fix line endings and tabs

This commit is contained in:
ineed bots
2023-09-01 10:50:11 -06:00
parent b17a56a7fd
commit bb216441bf
40 changed files with 22114 additions and 22115 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,206 +1,206 @@
#include <stdinc.hpp>
#include <utils/hook.hpp>
#include <utils/memory.hpp>
#include <utils/string.hpp>
namespace game
{
gamemode current = reinterpret_cast<const char*>(0x88A5DC) != "CoDWaW.exe"s
? gamemode::multiplayer
: gamemode::singleplayer;
namespace environment
{
bool t4mp()
{
return current == gamemode::multiplayer;
}
bool t4sp()
{
return current == gamemode::singleplayer;
}
}
// HunkUser* __usercall Hunk_UserCreate@<eax>(signed int maxSize@<edi>, char* name, char fixed, char tempMem, char debugMem, int type);
HunkUser* Hunk_UserCreate(signed int maxSize, const char* name, int fixed, int tempMem, int debugMem, int typ, void* call_addr)
{
HunkUser* answer;
__asm
{
push typ;
push debugMem;
push tempMem;
push fixed;
push name;
mov edi, maxSize;
call call_addr;
add esp, 0x14;
mov answer, eax;
}
return answer;
}
// unsigned int __usercall Hunk_AllocateTempMemoryHigh@<eax>(int a1@<eax>)
unsigned int Hunk_AllocateTempMemoryHigh(int size_, void* call_addr)
{
unsigned int answer;
__asm
{
mov eax, size_;
call call_addr;
mov answer, eax;
}
return answer;
}
// void __usercall FS_FCloseFile(int h@<eax>)
void FS_FCloseFile(int h, void* call_addr)
{
__asm
{
mov eax, h;
call call_addr;
}
}
// void *__usercall Z_TryVirtualAlloc@<eax>(signed int a1@<edi>)
void* Z_TryVirtualAlloc(signed int size_, void* call_addr)
{
void* answer;
__asm
{
mov edi, size_;
call call_addr;
mov answer, eax;
}
return answer;
}
// int __usercall I_stricmp@<eax>(int a1@<eax>, CHAR *a2@<edx>, const char *a3)
int I_stricmp(int len, const char* s0, const char* s1, void* call_addr)
{
int answer;
__asm
{
push s1;
mov eax, len;
mov edx, s0;
call call_addr;
mov answer, eax;
add esp, 0x4;
}
return answer;
}
//parseInfo_t* __usercall Com_Parse@<eax>(const char** a1@<esi>)
parseInfo_t* Com_Parse(const char** buffer, void* call_addr)
{
parseInfo_t* answer;
__asm
{
mov esi, buffer;
call call_addr;
mov answer, eax;
}
return answer;
}
//int __usercall I_strncmp@<eax>(char *str1@<edx>, char *str2@<ecx>, int len)
int I_strncmp(const char* str1, const char* str2, int len, void* call_addr)
{
int answer;
__asm
{
push len;
mov ecx, str2;
mov edx, str1;
call call_addr;
mov answer, eax;
}
return answer;
}
// const char **__usercall FS_ListFilteredFiles@<eax>(searchpath_s *searchPath@<eax>, const char *path@<edx>, const char *extension, const char *filter, FsListBehavior_e behavior, int *numFiles)
const char** FS_ListFilteredFiles(searchpath_s* searchPath, const char* path, const char* extension, const char* filter, FsListBehavior_e behavior, int* numFiles, void* call_addr)
{
const char** answer;
__asm
{
push numFiles;
push behavior;
push filter;
push extension;
mov eax, searchPath;
mov edx, path;
call call_addr;
mov answer, eax;
add esp, 0x10;
}
return answer;
}
dvar_s * Dvar_RegisterBool/*@<eax>*/(unsigned __int8 val/*@<al>*/, const char * name/*@<edi>*/, int flags, const char * desc, void* call_addr)
{
dvar_s * answer;
__asm
{
push desc;
push flags;
mov al, val;
mov edi, name;
call call_addr;
mov answer, eax;
add esp, 0x8;
}
return answer;
}
const char * XAnimGetAnimDebugName/*@<eax>*/(unsigned int animIndex/*@<ecx>*/, XAnim_s * anims/*@<edx>*/, void* call_addr)
{
const char * answer;
__asm
{
mov ecx, animIndex;
mov edx, anims;
call call_addr;
mov answer, eax;
}
return answer;
}
// restored
void Sys_EnterCriticalSection(CriticalSection critSect)
{
EnterCriticalSection(&s_criticalSection[critSect]);
}
// restored
void Sys_LeaveCriticalSection(CriticalSection critSect)
{
LeaveCriticalSection(&s_criticalSection[critSect]);
}
namespace plutonium
{
}
}
#include <stdinc.hpp>
#include <utils/hook.hpp>
#include <utils/memory.hpp>
#include <utils/string.hpp>
namespace game
{
gamemode current = reinterpret_cast<const char*>(0x88A5DC) != "CoDWaW.exe"s
? gamemode::multiplayer
: gamemode::singleplayer;
namespace environment
{
bool t4mp()
{
return current == gamemode::multiplayer;
}
bool t4sp()
{
return current == gamemode::singleplayer;
}
}
// HunkUser* __usercall Hunk_UserCreate@<eax>(signed int maxSize@<edi>, char* name, char fixed, char tempMem, char debugMem, int type);
HunkUser* Hunk_UserCreate(signed int maxSize, const char* name, int fixed, int tempMem, int debugMem, int typ, void* call_addr)
{
HunkUser* answer;
__asm
{
push typ;
push debugMem;
push tempMem;
push fixed;
push name;
mov edi, maxSize;
call call_addr;
add esp, 0x14;
mov answer, eax;
}
return answer;
}
// unsigned int __usercall Hunk_AllocateTempMemoryHigh@<eax>(int a1@<eax>)
unsigned int Hunk_AllocateTempMemoryHigh(int size_, void* call_addr)
{
unsigned int answer;
__asm
{
mov eax, size_;
call call_addr;
mov answer, eax;
}
return answer;
}
// void __usercall FS_FCloseFile(int h@<eax>)
void FS_FCloseFile(int h, void* call_addr)
{
__asm
{
mov eax, h;
call call_addr;
}
}
// void *__usercall Z_TryVirtualAlloc@<eax>(signed int a1@<edi>)
void* Z_TryVirtualAlloc(signed int size_, void* call_addr)
{
void* answer;
__asm
{
mov edi, size_;
call call_addr;
mov answer, eax;
}
return answer;
}
// int __usercall I_stricmp@<eax>(int a1@<eax>, CHAR *a2@<edx>, const char *a3)
int I_stricmp(int len, const char* s0, const char* s1, void* call_addr)
{
int answer;
__asm
{
push s1;
mov eax, len;
mov edx, s0;
call call_addr;
mov answer, eax;
add esp, 0x4;
}
return answer;
}
//parseInfo_t* __usercall Com_Parse@<eax>(const char** a1@<esi>)
parseInfo_t* Com_Parse(const char** buffer, void* call_addr)
{
parseInfo_t* answer;
__asm
{
mov esi, buffer;
call call_addr;
mov answer, eax;
}
return answer;
}
//int __usercall I_strncmp@<eax>(char *str1@<edx>, char *str2@<ecx>, int len)
int I_strncmp(const char* str1, const char* str2, int len, void* call_addr)
{
int answer;
__asm
{
push len;
mov ecx, str2;
mov edx, str1;
call call_addr;
mov answer, eax;
}
return answer;
}
// const char **__usercall FS_ListFilteredFiles@<eax>(searchpath_s *searchPath@<eax>, const char *path@<edx>, const char *extension, const char *filter, FsListBehavior_e behavior, int *numFiles)
const char** FS_ListFilteredFiles(searchpath_s* searchPath, const char* path, const char* extension, const char* filter, FsListBehavior_e behavior, int* numFiles, void* call_addr)
{
const char** answer;
__asm
{
push numFiles;
push behavior;
push filter;
push extension;
mov eax, searchPath;
mov edx, path;
call call_addr;
mov answer, eax;
add esp, 0x10;
}
return answer;
}
dvar_s * Dvar_RegisterBool/*@<eax>*/(unsigned __int8 val/*@<al>*/, const char * name/*@<edi>*/, int flags, const char * desc, void* call_addr)
{
dvar_s * answer;
__asm
{
push desc;
push flags;
mov al, val;
mov edi, name;
call call_addr;
mov answer, eax;
add esp, 0x8;
}
return answer;
}
const char * XAnimGetAnimDebugName/*@<eax>*/(unsigned int animIndex/*@<ecx>*/, XAnim_s * anims/*@<edx>*/, void* call_addr)
{
const char * answer;
__asm
{
mov ecx, animIndex;
mov edx, anims;
call call_addr;
mov answer, eax;
}
return answer;
}
// restored
void Sys_EnterCriticalSection(CriticalSection critSect)
{
EnterCriticalSection(&s_criticalSection[critSect]);
}
// restored
void Sys_LeaveCriticalSection(CriticalSection critSect)
{
LeaveCriticalSection(&s_criticalSection[critSect]);
}
namespace plutonium
{
}
}

