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

Ensure every segmented address uses a segment table lookup #62

Open
RevoSucks opened this issue Feb 18, 2019 · 0 comments
Open

Ensure every segmented address uses a segment table lookup #62

RevoSucks opened this issue Feb 18, 2019 · 0 comments

Comments

@RevoSucks
Copy link

RevoSucks commented Feb 18, 2019

Every access of this kind will need to use the segmented_to_virtual method lookup.

This method is used in mario 64 to do the translation:

void *segmented_to_virtual(void *addr)
{
    u32 segment = (u32)addr >> 24;
    u32 offset = (u32)addr & 0x00FFFFFF;

    return (void *)((sSegmentTable[segment] + offset) | 0x80000000);
}

JP: sSegmentTable: 8033a090
US: sSegmentTable: 8033b400

Addresses such as 0x07023C38 (segmented address of a painting struct in Inside Castle level data) will need a translation to actual address via this method before reading.

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

No branches or pull requests

1 participant