Set filesystem current path to fs_basegame

This commit is contained in:
Federico Cecchetto 2022-06-15 00:17:54 +02:00
parent 8c0d999a2a
commit 38897d308d
3 changed files with 16 additions and 1 deletions

View File

@ -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)
{

View File

@ -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];

View File

@ -19,7 +19,7 @@ namespace game
WEAK symbol<int(const char* fmt, ...)> Com_Printf{0x566BC0, 0x64C260};
WEAK symbol<const dvar_t*(const char*)> Dvar_FindVar{0x0, 0x0};
WEAK symbol<const dvar_t*(const char*)> Dvar_FindVar{0x5AE810, 0x512F70};
WEAK symbol<int(const dvar_t*)> Dvar_GetInt{0x0, 0x0};
WEAK symbol<dvar_t*(const char* dvarName, int value, int min, int max,
unsigned int flags, const char* description)> Dvar_RegisterInt{0x0, 0x0};