RynthCore as of 2026-10-04 (internal 843c801): RynthNav auto-travel and the navigation map, plugin API v75 (server and titles), launcher with Available plugins, download progress and the update on the front page, opt-in usage statistics, NPC names, radar colours, title-bar text size, FPS limiter, client action unlocks, release 2026.10.4.6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9b5e2765b7
commit
a24ed6df7c
322 changed files with 83009 additions and 7504 deletions
19
tools/TestClient/Build-TestClient.ps1
Normal file
19
tools/TestClient/Build-TestClient.ps1
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Builds tools\TestClient\bin\TestClient.exe (x86).
|
||||
$ErrorActionPreference = "Stop"
|
||||
$vsPath = & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" `
|
||||
-latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
|
||||
$vcVer = (Get-ChildItem "$vsPath\VC\Tools\MSVC" | Sort-Object Name -Descending | Select-Object -First 1).Name
|
||||
$vcBase = "$vsPath\VC\Tools\MSVC\$vcVer"
|
||||
$sdkVer = (Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\Include" | Sort-Object Name -Descending | Select-Object -First 1).Name
|
||||
$sdkInc = "C:\Program Files (x86)\Windows Kits\10\Include\$sdkVer"
|
||||
$sdkLib = "C:\Program Files (x86)\Windows Kits\10\Lib\$sdkVer"
|
||||
$env:INCLUDE = "$vcBase\include;$sdkInc\ucrt;$sdkInc\um;$sdkInc\shared"
|
||||
$env:LIB = "$vcBase\lib\x86;$sdkLib\ucrt\x86;$sdkLib\um\x86"
|
||||
$out = Join-Path $PSScriptRoot "bin"
|
||||
New-Item -ItemType Directory -Force -Path "$out\obj" | Out-Null
|
||||
Push-Location "$out\obj"
|
||||
try {
|
||||
& "$vcBase\bin\Hostx86\x86\cl.exe" /nologo /O2 /MT /W3 "$PSScriptRoot\TestClient.c" /link /MACHINE:X86 /OUT:"$out\TestClient.exe"
|
||||
if ($LASTEXITCODE -ne 0) { throw "TestClient build failed" }
|
||||
} finally { Pop-Location }
|
||||
Write-Host "Built $out\TestClient.exe"
|
||||
120
tools/TestClient/TestClient.c
Normal file
120
tools/TestClient/TestClient.c
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
// TestClient: starts acclient.exe suspended, injects a DLL, optionally calls one of its
|
||||
// exports on a remote thread (like RynthCore.Injector does with RynthCoreInit), resumes
|
||||
// the client, then waits and (optionally) terminates it. For loader/engine tests that must
|
||||
// not touch a real account: point the client at a closed port and no login happens.
|
||||
//
|
||||
// TestClient.exe <acclient.exe> <dll> <export|-> <seconds> [acclient args...]
|
||||
// seconds > 0: terminate the client after that many seconds
|
||||
// seconds = 0: leave it running and exit (prints TEST_PID=<pid>)
|
||||
//
|
||||
// Environment variables set here are inherited by the client (e.g. RYNTH_SPIKE_AUTORUN).
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static DWORD RemoteCall(HANDLE process, void* fn, void* arg, DWORD timeoutMs, DWORD* exitCode)
|
||||
{
|
||||
HANDLE t = CreateRemoteThread(process, NULL, 0, (LPTHREAD_START_ROUTINE)fn, arg, 0, NULL);
|
||||
if (!t) return GetLastError();
|
||||
DWORD r = WaitForSingleObject(t, timeoutMs);
|
||||
GetExitCodeThread(t, exitCode);
|
||||
CloseHandle(t);
|
||||
return r == WAIT_OBJECT_0 ? 0 : WAIT_TIMEOUT;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if (argc < 5) {
|
||||
printf("usage: TestClient <acclient.exe> <dll> <export|-> <seconds> [acclient args...]\n");
|
||||
return 1;
|
||||
}
|
||||
const char* exe = argv[1];
|
||||
const char* dll = argv[2];
|
||||
const char* exportName = argv[3];
|
||||
int seconds = atoi(argv[4]);
|
||||
|
||||
char cmd[4096];
|
||||
_snprintf_s(cmd, sizeof cmd, _TRUNCATE, "\"%s\"", exe);
|
||||
for (int i = 5; i < argc; i++) { strcat_s(cmd, sizeof cmd, " "); strcat_s(cmd, sizeof cmd, argv[i]); }
|
||||
char dir[MAX_PATH];
|
||||
strcpy_s(dir, sizeof dir, exe);
|
||||
*strrchr(dir, '\\') = 0;
|
||||
|
||||
// The export's RVA, from a local image-only mapping of the DLL.
|
||||
DWORD exportRva = 0;
|
||||
if (strcmp(exportName, "-") != 0) {
|
||||
HMODULE local = LoadLibraryExA(dll, NULL, DONT_RESOLVE_DLL_REFERENCES);
|
||||
if (!local) { printf("cannot map %s locally (%lu)\n", dll, GetLastError()); return 2; }
|
||||
FARPROC p = GetProcAddress(local, exportName);
|
||||
if (!p) { printf("%s has no export %s\n", dll, exportName); return 2; }
|
||||
exportRva = (DWORD)((char*)p - (char*)local);
|
||||
FreeLibrary(local);
|
||||
}
|
||||
|
||||
// Marks the client as a test client in its log (the loader logs "TestClient: ...").
|
||||
if (GetEnvironmentVariableA("RYNTHCORE_TEST_CLIENT", NULL, 0) == 0)
|
||||
SetEnvironmentVariableA("RYNTHCORE_TEST_CLIENT", "tools\\TestClient (no login)");
|
||||
STARTUPINFOA si = { sizeof si };
|
||||
PROCESS_INFORMATION pi;
|
||||
if (!CreateProcessA(exe, cmd, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, dir, &si, &pi)) {
|
||||
printf("CreateProcess failed %lu\n", GetLastError());
|
||||
return 3;
|
||||
}
|
||||
printf("TEST_PID=%lu\n", pi.dwProcessId);
|
||||
fflush(stdout);
|
||||
|
||||
// Its own launch context, naming a dummy account and NO character. Without one the engine
|
||||
// falls back to the shared %APPDATA%\RynthCore\launch_context.json - whatever the launcher
|
||||
// last launched (a real character) - and arms auto-login for it (2026-09-29).
|
||||
char ctxPath[MAX_PATH] = "";
|
||||
{
|
||||
char appdata[MAX_PATH];
|
||||
if (GetEnvironmentVariableA("APPDATA", appdata, sizeof appdata) > 0) {
|
||||
char dir[MAX_PATH];
|
||||
_snprintf_s(dir, sizeof dir, _TRUNCATE, "%s\\RynthCore\\launch_contexts", appdata);
|
||||
CreateDirectoryA(dir, NULL);
|
||||
_snprintf_s(ctxPath, sizeof ctxPath, _TRUNCATE, "%s\\launch_context_%lu.json", dir, pi.dwProcessId);
|
||||
FILE* f = NULL;
|
||||
if (fopen_s(&f, ctxPath, "w") == 0 && f) {
|
||||
fprintf(f, "{\"ProcessId\":%lu,\"AccountName\":\"test-client\",\"ServerName\":\"test-client\","
|
||||
"\"TargetCharacter\":\"\",\"SkipLoginLogos\":false,\"OnLoginCommands\":null,\"OnLoginWaitMs\":0}",
|
||||
pi.dwProcessId);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
size_t len = strlen(dll) + 1;
|
||||
void* remote = VirtualAllocEx(pi.hProcess, NULL, len, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
||||
WriteProcessMemory(pi.hProcess, remote, dll, len, NULL);
|
||||
DWORD base = 0;
|
||||
DWORD err = RemoteCall(pi.hProcess, (void*)GetProcAddress(GetModuleHandleA("kernel32.dll"), "LoadLibraryA"),
|
||||
remote, 30000, &base);
|
||||
if (err || !base) {
|
||||
printf("LoadLibrary in the client failed (err %lu, base 0x%08lx)\n", err, base);
|
||||
TerminateProcess(pi.hProcess, 1);
|
||||
return 4;
|
||||
}
|
||||
printf("loaded at 0x%08lx\n", base);
|
||||
|
||||
if (exportRva) {
|
||||
DWORD rc = 0;
|
||||
err = RemoteCall(pi.hProcess, (void*)(ULONG_PTR)(base + exportRva), NULL, 60000, &rc);
|
||||
printf("%s -> %s rc=%lu\n", exportName, err ? "TIMEOUT" : "returned", rc);
|
||||
}
|
||||
ResumeThread(pi.hThread);
|
||||
fflush(stdout);
|
||||
|
||||
if (seconds <= 0) return 0;
|
||||
DWORD r = WaitForSingleObject(pi.hProcess, seconds * 1000);
|
||||
if (r == WAIT_OBJECT_0) {
|
||||
DWORD code = 0;
|
||||
GetExitCodeProcess(pi.hProcess, &code);
|
||||
printf("client exited by itself, code 0x%08lx\n", code);
|
||||
} else {
|
||||
TerminateProcess(pi.hProcess, 0);
|
||||
printf("client terminated after %d s\n", seconds);
|
||||
}
|
||||
if (ctxPath[0]) DeleteFileA(ctxPath);
|
||||
return 0;
|
||||
}
|
||||
65
tools/TestClient/ThreadPeek.c
Normal file
65
tools/TestClient/ThreadPeek.c
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
// ThreadPeek: where is a (32-bit) thread right now? Suspends it a few times and prints EIP,
|
||||
// the module+offset it falls in, and the return-address-looking values on its stack.
|
||||
// ThreadPeek.exe <pid> <tid> [samples]
|
||||
#include <windows.h>
|
||||
#include <psapi.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static HMODULE g_mods[1024];
|
||||
static MODULEINFO g_info[1024];
|
||||
static char g_names[1024][64];
|
||||
static int g_nmods;
|
||||
|
||||
static void LoadModules(HANDLE p)
|
||||
{
|
||||
DWORD needed = 0;
|
||||
EnumProcessModulesEx(p, g_mods, sizeof g_mods, &needed, LIST_MODULES_ALL);
|
||||
g_nmods = (int)(needed / sizeof(HMODULE));
|
||||
for (int i = 0; i < g_nmods; i++) {
|
||||
GetModuleInformation(p, g_mods[i], &g_info[i], sizeof g_info[i]);
|
||||
GetModuleBaseNameA(p, g_mods[i], g_names[i], sizeof g_names[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static const char* Where(DWORD a, char* buf, size_t cap)
|
||||
{
|
||||
for (int i = 0; i < g_nmods; i++) {
|
||||
DWORD b = (DWORD)(ULONG_PTR)g_info[i].lpBaseOfDll;
|
||||
if (a >= b && a < b + g_info[i].SizeOfImage) {
|
||||
_snprintf_s(buf, cap, _TRUNCATE, "%s+0x%lx", g_names[i], a - b);
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if (argc < 3) { printf("usage: ThreadPeek <pid> <tid> [samples]\n"); return 1; }
|
||||
DWORD pid = strtoul(argv[1], NULL, 0), tid = strtoul(argv[2], NULL, 0);
|
||||
int samples = argc > 3 ? atoi(argv[3]) : 5;
|
||||
HANDLE p = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid);
|
||||
HANDLE t = OpenThread(THREAD_SUSPEND_RESUME | THREAD_GET_CONTEXT, FALSE, tid);
|
||||
if (!p || !t) { printf("open failed %lu\n", GetLastError()); return 2; }
|
||||
LoadModules(p);
|
||||
for (int s = 0; s < samples; s++) {
|
||||
SuspendThread(t);
|
||||
CONTEXT c = { 0 };
|
||||
c.ContextFlags = CONTEXT_CONTROL | CONTEXT_INTEGER;
|
||||
GetThreadContext(t, &c);
|
||||
DWORD stack[256] = { 0 };
|
||||
SIZE_T got = 0;
|
||||
ReadProcessMemory(p, (void*)(ULONG_PTR)c.Esp, stack, sizeof stack, &got);
|
||||
ResumeThread(t);
|
||||
char buf[128];
|
||||
const char* w = Where(c.Eip, buf, sizeof buf);
|
||||
printf("sample %d: eip=0x%08lx %s esp=0x%08lx eax=%08lx ecx=%08lx\n", s, c.Eip, w ? w : "(not in a module)", c.Esp, c.Eax, c.Ecx);
|
||||
int shown = 0;
|
||||
for (int i = 0; i < (int)(got / 4) && shown < 16; i++) {
|
||||
const char* m = Where(stack[i], buf, sizeof buf);
|
||||
if (m) { printf(" [esp+%03x] %s\n", i * 4, m); shown++; }
|
||||
}
|
||||
Sleep(200);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in a new issue