loader: keep the output and log of a game LoadExec relaunches #1480
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!1480
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1480/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Almo7aya on GitHub · 2026-10-13 16:51 UTC · original
Almo7aya:fix/loadexec-child-output→main· +77 −10 · 3 files · 4 commits · merged 2026-10-16 01:01 UTCGame
Uncharted: Legacy of Thieves Collection (PPSA05389, 01.002.000) — The Lost Legacy.
Problem
When The Lost Legacy was the last game played, the collection's
eboot.binrelaunches itself into/app0/tllr-boot.binthroughsceSystemServiceLoadExec. LoadExec starts a new emulator program(a new process on Windows,
execon Linux), and the output around that switch was lost:CREATE_NO_WINDOWand without the standard handles,so nothing it printed reached the console or the redirected stdout/stderr. Launched from the
launcher, the console stopped at the relaunch; with output redirected to a file, the file ended there.
--printf-direction File, the new program is given the same--printf-output-fileand openedit anew, emptying it: the log kept only the second program, without anything the collection logged
before the relaunch (its
LoadExec:line included).or be dropped (Linux,
execdiscards it).Any error after the relaunch, fatal errors included, was invisible.
Changes
current standard input, output and error handles. Only those are inherited
(
PROC_THREAD_ATTRIBUTE_HANDLE_LIST), and it shares the console when there is one;CREATE_NO_WINDOWis only used when the current process has no console.flushed before the new program starts, on both platforms.
KYTY_RELAUNCHEDfor theprogram it starts, which then appends to the printf output file instead of replacing it. A normal
start still begins a new file.
the log, with the new program's arguments, so it is clear where one program's output ends and the
next one's begins:
LoadExec: switching to /app0/tllr-boot.bin "" "boot-mode-tll".Evidence
Collection
eboot.bin, The Lost Legacy as the last game played.Console (the launcher's
cmd /Kwindow) or stdout/stderr redirected to a file:the relaunched process currently stops with on
main:(That error is a separate issue; starting
tllr-boot.bindirectly with--guest-execshows the sameerror. These changes only make it visible.)
--printf-direction File --printf-output-file log.txt(file pre-filled with an old line):to
LoadExec: switching to /app0/tllr-boot.bin "" "boot-mode-tll", and the relaunched program'slines follow it, through the error above.
Testing
Windows 11, RTX 4070, from the command line: console, redirected stdout/stderr and
--printf-direction File, as above.From the launcher: the relaunched program's output continues in the launcher's console, and
_kyty.txtholds both programs' output.AI use
These changes were developed with an AI coding assistant
@coderabbitai[bot] on GitHub · 2026-10-13 16:57 UTC · original
📝 Walkthrough
LoadExecnow logs the target path and arguments, flushes output, and configures relaunch behavior on Windows and Linux. It sets a relaunch environment variable for the new process. The file logger checks that variable and appends to the existing log when it is present; otherwise, it truncates the file.Suggested reviewers:
nmzikPriority: ➖ Normal
Change: Bug fix
Merge Risk: 🔵 Low · up to
dd24eThe relaunch change preserves output and logs across LoadExec. In a rare failure to set the relaunch marker, the previous log could be truncated. This is a small, low-risk follow-up.
Pre-merge checks ·
4 ·
1
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.@ -93,0 +134,4 @@const DWORD flags = (listed ? EXTENDED_STARTUPINFO_PRESENT : 0u) |(GetConsoleWindow() != nullptr ? 0u : static_cast<DWORD>(CREATE_NO_WINDOW));// The new process continues this one's log file; it inherits the environment.(void)SetEnvironmentVariableA(Log::RelaunchedVariable, "1");@coderabbitai[bot] on GitHub · 2026-10-13 16:57 UTC · original
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 3213
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 32133
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 8328
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 848
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 848
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 2254
Abort only when a new relaunch marker cannot be set.
"KYTY_RELAUNCHED"and"1"are valid, butSetEnvironmentVariableAcan still fail when the environment block or system resources are exhausted. If the marker was absent and the call fails,CreateProcessWinherits the missing marker.MakeFileLoggerthen opens the file with truncation enabled and can discard the previous program's log.If the marker already exists, preserve the current best-effort relaunch because
MakeFileLoggerchecks only whether the variable exists.🐛 Suggested fix
📝 Committable suggestion
@coderabbitai[bot] on GitHub · 2026-10-13 16:57 UTC · original · reviewed
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
c00ebcb4-946d-4e64-992f-e599091bccd3📥 Commits
Reviewing files that changed from the base of the PR and between
df5b9b92beanddd24ee6419.📒 Files selected for processing (3)
src/common/logging/log.cppsrc/common/logging/log.hsrc/loader/loadExec.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
@Nmzik on GitHub · 2026-10-16 01:01 UTC · original
@Almo7aya Thanks