libretro / px68k-libretro

Portable SHARP X68000 Emulator for Libretro
http://hissorii.blog45.fc2.com
GNU General Public License v2.0
45 stars 40 forks source link

Core Crashes Loading Content on Self Compiled RetroArch #147

Closed Awakened0 closed 1 year ago

Awakened0 commented 2 years ago

I can load content fine with Win64 buildbot builds of RetroArch. But with a build compiled with msys2 myself, it crashes when loading content. I can start the core in my build, but if I try to exit the menu with F12 or L2 it crashes. This is the crash log I got:

https://pastebin.com/51B9kLeP

Awakened0 commented 2 years ago

A user on Discord managed to reproduce this crash with an official buildbot build of RetroArch. I'm not sure if it's helpful, but they included a regular log: https://pastebin.com/p81xNhn1

We are both trying to run the same game, Akumajou Dracula.

Jamiras commented 2 years ago

Here's a more detailed stack trace into the core:

>   px68k_libretro.dll!C68k_Exec(<unnamed-tag> * cpu, int cycle) Line 205   C++
    px68k_libretro.dll!WinX68k_Exec() Line 414  C++
    px68k_libretro.dll!exec_app_retro() Line 831    C++
    px68k_libretro.dll!retro_run() Line 1423    C++
    RetroArch-msvc2019.exe!core_run() Line 26714    C
    RetroArch-msvc2019.exe!runloop_iterate() Line 26040 C
    RetroArch-msvc2019.exe!rarch_main(int argc, char * * argv, void * data) Line 9237   C
    RetroArch-msvc2019.exe!main(int argc, char * * argv) Line 9318  C

where the failing line is simply NEXT. The exception is:

Exception thrown at 0x00007FFC07D8972F (px68k_libretro.dll) in RetroArch-msvc2019.exe: 
0xC0000005: Access violation reading location 0x000000009107FFB0.

where 09107FFB0 is CPU->PC and the FETCH_WORD macro is trying to dereference it.

I tried with Quarth and Image Fight.

Both core and RetroArch were built locally. I could also reproduce with the buildbot core. I could not reproduce with official 1.9.11 RetroArch, but neither game loaded either - they just sat at a black screen.

Awakened0 commented 2 years ago

Now I'm getting the crash with the latest win64 nightly RetroArch and px68k core. Just like others in the other recent issue reports.

bslenul commented 2 years ago

Yeah, basically if your MSYS2 setup is updated from at least February, there's a feature called "ASLR" that is enabled by default when building: https://www.msys2.org/news/#2021-01-31-aslr-enabled-by-default

And some cores don't like this feature at all for whatever reason (at least PicoDrive and NP2Kai are affected as well in some circumstances), so to build a working core you have to add these linker flags mentioned in the link.

Awakened0 commented 2 years ago

I got around to building the core with the extra linker flags. While it does work with official RetroArch nightlies from the buildbot, it still crashes with my Minimal builds made with msys2 in Github Actions. Maybe ASLR has to be disabled when building RetroArch as well?

gouchi commented 1 year ago

Hi,

The core should be available on buildbot now, otherwise you can get the build directly for i686 or x86_64.

If the issue is fixed after testing please close it.

Thank you.

Awakened0 commented 1 year ago

Yep, tested the latest buildbot build with my minimal RA build and no crashing!