libretro / gpsp

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

Some example of demanding games which are not working #178

Open schmurtzm opened 1 year ago

schmurtzm commented 1 year ago

Hi, you'll find here a quick compatibility table of gpSP : https://github.com/OnionUI/Onion/issues/560#issuecomment-1264444736

Other example here : docs.libretro.com/library/compatibility/gba/#gpsp and here at the bottom of the list : wiki.maemo.org/GpSP/Game_Compatibility

Many of these are not working on Windows (Retroarch 1.10.3 , last build of gpSP 81649a2) and also on Miyoo Mini (linux handheld) with the same behavior.

andymcca commented 1 year ago

Interesting, will have a test of some of these to see if there's anything that can be done.

andymcca commented 1 year ago

OK, I started with Colin Mcrae Rally - confirmed that this crashes at the same point on my Leapster Explorer using the latest RetroArch / gpSP builds. It ALSO crashes at the same place using gpSP standalone.

Now, here's two interesting things -

1) It DOESN'T crash when I run lr-gpSP in Interpreter Mode (set option in Core Options in RetroArch). Obviously runs much slower but it doesn't creash, so it suggests the problem is with the Dynarec. 2) Exophase seemingly fixed this in gpSP 0.9! From his release notes for 0.9 (check the readme) - Fixed a bug causing games using movs pc in user mode (very bad behavior) to crash. Fixes Colin McRae Rally 2.0.

So this is possibly a regression between versions 0.9 and 0.91, or maybe Exophase didn't test all the way in-game. Will have to do some additional digging into years-old code to find out which it is!

schmurtzm commented 1 year ago

Hi, thanks for your investigation, I follow that with attention ;) I was thinking that it was mostly fixes of this kind 🤷‍♂️ May be it's not a regression but it works on 0.91 standalone ?

andymcca commented 1 year ago

Yes sometimes problems can be fixed by making changes in gba_over.h (used to be game_config.txt - not sure if lr-gpsp still uses this file).

But in the case of Colin McRae Rally 2.0 the problem is with the ARM Dynarec (used by MIYOO I think). I tested Colin McRae Rally on the PSP and on PC versions of gpSP and it worked ok.

It looks this ARM Dynarec was ported from the MIPS version before Exophase made his changes in gpSP 0.9. @davidgfnet made a new Dynarec for ARM64 based on the current MIPS version, so it is possible this will solve the problem for the MIYOO Mini. RetroArch build for MIYOO still targets the CPU from the original MIYOO (armv5te based), which is 32-bit.

I'm not sure if the MIYOO Mini (or Mini v2) uses a 64-bit ARM CPU? If so, someone needs to do a PR on the RetroArch MIYOO Makefile to take this into account. I will get round to it when I can if no-one else can do it, but might be a while due to other commitments.

davidgfnet commented 1 year ago

Yeah there's definitely a bug in the arm dynarec. However it seems that using the original BIOS works (or at least it doesnt crash on my machine?). The builtin open bios does make the game crash. I will take a look if I have some time.

andymcca commented 1 year ago

