Merge branch 'main' of https://github.com/ProjectDonetsk/Defcon
This commit is contained in:
commit
d1bcdaa4e3
11
README.md
11
README.md
@ -1,7 +1,8 @@
|
||||
# Defcon
|
||||
Call of Duty: Black Ops Cold War - Reimagined <br>
|
||||
Call of Duty: Black Ops Cold War - Reimagined
|
||||
|
||||
Credits: <br>
|
||||
CODuploader for the original source <br>
|
||||
.r4v3n for improving upon the source <br>
|
||||
Sku-111 for reversing .r4v3n's source and releasing it
|
||||
|
||||
## Credits
|
||||
- `CODuploader` - the original source.
|
||||
- `.r4v3n` - for improving upon the source.
|
||||
- `Sku-111` - for reversing `.r4v3n's` source and releasing it.
|
||||
|
@ -1,574 +1,65 @@
|
||||
#include "Main.hpp"
|
||||
#include <tlhelp32.h>
|
||||
|
||||
void* exception_handler;
|
||||
bool IsProcessRunning(const char* processName)
|
||||
{
|
||||
HANDLE hProcessSnap;
|
||||
PROCESSENTRY32 pe32;
|
||||
hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
||||
if (hProcessSnap == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
pe32.dwSize = sizeof(PROCESSENTRY32);
|
||||
|
||||
if (!Process32First(hProcessSnap, &pe32))
|
||||
{
|
||||
CloseHandle(hProcessSnap);
|
||||
return false;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if(strcmp(processName, pe32.szExeFile) == 0)
|
||||
{
|
||||
CloseHandle(hProcessSnap);
|
||||
return true;
|
||||
}
|
||||
} while (Process32Next(hProcessSnap, &pe32));
|
||||
|
||||
CloseHandle(hProcessSnap);
|
||||
return false;
|
||||
}
|
||||
|
||||
void backtrace(const char * func) {
|
||||
const int trace_count = 15;
|
||||
void* trace_back[trace_count];
|
||||
DWORD hash;
|
||||
RtlCaptureStackBackTrace(1, trace_count, trace_back, &hash);
|
||||
log(("%s callstack: "), func);
|
||||
printf(("%s callstack: "), func);
|
||||
for (int i = 0; i < trace_count; i++) {
|
||||
if (i == trace_count - 1) {
|
||||
log(("%p\n"), (uintptr_t)trace_back[i]);
|
||||
printf(("%p\n"), (uintptr_t)trace_back[i]);
|
||||
}
|
||||
else {
|
||||
|
||||
log(("%p:"), (uintptr_t)trace_back[i]);
|
||||
printf(("%p:"), (uintptr_t)trace_back[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int error_hashes_191[535] = {
|
||||
0x18D39B2A,
|
||||
0x72480D77,
|
||||
0x8D338662,
|
||||
0x5150B5A1,
|
||||
0xB4CF7CC4,
|
||||
0xA961BF7A,
|
||||
0xE41683A3,
|
||||
0x83004B05,
|
||||
0x1AA32246,
|
||||
0x390AAADB,
|
||||
0x20A69F48,
|
||||
0xBD84F758,
|
||||
0x17233425,
|
||||
0x9EF4CC77,
|
||||
0xDD9C956A,
|
||||
0x7DE83118,
|
||||
0xCB7EF283,
|
||||
0xB056B62F,
|
||||
0x74187792,
|
||||
0xDA26DE8F,
|
||||
0x32CDF3BF,
|
||||
0xC67752A6,
|
||||
0xFCC1C715,
|
||||
0xDAE802B7,
|
||||
0x79610918,
|
||||
0x1EE197ED,
|
||||
0x2A5D334F,
|
||||
0x2B29A64D,
|
||||
0x69F9FAB2,
|
||||
0x9C8DFD48,
|
||||
0x5DBE531E,
|
||||
0xD610721F,
|
||||
0xDAED84C2,
|
||||
0x46C17D78,
|
||||
0x48342502,
|
||||
0xC43406E2,
|
||||
0x3AD9E238,
|
||||
0x4736DBCD,
|
||||
0x60E31016,
|
||||
0xE48C56EE,
|
||||
0xA00853EE,
|
||||
0x704D5330,
|
||||
0x3F8BF7E8,
|
||||
0x1371C4A1,
|
||||
0x17558390,
|
||||
0x97C09F8,
|
||||
0x632991E8,
|
||||
0x82450269,
|
||||
0xD2D46216,
|
||||
0xC28DAC41,
|
||||
0xEA32272C,
|
||||
0xEA32272C,
|
||||
0xEA32272C,
|
||||
0xEA32272C,
|
||||
0x18498A10,
|
||||
0x37260A58,
|
||||
0xAD70DF96,
|
||||
0x2C4C73AB,
|
||||
0xA27ADAC9,
|
||||
0xB40311CE,
|
||||
0xD43C3F0D,
|
||||
0xD18D6D4F,
|
||||
0xE5742C65,
|
||||
0x6161D587,
|
||||
0xEE15C242,
|
||||
0x616C5A71,
|
||||
0xEA647B9E,
|
||||
0x1CBE6C9D,
|
||||
0x1CFB019E,
|
||||
0xCB705B25,
|
||||
0xD5D22F70,
|
||||
0xAEB62EB5,
|
||||
0x47C41F2F,
|
||||
0xFE0650AA,
|
||||
0xBC6574A8,
|
||||
0x7BCAA87B,
|
||||
0x5635C911,
|
||||
0x86F3CA42,
|
||||
0x66421413,
|
||||
0x6FBB7918,
|
||||
0x6769A06F,
|
||||
0xBC374C2,
|
||||
0xAF0600EC,
|
||||
0xB22A2B5A,
|
||||
0x7943A2EF,
|
||||
0xFCA692DE,
|
||||
0x16B92AFD,
|
||||
0x24C9AD9C,
|
||||
0xFEF4B73C,
|
||||
0xD4E0F385,
|
||||
0x412432D9,
|
||||
0x1784B355,
|
||||
0x6BB63EC0,
|
||||
0x285B45A4,
|
||||
0x59A17DFC,
|
||||
0x475BEA08,
|
||||
0x84170808,
|
||||
0x929003EF,
|
||||
0xC8F73C0C,
|
||||
0xA4B0CE4D,
|
||||
0xBE76FD8B,
|
||||
0x529C64D6,
|
||||
0x2045B979,
|
||||
0xAD636A1,
|
||||
0xC73523F5,
|
||||
0xE37B7D45,
|
||||
0x8E060158,
|
||||
0xAABA9A33,
|
||||
0x9E58424B,
|
||||
0xAB587EDA,
|
||||
0xB3F8E49B,
|
||||
0xEC6ACC19,
|
||||
0xDB54F493,
|
||||
0x8BC3C293,
|
||||
0x390AAADB,
|
||||
0x390AAADB,
|
||||
0x44853591,
|
||||
0x5D64B95E,
|
||||
0x102848F2,
|
||||
0xD961186A,
|
||||
0x616A2DB9,
|
||||
0x8D5F97D8,
|
||||
0xD9BB6B26,
|
||||
0xED384A0B,
|
||||
0xD313CE5C,
|
||||
0x31585B5A,
|
||||
0x290679F6,
|
||||
0x75B01FF7,
|
||||
0x63889088,
|
||||
0x99982658,
|
||||
0x7185EF9B,
|
||||
0x7E3BED99,
|
||||
0xA593846,
|
||||
0x4D0474C0,
|
||||
0x128793B1,
|
||||
0x709319AD,
|
||||
0xF01ACFB9,
|
||||
0x8D22691F,
|
||||
0x73F41E8F,
|
||||
0x83B56BA7,
|
||||
0x51DD4427,
|
||||
0x24AC074,
|
||||
0x9C765BB4,
|
||||
0x2CDF21E2,
|
||||
0x8B167B26,
|
||||
0xD906A508,
|
||||
0x281505E3,
|
||||
0x86025168,
|
||||
0xAC2FAAE7,
|
||||
0x153645E0,
|
||||
0xD747483C,
|
||||
0x82707D57,
|
||||
0xDDD51C6C,
|
||||
0xB207B2CE,
|
||||
0x3E2AC655,
|
||||
0x24DBD916,
|
||||
0xFC2775E4,
|
||||
0xEBC26945,
|
||||
0x932516C,
|
||||
0xD7DA1C3A,
|
||||
0x56933D5A,
|
||||
0x777C9E5D,
|
||||
0xB24026F2,
|
||||
0xDEFCE597,
|
||||
0x6E6406D7,
|
||||
0x7ABF84E5,
|
||||
0xBED9741D,
|
||||
0xFE54BA88,
|
||||
0xC6015AEE,
|
||||
0x3706620D,
|
||||
0x205235BB,
|
||||
0xB3A6A60D,
|
||||
0x53126B81,
|
||||
0x73104D5B,
|
||||
0x78559C53,
|
||||
0x4EBA9DC4,
|
||||
0x81F5367B,
|
||||
0xDB85744E,
|
||||
0x21A84B24,
|
||||
0x2854B1BD,
|
||||
0xA8F300B3,
|
||||
0x345EFE05,
|
||||
0xE4CD025B,
|
||||
0xC6015AEE,
|
||||
0xC6015AEE,
|
||||
0xB3286D46,
|
||||
0x3E4AC820,
|
||||
0x7096EBCE,
|
||||
0x87E07292,
|
||||
0x6F7BBA00,
|
||||
0x5D7F0DE1,
|
||||
0x87E07292,
|
||||
0x6F7BBA00,
|
||||
0x749C221C,
|
||||
0x77FEB655,
|
||||
0x157183C4,
|
||||
0xD1363774,
|
||||
0x77FEB655,
|
||||
0x157183C4,
|
||||
0x77FEB655,
|
||||
0x77FEB655,
|
||||
0x20725236,
|
||||
0x9DEDDC19,
|
||||
0x9FEA684D,
|
||||
0xFD054690,
|
||||
0x8FA700D2,
|
||||
0x218D9FD,
|
||||
0x76FABBC6,
|
||||
0x86387EA5,
|
||||
0xEA881A8B,
|
||||
0x13AE9A19,
|
||||
0xA5BA7D4F,
|
||||
0x6BA555E9,
|
||||
0xFE8BAC1E,
|
||||
0xB0D4C1CD,
|
||||
0x28D073F2,
|
||||
0xD0B496B5,
|
||||
0xFC0280C1,
|
||||
0x840B0567,
|
||||
0x67E1ABB1,
|
||||
0x80AD816A,
|
||||
0xBBFA9117,
|
||||
0xDD31A646,
|
||||
0x386224D2,
|
||||
0x13AE9A19,
|
||||
0x874E1AA5,
|
||||
0x21F2CAF,
|
||||
0xF1F2D330,
|
||||
0xB97B9662,
|
||||
0xDA5FA7D0,
|
||||
0x390AAADB,
|
||||
0xA6126545,
|
||||
0xDBECB91B,
|
||||
0xDC80565D,
|
||||
0x1F5D6355,
|
||||
0xD0A2FDEA,
|
||||
0x9B60753F,
|
||||
0x52B84067,
|
||||
0x52B84067,
|
||||
0x18E4E3DD,
|
||||
0x9BFEDF43,
|
||||
0x9BFEDF43,
|
||||
0xC53F1931,
|
||||
0x735EFF60,
|
||||
0x2F4C3F82,
|
||||
0x3424687D,
|
||||
0x3D56AE9C,
|
||||
0x3060C7DB,
|
||||
0x6C12201E,
|
||||
0x650AEAAA,
|
||||
0xDAA8AF48,
|
||||
0x327CD99C,
|
||||
0x1C8D6A1E,
|
||||
0xABB82158,
|
||||
0x1F8E9C42,
|
||||
0x1F8E9C42,
|
||||
0xD8A65951,
|
||||
0x1F8E9C42,
|
||||
0xD8A65951,
|
||||
0x1F8E9C42,
|
||||
0xD8A65951,
|
||||
0xFDFD6F5B,
|
||||
0x5BCD1A09,
|
||||
0x1AABD9A3,
|
||||
0xF501B6BF,
|
||||
0xEC0B59B9,
|
||||
0xE304BD06,
|
||||
0x6B859C7B,
|
||||
0x365A9F51,
|
||||
0x1226B87,
|
||||
0xEA37E240,
|
||||
0xE9B83FF4,
|
||||
0xD8E7C635,
|
||||
0x1C8D6A1E,
|
||||
0xABB82158,
|
||||
0x390AAADB,
|
||||
0x390AAADB,
|
||||
0x6023A97,
|
||||
0x47AF0DA7,
|
||||
0x1FAC8B32,
|
||||
0x9ECD96C7,
|
||||
0x534F9CBD,
|
||||
0xD2B82820,
|
||||
0xCC3E0F73,
|
||||
0x390AAADB,
|
||||
0x2C6029D4,
|
||||
0xCE2B59CD,
|
||||
0xB539685D,
|
||||
0x90B54889,
|
||||
0xD07E60D9,
|
||||
0x288122DD,
|
||||
0x11F1769B,
|
||||
0xAE89C5D5,
|
||||
0xFFA0DC2F,
|
||||
0x72002392,
|
||||
0x4418DBE0,
|
||||
0xEF204348,
|
||||
0xCD6FE9C7,
|
||||
0x653AD413,
|
||||
0xFB157DE3,
|
||||
0xD9F1DE1C,
|
||||
0xD9F1DE1C,
|
||||
0x7A13EDA,
|
||||
0xD9611B71,
|
||||
0x588C5666,
|
||||
0x69A9CD1,
|
||||
0xD6FC08D4,
|
||||
0xA82144CC,
|
||||
0xD76A8FF6,
|
||||
0x756751E9,
|
||||
0xC29699F2,
|
||||
0xC29699F2,
|
||||
0x3A4EA893,
|
||||
0xC29699F2,
|
||||
0xE2FBB14,
|
||||
0x390AAADB,
|
||||
0x8C221905,
|
||||
0x1174A680,
|
||||
0x1EC38B66,
|
||||
0x1D6BA7C3,
|
||||
0x421E0289,
|
||||
0xF7797B83,
|
||||
0xAC7FCE25,
|
||||
0xDD1C3E27,
|
||||
0x5DC6FB34,
|
||||
0xA35B96EC,
|
||||
0x33889D6F,
|
||||
0x866DF972,
|
||||
0x51D3DBB4,
|
||||
0x6F8A88A0,
|
||||
0x4CA0070A,
|
||||
0x4CA0070A,
|
||||
0xF907455D,
|
||||
0x9D40E229,
|
||||
0xCD5BC6A0,
|
||||
0x30BC25DB,
|
||||
0xA5B92877,
|
||||
0x3FD680D9,
|
||||
0xB0A4AABF,
|
||||
0x6083C49C,
|
||||
0x4E2B6547,
|
||||
0xB0A4AABF,
|
||||
0xB0A4AABF,
|
||||
0x3E795C0E,
|
||||
0xF88139FF,
|
||||
0x781DA398,
|
||||
0x71202385,
|
||||
0x71202385,
|
||||
0x2D9292F7,
|
||||
0x9D4F32D4,
|
||||
0x9D4F32D4,
|
||||
0x2DB47BB2,
|
||||
0xFBBA2F20,
|
||||
0x76B4A2FC,
|
||||
0x9392FE7E,
|
||||
0xE36FE761,
|
||||
0x91DFC002,
|
||||
0x108E5EA6,
|
||||
0x2113D9A8,
|
||||
0x43401D3D,
|
||||
0xB33A3D73,
|
||||
0xB4B84997,
|
||||
0x86BEC81F,
|
||||
0xA4E16BF8,
|
||||
0xECFBC008,
|
||||
0xC588FE78,
|
||||
0xECFBC008,
|
||||
0xC588FE78,
|
||||
0x6EFEA8B8,
|
||||
0xE1C142F8,
|
||||
0x1BB78AFA,
|
||||
0x1F20CF9C,
|
||||
0x6E543AD3,
|
||||
0x6CA9593E,
|
||||
0xDBC91516,
|
||||
0x39909097,
|
||||
0xD15B573E,
|
||||
0x53ACCA78,
|
||||
0x1BE15DE2,
|
||||
0x27356EEE,
|
||||
0xEBEA4AC,
|
||||
0x58438B3E,
|
||||
0xA11A24,
|
||||
0x355F2CD2,
|
||||
0xF725665D,
|
||||
0x32531F35,
|
||||
0x57A611BB,
|
||||
0x82A5291A,
|
||||
0xADBBDCB4,
|
||||
0x71AFAD82,
|
||||
0x4B993550,
|
||||
0x61EE678D,
|
||||
0x117768A5,
|
||||
0xCFF78A2D,
|
||||
0x117768A5,
|
||||
0xCFF78A2D,
|
||||
0x117768A5,
|
||||
0xCFF78A2D,
|
||||
0x117768A5,
|
||||
0xCFF78A2D,
|
||||
0x4462FB08,
|
||||
0x4462FB08,
|
||||
0x4462FB08,
|
||||
0x4462FB08,
|
||||
0x4462FB08,
|
||||
0x4462FB08,
|
||||
0x4462FB08,
|
||||
0x4462FB08,
|
||||
0x4462FB08,
|
||||
0x81396B8E,
|
||||
0x3F6FDE09,
|
||||
0xE554F200,
|
||||
0xF11EC000,
|
||||
0x45E225E8,
|
||||
0x99075C19,
|
||||
0x409C24BD,
|
||||
0xA43D3D70,
|
||||
0x8FEAC1BB,
|
||||
0x29AE40B9,
|
||||
0x4609A0DE,
|
||||
0xB5F3E580,
|
||||
0xFB52BB8E,
|
||||
0xE413DAEF,
|
||||
0x62E45E5F,
|
||||
0xE6C8B90B,
|
||||
0xB99F3027,
|
||||
0xE6D88C6,
|
||||
0xA4CBFDA6,
|
||||
0x910BC8C9,
|
||||
0xD368E0E8,
|
||||
0x14B3B487,
|
||||
0x6BA56D67,
|
||||
0xEC818059,
|
||||
0xEC818059,
|
||||
0xEC818059,
|
||||
0xEC818059,
|
||||
0xEC818059,
|
||||
0x37499325,
|
||||
0xB7D92332,
|
||||
0x372A0055,
|
||||
0x372A0055,
|
||||
0x372A0055,
|
||||
0x372A0055,
|
||||
0x372A0055,
|
||||
0x9D30EA03,
|
||||
0x3BC16E4,
|
||||
0x4465AF10,
|
||||
0x8ACF914F,
|
||||
0x9E252778,
|
||||
0x4273F80C,
|
||||
0x7F7F4748,
|
||||
0x5D89F07B,
|
||||
0x7E7E2DE0,
|
||||
0xD7DF30DD,
|
||||
0xD7DF30DD,
|
||||
0xA6777E27,
|
||||
0x9B7E705B,
|
||||
0x371423B9,
|
||||
0x3E922DF,
|
||||
0x8584A250,
|
||||
0x8584A250,
|
||||
0x8584A250,
|
||||
0xE81A3362,
|
||||
0x3EB92321,
|
||||
0xE65BF197,
|
||||
0xF7851B58,
|
||||
0x915BDD85,
|
||||
0xECE51BE7,
|
||||
0x8AAC3339,
|
||||
0xFA71E0EA,
|
||||
0x8DB7D449,
|
||||
0x287E39B4,
|
||||
0x1166CD23,
|
||||
0x9393E3CF,
|
||||
0x5B6094D7,
|
||||
0xD281316B,
|
||||
0xDE8DD7E4,
|
||||
0x582F9EDF,
|
||||
0x622EDE70,
|
||||
0x65B6BA1D,
|
||||
0x7ECA1AE,
|
||||
0x85BC06AC,
|
||||
0x40D79BD6,
|
||||
0xE337C11D,
|
||||
0x886DB281,
|
||||
0xD1DDF2FC,
|
||||
0x84CA941A,
|
||||
0xA335B660,
|
||||
0xC2A6E2C5,
|
||||
0xA335B660,
|
||||
0xA335B660,
|
||||
0xA335B660,
|
||||
0xA335B660,
|
||||
0xA335B660,
|
||||
0xC2A6E2C5,
|
||||
0xA335B660,
|
||||
0xA335B660,
|
||||
0x3BEEDF40,
|
||||
0x514983A3,
|
||||
0x8CCD702F,
|
||||
0x5160B089,
|
||||
0x35382CB7,
|
||||
0xA6317F10,
|
||||
0x8BC33220,
|
||||
0x5160B089,
|
||||
0xA6317F10,
|
||||
0x3E507E9A,
|
||||
0xA1FCC6F2,
|
||||
0xCCDEC6A1,
|
||||
0x3CF821D,
|
||||
0x4D2D121B,
|
||||
0xA1FCC6F2,
|
||||
0x3E507E9A,
|
||||
0xA1FCC6F2,
|
||||
0x3CF821D,
|
||||
0x4D2D121B,
|
||||
0xA81545BF,
|
||||
0xF7D6C3C8,
|
||||
0x129E8099,
|
||||
0x1962C3E8,
|
||||
0x390AAADB,
|
||||
0x69F06668,
|
||||
0xC1D0A3C5,
|
||||
0x40DDD191,
|
||||
0x3FEE5B65,
|
||||
0x9AB7D382,
|
||||
0x7ECA1AE,
|
||||
0xB62582C,
|
||||
0x7803E105,
|
||||
0xB62582C,
|
||||
0x94B0B8FA,
|
||||
0x1EA054D9,
|
||||
0x73A6B021,
|
||||
0x768271F2,
|
||||
0x1AB9BD99
|
||||
};
|
||||
|
||||
|
||||
uintptr_t GetFunctionHandle(uintptr_t file, uint32_t nspace, uint32_t fname) {
|
||||
int count = g_assetPool[ASSET_TYPE_SCRIPTPARSETREE].itemAllocCount;
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (g_assetPool[ASSET_TYPE_SCRIPTPARSETREE].pool.scriptParseTreeOld->__padding0000 == 0) {
|
||||
GSC_OBJ* gsc = (GSC_OBJ*)(g_assetPool[ASSET_TYPE_SCRIPTPARSETREE].pool.scriptParseTreeOld[i].data);
|
||||
if (gsc != 0 && g_assetPool[ASSET_TYPE_SCRIPTPARSETREE].pool.scriptParseTreeOld[i].name == file) {
|
||||
nlog("0x%p found!\n", file);
|
||||
printf("0x%p found!\n", file);
|
||||
GSC_EXPORT_ITEM* gsc_exports = (GSC_EXPORT_ITEM*)((uintptr_t)gsc + gsc->exports_offset);
|
||||
for (int i = 0; i < gsc->exports_count; i++) {
|
||||
if (gsc_exports[i].name_space == nspace && gsc_exports[i].name == fname) {
|
||||
nlog("0x%X - 0x%X found!\n", nspace, fname);
|
||||
printf("0x%X - 0x%X found!\n", nspace, fname);
|
||||
return (uintptr_t)(gsc)+gsc_exports[i].address;
|
||||
}
|
||||
}
|
||||
@ -577,11 +68,11 @@ uintptr_t GetFunctionHandle(uintptr_t file, uint32_t nspace, uint32_t fname) {
|
||||
else {
|
||||
GSC_OBJ* gsc = (GSC_OBJ*)(g_assetPool[ASSET_TYPE_SCRIPTPARSETREE].pool.scriptParseTreeNew[i].data);
|
||||
if (gsc != 0 && g_assetPool[ASSET_TYPE_SCRIPTPARSETREE].pool.scriptParseTreeNew[i].name == file) {
|
||||
nlog("0x%p found!\n", file);
|
||||
printf("0x%p found!\n", file);
|
||||
GSC_EXPORT_ITEM* gsc_exports = (GSC_EXPORT_ITEM*)((uintptr_t)gsc + gsc->exports_offset);
|
||||
for (int i = 0; i < gsc->exports_count; i++) {
|
||||
if (gsc_exports[i].name_space == nspace && gsc_exports[i].name == fname) {
|
||||
nlog("0x%X - 0x%X found!\n", nspace, fname);
|
||||
printf("0x%X - 0x%X found!\n", nspace, fname);
|
||||
return (uintptr_t)(gsc)+gsc_exports[i].address;
|
||||
}
|
||||
}
|
||||
@ -601,7 +92,7 @@ LONG WINAPI TopLevelExceptionHandler(PEXCEPTION_POINTERS pExceptionInfo)
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
}
|
||||
}
|
||||
backtrace("TopLevelExceptionHandler");
|
||||
// backtrace("TopLevelExceptionHandler");
|
||||
printf("%p - %X - %p\n", pExceptionInfo->ContextRecord->Rip, pExceptionInfo->ExceptionRecord->ExceptionCode, _ReturnAddress());
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
@ -613,9 +104,7 @@ uintptr_t some_stub;
|
||||
|
||||
void Render(uintptr_t a1) {
|
||||
|
||||
nlog("hooked!\n");
|
||||
|
||||
|
||||
printf("hooked!\n");
|
||||
|
||||
auto _stub = reinterpret_cast<void(*)(uintptr_t)>(some_stub);
|
||||
_stub(a1);
|
||||
@ -623,7 +112,8 @@ void Render(uintptr_t a1) {
|
||||
|
||||
bool is_script_ready;
|
||||
|
||||
extern "C" __declspec(dllexport) int DiscordCreate() { //unsigned int version, uintptr_t params, void** result
|
||||
extern "C" __declspec(dllexport) int DiscordCreate() //unsigned int version, uintptr_t params, void** result
|
||||
{
|
||||
entry_point();
|
||||
|
||||
if (*reinterpret_cast<int*>(0x1411017B0_g) != 0x70657DE9) {
|
||||
@ -713,7 +203,7 @@ void set_zombie_var(uintptr_t zvar, int value) {
|
||||
|
||||
BOOL WINAPI QueryPerformanceCounter_Detour(LARGE_INTEGER* lpPerformanceCount) {
|
||||
|
||||
//nlog("%s\n", __FUNCTION__);
|
||||
//printf("%s\n", __FUNCTION__);
|
||||
//if (is_script_ready) {
|
||||
// if (Com_IsInGame() && (uintptr_t)(_ReturnAddress()) == g_Addrs.clientthink_ret) {
|
||||
// if (set_zombie_var_handle) {
|
||||
@ -722,7 +212,7 @@ BOOL WINAPI QueryPerformanceCounter_Detour(LARGE_INTEGER* lpPerformanceCount) {
|
||||
// set_zombie_var(zombie_perk_cost, 10);
|
||||
// set_zombie_var(zombie_insta_kill, 1);
|
||||
// set_zombie_var(zombie_point_scalar, 10);
|
||||
// nlog("called\n");
|
||||
// printf("called\n");
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@ -792,7 +282,7 @@ void GameLoadScript() {
|
||||
if (!set_zombie_var_handle) {
|
||||
set_zombie_var_handle = GetFunctionHandle(0x3f9e0dc8454d98e1, 0x2a39b4c3, 0x63977437);
|
||||
}
|
||||
nlog("handle %p - %p\n", set_zombie_var_handle, GetFunctionHandle(0x3f9e0dc8454d98e1, 0x2a39b4c3, 0x63977437));
|
||||
printf("handle %p - %p\n", set_zombie_var_handle, GetFunctionHandle(0x3f9e0dc8454d98e1, 0x2a39b4c3, 0x63977437));
|
||||
|
||||
|
||||
|
||||
@ -810,7 +300,7 @@ bool RtlDispatchException_Detour(PEXCEPTION_RECORD ExceptionRecord, PCONTEXT Con
|
||||
if ((uintptr_t)ExceptionRecord->ExceptionAddress < (base + 0x100000000)) {
|
||||
if (ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION)
|
||||
{
|
||||
backtrace(__FUNCTION__);
|
||||
// backtrace(__FUNCTION__);
|
||||
if (Context->Rip == g_Addrs.Dvar_GetBool_cmp) { //for any type of dvar
|
||||
|
||||
switch (Context->Rcx) {
|
||||
@ -911,7 +401,6 @@ NTSTATUS NtClose_Detour(HANDLE Handle) {
|
||||
char info[16];
|
||||
if (NtQueryObject(Handle, OBJECT_INFORMATION_CLASS(4), &info, 2, nullptr) >= 0)
|
||||
{
|
||||
|
||||
return _NtClose(Handle);
|
||||
}
|
||||
|
||||
@ -921,14 +410,14 @@ NTSTATUS NtClose_Detour(HANDLE Handle) {
|
||||
NTSTATUS ZwTerminateProcess_Detour(HANDLE ProcessHandle, NTSTATUS ExitStatus) {
|
||||
|
||||
//backtrace(__FUNCTION__);
|
||||
log("closing process %p with %i\n", ProcessHandle, ExitStatus);
|
||||
printf("closing process %p with %i\n", ProcessHandle, ExitStatus);
|
||||
return _ZwTerminateProcess(ProcessHandle, ExitStatus);
|
||||
}
|
||||
|
||||
utils::hook::detour enumwindows;
|
||||
BOOL EnumWindows_Detour(WNDENUMPROC lpEnumFunc, LPARAM lParam) {
|
||||
|
||||
nlog("%p - %p\n", lpEnumFunc, lParam);
|
||||
printf("%p - %p\n", lpEnumFunc, lParam);
|
||||
|
||||
return enumwindows.invoke<BOOL>(lpEnumFunc, lParam);
|
||||
}
|
||||
@ -972,6 +461,35 @@ void find_and_hook_mapped_syscalls() {
|
||||
|
||||
}
|
||||
|
||||
const char* getBuildNumStr()
|
||||
{
|
||||
switch (*reinterpret_cast<int*>(0x1411017B0_g)) {
|
||||
case 0xB8ECE9C1:
|
||||
return "1.9.1";
|
||||
case 0xE9CC1D0E:
|
||||
return "1.33.2.15030131";
|
||||
case 0x8348B74E:
|
||||
return "1.34.0.15931218";
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void BuildWarning()
|
||||
{
|
||||
const char* warning = "The Cold War build your using isn't fully supported.\nThe fully supported build is 1.34.0.15931218";
|
||||
const char* buildNum = getBuildNumStr();
|
||||
if (buildNum != nullptr)
|
||||
{
|
||||
char detailedWarning[256];
|
||||
sprintf(detailedWarning, "The Cold War build your using isn't fully supported. (%s)\nThe fully supported build is 1.34.0.15931218", buildNum);
|
||||
warning = detailedWarning;
|
||||
}
|
||||
|
||||
MessageBoxA(NULL, warning, "T9 - WARNING", MB_ICONWARNING | MB_OK | MB_DEFBUTTON1);
|
||||
}
|
||||
|
||||
void conMenu()
|
||||
{
|
||||
bool s_inited = *reinterpret_cast<bool*>(g_Addrs.s_inited);
|
||||
@ -991,8 +509,20 @@ void conMenu()
|
||||
puts("RCTRL + NUMPAD 5 = Set Gametype");
|
||||
puts("--------------------------------------------");
|
||||
|
||||
uintptr_t dvar = *reinterpret_cast<unsigned long long*>(g_Addrs.DAT_180011dc0);
|
||||
Dvar_SetBoolFromSource(dvar, 1, 0); // unlocks campaign and zombies
|
||||
uintptr_t noDW = *reinterpret_cast<unsigned long long*>(g_Addrs.dvar_noDW);
|
||||
Dvar_SetBoolFromSource(noDW, 1, 0); // unlocks campaign and zombies
|
||||
|
||||
if (*reinterpret_cast<int*>(0x1411017B0_g) != 0x8348B74E)
|
||||
{
|
||||
CreateThread((LPSECURITY_ATTRIBUTES)0, 0, (LPTHREAD_START_ROUTINE)BuildWarning, (LPVOID)0, 0, (LPDWORD)0x0);
|
||||
}
|
||||
else
|
||||
{
|
||||
static cmd_function_t cmd_addtestclient;
|
||||
Cmd_AddCommandInternal("addtestclient", AddTestClient, &cmd_addtestclient);
|
||||
|
||||
Dvar_SetIntByHash(0x60CDC482A7D159F8, 1); // loot_fakeAll
|
||||
}
|
||||
|
||||
CL_Disconnect(0, false, "");
|
||||
|
||||
@ -1043,6 +573,7 @@ void conMenu()
|
||||
else
|
||||
{
|
||||
puts("1.34 build doesn't have this anyway, so no need to add that now...");
|
||||
puts("not gonna add it lol");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1217,8 +748,8 @@ void entry_point() {
|
||||
}
|
||||
g_Addrs.g_auth_manager += *reinterpret_cast<signed int*>(g_Addrs.g_auth_manager + 3) + 7;
|
||||
|
||||
g_Addrs.DAT_180011dc0 = find_pattern(main_module, "48 8B 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? 83 F8 01 75 ?? 48 8B 0F 8D 68 ?? 44 8B F8 48 85 C9");
|
||||
g_Addrs.DAT_180011dc0 = g_Addrs.DAT_180011dc0 + (*(int*)(g_Addrs.DAT_180011dc0 + 3) + 7);
|
||||
g_Addrs.dvar_noDW = find_pattern(main_module, "48 8B 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? 83 F8 01 75 ?? 48 8B 0F 8D 68 ?? 44 8B F8 48 85 C9");
|
||||
g_Addrs.dvar_noDW = g_Addrs.dvar_noDW + (*(int*)(g_Addrs.dvar_noDW + 3) + 7);
|
||||
|
||||
g_Addrs.s_inited = find_pattern(main_module, "38 ?? ?? ?? ?? ?? 0F 85 ?? ?? ?? ?? 48 ?? 4F B6 E2 AE 25 2E C1 17");
|
||||
g_Addrs.s_inited = g_Addrs.s_inited + (uintptr_t)(*(int*)(g_Addrs.s_inited + 2) + 6);
|
||||
@ -1270,7 +801,7 @@ void entry_point() {
|
||||
|
||||
uintptr_t exception_dispatcher = find_pattern(("ntdll.dll"), ("40 55 56 57 41 54 41 55 41 56 41 57 48 81 EC ?? ?? ?? ?? 48 8D 6C 24 ?? 48 89 9D ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 33 C5 48 89 85 ?? ?? ?? ?? 65 48 8B 04 25 ?? ?? ?? ?? 33 DB"));
|
||||
#ifdef DEV
|
||||
nlog(("%p - exception_dispatcher\n"), exception_dispatcher);
|
||||
printf(("%p - exception_dispatcher\n"), exception_dispatcher);
|
||||
#endif
|
||||
dispatch_exception.create(exception_dispatcher, RtlDispatchException_Detour);
|
||||
is_script_ready = true;
|
||||
@ -1346,12 +877,12 @@ utils::hook::detour createmutexexa;
|
||||
HANDLE CreateMutexExA_Detour(const LPSECURITY_ATTRIBUTES attributes, const LPCSTR name, const DWORD flags, const DWORD access)
|
||||
{
|
||||
#ifdef DEV
|
||||
nlog("0x%p - %s\n", (uintptr_t)(_ReturnAddress()) - base, name);
|
||||
printf("0x%p - %s\n", (uintptr_t)(_ReturnAddress()) - base, name);
|
||||
#endif
|
||||
if (strstr(name, ("$ IDA trusted_idbs")) || strstr(name, ("$ IDA registry mutex $")))
|
||||
{
|
||||
char* test = (char*)Com_GetRandomWord();
|
||||
//nlog("%s\n", test);
|
||||
//printf("%s\n", test);
|
||||
return createmutexexa.invoke<HANDLE>(attributes, test, flags, access);
|
||||
}
|
||||
|
||||
@ -1455,7 +986,7 @@ INT WINAPI get_system_metrics(int nIndex)
|
||||
{
|
||||
if (!nIndex) {
|
||||
#ifdef DEV
|
||||
nlog("get_system_metrics %i\n", nIndex);
|
||||
printf("get_system_metrics %i\n", nIndex);
|
||||
#endif
|
||||
//entry_point();
|
||||
//integrity::search_and_patch_integrity_checks();
|
||||
@ -1466,14 +997,26 @@ INT WINAPI get_system_metrics(int nIndex)
|
||||
utils::hook::detour regopenkeya;
|
||||
LSTATUS APIENTRY RegOpenKeyA_Detour( HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult) {
|
||||
|
||||
nlog("%s\n", lpSubKey);
|
||||
printf("%s\n", lpSubKey);
|
||||
|
||||
return regopenkeya.invoke<LSTATUS>(hKey, lpSubKey, phkResult);
|
||||
}
|
||||
|
||||
void* exception_handler_handle;
|
||||
BOOL WINAPI DllMain(HMODULE hModule, DWORD Reason, LPVOID lpVoid) {
|
||||
if (Reason == DLL_PROCESS_ATTACH) {
|
||||
if (Reason == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
if (IsProcessRunning("Battle.net.exe"))
|
||||
{
|
||||
MessageBoxA(NULL,
|
||||
"DO NOT launch the game via Battle.net or have Battle.net opened while launching the game with the custom discord_game_sdk.dll applied\n\n"
|
||||
"You are risking a BAN, so if you want to play Cold War normally via Battle.net: you need to delete the discord_game_sdk.dll in your game folder and replace it with the original one.\n\n"
|
||||
"But to launch Cold War with the custom discord_game_sdk.dll applied, you need to close Battle.net completely and just run 'BlackOpsColdWar.exe'.\n"
|
||||
"Not the 'Black Ops Cold War Launcher.exe'. This will open Battle.net!\n\n"
|
||||
"Press 'OK' to close the game", "T9 - WARNING", MB_ICONERROR | MB_OK | MB_DEFBUTTON1);
|
||||
|
||||
ExitProcess(0x0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
AllocConsole();
|
||||
FILE* Dummy;
|
||||
@ -1490,8 +1033,7 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD Reason, LPVOID lpVoid) {
|
||||
|
||||
const char* main_module = ("BlackOpsColdWar.exe");
|
||||
g_Addrs.ModuleBase = (uintptr_t)(GetModuleHandleA(0));
|
||||
nlog(("Base Address: %p\n"), base);
|
||||
|
||||
printf(("Base Address: %p\n"), base);
|
||||
|
||||
// utils::hook::set(game.get_iat_entry(("kernel32.dll"), ("QueryPerformanceCounter")), QueryPerformanceCounter_Detour);
|
||||
utils::hook::set(game.get_iat_entry(("user32.dll"), ("SetWindowsHookExA")), SetWindowsHookExA_Detour);
|
||||
@ -1505,7 +1047,7 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD Reason, LPVOID lpVoid) {
|
||||
//get_thread_context_hook.create(get_thread_context_func, get_thread_context_stub);
|
||||
|
||||
// patch_import("user32.dll", "GetSystemMetrics", get_system_metrics);
|
||||
// nlog("hooked\n");
|
||||
// printf("hooked\n");
|
||||
|
||||
|
||||
//g_Addrs.jmp_rbx = find_pattern(main_module, "FF 23");
|
||||
@ -1515,25 +1057,6 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD Reason, LPVOID lpVoid) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void nlog(const char* str, ...) {
|
||||
va_list ap;
|
||||
HWND notepad, edit;
|
||||
char buf[256];
|
||||
|
||||
va_start(ap, str);
|
||||
vsprintf(buf, str, ap);
|
||||
va_end(ap);
|
||||
strcat(buf, "");
|
||||
notepad = FindWindow(NULL, ("Untitled - Notepad"));
|
||||
if (!notepad)
|
||||
notepad = FindWindow(NULL, ("*Untitled - Notepad"));
|
||||
|
||||
edit = FindWindowEx(notepad, NULL, ("EDIT"), NULL);
|
||||
//SendMessageA(edit, EM_REPLACESEL, 0, (LPARAM)buf);
|
||||
printf("%s", buf);
|
||||
log(std::string(buf));
|
||||
}
|
||||
|
||||
uintptr_t* threadFunc;
|
||||
|
||||
uintptr_t find_pattern(const char* module_name, const char* pattern) {
|
||||
@ -1541,7 +1064,7 @@ uintptr_t find_pattern(const char* module_name, const char* pattern) {
|
||||
{
|
||||
return reinterpret_cast<PIMAGE_NT_HEADERS>(module_base + reinterpret_cast<PIMAGE_DOS_HEADER>(module_base)->e_lfanew)->OptionalHeader.SizeOfImage;
|
||||
};
|
||||
const auto module_start = (uintptr_t)GetModuleHandle(module_name);
|
||||
const auto module_start = (uintptr_t)GetModuleHandleA(module_name);
|
||||
if (module_start != 0ULL)
|
||||
{
|
||||
const auto module_end = module_start + get_module_size(module_start);
|
||||
@ -1576,7 +1099,7 @@ uintptr_t find_pattern(const char* module_name, const char* pattern) {
|
||||
pattern_current += 3;
|
||||
if (pattern_current[-1] == NULL)
|
||||
return current_match;
|
||||
//nlog("found %s\n", pattern);
|
||||
//printf("found %s\n", pattern);
|
||||
|
||||
}
|
||||
}
|
||||
@ -1589,7 +1112,7 @@ uintptr_t find_pattern(uintptr_t start, const char* module_name, const char* pat
|
||||
{
|
||||
return reinterpret_cast<PIMAGE_NT_HEADERS>(module_base + reinterpret_cast<PIMAGE_DOS_HEADER>(module_base)->e_lfanew)->OptionalHeader.SizeOfImage;
|
||||
};
|
||||
const auto module_start = (uintptr_t)GetModuleHandle(module_name);
|
||||
const auto module_start = (uintptr_t)GetModuleHandleA(module_name);
|
||||
if (module_start != 0ULL)
|
||||
{
|
||||
const auto module_end = module_start + get_module_size(module_start);
|
||||
@ -1748,7 +1271,6 @@ extern "C"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
size_t operator"" _b(const size_t val)
|
||||
{
|
||||
return base + val;
|
||||
@ -1778,25 +1300,3 @@ size_t reverse_g(const void* val)
|
||||
{
|
||||
return reverse_g(reinterpret_cast<size_t>(val));
|
||||
}
|
||||
|
||||
void log(std::string str)
|
||||
{
|
||||
std::ofstream outputFile("output.log", std::ios::app);
|
||||
if (outputFile.is_open()) {
|
||||
outputFile << str; // Append the string
|
||||
outputFile.close(); // Close the file
|
||||
}
|
||||
}
|
||||
|
||||
void log(const char* fmt, ...)
|
||||
{
|
||||
char va_buffer[0x800] = { 0 };
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vsprintf_s(va_buffer, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
const auto formatted = std::string(va_buffer);
|
||||
log(formatted);
|
||||
}
|
||||
|
@ -47,8 +47,6 @@ struct WeaponDef {
|
||||
|
||||
#pragma comment(lib, "ntdll.lib")
|
||||
|
||||
extern void* exception_handler;
|
||||
|
||||
#define base g_Addrs.ModuleBase
|
||||
|
||||
#pragma warning(disable:4996)
|
||||
@ -335,6 +333,15 @@ enum XAssetType : unsigned __int8
|
||||
ASSET_TYPE_SCENARIO = 0xDC,
|
||||
};
|
||||
|
||||
enum scriptInstance_t : __int32
|
||||
{
|
||||
SCRIPTINSTANCE_SERVER = 0x0,
|
||||
SCRIPTINSTANCE_CLIENT = 0x1,
|
||||
SCRIPTINSTANCE_MAX = 0x2,
|
||||
};
|
||||
|
||||
typedef float vec4_t[4];
|
||||
|
||||
struct LuaFile {
|
||||
uintptr_t name;
|
||||
uintptr_t unk;
|
||||
@ -511,8 +518,105 @@ struct __declspec(align(4)) GSC_EXPORT_ITEM
|
||||
uint8_t flags;
|
||||
};
|
||||
|
||||
union DvarLimits
|
||||
{
|
||||
struct
|
||||
{
|
||||
int stringCount;
|
||||
const char** strings;
|
||||
} enumeration;
|
||||
|
||||
struct
|
||||
{
|
||||
int min;
|
||||
int max;
|
||||
} integer;
|
||||
|
||||
struct
|
||||
{
|
||||
int64_t min;
|
||||
int64_t max;
|
||||
} integer64;
|
||||
|
||||
struct
|
||||
{
|
||||
uint64_t min;
|
||||
uint64_t max;
|
||||
} unsignedInt64;
|
||||
|
||||
struct
|
||||
{
|
||||
float min;
|
||||
float max;
|
||||
} value;
|
||||
|
||||
struct
|
||||
{
|
||||
float min;
|
||||
float max;
|
||||
} vector;
|
||||
};
|
||||
|
||||
struct dvar_t;
|
||||
|
||||
struct DvarValue
|
||||
{
|
||||
union
|
||||
{
|
||||
bool enabled;
|
||||
int integer;
|
||||
uint32_t unsignedInt;
|
||||
int64_t integer64;
|
||||
uint64_t unsignedInt64;
|
||||
float value;
|
||||
vec4_t vector;
|
||||
const char* string;
|
||||
byte color[4];
|
||||
const dvar_t* indirect[3];
|
||||
} naked;
|
||||
|
||||
uint64_t encrypted;
|
||||
};
|
||||
|
||||
struct DvarData
|
||||
{
|
||||
DvarValue current;
|
||||
DvarValue latched;
|
||||
DvarValue reset;
|
||||
};
|
||||
|
||||
struct DvarName
|
||||
{
|
||||
__int64 hash;
|
||||
__int64 null;
|
||||
};
|
||||
|
||||
struct dvar_t
|
||||
{
|
||||
DvarName name;
|
||||
DvarData* value;
|
||||
dvarType_t type;
|
||||
unsigned int flags;
|
||||
DvarLimits domain;
|
||||
char padding_unk1[8];
|
||||
};
|
||||
|
||||
struct gentity_t
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
typedef void (*xcommand_t)(void);
|
||||
|
||||
struct cmd_function_t
|
||||
{
|
||||
cmd_function_t* next;
|
||||
__int64 name;
|
||||
const char* autoCompleteDir;
|
||||
const char* autoCompleteExt;
|
||||
xcommand_t function;
|
||||
};
|
||||
|
||||
void nlog(const char* str, ...);
|
||||
uintptr_t find_pattern(const char* module_name, const char* pattern);
|
||||
uintptr_t find_pattern(uintptr_t start, const char* module_name, const char* pattern);
|
||||
|
||||
@ -533,8 +637,3 @@ size_t reverse_b(const void* val);
|
||||
size_t operator"" _g(size_t val);
|
||||
size_t reverse_g(size_t val);
|
||||
size_t reverse_g(const void* val);
|
||||
|
||||
void log(std::string str);
|
||||
void log(const char* fmt, ...);
|
||||
|
||||
extern void* exception_handler_handle;
|
||||
|
Binary file not shown.
Binary file not shown.
@ -58,6 +58,7 @@ void game_console::KeyboardHandle(WPARAM wParam, int key, char chKey)
|
||||
|
||||
_Cbuf_AddText(0, &g_console.szBuffer[g_console.start]);
|
||||
}
|
||||
printf("T9> %s\n", &g_console.szBuffer[g_console.start]);
|
||||
|
||||
g_console.bopen = false;
|
||||
memset(szBuffer, 0, 4096);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -88,7 +88,6 @@ void SetMode(int mode, int menu) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void* RtlAddVectoredExceptionHandler(LONG First, PVECTORED_EXCEPTION_HANDLER Handler) {
|
||||
utils::nt::library ntdll(("ntdll.dll"));
|
||||
ntdll.invoke<void*>(("RtlAddVectoredExceptionHandler"), First, Handler);
|
||||
@ -227,4 +226,85 @@ void Cbuf_AddText(const char* cmd)
|
||||
}
|
||||
}
|
||||
|
||||
const uint64_t fnvHash(const char* data)
|
||||
{
|
||||
uint64_t result = 0xCBF29CE484222325;
|
||||
|
||||
for (size_t i = 0; i < strlen(data); i++)
|
||||
{
|
||||
uint64_t value = tolower(data[i]);
|
||||
|
||||
if (value == '\\')
|
||||
value = '/';
|
||||
|
||||
result = 0x100000001B3 * (value ^ result);
|
||||
}
|
||||
|
||||
return result & 0x7FFFFFFFFFFFFFFF;
|
||||
}
|
||||
|
||||
// build 1.34.0.15931218
|
||||
|
||||
dvar_t* Dvar_FindVar(__int64 dvar) {
|
||||
auto func = reinterpret_cast<dvar_t * (*)(__int64)>(0x14C0B2090_g);
|
||||
return func(dvar);
|
||||
}
|
||||
const dvar_t* Dvar_RegisterInt(__int64 hash, const char* dvarName, int value, int min, int max, unsigned int flags) {
|
||||
printf("[%s] Registering int 0x%llX with value %d\n", __FUNCTION__, hash, value);
|
||||
auto func = reinterpret_cast<const dvar_t * (*)(__int64, const char*, int, int, int, unsigned int)>(0x14C0C7360_g);
|
||||
return func(hash, dvarName, value, min, max, flags);
|
||||
}
|
||||
void Dvar_SetInt(dvar_t* dvar, int value, int a3) {
|
||||
auto func = reinterpret_cast<void(*)(dvar_t*, int, int)>(0x14C0B7B90_g);
|
||||
func(dvar, value, a3);
|
||||
}
|
||||
|
||||
void Dvar_SetIntByHash(__int64 hash, int value) {
|
||||
dvar_t* dvar = Dvar_FindVar(hash);
|
||||
// if not found we should try to register it
|
||||
if (!dvar) {
|
||||
Dvar_RegisterInt(hash, 0, 1, 1, 1, 0);
|
||||
}
|
||||
else {
|
||||
Dvar_SetInt(dvar, value, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void Dvar_SetVariantByHash(__int64 hash, DvarValue value)
|
||||
{
|
||||
auto Dvar_SetVariant = reinterpret_cast<void(*)(dvar_t* dvar, DvarValue value, int setSource)>(0xC0B8DB0_b);
|
||||
|
||||
dvar_t* dvar = Dvar_FindVar(hash);
|
||||
if (dvar)
|
||||
{
|
||||
Dvar_SetVariant(dvar, value, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Dvar 0x%p doesn't exist.\n", hash);
|
||||
}
|
||||
}
|
||||
|
||||
gentity_t* SV_AddTestClient(const char* name, const char* unk) {
|
||||
auto func = reinterpret_cast<gentity_t * (*)(const char*, const char*)>(0x147189410_g);
|
||||
return func(name, unk);
|
||||
}
|
||||
|
||||
void Scr_AddEntity(scriptInstance_t inst, gentity_t* ent, unsigned int classNum) {
|
||||
auto func = reinterpret_cast<void(*)(scriptInstance_t, gentity_t*, unsigned int)>(0x14737F490_g);
|
||||
func(inst, ent, classNum);
|
||||
}
|
||||
|
||||
void AddTestClient() {
|
||||
gentity_t* client = SV_AddTestClient(0, 0);
|
||||
if (client)
|
||||
Scr_AddEntity(SCRIPTINSTANCE_SERVER, client, 0);
|
||||
}
|
||||
|
||||
void Cmd_AddCommandInternal(const char* cmdName, xcommand_t function, cmd_function_t* allocedCmd) {
|
||||
__int64 hash = fnvHash(cmdName);
|
||||
auto func = reinterpret_cast<void(*)(__int64, xcommand_t, cmd_function_t*)>(0x149ACBAD0_g);
|
||||
func(hash, function, allocedCmd);
|
||||
}
|
||||
|
||||
Addresses g_Addrs;
|
||||
|
@ -59,7 +59,6 @@ struct Addresses {
|
||||
uintptr_t watermark_font;
|
||||
uintptr_t dvar_show_over_stack;
|
||||
|
||||
|
||||
uintptr_t CL_DrawTextPhysical;
|
||||
|
||||
uintptr_t R_AddCmdDrawStretchPic;
|
||||
@ -81,8 +80,7 @@ struct Addresses {
|
||||
|
||||
uintptr_t shader_white;
|
||||
|
||||
// not named yet
|
||||
uintptr_t DAT_180011dc0;
|
||||
uintptr_t dvar_noDW;
|
||||
|
||||
uintptr_t Cbuf_AddText;
|
||||
uintptr_t CbufAddtextFunc;
|
||||
@ -108,6 +106,12 @@ enum LobbyNetworkMode
|
||||
|
||||
typedef uint32_t ScrVarIndex_t;
|
||||
struct ScrVmContext_t;
|
||||
struct dvar_t;
|
||||
typedef void (*xcommand_t)(void);
|
||||
struct cmd_function_t;
|
||||
struct gentity_t;
|
||||
enum scriptInstance_t;
|
||||
struct DvarValue;
|
||||
|
||||
void Dvar_SetBoolFromSource(uintptr_t dvar, bool value, int source);
|
||||
void Dvar_SetStringFromSource(uintptr_t dvar, const char* value, int source);
|
||||
@ -161,4 +165,26 @@ void LobbyHostBots_AddBotsToLobby(unsigned int lobbyType, int numBots, bool para
|
||||
|
||||
void Cbuf_AddText(const char* cmd);
|
||||
|
||||
const uint64_t fnvHash(const char* data);
|
||||
|
||||
// build 1.34.0.15931218
|
||||
|
||||
dvar_t* Dvar_FindVar(__int64 dvar);
|
||||
|
||||
const dvar_t* Dvar_RegisterInt(__int64 hash, const char* dvarName, int value, int min, int max, unsigned int flags);
|
||||
|
||||
void Dvar_SetInt(dvar_t* dvar, int value, int a3);
|
||||
|
||||
void Dvar_SetIntByHash(__int64 hash, int value);
|
||||
|
||||
void Dvar_SetVariantByHash(__int64 hash, DvarValue value);
|
||||
|
||||
gentity_t* SV_AddTestClient(const char* name, const char* unk);
|
||||
|
||||
void Scr_AddEntity(scriptInstance_t inst, gentity_t* ent, unsigned int classNum);
|
||||
|
||||
void AddTestClient();
|
||||
|
||||
void Cmd_AddCommandInternal(const char* cmdName, xcommand_t function, cmd_function_t* allocedCmd);
|
||||
|
||||
extern Addresses g_Addrs;
|
||||
|
@ -42,13 +42,13 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
@ -81,12 +81,12 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>discord_game_sdk</TargetName>
|
||||
<LibraryPath>D:\Dokumente\CoDBOCW\bocw-of-main\lib;$(LibraryPath)</LibraryPath>
|
||||
<LibraryPath>$(SolutionDir)\lib;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>discord_game_sdk</TargetName>
|
||||
<LibraryPath>D:\Dokumente\CoDBOCW\bocw-of-main\lib;$(LibraryPath)</LibraryPath>
|
||||
<LibraryPath>$(SolutionDir)\lib;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
@ -139,7 +139,7 @@
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<CreateHotpatchableImage>false</CreateHotpatchableImage>
|
||||
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
|
Binary file not shown.
BIN
lib/minhook.lib
BIN
lib/minhook.lib
Binary file not shown.
Loading…
Reference in New Issue
Block a user