Begin integrating TX
This commit is contained in:
@ -6,6 +6,7 @@
|
||||
#include <core.h>
|
||||
#include <utils.h>
|
||||
#include <msg.h>
|
||||
#include <tx.h>
|
||||
|
||||
#include <main.h>
|
||||
|
||||
@ -37,6 +38,29 @@ void request_restart() {
|
||||
CloseHandle(hRestartFlag);
|
||||
}
|
||||
|
||||
static void _run_game(struct game_data *game) {
|
||||
// Create fake ACE driver files
|
||||
ace_fake_driver_files();
|
||||
|
||||
// Load both ACE modules
|
||||
HMODULE baseModule = ace_load_base_module(game);
|
||||
ace_load_driver_module();
|
||||
|
||||
// ...magic
|
||||
core_setup_patcher(game, baseModule);
|
||||
|
||||
// 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) {
|
||||
|
||||
|
||||
request_restart();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) {
|
||||
// Only listen to attach
|
||||
if (reason != DLL_PROCESS_ATTACH) {
|
||||
@ -52,19 +76,18 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) {
|
||||
struct game_data game;
|
||||
game_detect(&game);
|
||||
|
||||
// Create fake ACE driver files
|
||||
ace_fake_driver_files();
|
||||
// Get required table file path
|
||||
wchar_t tableFile[MAX_PATH];
|
||||
tx_table_file(&game, tableFile);
|
||||
|
||||
// Load both ACE modules
|
||||
HMODULE baseModule = ace_load_base_module(&game);
|
||||
ace_load_driver_module();
|
||||
// Remove this
|
||||
msg_err_w(tableFile);
|
||||
|
||||
// ...magic
|
||||
core_setup_patcher(&game, baseModule);
|
||||
|
||||
// Load the UnityPlayer module and invoke the callback
|
||||
HMODULE unityModule = LoadLibraryA("UnityPlayer.dll");
|
||||
INVOKE_CALLBACK(game.unityplayer_callback, unityModule);
|
||||
if (1) {
|
||||
_run_game(&game);
|
||||
} else {
|
||||
_run_tx(&game, tableFile);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user