11 Commits

Author SHA1 Message Date
326ccd188e v1.1.2 2023-06-11 18:05:58 +03:00
0b0216e41e Pass commandline arguments to the game process
Closes #4
2023-06-11 18:04:24 +03:00
4c0c35ba43 Mark HSR unsafe for third-party launchers 2023-06-10 19:39:57 +03:00
e299d264de Don't include metadata.json in the release archives 2023-06-10 19:37:09 +03:00
cba9b20171 v1.1.1 2023-06-10 19:24:07 +03:00
5640987ead metadata.json for third-party launchers 2023-06-10 19:19:11 +03:00
54a127b848 Minor injector and launcher payload refactoring 2023-06-10 18:28:19 +03:00
3994188b08 Add WAIT_BEFORE_RESUME envvar 2023-06-10 18:23:43 +03:00
7ffce8fe3a Update readme 2023-06-10 13:07:47 +03:00
5143dc0d56 Minor readme styling changes 2023-06-09 21:10:44 +03:00
0afdf60cc6 Add HSR logging servers to SERVERS.txt 2023-06-08 23:01:07 +03:00
7 changed files with 108 additions and 39 deletions

View File

@ -1,38 +1,43 @@
# PROOF OF CONCEPT. DO NOT USE IF YOU DON'T KNOW WHAT YOU'RE DOING
### Games and regions ### Games and regions
3rd: glb v6.6.0 - **3rd**: glb v6.6.0
- **SR**: os/cn v1.1.0 (unsafe, refer to [configuration](#configuration))
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. 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 ### 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`). 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`).
Does not work on Windows. **SR-specific**: this tool disables the use of DirectX shared resources in a rather hacky way. It is required, as there is no (and most likely never will be) shared resources support in DirectX translation layers (WineD3D/DXVK). Refer to [configuration](#configuration) if you wish to run the game without the fix.
**Using third-party software (such as this tool) with the games violates their Terms of Service**. Therefore, **you may receive a ban**. No bans were ever reported with 3rd, however the legacy patch for SR did cause many. **Use at your own risk and only if you understand all the possible consequences**.
**This is not a cheating tool**. Using it with Windows is not possible, and Windows support is not planned or intended in any way. However, as it does not perform any on-disk file modifications, you may reuse the same game install for Windows if you have a dual-boot setup.
### Usage ### Usage
**Refer to [Third-party launchers](#third-party-launchers) (will be written later)** for convenient usage. If you don't want to (or can't) use third-party launchers, continue reading the section below. **Refer to [third-party launchers](#third-party-launchers) (will be written later)** for convenient usage. If you don't want to (or can't) use third-party launchers, continue reading the section below.
**Wine 8.0+ is recommended**, as lower versions leak "The Wine project" as the device identifier. Not critical, but taking a precaution never hurt anyone. **DXVK is strongly recommended.** **Wine 8.0+ is recommended**, as lower versions leak "The Wine project" as the device identifier. Not critical, but taking a precaution never hurt anyone. **DXVK is strongly recommended.**
3rd-specific: In some cases, and if you're not using Proton GE, **a fix for Media Foundation may be required to play videos. The Game may crash without it.** You can download it from [here](https://github.com/z0z0z/mf-install). You might need to [limit the number of cores available to the game](https://github.com/z0z0z/mf-install/issues/44) if your CPU has more than 8. **3rd-specific**: In some cases, and if you're not using Proton GE, **a fix for Media Foundation may be required to play videos. The Game may crash without it.** You can download it from [here](https://github.com/z0z0z/mf-install). You might need to [limit the number of cores available to the game](https://github.com/z0z0z/mf-install/issues/44) if your CPU has more than 8.
Manual usage instructions: Manual usage instructions:
- Download the game you want to run - Download the game you want to run
- Download a release from this repository - Download a release from this repository
- Extract the archive (**NOT INTO THE GAME DIRECTORY! THIS IS IMPORTANT!**) - Extract the archive (**NOT INTO THE GAME DIRECTORY! THIS IS IMPORTANT!**)
- Block analytics servers in your `hosts` file. You can find the list in SERVERS.txt - Block analytics servers in your `hosts` file. You can find the list in SERVERS.txt
- Run `wine jadeite.exe "Z:\\wine\\path\\to\\game.exe"` - Run `wine jadeite.exe 'Z:\wine\path\to\game.exe'`
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. 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.
To pass commandline arguments to the game, append them after the launcher path: `wine jadeite.exe 'Z:\wine\path\to\game.exe' 'Z:\wine\path\to\launcher.exe' -arg1 -arg2 -arg3`. To use the default launcher process, use `--`: `wine jadeite.exe 'Z:\wine\path\to\game.exe' -- -arg1 -arg2 -arg3`.
### Configuration ### Configuration
These environment variables can be used to configure the behaviour of the tool. These environment variables can be used to configure the behaviour of the tool.
SR-exclusive: - `WAIT_BEFORE_RESUME=1` - show a messagebox and wait for user input before resuming the game process. Useful on my side for debugging
- `I_WANT_A_BAN=1` - allows to launch HSR. Please only use testing accounts, as there is an extremely high risk of getting banned
**SR-exclusive**:
- `I_WANT_A_BAN=1` - allows to launch SR. Please only use testing accounts, as there is an extremely high risk of getting banned
- `SRFIX_DISABLE=1` - disable shared resources fix - `SRFIX_DISABLE=1` - disable shared resources fix
### Internals ### Internals

View File

@ -2,3 +2,11 @@
0.0.0.0 log-upload-os.hoyoverse.com 0.0.0.0 log-upload-os.hoyoverse.com
0.0.0.0 sg-public-data-api.hoyoverse.com 0.0.0.0 sg-public-data-api.hoyoverse.com
0.0.0.0 dump.gamesafe.qq.com 0.0.0.0 dump.gamesafe.qq.com
# Honkai Star Rail logging servers (oversea)
0.0.0.0 log-upload-os.hoyoverse.com
0.0.0.0 sg-public-data-api.hoyoverse.com
# Honkai Star Rail logging servers (China)
0.0.0.0 log-upload.mihoyo.com
0.0.0.0 public-data-api.mihoyo.com

View File

@ -1,7 +1,10 @@
#include <windows.h> #include <windows.h>
const char ENV_EXE_PATH[] = "JADEITE_TARGET_EXE_PATH"; #define EPFX "__JADEITE_"
const char ENV_DLL_PATH[] = "JADEITE_INJECT_DLL_PATH";
const char ENV_EXE_PATH[] = EPFX"TARGET_EXE_PATH";
const char ENV_DLL_PATH[] = EPFX"INJECT_DLL_PATH";
const char ENV_PROC_CMD[] = EPFX"PROCESS_COMMAND";
static inline void write_protected_process_memory(HANDLE process, void *address, const void *buf, size_t size) { static inline void write_protected_process_memory(HANDLE process, void *address, const void *buf, size_t size) {
DWORD oldProtect; DWORD oldProtect;

View File

@ -4,11 +4,6 @@
#include <lpayload.h> #include <lpayload.h>
static inline void read_env(const char *env, char *dest, size_t size) {
GetEnvironmentVariableA(env, dest, size);
SetEnvironmentVariableA(env, "");
}
BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) { BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) {
// Only listen for attach // Only listen for attach
if (reason != DLL_PROCESS_ATTACH) { if (reason != DLL_PROCESS_ATTACH) {
@ -16,12 +11,13 @@ BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) {
} }
// Get target EXE path // Get target EXE path
char targetExe[MAX_PATH]; char *targetExe = getenv(ENV_EXE_PATH);
read_env(ENV_EXE_PATH, targetExe, sizeof(targetExe));
// Get the path of the DLL to inject // Get the path of the DLL to inject
char injectDll[MAX_PATH]; char *injectDll = getenv(ENV_DLL_PATH);
read_env(ENV_DLL_PATH, injectDll, sizeof(injectDll));
// Get game commandline
char *cmdline = getenv(ENV_PROC_CMD);
// Compute the working directory path // Compute the working directory path
char workdir[MAX_PATH]; char workdir[MAX_PATH];
@ -37,8 +33,8 @@ BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) {
ZeroMemory(&pi, sizeof(pi)); ZeroMemory(&pi, sizeof(pi));
if (!CreateProcessA( if (!CreateProcessA(
targetExe,
NULL, NULL,
cmdline,
NULL, NULL,
NULL, NULL,
FALSE, FALSE,
@ -60,6 +56,14 @@ BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) {
size_t payloadSize = (size_t)&_binary_lpayload_o_p_payload_bin_size; size_t payloadSize = (size_t)&_binary_lpayload_o_p_payload_bin_size;
inject(pi.hProcess, payloadStart, payloadSize, injectDll); inject(pi.hProcess, payloadStart, payloadSize, injectDll);
// Optional: wait for user input before resuming (useful for debugging)
char *waitEnabled = getenv("WAIT_BEFORE_RESUME");
if (waitEnabled && strcmp(waitEnabled, "") != 0) {
char message[64];
sprintf(message, "PID: %ld. Press OK to continue", pi.dwProcessId);
MessageBoxA(NULL, message, "Jadeite Launcher Payload", MB_OK | MB_ICONINFORMATION);
}
// Resume the process // Resume the process
ResumeThread(pi.hThread); ResumeThread(pi.hThread);

View File

@ -7,35 +7,48 @@
const char LAUNCHER_INJECT_DLL[] = "launcher_payload.dll"; const char LAUNCHER_INJECT_DLL[] = "launcher_payload.dll";
const char GAME_INJECT_DLL[] = "game_payload.dll"; const char GAME_INJECT_DLL[] = "game_payload.dll";
#define SHIFT(argc, argv) argc--, argv++
int main(int argc, char **argv) { int main(int argc, char **argv) {
// Read arguments // Read arguments
char *gamePath = NULL; char *gamePath = NULL;
char *launcherPath = NULL; char *launcherPath = NULL;
// Skip executable
SHIFT(argc, argv);
switch (argc) { switch (argc) {
case 1: case 0:
printf("Usage: wine jadeite.exe [game path] <launcher path>\n"); printf("Usage: wine jadeite.exe [game path] <launcher path>\n");
return 0; return 0;
case 2: case 1:
printf("No launcher process specified! Using explorer.exe\n"); gamePath = argv[0];
gamePath = argv[1]; SHIFT(argc, argv);
launcherPath = "C:\\Windows\\explorer.exe";
break; launcherPath = "--";
case 3:
gamePath = argv[1];
launcherPath = argv[2];
break; break;
default: default:
fprintf(stderr, "Too many arguments! (%d)\n", argc); gamePath = argv[0];
return 1; SHIFT(argc, argv);
launcherPath = argv[0];
SHIFT(argc, argv);
break;
} }
// Default launcher path
if (strcmp(launcherPath, "--") == 0) {
printf("No launcher process specified! Using explorer.exe\n");
launcherPath = "C:\\Windows\\explorer.exe";
}
// cd into the injector directory // cd into the injector directory
char injectorPath[MAX_PATH]; char injectorPath[MAX_PATH];
GetModuleFileNameA(GetModuleHandleA(NULL), injectorPath, sizeof(injectorPath)); GetModuleFileNameA(GetModuleHandleA(NULL), injectorPath, sizeof(injectorPath));
char *lastSep = strrchr(injectorPath, '\\'); *(strrchr(injectorPath, '\\')) = '\0';
*lastSep = '\0';
SetCurrentDirectoryA(injectorPath); SetCurrentDirectoryA(injectorPath);
@ -49,13 +62,26 @@ int main(int argc, char **argv) {
char launcherPayloadPath[MAX_PATH]; char launcherPayloadPath[MAX_PATH];
GetFullPathNameA(LAUNCHER_INJECT_DLL, sizeof(launcherPayloadPath), launcherPayloadPath, NULL); GetFullPathNameA(LAUNCHER_INJECT_DLL, sizeof(launcherPayloadPath), launcherPayloadPath, NULL);
printf("Starting \"%s\" via \"%s\"\n", gameExePath, launcherPath); // Construct commandline for the game process
char cmdline[8192];
sprintf(cmdline, "\"%s\"", gameExePath);
while (argc) {
char arg[8192];
sprintf(arg, " \"%s\"", argv[0]);
strcat(cmdline, arg);
SHIFT(argc, argv);
}
// Set envvars // Set envvars
SetEnvironmentVariableA(ENV_EXE_PATH, gameExePath); SetEnvironmentVariableA(ENV_EXE_PATH, gameExePath);
SetEnvironmentVariableA(ENV_DLL_PATH, gamePayloadPath); SetEnvironmentVariableA(ENV_DLL_PATH, gamePayloadPath);
SetEnvironmentVariableA(ENV_PROC_CMD, cmdline);
// Start the launcher // Start the launcher
printf("Starting '%s' via '%s'\n", gameExePath, launcherPath);
STARTUPINFO si; STARTUPINFO si;
ZeroMemory(&si, sizeof(si)); ZeroMemory(&si, sizeof(si));

View File

@ -1,4 +1,4 @@
project('jadeite', 'c', version: '1.1.0') project('jadeite', 'c', version: '1.1.2')
nasm = find_program('nasm') nasm = find_program('nasm')
gen_res = find_program('gen_resources.sh') gen_res = find_program('gen_resources.sh')

23
metadata.json Normal file
View File

@ -0,0 +1,23 @@
{
"jadeite": {
"version": "1.1.2"
},
"games": {
"hi3rd": {
"global": {
"status": "verified",
"version": "6.6.0"
}
},
"hsr": {
"global": {
"status": "unsafe",
"version": "1.1.0"
},
"china": {
"status": "unsafe",
"version": "1.1.0"
}
}
}
}