libretro / gpsp

gpSP for libretro.
GNU General Public License v2.0
55 stars 53 forks source link

[Vita] Crash in Golden Sun when obtaining specific djinn #133

Closed edwardz closed 3 years ago

edwardz commented 3 years ago

When a particular djinn in the Mercury Lighthouse is defeated, gPSP just crashes during the "rain" animation of obtaining the djinn. I believe this is the same issue as referenced in this reddit thread: https://www.reddit.com/r/GoldenSun/comments/ew6nm3/consistent_game_freeze_after_acquiring_a_djinn/

I've attached my save file to reproduce the issue: Golden Sun (USA, Europe).sav.zip

When you load the save, you'll need to battle the djinn (the blue monster) but it shouldn't take more than a minute to win the battle. Just spam "attack" and the djinn will be defeated. When Issac then obtains the djinn, there will be a rain animation, and then gPSP will just crash.

davidgfnet commented 3 years ago

Cool! I can try take a look at this. Did you check whether it works with dynarec disabled? If it does, we have a workaround for the time being. Also helps me to fix it (since I can compare the two emus). Thanks for the save! That's awesome. Can you also paste the hash of the ROM you used? Are you using the original GBA bios as well? (Or the builtin one?)

edwardz commented 3 years ago

Hey thank you so much for agreeing to take a look!

davidgfnet commented 3 years ago

Awesome! I will take a close look at it then, since having a mode that works makes it easier to debug and potentially fix. Btw you using the most recent version I suppose? Fixed a couple of rare bugs not long ago

edwardz commented 3 years ago

To be perfectly honest, I've been holding off on doing so because of this thread: https://www.reddit.com/r/RetroArch/comments/n6npai/ps_vita_version_192_gba_core_gpsp_glitches/

But I might just do it in the next day or two for testing this issue.

davidgfnet commented 3 years ago

So you are reporting a bug on an old gpsp? What if the bug is already fixed in the latest version? Please avoid wasting other humans' time and check the latest version before filing an issue. In the event I/we fix this bug, it will only be fixed in the latest version (we do not backport fixes!), so you wont be able to use it. I hope it makes sense.

edwardz commented 3 years ago

Just updated my Vita to the newest Retroarch (v1.9.5) with the gpSP core (v0.91 261b2db) and the crash still happens.

I understand the fix wouldn't backported. The hope was the once the issues from the Reddit thread above gets resolved, I would be able to finally be able to safely update Retroarch and have this fix working as well. Without knowing that there has been some rare bugs that got fixed recently, my thought process was that since this appears to be a bug in the core for at least 1 year, the bug probably still went unnoticed in the core. But you are right. This should not be a safe assumption to make. I apologize.

davidgfnet commented 3 years ago

No worries! Just wanted to make sure you understood how things work over here :) Ok I will then take a look at this closely, given that I have a save file and a potential way to reproduce it. Will let you know if I have issues reproducing it or any other question. Thanks!

davidgfnet commented 3 years ago

@edwardz I managed to reproduce this bug on PC and ARM (although I didnt use my Vita to test) and fix it. Can you please confirm this indeed fixes the issue for you? You will need to wait for the next nightly build though :) Many thanks for the save file provided, the fix was only possible thanks to that file and the instructions provided to reproduce it. As a funny note, this bug doesn't seem to trigger if the open bios is used (if you remove the original GBA bios it should work). Took me a while to reproduce due to this :P

edwardz commented 3 years ago

Amazing, thank you so much! I'm so glad the save file proved useful. That's pretty ironic that the crash only happens with the original GBA bios and not the other way around, you'd normally think it's the other way around :joy:

davidgfnet commented 3 years ago

Usually game bugs appear with unofficial bios indeed, but this particular case was a bug in the emulator itself, not in the game or bios. That's why the interpreter worked well. I spent probably 1h trying to reproduce this and then read your reddit post where it says it happens on PSP (which is MIPS and not ARM). My bad! But at least we fixed this! This probably fixes a few very rare bugs on some random games. Interestingly enough this bug is 100% reproducible in Golden Sun across all savegames it seems (since other people complain too). It's awesome that we could fix this. Thanks!

edwardz commented 3 years ago

All the thanks goes to you, I appreciate all the work you put into keeping this emulator alive!