View File

@ -1,70 +1,70 @@
#pragma once
#define WEAK __declspec(selectany)
#define NAKED __declspec(naked)
#define SELECT(mp, sp) (game::environment::t4mp() ? mp : sp)
#define ASSIGN(type, mp, sp) reinterpret_cast<type>(SELECT(mp, sp))
#define CALL_ADDR(mp, sp) ASSIGN(void*, mp, sp)
#define ARRAY_COUNT(arrayn) \
((sizeof(arrayn)) / (sizeof(arrayn[0])))
namespace game
{
enum gamemode
{
multiplayer,
singleplayer,
none
};
extern gamemode current;
namespace environment
{
bool t4mp();
bool t4sp();
}
template <typename T>
class symbol
{
public:
symbol(const size_t t4mp, const size_t t4sp)
: t4mp_(reinterpret_cast<T*>(t4mp))
, t4sp_(reinterpret_cast<T*>(t4sp))
{
}
T* get() const
{
if (environment::t4mp())
{
return t4mp_;
}
return t4sp_;
}
void set(const size_t ptr)
{
this->t4mp_ = reinterpret_cast<T*>(ptr);
this->t4sp_ = reinterpret_cast<T*>(ptr);
}
operator T* () const
{
return this->get();
}
T* operator->() const
{
return this->get();
}
private:
T* t4mp_;
T* t4sp_;
};
}
#pragma once
#define WEAK __declspec(selectany)
#define NAKED __declspec(naked)
#define SELECT(mp, sp) (game::environment::t4mp() ? mp : sp)
#define ASSIGN(type, mp, sp) reinterpret_cast<type>(SELECT(mp, sp))
#define CALL_ADDR(mp, sp) ASSIGN(void*, mp, sp)
#define ARRAY_COUNT(arrayn) \
((sizeof(arrayn)) / (sizeof(arrayn[0])))
namespace game
{
enum gamemode
{
multiplayer,
singleplayer,
none
};
extern gamemode current;
namespace environment
{
bool t4mp();
bool t4sp();
}
template <typename T>
class symbol
{
public:
symbol(const size_t t4mp, const size_t t4sp)
: t4mp_(reinterpret_cast<T*>(t4mp))
, t4sp_(reinterpret_cast<T*>(t4sp))
{
}
T* get() const
{
if (environment::t4mp())
{
return t4mp_;
}
return t4sp_;
}
void set(const size_t ptr)
{
this->t4mp_ = reinterpret_cast<T*>(ptr);
this->t4sp_ = reinterpret_cast<T*>(ptr);
}
operator T* () const
{
return this->get();
}
T* operator->() const
{
return this->get();
}
private:
T* t4mp_;
T* t4sp_;
};
}

