Implement configuration variables

This commit is contained in:
mkrsym1
2023-06-08 22:33:37 +03:00
parent 8662c84a0a
commit f8954d0857
4 changed files with 30 additions and 1 deletions

View File

@ -3,3 +3,5 @@
#include <stdint.h>
uint32_t utils_file_crc32c(const char *filePath);
char utils_env_enabled(const char *env);

View File

@ -21,6 +21,11 @@ const struct crc_id_pair HSR_REGIONS[] = {
};
static void _unityplayer_callback(HMODULE unityModule) {
if (utils_env_enabled("SRFIX_DISABLE")) {
msg_info_a("Shared resources fix disabled. The game may not work");
return;
}
// Disable shared resources
// Temporarily hardcoded offset
@ -36,6 +41,12 @@ static void _unityplayer_callback(HMODULE unityModule) {
}
void hsr_fill_data(struct game_data *buf) {
if (!utils_env_enabled("I_WANT_A_BAN")) {
msg_err_a("Using this tool with HSR is unsafe. Refer to the readme for more details");
} else {
msg_warn_a("Using this tool with HSR will most likely result in a ban. Please only use testing accounts");
}
uint32_t crc = utils_file_crc32c("UnityPlayer.dll");
enum game_id id = GAME_INVALID;

View File

@ -28,3 +28,8 @@ uint32_t utils_file_crc32c(const char *filePath) {
return crc;
}
char utils_env_enabled(const char *env) {
char *envText = getenv(env);
return envText && strcmp(envText, "") != 0;
}