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 chase_pointer to the memory module #19

Open
vabold opened this issue Mar 28, 2023 · 2 comments
Open

Add chase_pointer to the memory module #19

vabold opened this issue Mar 28, 2023 · 2 comments
Labels
enhancement New feature or request P3 Priority: Low python Issues relating to Python
Milestone

Comments

@vabold
Copy link
Member

vabold commented Mar 28, 2023

Related to TASLabz/mkw-scripts#12.

The current MKW implementation looks like this:

from dolphin import memory


def chase_pointer(base_address: int, offsets: List, data_type: str):
    current_address = memory.read_u32(base_address)
    for offset in offsets:
        value_address = current_address + offset
        current_address = memory.read_u32(current_address + offset)
    data_types = {
        'u8': memory.read_u8,
        'u16': memory.read_u16,
        'u32': memory.read_u32,
        'u64': memory.read_u64,
        's8': memory.read_s8,
        's16': memory.read_s16,
        's32': memory.read_s32,
        's64': memory.read_s64,
        'f32': memory.read_f32,
        'f64': memory.read_f64,
        'vec3': vec3.read,
        'mat34': mat34.read,
        'quatf': quatf.read,
    }
    return data_types[data_type](value_address)

While vec3, mat34, and quatf are part of the EGG and nw4r libraries, the data_types dict should be extendable dynamically for game-specific implementations. The ideal usecase of this dict is for reading a datatype regularly created on the stack.

We should have a global data_types dict that scripts can append to.

@vabold vabold added enhancement New feature or request python Issues relating to Python labels Mar 28, 2023
@vabold vabold added the P4 Priority: Trivial label Apr 6, 2023
@vabold vabold added this to the 1.0 milestone Apr 6, 2023
@ximk
Copy link
Member

ximk commented Apr 7, 2023

It might be worth taking a look at how the memory watch inside dolphin works: Code.

@ximk
Copy link
Member

ximk commented Apr 14, 2023

Is this still planned?

@vabold vabold added P3 Priority: Low and removed P4 Priority: Trivial labels May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P3 Priority: Low python Issues relating to Python
Projects
None yet
Development

No branches or pull requests

2 participants