From e1cb09d7228c5c7e948c74c4fa876d049f783d95 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Tue, 26 Sep 2023 21:55:53 -0500 Subject: [PATCH 1/4] feat: add get commands --- CommonLibSF/include/RE/S/Script.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/CommonLibSF/include/RE/S/Script.h b/CommonLibSF/include/RE/S/Script.h index a194de6f..43b894df 100644 --- a/CommonLibSF/include/RE/S/Script.h +++ b/CommonLibSF/include/RE/S/Script.h @@ -149,11 +149,11 @@ namespace RE enum { - kNumScriptCommands = 0x03C0, kNumConsoleCommands = 0x0245, + kNumScriptCommands = 0x03C0, - kScriptOpBase = 0x1000, kConsoleOpBase = 0x0100, + kScriptOpBase = 0x1000, }; inline static SCRIPT_FUNCTION GetFirstScriptCommand() @@ -168,6 +168,18 @@ namespace RE return chunk.get(); } + inline static const auto GetConsoleCommands() + { + static REL::Relocation chunk{ REL::ID(841465) }; + return std::span{ *chunk }; + } + + inline static const auto GetScriptCommands() + { + static REL::Relocation chunk{ REL::ID(841467) }; + return std::span{ *chunk }; + } + // members SCRIPT_HEADER header; // 00 char* text; // 14 From 0f62142e7d542bdbae63cb26d1684b0d76000e30 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Tue, 26 Sep 2023 21:58:39 -0500 Subject: [PATCH 2/4] feat!: change first functions to return a pointer + swap positions --- CommonLibSF/include/RE/S/Script.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CommonLibSF/include/RE/S/Script.h b/CommonLibSF/include/RE/S/Script.h index 43b894df..6eeb08b3 100644 --- a/CommonLibSF/include/RE/S/Script.h +++ b/CommonLibSF/include/RE/S/Script.h @@ -156,15 +156,15 @@ namespace RE kScriptOpBase = 0x1000, }; - inline static SCRIPT_FUNCTION GetFirstScriptCommand() + inline static SCRIPT_FUNCTION* GetFirstConsoleCommand() { - static REL::Relocation chunk{ REL::ID(841467) }; + static REL::Relocation chunk{ REL::ID(841465) }; return chunk.get(); } - inline static SCRIPT_FUNCTION GetFirstConsoleCommand() + inline static SCRIPT_FUNCTION* GetFirstScriptCommand() { - static REL::Relocation chunk{ REL::ID(841465) }; + static REL::Relocation chunk{ REL::ID(841467) }; return chunk.get(); } From 388a77f8cda39bf628d95306e640aca953072e78 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Wed, 27 Sep 2023 13:41:24 -0500 Subject: [PATCH 3/4] fix: wrong rel id --- CommonLibSF/include/RE/U/UI.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CommonLibSF/include/RE/U/UI.h b/CommonLibSF/include/RE/U/UI.h index 29dd5216..12c2e761 100644 --- a/CommonLibSF/include/RE/U/UI.h +++ b/CommonLibSF/include/RE/U/UI.h @@ -12,9 +12,8 @@ namespace RE bool IsMenuOpen(const BSFixedString& a_name) { using func_t = decltype(&UI::IsMenuOpen); - REL::Relocation func{ REL::ID(187048) }; + REL::Relocation func{ REL::ID(187049) }; return func(this, a_name); } }; - } From 643affd748bb13a663fd8078bd2a138ea285c2eb Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Wed, 27 Sep 2023 14:02:58 -0500 Subject: [PATCH 4/4] chore!: remove old first functions --- CommonLibSF/include/RE/S/Script.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/CommonLibSF/include/RE/S/Script.h b/CommonLibSF/include/RE/S/Script.h index 6eeb08b3..8d4b26fc 100644 --- a/CommonLibSF/include/RE/S/Script.h +++ b/CommonLibSF/include/RE/S/Script.h @@ -156,18 +156,6 @@ namespace RE kScriptOpBase = 0x1000, }; - inline static SCRIPT_FUNCTION* GetFirstConsoleCommand() - { - static REL::Relocation chunk{ REL::ID(841465) }; - return chunk.get(); - } - - inline static SCRIPT_FUNCTION* GetFirstScriptCommand() - { - static REL::Relocation chunk{ REL::ID(841467) }; - return chunk.get(); - } - inline static const auto GetConsoleCommands() { static REL::Relocation chunk{ REL::ID(841465) };