Hello, I'm using the library in Wii homebrews and I'm having a crash with the Amiga Oktalyzer (OKT) format. The same okta file works fine on Windows but it seems like the Wii is little more picky for file handling.
Here is the fix I did to make it work.
Replace this code in load_okt.c:
while (1) { /* read block header */ _mm_read_UBYTES(id, 4, modreader); len = _mm_read_M_ULONG(modreader); if (_mm_eof(modreader)) break; fp = _mm_ftell(modreader);
Whit this one:
while (!_mm_eof(modreader)) { /* read block header */ _mm_read_UBYTES(id, 4, modreader); len = _mm_read_M_ULONG(modreader); fp = _mm_ftell(modreader);
The only thing I did is to check for the End Of File earlier in the process. I suspect that mmreadUBYTES and mmreadMULONG were call and the eof was already reached. On the Wii it was giving a code / stack dump screen. I like this fix, because for some reason I'm a bit alergic to while (1) :)
Now I have a question unrelated to the issue. Is there a reason why the code uses Mercurial? I know it was like that when you came into the project, but moving to Git would be nice. Moving to GitHub would even be nicer :)
Thanks! See commit: (I kept the eof check in the loop, just in case..)
https://sourceforge.net/p/mikmod/mercurial/ci/a7b28d393e82cbdbf727dc6160d18265984fb4f8/
Closing this as fixed. If it is not, please re-open.
As for hg vs git: I am OK with both (I got somewhat more familiar with git, even)
but as you said it was with hg when I got involved :) Maybe I move to git later,
don't know.
OK, thank you for the fix.
Last edit: S. Michel 2017-02-14
Hello, I think I wrote this issue to quickly.
The changes I recommanded seems to be OK according to the OKT file format here: http://jss.sourceforge.net/moddoc/okt-form.txt
But I found out that it was crashing because of mm_eof implementaion. It was loping forever because my EOF function was wrong. This is what was causing the crash.
So I guess it's OK to revert your commit a7b28d393e82cbdbf727dc6160d18265984fb4f8.
Sorry for the inconvenient.
Done.
No worries at all.
Migrated to git. A mirror is at https://github.com/sezero/mikmod.git