fix(relinker): start Windows executables in their own directory #2574
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2574"
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?
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T06:49:12Z.
Carrying @Get-fix's fix for #2464 while PR intake is paused. The change is theirs (from
Get-fix/AnyPS5:fix/windows-gui-startup,a2d583f5), cherry-picked unchanged onto currentmain.What
The Windows entry stub already finds the executable's directory to load
libs\. It now also passes that directory toSetCurrentDirectoryAbefore loading any library, with its own failure message (6 lines inWindowsEntryStubBuilder.cpp, plus one import). A new relinker test,windows_working_directory, converts a guest whose import spins and starts it from another directory as a console build and as a--windows-guibuild. It then reads the child's current directory.Why
Fixes #2464. The guest filesystem root comes from the current directory (
canonical(current_path())incore/libs/prx/libc/src/General.cpp), and save data goes to the relative_sd. An executable started from Explorer, or from any folder other than its own, doesn't find its title files and exits. In the issue, LeandroLP23 showed with ps5-doom (PPSA99666) that this happens to--windows-guiand console builds alike, and that missing standard handles alone don't stop a title. Fixing it in the stub keepsGeneral.cppand libSceSaveData unchanged, along with the 11 library tests that use the current directory.Tested
windows_working_directoryfails onmainand passes with the change. Relinker-only ctest 47/47, and full Windows ctest 544/544 before the rebase. ps5-doom as--windows --windows-gui, started withStart-Processfrom another directory and fromC:\Windows\System32(3 runs each) and withexplorer.exe <path>: without the change it exits within 6 s in all 7 starts. With it, it runs in all 7 and the window renders.main092e133e: the branch merges cleanly andtools/check_conventions.pypasses. CI runs the build and tests.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)