libretro / parallel-n64

Optimized/rewritten Nintendo 64 emulator made specifically for Libretro. Originally based on Mupen64 Plus.
309 stars 128 forks source link

Fix for segfault and saving issues #707

Closed mammo0 closed 3 years ago

mammo0 commented 3 years ago

Hello,

on my Android device I stumbled over #688 (and the corresponding ones: #571, #580, #592, #636, #684). Like @thekiefs said there the issue was not fixed entirely by PR #637.

So I had a look into it and at least for me I found an easy fix. Thanks @mrfixit2001 for pointing me in the right direction.

Basically it is the stop variable that is used in some methods of the file mupen64plus-core/src/r4300/r4300.c. Like @mrfixit2001 said, on ARM devices this variable is used, but it's not defined, because of lines

#if NEW_DYNAREC < NEW_DYNAREC_ARM
int stop;
int64_t reg[32], hi, lo;
[...]
#endif

When compiling for ARM devices the variable stop gets never defined, because the condition above will then be #if 3 < 3 (for 32bit ARM) or #if 4 < 3 (for 64bit arm), which is never true. So my "fix" is basically to detach the variable out of this if clause.

Hope this also helps others.


If someone wants to try if this fix works for her/his case, then you can use these binaries (32 and 64bit): android.zip These are compiled on the latest master (29e7f39) with my fix.

mammo0 commented 3 years ago

Hm, I weren't aware of the file linkage_arm.S. It seems like there's also a definition of the stop variable.

But then I don't know why the definition in the linkage_arm.S file is not sufficient. It compiles but fails with a seg fault. In my case, if there is the double definition, it works. Very strange... Maybe some of the maintainers can help here.