libretro / gpsp

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

[ARM 32-Bit] Colin McRae Rally crash after menu (works in gpSP 0.9 PSP) #179

Closed andymcca closed 1 year ago

andymcca commented 1 year ago

This game crashes at a certain point in the menu when running on an ARM platform in Dynarec mode. However this issue was fixed in gpSP 0.9 (see Exophase release notes) - confirmed this by running standalone gpSP 0.9 on PPSSPP and loading the game (it worked through to in-game) and also on lr-gpsp in Windows.

I suspect this is due to the implementation of arm_stub.S - it looks as if some jump conditions are missing in the execute cspr / spsr functions which are present in mips_stub.S, which are probably the fix that Exophase refers to in his release notes. However I'm not very familiar with ARM/MIPS assembler, Can anyone help????

andymcca commented 1 year ago

Update - I tried making a change to arm_stub.S in my own repo for gpSP standalone, but it didn't fix the issue.

I think it would be worth porting @davidgfnet's ARM64 Dynarec to ARM32, thus replacing the existing files - I'm happy to start looking at this but not likely to progress it anytime soon due to other commitments, especially as now back at work after Christmas!!

davidgfnet commented 1 year ago

Hey there! The reason why the arm32 dynarec is so different to the others, it's cause it's essentially an arm2arm translator, whereas mips, arm64 or x86 are actually doing translation. That makes arm32 faster (compared to the other dynarecs). I debugged the issue and it's what you mention: spsr-restore doesnt work as intended on usermode (cpu_mode=0). This is something that games shouldnt do (since it is undefined according to the arm manual), however a couple of them do. I fixed this in my fork, I will merge this in a minute. Thanks for reporting!

davidgfnet commented 1 year ago

This is fixed by https://github.com/libretro/gpsp/commit/90170e33894ac8e3598a5660da62a18884d795f4

andymcca commented 1 year ago

This is fixed by 90170e3

Ahhh that's great David thank you for all your great work on this emulator and also for taking the time to come back and fix this issue. As mentioned I run lr-gpSP and gpSP standalone (my fork from the notaz version) on Leapster Explorer and LeapsterGS devices, and have been messing with trying to fix certain things where I can (my C and assembler knowledge isn't great but that's how you learn right? :-)) .

These devices are pretty old now, the Explorer in particular runs an armv5te 32-bit CPU, but both lr-gpSP and gpSP run very well, so it's interesting to me to investigate and try to help tie up the last few mainstream games that have compatibility issues.

schmurtzm commented 1 year ago

Tested with last gPSP commit : 90170e33894ac8e3598a5660da62a18884d795f4 5 jan 2023 , work great. Thanks @davidgfnet !