-
-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now patching all calls to trampolines
- Loading branch information
Showing
12 changed files
with
14,141 additions
and
487 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ | |
*.user | ||
x64/ | ||
Win32/ | ||
cyberpunk_amd_patch/vsxmake2019/* |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include "Image.h" | ||
#include <windows.h> | ||
#include <zlib.h> | ||
#include <spdlog/spdlog.h> | ||
#include <dbghelp.h> | ||
#include <sstream> | ||
|
||
Image::Image() | ||
{ | ||
auto* pImage = GetModuleHandleA(nullptr); | ||
|
||
IMAGE_NT_HEADERS* pHeader = ImageNtHeader(pImage); | ||
auto* pSectionHeaders = reinterpret_cast<IMAGE_SECTION_HEADER*>(pHeader + 1); | ||
|
||
base_address = reinterpret_cast<uintptr_t>(pImage); | ||
|
||
for (auto count = 0u; count < pHeader->FileHeader.NumberOfSections; ++count) | ||
{ | ||
if (memcmp(pSectionHeaders->Name, ".text", 5) == 0) | ||
{ | ||
pTextStart = reinterpret_cast<uint8_t*>(base_address + pSectionHeaders->VirtualAddress); | ||
pTextEnd = reinterpret_cast<uint8_t*>(base_address + pSectionHeaders->VirtualAddress + pSectionHeaders->Misc.VirtualSize); | ||
} | ||
|
||
++pSectionHeaders; | ||
} | ||
|
||
uint32_t crc = crc32(0, pTextStart, pTextEnd - pTextStart); | ||
std::ostringstream oss; | ||
oss << crc; | ||
|
||
spdlog::info("Computed .text crc: {:X}", crc); | ||
|
||
switch(crc) | ||
{ | ||
case 3622375216: | ||
spdlog::info("\tResolved to version: 1.04"); | ||
version = MakeVersion(1,4); | ||
break; | ||
default: | ||
spdlog::error("\tUnknown version, please update the mod"); | ||
break; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#pragma once | ||
|
||
#include <cstdint> | ||
|
||
struct Image | ||
{ | ||
Image(); | ||
|
||
static uint64_t MakeVersion(uint64_t aMajor, uint64_t aMinor) | ||
{ | ||
return aMajor << 32 | aMinor << 16; | ||
} | ||
|
||
uint64_t version; | ||
uintptr_t base_address; | ||
uint8_t* pTextStart; | ||
uint8_t* pTextEnd; | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.