"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class ModHook {
    static MODHOOK_ADDR = -1;
    static MODHOOK_SIZE = 0x10;
    static addHook(ModLoader, n) {
        for (let i = 0; i < this.MODHOOK_SIZE; i++) {
            let offset = i * 0x4;
            let addr = this.MODHOOK_ADDR + offset;
            console.log(addr.toString(16));
            if (ModLoader.emulator.rdramRead32(addr) === 0) {
                ModLoader.emulator.rdramWrite32(addr, n);
                break;
            }
        }
    }
    static removeHook(ModLoader, n) {
        for (let i = 0; i < this.MODHOOK_SIZE; i++) {
            let offset = i * 0x4;
            let addr = this.MODHOOK_ADDR + offset;
            if (ModLoader.emulator.rdramRead32(addr) > 0) {
                if (ModLoader.emulator.rdramRead32(addr) === n) {
                    ModLoader.emulator.rdramWrite32(addr, 0);
                    break;
                }
            }
        }
    }
}
exports.default = ModHook;
//# sourceMappingURL=ModHook.js.map