Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial-D gb (sgb enhanced) game crashes when starting a race #2501

Closed
Bunkai9448 opened this issue Apr 20, 2022 · 3 comments
Closed

Initial-D gb (sgb enhanced) game crashes when starting a race #2501

Bunkai9448 opened this issue Apr 20, 2022 · 3 comments
Labels
platform:GB/GBC Game Boy/Game Boy Color-related issues
Milestone

Comments

@Bunkai9448
Copy link

Game rom: Initial D Gaiden (Japan) (SGB Enhanced)
CRC-32: 6CC56612

The game crashes right after entering in a race.
It doesn't matter if it is in time attack (タイムアタック)
or in story mode (シナリオ)

Here's the bug report from the PC (v0.9.3) version
bug initial-d gb.zip

It also happens on the same version (v0.9.3) in the psVita.

PS: I've tried in the lastest version of hhugboy and BGB and it doesn't happen in those, that's why i think is a mgba bug.

@endrift endrift added the platform:GB/GBC Game Boy/Game Boy Color-related issues label Apr 20, 2022
@CasualPokePlayer
Copy link
Contributor

CasualPokePlayer commented Apr 21, 2022

Seems that at some point mGBA gets into a loop where the STAT interrupt occurs within STAT interrupt handler. Game only enables mode 0 IRQ for STAT anyways. Interestingly, the game does write to STAT during the interrupt handler, and that ends up triggering the IRQ? Which that shouldn't be triggering the STAT IRQ in this case (especially since I was using CGB mode, might be some bug with STAT write handling?)

@endrift
Copy link
Member

endrift commented Apr 21, 2022

While I'm working on some other stuff, @CasualPokePlayer can you check if this is a regression? It was totally broken before #1473 was fixed, but there's a good range there in the middle.

@CasualPokePlayer
Copy link
Contributor

The game crashes the same way on the commit that fixed that issue.

Although interesting, it doesn't crash if I select CGB mode on that commit. Which means some sort of regression is causing it to occur in CGB mode mode too (CGB-DMG mode having the STAT bug instead of not like before?). Suppose anyways that probably means STAT bug is triggering an IRQ (although it shouldn't be in this case).

https://github.com/LIJI32/SameBoy/blob/76b881c2e153e164485814257fee472572dd8482/Core/sm83_cpu.c#L148-L151
This comment from SameBoy's source seems interesting (as the mode 1->2 transition is "4" cycles away (according to mGBA debugger) when STAT is written to)

@endrift endrift added this to the mGBA 0.10.1 milestone Jun 9, 2022
@endrift endrift modified the milestones: mGBA 0.10.1, mGBA 0.10.2 Dec 8, 2022
@endrift endrift modified the milestones: mGBA 0.10.2, mGBA 0.10.3 Mar 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:GB/GBC Game Boy/Game Boy Color-related issues
Projects
None yet
Development

No branches or pull requests

3 participants