void CommandTable::Init(void) { // read in the console commands g_consoleCommands.SetBaseID(0x0100); g_consoleCommands.Read((CommandInfo *)g_offsetConsoleCommandsStart, (CommandInfo *)g_offsetConsoleCommandsLast); // read in the script commands g_scriptCommands.SetBaseID(0x1000); g_scriptCommands.Read((CommandInfo *)g_offsetScriptCommandsStart, (CommandInfo *)g_offsetScriptCommandsLast); // pad to opcode 0x1400 to give Bethesda lots of room g_scriptCommands.PadTo(kNVSEOpcodeStart); // Add NVSE Commands g_scriptCommands.AddCommandsV1(); #if _DEBUG g_scriptCommands.AddDebugCommands(); #endif // register plugins g_pluginManager.Init(); ApplyPatch(kPatch_ScriptCommands_Start, (UInt32)g_scriptCommands.GetStart()); ApplyPatch(kPatch_ScriptCommands_End, (UInt32)g_scriptCommands.GetEnd()); ApplyPatch(kPatch_ScriptCommands_MaxIdx, g_scriptCommands.GetMaxID()); _MESSAGE("max id = %08X", g_scriptCommands.GetMaxID()); g_scriptCommands.Dump(); _MESSAGE("patched"); }
void CommandTable::Init(void) { static CommandInfo* kCmdInfo_Unused_1; #if RUNTIME #if RUNTIME_VERSION == RUNTIME_VERSION_1_4_0_525 kCmdInfo_Unused_1 = (CommandInfo*)0x0118E4F8; #elif RUNTIME_VERSION == RUNTIME_VERSION_1_4_0_525ng kCmdInfo_Unused_1 = (CommandInfo*)0x0118E4F8; #else #error #endif #else kCmdInfo_Unused_1 = (CommandInfo*)0x00E9D7A0; #endif // read in the console commands g_consoleCommands.SetBaseID(0x0100); g_consoleCommands.Read((CommandInfo *)g_offsetConsoleCommandsStart, (CommandInfo *)g_offsetConsoleCommandsLast); // read in the script commands g_scriptCommands.SetBaseID(0x1000); g_scriptCommands.Read((CommandInfo *)g_offsetScriptCommandsStart, (CommandInfo *)g_offsetScriptCommandsLast); // blocktype "Unused_1" becomes "Function" UInt16 onUnused_1Opcode = kCmdInfo_Unused_1->opcode; *kCmdInfo_Unused_1 = kCommandInfo_Function; kCmdInfo_Unused_1->opcode = onUnused_1Opcode; // pad to opcode 0x1400 to give Bethesda lots of room g_scriptCommands.PadTo(kNVSEOpcodeStart); // Add NVSE Commands g_scriptCommands.AddCommandsV1(); g_scriptCommands.AddCommandsV3s(); g_scriptCommands.AddCommandsV4(); #if _DEBUG g_scriptCommands.AddDebugCommands(); #endif // register plugins g_pluginManager.Init(); // patch the code ApplyPatch(kPatch_ScriptCommands_Start, (UInt32)g_scriptCommands.GetStart()); ApplyPatch(kPatch_ScriptCommands_End, (UInt32)g_scriptCommands.GetEnd()); ApplyPatch(kPatch_ScriptCommands_MaxIdx, g_scriptCommands.GetMaxID()); ApplyPatchEditorOpCodeDataList(); _MESSAGE("max id = %08X", g_scriptCommands.GetMaxID()); _MESSAGE("console commands"); g_consoleCommands.Dump(); _MESSAGE("script commands"); g_scriptCommands.Dump(); _MESSAGE("patched"); }