-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathframework.h
More file actions
1121 lines (1003 loc) · 29.5 KB
/
framework.h
File metadata and controls
1121 lines (1003 loc) · 29.5 KB
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
#pragma once
#include "callspoof.h"
#define WSINTERNAL_MOD_NAME "T7InternalWS.dll"
#define WSTORE_MOD_NAME "WSBlackOps3.exe"
#define WSTORE_UPDATER_WSID 3413662211
#define WSTORE_UPDATER_FILENAME "wsupdate.ff"
#define WSTORE_UPDATER_DEST_FILENAME "wsupdate.next"
#define VERSION_STRING "BO3Enhanced v1.16"
// If true, is development environment (printing, console, etc)
#define IS_DEVELOPMENT 0
// If true, enables the steamapi
#define ENABLE_STEAMAPI 1
// If false, disables all GDK components
#define USES_GDK 1
#if IS_DEVELOPMENT
#define DEV_SKIP_UPDATES 1
#define DEV_TEST_UPDATES 0
#define LOG_DEMONWARE 0
#define BADWORD_BYPASS 1
#define DWINVENTORY_UNLOCK_ALL 1
#define SCREENSHOT_OVERRIDE 1
#define ALLOC_CONSOLE 1
#define REMAP_EXPERIMENT 0
#define ALOG(...) nlog(__VA_ARGS__)
#else
#define ALOG(...)
#endif
// number of ticks to wait before checking steamauth (in ms)
#define STEAMAUTH_TICK_DELAY 15000
// number of ticks to wait before retrying steamauth for a client (in ms)
#define STEAMAUTH_CLIENT_RETRY_DELAY 30000
// number of ticks to wait before asking for a new auth ticket (minimum 1 minute for steam reasons) -- MUST BE A MULTIPLE OF STEAMAUTH_CLIENT_RETRY_DELAY
#define STEAMAUTH_DELAY_NEW_TIME (STEAMAUTH_CLIENT_RETRY_DELAY * 2)
// number of ticks to wait before disconnecting a client for failed steamauth (in ms)
#define STEAMAUTH_FAIL_TIMEOUT 180000
// time in ms to wait between checking to see if the active user is in a steam lobby
#define STEAMLOBBY_CHECK_DELAY 5000
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files
#include <windows.h>
#include <string>
#include <vector>
#include <fstream>
#include <istream>
#include <iostream>
#include <strsafe.h>
#define SystemHandleInformation 16
#include <Windows.h>
#include <iostream>
#include <Winternl.h>
#include <winnt.h>
#include <windows.h>
#include <stdio.h>
#include <functional>
#define NT_SUCCESS(x) ((x) >= 0)
#define STATUS_INFO_LENGTH_MISMATCH 0xc0000004
#define SystemHandleInformation 16
#define ObjectBasicInformation 0
#define ObjectNameInformation 1
#define ObjectTypeInformation 2
typedef NTSTATUS(NTAPI* _NtQuerySystemInformation)(
ULONG SystemInformationClass,
PVOID SystemInformation,
ULONG SystemInformationLength,
PULONG ReturnLength
);
typedef NTSTATUS(NTAPI* _NtDuplicateObject)(
HANDLE SourceProcessHandle,
HANDLE SourceHandle,
HANDLE TargetProcessHandle,
PHANDLE TargetHandle,
ACCESS_MASK DesiredAccess,
ULONG Attributes,
ULONG Options
);
typedef NTSTATUS(NTAPI* _NtQueryObject)(
HANDLE ObjectHandle,
ULONG ObjectInformationClass,
PVOID ObjectInformation,
ULONG ObjectInformationLength,
PULONG ReturnLength
);
typedef struct _SYSTEM_HANDLE
{
ULONG ProcessId;
BYTE ObjectTypeNumber;
BYTE Flags;
USHORT Handle;
PVOID Object;
ACCESS_MASK GrantedAccess;
} SYSTEM_HANDLE, * PSYSTEM_HANDLE;
typedef struct _SYSTEM_HANDLE_INFORMATION
{
ULONG HandleCount;
SYSTEM_HANDLE Handles[1];
} SYSTEM_HANDLE_INFORMATION, * PSYSTEM_HANDLE_INFORMATION;
typedef enum _POOL_TYPE
{
NonPagedPool,
PagedPool,
NonPagedPoolMustSucceed,
DontUseThisType,
NonPagedPoolCacheAligned,
PagedPoolCacheAligned,
NonPagedPoolCacheAlignedMustS
} POOL_TYPE, * PPOOL_TYPE;
typedef struct _OBJECT_TYPE_INFORMATION
{
ULONG TotalNumberOfObjects;
ULONG TotalNumberOfHandles;
ULONG TotalPagedPoolUsage;
ULONG TotalNonPagedPoolUsage;
ULONG TotalNamePoolUsage;
ULONG TotalHandleTableUsage;
ULONG HighWaterNumberOfObjects;
ULONG HighWaterNumberOfHandles;
ULONG HighWaterPagedPoolUsage;
ULONG HighWaterNonPagedPoolUsage;
ULONG HighWaterNamePoolUsage;
ULONG HighWaterHandleTableUsage;
ULONG InvalidAttributes;
GENERIC_MAPPING GenericMapping;
ULONG ValidAccess;
BOOLEAN SecurityRequired;
BOOLEAN MaintainHandleCount;
USHORT MaintainTypeList;
POOL_TYPE PoolType;
ULONG PagedPoolUsage;
ULONG NonPagedPoolUsage;
} OBJECT_TYPE_INFORMATION, * POBJECT_TYPE_INFORMATION;
namespace nt
{
typedef struct _CLIENT_ID
{
PVOID UniqueProcess;
PVOID UniqueThread;
} CLIENT_ID, * PCLIENT_ID;
typedef struct _PEB_LDR_DATA
{
ULONG Length;
UCHAR Initialized;
PVOID SsHandle;
LIST_ENTRY InLoadOrderModuleList;
LIST_ENTRY InMemoryOrderModuleList;
LIST_ENTRY InInitializationOrderModuleList;
PVOID EntryInProgress;
} PEB_LDR_DATA, * PPEB_LDR_DATA;
typedef struct _PROCESS_BASIC_INFORMATION
{
NTSTATUS ExitStatus;
PPEB PebBaseAddress;
KAFFINITY AffinityMask;
KPRIORITY BasePriority;
HANDLE UniqueProcessId;
HANDLE InheritedFromUniqueProcessId;
} PROCESS_BASIC_INFORMATION, * PPROCESS_BASIC_INFORMATION;
typedef struct _UNICODE_STRING
{
WORD Length;
WORD MaximumLength;
WORD* Buffer;
} UNICODE_STRING, * PUNICODE_STRING;
typedef struct _CURDIR
{
UNICODE_STRING DosPath;
PVOID Handle;
} CURDIR, * PCURDIR;
typedef struct _STRING
{
WORD Length;
WORD MaximumLength;
CHAR* Buffer;
} STRING, * PSTRING;
typedef struct _RTL_DRIVE_LETTER_CURDIR
{
WORD Flags;
WORD Length;
ULONG TimeStamp;
STRING DosPath;
} RTL_DRIVE_LETTER_CURDIR, * PRTL_DRIVE_LETTER_CURDIR;
typedef struct _RTL_USER_PROCESS_PARAMETERS
{
ULONG MaximumLength;
ULONG Length;
ULONG Flags;
ULONG DebugFlags;
PVOID ConsoleHandle;
ULONG ConsoleFlags;
PVOID StandardInput;
PVOID StandardOutput;
PVOID StandardError;
CURDIR CurrentDirectory;
UNICODE_STRING DllPath;
UNICODE_STRING ImagePathName;
UNICODE_STRING CommandLine;
PVOID Environment;
ULONG StartingX;
ULONG StartingY;
ULONG CountX;
ULONG CountY;
ULONG CountCharsX;
ULONG CountCharsY;
ULONG FillAttribute;
ULONG WindowFlags;
ULONG ShowWindowFlags;
UNICODE_STRING WindowTitle;
UNICODE_STRING DesktopInfo;
UNICODE_STRING ShellInfo;
UNICODE_STRING RuntimeData;
RTL_DRIVE_LETTER_CURDIR CurrentDirectores[32];
ULONG EnvironmentSize;
} RTL_USER_PROCESS_PARAMETERS, * PRTL_USER_PROCESS_PARAMETERS;
struct _PEB_FREE_BLOCK;
typedef struct _PEB_FREE_BLOCK* PPEB_FREE_BLOCK;
typedef struct _PEB_FREE_BLOCK
{
PPEB_FREE_BLOCK Next;
ULONG Size;
} PEB_FREE_BLOCK, * PPEB_FREE_BLOCK;
typedef struct _PEB
{
UCHAR InheritedAddressSpace;
UCHAR ReadImageFileExecOptions;
UCHAR BeingDebugged;
UCHAR BitField;
ULONG ImageUsesLargePages : 1;
ULONG IsProtectedProcess : 1;
ULONG IsLegacyProcess : 1;
ULONG IsImageDynamicallyRelocated : 1;
ULONG SpareBits : 4;
PVOID Mutant;
PVOID ImageBaseAddress;
PPEB_LDR_DATA Ldr;
PRTL_USER_PROCESS_PARAMETERS ProcessParameters;
PVOID SubSystemData;
PVOID ProcessHeap;
PRTL_CRITICAL_SECTION FastPebLock;
PVOID AtlThunkSListPtr;
PVOID IFEOKey;
ULONG CrossProcessFlags;
ULONG ProcessInJob : 1;
ULONG ProcessInitializing : 1;
ULONG ReservedBits0 : 30;
union
{
PVOID KernelCallbackTable;
PVOID UserSharedInfoPtr;
};
ULONG SystemReserved[1];
ULONG SpareUlong;
PPEB_FREE_BLOCK FreeList;
ULONG TlsExpansionCounter;
PVOID TlsBitmap;
ULONG TlsBitmapBits[2];
PVOID ReadOnlySharedMemoryBase;
PVOID HotpatchInformation;
VOID** ReadOnlyStaticServerData;
PVOID AnsiCodePageData;
PVOID OemCodePageData;
PVOID UnicodeCaseTableData;
ULONG NumberOfProcessors;
ULONG NtGlobalFlag;
LARGE_INTEGER CriticalSectionTimeout;
ULONG HeapSegmentReserve;
ULONG HeapSegmentCommit;
ULONG HeapDeCommitTotalFreeThreshold;
ULONG HeapDeCommitFreeBlockThreshold;
ULONG NumberOfHeaps;
ULONG MaximumNumberOfHeaps;
VOID** ProcessHeaps;
PVOID GdiSharedHandleTable;
PVOID ProcessStarterHelper;
ULONG GdiDCAttributeList;
PRTL_CRITICAL_SECTION LoaderLock;
ULONG OSMajorVersion;
ULONG OSMinorVersion;
WORD OSBuildNumber;
WORD OSCSDVersion;
ULONG OSPlatformId;
ULONG ImageSubsystem;
ULONG ImageSubsystemMajorVersion;
ULONG ImageSubsystemMinorVersion;
ULONG ImageProcessAffinityMask;
ULONG GdiHandleBuffer[34];
PVOID PostProcessInitRoutine;
PVOID TlsExpansionBitmap;
ULONG TlsExpansionBitmapBits[32];
ULONG SessionId;
ULARGE_INTEGER AppCompatFlags;
ULARGE_INTEGER AppCompatFlagsUser;
PVOID pShimData;
PVOID AppCompatInfo;
UNICODE_STRING CSDVersion;
PVOID* ActivationContextData;
PVOID* ProcessAssemblyStorageMap;
PVOID* SystemDefaultActivationContextData;
PVOID* SystemAssemblyStorageMap;
ULONG MinimumStackCommit;
PVOID* FlsCallback;
LIST_ENTRY FlsListHead;
PVOID FlsBitmap;
ULONG FlsBitmapBits[4];
ULONG FlsHighIndex;
PVOID WerRegistrationData;
PVOID WerShipAssertPtr;
} PEB, * PPEB;
struct _RTL_ACTIVATION_CONTEXT_STACK_FRAME;
typedef struct _RTL_ACTIVATION_CONTEXT_STACK_FRAME* PRTL_ACTIVATION_CONTEXT_STACK_FRAME;
typedef struct _RTL_ACTIVATION_CONTEXT_STACK_FRAME
{
PRTL_ACTIVATION_CONTEXT_STACK_FRAME Previous;
_ACTIVATION_CONTEXT* ActivationContext;
ULONG Flags;
} RTL_ACTIVATION_CONTEXT_STACK_FRAME, * PRTL_ACTIVATION_CONTEXT_STACK_FRAME;
typedef struct _ACTIVATION_CONTEXT_STACK
{
PRTL_ACTIVATION_CONTEXT_STACK_FRAME ActiveFrame;
LIST_ENTRY FrameListCache;
ULONG Flags;
ULONG NextCookieSequenceNumber;
ULONG StackId;
} ACTIVATION_CONTEXT_STACK, * PACTIVATION_CONTEXT_STACK;
typedef struct _GDI_TEB_BATCH
{
ULONG Offset;
ULONG HDC;
ULONG Buffer[310];
} GDI_TEB_BATCH, * PGDI_TEB_BATCH;
typedef struct _TEB_ACTIVE_FRAME_CONTEXT
{
ULONG Flags;
CHAR* FrameName;
} TEB_ACTIVE_FRAME_CONTEXT, * PTEB_ACTIVE_FRAME_CONTEXT;
struct _PTEB_ACTIVE_FRAME;
typedef struct _TEB_ACTIVE_FRAME* PTEB_ACTIVE_FRAME;
typedef struct _TEB_ACTIVE_FRAME
{
ULONG Flags;
PTEB_ACTIVE_FRAME Previous;
PTEB_ACTIVE_FRAME_CONTEXT Context;
} TEB_ACTIVE_FRAME, * PTEB_ACTIVE_FRAME;
typedef struct _LDR_DATA_TABLE_ENTRY
{
LIST_ENTRY InLoadOrderLinks;
LIST_ENTRY InMemoryOrderLinks;
LIST_ENTRY InInitializationOrderLinks;
PVOID DllBase;
PVOID EntryPoint;
ULONG SizeOfImage;
UNICODE_STRING FullDllName;
UNICODE_STRING BaseDllName;
ULONG Flags;
WORD LoadCount;
WORD TlsIndex;
union
{
LIST_ENTRY HashLinks;
struct
{
PVOID SectionPointer;
ULONG CheckSum;
};
};
union
{
ULONG TimeDateStamp;
PVOID LoadedImports;
};
_ACTIVATION_CONTEXT* EntryPointActivationContext;
PVOID PatchInformation;
LIST_ENTRY ForwarderLinks;
LIST_ENTRY ServiceTagLinks;
LIST_ENTRY StaticLinks;
} LDR_DATA_TABLE_ENTRY, * PLDR_DATA_TABLE_ENTRY;
typedef struct _TEB
{
NT_TIB NtTib;
PVOID EnvironmentPointer;
CLIENT_ID ClientId;
PVOID ActiveRpcHandle;
PVOID ThreadLocalStoragePointer;
PPEB ProcessEnvironmentBlock;
ULONG LastErrorValue;
ULONG CountOfOwnedCriticalSections;
PVOID CsrClientThread;
PVOID Win32ThreadInfo;
ULONG User32Reserved[26];
ULONG UserReserved[5];
PVOID WOW32Reserved;
ULONG CurrentLocale;
ULONG FpSoftwareStatusRegister;
VOID* SystemReserved1[54];
LONG ExceptionCode;
PACTIVATION_CONTEXT_STACK ActivationContextStackPointer;
UCHAR SpareBytes1[36];
ULONG TxFsContext;
GDI_TEB_BATCH GdiTebBatch;
CLIENT_ID RealClientId;
PVOID GdiCachedProcessHandle;
ULONG GdiClientPID;
ULONG GdiClientTID;
PVOID GdiThreadLocalInfo;
ULONG Win32ClientInfo[62];
VOID* glDispatchTable[233];
ULONG glReserved1[29];
PVOID glReserved2;
PVOID glSectionInfo;
PVOID glSection;
PVOID glTable;
PVOID glCurrentRC;
PVOID glContext;
ULONG LastStatusValue;
UNICODE_STRING StaticUnicodeString;
WCHAR StaticUnicodeBuffer[261];
PVOID DeallocationStack;
VOID* TlsSlots[64];
LIST_ENTRY TlsLinks;
PVOID Vdm;
PVOID ReservedForNtRpc;
VOID* DbgSsReserved[2];
ULONG HardErrorMode;
VOID* Instrumentation[9];
GUID ActivityId;
PVOID SubProcessTag;
PVOID EtwLocalData;
PVOID EtwTraceData;
PVOID WinSockData;
ULONG GdiBatchCount;
UCHAR SpareBool0;
UCHAR SpareBool1;
UCHAR SpareBool2;
UCHAR IdealProcessor;
ULONG GuaranteedStackBytes;
PVOID ReservedForPerf;
PVOID ReservedForOle;
ULONG WaitingOnLoaderLock;
PVOID SavedPriorityState;
ULONG SoftPatchPtr1;
PVOID ThreadPoolData;
VOID** TlsExpansionSlots;
ULONG ImpersonationLocale;
ULONG IsImpersonating;
PVOID NlsCache;
PVOID pShimData;
ULONG HeapVirtualAffinity;
PVOID CurrentTransactionHandle;
PTEB_ACTIVE_FRAME ActiveFrame;
PVOID FlsData;
PVOID PreferredLanguages;
PVOID UserPrefLanguages;
PVOID MergedPrefLanguages;
ULONG MuiImpersonation;
WORD CrossTebFlags;
ULONG SpareCrossTebBits : 16;
WORD SameTebFlags;
ULONG DbgSafeThunkCall : 1;
ULONG DbgInDebugPrint : 1;
ULONG DbgHasFiberData : 1;
ULONG DbgSkipThreadAttach : 1;
ULONG DbgWerInShipAssertCode : 1;
ULONG DbgRanProcessInit : 1;
ULONG DbgClonedThread : 1;
ULONG DbgSuppressDebugMsg : 1;
ULONG SpareSameTebBits : 8;
PVOID TxnScopeEnterCallback;
PVOID TxnScopeExitCallback;
PVOID TxnScopeContext;
ULONG LockCount;
ULONG ProcessRundown;
UINT64 LastSwitchTime;
UINT64 TotalSwitchOutTime;
LARGE_INTEGER WaitReasonBitMap;
} TEB, * PTEB;
typedef struct _THREAD_BASIC_INFORMATION {
NTSTATUS ExitStatus;
PTEB TebBaseAddress;
CLIENT_ID ClientId;
KAFFINITY AffinityMask;
KPRIORITY Priority;
KPRIORITY BasePriority;
} THREAD_BASIC_INFORMATION, * PTHREAD_BASIC_INFORMATION;
}
__forceinline
struct nt::_PEB*
NtCurrentPeb(
VOID
)
{
return ((struct nt::_TEB*)__readgsqword(FIELD_OFFSET(NT_TIB, Self)))->ProcessEnvironmentBlock;
}
#define EXPORT extern "C" __declspec(dllexport)
#define REBASE(x) (*(unsigned __int64*)((unsigned __int64)(NtCurrentTeb()->ProcessEnvironmentBlock) + 0x10) + (unsigned __int64)(x))
constexpr uint32_t fnv_base_32 = 0x4B9ACE2F;
inline uint32_t fnv1a(const char* key) {
const char* data = key;
uint32_t hash = 0x4B9ACE2F;
while (*data)
{
hash ^= *data;
hash *= 0x1000193;
data++;
}
hash *= 0x1000193; // bo3 wtf lol
return hash;
}
template <unsigned __int32 NUM>
struct canon_const_builtins
{
static const unsigned __int32 value = NUM;
};
constexpr unsigned __int32 fnv1a_const(const char* input)
{
const char* data = input;
uint32_t hash = 0x4B9ACE2F;
while (*data)
{
hash ^= *data;
hash *= 0x01000193;
data++;
}
hash *= 0x01000193; // bo3 wtf lol
return hash;
}
#define FNV32(x) canon_const_builtins<fnv1a_const(x)>::value
struct scr_vec3_t
{
float x;
float y;
float z;
scr_vec3_t operator+(scr_vec3_t const& obj)
{
return { x + obj.x, y + obj.y, z + obj.z };
}
scr_vec3_t operator-(scr_vec3_t const& obj)
{
return { x - obj.x, y - obj.y, z - obj.z };
}
scr_vec3_t operator*(float mp)
{
return { x + mp, y + mp, z + mp };
}
scr_vec3_t(float _x, float _y, float _z) : x(_x), y(_y), z(_z)
{
}
scr_vec3_t() : x(0), y(0), z(0)
{
}
};
enum errorCode : int32_t
{
ERROR_NONE = 0x0,
ERROR_FATAL = 0x1,
ERROR_DROP = 0x2,
ERROR_FROM_STARTUP = 0x4,
ERROR_SERVERDISCONNECT = 0x8,
ERROR_DISCONNECT = 0x10,
ERROR_SCRIPT = 0x20,
ERROR_SCRIPT_DROP = 0x40,
ERROR_LOCALIZATION = 0x80,
ERROR_UI = 0x100,
ERROR_LUA = 0x200,
ERROR_SOFTRESTART = 0x400,
ERROR_SOFTRESTART_KEEPDW = 0x800
};
enum MsgType
{
MESSAGE_TYPE_NONE = -1,
MESSAGE_TYPE_INFO_REQUEST = 0,
MESSAGE_TYPE_INFO_RESPONSE = 1,
MESSAGE_TYPE_LOBBY_STATE_PRIVATE = 2,
MESSAGE_TYPE_LOBBY_STATE_GAME = 3,
MESSAGE_TYPE_LOBBY_STATE_GAMEPUBLIC = 4,
MESSAGE_TYPE_LOBBY_STATE_GAMECUSTOM = 5,
MESSAGE_TYPE_LOBBY_STATE_GAMETHEATER = 6,
MESSAGE_TYPE_LOBBY_HOST_HEARTBEAT = 7,
MESSAGE_TYPE_LOBBY_HOST_DISCONNECT = 8,
MESSAGE_TYPE_LOBBY_HOST_DISCONNECT_CLIENT = 9,
MESSAGE_TYPE_LOBBY_HOST_LEAVE_WITH_PARTY = 0xA,
MESSAGE_TYPE_LOBBY_CLIENT_HEARTBEAT = 0xB,
MESSAGE_TYPE_LOBBY_CLIENT_DISCONNECT = 0xC,
MESSAGE_TYPE_LOBBY_CLIENT_RELIABLE_DATA = 0xD,
MESSAGE_TYPE_LOBBY_CLIENT_CONTENT = 0xE,
MESSAGE_TYPE_LOBBY_MODIFIED_STATS = 0xF,
MESSAGE_TYPE_JOIN_LOBBY = 0x10,
MESSAGE_TYPE_JOIN_RESPONSE = 0x11,
MESSAGE_TYPE_JOIN_AGREEMENT_REQUEST = 0x12,
MESSAGE_TYPE_JOIN_AGREEMENT_RESPONSE = 0x13,
MESSAGE_TYPE_JOIN_COMPLETE = 0x14,
MESSAGE_TYPE_JOIN_MEMBER_INFO = 0x15,
MESSAGE_TYPE_SERVERLIST_INFO = 0x16,
MESSAGE_TYPE_PEER_TO_PEER_CONNECTIVITY_TEST = 0x17,
MESSAGE_TYPE_PEER_TO_PEER_INFO = 0x18,
MESSAGE_TYPE_LOBBY_MIGRATE_TEST = 0x19,
MESSAGE_TYPE_MIGRATE_ANNOUNCE_HOST = 0x1A,
MESSAGE_TYPE_MIGRATE_START = 0x1B,
MESSAGE_TYPE_INGAME_MIGRATE_TO = 0x1C,
MESSAGE_TYPE_MIGRATE_NEW_HOST = 0x1D,
MESSAGE_TYPE_VOICE_PACKET = 0x1E,
MESSAGE_TYPE_VOICE_RELAY_PACKET = 0x1F,
MESSAGE_TYPE_DEMO_STATE = 0x20,
MESSAGE_TYPE_COUNT = MESSAGE_TYPE_DEMO_STATE + 1
};
enum AssetPool
{
xasset_physpreset,
xasset_physconstraints,
xasset_destructibledef,
xasset_xanim,
xasset_xmodel,
xasset_xmodelmesh,
xasset_material,
xasset_computeshaderset,
xasset_techset,
xasset_image,
xasset_sound,
xasset_sound_patch,
xasset_col_map,
xasset_com_map,
xasset_game_map,
xasset_map_ents,
xasset_gfx_map,
xasset_lightdef,
xasset_lensflaredef,
xasset_ui_map,
xasset_font,
xasset_fonticon,
xasset_localize,
xasset_weapon,
xasset_weapondef,
xasset_weaponvariant,
xasset_weaponfull,
xasset_cgmediatable,
xasset_playersoundstable,
xasset_playerfxtable,
xasset_sharedweaponsounds,
xasset_attachment,
xasset_attachmentunique,
xasset_weaponcamo,
xasset_customizationtable,
xasset_customizationtable_feimages,
xasset_customizationtablecolor,
xasset_snddriverglobals,
xasset_fx,
xasset_tagfx,
xasset_klf,
xasset_impactsfxtable,
xasset_impactsoundstable,
xasset_player_character,
xasset_aitype,
xasset_character,
xasset_xmodelalias,
xasset_rawfile,
xasset_stringtable,
xasset_structuredtable,
xasset_leaderboarddef,
xasset_ddl,
xasset_glasses,
xasset_texturelist,
xasset_scriptparsetree,
xasset_keyvaluepairs,
xasset_vehicle,
xasset_addon_map_ents,
xasset_tracer,
xasset_slug,
xasset_surfacefxtable,
xasset_surfacesounddef,
xasset_footsteptable,
xasset_entityfximpacts,
xasset_entitysoundimpacts,
xasset_zbarrier,
xasset_vehiclefxdef,
xasset_vehiclesounddef,
xasset_typeinfo,
xasset_scriptbundle,
xasset_scriptbundlelist,
xasset_rumble,
xasset_bulletpenetration,
xasset_locdmgtable,
xasset_aimtable,
xasset_animselectortable,
xasset_animmappingtable,
xasset_animstatemachine,
xasset_behaviortree,
xasset_behaviorstatemachine,
xasset_ttf,
xasset_sanim,
xasset_lightdescription,
xasset_shellshock,
xasset_xcam,
xasset_bgcache,
xasset_texturecombo,
xasset_flametable,
xasset_bitfield,
xasset_attachmentcosmeticvariant,
xasset_maptable,
xasset_maptableloadingimages,
xasset_medal,
xasset_medaltable,
xasset_objective,
xasset_objectivelist,
xasset_umbra_tome,
xasset_navmesh,
xasset_navvolume,
xasset_binaryhtml,
xasset_laser,
xasset_beam,
xasset_streamerhint,
xasset__string,
xasset_assetlist,
xasset_report,
xasset_depend
};
enum netsrc_t
{
NS_NULL = -1,
NS_CLIENT1 = 0,
NS_CLIENT2 = 1,
NS_CLIENT3 = 2,
NS_CLIENT4 = 3,
NS_SERVER = 4,
NS_MAXCLIENTS = 4,
NS_PACKET = 5
};
enum netadrtype_t
{
NA_BOT = 0x0,
NA_BAD = 0x1,
NA_LOOPBACK = 0x2,
NA_RAWIP = 0x3,
NA_IP = 0x4,
};
enum LobbyType
{
LOBBY_TYPE_INVALID = 0xFFFFFFFF,
LOBBY_TYPE_PRIVATE = 0x0,
LOBBY_TYPE_GAME = 0x1,
LOBBY_TYPE_TRANSITION = 0x2,
LOBBY_TYPE_COUNT = 0x3,
LOBBY_TYPE_FIRST = 0x0,
LOBBY_TYPE_LAST = 0x2,
LOBBY_TYPE_AUTO = 0x3,
};
enum LobbyModule
{
LOBBY_MODULE_INVALID = 0xFFFFFFFF,
LOBBY_MODULE_HOST = 0x0,
LOBBY_MODULE_CLIENT = 0x1,
LOBBY_MODULE_PEER_TO_PEER = 0x3,
LOBBY_MODULE_COUNT = 0x4,
};
enum LobbyMode
{
LOBBY_MODE_INVALID = 0xFFFFFFFF,
LOBBY_MODE_PUBLIC = 0x0,
LOBBY_MODE_CUSTOM = 0x1,
LOBBY_MODE_THEATER = 0x2,
LOBBY_MODE_ARENA = 0x3,
LOBBY_MODE_FREERUN = 0x4,
LOBBY_MODE_COUNT = 0x5,
};
enum SessionActive
{
SESSION_INACTIVE = 0x0,
SESSION_KEEP_ALIVE = 0x1,
SESSION_ACTIVE = 0x2,
};
typedef uint64_t XUID;
// notes:
// ugcinfo struct on steam is 0x4C8
// on wstor is 0x4BC (-0xC)
struct ugcinfo_entry_steam // 0x4C8
{
char pad[0x4C8];
// name: 0x0 (0x64)
// internalName: 0x64 (
// description: 0xA4
// ugcName: 0x84
// ugcVersion: ??
};
#define WORKSHOP_MAX_ENTRIES 128
struct ugcinfo_steam
{
uint32_t num_entries;
uint32_t unk4;
ugcinfo_entry_steam entries[WORKSHOP_MAX_ENTRIES];
};
struct ugcinfo_entry_wstor // 0x4BC
{
char name[0x64];
char internalName[0x20]; // 64
char ugcName[0x20]; // 84
char description[0x100]; // A4
char ugcPathBasic[0x104]; // 1A4
char ugcRoot[0x104]; // 2A8
char ugcPath[0x104]; // 3AC
uint32_t unk_4B0;
uint32_t hash_id; // 4B4
uint32_t unk_4B8;
};
struct ugcinfo_wstor
{
uint32_t num_entries;
ugcinfo_entry_wstor entries[WORKSHOP_MAX_ENTRIES];
};
struct netadr_t
{
uint8_t ipv4[4];
uint16_t port;
uint16_t pad;
netadrtype_t type;
netsrc_t localNetID;
};
struct msg_t
{
uint8_t overflowed; // 0x0
uint8_t readOnly; // 0x1
uint16_t pad1; // 0x2
uint32_t pad2; // 0x4
char* data; // 0x8
char* splitData; // 0x10
uint32_t maxsize; // 0x18
uint32_t cursize; // 0x1C
uint32_t splitSize; // 0x20
uint32_t readcount; // 0x24
uint32_t bit; // 0x28
uint32_t lastEntityRef; // 0x2C
uint32_t flush; // 0x30
netsrc_t targetLocalNetID; // 0x34
};
struct LobbyMsg
{
msg_t msg;
MsgType msgType; // 0x38
char encodeFlags;
uint32_t packageType;
};
struct bdSecurityID
{
uint64_t id;
};
struct bdSecurityKey
{
uint8_t ab[16];
};
struct SerializedAdr
{
uint8_t valid;
uint8_t addrBuf[37];
};
struct LobbyParams
{
uint32_t networkMode;
uint32_t mainMode;
};
struct InfoResponseLobby
{
uint8_t isValid; // 0x0
uint8_t pad[3];
uint32_t pad2;
XUID hostXuid; // 0x8
char hostName[0x20]; // 0x10
bdSecurityID secId; // 0x30
bdSecurityKey secKey; // 0x38
SerializedAdr serializedAdr; // 0x48
uint8_t pad3[2]; // 0x6E
LobbyParams lobbyParams; // 0x70
char ugcName[0x20]; // 0x78
uint32_t ugcVersion; // 0x98
uint8_t pad4[0x4]; // 0x9C
};
struct Msg_InfoResponse
{
uint32_t nonce;
uint32_t uiScreen;
uint8_t natType;
uint8_t pad[3];
uint32_t pad2;
InfoResponseLobby lobby[2];
};
struct LobbySession
{
LobbyModule module;
LobbyType type;
LobbyMode mode;
char pad[0x34];
SessionActive active;
char pad2[0x121D4];
};
struct FixedClientInfo
{
XUID xuid;
char gamertag[32];
};
struct SessionInfo
{
char inSession;
char pad[3];
netadr_t netAdr;
time_t lastMessageSentToPeer;
};