mirror of
https://github.com/Haze1337/Sound-Manager.git
synced 2025-12-06 18:08:34 +00:00
Compare commits
2 Commits
d0bf535a60
...
757c210541
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
757c210541 | ||
|
|
91ed36a82a |
@ -106,6 +106,34 @@
|
||||
"linux" "12"
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -208,6 +236,26 @@
|
||||
"windows" "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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,11 +39,14 @@ Address gP_SoundscapeSystem = Address_Null;
|
||||
Handle gH_AcceptInput = null;
|
||||
Handle gH_GetPlayerSlot = null;
|
||||
Handle gH_GetStringID = null;
|
||||
int gI_AmbientOffset = -1;
|
||||
int gI_m_soundscapesOffset = -1;
|
||||
int gI_VolumeOffset = -1;
|
||||
int gI_CurrentSoundscapeOffset = -1;
|
||||
int gI_CGameClientThing = -1;
|
||||
|
||||
// Other
|
||||
int gI_SilentSoundScape = -1;
|
||||
int gI_AmbientOffset = 0;
|
||||
char gS_WeaponID[32];
|
||||
|
||||
bool gB_ShouldHookShotgunShot = false;
|
||||
@ -64,12 +67,10 @@ public void OnPluginStart()
|
||||
gEV_Type = GetEngineVersion();
|
||||
if(gEV_Type == Engine_CSS)
|
||||
{
|
||||
gI_AmbientOffset = 85;
|
||||
FormatEx(gS_WeaponID, sizeof(gS_WeaponID), "m_iWeaponID");
|
||||
}
|
||||
else if(gEV_Type == Engine_CSGO)
|
||||
{
|
||||
gI_AmbientOffset = 89;
|
||||
FormatEx(gS_WeaponID, sizeof(gS_WeaponID), "m_weapon");
|
||||
}
|
||||
else
|
||||
@ -237,6 +238,31 @@ void LoadDHooks()
|
||||
HookAcceptInput();
|
||||
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;
|
||||
}
|
||||
|
||||
@ -249,11 +275,6 @@ 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);
|
||||
@ -308,7 +329,7 @@ void HookSoundscapes(Handle hGameData)
|
||||
struct ss_update_t
|
||||
{
|
||||
CBasePlayer *pPlayer; Offset: 0 | Size: 4
|
||||
CEnvSoundscape pCurrentSoundscape; Offset: 4 | Size: 4
|
||||
CEnvSoundscape *pCurrentSoundscape; Offset: 4 | Size: 4
|
||||
Vector playerPosition; Offset: 8 | Size: 12
|
||||
float currentDistance; Offset: 20 | Size: 4
|
||||
int traceCount; Offset: 24 | Size: 4
|
||||
@ -345,7 +366,7 @@ public MRESReturn DHook_UpdateForPlayer(int pThis, Handle hParams)
|
||||
}
|
||||
else
|
||||
{
|
||||
DHookSetParamObjectPtrVar(hParams, 1, 4, ObjectValueType_CBaseEntityPtr, 0);
|
||||
DHookSetParamObjectPtrVar(hParams, 1, gI_CurrentSoundscapeOffset, ObjectValueType_CBaseEntityPtr, 0);
|
||||
}
|
||||
|
||||
gI_LastSoundscape[client] = GetEntProp(client, Prop_Data, "soundscapeIndex");
|
||||
@ -484,13 +505,13 @@ void HookSendSound(Handle hGameData)
|
||||
//void CGameClient::SendSound( SoundInfo_t &sound, bool isReliable )
|
||||
public MRESReturn DHook_SendSound(Address pThis, Handle hParams)
|
||||
{
|
||||
if(DHookGetParamObjectPtrVar(hParams, 1, 40, ObjectValueType_Float) == 0.0)
|
||||
if(DHookGetParamObjectPtrVar(hParams, 1, gI_VolumeOffset, ObjectValueType_Float) == 0.0)
|
||||
{
|
||||
return MRES_Ignored;
|
||||
}
|
||||
|
||||
// TODO:
|
||||
Address pIClient = pThis + view_as<Address>(0x4);
|
||||
Address pIClient = pThis + view_as<Address>(gI_CGameClientThing);
|
||||
int client = view_as<int>(SDKCall(gH_GetPlayerSlot, pIClient)) + 1;
|
||||
|
||||
if(!IsValidClient(client))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user