diff --git a/gamedata/SoundManager.games.txt b/gamedata/SoundManager.games.txt index 1620c59..fd4ad58 100644 --- a/gamedata/SoundManager.games.txt +++ b/gamedata/SoundManager.games.txt @@ -9,7 +9,7 @@ "windows" { "signature" "soundscape_flush" - "read" "73" + "read" "93" } "windows64" { @@ -74,11 +74,11 @@ } // search "Shared activity collision" to find ActivityList_RegisterSharedActivity and the first function called inside is GetStringID - // CHECKED 2025-02-19 + // CHECKED 2025-02-20 "CStringRegistry::GetStringID" { "library" "server" - "windows" "\x55\x8B\xEC\x8B\x45\x2A\x83\xEC\x08\x53" + "windows" "\x55\x8B\xEC\x83\xEC\x0C\x8B\x45\x2A\x89\x4D\x2A\x53\xBB\xFF\xFF\x00\x00" "windows64" "\x48\x89\x5C\x24\x2A\x57\x48\x83\xEC\x30\x4C\x89\x7C\x24" "linux" "@_ZN15CStringRegistry11GetStringIDEPKc" "linux64" "@_ZN15CStringRegistry11GetStringIDEPKc" @@ -97,6 +97,15 @@ "linux" "15" "linux64" "24" } + // find in CSoundscapeSystem::GetSoundscapeIndex + // CHECKED 2025-02-20 + "CSoundscapeSystem::m_soundscapes" + { + "windows" "12" + "windows64" "24" + "linux" "12" + "linux64" "24" + } } } @@ -194,6 +203,11 @@ "windows" "16" "linux" "17" } + "CSoundscapeSystem::m_soundscapes" + { + "windows" "12" + "linux" "12" + } } } } diff --git a/scripting/SoundManager.sp b/scripting/SoundManager.sp index ca26210..b77addb 100644 --- a/scripting/SoundManager.sp +++ b/scripting/SoundManager.sp @@ -39,6 +39,7 @@ Address gP_SoundscapeSystem = Address_Null; Handle gH_AcceptInput = null; Handle gH_GetPlayerSlot = null; Handle gH_GetStringID = null; +int gI_m_soundscapesOffset = -1; // Other int gI_SilentSoundScape = -1; @@ -248,6 +249,11 @@ void StartPrepSDKCall_GetStringID(Handle hGameData) SetFailState("Could not get address of CSoundscapeSystem pointer."); } + if ((gI_m_soundscapesOffset = GameConfGetOffset(hGameData, "CSoundscapeSystem::m_soundscapes")) == -1) + { + SetFailState("Could not get CSoundscapeSystem::m_soundscapes offset"); + } + StartPrepSDKCall(SDKCall_Raw); PrepSDKCall_SetFromConf(hGameData, SDKConf_Signature, "CStringRegistry::GetStringID"); PrepSDKCall_AddParameter(SDKType_String, SDKPass_Pointer); @@ -261,7 +267,7 @@ void StartPrepSDKCall_GetStringID(Handle hGameData) int GetSoundscapeIndex(const char[] sString) { - return SDKCall(gH_GetStringID, gP_SoundscapeSystem + view_as
(0xC), sString); + return SDKCall(gH_GetStringID, gP_SoundscapeSystem + view_as
(gI_m_soundscapesOffset), sString); } public void OnMapStart() @@ -354,7 +360,7 @@ void HookAcceptInput() int offset = GameConfGetOffset(hGameData, "AcceptInput"); delete hGameData; - if(offset == 0) + if(offset == -1) { SetFailState("Failed to load \"AcceptInput\", invalid offset."); }