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

@ -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`).

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;
}