mchoccac / snes9x-gtk

Automatically exported from code.google.com/p/snes9x-gtk
0 stars 0 forks source link

JMA loading broken on 64 bit #37

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Trying to load a JMA compressed rom fails when using the 64 bit binary.
It works when using the 32 bit binary though.

There probably are some 32 bit type assumptions in the jma code.

Original issue reported on code.google.com by friedric...@gmail.com on 7 Feb 2010 at 5:29

GoogleCodeExporter commented 9 years ago
"some" assumptions is an understatement. Pretty much the entire jma decoder 
takes
advantage of the "fact" that unsigned integers are 32 bits. It would take a lot 
of
work to fix this, so I really don't see it happening in the near-future.

Original comment by bear...@gmail.com on 7 Feb 2010 at 9:12

GoogleCodeExporter commented 9 years ago
That's understandable.
Maybe someone else will fix it before then, since zsnes and bsnes seem to be 
using 
the same code as well.

Thanks for all the great work though.

Original comment by friedric...@gmail.com on 7 Feb 2010 at 9:19

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
> Maybe someone else will fix it before then, since zsnes and bsnes seem to be 
using
the same code as well.

bsnes 64 bits fails to load JMA as well.
ZSNES, it seems, runs in 32 bits mode.

Quote from Byuu 
"Okay, JMA ... the thing is there's bugs in the libjma library. If you try and 
load a
JMA file with it, it throws an "invalid file" exception or something. Which of 
course
I catch, and it ends up just not loading the file at all. Nach knows his library
isn't compatible with 64-bit systems, but I think he's busy to fix it at the 
moment,
so I just avoid listing it on the 64-bit systems.

It's okay with ZSNES because ZSNES runs in 32-bit mode even on 64-bit systems."

Original comment by tsukuyom...@gmail.com on 10 Mar 2010 at 7:09

GoogleCodeExporter commented 9 years ago
Hum... some news from kode54 :)

http://board.byuu.org/viewtopic.php?p=12112#p12112

Original comment by tsukuyom...@gmail.com on 11 Mar 2010 at 8:00

GoogleCodeExporter commented 9 years ago
Great, it works.
I've integrated this into snes9x and made a patch against the svn HEAD.

The second patch additionally changes the type defines in jma/portable.h to C99 
types, which probably makes it less portable but also makes a lot more sense 
then 
guessing the type sizes, in my mind.

Original comment by friedric...@gmail.com on 13 Mar 2010 at 2:31

Attachments:

GoogleCodeExporter commented 9 years ago
For some reason subversion didn't notice that lzmadec.cpp was deleted and left 
it 
out of the patch, so here's a patch made with git that includes that.

Original comment by friedric...@gmail.com on 13 Mar 2010 at 2:48

GoogleCodeExporter commented 9 years ago
Apparently the added files were ignored as well, so here's a patch that's been 
actually tested. ;)

Original comment by friedric...@gmail.com on 13 Mar 2010 at 11:27

Attachments:

GoogleCodeExporter commented 9 years ago
And here's a new, less invasive patch based on the work of kode54 and Nach in 
the 
thread on byuu's board.
It should also retain, if not improve, portability.
I think this could actually be applied to svn.

Original comment by friedric...@gmail.com on 26 Mar 2010 at 4:47

Attachments:

GoogleCodeExporter commented 9 years ago
I've committed the new fix to this SVN and forwarded the info to the Snes9x 
boards.

Original comment by bear...@gmail.com on 27 Mar 2010 at 5:43

GoogleCodeExporter commented 9 years ago
Great, thanks!

Original comment by friedric...@gmail.com on 27 Mar 2010 at 8:47

GoogleCodeExporter commented 9 years ago
I just noticed that the fix actually seems to break jma support on 32 bit.
Aparrently the return of sizeof being unsigned long triggers some sign 
extension or 
integer promotion it shouldn't, resulting in an endless loop.
So it needs this cast to int to work for both 32 and 64 bit.

I didn't retest that little change, since I didn't think that could break 
anything.
Sorry about that.

Original comment by friedric...@gmail.com on 2 Apr 2010 at 3:09

Attachments:

GoogleCodeExporter commented 9 years ago
Ok, I committed the fix for the fix. I'm also going to mark this bug fixed, too.

Original comment by bear...@gmail.com on 4 Apr 2010 at 10:37