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

Adjust s_DIMAR/s_DILENGTH behavior (fixes Baten Kaitos music) #8733

Merged
merged 1 commit into from Apr 16, 2020

Conversation

JosJuice
Copy link
Member

@JosJuice JosJuice commented Apr 9, 2020

https://bugs.dolphin-emu.org/issues/11997

The problem seemed to be that s_DILENGTH would get set to 0 at times when it shouldn't. Simply not changing it in case of NoReply or DTK seems to fix the problem. However, we can actually go one step further in accuracy and use data.size() to change s_DIMAR and s_DILENGTH as partial reads (NoReply commands) complete, instead of jumping directly to 0 when the whole read completes.

https://bugs.dolphin-emu.org/issues/11997

The problem seemed to be that s_DILENGTH would get set to 0
at times when it shouldn't. Simply not changing it in case
of NoReply or DTK seems to fix the problem. However, we can
actually go one step further in accuracy and use data.size()
to change s_DIMAR and s_DILENGTH as partial reads (NoReply
commands) complete, instead of jumping directly to 0 when
the whole read completes.
@AdmiralCurtiss
Copy link
Contributor

Can confirm that this fixes the music issue in Baten Kaitos.


u32 transfer_size = 0;
if (reply_type == ReplyType::NoReply)
transfer_size = static_cast<u32>(data.size());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this value ever exceed the current value of s_DILENGTH (making it potentially negative after the subtraction down there)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only if the emulated software overwrites s_DILENGTH in the middle of a read, which doesn't make much sense. I'm not sure what happens on hardware if you do that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good enough for me then.


u32 transfer_size = 0;
if (reply_type == ReplyType::NoReply)
transfer_size = static_cast<u32>(data.size());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good enough for me then.

@JMC47 JMC47 merged commit 85a8325 into dolphin-emu:master Apr 16, 2020
@JosJuice JosJuice deleted the di-baten-kaitos branch April 17, 2020 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants