GP2X Prboom 2.5.0B Crashing With Add-Ons


Super Jamie

Still Fresh
Joined
Feb 26, 2007
Messages
80
Age
39
Location
Brisbane, AU
Website
linuxaleph.blogspot.com
Hello all. It's been a long time since I've been around here, though I still have my F100-Mk2 with v2.1.1 firmware. I see Open2x is out now which is pretty exciting!

PrBoom for GP2X is currently the latest upstream version (2.5.0) however it only works well for the original levels. When trying to load add-ons (whether it's a fairly basic single map or a large mapset) the port either crashes with memory allocation errors or a segfault. This was not a problem with earlier the earlier version 2.2.6b4, and I'd like to fix it if I can.

mongolito404 who ported 2.2.6b4 lost his source and binaries, and has stated he's moved on from the port. I have binaries of b1, b2, b3 and b4 saved on my PC, so I've mirrored b4 on Sendspace and put a link on the Wiki PrBoom page. The changelog indicates this was compiled on an old toolchain by someone called oopo, with Paeryns' SDL and Guyfawkes' SDL Test Release.

Pickle performed the port of 2.5.0, then released the 2.5.0b fix to move savegames from NAND to SD. Are you still around, Pickle? The changes from official 2.5.0 to GP2X 2.5.0 are fairly trivial, just removal of a few #defines and addition of the GP2X control code. I'm no C programmer but the changes shouldn't break the game, and I've had two current Doom community devs confirm this. Pickle's port was compiled with the Open2x Toolchain, so I'm thinking perhaps there's some GP2X-specific issue with GCC4 or later SDL or something like that.

I'll have a read around and try setup a couple of different dev environments and pray I don't get any compiler errors. I see these forums are still partially active, so I was wondering if anyone had any tips or similar experience which would be of assistance?

Thanks for reading, any help at all would be appreciated.
 

Pickle

Mega GP Mania
Joined
May 30, 2006
Messages
5,516
Location
Detroit, Michigan
Website
Visit site
im always around :)

I think its a out of memory issue, why it occuring with 2.5.0 and not the previous releases, I dont know. I didnt really change much to the 2.5.0 release. Yes I do use the open2x toolchain and libraries. The SDL lib should be very close or the same to paeryn's versions.
 

Super Jamie

Still Fresh
Joined
Feb 26, 2007
Messages
80
Age
39
Location
Brisbane, AU
Website
linuxaleph.blogspot.com
Cool :)

The error on small PWADs is apparently allocating 4Gb RAM:
Code:
R_LoadTrigTables: Endianness...ok.
R_InitData: Textures Z_Malloc: Failure trying to allocate 4228103872 bytes
Z_Malloc: Failure trying to allocate 4228103872 bytes

And on larger PWADs (like HR) is just a straight segfault:
Code:
I_UpdateVideoMode: 320x240 (fullscreen)
I_SignalHandler: Exiting on signal: signal 11

Your port is good and clean and isn't the cause of the issues. Obviously Doom doesn't need 4Gb RAM and really should run in the ~19.5Mb free to apps on a fresh boot with Gmenu2x, I'm thinking perhaps we have some weird platform-specific compiler/library problem?

I tried to setup an Official SDK but svn.gp2x.com is no longer up (it looks like the whole domain is dead), same with gp32spain.com which gamkiller's SDK script uses. The libpack for Open2x with GCC3 is not available for download at the moment. Even building with the latest Open2x GCC4 I got some odd compiler errors I'm not sure how to troubleshoot.

Edit: I just found alot of built SDKs in the archives' Utilities section, and the official SDK is still up at http://dev.gp2x.com/sdk/ so I'll give these a go.
 

Pickle

Mega GP Mania
Joined
May 30, 2006
Messages
5,516
Location
Detroit, Michigan
Website
Visit site
Super Jamie said:
Cool :)

The error on small PWADs is apparently allocating 4Gb RAM:
Code:
R_LoadTrigTables: Endianness...ok.
 R_InitData: Textures Z_Malloc: Failure trying to allocate 4228103872 bytes
 Z_Malloc: Failure trying to allocate 4228103872 bytes

And on larger PWADs (like HR) is just a straight segfault:
Code:
I_UpdateVideoMode: 320x240 (fullscreen)
 I_SignalHandler: Exiting on signal: signal 11

Your port is good and clean and isn't the cause of the issues. Obviously Doom doesn't need 4Gb RAM and really should run in the ~19.5Mb free to apps on a fresh boot with Gmenu2x, I'm thinking perhaps we have some weird platform-specific compiler/library problem?

I tried to setup an Official SDK but svn.gp2x.com is no longer up (it looks like the whole domain is dead), same with gp32spain.com which gamkiller's SDK script uses. The libpack for Open2x with GCC3 is not available for download at the moment. Even building with the latest Open2x GCC4 I got some odd compiler errors I'm not sure how to troubleshoot.

Edit: I just found alot of built SDKs in the archives' Utilities section, and the official SDK is still up at http://dev.gp2x.com/sdk/ so I'll give these a go.

official SDK is junk, ethier use the open2x one or use the devkitgp2x.
When you showed that 4gb, I wonder if theres a misalignment in the code, its easy to detect by telling the kernel to signal.
 
Last edited by a moderator:

Super Jamie

