make requested changes

This commit is contained in:
Clayton Gilmer 2022-05-02 19:41:05 -04:00
parent afdde41a1b
commit 97d565a6e1

View File

@ -12,9 +12,9 @@ namespace database
namespace namespace
{ {
game::dvar_t* db_filesysImpl = nullptr; 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) switch (db_filesysImpl->current.integer)
{ {
@ -33,13 +33,17 @@ namespace database
public: public:
void post_unpack() override void post_unpack() override
{ {
static const char* values[] = { static const char* values[] =
{
"BnetTACTVFSManager", // (load files from CASC) "BnetTACTVFSManager", // (load files from CASC)
"DiskFS", // (load files from disk) "DiskFS", // (load files from disk)
nullptr 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<int>(!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); db_filesysImpl = dvars::register_enum("db_filesysImpl", values, default_value, game::DVAR_FLAG_READ);
if (default_value == 1) 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) 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);
} }
}; };
} }