jadeite/game_payload/src/hi3.c

45 lines
1.2 KiB
C
Raw Normal View History

2023-06-05 21:23:08 +00:00
#include <utils.h>
2023-06-08 18:44:42 +00:00
#include <msg.h>
2023-06-05 21:23:08 +00:00
2023-06-06 18:14:21 +00:00
#include <game.h>
2023-06-05 21:23:08 +00:00
2023-06-08 15:36:22 +00:00
const char *HI3_NAME = "BH3";
const char *HI3_ASSEMBLY_PATH = "BH3_Data/Native/UserAssembly.dll";
const char *HI3_TP6_SECTION_NAME = ".bh3";
const char *HI3_TVM_SECTION_NAME = ".tvm0";
2023-06-05 21:23:08 +00:00
struct crc_id_pair {
uint32_t crc;
enum game_id id;
};
const struct crc_id_pair HI3_REGIONS[] = {
// Only glb for now
// It may be possible to get rid of region-specific data altogether in the future
2023-06-29 09:58:57 +00:00
{ 0x45221647, GAME_HI3_GLB } // glb v6.7.0
2023-06-05 21:23:08 +00:00
};
void hi3_fill_data(struct game_data *buf) {
uint32_t crc = utils_file_crc32c("UnityPlayer.dll");
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) {
msg_err_a("Invalid UnityPlayer.dll checksum: %x", crc);
2023-06-05 21:23:08 +00:00
}
buf->id = id;
buf->name = HI3_NAME;
buf->assembly_path = HI3_ASSEMBLY_PATH;
buf->tp6_section_name = HI3_TP6_SECTION_NAME;
buf->tvm_section_name = HI3_TVM_SECTION_NAME;
2023-06-08 17:13:21 +00:00
buf->unityplayer_callback = NULL;
2023-06-05 21:23:08 +00:00
}