Skip to content

Commit 2faa7a2

Browse files
committed
feat: logo, hook game startup, hook game gui logic for display, hook mouse event
Logo added to the intro screen, game startup is hooked so UI is only displayed after the initial black screen is displayed, hooked the update loop for the game rendering to ensure that the game goes into "GUI" mode when the overlay is opened to prevent moving the camera etc Removed the old UI code Switched state logic for connection state to a message based system
1 parent 00d7cdb commit 2faa7a2

7 files changed

Lines changed: 279 additions & 281 deletions

File tree

Cargo.lock

Lines changed: 76 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ hudhook = { version = "0.8.1", default-features = false, features = [
3535
"dx9",
3636
], path = "./hudhook" }
3737
parking_lot = "0.12.4"
38+
image = { version = "0.25.6", default-features = false, features = ["png"] }
39+
once_cell = "1.21.3"
3840

3941
[dependencies.windows-sys]
4042
version = "0.52"

assets/logo-dark.png

6.16 KB
Loading

src/game/sfxgame.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,12 @@ pub struct FSFXOnlineMOTDInfo {
8080
pub offer_id: c_int,
8181
pub ty: c_uchar,
8282
}
83+
84+
#[repr(C, packed(4))]
85+
pub struct USFXGUIMovie {}
86+
87+
impl USFXGUIMovie {
88+
define_method!(set_mouse_visible, 50529, visible: bool);
89+
define_method!(set_input_enabled, 50505, enabled: bool);
90+
define_method!(set_game_mode, 50558, enable: bool, game_mode: u8);
91+
}

src/hooks/process_event.rs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ use super::mem::use_memory;
22
use crate::{
33
game::{
44
core::{FString, UFunction, UObject, UObjectExt},
5-
sfxgame::{FSFXOnlineMOTDInfo, USFXOnlineComponentUI},
5+
sfxgame::{FSFXOnlineMOTDInfo, USFXGUIMovie, USFXOnlineComponentUI},
66
},
77
hooks::mem::find_pattern,
8+
overlay::{GameEventMessage, GAME_EVENT_SENDER, IS_IN_BLOCKING_UI},
89
};
910
use log::{debug, warn};
1011
use serde::{Deserialize, Serialize};
@@ -291,5 +292,35 @@ pub unsafe extern "thiscall" fn fake_process_event(
291292
}
292293
}
293294

295+
// Hook the splash screen initialization
296+
if name.contains("Function SFXGame.SFXGUI_SplashScreen.Initialize") {
297+
if let Some(sender) = &GAME_EVENT_SENDER {
298+
_ = sender.send(GameEventMessage::GameStartupComplete);
299+
}
300+
}
301+
302+
if name.contains("Function SFXGame.SFXGUIMovie.Update") {
303+
let this = object.cast::<USFXGUIMovie>().as_mut();
304+
if let Some(this) = this {
305+
let blocking = { *IS_IN_BLOCKING_UI.lock() };
306+
if blocking {
307+
this.set_input_enabled(false);
308+
this.set_mouse_visible(true);
309+
this.set_game_mode(true, 9);
310+
} else {
311+
this.set_input_enabled(true);
312+
this.set_mouse_visible(false);
313+
this.set_game_mode(false, 9);
314+
}
315+
}
316+
}
317+
318+
if name.contains("HandleInputEvent") || name.contains("InputKey") {
319+
let blocking = *IS_IN_BLOCKING_UI.lock();
320+
if blocking {
321+
return;
322+
}
323+
}
324+
294325
process_event(object, func, params, result);
295326
}

0 commit comments

Comments
 (0)