scripts/Defaults.js
// Patches an array of bytes.
Patches an array of bytes.
Patches an array of bytes .
function patch(addr, c) {
    if (!isValidPatchAddress(addr)) {
        msg("Failed to patch.");
        return;
    }
    if (testing) {
        return;
    }
    if (!Array.isArray(c)) {
        c = [c];
    }
    Memory.protect(addr, c.length, 'rwx');
    for (var i = 0; i < c.length; ++i) {
        if (c[i] >= 0 && c[i] <= 0xFF) {
            Memory.writeU8(addr.add(i), c[i]);
        }
    }
    Memory.protect(addr, c.length, 'r-x');
}
function patch ( addr , c ) { if ( ! isValidPatchAddress ( addr ) ) { msg ( "Failed to patch." ) ; return ; } if ( testing ) { return ; } if ( ! Array . isArray ( c ) ) { c = [ c ] ; } Memory . protect ( addr , c . length , 'rwx' ) ; for ( var i = 0 ; i < c . length ; ++ i ) { if ( c [ i ] >= 0 && c [ i ] <= 0xFF ) { Memory . writeU8 ( addr . add ( i ) , c [ i ] ) ; } } Memory . protect ( addr , c . length , 'r-x' ) ; }
Patches an array of bytes.
Patches an array of bytes .