Implemented experimental patching method for SR
This commit is contained in:
parent
2da21065a6
commit
ecbab96427
@ -70,25 +70,53 @@ static void _unityplayer_callback(HMODULE unityModule) {
|
|||||||
utils_write_protected_memory(wtsud_patch_addr, payload, sizeof(payload));
|
utils_write_protected_memory(wtsud_patch_addr, payload, sizeof(payload));
|
||||||
}
|
}
|
||||||
|
|
||||||
void hsr_fill_data(struct game_data *buf) {
|
static void _break_cryptcat() {
|
||||||
uint32_t crc = utils_file_crc32c(L"UnityPlayer.dll");
|
const char STUB[] = {
|
||||||
|
0xB8, 0x01, 0x00, 0x00, 0x00, // mov eax, 1
|
||||||
|
0xC3 // ret
|
||||||
|
};
|
||||||
|
|
||||||
enum hsr_region id = HSR_INVALID;
|
const char *STUB_FUNCTIONS[] = {
|
||||||
for (size_t i = 0; i < UTILS_COUNT(HSR_REGIONS); i++) {
|
"CryptCATAdminEnumCatalogFromHash",
|
||||||
if (HSR_REGIONS[i].crc == crc) {
|
"CryptCATCatalogInfoFromContext",
|
||||||
id = HSR_REGIONS[i].id;
|
"CryptCATAdminReleaseCatalogContext"
|
||||||
break;
|
};
|
||||||
}
|
|
||||||
|
HMODULE wintrust = LoadLibraryA("wintrust.dll");
|
||||||
|
|
||||||
|
for (size_t i = 0; i < UTILS_COUNT(STUB_FUNCTIONS); i++) {
|
||||||
|
void *fn = GetProcAddress(wintrust, STUB_FUNCTIONS[i]);
|
||||||
|
utils_write_protected_memory(fn, STUB, sizeof(STUB));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (id == HSR_INVALID) {
|
void hsr_fill_data(struct game_data *buf) {
|
||||||
msg_err_a("Invalid UnityPlayer.dll checksum: 0x%08x. This patch is intended to be used with HSR v" HSR_VERSION, crc);
|
if (!utils_env_enabled("BREAK_CRYPTCAT")) {
|
||||||
|
uint32_t crc = utils_file_crc32c(L"UnityPlayer.dll");
|
||||||
|
|
||||||
|
enum hsr_region id = HSR_INVALID;
|
||||||
|
for (size_t i = 0; i < UTILS_COUNT(HSR_REGIONS); i++) {
|
||||||
|
if (HSR_REGIONS[i].crc == crc) {
|
||||||
|
id = HSR_REGIONS[i].id;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id == HSR_INVALID) {
|
||||||
|
msg_err_a("Invalid UnityPlayer.dll checksum: 0x%08x. This patch is intended to be used with HSR v" HSR_VERSION, crc);
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteTextureStatisticUserData patch
|
||||||
|
buf->unityplayer_callback = &_unityplayer_callback;
|
||||||
|
} else {
|
||||||
|
msg_warn_a("Using experimental patching method");
|
||||||
|
_break_cryptcat();
|
||||||
|
|
||||||
|
buf->unityplayer_callback = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf->base_module_name = HSR_BASE_MODULE_NAME;
|
buf->base_module_name = HSR_BASE_MODULE_NAME;
|
||||||
buf->assembly_path = HSR_ASSEMBLY_PATH;
|
buf->assembly_path = HSR_ASSEMBLY_PATH;
|
||||||
buf->txs_section_name = HSR_TXS_SECTION_NAME;
|
buf->txs_section_name = HSR_TXS_SECTION_NAME;
|
||||||
buf->tvm_section_name = HSR_TVM_SECTION_NAME;
|
buf->tvm_section_name = HSR_TVM_SECTION_NAME;
|
||||||
|
|
||||||
buf->unityplayer_callback = &_unityplayer_callback;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user