OpenArena Message Boards

OpenArena => General => Topic started by: duncanisgoed on July 31, 2015, 06:26:35 AM



Title: [FIX] Fixing a crash when starting OpenArena on OS X Yosemite
Post by: duncanisgoed on July 31, 2015, 06:26:35 AM
Hello everyone,

Recently I wanted to use OpenArena on Yosemite, but it crashed immediately after I started it with a stack trace like this:

Code:
Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x00000000134d3000

VM Regions Near 0x134d3000:
    MALLOC_SMALL           00000000134d0000-00000000134d3000 [   12K] rw-/rwx SM=COW  
-->
    MALLOC_TINY            0000000013500000-0000000013700000 [ 2048K] rw-/rwx SM=PRV  

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.apple.CoreGraphics         0x96d575d9 interpolate_table + 165
1   com.apple.CoreGraphics         0x96d5748f CGSGetDisplayTransferByTable + 249
2   libSDL-1.2.0.dylib             0x01b1136f QZ_GetGammaRamp + 105
3   libSDL-1.2.0.dylib             0x01b02f4f SDL_GetGammaRamp + 230
4   libSDL-1.2.0.dylib             0x01b030ee SDL_SetGammaRamp + 326
5   libSDL-1.2.0.dylib             0x01b03380 SDL_SetGamma + 401
6   ws.openarena.OpenArena         0x00159636 GLimp_Init + 349
7   ws.openarena.OpenArena         0x000ffbdc InitOpenGL + 34
8   ws.openarena.OpenArena         0x00102ade R_Init + 1026
9   ws.openarena.OpenArena         0x0010c775 RE_BeginRegistration + 25
10  ws.openarena.OpenArena         0x00018148 CL_InitRenderer + 33
11  ws.openarena.OpenArena         0x0001820a CL_StartHunkUsers + 73
12  ws.openarena.OpenArena         0x0003b3cd Com_Init + 1720
13  ws.openarena.OpenArena         0x00126f83 SDL_main + 380
14  ws.openarena.OpenArena         0x00159e9c -[SDLMain applicationDidFinishLaunching:] + 75

The 'fix' I came up with is to patch libSDL to fail on SDL_SetGammaRamp. It breaks the 'Brightness' setting, but the game is perfectly playable apart from that.

This is a link to my MEGA folder with the modified libSDL source code and also a fixed Open Arena.app file. Basically all you have to do is replace libSDL-1.2.0.dylib with the compiled version.

Link: libSDL-1.2.15 SetGammaRamp fix (https://mega.co.nz/#F!HpgWWQjJ!6Owrf5lfjA03cfQhyKoMLw)

An actual fix would be to port the engine to libSDL-2.0. I did some attempts, but I don't have enough understanding of the engine (yet) to do it so I decided to fix it like this instead.

Hope this helps some people,

Duncan

PS I don't know if this is the right section. Please move it if incorrect.


Title: Re: [FIX] Fixing a crash when starting OpenArena on OS X Yosemite
Post by: fromhell on July 31, 2015, 07:06:04 AM
another fix is to just do brightness and gamma via GLSL shader, which I'm doing in the current git repo.  ARB shader probably is also possible, but it's arb and I don't know arb



Title: Re: [FIX] Fixing a crash when starting OpenArena on OS X Yosemite
Post by: grey matter on August 01, 2015, 06:28:39 PM
ioquake3 is using SDL 2 already, so you might want to merge their upstream changes.