New Playstation Emulator : Pcs2x


tuXXX

Still Fresh
Joined
May 9, 2008
Messages
19
Hi,

I bought a GP2X and got it 3 weeks ago (I'm travelling frequently by train these days so I have to do something ;)).
I've been using GNU/Linux for 4 years and I like coding.

I checked the available emulators and tried many of them (NES, MegaDrive...) when I saw the psx4gp2x PSX emulator.

I'm able to run Wip3out, but not at full speed (and I can't overclock to more than 250) so I tried to see how to improve it. But the source code of psx4gp2x is not available.

So I planned to port an open source emulator to the GP2X, the first thing is the choice of the emulator, but the only one available was Pcsx because every other one I looked at were closed-source (ePSXe? pSX?).
But this is only the core of the emulator, plugins are needed too, I took P.E.Op.S. SoftGPU as a GPU plugin (well, OpenGL isn't really available on the GP2X ;)) and cdriso (again, there is no CDrom drive on the GP2X).

From there I had to do many things : compile with the GP2X cross compiler, remove all x86 asm, reorganize of the source code to clean it and create a new build system, remove the plugin system and build plugins directly into the executable (they have to be in the correct license to do this, but the two plugins are compatible), remove every configuration utility and many configuration files, add SDL support to the gpu plugin, add a SDL pad plugin, add a sound plugin and check 2/3 more things.

SDL support is available in the GPU plugin, so it's really a good thing. I cleaned everything and built a good Makefile (I like doing this :p ). I created the SDL pad plugin and was able to test it on my computer. I created an empty SPU (sound) plugin.

And yes, I'm able to build it for the GP2X, the HLE is not working so it needs a real BIOS but, it runs!
It's (very) slow, I wasn't able to use the buttons to do anything, I should try to see what's wrong.
(I have a GP2X-F200 so I should buy the cradle to debug easily)

To those wanting to try it, here is an howto:
First download it, it's available as a bzr directory :
CODE
$ bzr clone http://tuxxx.zapto.org/bzr/pcs2x/

But since I think that many people don't want to use bzr, an archive is available here :
http://tuxxx.zapto.org/pub/pcs2x/ , named "pcs2x-v??.tar.bz2".
Ok now go to this directory and follow the following steps:
1) build it, first you may test it natively on your computer, the build command is something like this:
CODE
$ make CC=gcc-3.4.6 MYCFLAGS=-DPC

(currently it doesn't build with gcc 4, -DPC is used to tell the pad plugin to use the keyboard input)
The build command for the GP2X binary is:
CODE
$ make CC=arm-gp2x-linux-gcc TARGET=pcs2x.gpe

2) copy the file(s) to a directory (the x86 binary is useful here because you will be able to use it to test the settings)
3) copy the BIOS
The name of the BIOS must be "scph1001.bin".
CODE
$ cp path/to/scph1001.bin .

3) create the "fonts" folder and copy the font in it
I used the DejaVuMonoSans.ttf font since it's easily available on the net:
CODE
$ mkdir fonts
$ cp path/to/DejaVuMonoSans.ttf fonts/

4) create the cfg directory
CODE
$ mkdir cfg

5) create cfg/cdriso.cfg
QUOTE
IsoFile = path/to/your/rom.img

6) create cfg/gpuPeopsSoftX.cfg
QUOTE
ResX = 320
ResY = 240
NoStretch = 0
UseDither = 0
FullScreen = 0
ShowFPS = 1
ScanLines = 1
UseFrameLimit = 0
UseFrameSkip = 1
FPSDetection = 1
FrameRate = 30.0
CfgFixes = 0
UseFixes = 0

Now you should be able to run ./pcs2x, the BIOS should start and the game too.
The PC controls are :
Up/Down/Left/Right
Start : Enter
Space : Select
R : Triagle
G : Circle
V : Cross
D : Squaree

Ok now that it's working, just copy everything on the SD, start your GP2X and run pcs2x.gpe!

For those which don't want to do those steps, an archive named "pcs2x-v??-bin.tar.bz2" is available on http://tuxxx.zapto.org/pub/pcs2x/ , you only have to modify cfg/cdriso.cfg and add the BIOS file ;)

