aliens

Author Topic: Patch to fix crash issue on Mac OS X when using some weapon mods  (Read 7061 times)

Offline Crazy Photon

  • Squaddie
  • *
  • Posts: 8
  • Resistance is NEVER Futile!
    • View Profile
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!

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Patch to fix crash issue on Mac OS X when using some weapon mods
« Reply #1 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 :)

Offline Nattfarinn

  • Sergeant
  • **
  • Posts: 11
    • View Profile
Re: Patch to fix crash issue on Mac OS X when using some weapon mods
« Reply #2 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.

Offline Crazy Photon

  • Squaddie
  • *
  • Posts: 8
  • Resistance is NEVER Futile!
    • View Profile
Re: Patch to fix crash issue on Mac OS X when using some weapon mods
« Reply #3 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!

Offline ziechael

  • Squaddie
  • *
  • Posts: 7
    • View Profile
Re: Patch to fix crash issue on Mac OS X when using some weapon mods
« Reply #4 on: November 06, 2014, 01:30:51 am »
Forgive my ignorance but how do i apply this patch?

Thanks :)

Offline Crazy Photon

  • Squaddie
  • *
  • Posts: 8
  • Resistance is NEVER Futile!
    • View Profile
Re: Patch to fix crash issue on Mac OS X when using some weapon mods
« Reply #5 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

Offline ziechael

  • Squaddie
  • *
  • Posts: 7
    • View Profile
Re: Patch to fix crash issue on Mac OS X when using some weapon mods
« Reply #6 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 ;)

Offline Crazy Photon

  • Squaddie
  • *
  • Posts: 8
  • Resistance is NEVER Futile!
    • View Profile
Re: Patch to fix crash issue on Mac OS X when using some weapon mods
« Reply #7 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)