Commit Graph
14017 Commits
Author SHA1 Message Date
Pouare514 a719359cd1 prx: make libRenoirCore.PS5 stubs throw NotImplemented 2026-09-27 15:49:18 +02:00
boykopovar e06dbff7d6 Merge pull request #10 from boykopovar/feat/sce-module-load
Feat/sce module load
The game can expect its modified prx from the `sce_module`/`sce_modules` folder. The relinker now converts PRX files from sce_module to `dll`/`so` format with `.guest.prx` postfix. During linking, libraries from `sce_module` are given priority. If a library from `sce_module` fails to import a symbol or contains a syscall, an exception will be thrown.

This made it possible to remove the GuestLocale formats that were customized for specific guests. Launched apps now use their own PRX files from the `sce_module` folder.
Locale handling functions now use `std::locale`.

Added a lot of posix functions to `libkernel` (they are thin wrappers and do what the existing non-posix versions do)
2026-09-27 15:47:36 +03:00
Pouare514 030e62dfa3 feat(prx): fmod real audio output via SDL + identify 22/27 NIDs
- libfmod: route createSound (OPENMEMORY WAV/RAW, file placeholder sine)
  + playSound + update() mixer pump into SDL queue (48k stereo F32,
  mirrors libSceAudioOut). Channel::setVolume/isPlaying/position now
  track real PCM cursor with loop support. Silent fallback via
  ANYPS5_FMOD_SILENT=1, NOSOUND output, or SDL open failure.
  Link SDL2-static like libSceAudioOut.
- NIDs: recompute from public FMOD headers (fmod.h/hpp + fmod_studio
  2.0) with exact Itanium manglings (g++ nm) + SHA1+suffix
  (NidCompute.cpp). Identify 2/2 libfmod (setFileSystem, setCallback)
  + 20/25 studio (const createInstance, getEvent, getCoreSystem,
  getSoundInfo, etc.). Replace stubs with ABI-compatible real
  impls; 5 studio remain unknown (Cm2cmtCv8cA, EfM9xXvBmxk,
  Js90KQXVS4s, oCYWES02VPc, vVwA2cZA5e4).
- Tests: coverage OK (51+42 Legends NIDs, missing 0), audio smoke
  (WAV 4800f + RAW 2048f, volume, channelsPlaying, stop) OK real
  and silent.
2026-09-27 13:24:34 +02:00
Pouare514 279587cb16 fix(libcohtml): provide libcohtml.Prospero.prx for DT_NEEDED
Copy the patched libcohtml.prx to libcohtml.Prospero.prx (exact DT_NEEDED name) via a post-build copy in the module CMakeLists, wired into the libs umbrella target. OUTPUT_NAME with a dot was rejected: the parent pipeline derives unpatched/patched paths from the directory target name, so renaming output would break it; dotted CMake target names are supported (e.g. libSceSaveData.native) but the parent-owned NID-patch rule is kept untouched. Adds DEPLOY.md deploy note. All 50 raw NIDs re-verified in the renamed file export table.
2026-09-27 12:57:23 +02:00
Pouare514 c0515bdcce feat(prx): add libfmod and libfmodstudio replacements covering Legends NIDs 2026-09-27 12:32:13 +02:00
boykopovar 179841caff feat(relinker): report full module path when windows loading fails 2026-09-27 13:10:06 +03:00
Pouare514 a4248cb114 feat(libcohtml): add stub prx exporting 50 Minecraft Legends NIDs 2026-09-27 12:00:15 +02:00
Pouare514 0722f3e5fc prx: add libRenoirCore.PS5 replacement with 23 Renoir stubs for libcohtml
Minecraft Legends' libcohtml.Prospero.prx imports 23 NIDs from lib
libRenoirCore.PS5_v1 (docs/legends-unresolved-nids.json). Clear names are
unknown, so each export is exposed under its raw NID via APS5_EXPORT
alias (<NID>_nid_no_patch_cut), which nid_patcher strips to the
literal NID instead of hashing.

