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

Add support for K, W and C versions of NSMBW #8

Closed
wants to merge 1 commit into from

Conversation

RoadrunnerWMC
Copy link
Collaborator

@RoadrunnerWMC RoadrunnerWMC commented Oct 5, 2021

Status of this PR

This PR has been split up and replaced by #13, #14, #15, and #16.


This PR adds support for the Korean (K), Taiwanese (W), and Chinese (C) releases of NSMBW to the dynamic loader (finished) and address map (work in progress).

Loader

The loader has been tested in Dolphin with the help of @Meatball132, and is verified working for all nine versions.

A few notes about the implementation:

  • 800CF6CC is used as the primary identification test because it's the first of only about 30 DOL addresses that have statically unique values in 8 of the 9 versions. This was found through exhaustive search.
    • This is better than checking REL addresses like in the original implementation because it's more reliable. Changing the REL addresses won't break it, and it works no matter how early or late in the boot process it runs.
    • Unfortunately, there's no single u32 that can distinguish all nine versions simultaneously like this. 8 is the maximum possible without getting relocations or RELs involved.
    • No relocations touch this particular address in any version, so its value never changes at runtime.
  • For the two versions that can't be distinguished by that address (K and W), a second test is done at 80004238, which is the first address at which these two statically differ.
    • Only the third byte is checked this time instead of all four, because the other 24 bits of this address are the same in both versions anyway, and because it should make the compiled code shorter by an instruction or two.

Address map

(Work-in-progress)

@RoadrunnerWMC
Copy link
Collaborator Author

Since the Chinese address map is unlikely to be finished anytime soon, and there's some demand for the rest of this PR to be merged, I've split this up into new PRs #13, #14, #15, and #16, and merged all but the last of those. I'll close this one now.

@RoadrunnerWMC RoadrunnerWMC deleted the all_nsmbw_regions branch May 22, 2022 21:00
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.

1 participant