Initial HSR support
This commit is contained in:
42
game_payload/src/hsr.c
Normal file
42
game_payload/src/hsr.c
Normal file
@ -0,0 +1,42 @@
|
||||
#include <utils.h>
|
||||
#include <err.h>
|
||||
|
||||
#include <game.h>
|
||||
|
||||
const char *HSR_NAME = "StarRail";
|
||||
const char *HSR_ASSEMBLY_PATH = "GameAssembly.dll";
|
||||
const char *HSR_TP6_SECTION_NAME = ".ace";
|
||||
const char *HSR_TVM_SECTION_NAME = ".tvm0";
|
||||
|
||||
struct crc_id_pair {
|
||||
uint32_t crc;
|
||||
enum game_id id;
|
||||
};
|
||||
|
||||
const struct crc_id_pair HSR_REGIONS[] = {
|
||||
// It may be possible to get rid of region-specific data altogether in the future
|
||||
|
||||
{ 0x2df53005, GAME_HSR_OS }, // os v1.1.0
|
||||
{ 0x3e644d26, GAME_HSR_CN } // cn v1.1.0
|
||||
};
|
||||
|
||||
void hsr_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(HSR_REGIONS) / sizeof(struct crc_id_pair); i++) {
|
||||
if (HSR_REGIONS[i].crc == crc) {
|
||||
id = HSR_REGIONS[i].id;
|
||||
}
|
||||
}
|
||||
|
||||
if (id == GAME_INVALID) {
|
||||
err_mb_a("Invalid UnityPlayer.dll checksum: %d", crc);
|
||||
}
|
||||
|
||||
buf->id = id;
|
||||
buf->name = HSR_NAME;
|
||||
buf->assembly_path = HSR_ASSEMBLY_PATH;
|
||||
buf->tp6_section_name = HSR_TP6_SECTION_NAME;
|
||||
buf->tvm_section_name = HSR_TVM_SECTION_NAME;
|
||||
}
|
||||
Reference in New Issue
Block a user