Open Thunderforge opened 2 years ago
This is indeed a known issue with any game that use mp3. This was reported on the forum a few times, and I have seen the issue myself. However it looks like we never created a bug report for it. So thank you for doing it.
My conclusion were the same as yours, and I am indeed hoping that recompiling libmad for iOS will fix the issue. I just never go around to doing it. This is listed as a task in our iOS/Android Trello board.
Drascula is a good game to use for testing as it is available from our download page with a mp3 music addon available, and it crashes right at the start.
Oh very good, I'm glad it wasn't just me.
Thanks for keeping up the ios support, criezy. I love having Dagger of Amon-Ra on me at all times; it's a security blanket and genuinely hilarious.
There should be a competition to see who has the funniest organization codesigning their phone's ScummVM. =)
This would be nice to get fixed before the release.
I'm not sure what builds scummvm-ios7-libs-v2.zip
, but the md_size.diff
and length-check.patch
patches for libmad in https://deb.debian.org/debian/pool/main/libm/libmad/libmad_0.15.1b-10.diff.gz could help, I believe.
libmad.a is a fat MachO with 4 architectures: arm, arm64, x86, x86_64. libmad.h is an include file with platform specific defines which seem to come from x86 build (note the FPM_INTEL define).
I suspect that the overflow comes from this discrepancy between the header used by ScummVM code to allocate the structure and the code included in libmad.a.
I've ripped and encoded the King's Quest 6 end credits CD track to track1.mp3 but the IOS build crashes immediately upon playback. Windows and Mac builds work. I've tried several unrelated mp3s. Failure occurs during construction of MP3Stream due to libmad's mad_synth_frame() writing beyond its struct and corrupting adjacent values. This looks unrelated to the game or CD-audio context in which it's being used. I think any mp3 playback with MP3Stream would crash.
I debugged this sequence:
I'm building with Xcode 12.4 (latest) on an M1 with macos 11.2.3 (latest) for an iphone 12 mini with ios 14.4.1. I'm using the instructions on the wiki and scummvm-ios7-libs-v2.zip. I tripped this a few months ago with earlier versions and now got around to debugging it.
To reproduce with attached KQ6 CD save:
I suspect that any MP3Stream usage from any engine will trigger this. I'm hoping something is just off about the prebuilt libmad. Happy to help test.
kq6-cd.025.zip