From fe5101bd8525fe6cb0439b41ebd5b06d7d349bcf Mon Sep 17 00:00:00 2001 From: c6 <31777460+c6-dev@users.noreply.github.com> Date: Sun, 12 Jun 2022 18:09:26 +0400 Subject: [PATCH] refactor hook function names and stuff --- JG/JohnnyGuitarNVSE.h | 28 ++++++++++++++-------------- JG/functions/fn_form.h | 2 ++ JG/functions/fn_gameplay.h | 1 - JG/functions/fn_math.h | 2 +- JG/functions/fn_utility.h | 3 --- JG/internal/decoding.h | 4 ++-- 6 files changed, 19 insertions(+), 21 deletions(-) diff --git a/JG/JohnnyGuitarNVSE.h b/JG/JohnnyGuitarNVSE.h index 795a0dd..c0f2496 100644 --- a/JG/JohnnyGuitarNVSE.h +++ b/JG/JohnnyGuitarNVSE.h @@ -208,21 +208,21 @@ bool __fastcall FleeFixHook(PlayerCharacter* Player, void* unused, bool& IsHidde return (GetPlayerInCombat(Player, IsHidden) && !IsHidden); } -char** DefaultMarkers = (char**)0x11A0404; +char** defaultMarkerList = (char**)0x11A0404; -char* __fastcall hk_GetMapMarker(TESObjectREFR* thisObj, UInt16 MapMarkerType) { +char* __fastcall GetMapMarker(TESObjectREFR* thisObj, UInt16 mapMarkerType) { auto it = markerIconMap.find(thisObj->refID); if (it != markerIconMap.end()) return it->second; - return DefaultMarkers[MapMarkerType]; + return defaultMarkerList[mapMarkerType]; } -__declspec (naked) void AsmGetMapMarkerRoute() { +__declspec (naked) void GetMapMarkerHook() { //UInt32 static const retAddr = 0x079D337; __asm { mov edx, eax mov ecx, [ebp - 0x24] - jmp hk_GetMapMarker + jmp GetMapMarker } } @@ -375,7 +375,7 @@ __declspec(naked) void NPCIncrementingChallengesHook() { jmp retnAddr } } -void __fastcall PlayQuestFailSound(Sound* sound, int dummy) { +void __fastcall UIUpdateSoundHook(Sound* sound, int dummy) { tList* g_questUpdateManager = (tList *)0x11D970C; if (g_questUpdateManager) { ListNode* iter = g_questUpdateManager->Head(); @@ -406,7 +406,7 @@ void ResetVanityWheel() { *VanityWheel = *MaxChaseCam; } -__declspec (naked) void hk_VanityModeBug() { +__declspec (naked) void VanityModeHook() { static uintptr_t jmpDest = 0x942D43; static uintptr_t getGS = 0x403E20; __asm @@ -416,7 +416,7 @@ __declspec (naked) void hk_VanityModeBug() { jmp jmpDest } } -bool __fastcall ShouldPlayCombatMusic(UInt32* a1) { +bool __fastcall CombatMusicHook(UInt32* a1) { if (bCombatMusicDisabled) return false; return ThisStdCall_B(0x992D90, a1); } @@ -452,7 +452,7 @@ void __fastcall DropItemHook(PlayerCharacter* a1, void* edx, TESForm* a2, BaseEx ThisStdCall(0x954610, a1, a2, a3, itemCount, a5, a6); } -void __fastcall TESRegionDataSoundLoadIncidentalID(ModInfo* info, void* edx, UInt32* refID) { +void __fastcall TESRegionDataSoundIncidentalIDHook(ModInfo* info, void* edx, UInt32* refID) { ThisStdCall(0x4727F0, info, refID); if (*refID) { CdeclCall(0x485D50, refID, info); @@ -562,12 +562,12 @@ void HandleGameHooks() { SafeWriteBuf(0x8BFBC1, "\x85\xC9\x74\x36\x80\x79\x04", 7); // fix for incidental sounds not working in regions - WriteRelCall(0x4F49AB, UInt32(TESRegionDataSoundLoadIncidentalID)); + WriteRelCall(0x4F49AB, UInt32(TESRegionDataSoundIncidentalIDHook)); // INI OPTIONS // for bReset3rdPersonCamera - if (resetVanityCam) WriteRelJump(0x942D3D, (uintptr_t)hk_VanityModeBug); + if (resetVanityCam) WriteRelJump(0x942D3D, (uintptr_t)VanityModeHook); // for bFixFleeing if (fixFleeing) WriteRelCall(0x8F5FE2, (UInt32)FleeFixHook); @@ -615,16 +615,16 @@ void HandleGameHooks() { // SetCustomMapMarkerIcon SafeWrite16(0x79D330, 0x9090); - WriteRelCall(0x79D332, (UInt32)AsmGetMapMarkerRoute); + WriteRelCall(0x79D332, (UInt32)GetMapMarkerHook); // DisableMenuArrowKeys WriteRelJump(0x70F708, (UInt32)DisableArrowKeysHook); // SetUIUpdateSound - WriteRelCall(0x77A8E9, (UInt32)PlayQuestFailSound); + WriteRelCall(0x77A8E9, (UInt32)UIUpdateSoundHook); // DisableCombatMusic - WriteRelCall(0x82FC0B, (UInt32)ShouldPlayCombatMusic); + WriteRelCall(0x82FC0B, (UInt32)CombatMusicHook); // ToggleDisableSaves g_canSaveNowAddr = (*(UInt32*)0x0850443) + 5 + 0x0850442; diff --git a/JG/functions/fn_form.h b/JG/functions/fn_form.h index 29ee54a..11b1696 100644 --- a/JG/functions/fn_form.h +++ b/JG/functions/fn_form.h @@ -437,6 +437,8 @@ TESModelTextureSwap* GetArmorModel(TESObjectARMO* armor, UInt32 id) { return &armor->bipedModel.groundModel[0]; // male world case 4: return &armor->bipedModel.groundModel[1]; //female world + default: + return nullptr; } } bool Cmd_GetArmorAltTextures_Execute(COMMAND_ARGS) { diff --git a/JG/functions/fn_gameplay.h b/JG/functions/fn_gameplay.h index 4eedd54..69f6eb8 100644 --- a/JG/functions/fn_gameplay.h +++ b/JG/functions/fn_gameplay.h @@ -220,7 +220,6 @@ bool Cmd_SendStealingAlarm_Execute(COMMAND_ARGS) { return true; ListNode* contChangesIter = xChanges->data->objList->Head(); ContChangesEntry* entry; - TESForm* item; do { if (!(entry = contChangesIter->data) || !entry->extendData || !entry->type) continue; ListNode* xdlIter = entry->extendData->Head(); diff --git a/JG/functions/fn_math.h b/JG/functions/fn_math.h index 38e385a..3b96460 100644 --- a/JG/functions/fn_math.h +++ b/JG/functions/fn_math.h @@ -18,7 +18,7 @@ DEFINE_COMMAND_PLUGIN(GetRGBColor, , 0, 3, kParams_ThreeInts); bool Cmd_GetRGBColor_Execute(COMMAND_ARGS) { *result = 0; UInt32 r, g, b; - if (ExtractArgsEx(EXTRACT_ARGS_EX, &r, &g, &b) && r <= 255 && g <= 255 & b <= 255) { + if (ExtractArgsEx(EXTRACT_ARGS_EX, &r, &g, &b) && r <= 255 && g <= 255 && b <= 255) { *result = ((r & 0xFF) << 16) + ((g & 0xFF) << 8) + (b & 0xFF); if (IsConsoleMode()) Console_Print("0x%X", (UInt32)*result); } diff --git a/JG/functions/fn_utility.h b/JG/functions/fn_utility.h index e6384e6..050a73a 100644 --- a/JG/functions/fn_utility.h +++ b/JG/functions/fn_utility.h @@ -66,9 +66,6 @@ bool Cmd_DumpINI_Execute(COMMAND_ARGS) { std::ofstream csv; csv.open("settings.csv"); Setting* setting; - int value; - float fvalue; - const char* cvalue; csv << "fallout.ini" << std::endl; ListNode* istIter = ini->settings.Head(); do { diff --git a/JG/internal/decoding.h b/JG/internal/decoding.h index ff56746..f73a3f1 100644 --- a/JG/internal/decoding.h +++ b/JG/internal/decoding.h @@ -2677,7 +2677,7 @@ class FORenderedTerminal : public FORenderedMenu { float fltE8; UInt8 bytEC; }; -STATIC_ASSERT(sizeof(FORenderedTerminal), 0x70); +//STATIC_ASSERT(sizeof(FORenderedTerminal) == 0x70); FIXME class FOPipboyManager : public FORenderedMenu { public: @@ -3509,7 +3509,7 @@ class NavMeshObstacleManager { UInt8 backgroundThreadPerformanceTimer; UInt8 gap1A2[2]; }; -STATIC_ASSERT(sizeof(NavMeshObstacleManager), 0x1A4); +STATIC_ASSERT(sizeof(NavMeshObstacleManager) == 0x1A4); class BSArchiveHeader { public: