The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
NES emulator in C w/SDL. crashing in linux, works in win32!
miker00lz


Joined: 15 Oct 2010
Posts: 4
i've been writing this NES emulator over the past month and a half using SDL. everything works like a charm when compiling and running on windows, but i've tried it on 2 linux systems and it compiles fine but after trying to start running the NES ROM it crashes with:

Code:
*** glibc detected *** ./moarnes: realloc(): invalid pointer: 0x00000000025d8430 ***



i'm positive it's an SDL issue, as i don't use a single realloc in the whole program. yes libsdl1.2-dev is installed on the machines i tried it with. i've also sent the program to a few people i know that also use linux and they have the same issue. and again, everything work 100% when running under windows.

the build script i made to compile the program invokes gcc like this:

Code:
gcc -o moarnes main.c 6502.c PPU.c APU.c font.c mappers.c -lSDL -I/usr/include/SDL -I/usr/local/include/SDL





i use SDL 1.2. does anybody have any ideas or suggestions? thanks. here is a zip of the code and build script if anybody else wants to give it a shot:

http://rubbermallet.org/moarnes-0.10.15.10-dev.zip

it's still very early in development, but it does already play the vast majority of mapper 0, 1, 2, 3, and 7 ROMs with no problems at all, or very minor glitches. i played megaman 2 from start to finish last night in it. Smile

if you actually end up trying a game in it, the controls are hardcoded for the time being. Z = B, X = A, right shift = select, enter = start. D toggles debug overlay, F toggles fullscreen.

and be prepared to see ugly code that needs to be cleaned up. thanks for helping!
miker00lz


Joined: 15 Oct 2010
Posts: 4
nobody has any ideas?