Still Fresh
Joined
Feb 26, 2007
Messages
80
Age
39
Location
Brisbane, AU
Website
linuxaleph.blogspot.com
Pickle said:
official SDK is junk, ethier use the open2x one or use the devkitgp2x.
When you showed that 4gb, I wonder if theres a misalignment in the code, its easy to detect by telling the kernel to signal.
I have been trying both Open2x and devkitGP2X. I had to remove I_EndDoom altogether from src/SDL/i_main.c, and pr_config.sh puts the wrong things in config.h under devkitGP2X depending on which SDL libs I'm using but they can be manually fixed. I keep getting errors either with SDL version being rejected or other SDL errors later on. Do I need to point the paths in the SDL*.la files to where my toolchain is stored?
 
Last edited by a moderator:

Pickle

Mega GP Mania
Joined
May 30, 2006
Messages
5,516
Location
Detroit, Michigan
Website
Visit site
Super Jamie said:
Pickle said:
official SDK is junk, ethier use the open2x one or use the devkitgp2x.
When you showed that 4gb, I wonder if theres a misalignment in the code, its easy to detect by telling the kernel to signal.
I have been trying both Open2x and devkitGP2X. I had to remove I_EndDoom altogether from src/SDL/i_main.c, and pr_config.sh puts the wrong things in config.h under devkitGP2X depending on which SDL libs I'm using but they can be manually fixed. I keep getting errors either with SDL version being rejected or other SDL errors later on. Do I need to point the paths in the SDL*.la files to where my toolchain is stored?

Sounds like your linker paths are not correct. I could help better if you posted the actual errors.
I do remember there being a couple of defines thats were not correct in the config.h.

Can you provide a link to a legal wad that causes the memory problem?
 
Last edited by a moderator:

Super Jamie

Still Fresh
Joined
Feb 26, 2007
Messages
80
Age
39
Location
Brisbane, AU
Website
linuxaleph.blogspot.com
Pickle said:
Sounds like your linker paths are not correct. I could help better if you posted the actual errors.
I do remember there being a couple of defines thats were not correct in the config.h.

Can you provide a link to a legal wad that causes the memory problem?

Compiling with Open2x Precompiled Toolchan and Precompiled Libraries from the Open2x wiki, I get the following:

Code:
arm-open2x-linux-gcc  -g -O2 -Wall -Wno-unused -Wno-switch -Wextra -Wno-missing-field-initializers -Winline -Wwrite-strings -Wundef -Wbad-function-cast -Wcast-align -Wcast-qual -Wdeclaration-after-statement -ffast-math -O2 -fomit-frame-pointer -I../src -I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include/SDL -D_REENTRANT  -s -static -L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib -o prboom mmus2mid.o am_map.o g_game.o p_mobj.o r_demo.o r_segs.o hu_lib.o lprintf.o p_plats.o r_sky.o d_deh.o hu_stuff.o m_argv.o p_pspr.o m_bbox.o p_saveg.o r_things.o d_items.o m_cheat.o p_setup.o s_sound.o d_main.o p_sight.o sounds.o m_menu.o p_spec.o info.o st_lib.o m_misc.o p_switch.o p_telept.o st_stuff.o m_random.o p_tick.o tables.o p_user.o p_ceilng.o v_video.o doomdef.o p_doors.o p_enemy.o r_bsp.o version.o doomstat.o p_floor.o r_data.o w_wad.o p_genlin.o dstrings.o p_inter.o wi_stuff.o r_draw.o f_finale.o p_lights.o z_bmalloc.o p_map.o r_main.o f_wipe.o z_zone.o p_maputl.o r_plane.o md5.o p_checksum.o r_patch.o r_fps.o r_filter.o d_client.o  w_mmap.o SDL/libsdldoom.a   -L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib -Wl,-rpath,/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib -lSDL -lpthread   -lm 
SDL/libsdldoom.a(i_system.o): In function `I_SetAffinityMask':
/home/superjamie/Desktop/prboom-2.5.0/src/SDL/i_system.c:446: undefined reference to `CPU_ZERO'
/home/superjamie/Desktop/prboom-2.5.0/src/SDL/i_system.c:450: undefined reference to `CPU_SET'
collect2: ld returned 1 exit status
make[3]: *** [prboom] Error 1
make[3]: Leaving directory `/home/superjamie/Desktop/prboom-2.5.0/src'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/superjamie/Desktop/prboom-2.5.0/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/superjamie/Desktop/prboom-2.5.0'
make: *** [all] Error 2

With devkitGP2X I have to manually comment the appropriate lines in config.h file, as well as change a few references of "/home/brendan" in all Makefiles plus a few others to "/opt/devkitGP2X".

This map of mine should provide the 4Gb error, it's Doom2 MAP01. Hell Revealed should produce segfault.

If you make a very simple map with just a player start and two adjacent 128x128 sectors it does actually launch fine with your 2.5.0b binaries.
 
Last edited by a moderator:

Pickle

Mega GP Mania
Joined
May 30, 2006
Messages
5,516
Location
Detroit, Michigan
Website
Visit site
I did some tests and im right, theres code that is unaligned. A temporary fix is to add this at the beginning of the script, i was able to load your custom wad:
echo 4 > /proc/cpu/alignment
 

Super Jamie

Still Fresh
Joined
Feb 26, 2007
Messages
80
Age
39
Location
Brisbane, AU
Website
linuxaleph.blogspot.com
Pickle said:
I did some tests and im right, theres code that is unaligned. A temporary fix is to add this at the beginning of the script, i was able to load your custom wad:
echo 4 > /proc/cpu/alignment
Strangely that does not work for me.

With megawads I get:
Code:
W_AddFile: couldn't open HR.WAD

With my small map I get:
Code:
R_LoadTrigTables: Endianness...ok.
R_InitData: Textures SDL_GP2X: Freeing cursor 0x2ddd98

This is on an F100 with Firmware 2.1.1, do you think it would help upgrading to Open2x?
 
Last edited by a moderator:
Top