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
BS2Emu: Set HID0/1/2/4 and MSR with correct default values #10746
Conversation
0349324
to
deeef80
Compare
|
I've added a workaround for the missing textures. It's kinda jank, but it works. |
deeef80
to
33fd692
Compare
|
The registers values LGTM and match what I have with the GC and Wii system menu. |
5856751
to
d4bde9d
Compare
| // Datel titles don't initialize the postMatrices, but they have dual-texture coordinate | ||
| // transformation enabled. We initialize all of xfmem to 0, which results in everything using | ||
| // a texture coordinate of (0, 0), breaking textures. Normally the IPL will initialize the last | ||
| // entry to the identity matrix, but BS2 EMU skips that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment confuses me, doesn't this new piece of code initialize the last entry to the identity matrix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BS2 EMU skips running the IPL, so the initialization that the IPL performs is skipped and thus needs to be performed in BS2 EMU. But that comment can also be read as "BS2 EMU skips performing this initialization", which is misleading - I'll change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the comment (I thought I did so earlier, but it seems like I didn't).
d4bde9d
to
aad6c4d
Compare
|
Hmm. I just tested, and it seems like with this PR (and #10761 which was merged yesterday), you can boot Datel titles with DSP HLE and the IPL enabled, or DSP LLE and the IPL disabled, but it still hangs if you have both DSP HLE and the IPL enabled. That's annoying... |
|
Possibly a timing issue? That is annoying, though. |
|
I figured it out; see #10785. |
These values were obtained by setting a breakpoint at a game's entry point, and then observing the register values with Dolphin's register widget. There are other registers that aren't handled by this PR, including CR, XER, SRR0, SRR1, and "Int Mask" (as well as most of the GPRs). They could be added in a later PR if it turns out that their values matter, but probably most of them don't. This fixes Datel titles booting with the IPL skipped (see https://bugs.dolphin-emu.org/issues/8223), though when booted this way they are currently missing textures. Due to somewhat janky code, Datel overwrites the syscall interrupt handler and then immediately triggers it (with the `sc` instruction) before they restore the correct one. This works on real hardware due to icache, and also works in Dolphin when the IPL runs due to icache, but prior to this change `HID0.ICE` defaulted to 0 so icache was not enabled when the IPL was skipped.
aad6c4d
to
2023831
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems all of the Datel Products work with this now.
This fixes Datel titles having missing textures (which was an issue with the previous commit).
2023831
to
76401e8
Compare
BS2Emu: Set HID0/1/2/4 and MSR with correct default values
|
Here's a detailed writeup of how Datel's code was broken and why this fixes it: https://gist.github.com/Pokechu22/abed8faefa0afc6dd881a8958e2407fe |
These values were obtained by setting a breakpoint at a game's entry point, and then observing the register values with Dolphin's register widget.
There are other registers that aren't handled by this PR, including CR, XER, SRR0, SRR1, and "Int Mask" (as well as most of the GPRs). They could be added in a later PR if it turns out that their values matter, but probably most of them don't.
This fixes Datel titles booting with the IPL skipped (see https://bugs.dolphin-emu.org/issues/8223), though when booted this way they are currently missing textures. Due to somewhat janky code, Datel overwrites the syscall interrupt handler and then immediately triggers it (with the
scinstruction) before they restore the correct one. This works on real hardware due to icache, and also works in Dolphin when the IPL runs due to icache, but prior to this changeHID0.ICEdefaulted to 0 so icache was not enabled when the IPL was skipped.