GP2X Problem With Porting Snes9x


STTrife

Member
Joined
Jun 25, 2006
Messages
160
Hello, I'm trying to port snes9x to the GP2X (just for fun, I know it's already done)
Now I got it compiling and added some code to initialise snes9x and load a ROM (and try to play it)

now first I get some warning when compiling it that could cause the malfunction like these:
---------------------------
594 D:\temp\snes9x-1.5-src\snes9x-1.5-src\srtc.cpp [Warning] right shift count >= width of type
595 D:\temp\snes9x-1.5-src\snes9x-1.5-src\srtc.cpp [Warning] right shift count >= width of type
----------------

(I downloaded the 1.5 source from snes9x.com)

I don't know if that part could cause any troubles.
The port crashes at the main loop of snes9x. Here is the debugging output (on the gp2x itself)

---------------------------------
Found ROM file header (and ignored it)."CHRONO TRIGGER" [checksum ok] HiROM, 32M
bits, Type: ROM+RAM+BAT, Mode: 21, TV: NTSC, S-RAM: 8KB, ROMId: ACTE Company: C3
CRC32: 2D206BF7LOADING ROM DONE

Program received signal SIGSEGV, Segmentation fault.
0x000477a4 in Immediate8 (a=JUMP) at cpuaddr.h:158
158 cpuaddr.h: No such file or directory.
in cpuaddr.h
(gdb) backtrace
#0 0x000477a4 in Immediate8 (a=JUMP) at cpuaddr.h:158
#1 0x0005af7c in Relative (a=JUMP) at cpuaddr.h:194
#2 0x0005c754 in Op80Slow () at cpuops.cpp:1591
#3 0x00046544 in S9xMainLoop () at cpuexec.cpp:273
#4 0x0000ae30 in main (argc=1, argv=0xbffffdf4) at main.cpp:158
----------------------------------


as you can see the rom is loaded (chrono trigger), but somewhere in the inline function:


-----
STATIC inline uint8 Immediate8 (AccessMode a) {
uint8 val = CPU.PCBase[Registers.PCw];
-----


(at the second line) it goes wrong. (segmentation fault)

At the point of the error, CPU.PCBase = 0x0

---
(gdb) print CPU.PCBase
$1 = (uint8 *) 0x0
---

Now I am not really into emulators, so I can't easily find out what's wrong. Maybe someone with knowledge of snes9x has any idea where this error comes from?

or maybe knows a good way to find out where the error comes from?

thanks!
 
thats great news by the way. maybe we can get another good snes emu. hope you have fun and continue your work until its complete :)
 
Well I got the port working, however the speed is very bad and for some reason the sound doesn't work yet (but I can fix that soon I think)

the thing is I would need some expert to give me some pointers on how to start optimizing. I think I need to find the bottleneck first (or else I will be optimizing stuff that doesn't need it :p ). But I have no clue how I could find out where the bottleneck is.

If some expert can give me some hints that would be very helpfull :)
I always found emulators very interesting but never really got into it yet.

And also if someone has more advanced documentation for snes9x that would be very helpfull! (currently there is some, but not enough for me)
 
is the source code of squidge snes open for everybody? if yes maybe you can help optimize squidge with this emu. you know it's not only squidges emu anymore ;)
 
STTrife posted on Jul 4 2006 at 11:11 AM said:
Well I got the port working, however the speed is very bad and for some reason the sound doesn't work yet (but I can fix that soon I think)

the thing is I would need some expert to give me some pointers on how to start optimizing. I think I need to find the bottleneck first (or else I will be optimizing stuff that doesn't need it :p ). But I have no clue how I could find out where the bottleneck is.

If some expert can give me some hints that would be very helpfull :)
I always found emulators very interesting but never really got into it yet.

And also if someone has more advanced documentation for snes9x that would be very helpfull! (currently there is some, but not enough for me)

Radek. :)

P.S. I don't mean bother radek about it, it's just that he is a freaking genius! ;)
 
Last edited by a moderator:
Back
Top