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

Account for HOFSTR hardware flaw in h-bias worlds #43

Merged
merged 1 commit into from
Mar 9, 2024

Conversation

pizzarollsroyce
Copy link
Contributor

VB hardware will OR the eye "offset" with the param_base instead of adding it to compute the h-bias offset, which results in incorrect behavior if the param_base isn't word-aligned. See http://perfectkiosk.net/stsvb.html#vip_worlds_h_bias

Another selfish fix for Elevated Speed, which exploits this flaw to reduce writes to VRAM

@pizzarollsroyce
Copy link
Contributor Author

I double checked the behavior against level 3 of Wario Land. H-bias layers that are used for the wavy underwater effect still work.

@@ -374,7 +374,8 @@ void video_hard_render() {
}
} else {
// hbias or affine world
s16 *params = (s16 *)(&V810_DISPLAY_RAM.pmemory[0x20000 + windows[wnd * 16 + 9] * 2]);
u32 param_base = (u32)&V810_DISPLAY_RAM.pmemory[0x20000 + windows[wnd * 16 + 9] * 2];
Copy link
Owner

Choose a reason for hiding this comment

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

Is the cast to u32 necessary? It seems like this should be possible with just s16* indexing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have to cast to an arithmetic type somewhere to determine alignment. I moved it down in #45 if you prefer that one instead.

Copy link
Owner

Choose a reason for hiding this comment

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

I prefer not casting a pointer to an integer where it's not absolutely needed, and storing param_base separately is a viable alternative. I'll merge this PR so you get the credit, and then tweak it.

@skyfloogle skyfloogle merged commit 7d09ab9 into skyfloogle:master Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants