From f8954d0857d49389de35cabcc68208a37835c541 Mon Sep 17 00:00:00 2001 From: mkrsym1 Date: Thu, 8 Jun 2023 22:33:37 +0300 Subject: [PATCH] Implement configuration variables --- README.md | 13 ++++++++++++- game_payload/include/utils.h | 2 ++ game_payload/src/hsr.c | 11 +++++++++++ game_payload/src/utils.c | 5 +++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b5302bf..58c2978 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,11 @@ # PROOF OF CONCEPT. DO NOT USE IF YOU DON'T KNOW WHAT YOU'RE DOING ### Games and regions -This project is in the proof-of-concept stage. Currently, only **3rd glb v6.6.0** is supported. It may be possilbe to completely remove the region and version-specific data in the future. Refer to the source code in `game_payload/src` for details. +3rd: glb v6.6.0 + +SR: os/cn v1.1.0 (unsafe, refer to [configuration](#configuration)) + +It may be possilbe to completely remove the region and version-specific data in the future. Refer to the source code in `game_payload/src` for details. ### Information The anticheat the games use is fundamentally incompatible with Wine in multiple ways. This tool launches the game without it (`injector/launcher_payload`) and imitates it's behaviour (`game_payload`). @@ -24,6 +28,13 @@ Manual usage instructions: This tool is capable of starting the games from a different process. This may be useful for spoofing the parent process (SR is known to report it). Use `wine jadeite.exe "Z:\\wine\\path\\to\\game.exe" "Z:\\wine\\path\\to\\launcher.exe"`. `explorer.exe` is used as the default. +### Configuration +These environment variables can be used to configure the behaviour of the tool. + +SR-exclusive: +- `I_WANT_A_BAN=1` - allows to launch HSR. Please only use testing accounts, as there is an extremely high risk of getting banned +- `SRFIX_DISABLE=1` - disable shared resources fix + ### Internals This tool consists of three parts: the main injector (`injector`), the launcher payload (`injector/launcher_payload`) and the game payload (`game_payload`). diff --git a/game_payload/include/utils.h b/game_payload/include/utils.h index 2a2a876..a308fe6 100644 --- a/game_payload/include/utils.h +++ b/game_payload/include/utils.h @@ -3,3 +3,5 @@ #include uint32_t utils_file_crc32c(const char *filePath); + +char utils_env_enabled(const char *env); diff --git a/game_payload/src/hsr.c b/game_payload/src/hsr.c index 332ddd4..cd07056 100644 --- a/game_payload/src/hsr.c +++ b/game_payload/src/hsr.c @@ -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; diff --git a/game_payload/src/utils.c b/game_payload/src/utils.c index d71cd56..051b2fe 100644 --- a/game_payload/src/utils.c +++ b/game_payload/src/utils.c @@ -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; +}