forked from CnCNet/ts-patches
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dont_save_without_all_players.asm
59 lines (43 loc) · 1.44 KB
/
dont_save_without_all_players.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
%include "TiberianSun.inc"
%include "macros/patch.inc"
%include "macros/datatypes.inc"
; Prevents saving multiplayer games manually when not all players are present.
; SavesDisabled is set to 1 in recon_kick.asm when the REMOVEPLAYER event is executed.
; Author: Rampastring
cextern SavesDisabled
cextern IsDoingMPSaveNextFrame
sstring str_CantSaveWithoutAllPlayers, "All players need to be present for saving multiplayer games."
section .text
hack 0x00494DCE
mov ax, [SavesDisabled]
cmp ax, 1
jne .Post_Players_Present_Check
pushad
; Calculate message duration
mov eax, [Rules]
fld qword [eax+0C68h] ; Message duration in minutes
fmul qword [0x006CB1B8] ; Frames Per Minute
call Get_Message_Delay_Or_Duration ; Float to int
; Push arguments
push eax ; Message delay/duration
push 4046h ; Very likely TextPrintType
mov ecx, MessageListClass_this
push 4
lea edx, [str_CantSaveWithoutAllPlayers]
push edx
push 0
push 0
call MessageListClass__Add_Message
popad
jmp 0x00494EB3
.Post_Players_Present_Check:
; Don't save mid-frame in multiplayer to prevent saves from getting corrupted
; We instead save after the game's main loop
mov byte [IsDoingMPSaveNextFrame], 1
jmp 0x00494EB3 ; exit function
; original Westwood code
; mov eax, dword [0x007E4940]
; xor edi, edi
; cmp eax, edi
; jnz 0x00494E9C
; jmp 0x00494DDD