pub struct BranchBuilder { /* private fields */ }
Expand description

A builder type to help when replacing branches in games

Example:

// Replace the instruction at `main` + 0x14a8504 with a branch
// to `main` + 0x14a853C
BranchBuilder::branch()
    .branch_offset(0x14a8504)
    .branch_to_offset(0x14a853C)
    .replace()

// Replace the instruction at `main` + 0x14a8504 with a branch
// to `replacement_function`
BranchBuilder::branch()
    .branch_offset(0x14a8504)
    .branch_to_ptr(replacement_function as *const ())
    .replace()

Implementations

Create new branch builder for a b ARM instruction

Create new branch builder for a bl ARM instruction

Set the offset within the executable of the instruction to replace

Offset within the executable for the branch to jump to

Set a pointer for the branch to be jumped to. Must be within +/- 128 MiB of the given offset

Replaces an instruction at the provided offset with a branch to the given pointer.

Panics

Panics if an offset/ptr hasn’t been provided or if the pointer is out of range of the branch

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.