I don't know if someday it'll be playable (now it's something like 1 frame every 4 seconds ^^), but I'm already happy : it works!

I would really appreciate comments :) .
 
I don't want to sound critical or unsupportive, but you're basically just retracing the same early steps zodttd took with psx4all, which is also a PCSX port. It's not a very well known fact but he even released the source code eventually - I don't have a link but maybe he'll come by to give one.

psx4all eventually became a lot more than just a PCSX port - it has much more optimized GPU and SPU plugins (or so I hear with the SPU one, I haven't seen benchmarks with either though), and an ARM backend for the recompiler. It also has a lot of speed hacks that IMO it would be better off without having, but they can still do some good if experimented with heavily.

I have to warn you, unless you're an expert at emulation I don't think you're going to be able to do much better than zodttd has, or even come anywhere close.

(also this is totally just random opinion but I think a better name for the emulator might be "ps2x", I know the "c" is in there since it's a PCSX port but since yours isn't for PC it seems out of place.. it loses the PCSX in its name this way but it has the same style portmanteau in spirit)
 
tuXXX: Well done. If you need any help along your struggle with PCSX, let me know and I'll do my best to help. :)
 
Well done tuXXX - impressive after only 3 weeks!

I've also looked around for zodttd's source to no avail, but not have any luck - I would just be interested in 'having a nose around', not developing with it.

Maybe he'd be willing to pass it onto interested parties such as yourself...?
 
Does anyone know of any PSX documentation other than Joshua Walker's excellent document?

EDIT
Sorry for going slightly off topic, but it is slightly related. You can't improve the emulator if you don't understand how the stuff works under th hood. Good job on the port tuXXX.
 
Thanks to everybody supporting me :)

Exophase said:
I don't want to sound critical or unsupportive, but you're basically just retracing the same early steps zodttd took with psx4all, which is also a PCSX port. It's not a very well known fact but he even released the source code eventually - I don't have a link but maybe he'll come by to give one.

psx4all eventually became a lot more than just a PCSX port - it has much more optimized GPU and SPU plugins (or so I hear with the SPU one, I haven't seen benchmarks with either though), and an ARM backend for the recompiler. It also has a lot of speed hacks that IMO it would be better off without having, but they can still do some good if experimented with heavily.

I have to warn you, unless you're an expert at emulation I don't think you're going to be able to do much better than zodttd has, or even come anywhere close.

Sure, currently my main points are only the lack of source code and the fun of doing it.
I think that the process of porting and optimizing is interesting. And if someone is interesting in working on something, it'll be easier too :p

QUOTE
(also this is totally just random opinion but I think a better name for the emulator might be "ps2x", I know the "c" is in there since it's a PCSX port but since yours isn't for PC it seems out of place.. it loses the PCSX in its name this way but it has the same style portmanteau in spirit)

Good point, I'll thing about it ;)

Reesy said:
EDIT
Sorry for going slightly off topic, but it is slightly related. You can't improve the emulator if you don't understand how the stuff works under th hood.

No problem :)
 
Last edited by a moderator:
tuXXX said:
Thanks to everybody supporting me :)

Exophase said:
I don't want to sound critical or unsupportive, but you're basically just retracing the same early steps zodttd took with psx4all, which is also a PCSX port. It's not a very well known fact but he even released the source code eventually - I don't have a link but maybe he'll come by to give one.

psx4all eventually became a lot more than just a PCSX port - it has much more optimized GPU and SPU plugins (or so I hear with the SPU one, I haven't seen benchmarks with either though), and an ARM backend for the recompiler. It also has a lot of speed hacks that IMO it would be better off without having, but they can still do some good if experimented with heavily.

I have to warn you, unless you're an expert at emulation I don't think you're going to be able to do much better than zodttd has, or even come anywhere close.

Sure, currently my main points are only the lack of source code and the fun of doing it.
I think that the process of porting and optimizing is interesting. And if someone is interesting in working on something, it'll be easier too :p

QUOTE
(also this is totally just random opinion but I think a better name for the emulator might be "ps2x", I know the "c" is in there since it's a PCSX port but since yours isn't for PC it seems out of place.. it loses the PCSX in its name this way but it has the same style portmanteau in spirit)

Good point, I'll thing about it ;)

Reesy said:
EDIT
Sorry for going slightly off topic, but it is slightly related. You can't improve the emulator if you don't understand how the stuff works under th hood.

No problem :)
Glad to see you are not disheartened by some comments (realistic as some may be). Do this for your own fun, and if something comes of it we can all benefit. Enjoy and I look forward to any updates you release.
 
