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:
+41
-1
@@ -315,7 +315,11 @@ impl LauncherApp {
|
||||
ui.colored_label(Color32::from_rgb(220, 60, 60), "✘ Not deployed");
|
||||
ui.add_space(8.0);
|
||||
if ui.add_enabled(dll_built, egui::Button::new("Deploy")).clicked() {
|
||||
match setup::deploy_hook_dll(dll_src, game_dir) {
|
||||
match setup::deploy_hook_dll(
|
||||
dll_src,
|
||||
game_dir,
|
||||
&self.config.hook_redirect_ip,
|
||||
) {
|
||||
Ok(()) => {
|
||||
self.setup_message = Some((true, "Hook DLL deployed as version.dll.".into()));
|
||||
self.hook_deployed = true;
|
||||
@@ -326,6 +330,38 @@ impl LauncherApp {
|
||||
}
|
||||
});
|
||||
|
||||
ui.add_space(8.0);
|
||||
|
||||
// IP configuration — always editable; Update writes openfut.cfg in-place
|
||||
ui.horizontal(|ui| {
|
||||
ui.label("Redirect IP:");
|
||||
let changed = ui
|
||||
.add(egui::TextEdit::singleline(&mut self.config.hook_redirect_ip)
|
||||
.desired_width(160.0))
|
||||
.changed();
|
||||
if changed {
|
||||
self.config_dirty = true;
|
||||
}
|
||||
if ui.add_enabled(self.hook_deployed, egui::Button::new("Update")).clicked() {
|
||||
match setup::update_hook_config(
|
||||
Path::new(&self.config.fifa_game_dir),
|
||||
&self.config.hook_redirect_ip,
|
||||
) {
|
||||
Ok(()) => {
|
||||
self.config.save();
|
||||
self.config_dirty = false;
|
||||
self.setup_message = Some((true, format!(
|
||||
"Config updated — hook will redirect to {}.",
|
||||
self.config.hook_redirect_ip
|
||||
)));
|
||||
}
|
||||
Err(e) => self.setup_message = Some((false, format!("Failed: {e}"))),
|
||||
}
|
||||
}
|
||||
});
|
||||
ui.label(egui::RichText::new("Tip: use 127.0.0.1 if the emulator is on this machine, or the LAN IP if it's on another.")
|
||||
.weak().small());
|
||||
|
||||
ui.add_space(8.0);
|
||||
ui.separator();
|
||||
ui.add_space(4.0);
|
||||
@@ -461,6 +497,10 @@ impl LauncherApp {
|
||||
ui.label("FIFA 23 game dir:");
|
||||
changed |= ui.text_edit_singleline(&mut self.config.fifa_game_dir).changed();
|
||||
ui.end_row();
|
||||
|
||||
ui.label("Redirect IP:");
|
||||
changed |= ui.text_edit_singleline(&mut self.config.hook_redirect_ip).changed();
|
||||
ui.end_row();
|
||||
});
|
||||
|
||||
if changed {
|
||||
|
||||
Reference in New Issue
Block a user