Implement shared resources fix for HSR

This commit is contained in:
mkrsym1
2023-06-08 20:13:21 +03:00
parent 2584898be6
commit 38dbf82f7f
4 changed files with 27 additions and 1 deletions

View File

@ -20,6 +20,21 @@ const struct crc_id_pair HSR_REGIONS[] = {
{ 0x3e644d26, GAME_HSR_CN } // cn v1.1.0
};
static void _unityplayer_callback(HMODULE unityModule) {
// Disable shared resources
// Temporarily hardcoded offset
// v1.1.0, same for os and cn
unsigned char *srAddr = ((unsigned char*)unityModule) + 0x16430;
DWORD oldProtect;
VirtualProtect(srAddr, 1, PAGE_EXECUTE_READWRITE, &oldProtect);
*srAddr = 0xC3; // ret
VirtualProtect(srAddr, 1, oldProtect, &oldProtect);
}
void hsr_fill_data(struct game_data *buf) {
uint32_t crc = utils_file_crc32c("UnityPlayer.dll");
@ -39,4 +54,6 @@ void hsr_fill_data(struct game_data *buf) {
buf->assembly_path = HSR_ASSEMBLY_PATH;
buf->tp6_section_name = HSR_TP6_SECTION_NAME;
buf->tvm_section_name = HSR_TVM_SECTION_NAME;
buf->unityplayer_callback = &_unityplayer_callback;
}