From 38897d308d3102aca9a1a6bb94096e1e7ea27438 Mon Sep 17 00:00:00 2001 From: Federico Cecchetto Date: Wed, 15 Jun 2022 00:17:54 +0200 Subject: [PATCH] Set filesystem current path to fs_basegame --- src/component/io.cpp | 3 +++ src/game/structs.hpp | 12 ++++++++++++ src/game/symbols.hpp | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/component/io.cpp b/src/component/io.cpp index 6c51d2f..3bdbbba 100644 --- a/src/component/io.cpp +++ b/src/component/io.cpp @@ -15,6 +15,9 @@ namespace io public: void post_unpack() override { + const auto fs_basegame = game::Dvar_FindVar("fs_basegame"); + std::filesystem::current_path(fs_basegame->current.string); + gsc::function::add_multiple([](const std::string& file, const std::string& data, const scripting::variadic_args& va) { diff --git a/src/game/structs.hpp b/src/game/structs.hpp index 488fd77..c026bb9 100644 --- a/src/game/structs.hpp +++ b/src/game/structs.hpp @@ -492,12 +492,19 @@ namespace game float max; }; + struct DvarLimits_integer64 + { + __int64 min; + __int64 max; + }; + union DvarLimits { $A37BA207B3DDD6345C554D4661813EDD enumeration; $9CA192F9DB66A3CB7E01DE78A0DEA53D integer; $251C2428A496074035CACA7AAF3D55BD value; $251C2428A496074035CACA7AAF3D55BD vector; + DvarLimits_integer64 integer64; }; struct dvar_t @@ -508,13 +515,18 @@ namespace game unsigned int flags; dvarType_t type; bool modified; + bool loadedFromSaveGame; DvarValue current; DvarValue latched; + DvarValue saved; DvarValue reset; DvarLimits domain; dvar_t* hashNext; }; + static_assert(offsetof(dvar_t, hashNext) == 104); + static_assert(offsetof(dvar_t, current) == 24); + struct GSC_OBJ { char magic[8]; diff --git a/src/game/symbols.hpp b/src/game/symbols.hpp index b48129f..33687f0 100644 --- a/src/game/symbols.hpp +++ b/src/game/symbols.hpp @@ -19,7 +19,7 @@ namespace game WEAK symbol Com_Printf{0x566BC0, 0x64C260}; - WEAK symbol Dvar_FindVar{0x0, 0x0}; + WEAK symbol Dvar_FindVar{0x5AE810, 0x512F70}; WEAK symbol Dvar_GetInt{0x0, 0x0}; WEAK symbol Dvar_RegisterInt{0x0, 0x0};