@davidgfnet thanks for taking the time to check this issue out and perhaps make a fix! I will build and test using your latest commits. I do use an original BIOS (at least, I thought I was!). On a separate note - I found a fix for the Banjo Kazooie: Gruntys Revenge issue (#164) from another emulator - https://github.com/ITotalJustice/notorious_beeg/issues/44 and commit https://github.com/ITotalJustice/notorious_beeg/commit/66a045f0da157fcae6cf13d47ec87c1c77f2300d

It says bit 4 of psr should always be 1 - so this means cpu mode 0 (usermode) is actually cpu mode 16?

I spent a few hours trying to apply this fix to cpu.c without success - I think I should just be able to OR 16 on newmode (i.e. something like newmode | 0b10000) in the set_cpu_mode function, but it doesn't work (on recompiling and trying the game I just get a white screen on loading any game). If you have any time to look or even just point me in the right direction I am happy to spend some more time on it?

davidgfnet commented 1 year ago

You are reading the code wrong, the cpu mode (it's an enum) is different from the cpu mode encoding (which is indeed 5 bits and its 4th bit is always set to one). There's however some weird issues in the way CPSR and SPSR are written (we are not doing some checks that are probably required). Ive based most of the code in what was already in gpsp and also giibiiadvance, but seems that the later has also issues with this game. Looking at mgba's CPSR masking code it looks like gpsp might be wrong. I need to spend a couple of hours and detangle the details and come up with a proper fix. Thanks for bringing this up!

andymcca commented 1 year ago

@davidgfnet thanks again for the detailed explanation! OK wonderful, if there's anything I can do to help please let me know!

davidgfnet commented 1 year ago

So far I think I identified the bug, sent a fix to GiiBiiAdvance (https://github.com/AntonioND/giibiiadvance/pull/19) gpsp has some other issues since fixing it doesn't seem to fix the mentioned games. Will need some more work, thanks for reporting it!

andymcca commented 1 year ago

No problem @davidgfnet ! Seems like this is scratching the surface of a bigger issue maybe? Happy to help or test anything if you need it. Thanks again :-)

schmurtzm commented 1 year ago

I complete the list with these examples of non working games listed on libretro documentation : https://docs.libretro.com/library/compatibility/gba/#gpsp and here at the bottom of the list : https://wiki.maemo.org/GpSP/Game_Compatibility

Do not hesitate to tell me if you want a global document or one issue per game. I can compile and make tests if necessary. Happy to see some activity on the repo, this emulator is so fast, it deserve these improvements on compatibility :)

andymcca commented 1 year ago

@schmurtzm I agree, it's the best performance GBA emulator (but definitely not accurate!), and pretty much the only choice for low performance retro handhelds. Thankfully @davidgfnet has improved it massively over the past couple of years!

andymcca commented 1 year ago

You are reading the code wrong, the cpu mode (it's an enum) is different from the cpu mode encoding (which is indeed 5 bits and its 4th bit is always set to one). There's however some weird issues in the way CPSR and SPSR are written (we are not doing some checks that are probably required). Ive based most of the code in what was already in gpsp and also giibiiadvance, but seems that the later has also issues with this game. Looking at mgba's CPSR masking code it looks like gpsp might be wrong. I need to spend a couple of hours and detangle the details and come up with a proper fix. Thanks for bringing this up!

Reviewing the code a bit more, I understand what you're saying now.

Spotted a potential issue - looks to me like the MODE_IRQ / MODE_FIQ definitions are the wrong way around? MODE_IRQ should be value 2 (encoded 18) and MODE_FIQ should be value 1 (17)?

andymcca commented 1 year ago

@schmurtzm can you do me a favour? The latest version of gpsp seems to have a problem with 32MB ROMS on platforms with 64MB or under. This will apply to the original Miyoo, PocketGo v1, Bittboy etc. I need someone to test the latest build (or latest nightly?) on one of these platforms with something like the Mother 3 1.3 translation or Pokemon FireRed for example and tell me if they work as I don't own any of these devices to test. Thanks.

schmurtzm commented 1 year ago

Hi, I can make these test but my Miyoo Mini has 128MB of ram. So is it useful for you ?

andymcca commented 1 year ago

Ahhh no that's no good - my Leapster GS has 128MB RAM also and it works there. It needs to be one with 32 or 64MB. Is there a Miyoo forum or something I can ask the question on?

schmurtzm commented 1 year ago

There is the RGH discord server. There is one channel per device so it is simple to ask to the community of each device 😉

https://discord.com/invite/p4uRmCd

We (Onion Team) are mostly present in Miyoo Mini and Miyoo Mini Plus channels

andymcca commented 1 year ago

Thanks @schmurtzm - Apaczer has answered in the Mother 3 issue thread here too.

andymcca commented 1 year ago

With regards to Open Lara - this does work if you use the version for slow flash carts available here - https://www.gamebrew.org/wiki/OpenLara_GBA.

andymcca commented 1 year ago

With regards to Pokemon Crystal - this appears to be working as of the latest commit. Not sure if the recent changes (aimed at ROM hacks such as Pokemon Gaia, by the same author) have fixed it.

andymcca commented 1 year ago

@schmurtzm with regards to ATV Ridge Racers, Smashing Drive and Street Racing Syndicate, I have just done a PR #199 which fixes all 3 of these games at least (Street Racing Syndicate seems to now have a different issue in ARM32 Dynarec tho). Additionally, as you may have seen David has a fix for GTA Advance in Interpreter mode. So we are almost done with the OnionUI list I think!

andymcca commented 1 year ago

With regards to Hamtaro Heartbreak , as mentioned elsewhere this can be fixed by applying an IPS patch to the ROM which fixes the transition behaviour.