This commit is contained in:
quaK 2023-12-26 01:59:19 +02:00
parent 2554846b30
commit 8def7b71d9
6 changed files with 43 additions and 26 deletions

View File

@ -61,11 +61,6 @@ namespace branding
class component final : public component_interface
{
public:
void post_start() override
{
scheduler::loop(draw_branding, scheduler::pipeline::renderer);
}
void post_unpack() override
{
if (game::environment::is_dedi())
@ -73,6 +68,8 @@ namespace branding
return;
}
scheduler::loop(draw_branding, scheduler::pipeline::renderer);
ui_get_formatted_build_number_hook.create(
SELECT_VALUE(0x406EC0_b, 0x1DF300_b), ui_get_formatted_build_number_stub);
}

View File

@ -22,6 +22,7 @@ namespace fastfiles
namespace
{
utils::hook::detour db_init_load_x_file_hook;
utils::hook::detour db_try_load_x_file_internal_hook;
utils::hook::detour db_find_xasset_header_hook;
@ -31,9 +32,14 @@ namespace fastfiles
utils::concurrency::container<std::vector<HANDLE>> fastfile_handles;
bool is_mod_pre_gfx = false;
void db_init_load_x_file_stub(game::DBFile* file, std::uint64_t offset)
{
console::info("Loading fastfile %s\n", file->name);
return db_init_load_x_file_hook.invoke<void>(file, offset);
}
void db_try_load_x_file_internal(const char* zone_name, const int flags)
{
console::info("Loading fastfile %s\n", zone_name);
is_mod_pre_gfx = zone_name == "mod_pre_gfx"s;
current_fastfile.access([&](std::string& fastfile)
{
@ -74,30 +80,32 @@ namespace fastfiles
dump_gsc_script(name, result);
}
const std::string override_asset_name = "override/"s + name;
if (type == game::XAssetType::ASSET_TYPE_RAWFILE)
{
if (result.rawfile)
const std::string override_asset_name = "override/"s + name;
if (type == game::XAssetType::ASSET_TYPE_RAWFILE)
{
const auto override_rawfile = db_find_xasset_header_hook.invoke<game::XAssetHeader>(type, override_asset_name.data(), 0);
if (override_rawfile.rawfile)
if (result.rawfile)
{
result.rawfile = override_rawfile.rawfile;
console::debug("using override asset for rawfile: \"%s\"\n", name);
const auto override_rawfile = db_find_xasset_header_hook.invoke<game::XAssetHeader>(type, override_asset_name.data(), 0);
if (override_rawfile.rawfile)
{
result.rawfile = override_rawfile.rawfile;
console::debug("using override asset for rawfile: \"%s\"\n", name);
}
}
}
}
if (type == game::XAssetType::ASSET_TYPE_STRINGTABLE)
{
if (result.stringTable)
if (type == game::XAssetType::ASSET_TYPE_STRINGTABLE)
{
const auto override_stringtable = db_find_xasset_header_hook.invoke<game::XAssetHeader>(type, override_asset_name.data(), 0);
if (override_stringtable.stringTable)
if (result.stringTable)
{
result.stringTable = override_stringtable.stringTable;
console::debug("using override asset for stringtable: \"%s\"\n", name);
const auto override_stringtable = db_find_xasset_header_hook.invoke<game::XAssetHeader>(type, override_asset_name.data(), 0);
if (override_stringtable.stringTable)
{
result.stringTable = override_stringtable.stringTable;
console::debug("using override asset for stringtable: \"%s\"\n", name);
}
}
}
}
@ -1193,8 +1201,8 @@ namespace fastfiles
public:
void post_unpack() override
{
db_try_load_x_file_internal_hook.create(
SELECT_VALUE(0x1F5700_b, 0x39A620_b), &db_try_load_x_file_internal);
db_try_load_x_file_internal_hook.create(SELECT_VALUE(0x1F5700_b, 0x39A620_b), db_try_load_x_file_internal);
db_init_load_x_file_hook.create(SELECT_VALUE(0x1C46E0_b, 0x3681E0_b), db_init_load_x_file_stub);
db_find_xasset_header_hook.create(game::DB_FindXAssetHeader, db_find_xasset_header_stub);
db_unload_x_zones_hook.create(SELECT_VALUE(0x1F6040_b,

View File

@ -136,8 +136,10 @@ namespace imagefiles
}
void* pakfile_open_stub(void* /*handles*/, unsigned int count, int is_imagefile,
unsigned int index, int is_localized)
unsigned int index, short is_localized)
{
console::debug("Opening %s%d.pak (localized:%d)\n", is_imagefile ? "imagefile" : "soundfile", index, is_localized);
if (index != CUSTOM_IMAGE_FILE_INDEX)
{
return utils::hook::invoke<void*>(

View File

@ -46,6 +46,11 @@ namespace lui
public:
void post_unpack() override
{
if (game::environment::is_dedi())
{
return;
}
if (game::environment::is_mp())
{
// Patch game message overflow

View File

@ -2418,6 +2418,12 @@ namespace game
DB_AuthSignature signature;
};
struct DBFile
{
char __pad0[32];
char name[64];
};
namespace hks
{
struct lua_State;

View File

@ -158,7 +158,6 @@ FARPROC load_binary(const launcher::mode mode, uint64_t* base_address)
void remove_crash_file()
{
utils::io::remove_file("__h1Exe");
utils::io::remove_file("h1-mod\\h1_mp64_ship.exe"); // remove this at some point
}
void enable_dpi_awareness()