ares-emulator / ares

ares is a cross-platform, open source, multi-system emulator, focusing on accuracy and preservation.
https://ares-emu.net
Other
929 stars 114 forks source link

[N64] Iggy's Reckin' Balls (USA): Can't get past certain levels #838

Open Mastergatto opened 1 year ago

Mastergatto commented 1 year ago

Describe the issue Ares v130.1, running on Archlinux using the AUR package.

In some level after passing the finish line and getting points for the championship, the game gets stuck on a black screen. This issue seems to be reliably reproducible, one of these such levels is the 9-2, that you can play in the attached save state. On a (maybe) related note, this level seems to be more laggy on emulator than on a N64 even though Ares still says 60 fps, but I could misremember as well.

In the .zip file you can find .bs1 file for load up the game right at the start of the level 9-2. If this is too tedious to complete for you, then you can instead load the .bs2 file that start the game right at the end of the same level. If you need to do some further testing, there's also the .pak containing the 100% complete save game of Iggy's Reckin' Balls.

Rom Information

file: Iggy's Reckin' Balls (USA).z64
sha256: cd5fb12c0295f3911f688a2444152a2aadd417cf13f0fd89623f64eb36e630bc

Iggy's Reckin' Balls (USA).zip

Mastergatto commented 1 year ago

I should add more details: The 100% complete save game, that is doable without cheats, was done on CEN64. I recall that I completed the game without any issues, well... there were some rare and random freeze during the run, nonetheless I was still able to complete it.

I mentioned that I played the game on N64 at its time, I should have specified that it was the PAL version on PAL HW. Anyways, It might be just the game, but I didn't expect the NTSC version to be as laggy as the PAL version, or even worse, during that level.

Speaking of the PAL version, I should also mention that I have just done the same run that I tried to do previously with NTSC version, always on Ares, and I was able to get past the 9-2 level and beyond without issues.

kev4cards commented 1 year ago

I can reproduce this issue. The game will also get stuck on a black screen with the music playing when choosing "restart level" from the pause menu in level 9-2.

I attempted to find a regression point with this issue, but I encountered damaged controller pak error in v120r07, ceasing my ability to check the issue without complicated patching.

Also, I changed the RDRAM allocation from 8 to 4 MiB to disable the expansion pak effectively as the pak had caused problems in the past for earlier emulators with respect to this game (thanks to Logan on discord for the suggestion). That had no impact on the issue.

Moreover, I commented out all mentions of icache. This slowed up the game tremendously from boot up to the character select screen (only 20 fps shown in the status bar). However, once reaching level 9-2 through the mix up game mode, I was hitting full speed, and the game could not restart the level properly.

Lastly, I changed the accuracy.hpp reference flag from 0 to 1 so the CPU interpreter would be used (as discussed with Rasky on discord). This still caused the issue to be present. So, some detail about icache appears to be the culprit.

UPDATE: I have narrowed this down to this if statement: https://github.com/ares-emulator/ares/blob/e73ec4cac959265091f46256bedef2602574da65/ares/n64/cpu/cpu.cpp#L100

Commenting it out will allow the game to restart level 9-2. However, this does not fix the problem in CPU interpreter and is the massive performance hit mentioned earlier.

Mastergatto commented 1 year ago

Thank you for your efforts. There are other levels with issues that I have found until now: 5-5, 6-7, 6-8, 8-8, 9-3

Mastergatto commented 1 year ago

Thanks to @invertego 's PR #1169 , I have been able to complete and get past 5-5, 6-7, 6-8, 8-8, 9-2 and 9-3 levels.

Although in case of 9-2 it seems a bit finicky, now it may allow or not to continue to next level whereas it just never did before. For this reason, I won't close this issue yet.

Another thing regarding the 9-2 level, the terrible slowdowns mentioned in the first post seem to be disappeared for good, making this level much more playable now, although this time my old CPU really struggles to maintain a stable 60 VI/s during it. It was worth it, though!

kev4cards commented 1 year ago

I can confirm that commit 6bf0d1f has moved the needle on this. I think the timings have helped to alleviate but not solve the problem. There are some CPU cache tests that are mostly finalized but have not been released yet. Once those do, fixing that/those test(s) could fix this issue.

kev4cards commented 7 months ago

@Mastergatto Could you check the build using commit c95dc1b and the one prior? I think this bug is fixed now. Actions builds: Should hang: https://github.com/ares-emulator/ares/actions/runs/7131340076 Should be fixed: https://github.com/ares-emulator/ares/actions/runs/7131630969

Mastergatto commented 7 months ago

I can confirm that with previous commit b85395f it still hangs, though even with the supposedly fix in the commit c95dc1b I can still reproduce the issue, sadly. Just resetting the level is not enough, can you tell me if you too can reproduce the issue by completing 9-2 level, and then in the next course (still the same 9-2) resetting the level?

kev4cards commented 7 months ago

Sorry for the late reply and thanks for the follow-up. Generally, resetting is enough for me. I climb a few rungs and then reset. Then, I'll reset before the countdown. Within ten or so attempts of restarting at various points, I can typically trigger the problem. I do it that way because I am not very skilled at the game and do not have a compatible save state at the end of the level. Anyways, I was able to reproduce by restarting the level just now on v135 release. So, the fix is still yet to be found and seems to be connected to the CPU's instruction or data cache.