From da7ba34025474b63a9e030b6a3564da00b803eeb Mon Sep 17 00:00:00 2001 From: momo5502 Date: Mon, 11 Jan 2016 12:09:31 +0100 Subject: [PATCH] Volume shit. --- src/Components/Modules/Dvar.cpp | 4 ++++ src/Components/Modules/Theatre.cpp | 9 ++++++++- src/Game/Functions.cpp | 2 ++ src/Game/Functions.hpp | 2 ++ src/Game/Structs.hpp | 20 ++++++++++++++++++++ 5 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/Components/Modules/Dvar.cpp b/src/Components/Modules/Dvar.cpp index 8c13339c..9bdd9f5d 100644 --- a/src/Components/Modules/Dvar.cpp +++ b/src/Components/Modules/Dvar.cpp @@ -179,6 +179,10 @@ namespace Components static float cgFov90 = 90.0f; Utils::Hook::Set(0x4F8E28, &cgFov90); + // set max volume to 1 + static float volume = 1.0f; + Utils::Hook::Set(0x408078, &volume); + // Hook dvar 'name' registration Utils::Hook(0x40531C, Dvar::RegisterName, HOOK_CALL).Install()->Quick(); } diff --git a/src/Components/Modules/Theatre.cpp b/src/Components/Modules/Theatre.cpp index 473c600c..1ad87e9d 100644 --- a/src/Components/Modules/Theatre.cpp +++ b/src/Components/Modules/Theatre.cpp @@ -222,6 +222,7 @@ namespace Components FileSystem::DeleteFile("demos", info.Name + ".dm_13.json"); // Reset our ui_demo_* dvars here, because the theater menu needs it. + // Resetting them has no use, as they don't have any default value! Command::Execute("reset ui_demo_mapname", true); Command::Execute("reset ui_demo_mapname_localized", true); Command::Execute("reset ui_demo_gametype", true); @@ -271,7 +272,7 @@ namespace Components Dvar::Var("ui_demo_mapname").Set(info.Mapname); Dvar::Var("ui_demo_mapname_localized").Set(Game::UI_LocalizeMapName(info.Mapname.data())); Dvar::Var("ui_demo_gametype").Set(Game::UI_LocalizeGameType(info.Gametype.data())); - Dvar::Var("ui_demo_length").Set(Utils::FormatTimeSpan(info.Length)); // TODO: Parse as readable string + Dvar::Var("ui_demo_length").Set(Utils::FormatTimeSpan(info.Length)); Dvar::Var("ui_demo_author").Set(info.Author); Dvar::Var("ui_demo_date").Set(std::asctime(std::localtime(&info.TimeStamp))); } @@ -363,5 +364,11 @@ namespace Components // Change font size Utils::Hook::Set(0x5AC854, 2); Utils::Hook::Set(0x5AC85A, 2); + +// Command::Add("democycle", [] (Command::Params params) +// { +// // Cmd_FollowCycle_f +// Utils::Hook::Call(0x458ED0)(Game::g_entities, -1); +// }); } } diff --git a/src/Game/Functions.cpp b/src/Game/Functions.cpp index c0f27f93..63a77894 100644 --- a/src/Game/Functions.cpp +++ b/src/Game/Functions.cpp @@ -157,6 +157,8 @@ namespace Game int* demoRecording = (int*)0xA5EA08; int* serverMessageSequence = (int*)0xA3E9B4; + gentity_t* g_entities = (gentity_t*)0x18835D8; + void* ReallocateAssetPool(XAssetType type, unsigned int newSize) { int elSize = DB_GetXAssetSizeHandlers[type](); diff --git a/src/Game/Functions.hpp b/src/Game/Functions.hpp index bbbeeef5..49e0ef53 100644 --- a/src/Game/Functions.hpp +++ b/src/Game/Functions.hpp @@ -315,6 +315,8 @@ namespace Game extern int* demoRecording; extern int* serverMessageSequence; + extern gentity_t* g_entities; + void* ReallocateAssetPool(XAssetType type, unsigned int newSize); void Menu_FreeItemMemory(Game::itemDef_t* item); void OOBPrintT(int type, netadr_t netadr, const char* message); diff --git a/src/Game/Structs.hpp b/src/Game/Structs.hpp index a34b68f4..01800433 100644 --- a/src/Game/Structs.hpp +++ b/src/Game/Structs.hpp @@ -656,6 +656,26 @@ namespace Game int lastEntityRef; } msg_t; + typedef struct gclient_s + { + unsigned char pad[12764]; + unsigned int team; + char pad2[1164]; + } gclient_t; + + typedef struct gentity_s + { + unsigned char pad[312]; // 0 + float origin[3]; // 312 + float angles[3]; // 324 + char pad2[8]; + gclient_t* client; // 344 + unsigned char pad3[28]; + short classname; + short pad4; + unsigned char pad5[248]; + } gentity_t; + #pragma pack(push, 1) typedef struct client_s {