From 97d565a6e1a834bae0f3f2b3737798cedd171d41 Mon Sep 17 00:00:00 2001 From: Clayton Gilmer Date: Mon, 2 May 2022 19:41:05 -0400 Subject: [PATCH] make requested changes --- src/client/component/database.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/client/component/database.cpp b/src/client/component/database.cpp index 37300a2a..14647371 100644 --- a/src/client/component/database.cpp +++ b/src/client/component/database.cpp @@ -12,9 +12,9 @@ namespace database namespace { game::dvar_t* db_filesysImpl = nullptr; - utils::hook::detour db_fsinitialize_hook; + utils::hook::detour db_fs_initialize_hook; - game::DB_FileSysInterface* db_fsinitialize_stub() + game::DB_FileSysInterface* db_fs_initialize_stub() { switch (db_filesysImpl->current.integer) { @@ -33,13 +33,17 @@ namespace database public: void post_unpack() override { - static const char* values[] = { + static const char* values[] = + { "BnetTACTVFSManager", // (load files from CASC) "DiskFS", // (load files from disk) nullptr }; - int default_value = (utils::io::directory_exists("Data/data") && utils::io::directory_exists("Data/config") && utils::io::directory_exists("Data/indices")) ? 0 : 1; + const auto default_value = static_cast(!utils::io::directory_exists("Data/data") + || !utils::io::directory_exists("Data/config") + || !utils::io::directory_exists("Data/indices")); + db_filesysImpl = dvars::register_enum("db_filesysImpl", values, default_value, game::DVAR_FLAG_READ); if (default_value == 1) @@ -48,7 +52,7 @@ namespace database utils::hook::nop(0x14071AF83, 45); // Skip setting Bink file OS callbacks (not necessary since we're loading from disk) } - db_fsinitialize_hook.create(game::DB_FSInitialize, db_fsinitialize_stub); + db_fs_initialize_hook.create(game::DB_FSInitialize, db_fs_initialize_stub); } }; }