remove RTSM (not On) to remove unecessary "Ready" button interaction

This commit is contained in:
ApfelTeeSaft
2026-05-07 07:51:04 +02:00
parent 86fcb9cf2c
commit f26891d7a2
6 changed files with 56 additions and 59 deletions
+1
View File
@@ -136,6 +136,7 @@ EXTERNDEF Hooks_InitNetworkHooks :PROC
; ufunctionhooks.asm - UFunction dispatch hooks ; ufunctionhooks.asm - UFunction dispatch hooks
EXTERNDEF UFunctionHooks_Initialize :PROC EXTERNDEF UFunctionHooks_Initialize :PROC
EXTERNDEF Server_Initialize :PROC
EXTERNDEF UFunctionHooks_ToHook_Data :QWORD ; base of UFunction* array EXTERNDEF UFunctionHooks_ToHook_Data :QWORD ; base of UFunction* array
EXTERNDEF UFunctionHooks_ToHook_Num :DWORD ; count of registered hooks EXTERNDEF UFunctionHooks_ToHook_Num :DWORD ; count of registered hooks
EXTERNDEF UFunctionHooks_ToCall_Data :QWORD ; base of handler QWORD* array (BYTE (*)(UObject*,void*)) EXTERNDEF UFunctionHooks_ToCall_Data :QWORD ; base of handler QWORD* array (BYTE (*)(UObject*,void*))
+2 -2
View File
@@ -51,8 +51,8 @@ Logger_hFile QWORD ?
Logger_Initialize PROC Logger_Initialize PROC
sub rsp, 148h sub rsp, 148h
; GetModuleFileNameA(NULL, &path, MAX_PATH) EAX = length ; GetModuleFileNameA(NULL, &path, MAX_PATH) -> EAX = length
xor ecx, ecx ; hModule = NULL host EXE xor ecx, ecx ; hModule = NULL -> host EXE
lea rdx, [rsp+38h] ; path buffer lea rdx, [rsp+38h] ; path buffer
mov r8d, 104h ; MAX_PATH = 260 mov r8d, 104h ; MAX_PATH = 260
call GetModuleFileNameA call GetModuleFileNameA
+3 -3
View File
@@ -31,11 +31,11 @@ ENDIF
Native_InitializeAll PROC Native_InitializeAll PROC
push rbp push rbp
push rbx push rbx
sub rsp, 40 ; shadow space; RSP 0 mod 16 at all CALLs sub rsp, 40 ; shadow space; RSP = 0 mod 16 at all CALLs
LOG_DBG szNatDbg_Start LOG_DBG szNatDbg_Start
xor ecx, ecx ; lpModuleName = NULL returns base of .exe xor ecx, ecx ; lpModuleName = NULL -> returns base of .exe
call GetModuleHandleA call GetModuleHandleA
mov QWORD PTR [Imagebase], rax mov QWORD PTR [Imagebase], rax
@@ -150,7 +150,7 @@ Native_InitializeAll PROC
xor r8d, r8d xor r8d, r8d
call Utils_FindPattern call Utils_FindPattern
mov QWORD PTR [Native_OnlineBeacon_PauseBeaconRequests], rax mov QWORD PTR [Native_OnlineBeacon_PauseBeaconRequests], rax
; Also store in the host-specific slot same function pointer ; Also store in the host-specific slot - same function pointer
mov QWORD PTR [Native_OnlineBeaconHost_PauseBeaconRequests], rax mov QWORD PTR [Native_OnlineBeaconHost_PauseBeaconRequests], rax
; OnlineBeacon::NotifyAcceptingConnection (direct) ; OnlineBeacon::NotifyAcceptingConnection (direct)
+6
View File
@@ -20,6 +20,8 @@ szDbgAtchProcEvent DB "[DEBUG] Attached Hooks_ProcessEventHook", 0
szDbgAtchViewPt DB "[DEBUG] Attached Hooks_GetPlayerViewPoint", 0 szDbgAtchViewPt DB "[DEBUG] Attached Hooks_GetPlayerViewPoint", 0
szDbgDetourCommit DB "[DEBUG] Detours transaction committed", 0 szDbgDetourCommit DB "[DEBUG] Detours transaction committed", 0
szDbgConsoleCreated DB "[DEBUG] SDK console created", 0 szDbgConsoleCreated DB "[DEBUG] SDK console created", 0
szDbgServerInit DB "[DEBUG] Server_Initialize starting", 0
szDbgServerDone DB "[DEBUG] Server_Initialize complete", 0
ENDIF ENDIF
.data .data
@@ -117,6 +119,10 @@ Main PROC
call SDK_CreateConsole call SDK_CreateConsole
LOG_DBG szDbgConsoleCreated LOG_DBG szDbgConsoleCreated
LOG_DBG szDbgServerInit
call Server_Initialize
LOG_DBG szDbgServerDone
xor eax, eax ; return 0 (DWORD thread exit code) xor eax, eax ; return 0 (DWORD thread exit code)
@@main_exit: @@main_exit:
+40 -50
View File
@@ -72,7 +72,6 @@ szFn_ServerExecuteInventoryItem DB "Function FortniteGame.FortPlayerControll
szFn_ServerReturnToMainMenu DB "Function FortniteGame.FortPlayerController.ServerReturnToMainMenu", 0 szFn_ServerReturnToMainMenu DB "Function FortniteGame.FortPlayerController.ServerReturnToMainMenu", 0
szFn_ServerLoadingScreenDropped DB "Function FortniteGame.FortPlayerController.ServerLoadingScreenDropped", 0 szFn_ServerLoadingScreenDropped DB "Function FortniteGame.FortPlayerController.ServerLoadingScreenDropped", 0
szFn_ServerChoosePart DB "Function FortniteGame.FortPlayerControllerCommon.ServerChoosePart", 0 szFn_ServerChoosePart DB "Function FortniteGame.FortPlayerControllerCommon.ServerChoosePart", 0
szFn_ReadyToStartMatch DB "Function FortniteGame.FortGameModeAthena.ReadyToStartMatch", 0
szFn_OnAircraftExitedDropZone DB "Function FortniteGame.FortAthenaAircraft.OnAircraftExitedDropZone", 0 szFn_OnAircraftExitedDropZone DB "Function FortniteGame.FortAthenaAircraft.OnAircraftExitedDropZone", 0
szFn_ServerCheatAll DB "Function FortniteGame.FortGameModeAthena.ServerCheatAll", 0 szFn_ServerCheatAll DB "Function FortniteGame.FortGameModeAthena.ServerCheatAll", 0
szFn_Logout DB "Function FortniteGame.FortGameModeAthena.Logout", 0 szFn_Logout DB "Function FortniteGame.FortGameModeAthena.Logout", 0
@@ -1172,15 +1171,23 @@ PEHOOK_ServerEditBuildingActor PROC
ret ret
PEHOOK_ServerEditBuildingActor ENDP PEHOOK_ServerEditBuildingActor ENDP
; PEHOOK_ReadyToStartMatch - set up full listen-server infrastructure ; Server_Initialize - set up full listen-server infrastructure
; RCX = AFortGameModeAthena* (GameMode) ; Called directly from raider.asm Main after DetourTransactionCommit.
; No arguments; no return value.
; ;
; Stack: push rbp,rbx,rsi,rdi,r12,r13,r14 = 7 pushes (RSP=0); sub 80 -> 0 ; Sequence:
; [rsp+0..31] = shadow ; 1. Guard bListening - skip if already listening
; [rsp+32..79] = FURL struct (0x70 = 112 bytes)... actually needs sub 128 = 0 ; 2. Game_OnReadyToStartMatch()
; With 7 pushes: RSP=0; sub 128(=0) -> 0 ; 3. Spawn AFortOnlineBeaconHost -> HostBeacon
; FURL at [rsp+32..143] ; 4. Set ListenPort=7776 + InitHost
PEHOOK_ReadyToStartMatch PROC ; 5. Zero-init FURL on stack (port 7777)
; 6. Resolve ServerReplicateActors from ReplicationDriver vtable slot 0x53
; 7. PauseBeaconRequests(false), bListening=true
;
; Stack: 7 pushes (56) -> entry RSP=8; after 7 odd pushes RSP=0; sub128(=0) -> 0
; [rsp+0..31] = shadow
; [rsp+32..143] = FURL local struct (112 bytes)
Server_Initialize PROC
push rbp push rbp
push rbx push rbx
push rsi push rsi
@@ -1188,10 +1195,7 @@ PEHOOK_ReadyToStartMatch PROC
push r12 push r12
push r13 push r13
push r14 push r14
sub rsp, 128 ; 7 pushes: RSP=0; sub128(=0) -> 0 sub rsp, 128
; [rsp+32..143] = FURL local
mov rbx, rcx ; GameMode
; Guard: already listening? ; Guard: already listening?
movzx eax, BYTE PTR [bListening] movzx eax, BYTE PTR [bListening]
@@ -1212,20 +1216,18 @@ PEHOOK_ReadyToStartMatch PROC
test rax, rax test rax, rax
jz @@net_setup jz @@net_setup
; SpawnActor - use world + class + null transform + default flags
call SDK_GetWorld call SDK_GetWorld
test rax, rax test rax, rax
jz @@net_setup jz @@net_setup
mov r12, rax ; World
mov rcx, QWORD PTR [pClass_FortOnlineBeaconHost] mov rcx, QWORD PTR [pClass_FortOnlineBeaconHost]
xor edx, edx ; Location = null (use zero) xor edx, edx ; Location = null (zero origin)
xor r8d, r8d ; Owner = null xor r8d, r8d ; Owner = null
call Spawners_SpawnActor ; Phase 10 will fill this call Spawners_SpawnActor
test rax, rax test rax, rax
jz @@net_setup jz @@net_setup
mov r13, rax ; r13 = HostBeacon mov r13, rax
mov QWORD PTR [HostBeacon], r13 mov QWORD PTR [HostBeacon], r13
; Set ListenPort = 7776 ; Set ListenPort = 7776
@@ -1236,40 +1238,36 @@ PEHOOK_ReadyToStartMatch PROC
call QWORD PTR [Native_OnlineBeaconHost_InitHost] call QWORD PTR [Native_OnlineBeaconHost_InitHost]
@@net_setup: @@net_setup:
; Init World NetDriver on port 7777 ; Zero-init FURL on stack, set Port=7777
; Build minimal FURL on stack: zero-init [rsp+32..143], set Port=7777
lea rcx, [rsp + 32] lea rcx, [rsp + 32]
xor edx, edx xor edx, edx
mov r8d, 112 ; sizeof(FURL) = 0x70 mov r8d, 112 ; sizeof(FURL) = 0x70
call RtlZeroMemory call RtlZeroMemory
mov DWORD PTR [rsp + 32 + FURL_Port], LISTEN_GAME_PORT ; FURL::Port at +0x20 mov DWORD PTR [rsp + 32 + FURL_Port], LISTEN_GAME_PORT
; Resolve ServerReplicateActors from ReplicationDriver vtable[0x53] ; Resolve ServerReplicateActors from ReplicationDriver vtable[0x53]
call SDK_GetWorld call SDK_GetWorld
test rax, rax test rax, rax
jz @@final_setup jz @@final_setup
mov rax, QWORD PTR [rax + UWORLD_NetDriver] ; World->NetDriver mov rax, QWORD PTR [rax + UWORLD_NetDriver]
test rax, rax test rax, rax
jz @@final_setup jz @@final_setup
mov rax, QWORD PTR [rax + UNETDRIVER_ReplDriver] ; NetDriver->ReplicationDriver mov rax, QWORD PTR [rax + UNETDRIVER_ReplDriver]
test rax, rax test rax, rax
jz @@final_setup jz @@final_setup
mov r14, rax ; r14 = ReplicationDriver mov r14, rax
mov rax, QWORD PTR [r14] ; vtable ptr mov rax, QWORD PTR [r14]
mov rax, QWORD PTR [rax + VTABLE_ServerReplicateActors] ; slot 0x53 mov rax, QWORD PTR [rax + VTABLE_ServerReplicateActors]
mov QWORD PTR [Native_ReplicationDriver_ServerReplicateActors], rax mov QWORD PTR [Native_ReplicationDriver_ServerReplicateActors], rax
; ClassRepNodePolicies is a TMap<UClass*, EClassRepNodeMapping> at RepDriver+0x3B8.
; Populating it requires iterating registered actor classes; deferred to game-specific setup.
@@final_setup: @@final_setup:
; PauseBeaconRequests(false) if beacon was spawned ; PauseBeaconRequests(false), mark listening
mov rax, QWORD PTR [HostBeacon] mov rax, QWORD PTR [HostBeacon]
test rax, rax test rax, rax
jz @@set_listening jz @@set_listening
mov rcx, rax mov rcx, rax
xor edx, edx ; false = don't pause xor edx, edx
call QWORD PTR [Native_OnlineBeacon_PauseBeaconRequests] call QWORD PTR [Native_OnlineBeacon_PauseBeaconRequests]
@@set_listening: @@set_listening:
@@ -1284,9 +1282,8 @@ PEHOOK_ReadyToStartMatch PROC
pop rsi pop rsi
pop rbx pop rbx
pop rbp pop rbp
xor al, al
ret ret
PEHOOK_ReadyToStartMatch ENDP Server_Initialize ENDP
; UFunctionHooks_Initialize ; UFunctionHooks_Initialize
; Resolves all 27 UFunction* pointers and fills the ToHook + ToCall arrays. ; Resolves all 27 UFunction* pointers and fills the ToHook + ToCall arrays.
@@ -1298,7 +1295,7 @@ PEHOOK_ReadyToStartMatch ENDP
; ;
; Stack: push rbp,rbx,rsi,rdi,r12 = 5 pushes (RSP=8); sub 40(=8) -> 0 ; Stack: push rbp,rbx,rsi,rdi,r12 = 5 pushes (RSP=8); sub 40(=8) -> 0
; Helper macro-equivalent - inline for each registration: ; Helper macro-equivalent inline for each registration:
; REGISTER rcx=szFnName, handler_label ; REGISTER rcx=szFnName, handler_label
; lea rcx, szFn_X ; lea rcx, szFn_X
; call SDK_FindObject ; call SDK_FindObject
@@ -1315,9 +1312,10 @@ UFunctionHooks_Initialize PROC
push rsi push rsi
push rdi push rdi
push r12 push r12
sub rsp, 40 ; 5 pushes: RSP=8; sub40 -> 0 sub rsp, 48 ; 5 pushes: entry RSP=8 -> after pushes RSP=0; sub48(=0) -> 0
LOG_DBG szUFDbg_Start LOG_DBG szUFDbg_Start
; Set public pointers to internal storage ; Set public pointers to internal storage
lea rax, _ToHook_Storage lea rax, _ToHook_Storage
mov QWORD PTR [UFunctionHooks_ToHook_Data], rax mov QWORD PTR [UFunctionHooks_ToHook_Data], rax
@@ -1349,7 +1347,7 @@ UFunctionHooks_Initialize PROC
mov QWORD PTR [rdi + rbp * 8], rax mov QWORD PTR [rdi + rbp * 8], rax
inc ebp inc ebp
@@r2: @@r2:
; 3. ServerAbilityRPCBatch ; ServerAbilityRPCBatch
lea rcx, szFn_ServerAbilityRPCBatch lea rcx, szFn_ServerAbilityRPCBatch
call SDK_FindObject call SDK_FindObject
test rax, rax test rax, rax
@@ -1539,7 +1537,7 @@ UFunctionHooks_Initialize PROC
mov QWORD PTR [rdi + rbp * 8], rax mov QWORD PTR [rdi + rbp * 8], rax
inc ebp inc ebp
@@r21: @@r21:
; 22. ServerLoadingScreenDropped ; ServerLoadingScreenDropped
lea rcx, szFn_ServerLoadingScreenDropped lea rcx, szFn_ServerLoadingScreenDropped
call SDK_FindObject call SDK_FindObject
test rax, rax test rax, rax
@@ -1549,7 +1547,7 @@ UFunctionHooks_Initialize PROC
mov QWORD PTR [rdi + rbp * 8], rax mov QWORD PTR [rdi + rbp * 8], rax
inc ebp inc ebp
@@r22: @@r22:
; 23. ServerChoosePart ; ServerChoosePart
lea rcx, szFn_ServerChoosePart lea rcx, szFn_ServerChoosePart
call SDK_FindObject call SDK_FindObject
test rax, rax test rax, rax
@@ -1559,17 +1557,9 @@ UFunctionHooks_Initialize PROC
mov QWORD PTR [rdi + rbp * 8], rax mov QWORD PTR [rdi + rbp * 8], rax
inc ebp inc ebp
@@r23: @@r23:
; ReadyToStartMatch ; ---- 24 (renumbered). OnAircraftExitedDropZone ----
lea rcx, szFn_ReadyToStartMatch ; NOTE: ReadyToStartMatch removed — server init now called directly
call SDK_FindObject ; via Server_Initialize from raider.asm Main after Detours commit.
test rax, rax
jz @@r24
mov QWORD PTR [rsi + rbp * 8], rax
lea rax, PEHOOK_ReadyToStartMatch
mov QWORD PTR [rdi + rbp * 8], rax
inc ebp
@@r24:
; OnAircraftExitedDropZone
lea rcx, szFn_OnAircraftExitedDropZone lea rcx, szFn_OnAircraftExitedDropZone
call SDK_FindObject call SDK_FindObject
test rax, rax test rax, rax
@@ -1613,7 +1603,7 @@ UFunctionHooks_Initialize PROC
mov edx, ebp mov edx, ebp
call Logger_LogInfoFmt call Logger_LogInfoFmt
add rsp, 40 add rsp, 48
pop r12 pop r12
pop rdi pop rdi
pop rsi pop rsi
+4 -4
View File
@@ -52,14 +52,14 @@ ZeroInput_IsMouseClicked PROC
; Check mouseDown[button] ; Check mouseDown[button]
mov eax, ecx ; button index (zero-extends rax) mov eax, ecx ; button index (zero-extends rax)
lea rcx, [ZI_mouseDown] ; RIP-relative base rcx lea rcx, [ZI_mouseDown] ; RIP-relative base -> rcx
movzx eax, BYTE PTR [rcx + rax] ; mouseDown[button] movzx eax, BYTE PTR [rcx + rax] ; mouseDown[button]
test al, al test al, al
jz @@clear_already ; not pressed -> clear + return false jz @@clear_already ; not pressed -> clear + return false
; mouseDown[button] is set - check mouseDownAlready[element_id] ; mouseDown[button] is set - check mouseDownAlready[element_id]
mov ecx, edx ; element_id (zero-extends rcx) mov ecx, edx ; element_id (zero-extends rcx)
lea rax, [ZI_mouseDownAlready] ; RIP-relative base rax lea rax, [ZI_mouseDownAlready] ; RIP-relative base -> rax
movzx eax, BYTE PTR [rax + rcx] ; mouseDownAlready[element_id] movzx eax, BYTE PTR [rax + rcx] ; mouseDownAlready[element_id]
test al, al test al, al
jnz @@check_repeat ; already marked -> check repeat jnz @@check_repeat ; already marked -> check repeat
@@ -96,12 +96,12 @@ ZeroInput_IsKeyPressed PROC
sub rsp, 28h sub rsp, 28h
mov r9d, ecx ; save key index (zero-extends r9) mov r9d, ecx ; save key index (zero-extends r9)
lea rcx, [ZI_keysDown] ; RIP-relative base rcx lea rcx, [ZI_keysDown] ; RIP-relative base -> rcx
movzx eax, BYTE PTR [rcx + r9] ; keysDown[key] movzx eax, BYTE PTR [rcx + r9] ; keysDown[key]
test al, al test al, al
jz @@clear_already jz @@clear_already
lea rax, [ZI_keysDownAlready] ; RIP-relative base rax lea rax, [ZI_keysDownAlready] ; RIP-relative base -> rax
movzx eax, BYTE PTR [rax + r9] ; keysDownAlready[key] movzx eax, BYTE PTR [rax + r9] ; keysDownAlready[key]
test al, al test al, al
jnz @@check_repeat jnz @@check_repeat