fix up everything
This commit is contained in:
parent
fc054f4fe8
commit
91e25f97ac
@ -4,7 +4,7 @@
|
||||
#include "game/dvars.hpp"
|
||||
#include "game/game.hpp"
|
||||
|
||||
#include <utils/flags.hpp>
|
||||
#include <utils/io.hpp>
|
||||
#include <utils/hook.hpp>
|
||||
|
||||
namespace database
|
||||
@ -12,10 +12,9 @@ namespace database
|
||||
namespace
|
||||
{
|
||||
game::dvar_t* db_filesysImpl = nullptr;
|
||||
utils::hook::detour db_fsinitialize_hook;
|
||||
|
||||
utils::hook::detour sub_140272EC0_hook;
|
||||
|
||||
game::DB_FileSysInterface* sub_140272EC0_stub()
|
||||
game::DB_FileSysInterface* db_fsinitialize_stub()
|
||||
{
|
||||
switch (db_filesysImpl->current.integer)
|
||||
{
|
||||
@ -27,8 +26,6 @@ namespace database
|
||||
return nullptr; // this should not happen
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class component final : public component_interface
|
||||
@ -42,15 +39,16 @@ namespace database
|
||||
nullptr
|
||||
};
|
||||
|
||||
int default_value = utils::flags::has_flag("disk") ? 1 : 0;
|
||||
int default_value = utils::io::directory_exists("Data/data") ? 0 : 1;
|
||||
db_filesysImpl = dvars::register_enum("db_filesysImpl", values, default_value, game::DVAR_FLAG_READ);
|
||||
|
||||
if (default_value == 1)
|
||||
{
|
||||
utils::hook::nop(0x1405A4868, 22); // TACT related stuff that's pointless if we're using DiskFS
|
||||
utils::hook::nop(0x14071AF83, 45); // Skip setting Bink file OS callbacks (not necessary since we're loading from disk)
|
||||
}
|
||||
|
||||
sub_140272EC0_hook.create(0x140272EC0, sub_140272EC0_stub);
|
||||
db_fsinitialize_hook.create(game::DB_FSInitialize, db_fsinitialize_stub);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -2223,7 +2223,7 @@ namespace dvars
|
||||
};
|
||||
|
||||
game::dvar_t* register_int(const std::string& name, int value, int min, int max,
|
||||
game::DvarFlags flags)
|
||||
unsigned int flags)
|
||||
{
|
||||
dvar_list.insert(name);
|
||||
const auto hash = game::generateHashValue(name.data());
|
||||
@ -2231,14 +2231,14 @@ namespace dvars
|
||||
}
|
||||
|
||||
game::dvar_t* register_bool(const std::string& name, bool value,
|
||||
game::DvarFlags flags)
|
||||
unsigned int flags)
|
||||
{
|
||||
dvar_list.insert(name);
|
||||
const auto hash = game::generateHashValue(name.data());
|
||||
return game::Dvar_RegisterBool(hash, "", value, flags);
|
||||
}
|
||||
|
||||
game::dvar_t* register_enum(const std::string& name, const char** valueList, int defaultIndex, game::DvarFlags flags)
|
||||
game::dvar_t* register_enum(const std::string& name, const char** valueList, int defaultIndex, unsigned int flags)
|
||||
{
|
||||
dvar_list.insert(name);
|
||||
const auto hash = game::generateHashValue(name.data());
|
||||
@ -2246,7 +2246,7 @@ namespace dvars
|
||||
}
|
||||
|
||||
game::dvar_t* register_float(const std::string& name, float value, float min,
|
||||
float max, game::DvarFlags flags)
|
||||
float max, unsigned int flags)
|
||||
{
|
||||
dvar_list.insert(name);
|
||||
const auto hash = game::generateHashValue(name.data());
|
||||
@ -2254,7 +2254,7 @@ namespace dvars
|
||||
}
|
||||
|
||||
game::dvar_t* register_vec4(const std::string& name, float x, float y, float z,
|
||||
float w, float min, float max, game::DvarFlags flags)
|
||||
float w, float min, float max, unsigned int flags)
|
||||
{
|
||||
dvar_list.insert(name);
|
||||
const auto hash = game::generateHashValue(name.data());
|
||||
|
@ -29,9 +29,9 @@ namespace dvars
|
||||
std::string dvar_get_vector_domain(const int components, const game::dvar_limits& domain);
|
||||
std::string dvar_get_domain(const game::dvar_type type, const game::dvar_limits& domain);
|
||||
|
||||
game::dvar_t* register_int(const std::string& name, int value, int min, int max, game::DvarFlags flags);
|
||||
game::dvar_t* register_bool(const std::string& name, bool value, game::DvarFlags flags);
|
||||
game::dvar_t* register_enum(const std::string& name, const char** valueList, int defaultIndex, game::DvarFlags flags);
|
||||
game::dvar_t* register_float(const std::string& name, float value, float min, float max, game::DvarFlags flags);
|
||||
game::dvar_t* register_vec4(const std::string& name, float x, float y, float z, float w, float min, float max, game::DvarFlags flags);
|
||||
game::dvar_t* register_int(const std::string& name, int value, int min, int max, unsigned int flags);
|
||||
game::dvar_t* register_bool(const std::string& name, bool value, unsigned int flags);
|
||||
game::dvar_t* register_enum(const std::string& name, const char** valueList, int defaultIndex, unsigned int flags);
|
||||
game::dvar_t* register_float(const std::string& name, float value, float min, float max, unsigned int flags);
|
||||
game::dvar_t* register_vec4(const std::string& name, float x, float y, float z, float w, float min, float max, unsigned int flags);
|
||||
}
|
||||
|
@ -1102,12 +1102,12 @@ namespace game
|
||||
|
||||
struct DB_FileSysInterface;
|
||||
|
||||
// this is a best guess, interface doesn't match up exactly w/other games (IW8)
|
||||
// this is a best guess, interface doesn't match up exactly w/other games (IW8, T9)
|
||||
struct DB_FileSysInterface_vtbl
|
||||
{
|
||||
DB_IFileSysFile* (__fastcall* OpenFile)(DB_FileSysInterface* _this, Sys_Folder folder, const char* filename);
|
||||
FileSysResult (__fastcall* StartRead)(DB_FileSysInterface* _this, DB_IFileSysFile* handle, unsigned __int64 /* idk */, unsigned __int64 offset, unsigned __int64 size);
|
||||
FileSysResult (__fastcall* NumberOfBytesRead)(DB_FileSysInterface* _this, DB_IFileSysFile* handle, unsigned __int64* bytesRead);
|
||||
FileSysResult (__fastcall* Read)(DB_FileSysInterface* _this, DB_IFileSysFile* handle, unsigned __int64 offset, unsigned __int64 size, void* dest);
|
||||
FileSysResult (__fastcall* Tell)(DB_FileSysInterface* _this, DB_IFileSysFile* handle, unsigned __int64* bytesRead);
|
||||
__int64 (__fastcall* Size)(DB_FileSysInterface* _this, DB_IFileSysFile* handle);
|
||||
void (__fastcall* Close)(DB_FileSysInterface* _this, DB_IFileSysFile* handle);
|
||||
bool (__fastcall* Exists)(DB_FileSysInterface* _this, Sys_Folder folder, const char* filename);
|
||||
@ -1118,6 +1118,13 @@ namespace game
|
||||
DB_FileSysInterface_vtbl* vftbl;
|
||||
};
|
||||
|
||||
__declspec(align(8)) struct DiskFile
|
||||
{
|
||||
DWORD status;
|
||||
HANDLE handle;
|
||||
_OVERLAPPED overlapped;
|
||||
};
|
||||
|
||||
namespace hks
|
||||
{
|
||||
struct GenericChunkHeader
|
||||
|
@ -37,6 +37,7 @@ namespace game
|
||||
WEAK symbol<const char*(const XAsset* asset)> DB_GetXAssetName{0x1403E4090};
|
||||
WEAK symbol<void(XZoneInfo* zoneInfo, unsigned int zoneCount, DBSyncMode syncMode)> DB_LoadXAssets{0x140414FF0};
|
||||
WEAK symbol<XAssetHeader(XAssetType type, const char* name, int allowCreateDefault)> DB_FindXAssetHeader{0x140412F60};
|
||||
WEAK symbol<DB_FileSysInterface*()> DB_FSInitialize{0x140272EC0};
|
||||
WEAK symbol<int(const RawFile* rawfile)> DB_GetRawFileLen{0x140413D80};
|
||||
WEAK symbol<int(const RawFile* rawfile, char* buf, int size)> DB_GetRawBuffer{0x140413C40};
|
||||
|
||||
@ -127,6 +128,7 @@ namespace game
|
||||
WEAK symbol<void()> R_WaitWorkerCmds{0x140794330};
|
||||
WEAK symbol<void(const void* obj, void* pose, unsigned int entnum, unsigned int renderFxFlags, float* lightingOrigin,
|
||||
float materialTime, __int64 a7, __int64 a8)> R_AddDObjToScene{0x140775C40};
|
||||
WEAK symbol<HANDLE(unsigned __int64* outUserData, void* dest, unsigned __int64 bytes)> R_Cinematic_SysIO_BinkRead{0x1407191B0};
|
||||
|
||||
WEAK symbol<ScreenPlacement*()> ScrPlace_GetViewPlacement{0x1403E16A0};
|
||||
WEAK symbol<ScreenPlacement*()> ScrPlace_GetView{0x1403E1660};
|
||||
@ -163,6 +165,7 @@ namespace game
|
||||
WEAK symbol<HWND> hWnd{0x14CCF81C0};
|
||||
|
||||
WEAK symbol<const char*> g_assetNames{0x140BEF280};
|
||||
|
||||
WEAK symbol<int> g_poolSize{0x140BF2E40};
|
||||
|
||||
WEAK symbol<gentity_s> g_entities{0x1452DDDA0};
|
||||
@ -191,6 +194,8 @@ namespace game
|
||||
WEAK symbol<scrVmPub_t> scr_VmPub{0x14BA9EE40};
|
||||
WEAK symbol<function_stack_t> scr_function_stack{0x14BAA93C0};
|
||||
|
||||
WEAK symbol<DB_FileSysInterface*> g_fileSystem{0x1420B27E8};
|
||||
|
||||
namespace hks
|
||||
{
|
||||
WEAK symbol<lua_State*> lua_state{0x1419D83E8};
|
||||
|
Loading…
Reference in New Issue
Block a user