Skip to content

Commit

Permalink
Fix bik videos overriding from mods
Browse files Browse the repository at this point in the history
  • Loading branch information
rafalh committed Aug 18, 2024
1 parent 9bcfa83 commit f8bed2a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
14 changes: 13 additions & 1 deletion game_patch/misc/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "../rf/os/os.h"
#include "../rf/misc.h"
#include "../rf/vmesh.h"
#include "../rf/file/file.h"
#include "../object/object.h"

void apply_main_menu_patches();
Expand Down Expand Up @@ -376,6 +377,17 @@ CodeInjection vfile_read_stack_corruption_fix{
},
};

CodeInjection game_set_file_paths_injection{
0x004B1810,
[]() {
if (rf::mod_param.found()) {
std::string mod_dir = "mods\\";
mod_dir += rf::mod_param.get_arg();
rf::file_add_path(mod_dir.c_str(), ".bik", false);
}
},
};

void misc_init()
{
// Window title (client and server)
Expand Down Expand Up @@ -478,7 +490,7 @@ void misc_init()
AsmWriter{0x0045515B}.nop(5);

// Add support for Bink videos in mods
write_mem_ptr(0x004B174A + 1, ".vpp .bik");
game_set_file_paths_injection.install();

// Apply patches from other files
apply_main_menu_patches();
Expand Down
1 change: 1 addition & 0 deletions game_patch/rf/os/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ namespace rf
static auto& console_redraw_counter = addr_as_ref<uint32_t>(0x01775698);

static auto& lan_only_cmd_line_param = addr_as_ref<CmdLineParam>(0x0063F608);
static auto& mod_param = addr_as_ref<CmdLineParam>(0x007D9528);

static auto& cmdline_args = addr_as_ref<CmdArg[50]>(0x01AED368);
static auto& cmdline_num_args = addr_as_ref<int>(0x01AED514);
Expand Down

0 comments on commit f8bed2a

Please sign in to comment.