Linux: port the emulator to a working state on Linux #117
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!117
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/117/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?
@StefanosCosta on GitHub · 2026-07-28 14:59 UTC · original
StefanosCosta:main→main· +2299 −360 · 30 files · 1 commits · merged 2026-07-28 22:25 UTCSummary
Brings the emulator up on Linux. Previously the Linux paths were a mix of stubs,
ENOSYSreturns and fatal "unsupported on this platform" aborts; games did not run.This implements the missing platform layers and fixes the Linux-specific bugs behind them.
Windows behaviour is unchanged throughout — every change is either in a Linux-only file,
inside a platform guard, or build config gated on
LINUX/KYTY_CLANG_CL.What's included
Memory and page tracking
mprotecttransitions inpageManager— these wereFatal("unsupported on this platform"), so the CPU/GPUcoherency model did not function at all
gettidsceLibcMspaceCreateaccepts, somspacecreation stops returning null and faulting on the first
operator newdecommit via
madvise; reserve and commit in one call rather than ~131k syscalls per 2 GiBunmap failure into a fatal rollback
Host exceptions and signals
QueryHostProtectionallocated inside it)sceKernelRaiseExceptionon its target thread; populate all 16 GPRs, rflags,cs and ss in the guest signal ucontext, with write-back so a guest handler's mutations apply
Guest threading
SysV callee-saved contract, and a dirty register on return corrupted the emulator
Sockets and networking
ENOSYS),plus
Select,EpollWaitviapoll, and name resolution viagetaddrinfoSOL_SOCKEToption names, andMSG_*flags — without which guestEAGAINarrived asEDEADLK,SO_REUSEADDRlandedon
SO_ERROR, andMSG_WAITALLread asMSG_DONTWAITNetInetNtoppassing the guest address family straight toinet_ntoplibhttp2 (cross-platform)
Callers took that as a real response and dereferenced the empty result. Now mirrors
libhttp v1 in
network.cpp: the send fails and every accessor returns the recorded result.Files, time and diagnostics
SysFileSizetruncating to 32 bits; resolve guest paths case-insensitively so assetsmastered on a case-insensitive filesystem load on ext4; carry nanoseconds in timestamps
__rdtscwith TSC calibration instead of a hardcoded 1 GHz, and add a high-resolutionsleep path (a 2 µs request took 55 µs)
Build, tests and CI
throw/try; they could not compileoff Windows despite having unconditional
add_testentriesstay gated with the measured reason
launcher; add the Linux CI workflow
Launcher
gnome-terminal, and report a failedlaunch instead of failing silently
Platform impact
pthreadasm emits an identicalinstruction stream,
network.cppadditions are all in#elsebranches,pageManager'sWindows paths are untouched, and the refactored IWYU flag string expands identically.
are confined to Linux, since Darwin has neither glibc's
ucontextlayout norgettid.macOS keeps the behaviour it had before this branch. It is not made worse, and no
untested Darwin code is introduced.
Testing
Built and run on Linux (Clang, Ninja). Verified against Subnautica, Cult of the Lamb and
Dreaming Sarah: they boot, render, and sustain tens of thousands of draw calls without faults.
Windows and macOS were not run — see the platform notes above for how each is kept unchanged.
@Nmzik on GitHub · 2026-07-28 19:04 UTC · original
@StefanosCosta Thanks for the PR. I trimmed some comments, added platform guards to keep the macOS and Windows paths unchanged, and refactored CI into a single workflow. Could youconfirm that the latest revision still runs all three tested games successfully on Linux? If so, I’ll be happy to merge it.
@StefanosCosta on GitHub · 2026-07-28 22:00 UTC · original
Hi there @Nmzik! Thanks for the quick review! All seems to run well except subnautica because of the libNet changes you reverted, I understand that's probably because they weren't linux only and risked a blast radius.I can add them with guards to make sure windows functionality is not affected, but If you think they are out of scope, then feel free to merge right now and I will creatte another PR for it :). On the other hand, I could push another commit that you give your final say to and revert if not needed. Up to you either way.
@Nmzik on GitHub · 2026-07-28 22:25 UTC · original
Merged. Yeah lets split this PR. The ABI changes should go in a separate PR. Feel free to create one. Thanks for understanding
@StefanosCosta on GitHub · 2026-07-28 22:30 UTC · original
Of course. It's better practice anyway. Opening it soon. Thanks!