Implement a better workaround for different HI3 editions having different section names
This commit is contained in:
parent
e96bf23a30
commit
57b2423a8a
@ -1,5 +1,7 @@
|
|||||||
#include <utils.h>
|
#include <utils.h>
|
||||||
#include <msg.h>
|
#include <msg.h>
|
||||||
|
#include <pe.h>
|
||||||
|
#include <main.h>
|
||||||
|
|
||||||
#include <game.h>
|
#include <game.h>
|
||||||
|
|
||||||
@ -12,15 +14,18 @@ const char *HI3_TVM_SECTION_NAME = ".tvm0";
|
|||||||
|
|
||||||
|
|
||||||
void hi3_fill_data(struct game_data *buf) {
|
void hi3_fill_data(struct game_data *buf) {
|
||||||
// !!! TEMPORARY WORKAROUND FOR HI3 6.8.0 -> 6.9.0
|
// !!! TEMPORARY WORKAROUND
|
||||||
const uint32_t NEW_CHECKSUM = 0x885b4c63;
|
// Name in exe matches name in base module
|
||||||
|
HMODULE exe = GetModuleHandleA(NULL);
|
||||||
uint32_t crc = utils_file_crc32c(L"UnityPlayer.dll");
|
if (pe_find_section(exe, HI3_TXS_SECTION_NAME_OLD)) {
|
||||||
|
// Old name
|
||||||
if (crc == NEW_CHECKSUM) {
|
buf->txs_section_name = HI3_TXS_SECTION_NAME_OLD;
|
||||||
|
} else if (pe_find_section(exe, HI3_TXS_SECTION_NAME_NEW)) {
|
||||||
|
// New name
|
||||||
buf->txs_section_name = HI3_TXS_SECTION_NAME_NEW;
|
buf->txs_section_name = HI3_TXS_SECTION_NAME_NEW;
|
||||||
} else {
|
} else {
|
||||||
buf->txs_section_name = HI3_TXS_SECTION_NAME_OLD;
|
// This should not happen
|
||||||
|
msg_err_a("Could not determine region-specific section name. " ISSUE_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
buf->base_module_name = HI3_BASE_MODULE_NAME;
|
buf->base_module_name = HI3_BASE_MODULE_NAME;
|
||||||
|
Loading…
Reference in New Issue
Block a user