File diff suppressed because it is too large Load Diff

View File

@ -1,77 +1,77 @@
#pragma once
namespace game
{
// Functions
WEAK symbol<void(con_channel_e channel, const char* fmt, ...)> Com_Printf{ 0x0, 0x59A2C0 };
WEAK symbol<void(con_channel_e a1, const char* Source, int a3)>Com_PrintMessage{ 0x0, 0x59A170 };
WEAK symbol<void(con_channel_e a1, const char* Format, ...)>Com_PrintWarning{ 0x0, 0x59A440 };
WEAK symbol<void(con_channel_e a1, const char* Format, ...)>Com_PrintError{ 0x0, 0x59A380 };
WEAK symbol<void(errorParm_t a1, const char* Format, ...)>Com_Error{ 0x0, 0x59AC50 };
WEAK symbol<void(const char* Format, ...)>Sys_Error{ 0x0, 0x5FE8C0 };
WEAK symbol<void(HunkUser *user)>Hunk_UserDestroy{ 0x0, 0x5E4940 };
WEAK symbol<void *(HunkUser *user, int size, int alignment)> Hunk_UserAlloc{ 0x0, 0x5E47B0 };
WEAK symbol<void()> Hunk_ClearTempMemoryHigh{ 0x0, 0x5E4300 };
WEAK symbol<int(const char* filename, int* file)>FS_FOpenFileRead{ 0x0, 0x5DBD20 };
WEAK symbol<int(char* Buffer, size_t ElementCount, int a3)>FS_Read{ 0x0, 0x5DBDF0 };
WEAK symbol<int(const char* filename, int* file, fsMode_t mode)>FS_FOpenFileByMode{ 0x0, 0x5DB630 };
WEAK symbol<const char*(const char* Format, ...)>va{ 0x0, 0x5F6D80 };
WEAK symbol<parseInfo_t* (const char* ArgList)>Com_BeginParseSession{ 0x0, 0x5F5830 };
WEAK symbol<void()> Com_EndParseSession{ 0x0, 0x5F5910 };
WEAK symbol<int()> Sys_Milliseconds{ 0x0, 0x603D40 };
WEAK symbol<void(char* Destination, const char* Source, size_t Count)>I_strncpyz{ 0x0, 0x7AA9C0 };
inline void* I_strncmp_ADDR() { return CALL_ADDR(0x0, 0x5F6A40); }
int I_strncmp(const char* str1, const char* str2, int len, void* call_addr = I_strncmp_ADDR());
inline void* Hunk_UserCreate_ADDR() { return CALL_ADDR(0x0, 0x5E46E0); }
HunkUser* Hunk_UserCreate(signed int maxSize, const char* name, int fixed, int tempMem, int debugMem, int type, void* call_addr = Hunk_UserCreate_ADDR());
inline void* Hunk_AllocateTempMemoryHigh_ADDR() { return CALL_ADDR(0x0, 0x5E4220); }
unsigned int Hunk_AllocateTempMemoryHigh(int size_, void* call_addr = Hunk_AllocateTempMemoryHigh_ADDR());
inline void* FS_FCloseFile_ADDR() { return CALL_ADDR(0x0, 0x5DB060); }
void FS_FCloseFile(int h, void* call_addr = FS_FCloseFile_ADDR());
inline void* FS_ListFilteredFiles_ADDR() { return CALL_ADDR(0x0, 0x5DC720); }
const char** FS_ListFilteredFiles(searchpath_s* searchPath, const char* path, const char* extension, const char* filter, FsListBehavior_e behavior, int* numFiles, void* call_addr = FS_ListFilteredFiles_ADDR());
inline void* Z_TryVirtualAlloc_ADDR() { return CALL_ADDR(0x0, 0x5E39D0); }
void* Z_TryVirtualAlloc(signed int size_, void* call_addr = Z_TryVirtualAlloc_ADDR());
inline void* I_stricmp_ADDR() { return CALL_ADDR(0x0, 0x5F69E0); }
int I_stricmp(int len, const char* s0, const char* s1, void* call_addr = I_stricmp_ADDR());
inline void* Com_Parse_ADDR() { return CALL_ADDR(0x0, 0x5F61B0); }
parseInfo_t* Com_Parse(const char** buffer, void* call_addr = Com_Parse_ADDR());
inline void* Dvar_RegisterBool_ADDR() { return CALL_ADDR(0x0, 0x5EEE20); }
dvar_s * Dvar_RegisterBool(unsigned __int8 val, const char * name, int flags, const char * desc, void* call_addr = Dvar_RegisterBool_ADDR());
inline void* XAnimGetAnimDebugName_ADDR() { return CALL_ADDR(0x0, 0x60F850); }
const char * XAnimGetAnimDebugName(unsigned int animIndex, XAnim_s * anims, void* call_addr = XAnimGetAnimDebugName_ADDR());
void Sys_EnterCriticalSection(CriticalSection critSect);
void Sys_LeaveCriticalSection(CriticalSection critSect);
// Variables
WEAK symbol<CRITICAL_SECTION> s_criticalSection{ 0x0, 0x2298D08 };
WEAK symbol<HunkUser*> g_DebugHunkUser{ 0x0, 0x212B2EC };
WEAK symbol<dvar_s*> useFastFile{ 0x0, 0x1F552FC };
WEAK symbol<fileHandleData_t> fsh{ 0x0, 0x2126E20 };
WEAK symbol<dvar_s*> fs_game{ 0x0, 0x2122B00 };
WEAK symbol<dvar_s*> com_developer{ 0x0, 0x1F55288 };
WEAK symbol<int> statmon_related_bool{ 0x0, 0x2122B04 };
WEAK symbol<HunkUser*> g_allocNodeUser{ 0x0, 0x3882B20 };
WEAK symbol<struct HunkUser *> g_user{ 0x0, 0x3882B48 };
WEAK symbol<searchpath_s*> fs_searchpaths{ 0x0, 0x46E5044 };
namespace plutonium
{
WEAK symbol<int(const char* fmt, ...)> printf{0x0, 0x0};
WEAK symbol<void(scriptInstance_t)> load_custom_script_func{0x0, 0x0};
}
}
#pragma once
namespace game
{
// Functions
WEAK symbol<void(con_channel_e channel, const char* fmt, ...)> Com_Printf{ 0x0, 0x59A2C0 };
WEAK symbol<void(con_channel_e a1, const char* Source, int a3)>Com_PrintMessage{ 0x0, 0x59A170 };
WEAK symbol<void(con_channel_e a1, const char* Format, ...)>Com_PrintWarning{ 0x0, 0x59A440 };
WEAK symbol<void(con_channel_e a1, const char* Format, ...)>Com_PrintError{ 0x0, 0x59A380 };
WEAK symbol<void(errorParm_t a1, const char* Format, ...)>Com_Error{ 0x0, 0x59AC50 };
WEAK symbol<void(const char* Format, ...)>Sys_Error{ 0x0, 0x5FE8C0 };
WEAK symbol<void(HunkUser *user)>Hunk_UserDestroy{ 0x0, 0x5E4940 };
WEAK symbol<void *(HunkUser *user, int size, int alignment)> Hunk_UserAlloc{ 0x0, 0x5E47B0 };
WEAK symbol<void()> Hunk_ClearTempMemoryHigh{ 0x0, 0x5E4300 };
WEAK symbol<int(const char* filename, int* file)>FS_FOpenFileRead{ 0x0, 0x5DBD20 };
WEAK symbol<int(char* Buffer, size_t ElementCount, int a3)>FS_Read{ 0x0, 0x5DBDF0 };
WEAK symbol<int(const char* filename, int* file, fsMode_t mode)>FS_FOpenFileByMode{ 0x0, 0x5DB630 };
WEAK symbol<const char*(const char* Format, ...)>va{ 0x0, 0x5F6D80 };
WEAK symbol<parseInfo_t* (const char* ArgList)>Com_BeginParseSession{ 0x0, 0x5F5830 };
WEAK symbol<void()> Com_EndParseSession{ 0x0, 0x5F5910 };
WEAK symbol<int()> Sys_Milliseconds{ 0x0, 0x603D40 };
WEAK symbol<void(char* Destination, const char* Source, size_t Count)>I_strncpyz{ 0x0, 0x7AA9C0 };
inline void* I_strncmp_ADDR() { return CALL_ADDR(0x0, 0x5F6A40); }
int I_strncmp(const char* str1, const char* str2, int len, void* call_addr = I_strncmp_ADDR());
inline void* Hunk_UserCreate_ADDR() { return CALL_ADDR(0x0, 0x5E46E0); }
HunkUser* Hunk_UserCreate(signed int maxSize, const char* name, int fixed, int tempMem, int debugMem, int type, void* call_addr = Hunk_UserCreate_ADDR());
inline void* Hunk_AllocateTempMemoryHigh_ADDR() { return CALL_ADDR(0x0, 0x5E4220); }
unsigned int Hunk_AllocateTempMemoryHigh(int size_, void* call_addr = Hunk_AllocateTempMemoryHigh_ADDR());
inline void* FS_FCloseFile_ADDR() { return CALL_ADDR(0x0, 0x5DB060); }
void FS_FCloseFile(int h, void* call_addr = FS_FCloseFile_ADDR());
inline void* FS_ListFilteredFiles_ADDR() { return CALL_ADDR(0x0, 0x5DC720); }
const char** FS_ListFilteredFiles(searchpath_s* searchPath, const char* path, const char* extension, const char* filter, FsListBehavior_e behavior, int* numFiles, void* call_addr = FS_ListFilteredFiles_ADDR());
inline void* Z_TryVirtualAlloc_ADDR() { return CALL_ADDR(0x0, 0x5E39D0); }
void* Z_TryVirtualAlloc(signed int size_, void* call_addr = Z_TryVirtualAlloc_ADDR());
inline void* I_stricmp_ADDR() { return CALL_ADDR(0x0, 0x5F69E0); }
int I_stricmp(int len, const char* s0, const char* s1, void* call_addr = I_stricmp_ADDR());
inline void* Com_Parse_ADDR() { return CALL_ADDR(0x0, 0x5F61B0); }
parseInfo_t* Com_Parse(const char** buffer, void* call_addr = Com_Parse_ADDR());
inline void* Dvar_RegisterBool_ADDR() { return CALL_ADDR(0x0, 0x5EEE20); }
dvar_s * Dvar_RegisterBool(unsigned __int8 val, const char * name, int flags, const char * desc, void* call_addr = Dvar_RegisterBool_ADDR());
inline void* XAnimGetAnimDebugName_ADDR() { return CALL_ADDR(0x0, 0x60F850); }
const char * XAnimGetAnimDebugName(unsigned int animIndex, XAnim_s * anims, void* call_addr = XAnimGetAnimDebugName_ADDR());
void Sys_EnterCriticalSection(CriticalSection critSect);
void Sys_LeaveCriticalSection(CriticalSection critSect);
// Variables
WEAK symbol<CRITICAL_SECTION> s_criticalSection{ 0x0, 0x2298D08 };
WEAK symbol<HunkUser*> g_DebugHunkUser{ 0x0, 0x212B2EC };
WEAK symbol<dvar_s*> useFastFile{ 0x0, 0x1F552FC };
WEAK symbol<fileHandleData_t> fsh{ 0x0, 0x2126E20 };
WEAK symbol<dvar_s*> fs_game{ 0x0, 0x2122B00 };
WEAK symbol<dvar_s*> com_developer{ 0x0, 0x1F55288 };
WEAK symbol<int> statmon_related_bool{ 0x0, 0x2122B04 };
WEAK symbol<HunkUser*> g_allocNodeUser{ 0x0, 0x3882B20 };
WEAK symbol<struct HunkUser *> g_user{ 0x0, 0x3882B48 };
WEAK symbol<searchpath_s*> fs_searchpaths{ 0x0, 0x46E5044 };
namespace plutonium
{
WEAK symbol<int(const char* fmt, ...)> printf{0x0, 0x0};
WEAK symbol<void(scriptInstance_t)> load_custom_script_func{0x0, 0x0};
}
}