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

Ore ga Omae o Mamoru: hangs on white screen #559

Open
scurest opened this issue Dec 26, 2019 · 8 comments
Open

Ore ga Omae o Mamoru: hangs on white screen #559

scurest opened this issue Dec 26, 2019 · 8 comments
Labels
timing Timing issue

Comments

@scurest
Copy link
Contributor

scurest commented Dec 26, 2019

The game Ore ga Omae o Mamoru (俺がオマエを守る) hangs on a white screen immediately after booting. The emulator freezes and can't be interacted with/closed.

This is printed to stdout

unknown arm7 read32 0126F05C | 0126F060
unknown arm7 read32 0126F060 | 0126F060
unknown arm7 read32 0126F064 | 0126F064
unknown arm7 read32 0126F068 | 0126F068
unknown arm7 read32 0126F06C | 0126F06C
unknown arm7 read32 0126F070 | 0126F070
unknown arm7 read32 0126F074 | 0126F074
unknown arm7 read32 0126F078 | 0126F078
...goes on forever...

Using commit 3f7bc1a.

@RSDuck
Copy link
Member

RSDuck commented Dec 27, 2019

no$gba seems to be affected as well, while desmume works.

EDIT 3: ignore all of what I've written, it's probably wrong
There seems to be code being overriden on the ARM7ARM9 by a memset implementation at 0x20108b8. The length parameter in r2 seems to be far to much (over 2mb!). It is derived by subtracting the values located at 0x27FFDA0 and 0x27FFDC4. I suspect the problem is that these values are either set too early or too late, though neither disabling advanced bus emulation in desmume nor changing timing constants in melonDS seems to make a difference.

EDIT 2: the memset seems to be called with the same crazy value in desmume too. The problem has something to do with the memset itself

@RSDuck
Copy link
Member

RSDuck commented Dec 27, 2019

after some more debugging I finally have a conclusive theory about all of this:
there's a memory area in main ram which during the beginning contains code executed by the ARM7. Later it is cleared for some reason by the ARM9 first with the value 0xbb then 0xcc (or the other way around). In melonDS and no$gba the ARM7 happens to still execute code in this region, while this mem(e)set operation is going. The value 0xbbbbbbbb is interpreted as a conditional branch to nowhere which is taken.
The game boots if the ARM7 is sped up (e.g. by only adding a single cycle per instruction).
EDIT: it also works if you slow down the ARM9 (kDataCacheTiming and kCodeCacheTiming = 10 seemed to work for me)

@RSDuck RSDuck added the timing Timing issue label Dec 27, 2019
@Arisotura
Copy link
Member

urgl. there is a similar timing issue with the aging cart on some DS emulators.

@RSDuck
Copy link
Member

RSDuck commented Dec 8, 2020

the english translation allegedly works fine
https://www.romhacking.net/translations/5796/

@Illidanz
Copy link

@RSDuck we added a check for that bugged value in the translation patch, see here.

@RSDuck
Copy link
Member

RSDuck commented Dec 10, 2020

ah I was already wondering if the english text somehow took longer or slower to load which changed this unintentionally

@ghost
Copy link

ghost commented Dec 2, 2021

Still fucked. With JIT on the entire emulator crashes. With it off the game instantly hangs on a white screen.

Capture

@Arisotura
Copy link
Member

after some more debugging I finally have a conclusive theory about all of this: there's a memory area in main ram which during the beginning contains code executed by the ARM7. Later it is cleared for some reason by the ARM9 first with the value 0xbb then 0xcc (or the other way around). In melonDS and no$gba the ARM7 happens to still execute code in this region, while this mem(e)set operation is going. The value 0xbbbbbbbb is interpreted as a conditional branch to nowhere which is taken. The game boots if the ARM7 is sped up (e.g. by only adding a single cycle per instruction). EDIT: it also works if you slow down the ARM9 (kDataCacheTiming and kCodeCacheTiming = 10 seemed to work for me)

looking back on this, it seems to be related to concurrent mainRAM access

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
timing Timing issue
Projects
None yet
Development

No branches or pull requests

4 participants