Last edited by a moderator:
Everyone's gotta start somewhere, keep it up! If you're one stubborn S.O.B., maybe one day you will write one from scratch :p

Let's have a Pcs2x vs gpSP2x sexy name contest! IMO neither of them contain enough X's, I think PcS3XXX sounds more enticing :rolleyes:
 
Nice project, tuXXX. Many luck and just go for it...

Regards,
Stephan
 
I know I'm jumping a bit late into the topic, but wouldn't it be faster to just ask zodttd to be let in/to view the sources?

Oh nevermind my comment, as the saying goes, a few months spent coding can save you a few seconds spent typing a PM ;)
 
take it as an advice, if you plan just a port of pcsx2 on gp2x, you'll get nothing faster than what psxp or ps1p did on PSP before POPS pops up. And don't expect for it to be better than psx4gp2x too.

1) interpreter is too slow on gp2x, so you really need an arm backend (dynarec)
2) cycles counting tends to be inaccurate (each MIPS instruction falsely counted as 1 cycle) : this is one issue i found out about psx4gp2x being quite sensitive even with its arm backend too.
3) this source has too many global variables and pointers : having a single big structure and arrays instead of pointers should remove extra memory accesses. If you don't see what I mean : "int *a, b; b = a;" ==> "tmp <- load_word(a); b <- load_word(tmp+i);" whereas " int a[128], b; b = a;" ==> "b <- load_word(a+i)".

etc.

Anyway, good luck !
 
As I said earlier it's mainly for the fun ;) I never planned to "beat" psx4gp2x in any way.
And well... I didn't found the link posted before, so maybe now I'll try hacking on psx4gp2x instead of this port. (but currently I don't really have time to do anything so it doesn't really matters :()
 
tuXXX said:
As I said earlier it's mainly for the fun ;) I never planned to "beat" psx4gp2x in any way.
And well... I didn't found the link posted before, so maybe now I'll try hacking on psx4gp2x instead of this port. (but currently I don't really have time to do anything so it doesn't really matters :()
In case you were looking for things to hack around with on the Gp2X it really could use a decent Gameboy/Gameboy color emu. The one out doesn't work if you have more than like 10 ROMs on your card and you can't specify the ROM dir, zip support is dodgy, the interface is frustratingly cumbersome. It would be a much easier project to start, and would really fill a needed gap nicely. The sources for GNUboy for Linux PCs can be used as a base. That may be a better project than trying to re-invent psx4gp2x, Just an idea.
 
Last edited by a moderator:
DaveC said:
tuXXX said:
As I said earlier it's mainly for the fun ;) I never planned to "beat" psx4gp2x in any way.
And well... I didn't found the link posted before, so maybe now I'll try hacking on psx4gp2x instead of this port. (but currently I don't really have time to do anything so it doesn't really matters :()
In case you were looking for things to hack around with on the Gp2X it really could use a decent Gameboy/Gameboy color emu. The one out doesn't work if you have more than like 10 ROMs on your card and you can't specify the ROM dir, zip support is dodgy, the interface is frustratingly cumbersome. It would be a much easier project to start, and would really fill a needed gap nicely. The sources for GNUboy for Linux PCs can be used as a base. That may be a better project than trying to re-invent psx4gp2x, Just an idea.


Good call

+1
 
Last edited by a moderator:
I wholeheartedly second that notion!
I also noticed that GNUBoy2x also seems to run a little too fast, like around 61 or 62 fps instead of 60.
 
There is actually a new GB/GBC emulator out now, Lemonboy2x by juanvvc. The interface is definitely much better and has proper zip support. Although, it runs okay, but could use some more improvements.

I wonder why it hasn't yet appeared in the News section. :huh:
 
Back
Top