Stubs follow KytyPS5 UnresolvedImportStub policy (log call + return 0)
via APS5_LOG_OUT rather than throwing NotImplemented.
2026-09-27 11:57:54 +02:00
boykopovar 43d2e8b4dc fix(codegen): decode xadd byte and popcnt instruction lengths fix 2026-09-27 12:49:46 +03:00
boykopovar e3dc9a6acc fix(relinker): accept zero alignment for empty tls segments 2026-09-27 12:41:52 +03:00
boykopovar 52b683d208 fix(relinker): skip generated guest prx files during sce module scan 2026-09-27 11:43:42 +03:00
boykopovar e526f1f528 feat(libc): replace guest locale implementation with std::locale 2026-09-27 11:43:42 +03:00
boykopovar bfa1ac0751 fix(relinker): scan complete function ranges for windows tls accesses 2026-09-27 11:43:41 +03:00
boykopovar 9cc36a02fe feat(libkernel): add __progname str value 2026-09-27 11:43:40 +03:00
boykopovar f5ea673c10 feat(libkernel): impl posix stdio wrappers, reusing sceKernel file ops 2026-09-27 11:43:40 +03:00
boykopovar 7a925c68e5 fix(libkernel): handle clock_second 13 in clock_gettime and clock_getres 2026-09-27 11:43:39 +03:00
boykopovar 13c648bebb feat(libkernel): impl file, time, process, signal for posix 2026-09-27 11:43:38 +03:00
boykopovar 62c16792ff feat(libkernel): impl pthread condition variables + posix thread attribute queries 2026-09-27 11:43:37 +03:00
boykopovar a709e220f2 feat(libkernel): implement posix mutex locking and timed waits 2026-09-27 11:43:37 +03:00
boykopovar ae2e5cba7e feat(libc): implement heap trace info 2026-09-27 11:43:36 +03:00
boykopovar c9cb3cae39 feat(libkernel): implement disabled address sanitizer state + replacement tables 2026-09-27 11:43:36 +03:00
boykopovar 9fd6816356 fix(libkernel): store rtld allocator table separately from application heap 2026-09-27 11:43:35 +03:00
boykopovar dbb56adcf6 feat(libkernel): implement process, cpu, uuid, gpi, gpo, sync funcs 2026-09-27 11:43:34 +03:00
boykopovar 55e1c4a238 feat(libkernel): implement application heap and thread atexit registration 2026-09-27 11:43:33 +03:00
boykopovar 2e654e4f89 feat(relinker): scan sce modules for syscalls 2026-09-27 11:43:33 +03:00
boykopovar 630cb018c0 feat(relinker): add --skip-sce-module flag 2026-09-27 11:43:32 +03:00
boykopovar 5887c8d6e2 feat(libkernel): add memory segment, backtrace, heap error report definitions 2026-09-27 11:43:32 +03:00
boykopovar 40101471ee feat(libkernel): add new posix, pthread, semaphore, process funcs definitions 2026-09-27 11:43:31 +03:00
boykopovar 0783e369da feat(libkernel): add definitions for standard guest libc imports 2026-09-27 11:43:31 +03:00
boykopovar 337e763597 fix(relinker): support operand-size prefixes on fs:[0] access 2026-09-27 11:43:30 +03:00
boykopovar 2cc34985c0 fix(codegen): decode int imm8 instruction length correctly 2026-09-27 11:43:30 +03:00
boykopovar fa10c6d7eb fix(relinker): scan reachable code for windows guest tls accesses 2026-09-27 11:43:30 +03:00
boykopovar 6b2db1d8a8 fix(relinker): support windows guest tls relocations and accesses 2026-09-27 11:43:29 +03:00
boykopovar 0c6765e6a6 fix(relinker): ignore non-loadable SCE segments outside file bounds 2026-09-27 11:43:29 +03:00
boykopovar 1379ec001b feat(relinker): add native guest module loading with export priority 2026-09-27 11:43:28 +03:00
boykopovar fce5889d91 Merge pull request #21 from obelisk-complex/test/wire-up-exception-runtime-test
test: wire up the orphaned exception runtime test
- `core/libs/CMakeLists.txt`: registered `ExceptionRuntime.cpp` as `exception_runtime_tests`/`exception_runtime`, following the existing `Guest*.cpp` test pattern, linked against `libc`.
2026-09-27 11:39:23 +03:00
boykopovar 228802b7f5 Merge pull request #23 from obelisk-complex/test/fix-agc-driver-test-bitrot
test(agc): fix and re-enable 3 of 8 bitrotted AGC driver tests
- `agc_driver_graphics_tests`: fixed the link failure by adding the three missing source files and linking `shader_recompiler_agc_driver`. Still fails at runtime against stale assertions accumulated over many commits of not being built (an expected "not implemented" message that texture support since removed, and a sampler test fixture value that no longer fits its 12-bit field). Left `EXCLUDE_FROM_ALL`; fixing the assertions is a separate pass across the whole 1150-line test file, not a build fix.
- `agc_driver_recompiler_tests`: root-caused but not fixed. It needs `COMPUTE_NUM_THREAD_X` set, and its pass condition checks for a "not implemented" stub error that no longer exists now that the real recompiler is in. Restoring its original intent needs a shader deliberately built to fail recompilation, which is a design decision, not something this PR should decide unilaterally. Left `EXCLUDE_FROM_ALL`.
- `agc_driver_tests`, `agc_shader_memory_tests`, `agc_driver_flip_tests` and `agc_driver_pm4_tests` already passed; registered them with `add_test` so none of the four can bitrot silently again.
2026-09-27 11:34:45 +03:00
boykopovar 7894745fba Merge pull request #15 from obelisk-complex/fix/sscanf-signedness-and-substr-copy
fix: correct sscanf %x signedness and avoid a substr copy
- `core/libs/prx/libSceSysmodule/Export.cpp`: `devMajor`/`devMinor` now `unsigned int`.
- `core/libs/nid/include/nid/NidPatcherUtils.hpp`: two `substr(0, n)` calls replaced with `resize(n)`.
2026-09-27 11:30:50 +03:00
boykopovar 0b262e9987 Merge pull request #14 from obelisk-complex/fix/linux-exception-unwind-interposition
fix(exceptions): interpose libstdc++ ABI on Linux so the project's own unwinder drives it
- `OwnPersonality()` in `Unwind.cpp` now recognises the bare `__gxx_personality_v0` wrapper on Linux too (previously Windows-only).
- `Exports.cpp` exports the real ABI names (`__cxa_throw`, `__cxa_begin_catch`/`end_catch`, `__cxa_rethrow`, `__cxa_allocate`/`free_exception`, `__cxa_call_terminate`, `__cxa_get_exception_ptr`, `__cxa_current_exception_type`, `__cxa_init_primary_exception`, the `std::terminate`/`uncaught_exception(s)` mangled names, and the core `_Unwind_*` entry points) through the existing `GCC_GLOBAL_ALIAS` assembler-alias macro rather than new C++ definitions (a plain redefinition under these names conflicts with `<cxxabi.h>`'s own declarations). This lets ELF symbol interposition make this project's own implementation win process-wide over `libgcc_s.so.1`/`libstdc++.so.6`.
- `__cxa_init_primary_exception_nid_postfix` is new: GCC 13's inline `std::make_exception_ptr` calls `__cxa_init_primary_exception`, and nothing implemented it before.
- Deliberately did not alias `__dynamic_cast`, `__cxa_pure_virtual` or `__cxa_deleted_virtual`. Nothing in `core/libs/prx` needs them rerouted, and doing so would divert every RTTI cast in libstdc++ and third-party code (SDL2, glslang) through this project's slower walker for no benefit.
2026-09-27 11:27:36 +03:00
boykopovar aa7d8b1072 Merge pull request #16 from obelisk-complex/docs/spirv-validation-is-opt-in
docs: correct SPIR-V validation claim and a stale line citation
2026-09-27 11:17:01 +03:00
QDarkRexandClaude Opus 5.5 2081071237 refactor(kernel): share SCE kernel error codes through KernelErrors.hpp
Kernel error codes were redeclared per file under three prefixes
(SCE_KERNEL_ERROR_, EQUEUE_ERROR_, KERNEL_SEMA_ERROR_), which let wrong
values go unnoticed. Define them once as 0x80020000 | errno for errno
1..94 and use the SCE_KERNEL_ERROR_ names everywhere. Values are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-27 13:32:28 +07:00
QDarkRexandClaude Opus 5.5 ac0f8af228 fix(kernel): use SCE kernel error codes in equeue, direct memory and mutex
SCE kernel errors are 0x80020000 plus the FreeBSD errno. The equeue and
direct memory constants used an unrelated 0x8001xxxx range with mismatched
errno values (e.g. ETIMEDOUT was 0x80010023), so a guest checking
sceKernelWaitEqueue for SCE_KERNEL_ERROR_ETIMEDOUT saw an unexpected error.
SCE_KERNEL_ERROR_EDEADLK in Mutex.cpp held the EAGAIN value.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-27 13:27:23 +07:00
QDarkRexandClaude Opus 5.5 97cae1458e fix(kernel): use SCE kernel error codes in equeue, direct memory and mutex
SCE kernel errors are 0x80020000 plus the FreeBSD errno. The equeue and
direct memory constants used an unrelated 0x8001xxxx range with mismatched
errno values (e.g. ETIMEDOUT was 0x80010023), so a guest checking
sceKernelWaitEqueue for SCE_KERNEL_ERROR_ETIMEDOUT saw an unexpected error.
SCE_KERNEL_ERROR_EDEADLK in Mutex.cpp held the EAGAIN value.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-27 13:22:01 +07:00
QDarkRexandClaude Opus 5.5 be127fd0f1 feat(kernel): implement sceKernelDeleteSema
Waiters are woken with SCE_KERNEL_ERROR_EACCES and the semaphore is freed
once they have left.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-27 12:38:59 +07:00
QDarkRexandClaude Opus 5.5 15b749c2ba fix(kernel): return 64-bit offsets from sceKernelLseek
The SCE ABI returns off_t; offsets above INT_MAX threw instead of being returned.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-27 12:38:59 +07:00
QDarkRexandClaude Opus 5.5 76b7f998f5 fix(kernel): give every thread a pthread handle and keep mutex ownership consistent
- scePthreadSelf returned null on Linux and for threads not created by
  scePthreadCreate (including the main thread); such threads now get a
  lazily adopted, non-joinable handle
- scePthreadExit on Linux skipped FinishThread, losing the join value
- detached threads on Linux were never freed; use the reference count
  already used on Windows
- unlocking a recursive mutex from a non-owner was undefined behaviour;
  return SCE_KERNEL_ERROR_EPERM
- scePthreadCondTimedwait did not restore the mutex owner after waking,
  so another thread locking during the wait made the waiter's unlock
  fail with EPERM and left the mutex locked forever
- SCE_KERNEL_ERROR_ETIMEDOUT in Cond.cpp was 0x80020062 instead of 0x8002003C

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-27 12:38:59 +07:00
ownerandClaude Sonnet 5 6e810feb50 docs: drop SPIR-V gate note from TechnicalDebt.md per maintainer feedback
Maintainer noted the opt-in-via-documented-flag SPIR-V validation gap
isn't the silent-stub category this doc tracks; the README correction
stands on its own.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-26 23:30:21 -06:00
QDarkRexandClaude Opus 5.5 908befe81d feat(relinker): add --windows-gui to emit a GUI subsystem executable
Generated executables always used the console subsystem and opened a
console window on launch. The opt-in flag writes IMAGE_SUBSYSTEM_WINDOWS_GUI.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-27 12:24:15 +07:00
QDarkRexandClaude Opus 5.5 7ac1198e74 fix(audioout): reject zero sample count and frequency in sceAudioOutOpen
A zero frequency was stored and later used as a divisor when computing
the output block duration. Return SCE_AUDIO_OUT_ERROR_INVALID_SIZE and
SCE_AUDIO_OUT_ERROR_INVALID_SAMPLE_FREQ instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-27 12:24:15 +07:00
QDarkRexandClaude Opus 5.5 f8485ce6a6 fix(relinker): return unpacked exit status and wait for a single Enter in autorun
std::system returns a wait status on POSIX, so returning it from main
truncated a guest exit code of 1 (status 256) to 0. The prompt also
required pressing Enter twice because cin.get followed cin.ignore.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-27 12:24:14 +07:00