Load table dynamically from FS
This commit is contained in:
parent
9a3d623883
commit
b8aa6f968b
Binary file not shown.
@ -4,6 +4,6 @@
|
||||
|
||||
#include <game.h>
|
||||
|
||||
void core_setup_patcher(struct game_data *game, HMODULE baseModule);
|
||||
void core_setup_patcher(struct game_data *game, HMODULE baseModule, wchar_t *txFile);
|
||||
|
||||
void *core_perform_tx(size_t *outLength);
|
||||
|
@ -38,7 +38,7 @@ void request_restart() {
|
||||
CloseHandle(hRestartFlag);
|
||||
}
|
||||
|
||||
static void _run_game(struct game_data *game) {
|
||||
static void _run_game(struct game_data *game, wchar_t *txFile) {
|
||||
// Create fake ACE driver files
|
||||
ace_fake_driver_files();
|
||||
|
||||
@ -47,14 +47,14 @@ static void _run_game(struct game_data *game) {
|
||||
ace_load_driver_module();
|
||||
|
||||
// ...magic
|
||||
core_setup_patcher(game, baseModule);
|
||||
core_setup_patcher(game, baseModule, txFile);
|
||||
|
||||
// Load the UnityPlayer module and invoke the callback
|
||||
HMODULE unityModule = LoadLibraryA("UnityPlayer.dll");
|
||||
INVOKE_CALLBACK(game->unityplayer_callback, unityModule);
|
||||
}
|
||||
|
||||
static void _run_tx(struct game_data *game, wchar_t *tableFile) {
|
||||
static void _run_tx(struct game_data *game, wchar_t *txFile) {
|
||||
// Load unpatched base module
|
||||
HMODULE baseModule = LoadLibraryA(game->base_module_name);
|
||||
if (!baseModule) {
|
||||
@ -66,8 +66,8 @@ static void _run_tx(struct game_data *game, wchar_t *tableFile) {
|
||||
void *table = core_perform_tx(&tableSize);
|
||||
|
||||
// Save to file
|
||||
utils_create_dir_recursively(tableFile);
|
||||
utils_save_to_file(tableFile, table, tableSize);
|
||||
utils_create_dir_recursively(txFile);
|
||||
utils_save_to_file(txFile, table, tableSize);
|
||||
|
||||
// Cleanup
|
||||
free(table);
|
||||
@ -93,13 +93,13 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) {
|
||||
game_detect(&game);
|
||||
|
||||
// Get required table file path
|
||||
wchar_t tableFile[MAX_PATH];
|
||||
tx_table_file(&game, tableFile);
|
||||
wchar_t txFile[MAX_PATH];
|
||||
tx_table_file(&game, txFile);
|
||||
|
||||
if (utils_path_exists(tableFile)) {
|
||||
_run_game(&game);
|
||||
if (utils_path_exists(txFile)) {
|
||||
_run_game(&game, txFile);
|
||||
} else {
|
||||
_run_tx(&game, tableFile);
|
||||
_run_tx(&game, txFile);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user