2023-06-06 00:23:08 +03:00
|
|
|
#include <utils.h>
|
2023-06-08 21:44:42 +03:00
|
|
|
#include <msg.h>
|
2023-06-06 00:23:08 +03:00
|
|
|
|
2023-06-06 21:14:21 +03:00
|
|
|
#include <game.h>
|
2023-06-06 00:23:08 +03:00
|
|
|
|
2023-08-04 00:19:02 +03:00
|
|
|
const char *HI3_BASE_MODULE_NAME = "BH3Base.dll";
|
2023-08-02 01:39:39 +03:00
|
|
|
const char *HI3_ASSEMBLY_NAME = "UserAssembly.dll";
|
2023-06-08 18:36:22 +03:00
|
|
|
const char *HI3_TVM_SECTION_NAME = ".tvm0";
|
2023-06-06 00:23:08 +03:00
|
|
|
|
|
|
|
|
struct crc_id_pair {
|
|
|
|
|
uint32_t crc;
|
|
|
|
|
enum game_id id;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const struct crc_id_pair HI3_REGIONS[] = {
|
|
|
|
|
// It may be possible to get rid of region-specific data altogether in the future
|
|
|
|
|
|
2023-08-03 09:07:18 +03:00
|
|
|
{ 0xcb8041ff, GAME_HI3_GLB }, // glb v6.8.0
|
|
|
|
|
{ 0x104cbfc5, GAME_HI3_SEA }, // sea v6.8.0
|
2023-08-02 23:32:12 +03:00
|
|
|
{ 0x2efd9099, GAME_HI3_CN }, // cn v6.8.0
|
2023-08-03 09:07:18 +03:00
|
|
|
{ 0x30fa5b0f, GAME_HI3_TW }, // tw v6.8.0
|
|
|
|
|
{ 0xe47327fb, GAME_HI3_KR }, // kr v6.8.0
|
|
|
|
|
{ 0x992b6b63, GAME_HI3_JP } // jp v6.8.0
|
2023-06-06 00:23:08 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void hi3_fill_data(struct game_data *buf) {
|
2023-08-04 21:09:16 +03:00
|
|
|
uint32_t crc = utils_file_crc32c(L"UnityPlayer.dll");
|
2023-06-06 00:23:08 +03:00
|
|
|
|
|
|
|
|
enum game_id id = GAME_INVALID;
|
|
|
|
|
for (size_t i = 0; i < sizeof(HI3_REGIONS) / sizeof(struct crc_id_pair); i++) {
|
|
|
|
|
if (HI3_REGIONS[i].crc == crc) {
|
|
|
|
|
id = HI3_REGIONS[i].id;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (id == GAME_INVALID) {
|
2023-06-23 20:00:27 +03:00
|
|
|
msg_err_a("Invalid UnityPlayer.dll checksum: %x", crc);
|
2023-06-06 00:23:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buf->id = id;
|
2023-08-04 00:19:02 +03:00
|
|
|
buf->base_module_name = HI3_BASE_MODULE_NAME;
|
2023-08-02 01:39:39 +03:00
|
|
|
buf->assembly_name = HI3_ASSEMBLY_NAME;
|
2023-06-06 00:23:08 +03:00
|
|
|
buf->tvm_section_name = HI3_TVM_SECTION_NAME;
|
2023-06-08 20:13:21 +03:00
|
|
|
|
|
|
|
|
buf->unityplayer_callback = NULL;
|
2023-06-06 00:23:08 +03:00
|
|
|
}
|