OpenXcom Forum

Contributions => Programming => Topic started by: Crazy Photon on July 07, 2014, 05:51:19 am

Title: Patch to fix crash issue on Mac OS X when using some weapon mods
Post by: Crazy Photon on July 07, 2014, 05:51:19 am
Hi folks,

Just wanted to post a patch I made to fix crashes (on Mac OS X) when enabling weapon mods that use gifs for the HANDOB images (e.g.: Combat Knife, Sniper Rifle, Minigun, GrenadeLauncher), in case anyone finds it useful.

Dev notes: Long story short, the problem is that SDL loads gifs as 32bpp surfaces on Mac OS X, and this patch adds a function to convert such surfaces back to 8bpp - note that the function requires a palette to do the conversion (for now, it uses the battlescape palette but it should probably do something smarter).

Cheers!
Title: Re: Patch to fix crash issue on Mac OS X when using some weapon mods
Post by: Warboy1982 on July 07, 2014, 12:29:01 pm
nice, we've been completely unable to diagnose/fix mac issues since forever, because none of us owns one. good to see someone's on the case :)
Title: Re: Patch to fix crash issue on Mac OS X when using some weapon mods
Post by: Nattfarinn on July 07, 2014, 09:50:53 pm
I just found the reason of Segmentation Faults I've had and and came here to post about it :). Well... Glad to see someone already made a fix for it.

Yup, it's SDL_image fault and it's not considered as a bug but a feature. It's because SDL_image on Mac uses the system "Core Image" processing.
Title: Re: Patch to fix crash issue on Mac OS X when using some weapon mods
Post by: Crazy Photon on July 08, 2014, 04:32:43 am
nice, we've been completely unable to diagnose/fix mac issues since forever, because none of us owns one. good to see someone's on the case :)
That's good to know then, if I find any issues I'll try to fix them then!
Title: Re: Patch to fix crash issue on Mac OS X when using some weapon mods
Post by: ziechael on November 06, 2014, 01:30:51 am
Forgive my ignorance but how do i apply this patch?

Thanks :)
Title: Re: Patch to fix crash issue on Mac OS X when using some weapon mods
Post by: Crazy Photon on November 06, 2014, 03:25:47 am
Steps (assuming some dev knowledge):

1. Fetch the code from github.
2. Go to the source folder.
3. Run the patch command: patch path-to-patch-file
4. Recompile
5. ???
6. Profit
Title: Re: Patch to fix crash issue on Mac OS X when using some weapon mods
Post by: ziechael on November 06, 2014, 11:11:30 am
Thanks for the super quick reply to an old thread, really appreciate it!

I'm not one for having to have his hand held but i'm certainly a noob when it comes to develop speak. I've figured out steps 3 and 4, not entirely sure i can pull the right face for 5 but will give it a go and always up for a bit of 6!

Now the hand holding part, can i just confirm that the attachment in the OP is the code? Or should i go searching github for it?
Also, what is classed as the source folder? <-- told you i was a noob!

Sorry to be a pain and thanks for helping us alienated maccers out there ;)
Title: Re: Patch to fix crash issue on Mac OS X when using some weapon mods
Post by: Crazy Photon on November 06, 2014, 02:30:14 pm
Hi! sorry I am going to be brief, don't have much time right now. Answers:

1. What I attached is the patch to apply.
2. W.r.t. the code, you can download from https://github.com/SupSuper/OpenXcom/, I recommend you install git, and then do a git clone of the repository. The source code is on the src folder.
3. For recompiling, I recommend installing Homebrew, then running the steps from the wiki: https://www.ufopaedia.org/index.php?title=Compiling_with_brew_(OpenXcom)