Skip to content

Commit

Permalink
refactor hook function names and stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
c6-dev committed Jun 12, 2022
1 parent 2b4204d commit fe5101b
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 21 deletions.
28 changes: 14 additions & 14 deletions JG/JohnnyGuitarNVSE.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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<QuestUpdateManager>* g_questUpdateManager = (tList <QuestUpdateManager>*)0x11D970C;
if (g_questUpdateManager) {
ListNode<QuestUpdateManager>* iter = g_questUpdateManager->Head();
Expand Down Expand Up @@ -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
Expand All @@ -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);
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions JG/functions/fn_form.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion JG/functions/fn_gameplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ bool Cmd_SendStealingAlarm_Execute(COMMAND_ARGS) {
return true;
ListNode<ContChangesEntry>* contChangesIter = xChanges->data->objList->Head();
ContChangesEntry* entry;
TESForm* item;
do {
if (!(entry = contChangesIter->data) || !entry->extendData || !entry->type) continue;
ListNode<ExtraDataList>* xdlIter = entry->extendData->Head();
Expand Down
2 changes: 1 addition & 1 deletion JG/functions/fn_math.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
3 changes: 0 additions & 3 deletions JG/functions/fn_utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<Setting>* istIter = ini->settings.Head();
do {
Expand Down
4 changes: 2 additions & 2 deletions JG/internal/decoding.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -3509,7 +3509,7 @@ class NavMeshObstacleManager {
UInt8 backgroundThreadPerformanceTimer;
UInt8 gap1A2[2];
};
STATIC_ASSERT(sizeof(NavMeshObstacleManager), 0x1A4);
STATIC_ASSERT(sizeof(NavMeshObstacleManager) == 0x1A4);

class BSArchiveHeader {
public:
Expand Down

0 comments on commit fe5101b

Please sign in to comment.