feat: make hook redirect IP configurable from launcher

The DLL now reads openfut.cfg from its own directory on DLL_PROCESS_ATTACH
and uses the IP it contains as the redirect target instead of hardcoding
127.0.0.1. Falls back to 127.0.0.1 if the file is absent.

The launcher writes openfut.cfg alongside version.dll when deploying, and
the Setup tab exposes a "Redirect IP" field with an "Update" button that
rewrites openfut.cfg in-place without redeploying the DLL. Useful when
running the emulator on a different machine on the LAN.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
funman300
2026-06-25 21:08:44 -07:00
parent 9b5da57f12
commit dfa2c9afc7
6 changed files with 114 additions and 13 deletions
+8 -3
View File
@@ -1,3 +1,4 @@
mod config;
mod hooks;
mod iat;
@@ -9,17 +10,21 @@ use windows_sys::Win32::{
#[no_mangle]
pub unsafe extern "system" fn DllMain(
_module: HMODULE,
module: HMODULE,
reason: u32,
_reserved: *mut (),
) -> BOOL {
if reason == DLL_PROCESS_ATTACH {
install_hooks();
install_hooks(module);
}
TRUE
}
unsafe fn install_hooks() {
unsafe fn install_hooks(module: HMODULE) {
// Load redirect IP from openfut.cfg before patching
let ip = config::read_redirect_ip(module);
hooks::set_redirect_ip(ip);
let real_ptr = iat::resolve(b"ws2_32.dll\0", b"getaddrinfo\0");
if real_ptr.is_null() {
return;