-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathengine.rs
2668 lines (2429 loc) · 90 KB
/
engine.rs
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//! `hw`, `sw`, `hl`.
#![allow(non_snake_case, non_upper_case_globals)]
use std::ffi::CString;
use std::fmt;
use std::num::ParseIntError;
use std::os::raw::*;
use std::ptr::{null_mut, NonNull};
use std::str::FromStr;
use bxt_macros::pattern;
use bxt_patterns::Patterns;
use crate::ffi::com_model::{mleaf_s, model_s};
use crate::ffi::command::cmd_function_s;
use crate::ffi::cvar::cvar_s;
use crate::ffi::edict::edict_s;
use crate::ffi::playermove::playermove_s;
use crate::ffi::triangleapi::triangleapi_s;
use crate::ffi::usercmd::usercmd_s;
#[cfg(windows)]
use crate::hooks::opengl32;
use crate::hooks::{bxt, sdl, server};
use crate::modules::*;
use crate::utils::*;
pub static build_number: Pointer<unsafe extern "C" fn() -> c_int> = Pointer::empty_patterns(
b"build_number\0",
// To find, search for "Half-Life %i/%s (hw build %d)". This function is
// Draw_ConsoleBackground(), and a call to build_number() is right above the snprintf() using
// this string.
Patterns(&[
// 6153
pattern!(55 8B EC 83 EC 08 A1 ?? ?? ?? ?? 56 33 F6 85 C0),
// 4554
pattern!(A1 ?? ?? ?? ?? 83 EC 08 57 33 FF 85 C0),
// 3248
pattern!(A1 ?? ?? ?? ?? 83 EC 08 56),
// CoF-5936
pattern!(55 8B EC 83 EC 10 C7 45 ?? 00 00 00 00 C7 45 ?? 00 00 00 00 C7 45 ?? 00 00 00 00 83 3D ?? ?? ?? ?? 00),
]),
null_mut(),
);
pub static CBaseUI__HideGameUI: Pointer<unsafe extern "fastcall" fn(*mut c_void)> =
// 8th pointer in CBaseUI vtable.
// To find, search for "chromehtml.dll". You are in CBaseUI::Initialize and that will be
// the second pointer of CBaseUI vtable.
Pointer::empty_patterns(
b"_ZN7CBaseUI10HideGameUIEv\0",
Patterns(&[
// 8684
pattern!(56 8B F1 8B 0D ?? ?? ?? ?? 8B 01 FF 50 ?? 8B 0D ?? ?? ?? ?? 8B 11 FF 52 ?? FF 15),
]),
my_CBaseUI__HideGameUI as _,
);
pub static Cbuf_AddFilteredText: Pointer<unsafe extern "C" fn(*const c_char)> =
Pointer::empty_patterns(
b"Cbuf_AddFilteredText\0",
Patterns(&[]),
my_Cbuf_AddFilteredText as _,
);
pub static Cbuf_AddText: Pointer<unsafe extern "C" fn(*const c_char)> =
Pointer::empty_patterns(b"Cbuf_AddText\0", Patterns(&[]), my_Cbuf_AddText as _);
pub static Cbuf_AddTextToBuffer: Pointer<unsafe extern "C" fn(*const c_char, *mut c_void)> =
Pointer::empty_patterns(
b"Cbuf_AddTextToBuffer\0",
// To find, search for "Cbuf_AddTextToBuffer: overflow".
Patterns(&[
// 8684
pattern!(55 8B EC 56 57 8B 7D ?? 57 E8 ?? ?? ?? ?? 8B 75),
]),
my_Cbuf_AddTextToBuffer as _,
);
pub static Cbuf_InsertText: Pointer<unsafe extern "C" fn(*const c_char)> =
Pointer::empty(b"Cbuf_InsertText\0");
pub static CL_Disconnect: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
b"CL_Disconnect\0",
// To find, search for "ExitGame".
Patterns(&[
// 6153
pattern!(55 8B EC 83 EC 14 53 56 33 DB),
// 4554
pattern!(83 EC 14 C7 05 ?? ?? ?? ?? F0 69 F8 C0),
// CoF-5936
pattern!(55 8B EC 83 EC 18 56 57 C7 05 ?? ?? ?? ?? 00 00 00 00),
]),
my_CL_Disconnect as _,
);
pub static cl_funcs: Pointer<*mut ClientDllFunctions> = Pointer::empty(b"cl_funcs\0");
pub static CL_GameDir_f: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
b"CL_GameDir_f\0",
// To find, search for "gamedir is ".
Patterns(&[
// 6153
pattern!(E8 ?? ?? ?? ?? 83 F8 02 74 ?? 68 ?? ?? ?? ?? 68 ?? ?? ?? ?? E8 ?? ?? ?? ?? 83 C4 08 C3),
// CoF-5936
pattern!(55 8B EC E8 ?? ?? ?? ?? 83 F8 02 74 ?? 68 ?? ?? ?? ?? 68 ?? ?? ?? ?? E8 ?? ?? ?? ?? 83 C4 08 EB),
]),
null_mut(),
);
pub static cl_lightstyle: Pointer<*mut [lightstyle_t; 64]> = Pointer::empty(b"cl_lightstyle\0");
pub static CL_Move: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
b"CL_Move\0",
// To find, search for "Client Move".
Patterns(&[
// 6153
pattern!(55 8B EC 81 EC 78 08 00 00),
]),
my_CL_Move as _,
);
pub static CL_Parse_LightStyle: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
b"CL_Parse_LightStyle\0",
// To find, search for "svc_lightstyle > MAX_LIGHTSTYLES"
Patterns(&[
// 8684
pattern!(56 57 E8 ?? ?? ?? ?? 8B ?? 83 ?? ?? ?? ?? 68),
]),
my_CL_Parse_LightStyle as _,
);
pub static CL_PlayDemo_f: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
b"CL_PlayDemo_f\0",
// To find, search for "playdemo <demoname> <replayspeed>: plays a demo".
Patterns(&[
// 8684
pattern!(55 8B EC 81 EC 00 01 00 00 A1 ?? ?? ?? ?? 53),
// 4554
pattern!(A1 ?? ?? ?? ?? 81 EC 00 01 00 00 83 F8 01),
// CoF-5936
pattern!(55 8B EC 81 EC 00 01 00 00 56 57 83 3D ?? ?? ?? ?? 01),
]),
my_CL_PlayDemo_f as _,
);
pub static CL_ViewDemo_f: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
b"CL_ViewDemo_f\0",
// To find, search for "viewdemo not available".
Patterns(&[
// 8684
pattern!(55 8B EC 81 EC 04 01 00 00 A1 ?? ?? ?? ?? 56 BE 01 00 00 00 57 3B C6 0F 85),
]),
my_CL_ViewDemo_f as _,
);
pub static ClientDLL_Init: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
b"ClientDLL_Init\0",
// To find, search for "cl_dlls\\client.dll" (with a backslash).
Patterns(&[
// 6153
pattern!(55 8B EC 81 EC 00 02 00 00 68),
]),
my_ClientDLL_Init as _,
);
pub static ClientDLL_DrawTransparentTriangles: Pointer<unsafe extern "C" fn()> =
Pointer::empty_patterns(
b"ClientDLL_DrawTransparentTriangles\0",
// To find, search for "HUD_DrawTransparentTriangles". This sets the
// HUD_DrawTransparentTriangles pointer in cl_funcs; the larger function calling
// the pointer is ClientDLL_DrawTransparentTriangles().
Patterns(&[
// 8684
pattern!(A1 ?? ?? ?? ?? 85 C0 74 ?? FF D0 6A 00 FF 15 ?? ?? ?? ?? 59 C3 90 90 90 90 90 90 90 90 90 90 90 A1 ?? ?? ?? ?? 85 C0 74 ?? FF E0),
// CoF-5936
pattern!(55 8B EC 83 3D ?? ?? ?? ?? 00 74 ?? FF 15 ?? ?? ?? ?? 6A 00 FF 15 ?? ?? ?? ?? 83 C4 04 5D C3 55 8B EC 83 3D ?? ?? ?? ?? 00 74 06 FF 15 ?? ?? ?? ?? 5D),
]),
null_mut(),
);
pub static cl: Pointer<*mut client_state_t> = Pointer::empty(b"cl\0");
pub static cl_stats: Pointer<*mut [i32; 32]> = Pointer::empty(
// Not a real symbol name.
b"cl_stats\0",
);
pub static cl_viewent: Pointer<*mut cl_entity_s> = Pointer::empty(
// Not a real symbol name.
b"cl_viewent\0",
);
pub static cl_viewent_viewmodel: Pointer<*mut cl_entity_s_viewmodel> = Pointer::empty(
// Not a real symbol name.
b"cl_viewent_viewmodel\0",
);
pub static cls: Pointer<*mut client_static_s> = Pointer::empty(b"cls\0");
pub static cls_demoframecount: Pointer<*mut c_int> = Pointer::empty(
// Not a real symbol name.
b"cls_demoframecount\0",
);
pub static cls_demos: Pointer<*mut client_static_s_demos> = Pointer::empty(
// Not a real symbol name.
b"cls_demos\0",
);
pub static Cmd_AddMallocCommand: Pointer<
unsafe extern "C" fn(*const c_char, unsafe extern "C" fn(), c_int),
> = Pointer::empty_patterns(
b"Cmd_AddMallocCommand\0",
// To find, search for "Cmd_AddCommand: %s already defined as a var". It will give two results,
// one of them for Cmd_AddCommandWithFlags, another for Cmd_AddMallocCommand.
// Cmd_AddMallocCommand is slightly smaller, and the allocation call in the middle that takes
// 0x10 as a parameter calls malloc internally. This allocation call is Mem_ZeroMalloc.
Patterns(&[
// 6153
pattern!(55 8B EC 56 57 8B 7D ?? 57 E8 ?? ?? ?? ?? 8A 08),
// 4554
pattern!(56 57 8B 7C 24 ?? 57 E8 ?? ?? ?? ?? 8A 08 83 C4 04 84 C9 74 ?? 57 68 ?? ?? ?? ?? E8 ?? ?? ?? ?? 83 C4 08 5F ?? C3),
// CoF-5936
pattern!(55 8B EC 51 8B 45 ?? 50 E8 ?? ?? ?? ?? 83 C4 04 0F BE 08 85 C9 74 16 8B 55 08 52 68 ?? ?? ?? ?? E8 ?? ?? ?? ?? 83 C4 08),
]),
null_mut(),
);
pub static Cmd_Argc: Pointer<unsafe extern "C" fn() -> c_int> = Pointer::empty(b"Cmd_Argc\0");
pub static Cmd_Argv: Pointer<unsafe extern "C" fn(c_int) -> *const c_char> =
Pointer::empty(b"Cmd_Argv\0");
pub static cmd_functions: Pointer<*mut *mut cmd_function_s> = Pointer::empty(b"cmd_functions\0");
pub static Con_Printf: Pointer<unsafe extern "C" fn(*const c_char, ...)> = Pointer::empty_patterns(
b"Con_Printf\0",
// To find, search for "qconsole.log". One of the three usages is Con_Printf (the one that
// isn't just many function calls or OutputDebugStringA).
Patterns(&[
// 6153
pattern!(55 8B EC B8 00 10 00 00 E8 ?? ?? ?? ?? 8B 4D),
// 4554
pattern!(B8 00 10 00 00 E8 ?? ?? ?? ?? 8B 8C 24),
// CoF-5936
pattern!(55 8B EC B8 04 10 00 00 E8 ?? ?? ?? ?? 56),
]),
null_mut(),
);
pub static Con_ToggleConsole_f: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
b"Con_ToggleConsole_f\0",
// To find, search for "toggleconsole". Look for console command registration, the callback
// will be Con_ToggleConsole_f().
Patterns(&[
// 6153
pattern!(E8 ?? ?? ?? ?? 85 C0 74 ?? E9 ?? ?? ?? ?? E9 ?? ?? ?? ?? 90 90 90 90 90 90 90 90 90 90 90 90 90),
// 1600
pattern!(A1 ?? ?? ?? ?? B9 01 00 00 00 3B C1 75 ?? A1),
// CoF-5936
pattern!(55 8B EC E8 ?? ?? ?? ?? 85 C0 74 ?? E8 ?? ?? ?? ?? EB),
]),
my_Con_ToggleConsole_f as _,
);
pub static com_gamedir: Pointer<*mut [c_char; 260]> = Pointer::empty(b"com_gamedir\0");
pub static Cvar_RegisterVariable: Pointer<unsafe extern "C" fn(*mut cvar_s)> =
Pointer::empty_patterns(
b"Cvar_RegisterVariable\0",
// To find, search for "Can't register variable %s, already defined".
Patterns(&[
// 6153
pattern!(55 8B EC 83 EC 14 53 56 8B 75 ?? 57 8B 06),
// 4554
pattern!(83 EC 14 53 56 8B 74 24),
// CoF-5936
pattern!(55 8B EC 83 EC 24 8B 45 ?? 8B 08 51 E8 ?? ?? ?? ?? 83 C4 04 85 C0 74 18 8B 55 08 8B 02 50 68 ?? ?? ?? ?? E8 ?? ?? ?? ?? 83 C4 08),
]),
null_mut(),
);
pub static cvar_vars: Pointer<*mut *mut cvar_s> = Pointer::empty(b"cvar_vars\0");
pub static Draw_FillRGBABlend: Pointer<
unsafe extern "C" fn(c_int, c_int, c_int, c_int, c_int, c_int, c_int, c_int),
> = Pointer::empty_patterns(
b"Draw_FillRGBABlend\0",
// 130th pointer in cl_enginefuncs.
Patterns(&[
// 8684
pattern!(55 8B EC 83 EC 08 8D 45 ?? 8D 4D ?? 50 8D 55 ?? 51 8D 45 ?? 52 8D 4D ?? 50 8D 55 ?? 51 8D 45 ?? 52 8D 4D ?? 50 51 FF 15 ?? ?? ?? ?? 83 C4 20 68 E1 0D 00 00 FF 15 ?? ?? ?? ?? 68 E2 0B 00 00 FF 15 ?? ?? ?? ?? 68 00 00 04 46 68 00 22 00 00 68 00 23 00 00 FF 15 ?? ?? ?? ?? 68 03 03 00 00),
]),
null_mut(),
);
pub static Draw_String: Pointer<unsafe extern "C" fn(c_int, c_int, *const c_char) -> c_int> =
Pointer::empty_patterns(
b"Draw_String\0",
// To find, search for "Downloading %s". You are in SCR_DrawDownloadText().
// Draw_String() will be the last call in the conditional block, below two other calls
// including Draw_SetTextColor() taking in three identical float arguments.
Patterns(&[
// 8684
pattern!(55 8B EC 56 57 E8 ?? ?? ?? ?? 8B 4D),
]),
null_mut(),
);
pub static DrawCrosshair: Pointer<unsafe extern "C" fn(c_int, c_int)> = Pointer::empty_patterns(
b"DrawCrosshair\0",
// To find, search for "Client.dll SPR_DrawHoles error: invalid frame". This is
// SPR_DrawHoles(), it's used in two places: a data table (cl_enginefuncs) and DrawCrosshair().
Patterns(&[
// 6153
pattern!(55 8B EC A1 ?? ?? ?? ?? 85 C0 74 ?? 8B 0D ?? ?? ?? ?? 8B 15),
// 4554
pattern!(A1 ?? ?? ?? ?? 85 C0 74 5C 8B 0D ?? ?? ?? ?? 8B 15 ?? ?? ?? ?? 51 8B 0D),
// CoF-5936
pattern!(55 8B EC 83 3D ?? ?? ?? ?? 00 74 ?? A1 ?? ?? ?? ?? 50 8B 0D ?? ?? ?? ?? 51),
]),
my_DrawCrosshair as _,
);
pub static frametime_remainder: Pointer<*mut f64> = Pointer::empty(
// Not a real symbol name.
b"frametime_remainder\0",
);
pub static GL_BeginRendering: Pointer<
unsafe extern "C" fn(*mut c_int, *mut c_int, *mut c_int, *mut c_int),
> = Pointer::empty_patterns(
b"GL_BeginRendering\0",
// To find, search for "R_BeginFrame". The function using this string is
// GLimp_LogNewFrame() and the function calling that is GL_BeginRendering().
Patterns(&[
// 6153
pattern!(55 8B EC 8B 45 ?? 8B 4D ?? 56 57),
// 4554
pattern!(8B 44 24 ?? 8B 4C 24 ?? 8B 54 24 ?? C7 00 00 00 00 00),
// CoF-5936
pattern!(55 8B EC 8B 45 ?? C7 00 00 00 00 00 8B 4D),
]),
null_mut(),
);
pub static gEntityInterface: Pointer<*mut DllFunctions> = Pointer::empty(b"gEntityInterface\0");
pub static gLoadSky: Pointer<*mut c_int> = Pointer::empty(b"gLoadSky\0");
pub static g_svmove: Pointer<*mut playermove_s> = Pointer::empty(b"g_svmove\0");
pub static Key_Event: Pointer<unsafe extern "C" fn(c_int, c_int)> = Pointer::empty_patterns(
b"Key_Event\0",
// To find, search for "ctrl-alt-del pressed".
Patterns(&[
// 6153
pattern!(55 8B EC 81 EC 00 04 00 00 8B 45 ?? 56 3D 00 01 00 00),
// 4554
pattern!(81 EC 00 04 00 00 8D 84 24 ?? ?? ?? ?? 8D 8C 24),
// 1600
pattern!(81 EC 00 04 00 00 56 8B B4 24 ?? ?? ?? ?? 57 8B BC 24),
// CoF-5936
pattern!(55 8B EC 81 EC 08 04 00 00 8D 45 0C 50 8D 4D 08 51 FF 15 ?? ?? ?? ?? 83 C4 08),
]),
my_Key_Event as _,
);
pub static LoadEntityDLLs: Pointer<unsafe extern "C" fn(*const c_char)> = Pointer::empty_patterns(
b"LoadEntityDLLs\0",
// To find, search for "GetNewDLLFunctions".
Patterns(&[
// 6153
// Don't use this for com_gamedir as the pattern matches versions with different offsets.
pattern!(55 8B EC B8 90 23 00 00),
// 4554
pattern!(81 EC 94 04 00 00 53 56 E8),
// 1600
pattern!(81 EC AC 05 00 00 E8),
// CoF-5936
pattern!(55 8B EC 81 EC BC 04 00 00 E8),
]),
my_LoadEntityDLLs as _,
);
pub static Mod_LeafPVS: Pointer<unsafe extern "C" fn(*mut mleaf_s, *mut model_s) -> *mut c_void> =
Pointer::empty_patterns(
b"Mod_LeafPVS\0",
// To find, search for "Spawned a NULL entity!", the referencing function is
// CreateNamedEntity. Find cross references, go to the global data, that data is
// g_engfuncsExportedToDlls Go up 5 entries and you'll find PVSFindEntities, inside
// this function first function call is Mod_PointInLeaf and the 2nd one is
// Mod_LeafPVS.
Patterns(&[
// 6153
pattern!(55 8B EC 8B 55 ?? 8B 45 ?? 8B 8A),
// 4554
pattern!(8B 54 24 ?? 8B 44 24 ?? 8B 8A),
// CoF-5936
pattern!(55 8B EC 51 8B 45 ?? 8B 4D ?? 3B 88 ?? ?? ?? ?? 75 07 B8 ?? ?? ?? ?? EB ?? 83 3D ?? ?? ?? ?? 00),
]),
my_Mod_LeafPVS as _,
);
pub static Host_FilterTime: Pointer<unsafe extern "C" fn(c_float) -> c_int> =
Pointer::empty_patterns(
b"Host_FilterTime\0",
// To find, search for "-sys_ticrate". The parent will be _Host_Frame().
Patterns(&[
// 6153
pattern!(55 8B EC 83 EC 08 D9 05 ?? ?? ?? ?? D8 1D ?? ?? ?? ?? DF E0 25),
// 4554
pattern!(55 8B EC 83 E4 F8 83 EC 08 D9 05 ?? ?? ?? ?? D8 1D ?? ?? ?? ?? DF E0 F6 C4 41),
// 3248
pattern!(55 8B EC 83 E4 F8 83 EC 08 D9 05 ?? ?? ?? ?? D8 1D ?? ?? ?? ?? DF E0 25 00 41 00 00),
// 1712
pattern!(55 8B EC 83 E4 F8 83 EC 08 D9 45 08 DC 05 ?? ?? ?? ?? A1 ?? ?? ?? ?? 85 C0 DD 1D ?? ?? ?? ?? 0F 85 E1 00 00 00),
// CoF-5936
pattern!(55 8B EC 83 EC 14 D9 05 ?? ?? ?? ?? D8 1D ?? ?? ?? ?? DF E0 F6 C4 41),
]),
my_Host_FilterTime as _,
);
pub static host_frametime: Pointer<*mut c_double> = Pointer::empty(b"host_frametime\0");
pub static Host_InitializeGameDLL: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
b"Host_InitializeGameDLL\0",
// To find, search for "Sys_InitializeGameDLL called twice, skipping second call".
// Alternatively, find LoadEntityDLLs() and go to the parent function.
Patterns(&[
// 6153
pattern!(E8 ?? ?? ?? ?? 8B 0D ?? ?? ?? ?? 33 C0 83 F9 01),
// 1600
pattern!(E8 ?? ?? ?? ?? A1 ?? ?? ?? ?? 85 C0 74 ?? 68 ?? ?? ?? ?? E8 ?? ?? ?? ?? 83 C4 04 C3),
// CoF-5936
pattern!(55 8B EC 83 EC 0C C6 45 ?? 2D),
]),
null_mut(),
);
pub static Host_NextDemo: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
b"Host_NextDemo\0",
// To find, search for "No demos listed with startdemos".
Patterns(&[
// 6153
pattern!(55 8B EC 81 EC 00 04 00 00 83 3D ?? ?? ?? ?? FF 0F 84),
// 4554
pattern!(A1 ?? ?? ?? ?? 81 EC 00 04 00 00 83 F8 FF 0F 84 87 00 00 00),
// 1712
pattern!(A1 ?? ?? ?? ?? 81 EC 00 04 00 00 83 F8 FF 0F 84 82 00 00 00),
// CoF-5936
pattern!(55 8B EC 81 EC 00 04 00 00 83 3D ?? ?? ?? ?? FF 75 05),
]),
my_Host_NextDemo as _,
);
pub static Host_Shutdown: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
b"Host_Shutdown\0",
// To find, search for "recursive shutdown".
Patterns(&[
// 6153
pattern!(A1 ?? ?? ?? ?? 53 33 DB 3B C3 74 ?? 68),
// 3248
pattern!(53 33 DB 53 68 ?? ?? ?? ?? FF 15),
// 1600
pattern!(A1 ?? ?? ?? ?? 85 C0 74 ?? 68 ?? ?? ?? ?? E8 ?? ?? ?? ?? 83 C4 04 C3 A1 ?? ?? ?? ?? C7 05 ?? ?? ?? ?? 01 00 00 00 85 C0),
// CoF-5936
pattern!(55 8B EC 83 EC 08 83 3D ?? ?? ?? ?? 00 74 ?? 68),
]),
my_Host_Shutdown as _,
);
pub static Host_Tell_f: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
b"Host_Tell_f\0",
// To find, search for "%s TELL: ".
Patterns(&[
// 6153
pattern!(55 8B EC 83 EC 40 A1 ?? ?? ?? ?? 56),
// 4554
pattern!(A1 ?? ?? ?? ?? 83 EC 40 83 F8 01 56 75 0A E8 ?? ?? ?? ?? ?? 83 C4 40 C3 E8 ?? ?? ?? ?? 83 F8 03 0F 8C 7A 01 00 00),
// 3248
pattern!(A1 ?? ?? ?? ?? 83 EC 40 83 F8 01 56 75 09),
// 1712
pattern!(A1 ?? ?? ?? ?? 83 EC 40 83 F8 01 56 75 0A E8 ?? ?? ?? ?? ?? 83 C4 40 C3 E8 ?? ?? ?? ?? 83 F8 03 0F 8C 82 01 00 00),
// CoF-5936
pattern!(55 8B EC 83 EC 54 83 3D ?? ?? ?? ?? 01 75 0A E8 ?? ?? ?? ?? E9 ?? ?? ?? ?? E8 ?? ?? ?? ?? 83 F8 03 7D 05),
]),
null_mut(),
);
pub static Host_ValidSave: Pointer<unsafe extern "C" fn() -> c_int> = Pointer::empty_patterns(
b"Host_ValidSave\0",
// To find, search for "Not playing a local game.".
Patterns(&[
// 6153
pattern!(A1 ?? ?? ?? ?? B9 01 00 00 00 3B C1 0F 85),
// CoF-5936
pattern!(55 8B EC 83 3D ?? ?? ?? ?? 01 74 ?? 33 C0),
]),
null_mut(),
);
pub static hudGetScreenInfo: Pointer<unsafe extern "C" fn(*mut SCREENINFO) -> c_int> =
Pointer::empty_patterns(
b"hudGetScreenInfo\0",
// 13th pointer in cl_enginefuncs.
Patterns(&[
// 6153
pattern!(55 8B EC 8D 45 ?? 50 FF 15 ?? ?? ?? ?? 8B 45 ?? 83 C4 04 85 C0 75 ?? 5D C3 81 38 14 02 00 00),
// 4554
pattern!(8D 44 24 ?? 50 FF 15 ?? ?? ?? ?? 8B 44 24 ?? 83 C4 04 85 C0 75 ?? C3 81 38 14 02 00 00),
// 1600
pattern!(56 8B 74 24 ?? 85 F6 75 ?? 33 C0 ?? C3 81 ?? 14 02 00 00),
// CoF-5936
pattern!(55 8B EC 8D 45 ?? 50 FF 15 ?? ?? ?? ?? 83 C4 04 83 7D ?? 00 75 ?? 33 C0 EB ?? 8B 4D ?? 81 39 14 02 00 00),
]),
my_hudGetScreenInfo as _,
);
pub static hudGetViewAngles: Pointer<unsafe extern "C" fn(*mut [c_float; 3])> =
Pointer::empty_patterns(
b"hudGetViewAngles\0",
// 35th pointer in cl_enginefuncs.
//
// Be careful! The very next function is hudSetViewAngles() which looks VERY similar, yet
// does the exact opposite thing!
Patterns(&[
// 8684
pattern!(55 8B EC 8D 45 ?? 50 FF 15 ?? ?? ?? ?? 8B 55),
]),
null_mut(),
);
pub static idum: Pointer<*mut c_int> = Pointer::empty(
// Not a real symbol name.
b"idum\0",
);
pub static listener_origin: Pointer<*mut [f32; 3]> = Pointer::empty(b"listener_origin\0");
pub static Memory_Init: Pointer<unsafe extern "C" fn(*mut c_void, c_int) -> c_int> =
Pointer::empty_patterns(
b"Memory_Init\0",
// To find, search for "Memory_Init".
Patterns(&[
// 6153
pattern!(55 8B EC 8B 45 ?? 8B 4D ?? 56 BE 00 00 20 00),
// 4554
pattern!(8B 44 24 ?? 8B 4C 24 ?? 56 BE 00 00 20 00),
// 1600
pattern!(8B 44 24 ?? 8B 4C 24 ?? 56 BE 00 00 02 00),
// CoF-5936
pattern!(55 8B EC 83 EC 08 C7 45 ?? 00 00 20 00),
]),
my_Memory_Init as _,
);
pub static Mem_Free: Pointer<unsafe extern "C" fn(*mut c_void)> = Pointer::empty_patterns(
b"Mem_Free\0",
// Mem_Free is called once in Host_Shutdown to free a pointer after checking that it's != 0. On
// Windows, it dispatches directly to an underlying function, and the pattern is for the
// underlying function.
Patterns(&[
// 6153
pattern!(55 8B EC 6A FF 68 ?? ?? ?? ?? 68 ?? ?? ?? ?? 64 A1 ?? ?? ?? ?? 50 64 89 25 ?? ?? ?? ?? 83 EC 18 53 56 57 8B 75 ?? 85 F6),
// 4554
pattern!(56 8B 74 24 ?? 85 F6 74 ?? 6A 09),
]),
null_mut(),
);
pub static movevars: Pointer<*mut movevars_s> = Pointer::empty(b"movevars\0");
pub static paintbuffer: Pointer<*mut [portable_samplepair_t; 1026]> =
Pointer::empty(b"paintbuffer\0");
pub static paintedtime: Pointer<*mut c_int> = Pointer::empty(b"paintedtime\0");
pub static pmove: Pointer<*mut *mut playermove_s> = Pointer::empty(b"pmove\0");
pub static ran1: Pointer<unsafe extern "C" fn() -> c_int> = Pointer::empty_patterns(
b"ran1\0",
// Find RandomLong(). The function it calls in the loop is ran1().
Patterns(&[
// 6153
pattern!(8B 0D ?? ?? ?? ?? 56 85 C9 ?? ?? 8B 35),
// CoF-5936
pattern!(55 8B EC 83 EC 08 83 3D ?? ?? ?? ?? 00 ?? ?? 83 3D ?? ?? ?? ?? 00 0F 85),
]),
null_mut(),
);
pub static ran1_iy: Pointer<*mut c_int> = Pointer::empty(
// Not a real symbol name.
b"ran1::iy\0",
);
pub static ran1_iv: Pointer<*mut [c_int; 32]> = Pointer::empty(
// Not a real symbol name.
b"ran1::iv\0",
);
pub static realtime: Pointer<*mut f64> = Pointer::empty(b"realtime\0");
pub static r_refdef: Pointer<*mut c_void> = Pointer::empty(b"r_refdef\0");
pub static r_refdef_vieworg: Pointer<*mut [c_float; 3]> = Pointer::empty(
// Not a real symbol name.
b"r_refdef_vieworg\0",
);
pub static r_refdef_viewangles: Pointer<*mut [c_float; 3]> = Pointer::empty(
// Not a real symbol name.
b"r_refdef_viewangles\0",
);
pub static R_DrawSequentialPoly: Pointer<
unsafe extern "C" fn(*mut c_void, *mut c_int) -> *mut c_void,
> = Pointer::empty_patterns(
b"R_DrawSequentialPoly\0",
// To find, search for "Too many decal surfaces!\n". This string will be used once in
// R_RenderBrushPoly and twice in R_DrawSequentialPoly.
Patterns(&[
// 6153
pattern!(55 8B EC 51 A1 ?? ?? ?? ?? 53 56 57 83 B8 ?? ?? ?? ?? 01),
// 4554
pattern!(A1 ?? ?? ?? ?? 53 55 56 8B 88),
// 1600
pattern!(A1 ?? ?? ?? ?? 53 55 BD 01 00 00 00 8B 88 F8 02 00 00 56 3B CD 57 75 62 E8 ?? ?? ?? ?? 68 03 03 00 00 68 02 03 00 00),
// CoF-5936
pattern!(55 8B EC 83 EC 1C A1 ?? ?? ?? ?? 83 B8 ?? ?? ?? ?? 01),
]),
my_R_DrawSequentialPoly as _,
);
pub static R_Clear: Pointer<unsafe extern "C" fn() -> *mut c_void> = Pointer::empty_patterns(
b"R_Clear\0",
// To find, search for "R_RenderView". This is R_RenderView, the call before two if
// (global == 0) {} conditions is R_Clear.
Patterns(&[
// 6153
pattern!(8B 15 ?? ?? ?? ?? 33 C0 83 FA 01),
// 3248
pattern!(D9 05 ?? ?? ?? ?? DC 1D ?? ?? ?? ?? DF E0 F6 C4 ?? ?? ?? D9 05 ?? ?? ?? ?? D8 1D ?? ?? ?? ?? DF E0 F6 C4 ?? ?? ?? 68 ?? ?? ?? ?? EB),
// CoF-5936
pattern!(55 8B EC 33 C0 83 3D ?? ?? ?? ?? 01 0F 9F C0 50 E8 ?? ?? ?? ?? 83 C4 04 D9 05 ?? ?? ?? ?? DC 1D),
]),
my_R_Clear as _,
);
pub static R_DrawSkyBox: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
b"R_DrawSkyBox\0",
// To find, search for "ClipSkyPolygon: MAX_CLIP_VERTS" string.
// This is ClipSkyPolygon. On Windows, right below that function is R_DrawSkyChain.
// Last call in R_DrawSkyChain is R_DrawSkyBox. Alternatively, search for the byte
// sequence "42 B0 47 34 C3 BE D2 BF", the referencing function is R_DrawSkyBox.
Patterns(&[
// 6153
pattern!(55 8B EC 83 EC 1C A1 ?? ?? ?? ?? 53 56),
// 4554
pattern!(83 EC 1C A1 ?? ?? ?? ?? 53 55),
// 1712
pattern!(83 EC 0C 53 55 56 57 E8 ?? ?? ?? ?? 33 FF),
// CoF-5936
pattern!(55 8B EC 83 EC 24 C7 45 ?? 00 00 00 00 C7 45 ?? 00 00 80 3F),
]),
my_R_DrawSkyBox as _,
);
pub static R_DrawViewModel: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
// To find, search for "R_RenderView". This is R_RenderView.
// There will be an assignment of `mirror = false` and a function call follows.
// The next line should be branching of `r_refdef.onlyClientDraws == false`, which will repeat
// again in R_RenderView(). R_DrawViewModel is called in the block where branch appears the
// second time. In that branch block, it contains two functions called. The first one is
// R_DrawViewModel().
b"R_DrawViewModel\0",
Patterns(&[
// 8684
pattern!(55 8B EC 83 EC 50 D9 05 ?? ?? ?? ?? D8 1D ?? ?? ?? ?? 56 57 33 FF C7 45),
// 4554
pattern!(83 EC ?? D9 05 ?? ?? ?? ?? D8 1D ?? ?? ?? ?? 56 57 33 FF C7 44),
]),
my_R_DrawViewModel as _,
);
pub static R_LoadSkys: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
b"R_LoadSkys\0",
// To find, search for "done\n".
Patterns(&[
// 8684
pattern!(55 8B EC 83 EC 6C A1 ?? ?? ?? ?? 56),
]),
my_R_LoadSkys as _,
);
pub static R_PreDrawViewModel: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
// To find, search for "R_RenderView". This is R_RenderView.
// There will be an assignment of `mirror = false` and a function call follows.
// The next line should be branching of `r_refdef.onlyClientDraws == false`, which will repeat
// again in R_RenderView(). In that branching block, there is one function called, that is
// R_PreDrawViewModel().
b"R_PreDrawViewModel\0",
Patterns(&[
// 8684
pattern!(D9 05 ?? ?? ?? ?? D8 1D ?? ?? ?? ?? 56 C7 05),
]),
my_R_PreDrawViewModel as _,
);
pub static R_RenderView: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
b"R_RenderView\0",
// To find, search for "R_RenderView: NULL worldmodel".
Patterns(&[
// 8684
pattern!(55 8B EC 83 EC 14 D9 05 ?? ?? ?? ?? D8 1D ?? ?? ?? ?? DF E0 F6 C4 44 0F 8A ?? ?? ?? ?? A1 ?? ?? ?? ?? 85 C0 74),
]),
my_R_RenderView as _,
);
pub static R_SetFrustum: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
b"R_SetFrustum\0",
// To find, search for "R_RenderView". This is R_RenderView(). The call between two if (global
// == 0) {} conditions is R_RenderScene(). Open R_RenderScene(). The second call after the
// first check is R_SetFrustum().
Patterns(&[
// 6153
pattern!(55 8B EC 83 EC 08 DB 05),
// 4554
pattern!(83 EC 08 DB 05 ?? ?? ?? ?? A1 ?? ?? ?? ?? 56 89 44 24 04),
// CoF-5936
pattern!(55 8B EC 83 EC 0C A1 ?? ?? ?? ?? 89 45 ?? DB 05),
]),
my_R_SetFrustum as _,
);
pub static ReleaseEntityDlls: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
b"ReleaseEntityDlls\0",
// Find Host_Shutdown(). It has a Mem_Free() if. The 3-rd function above that if is
// ReleaseEntityDlls().
Patterns(&[
// 6153
pattern!(A1 ?? ?? ?? ?? 56 57 BE ?? ?? ?? ?? 8D 04),
// CoF-5936
pattern!(55 8B EC 83 EC 08 C7 45 ?? ?? ?? ?? ?? A1 ?? ?? ?? ?? 6B C0 0C),
]),
my_ReleaseEntityDlls as _,
);
pub static S_PaintChannels: Pointer<unsafe extern "C" fn(c_int)> = Pointer::empty_patterns(
b"S_PaintChannels\0",
// To find, search for "Start profiling 10,000 calls to DSP". This is S_Say(). A call below
// which has an argument of something + 0x4e2000 is S_PaintChannels().
Patterns(&[
// 6153
pattern!(55 8B EC A1 ?? ?? ?? ?? 53 8B 5D ?? 3B C3 0F 8D),
// 4554
pattern!(A1 ?? ?? ?? ?? 55 8B 6C 24),
// CoF-5936
pattern!(55 8B EC 83 EC 14 A1 ?? ?? ?? ?? 3B 45),
]),
my_S_PaintChannels as _,
);
pub static S_PrecacheSound: Pointer<unsafe extern "C" fn(*const c_char) -> *mut sfx_s> =
Pointer::empty_patterns(
b"S_PrecacheSound\0",
// To find, search for "Cannot continue without sound". You are in CL_PrecacheResources().
// The string will be inside a condition block. That condition block is also inside
// another condition block. There are 3 calls inside the outer conditon block. The
// second call with one argument will be S_PrecacheSound().
Patterns(&[
// 8684
pattern!(55 8B EC A1 ?? ?? ?? ?? 56 85 C0 74 ?? D9 05),
]),
null_mut(),
);
pub static S_Say: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
b"S_Say\0",
// To find, search for "Start profiling 10,000 calls to DSP".
Patterns(&[
// 8684
pattern!(55 8B EC 81 EC 00 01 00 00 D9 05 ?? ?? ?? ?? D8 1D ?? ?? ?? ?? 53),
]),
null_mut(),
);
pub static S_StartDynamicSound: Pointer<
unsafe extern "C" fn(c_int, c_int, *mut sfx_s, *const c_float, c_float, c_float, c_int, c_int),
> = Pointer::empty_patterns(
b"S_StartDynamicSound\0",
// To find, search for "S_StartDynamicSound: ".
Patterns(&[
// 8684
pattern!(55 8B EC 83 EC 48 A1 ?? ?? ?? ?? 53),
]),
null_mut(),
);
pub static S_StopSound: Pointer<unsafe extern "C" fn(c_int, c_int)> = Pointer::empty_patterns(
b"S_StopSound\0",
// To find, search for "Voice - compress: ". You are in Voice_Idle(). Look an else block with
// exactly 1 line of 1 call inside with `1` as an argument. That will be Voice_EndChannel().
// Inside Voice_EndChannel(), there will be an if block with eaxctly 1 line of 1 call with 1
// argument. That will be VoiceSE_EndChannel() and it is a wrapper for S_StopSound() call.
Patterns(&[
// 8684
pattern!(55 8B EC A1 ?? ?? ?? ?? 57 BF 04 00 00 00),
]),
null_mut(),
);
pub static S_TransferStereo16: Pointer<unsafe extern "C" fn(c_int)> = Pointer::empty_patterns(
b"S_TransferStereo16\0",
// To find, find S_PaintChannels(), go into the last call before the while () condition in the
// end and this will be the function that that one falls through into. Alternatively, search
// for "S_TransferStereo16".
Patterns(&[
// 6153
pattern!(55 8B EC 83 EC 0C D9 05 ?? ?? ?? ?? D8 0D),
// 4554
pattern!(D9 05 ?? ?? ?? ?? D8 0D ?? ?? ?? ?? 83 EC 0C 53 56 57 E8 ?? ?? ?? ?? 8B 4C 24 1C A3 ?? ?? ?? ?? A1 ?? ?? ?? ?? C7 05 ?? ?? ?? ?? ?? ?? ?? ?? 8D 3C 09 8D 34 00 A1 ?? ?? ?? ?? 85 C0 74 55 E8),
// 3248
pattern!(D9 05 ?? ?? ?? ?? D8 0D ?? ?? ?? ?? 83 EC 0C 53 56 57 E8 ?? ?? ?? ?? 8B 4C 24 1C A3 ?? ?? ?? ?? A1 ?? ?? ?? ?? C7 05 ?? ?? ?? ?? ?? ?? ?? ?? 8D 3C 09 8D 34 00 A1 ?? ?? ?? ?? 85 C0 74 54 E8),
// CoF-5936
pattern!(55 8B EC 83 EC 24 D9 05 ?? ?? ?? ?? D8 0D ?? ?? ?? ?? E8),
]),
my_S_TransferStereo16 as _,
);
pub static SCR_DrawLoading: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
b"SCR_DrawLoading\0",
// To find, search for "cz_worldmap" string in Steampipe DLL.
// This is SCR_DrawPause. Right below that function is SCR_DrawLoading.
// This pattern also works for the pre-Steampipe builds.
// Another way to find this would be as follows:
// To find, search for "transition" string, there is two functions with that string:
// SCR_BeginLoadingPlaque and SCR_EndLoadingPlaque. Go to SCR_EndLoadingPlaque, it can be
// recognized by having much less code than in SCR_BeginLoadingPlaque. Find second variable
// inside of that function, it would be scr_drawloading boolean. Now to references of
// variable and find other function with shortest code in it, that would be SCR_DrawLoading
// function.
Patterns(&[
// 6153
pattern!(A1 ?? ?? ?? ?? 85 C0 74 05 E9 ?? ?? FF FF C3 90),
// CoF-5936
pattern!(55 8B EC 83 3D ?? ?? ?? ?? 00 75 ?? EB ?? E8 ?? ?? ?? ?? 5D C3 55 8B EC E8),
]),
my_SCR_DrawLoading as _,
);
pub static SCR_DrawPause: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
b"SCR_DrawPause\0",
// To find, search for "cz_worldmap". You are in SCR_DrawPause().
Patterns(&[
pattern!(D9 05 ?? ?? ?? ?? D8 1D ?? ?? ?? ?? DF E0 F6 C4 44 7B ?? A1 ?? ?? ?? ?? 85 C0 74 ?? E8 ?? ?? ?? ?? 85),
]),
my_SCR_DrawPause as _,
);
pub static scr_fov_value: Pointer<*mut c_float> = Pointer::empty(b"scr_fov_value\0");
pub static shm: Pointer<*mut *mut dma_t> = Pointer::empty(b"shm\0");
pub static sv: Pointer<*mut c_void> = Pointer::empty(b"sv\0");
pub static sv_edicts: Pointer<*mut *mut edict_s> = Pointer::empty(
// Not a real symbol name.
b"sv_edicts\0",
);
pub static sv_num_edicts: Pointer<*mut c_int> = Pointer::empty(
// Not a real symbol name.
b"sv_num_edicts\0",
);
pub static svs: Pointer<*mut server_static_s> = Pointer::empty(b"svs\0");
pub static sv_areanodes: Pointer<*mut c_void> = Pointer::empty(b"sv_areanodes\0");
pub static SV_AddLinksToPM: Pointer<unsafe extern "C" fn(*mut c_void, *const [f32; 3])> =
Pointer::empty(b"SV_AddLinksToPM\0");
pub static SV_AddLinksToPM_: Pointer<
unsafe extern "C" fn(*mut c_void, *mut [f32; 3], *mut [f32; 3]),
> = Pointer::empty_patterns(
b"SV_AddLinksToPM_\0",
// To find, search for "SV_AddLinksToPM: pmove->nummoveent >= MAX_MOVEENTS\n"
Patterns(&[
// 8684
pattern!(55 8B EC 83 EC 14 8B 4D ?? 53 8B 5D),
// 4554
pattern!(83 EC 10 53 55 56 57 8B 5C 24),
// 3248
pattern!(83 EC 10 53 8B 5C 24 ?? 55 56 57),
// CoF-5936
pattern!(55 8B EC 83 EC 24 56 57 8B 45 ?? 8B 48),
]),
my_SV_AddLinksToPM_ as _,
);
pub static SV_ExecuteClientMessage: Pointer<unsafe extern "C" fn(*mut c_void)> =
Pointer::empty_patterns(
b"SV_ExecuteClientMessage\0",
// To find, search for "SV_ReadClientMessage: badread".
Patterns(&[
// 8684
pattern!(55 8B EC 8B 0D ?? ?? ?? ?? 56 8B 75 ?? C7 05 ?? ?? ?? ?? 00 00 00 00),
// CoF-5936
pattern!(55 8B EC 83 EC 0C C7 05 ?? ?? ?? ?? 00 00 00 00 8B 45 08),
]),
null_mut(),
);
pub static SV_Frame: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
b"SV_Frame\0",
// To find, search for "%s timed out". It is used in SV_CheckTimeouts(), which is called by
// SV_Frame().
Patterns(&[
// 6153
pattern!(A1 ?? ?? ?? ?? 85 C0 74 ?? DD 05 ?? ?? ?? ?? A1),
// CoF-5936
pattern!(55 8B EC 83 3D ?? ?? ?? ?? 00 75 ?? EB ?? DD 05 ?? ?? ?? ?? D9 1D ?? ?? ?? ?? A1 ?? ?? ?? ?? A3 ?? ?? ?? ?? 8B 0D),
]),
my_SV_Frame as _,
);
pub static SV_RunCmd: Pointer<unsafe extern "C" fn(*mut usercmd_s, c_int)> =
Pointer::empty_patterns(
b"SV_RunCmd\0",
// To find, find SV_AddLinksToPM_(), go to the referenced caller function,
// this is SV_AddLinksToPM(), go to the referenced function once again,
// this is SV_RunCmd().
Patterns(&[
// 8684
pattern!(55 8B EC 81 EC ?? ?? ?? ?? 56 57 8B 75 08 B9 0D 00 00 00 8D 7D 84 F3 A5 A1 ?? ?? ?? ?? DD 80 ?? ?? ?? ?? DC 1D ?? ?? ?? ?? DF E0 25 00 41 00 00),
// 4554
pattern!(55 8B EC 81 EC ?? ?? ?? ?? 56 57 8B 75 08 B9 0D 00 00 00 8D 7D 84 F3 A5 A1 ?? ?? ?? ?? DD 80 ?? ?? ?? ?? DC 1D ?? ?? ?? ?? DF E0 F6 C4 41),
// CoF-5936
pattern!(55 8B EC 81 EC ?? ?? ?? ?? 56 57 8B 75 08 B9 ?? 00 00 00 8D 7D 80 F3 A5 A1 ?? ?? ?? ?? DD 80 ?? ?? ?? ?? DC 1D ?? ?? ?? ?? DF E0 F6 C4 41),
]),
null_mut(),
);
pub static SV_StartSound: Pointer<
unsafe extern "C" fn(c_int, *mut edict_s, c_int, *const c_char, c_int, c_float, c_int, c_int),
> = Pointer::empty_patterns(
b"SV_StartSound\0",
// To find, search for "EMIT_SOUND: volume = ". You are in PF_sound_I(). The last call with `0`
// in its argument in that function will be SV_StartSound().
Patterns(&[
// 8684
pattern!(55 8B EC 83 EC 0C 53 8B 5D ?? 56 57 33 C9),
]),
null_mut(),
);
pub static Sys_VID_FlipScreen: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
b"_Z18Sys_VID_FlipScreenv\0",
// To find, search for "Sys_InitLauncherInterface()". Go into function right after the one that
// accepts this string as an argument. The last function pointer assigned is
// Sys_VID_FlipScreen(). It checks one pointer for NULL then calls SDL_GL_SwapWindow().
Patterns(&[
// 6153
pattern!(A1 ?? ?? ?? ?? 85 C0 74 ?? 8B 00),
// 4554
pattern!(A1 ?? ?? ?? ?? 50 FF 15 ?? ?? ?? ?? C3),
// CoF-5936
pattern!(55 8B EC A1 ?? ?? ?? ?? 50 FF 15 ?? ?? ?? ?? 5D),
]),
my_Sys_VID_FlipScreen as _,
);
pub static Sys_VID_FlipScreen_old: Pointer<unsafe extern "system" fn(*mut c_void)> =
Pointer::empty_patterns(
// Not a real symbol name.
b"_Z18Sys_VID_FlipScreenv_old\0",
// To find, search for "wglSwapBuffers". This pointer is assigned to a global, which is
// called in a single function, this is Sys_VID_FlipScreen().
Patterns(&[
// 1712
pattern!(8B 44 24 ?? 50 FF 15 ?? ?? ?? ?? C2 04 00),
]),
my_Sys_VID_FlipScreen_old as _,
);
pub static tri: Pointer<*const triangleapi_s> = Pointer::empty(b"tri\0");
pub static V_ApplyShake: Pointer<unsafe extern "C" fn(*mut [f32; 3], *mut [f32; 3], c_float)> =
Pointer::empty_patterns(
b"V_ApplyShake\0",
// To find, search for "ScreenShake". This is ClientDLL_Init(), near the bottom there are
// two similar function calls, one is using our string as the 1st param and another
// function as the 2nd param, open that function in the 2nd param. This is
// V_ScreenShake(), right above it is V_ApplyShake().
Patterns(&[
// 6153
pattern!(55 8B EC 8D 45 ?? 8D 4D ?? 50 8D 55 ?? 51 52 FF 15 ?? ?? ?? ?? 8B 45 ?? 83 C4 0C),
// 4554
pattern!(8D 44 24 ?? 8D 4C 24 ?? 50 8D 54 24 ?? 51 52 FF 15 ?? ?? ?? ?? 8B 44 24 ?? 83 C4 0C),
// 1712
pattern!(8B 44 24 ?? 85 C0 74 ?? 8B 4C 24 ?? 50),
// CoF-5936
pattern!(55 8B EC 8D 45 ?? 50 8D 4D ?? 51 8D 55 ?? 52 FF 15 ?? ?? ?? ?? 83 C4 0C 83 7D ?? 00),
]),
my_V_ApplyShake as _,
);
pub static V_FadeAlpha: Pointer<unsafe extern "C" fn() -> c_int> = Pointer::empty_patterns(
b"V_FadeAlpha\0",
// To find, search for "%3ifps %3i ms %4i wpoly %4i epoly". This will lead to either
// R_RenderView() or its usually-inlined part, and the string will be used within an if. Right
// above the if is S_ExtraUpdate(), and right above that (maybe in another if) is
// R_PolyBlend(). Inside R_PolyBlend(), the first call is V_FadeAlpha().
Patterns(&[
// 6153
pattern!(55 8B EC 83 EC 08 D9 05 ?? ?? ?? ?? DC 1D),
// 4554
pattern!(D9 05 ?? ?? ?? ?? DC 1D ?? ?? ?? ?? 8A 0D ?? ?? ?? ?? 83 EC 08),
// CoF-5936
pattern!(55 8B EC 83 EC 0C C7 45 ?? 00 00 00 00 D9 05 ?? ?? ?? ?? DC 1D ?? ?? ?? ?? DF E0),
]),
my_V_FadeAlpha as _,
);
pub static V_RenderView: Pointer<unsafe extern "C" fn()> = Pointer::empty_patterns(
b"V_RenderView\0",
// To find, search for "R_RenderView: NULL worldmodel". This is an output error for
// R_RenderView(). Then, find a function calling R_RenderView() exactly 3 times. That
// function will be V_RenderView().
Patterns(&[
// 8684
pattern!(55 8B EC 81 EC F4 00 00 00 A1 ?? ?? ?? ?? 56 57),
]),
my_V_RenderView as _,
);
pub static VideoMode_IsWindowed: Pointer<unsafe extern "C" fn() -> c_int> = Pointer::empty_patterns(
b"VideoMode_IsWindowed\0",
// To find, first find GL_BeginRendering(). The first check is for the
// return value of VideoMode_IsWindowed().
Patterns(&[
// 6153
pattern!(8B 0D ?? ?? ?? ?? 85 C9 74 ?? 8B 01 FF 50 ?? 84 C0),
// 3248
pattern!(8B 0D ?? ?? ?? ?? 8B 01 FF 50 ?? 25 FF 00 00 00),
// CoF-5936
pattern!(55 8B EC 51 83 3D ?? ?? ?? ?? 00 74 ?? A1 ?? ?? ?? ?? 8B 10),
]),
null_mut(),
);
pub static VideoMode_GetCurrentVideoMode: Pointer<
unsafe extern "C" fn(*mut c_int, *mut c_int, *mut c_int),
> = Pointer::empty_patterns(
b"VideoMode_GetCurrentVideoMode\0",
// To find, first find GL_BeginRendering(). The first if calls
// VideoMode_GetCurrentVideoMode().
Patterns(&[
// 6153
pattern!(55 8B EC 8B 0D ?? ?? ?? ?? 8B 01 FF 50 ?? 85 C0),
// 4554
pattern!(8B 0D ?? ?? ?? ?? 8B 01 FF 50 ?? 85 C0 74 ?? 8B 4C 24),
// CoF-5936
pattern!(55 8B EC 51 A1 ?? ?? ?? ?? 8B 10 8B 0D ?? ?? ?? ?? FF 52),
]),
null_mut(),
);
pub static window_rect: Pointer<*mut Rect> = Pointer::empty(b"window_rect\0");
pub static Z_Free: Pointer<unsafe extern "C" fn(*mut c_void)> = Pointer::empty_patterns(
b"Z_Free\0",
// To find, search for "Z_Free: NULL pointer".
Patterns(&[
// 6153
pattern!(55 8B EC 56 8B 75 ?? 85 F6 57 75 ?? 68 ?? ?? ?? ?? E8 ?? ?? ?? ?? 83 C4 04 8B 46),
// 4554
pattern!(56 8B 74 24 ?? 85 F6 57 75 ?? 68 ?? ?? ?? ?? E8 ?? ?? ?? ?? 83 C4 04 8B 46),
// CoF-5936
pattern!(55 8B EC 83 EC 08 83 7D ?? 00 75 ?? 68 ?? ?? ?? ?? E8 ?? ?? ?? ?? 83 C4 04 8B 45),
]),
null_mut(),
);
pub static client_s_edict_offset: MainThreadCell<Option<usize>> = MainThreadCell::new(None);
static POINTERS: &[&dyn PointerTrait] = &[
&build_number,
&CBaseUI__HideGameUI,
&Cbuf_AddFilteredText,
&Cbuf_AddText,
&Cbuf_AddTextToBuffer,
&Cbuf_InsertText,
&CL_Disconnect,
&cl_funcs,
&CL_GameDir_f,
&cl_lightstyle,
&CL_Move,
&CL_Parse_LightStyle,
&CL_PlayDemo_f,
&CL_ViewDemo_f,
&ClientDLL_Init,