singleplayer mod stuff
This commit is contained in:
parent
9df6257732
commit
fa41a6a8d3
@ -91,6 +91,8 @@ namespace fastfiles
|
||||
return db_read_stream_file_hook.invoke<void>(a1, a2);
|
||||
}
|
||||
|
||||
namespace mp
|
||||
{
|
||||
void skip_extra_zones_stub(utils::hook::assembler& a)
|
||||
{
|
||||
const auto skip = a.newLabel();
|
||||
@ -114,6 +116,32 @@ namespace fastfiles
|
||||
a.and_(esi, r14d);
|
||||
a.jmp(0x39814F_b);
|
||||
}
|
||||
}
|
||||
namespace sp
|
||||
{
|
||||
void skip_extra_zones_stub(utils::hook::assembler& a)
|
||||
{
|
||||
const auto skip = a.newLabel();
|
||||
const auto original = a.newLabel();
|
||||
|
||||
a.pushad64();
|
||||
a.test(ebp, game::DB_ZONE_CUSTOM); // allocFlags
|
||||
a.jnz(skip);
|
||||
|
||||
a.bind(original);
|
||||
a.popad64();
|
||||
a.mov(r8d, 9);
|
||||
a.mov(rdx, 0x782210_b);
|
||||
a.jmp(0x1F4006_b);
|
||||
|
||||
a.bind(skip);
|
||||
a.popad64();
|
||||
a.mov(r15d, game::DB_ZONE_CUSTOM);
|
||||
a.not_(r15d);
|
||||
a.and_(ebp, r15d);
|
||||
a.jmp(0x1F4023_b);
|
||||
}
|
||||
}
|
||||
|
||||
utils::hook::detour sys_createfile_hook;
|
||||
HANDLE sys_create_file_stub(game::Sys_Folder folder, const char* base_filename)
|
||||
@ -164,7 +192,7 @@ namespace fastfiles
|
||||
std::vector<game::XZoneInfo> data;
|
||||
merge(&data, zoneInfo, zoneCount);
|
||||
|
||||
// code_pre_gfx_mp
|
||||
// code_pre_gfx
|
||||
|
||||
game::DB_LoadXAssets(data.data(), static_cast<std::uint32_t>(data.size()), syncMode);
|
||||
}
|
||||
@ -174,9 +202,9 @@ namespace fastfiles
|
||||
std::vector<game::XZoneInfo> data;
|
||||
merge(&data, zoneInfo, zoneCount);
|
||||
|
||||
// code_post_gfx_mp
|
||||
// ui_mp
|
||||
// common_mp
|
||||
// code_post_gfx
|
||||
// ui
|
||||
// common
|
||||
|
||||
if (fastfiles::exists("mod"))
|
||||
{
|
||||
@ -191,7 +219,7 @@ namespace fastfiles
|
||||
std::vector<game::XZoneInfo> data;
|
||||
merge(&data, zoneInfo, zoneCount);
|
||||
|
||||
// ui_mp
|
||||
// ui
|
||||
|
||||
game::DB_LoadXAssets(data.data(), static_cast<std::uint32_t>(data.size()), syncMode);
|
||||
}
|
||||
@ -251,28 +279,29 @@ namespace fastfiles
|
||||
// Fix compressor type on streamed file load
|
||||
db_read_stream_file_hook.create(SELECT_VALUE(0x1FB9D0_b, 0x3A1BF0_b), db_read_stream_file_stub);
|
||||
|
||||
// Don't load extra zones with loadzone
|
||||
if (!game::environment::is_sp())
|
||||
{
|
||||
// TODO: SP?
|
||||
utils::hook::nop(0x398061_b, 15);
|
||||
utils::hook::jump(0x398061_b, utils::hook::assemble(skip_extra_zones_stub), true);
|
||||
}
|
||||
|
||||
if (!game::environment::is_sp())
|
||||
{
|
||||
// Add custom zone paths
|
||||
sys_createfile_hook.create(game::Sys_CreateFile, sys_create_file_stub);
|
||||
|
||||
// load our custom pre_gfx zones
|
||||
utils::hook::call(0x15C3FD_b, load_pre_gfx_zones);
|
||||
utils::hook::call(0x15C75D_b, load_pre_gfx_zones);
|
||||
utils::hook::call(SELECT_VALUE(0x3862ED_b, 0x15C3FD_b), load_pre_gfx_zones);
|
||||
utils::hook::call(SELECT_VALUE(0x3865E7_b, 0x15C75D_b), load_pre_gfx_zones);
|
||||
|
||||
// load our custom ui and common zones
|
||||
utils::hook::call(0x686421_b, load_post_gfx_and_ui_and_common_zones);
|
||||
utils::hook::call(SELECT_VALUE(0x5634AA_b, 0x686421_b), load_post_gfx_and_ui_and_common_zones);
|
||||
|
||||
// load our custom ui zones
|
||||
utils::hook::call(0x17C6D2_b, load_ui_zones);
|
||||
utils::hook::call(SELECT_VALUE(0x3A5676_b, 0x17C6D2_b), load_ui_zones);
|
||||
|
||||
// Don't load extra zones with loadzone
|
||||
if (game::environment::is_sp())
|
||||
{
|
||||
utils::hook::nop(0x1F3FF9_b, 13);
|
||||
utils::hook::jump(0x1F3FF9_b, utils::hook::assemble(sp::skip_extra_zones_stub), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
utils::hook::nop(0x398061_b, 15);
|
||||
utils::hook::jump(0x398061_b, utils::hook::assemble(mp::skip_extra_zones_stub), true);
|
||||
}
|
||||
|
||||
command::add("loadzone", [](const command::params& params)
|
||||
|
@ -85,7 +85,7 @@ namespace filesystem
|
||||
get_search_paths().insert("data");
|
||||
|
||||
// fs_game flags
|
||||
utils::hook::set<uint32_t>(0x189275_b, 0);
|
||||
utils::hook::set<uint32_t>(SELECT_VALUE(0x40D2A5_b, 0x189275_b), 0);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -83,9 +83,15 @@ namespace weapon
|
||||
{
|
||||
public:
|
||||
void post_unpack() override
|
||||
{
|
||||
if (!game::environment::is_sp())
|
||||
{
|
||||
g_setup_level_weapon_def_hook.create(0x462630_b, g_setup_level_weapon_def_stub);
|
||||
|
||||
// disable custom weapon index mismatch (fix for custom attachments) (NEEDS TESTING)
|
||||
//utils::hook::set<uint8_t>(0x11B910_b, 0xC3); // CG_SetupCustomWeapon
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
command::add("setWeaponFieldFloat", [](const command::params& params)
|
||||
{
|
||||
|
@ -166,7 +166,7 @@ namespace game
|
||||
int createDefault)> DB_FindXAssetHeader{0x1F1120, 0x3950C0};
|
||||
WEAK symbol<bool(const char* zone, int source)> DB_FileExists{0x1F0D50, 0x394DC0};
|
||||
WEAK symbol<void(XZoneInfo* zoneInfo, unsigned int zoneCount, DBSyncMode syncMode)> DB_LoadXAssets{0x1F31E0, 0x397500};
|
||||
WEAK symbol<bool(const char* zoneName)> DB_IsLocalized{0x0, 0x396790};
|
||||
WEAK symbol<bool(const char* zoneName)> DB_IsLocalized{0x1F23C0, 0x396790};
|
||||
|
||||
WEAK symbol<void(int clientNum, const char* menu,
|
||||
int a3, int a4, unsigned int a5)> LUI_OpenMenu{0x3F20A0, 0x1E1210};
|
||||
@ -210,7 +210,7 @@ namespace game
|
||||
WEAK symbol<bool()> Sys_IsDatabaseReady2{0x3AB100, 0x4F79C0};
|
||||
WEAK symbol<bool(int, void const*, const netadr_s*)> Sys_SendPacket{0x0, 0x5BDA90};
|
||||
WEAK symbol<bool(const char* path)> Sys_FileExists{0x0, 0x0};
|
||||
WEAK symbol<HANDLE(Sys_Folder, const char* baseFilename)> Sys_CreateFile{0x0, 0x5B2860};
|
||||
WEAK symbol<HANDLE(Sys_Folder, const char* baseFilename)> Sys_CreateFile{0x42C430, 0x5B2860};
|
||||
|
||||
WEAK symbol<const char*(const char*)> UI_GetMapDisplayName{0x0, 0x4DDEE0};
|
||||
WEAK symbol<const char*(const char*)> UI_GetGameTypeDisplayName{0x0, 0x4DD8C0};
|
||||
|
Loading…
Reference in New Issue
Block a user