Struct skyline::patching::BranchBuilder
source · [−]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
sourceimpl BranchBuilder
impl BranchBuilder
sourcepub fn branch_link() -> Self
pub fn branch_link() -> Self
Create new branch builder for a bl
ARM instruction
sourcepub fn branch_offset(self, offset: usize) -> Self
pub fn branch_offset(self, offset: usize) -> Self
Set the offset within the executable of the instruction to replace
sourcepub fn branch_to_offset(self, offset: usize) -> Self
pub fn branch_to_offset(self, offset: usize) -> Self
Offset within the executable for the branch to jump to
sourcepub fn branch_to_ptr<T>(self, ptr: *const T) -> Self
pub fn branch_to_ptr<T>(self, ptr: *const T) -> Self
Set a pointer for the branch to be jumped to. Must be within +/- 128 MiB of the given offset
Auto Trait Implementations
impl RefUnwindSafe for BranchBuilder
impl !Send for BranchBuilder
impl !Sync for BranchBuilder
impl Unpin for BranchBuilder
impl UnwindSafe for BranchBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more