upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/process_cmdline_test.cpp
diff options
context:
space:
mode:
authorNotRexed <therealnothingfn@gmail.com>2026-11-26 02:28:26 -0500
committerNotRexed <therealnothingfn@gmail.com>2026-11-26 02:28:26 -0500
commit704bbfd1f95e659e6df22b921baecfb47dbc38c5 (patch)
tree66e6c1e62797e92b695ebe3a3b8ce8a9c7799d84 /runtime/test/process_cmdline_test.cpp
parent10adc5c6854d7c1a1708010f8f6cf75017052e2d (diff)
process: log the title's debug output and its TerminateProcess
Port VIctory's kernel.rs (GPL-3.0-or-later) OutputDebugStringA/W and TerminateProcess: the title's debug strings go to stderr as "[title] ..." (LEONIDA_TITLE_DEBUG_OUTPUT=0 silences them; the host still gets them for an attached debugger), and a TerminateProcess of the game's own process is logged with its code and caller before it is done, instead of ending gta6rt without a word. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/test/process_cmdline_test.cpp')
-rw-r--r--runtime/test/process_cmdline_test.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/runtime/test/process_cmdline_test.cpp b/runtime/test/process_cmdline_test.cpp
index fb0a0498c..89a1b7f03 100644
--- a/runtime/test/process_cmdline_test.cpp
+++ b/runtime/test/process_cmdline_test.cpp
@@ -269,6 +269,23 @@ int main() {
269 SetProcessAffinityMask(GetCurrentProcess(), process_mask); 269 SetProcessAffinityMask(GetCurrentProcess(), process_mask);
270 } 270 }
271 271
272 // The title's debug output is served (and logged as "[title] ..."); TerminateProcess is served by the shim too.
273 {
274 using DebugA = void(WINAPI*)(LPCSTR);
275 using DebugW = void(WINAPI*)(LPCWSTR);
276 const auto debug_a = reinterpret_cast<DebugA>(rt::shims::find("kernelbase.dll", "OutputDebugStringA"));
277 const auto debug_w =
278 reinterpret_cast<DebugW>(rt::shims::find("api-ms-win-core-debug-l1-1-0.dll", "OutputDebugStringW"));
279 if (!debug_a || !debug_w || !rt::shims::find("kernel32.dll", "TerminateProcess")) {
280 std::fprintf(stderr, "FAIL OutputDebugStringA/W and TerminateProcess are not served\n");
281 ++failures;
282 } else {
283 debug_a("process_cmdline: a narrow debug line\n");
284 debug_w(L"process_cmdline: a wide debug line Δ");
285 debug_a(nullptr);
286 }
287 }
288
272 if (failures) return 1; 289 if (failures) return 1;
273 std::printf("process_cmdline: GetCommandLineW parses back to __wargv, non-ASCII arguments intact (code page %u); " 290 std::printf("process_cmdline: GetCommandLineW parses back to __wargv, non-ASCII arguments intact (code page %u); "
274 "the WinMain line and the kernelbase/API-set names are the game's\n", 291 "the WinMain line and the kernelbase/API-set names are the game's\n",