Compare commits

..

1 Commits

Author SHA1 Message Date
rtldg
d0bf535a60
Merge 33827ca7a2 into 58a1046e0a 2025-02-20 02:43:55 +00:00
2 changed files with 12 additions and 81 deletions

View File

@ -106,34 +106,6 @@
"linux" "12" "linux" "12"
"linux64" "24" "linux64" "24"
} }
"SoundInfo_t::fVolume"
{
"windows" "40"
"windows64" "44"
"linux" "40"
"linux64" "44"
}
"SoundInfo_t::bIsAmbient"
{
"windows" "85"
"windows64" "89"
"linux" "85"
"linux64" "89"
}
"ss_update_t::pCurrentSoundscape"
{
"windows" "4"
"windows64" "8"
"linux" "4"
"windows64" "8"
}
"CGameClient::thing"
{
"windows" "4"
"windows64" "8"
"linux" "4"
"windows64" "8"
}
} }
} }
@ -236,26 +208,6 @@
"windows" "12" "windows" "12"
"linux" "12" "linux" "12"
} }
"SoundInfo_t::fVolume"
{
"windows" "40"
"linux" "40"
}
"SoundInfo_t::bIsAmbient"
{
"windows" "89"
"linux" "89"
}
"ss_update_t::pCurrentSoundscape"
{
"windows" "4"
"linux" "4"
}
"CGameClient::thing"
{
"windows" "4"
"linux" "4"
}
} }
} }
} }

View File

@ -39,14 +39,11 @@ Address gP_SoundscapeSystem = Address_Null;
Handle gH_AcceptInput = null; Handle gH_AcceptInput = null;
Handle gH_GetPlayerSlot = null; Handle gH_GetPlayerSlot = null;
Handle gH_GetStringID = null; Handle gH_GetStringID = null;
int gI_AmbientOffset = -1;
int gI_m_soundscapesOffset = -1; int gI_m_soundscapesOffset = -1;
int gI_VolumeOffset = -1;
int gI_CurrentSoundscapeOffset = -1;
int gI_CGameClientThing = -1;
// Other // Other
int gI_SilentSoundScape = -1; int gI_SilentSoundScape = -1;
int gI_AmbientOffset = 0;
char gS_WeaponID[32]; char gS_WeaponID[32];
bool gB_ShouldHookShotgunShot = false; bool gB_ShouldHookShotgunShot = false;
@ -67,10 +64,12 @@ public void OnPluginStart()
gEV_Type = GetEngineVersion(); gEV_Type = GetEngineVersion();
if(gEV_Type == Engine_CSS) if(gEV_Type == Engine_CSS)
{ {
gI_AmbientOffset = 85;
FormatEx(gS_WeaponID, sizeof(gS_WeaponID), "m_iWeaponID"); FormatEx(gS_WeaponID, sizeof(gS_WeaponID), "m_iWeaponID");
} }
else if(gEV_Type == Engine_CSGO) else if(gEV_Type == Engine_CSGO)
{ {
gI_AmbientOffset = 89;
FormatEx(gS_WeaponID, sizeof(gS_WeaponID), "m_weapon"); FormatEx(gS_WeaponID, sizeof(gS_WeaponID), "m_weapon");
} }
else else
@ -238,31 +237,6 @@ void LoadDHooks()
HookAcceptInput(); HookAcceptInput();
HookSendSound(hGameData); HookSendSound(hGameData);
if ((gI_AmbientOffset = GameConfGetOffset(hGameData, "SoundInfo_t::bIsAmbient")) == -1)
{
SetFailState("Could not get SoundInfo_t::bIsAmbient offset");
}
if ((gI_m_soundscapesOffset = GameConfGetOffset(hGameData, "CSoundscapeSystem::m_soundscapes")) == -1)
{
SetFailState("Could not get CSoundscapeSystem::m_soundscapes offset");
}
if ((gI_VolumeOffset = GameConfGetOffset(hGameData, "SoundInfo_t::fVolume")) == -1)
{
SetFailState("Could not get SoundInfo_t::fVolume offset");
}
if ((gI_CurrentSoundscapeOffset = GameConfGetOffset(hGameData, "ss_update_t::pCurrentSoundscape")) == -1)
{
SetFailState("Could not get ss_update_t::pCurrentSoundscape");
}
if ((gI_CGameClientThing = GameConfGetOffset(hGameData, "CGameClient::thing")) == -1)
{
SetFailState("Could not get CGameClient::thing");
}
delete hGameData; delete hGameData;
} }
@ -275,6 +249,11 @@ void StartPrepSDKCall_GetStringID(Handle hGameData)
SetFailState("Could not get address of CSoundscapeSystem pointer."); 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); StartPrepSDKCall(SDKCall_Raw);
PrepSDKCall_SetFromConf(hGameData, SDKConf_Signature, "CStringRegistry::GetStringID"); PrepSDKCall_SetFromConf(hGameData, SDKConf_Signature, "CStringRegistry::GetStringID");
PrepSDKCall_AddParameter(SDKType_String, SDKPass_Pointer); PrepSDKCall_AddParameter(SDKType_String, SDKPass_Pointer);
@ -329,7 +308,7 @@ void HookSoundscapes(Handle hGameData)
struct ss_update_t struct ss_update_t
{ {
CBasePlayer *pPlayer; Offset: 0 | Size: 4 CBasePlayer *pPlayer; Offset: 0 | Size: 4
CEnvSoundscape *pCurrentSoundscape; Offset: 4 | Size: 4 CEnvSoundscape pCurrentSoundscape; Offset: 4 | Size: 4
Vector playerPosition; Offset: 8 | Size: 12 Vector playerPosition; Offset: 8 | Size: 12
float currentDistance; Offset: 20 | Size: 4 float currentDistance; Offset: 20 | Size: 4
int traceCount; Offset: 24 | Size: 4 int traceCount; Offset: 24 | Size: 4
@ -366,7 +345,7 @@ public MRESReturn DHook_UpdateForPlayer(int pThis, Handle hParams)
} }
else else
{ {
DHookSetParamObjectPtrVar(hParams, 1, gI_CurrentSoundscapeOffset, ObjectValueType_CBaseEntityPtr, 0); DHookSetParamObjectPtrVar(hParams, 1, 4, ObjectValueType_CBaseEntityPtr, 0);
} }
gI_LastSoundscape[client] = GetEntProp(client, Prop_Data, "soundscapeIndex"); gI_LastSoundscape[client] = GetEntProp(client, Prop_Data, "soundscapeIndex");
@ -505,13 +484,13 @@ void HookSendSound(Handle hGameData)
//void CGameClient::SendSound( SoundInfo_t &sound, bool isReliable ) //void CGameClient::SendSound( SoundInfo_t &sound, bool isReliable )
public MRESReturn DHook_SendSound(Address pThis, Handle hParams) public MRESReturn DHook_SendSound(Address pThis, Handle hParams)
{ {
if(DHookGetParamObjectPtrVar(hParams, 1, gI_VolumeOffset, ObjectValueType_Float) == 0.0) if(DHookGetParamObjectPtrVar(hParams, 1, 40, ObjectValueType_Float) == 0.0)
{ {
return MRES_Ignored; return MRES_Ignored;
} }
// TODO: // TODO:
Address pIClient = pThis + view_as<Address>(gI_CGameClientThing); Address pIClient = pThis + view_as<Address>(0x4);
int client = view_as<int>(SDKCall(gH_GetPlayerSlot, pIClient)) + 1; int client = view_as<int>(SDKCall(gH_GetPlayerSlot, pIClient)) + 1;
if(!IsValidClient(client)) if(!IsValidClient(client))