With cordite in the air, splintered steel, shell casings and powder burns, there’s only one explanation...
Discuss & improve the game engine.

Moderators: Tequila, sparcdr, torhu

Fixing a crash when starting SG on OS X Yosemite

Postby duncanisgoed » Sun Jul 26, 2015 3:44 pm

Hello everyone,

Recently I wanted to install Smoking' Guns on Yosemite because I didn't bring my Windows laptop, but it crashed immediately after I started it with a stack trace like this:

Code: Select all
Crashed Thread:        1  Dispatch queue: com.apple.libdispatch-manager

Exception Type:        EXC_CRASH (SIGSEGV)
Exception Codes:       0x0000000000000000, 0x0000000000000000

Thread 0:: 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               0x01bb57b2 QZ_GetGammaRamp + 106
3   libSDL-1.2.0.dylib               0x01ba551d SDL_GetGammaRamp + 183
4   libSDL-1.2.0.dylib               0x01ba5696 SDL_SetGammaRamp + 294
5   libSDL-1.2.0.dylib               0x01ba5928 SDL_SetGamma + 401
6   net.smokin-guns.www              0x00196aeb GLimp_Init + 662
7   net.smokin-guns.www              0x000ec7c6 InitOpenGL + 46
8   net.smokin-guns.www              0x000efa4a R_Init + 1004
9   net.smokin-guns.www              0x000f9d28 RE_BeginRegistration + 25
10  net.smokin-guns.www              0x0001a281 CL_InitRenderer + 33
11  net.smokin-guns.www              0x0001a343 CL_StartHunkUsers + 73
12  net.smokin-guns.www              0x0003e7d8 Com_Init + 1937
13  net.smokin-guns.www              0x0011a1bd SDL_main + 635
14  net.smokin-guns.www              0x00197044 -[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 Smoking' Guns.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

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.

In the folder there is another game that uses libSDL-1.2.0.dylib (OpenArena). The same fix works for that game.

Hope this helps some people,

Duncan
duncanisgoed
Newcomer
 
Posts: 1
Joined: Sun Mar 15, 2009 4:17 pm



Re: Fixing a crash when starting SG on OS X Yosemite

Postby Barto » Tue Jul 28, 2015 11:05 am

Hi Duncan and welcome to the forum :-)

Thanks for the quickfix, it might be useful for someone else. We do not have any Apple products around and each OSX version is bringing their breakage which noone out of the OSX ecosystem knows how to fix.

duncanisgoed wrote: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.

It is, but only the ioquake3 engine! To port the game to SDL2, one should just need to rebase on ioquake's master branch. Easy to say I know, but Tequila was too busy to make it. Family and real life obligations first, you know.
"Chuck Norris had to shorten his beard in the presence of Richard Stallman because two beards that awesome, so close would segfault the universe (again)."
User avatar
Barto
Jeuxlinux Admin
 
Posts: 329
Joined: Fri Oct 23, 2009 5:08 pm
Location: Switzerland




Return to Code

Show Sidebar
Show Sidebar

User Control Panel