diff options
| author | NotRexed <therealnothingfn@gmail.com> | 2026-11-27 17:58:38 -0500 |
|---|---|---|
| committer | NotRexed <therealnothingfn@gmail.com> | 2026-11-27 17:58:38 -0500 |
| commit | 00131bb85ee294179e5179b00a2c68f4ea3610b5 (patch) | |
| tree | 11854f35d928e964919b81746360146c3657ce07 /runtime/shims/process.cpp | |
| parent | eac96d744c3a899fa6e326e296f387fe11e05eab (diff) | |
main keeps its own runtime, tools and tests; the branch's variants stay on port/d3d12-nvidia
After the merge the tree held this branch's older states of files main maintains. Run against main's code,
tests/test_acphal_abi.py and 11 of the 15 translator tests that differed failed, and the C++ runtime would have
been built from two generations of its sources. So that the merge cannot break what main builds and tests:
- runtime/ is main's, file for file (68 files only this branch had are not carried over);
- every file under tools/, tests/ and docs/ that both sides have is main's (80 files);
- ten translator tests only this branch has, which test rules main's translator does not have, and their
fixtures are left out.
What main gains: d3d12/ (the Rust D3D12 runtime), its launchers and helpers (Launcher.bat, scripts/play*.ps1,
play-linux.sh, port_ctl.py, smooth-motion.ps1, fetch_vkd3d_proton.py, sync_victory.py), mods/example_lua, eleven
notes under docs/, seven tools and the tests that pass with main's code, the README's sections and credits, and
the "Runtime traps" section of AGENTS.md. Everything left out here is on the branch port/d3d12-nvidia.
Checked: compileall; make_game.py --help; check_no_game_data.py over every file this adds to main; the
line-ending, docs-encoding, CI-registration and docs tests; each test file that differs from main, on its own.
Not run: the whole translator suite, the C++ build, cargo over d3d12/ after the merge (d3d12/ is byte for byte the
branch's), CI.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'runtime/shims/process.cpp')
| -rw-r--r-- | runtime/shims/process.cpp | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/runtime/shims/process.cpp b/runtime/shims/process.cpp index aa33fe750..2c37292e2 100644 --- a/runtime/shims/process.cpp +++ b/runtime/shims/process.cpp | |||
| @@ -21,7 +21,6 @@ | |||
| 21 | // umbrella libraries a GDK title links (OneCore_apiset.lib, mincore.lib) bind them to. The retail package's own DLLs | 21 | // umbrella libraries a GDK title links (OneCore_apiset.lib, mincore.lib) bind them to. The retail package's own DLLs |
| 22 | // import ExitProcess from api-ms-win-core-processthreads-l1-1-0.dll. | 22 | // import ExitProcess from api-ms-win-core-processthreads-l1-1-0.dll. |
| 23 | #include <windows.h> | 23 | #include <windows.h> |
| 24 | #include <intrin.h> | ||
| 25 | 24 | ||
| 26 | #include <atomic> | 25 | #include <atomic> |
| 27 | #include <cerrno> | 26 | #include <cerrno> |
| @@ -514,52 +513,6 @@ int run_entry(void* entry, size_t stack_bytes) { | |||
| 514 | 513 | ||
| 515 | namespace { | 514 | namespace { |
| 516 | using namespace rt::process; | 515 | using namespace rt::process; |
| 517 | |||
| 518 | // The title's debug output goes to the log, as VIctory's kernel.rs OutputDebugStringA/W do (GPL-3.0-or-later): no | ||
| 519 | // debugger needs to be attached to read what the title says about itself. "[title] <text>", one line per call, the | ||
| 520 | // trailing newline dropped; LEONIDA_TITLE_DEBUG_OUTPUT=0 silences it. The host's function still gets the text, so an | ||
| 521 | // attached debugger sees it as before. | ||
| 522 | bool title_debug_output_on() { | ||
| 523 | static const bool on = [] { | ||
| 524 | char v[8] = {}; | ||
| 525 | const DWORD n = GetEnvironmentVariableA("LEONIDA_TITLE_DEBUG_OUTPUT", v, sizeof(v)); | ||
| 526 | return !(n > 0 && n < sizeof(v) && v[0] == '0'); | ||
| 527 | }(); | ||
| 528 | return on; | ||
| 529 | } | ||
| 530 | void log_title_text(std::string text) { | ||
| 531 | while (!text.empty() && (text.back() == '\n' || text.back() == '\r')) text.pop_back(); | ||
| 532 | std::fprintf(stderr, "[title] %s\n", text.c_str()); | ||
| 533 | } | ||
| 534 | void WINAPI game_output_debug_string_a(LPCSTR text) { | ||
| 535 | if (text && title_debug_output_on()) log_title_text(text); | ||
| 536 | OutputDebugStringA(text); | ||
| 537 | } | ||
| 538 | void WINAPI game_output_debug_string_w(LPCWSTR text) { | ||
| 539 | if (text && title_debug_output_on()) { | ||
| 540 | const int n = WideCharToMultiByte(CP_UTF8, 0, text, -1, nullptr, 0, nullptr, nullptr); | ||
| 541 | std::string utf8(n > 1 ? static_cast<size_t>(n - 1) : 0, ' '); | ||
| 542 | if (n > 1) WideCharToMultiByte(CP_UTF8, 0, text, -1, utf8.data(), n, nullptr, nullptr); | ||
| 543 | log_title_text(std::move(utf8)); | ||
| 544 | } | ||
| 545 | OutputDebugStringW(text); | ||
| 546 | } | ||
| 547 | |||
| 548 | // TerminateProcess of the game's own process ends gta6rt without a word otherwise; it is logged with its code and | ||
| 549 | // caller first (VIctory kernel.rs TerminateProcess), then done as asked. | ||
| 550 | BOOL WINAPI game_terminate_process(HANDLE process, UINT code) { | ||
| 551 | if (process == GetCurrentProcess() || GetProcessId(process) == GetCurrentProcessId()) { | ||
| 552 | std::fprintf(stderr, "[rt] process: the game called TerminateProcess(code %u) from %s\n", code, | ||
| 553 | rt::shims::module_offset(reinterpret_cast<uint64_t>(_ReturnAddress())).c_str()); | ||
| 554 | std::fflush(nullptr); | ||
| 555 | } | ||
| 556 | return TerminateProcess(process, code); | ||
| 557 | } | ||
| 558 | |||
| 559 | #define DEBUG_OUTPUT(dll) \ | ||
| 560 | {dll, "OutputDebugStringA", reinterpret_cast<void*>(&game_output_debug_string_a)}, \ | ||
| 561 | {dll, "OutputDebugStringW", reinterpret_cast<void*>(&game_output_debug_string_w)} | ||
| 562 | #define TERMINATE_PROCESS(dll) {dll, "TerminateProcess", reinterpret_cast<void*>(&game_terminate_process)} | ||
| 563 | #define UCRT(dll) \ | 516 | #define UCRT(dll) \ |
| 564 | {dll, "exit", reinterpret_cast<void*>(&game_exit)}, {dll, "_exit", reinterpret_cast<void*>(&game_quick_exit)}, \ | 517 | {dll, "exit", reinterpret_cast<void*>(&game_exit)}, {dll, "_exit", reinterpret_cast<void*>(&game_quick_exit)}, \ |
| 565 | {dll, "_Exit", reinterpret_cast<void*>(&game_quick_exit)}, \ | 518 | {dll, "_Exit", reinterpret_cast<void*>(&game_quick_exit)}, \ |
| @@ -619,12 +572,5 @@ SHIM_TABLE(process, | |||
| 619 | POOL_AFFINITY("kernelbase.dll"), | 572 | POOL_AFFINITY("kernelbase.dll"), |
| 620 | COMMAND_LINE("kernel32.dll"), | 573 | COMMAND_LINE("kernel32.dll"), |
| 621 | COMMAND_LINE("kernelbase.dll"), | 574 | COMMAND_LINE("kernelbase.dll"), |
| 622 | DEBUG_OUTPUT("kernel32.dll"), | ||
| 623 | DEBUG_OUTPUT("kernelbase.dll"), | ||
| 624 | DEBUG_OUTPUT("api-ms-win-core-debug-l1-1-0.dll"), | ||
| 625 | DEBUG_OUTPUT("api-ms-win-core-debug-l1-1-1.dll"), | ||
| 626 | TERMINATE_PROCESS("kernel32.dll"), | ||
| 627 | TERMINATE_PROCESS("kernelbase.dll"), | ||
| 628 | TERMINATE_PROCESS("api-ms-win-core-processthreads-l1-1-0.dll"), | ||
| 629 | COMMAND_LINE("api-ms-win-core-processenvironment-l1-1-0.dll"), | 575 | COMMAND_LINE("api-ms-win-core-processenvironment-l1-1-0.dll"), |
| 630 | ); | 576 | ); |