feat: boot PPSA04263 with its own sce_module, into the story mode load (supersedes #144) #153
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/153"
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 STL1te on 2026-09-29T18:34:09Z.
feat: boot PPSA04263 with its own sce_module, into the story mode load (supersedes #144)
What
Supersedes #144, rebased on current
mainand reworked after the review there. PPSA04263 (version01.010.002, master01.00) now runs with its ownsce_module: the relinker is run without--skip-sce-moduleor any exclusion, and the title'slibc.prx,libSceJobManager.prxandlibSceNpCppWebApi.prxrun as guest modules. The only import the title libc was missing issceKernelDebugWriteCppExceptionInfo, which is now implemented.The title plays the intro movie with sound, renders the legal and calibration screens, the main menu and Settings, and loads story mode until the first shader the recompiler cannot structure (see Not done yet).
Differences from #144:
main(75a8668). The two commits of #83 are gone, since #83 is merged.scePadoutput (light bar, vibration, trigger effects) keeps the implementation from #84. The no-op this branch had is dropped.DirectMemory:FreeRunfrom #81 is kept next to this branch'sDirectMemoryFind.style: drop the branch's code comments per CONVENTIONS.md). The commits before it keep them, with the reasoning behind each change, for anyone who investigates that code later.sce_module(sceKernelDebugWriteCppExceptionInfo) and the story mode load (the shader recompiler, AGC driver and heap mirror entries below).Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-09-30T05:01:16Z.
Progress report (
75a8668→3a76b18)📈 System libraries: 74.63% (+1.93%, +97 implemented, +43 declared functions)
✅ 97 implemented
sceAgcAsyncRewindPatchSetRewindStatesceAgcCbNopGetSizesceAgcCbSetShRegisterRangeDirectGetSizesceAgcCbSetUcRegisterRangeDirectGetSizesceAgcDcbDrawIndexOffsetGetSizesceAgcDcbEventWriteGetSizesceAgcDcbSetCxRegisterDirectsceAgcDcbSetCxRegisterDirectGetSizesceAgcDcbSetIndexBufferGetSizesceAgcDcbSetIndexSizeGetSizesceAgcDcbSetShRegisterDirectsceAgcDcbSetShRegisterDirectGetSizesceAgcDcbSetUcRegisterDirectsceAgcDcbSetUcRegisterDirectGetSizesceAgcJumpPatchSetTargetsceAgcQueueEndOfPipeActionPatchDatasceAgcQueueEndOfPipeActionPatchGcrCntlsceAgcQueueEndOfPipeActionPatchTypesceAgcRewindPatchSetRewindStatesceAgcUnknownFuseShaderHalvessceAgcUnknownGetFusedShaderSizesceAgcUnknown_Ikfdt_MrIqCEsceAgcDriverInitResourceRegistrationsceAgcDriverQueryResourceRegistrationUserMemoryRequirementssceAgcDriverRegisterWorkloadStreamsceAgcDriverSetHsOffchipParamsceAgcDriverSetTFRingsceAppContentDownloadDataGetAvailableSpaceKbsceAppContentTemporaryDataFormatsceAppContentTemporaryDataGetAvailableSpaceKbsceAppContentTemporaryDataMount2sceAudioOut2GetSpeakerArrayAmbisonicsCoefficientssceAudioOut2GetSpeakerArrayMemorySizesceAudioOut2SpeakerArrayCreatesceAudioOut2SpeakerArrayDestroysceContentDeleteInitializesceContentDeleteTerminatesceContentExportInit2sceContentExportTermsceContentSearchInitsceContentSearchTermsceGameLiveStreamingInitializesceGameLiveStreamingTerminatesceImeKeyboardClosesceImeKeyboardOpensceImeUpdatesceMsgDialogInitializesceMsgDialogTerminatesceMsgDialogUpdateStatussceNpGetNpReachabilityStatesceNpHasSignedUpsceNpRegisterNpReachabilityStateCallbacksceNpRegisterPlusEventCallbacksceNpRegisterPremiumEventCallbacksceNpRegisterStateCallbacksceNpUnregisterPremiumEventCallbacksceNpUnregisterStateCallbacksceRemoteplayGetConnectionStatussceRemoteplayInitializesceRemoteplayTerminatesceSharePlayInitializesceSharePlayTerminatesceSystemServiceDisableNoticeScreenSkipFlagAutoSetsceSystemServiceSetNoticeScreenSkipFlagsceVideoRecordingGetInfosceVideoRecordingSetInfosceVoiceConnectIPortToOPortsceVoiceCreatePortsceVoiceDeletePortsceVoiceDisconnectIPortFromOPortsceVoiceEnd_nid_postfixsceVoiceGetBitRatesceVoiceGetPortAttrsceVoiceGetPortInfosceVoiceGetVolumesceVoiceInitsceVoiceReadFromOPortsceVoiceSetThreadsParamssceVoiceSetVolumesceVoiceStartsceVoiceStopsceWebBrowserDialogInitializesceWebBrowserDialogTerminatesceWebBrowserDialogUpdateStatusgetpeername_nid_postfixsceKernelAprGetFileSizesceKernelAprGetFileStatsceKernelAprResolveFilepathsWithPrefixToIdssceKernelAprResolveFilepathsWithPrefixToIdsAndFileSizessceKernelAprSubmitCommandBufferAndGetIdsceKernelAprSubmitCommandBufferAndGetResultsceKernelAprWaitCommandBuffersceKernelCheckReachabilitysceKernelDebugWriteCppExceptionInfosceKernelFsyncsceKernelQueryMemoryProtectionshutdown_nid_postfix🆕 43 declared as stubs
sceAudioOutSetMixLevelPadSpksceContentDeleteByPathsceContentExportFinishsceContentExportFromFilesceContentExportFromFileWithThumbnailsceContentExportStartsceContentSearchCloseMetadatasceContentSearchGetMetadataFieldInfosceContentSearchGetMetadataValuesceContentSearchOpenMetadatasceContentSearchSearchContentsceMsgDialogGetResultsceMsgDialogOpensceNpCommerceHidePsStoreIconsceNpCommerceShowPsStoreIconsceNpEntitlementAccessAbortRequestsceNpEntitlementAccessDeleteRequestsceNpEntitlementAccessGenerateTransactionIdsceNpEntitlementAccessPollConsumeEntitlementsceNpEntitlementAccessRequestConsumeUnifiedEntitlementsceNpBandwidthTestAbortsceNpBandwidthTestGetStatussceNpBandwidthTestInitStartDownloadsceNpBandwidthTestInitStartUploadsceNpBandwidthTestShutdownscePlayerSelectionDialogTerminatesceRazorCpuJobManagerDispatchsceRazorCpuJobManagerJobsceRazorCpuJobManagerSequencesceSystemServiceInitializePlayerDialogParamsceSystemServiceLaunchPlayerDialogsceVideoRecordingClosesceVideoRecordingGetStatussceVideoRecordingOpensceVideoRecordingQueryMemSizesceVideoRecordingStartsceVideoRecordingStopvideoRecordingUnknown_iQS6DUtLybEsceWebBrowserDialogClosesceWebBrowserDialogGetResultsceWebBrowserDialogOpen_sceUlobjmgrRegisterObject_sceUlobjmgrUnregisterObjectImported from boykopovar/AnyPS5. Originally posted by STL1te on 2026-09-30T06:42:21Z.
CI fix: the build was failing only because of the FFmpeg package that came with
028d465(AJM MP3). There are three commits on top, and no code changes besides these:d252a3cfix(build): FFmpeg on Linux.bcrypt ole32 user32were linked unconditionally, which brokelibSceAjm.native.prxon Linux. They are now linked only under MinGW.ff_pb_80), andldrefuses those in a shared object.--exclude-libs,ALLon theffmpeginterface target keeps the archives' symbols local, which also keeps FFmpeg out of the prx's dynamic symbols.5cf8ffaci(windows): FFmpeg download. WinLibs ships its owncmake.exe(4.3, built with OpenSSL, no CA certificates), and it comes first inPATH. As a result,file(DOWNLOAD)of the FFmpeg package failed with curl error 60.SSL_CERT_FILEnow points it at the Git for Windows CA bundle.ee94280test(libc):guest_formattingis registered only on Windows.ea3f7b5).mainnever registered it; this branch did, for all platforms.snprintfsegfaults in glibc once arguments go to the stack. That code is the same onmainand is untouched here, so it's left for a separate fix.Both Build jobs pass at
ee94280, tests included: https://github.com/STL1te/AnyPS5/actions/runs/36678986766Imported from boykopovar/AnyPS5. Originally posted by boykopovar on 2026-09-30T07:07:53Z.
Problem: The Windows implementation didn't support mapping the same physical memory to multiple virtual addresses with write access - separate copies were used, so writes were disabled.
The fix I added to this PR: The memory was moved to a common backing - multiple addresses now reference the same data, and writes to any of them are immediately visible to the others. This fixed the regression on Dreaming Sarah - it used write access, so our PRXs should support it.
I haven't checked PPSA04263. If a regression appeared there, it can be fixed in future PRs. I'm currently checking for more regressions, and if everything else is fine, I'll merge it.
Imported from boykopovar/AnyPS5. Originally posted by boykopovar on 2026-09-30T07:33:41Z.
Can you check whether the game will actually use _ZNSt4_PadC2Ev_nid_postfix, _ZNSt4_PadD2Ev_nid_postfix, _ZNSt4_Pad7_LaunchEPP7pthread_nid_postfix, and _ZNSt4_Pad8_ReleaseEv_nid_postfix (Xthreads.cpp) in our libs/prx/libc? To check, you can make each of these functions throw exceptions when called. I suspect these functions are custom (in which case the game will take them from its own .guest.prx). If these functions from our libc.prx are still not called, you should remove them.
Imported from boykopovar/AnyPS5. Originally posted by STL1te on 2026-09-30T07:45:37Z.
Checked both ways.
Statically: the executable imports
_ZNSt4_PadC2Ev,_ZNSt4_PadD2Ev,_ZNSt4_Pad7_LaunchEPP7pthreadand_ZNSt4_Pad8_ReleaseEvfromlibc, and the title's ownsce_module/libc.prxexports all four. They are the stock Dinkumwarestd::threadlaunch helpers, not custom ones, and since the relinker lists the guest modules ahead of the host prx in DT_NEEDED, the imports bind tolibc.prx.guest.prx.Dynamically, as you suggested: with each of the four throwing, the title boots, reaches the menu and gets through the story-mode loading route (about 100 s, 2,860 frames) without any of them being called.
They are leftovers from the earlier
--skip-sce-moduleroute, where our libc stood in for the title's. The same holds for the rest ofXthreads.cpp(_Mtx_*,_Cnd_*,_Thrd_*,_Xtime_get_ticks): the guest libc exports all of them too. I'll remove the whole file from this PR rather than just the four functions. One note: the file is compiled intolibkernel.prx, notlibc.prx, even though the NIDs are libc's.Imported from boykopovar/AnyPS5. Originally posted by STL1te on 2026-09-30T07:58:14Z.
Checked, and removed in
9cfdbff.How I checked: the executable imports all four
std::_PadNIDs fromlibc, and the title's ownsce_module/libc.prxexports them; they are the stock Dinkumwarestd::threadlaunch helpers. Since the relinker lists the guest modules ahead of the host prx in DT_NEEDED, the imports bind tolibc.prx.guest.prx, never to ours. To confirm it the way you suggested, I made the four functions throw: the title boots, reaches the menu and loads story mode without any of them being called.The same holds for the rest of that file (
_Mtx_*,_Cnd_*,_Thrd_*,_Xtime_get_ticks) and for eight libc additions from the same commit (_FNan,_FDtest,_FExp,__udivti3,_Throw_Cpp_error,generic_category,localeconv,wcsncpy_s, alignedoperator new): each is imported fromlibcand exported by the guest libc. They were leftovers of the--skip-sce-moduleroute, where our libc stood in for the title's. All of them are gone now.Xthreads.cppwas compiled intolibkernel.prx, notlibc.prx, although the NIDs are libc's.I also went through every function the branch adds over
main(74) against the executable's import table and the guest modules' exports; the remaining ones are imported from libraries the title does not ship, so they stay.Imported from boykopovar/AnyPS5. Originally posted by STL1te on 2026-09-30T07:59:48Z.
One observation after your three memory commits (
abb9c85,f7c53a4,5e08eb4), same build otherwise, same route to story mode:ee94280)5e08eb4)deferred write-back failedin the logThe failures all read
BDA access failed: ... reason=2; the store hit 0x23dc00000+0x120f00000, read-only in the BDA table: stores through GPU-selected descriptors reach only writable ranges imported in place, not ones served by a mirror or a copy. So that direct-memory range is no longer imported in place by the host and is served by a mirror instead, which would explain both the memory growth and the refused GPU stores. I have not looked at the mapping code yet; if it helps, I can bisect the three commits and post the numbers.Imported from boykopovar/AnyPS5. Originally posted by boykopovar on 2026-09-30T08:08:19Z.
Another issue:
current = is_directory(root / "app0") ? root / "app0" : root;- with this change, ctests result depends on the app0 folder being nearby. Previously, it wasapp0at the beginning of the path. As I understand it, this is a fallback in case the executable is located inside the game files folder (app0)? If so, it's not needed; it would significantly complicate debugging. In the current main, the following structure is considered correct:Regarding BDA access failed - let's add fix in the next PRs, in this PR we'll limit ourselves to the current changes and the absence of regressions relative to main
Imported from boykopovar/AnyPS5. Originally posted by STL1te on 2026-09-30T08:16:29Z.
@boykopovar
Done in
3a76b18:current = rootagain. You are right about the origin: theapp0fallback came from the--skip-sce-moduleroute, where our libc opened the title's files. With the title's own libc every path arrives as absolute/app0/..., so the fallback was never taken. Verified with the layout you describe (executable,libs/,app0/,sce_module/underapp0): boot, menu and the loading route to story mode run the same, no file errors in the log.Agreed on the BDA import failures: I'll leave them out of this PR and bring the fix separately. For the record, on this branch as it stands the title now runs at about 21 frames per second on the loading route against 27 before
abb9c85, with 16 GB resident against 10; that is the copies the refused imports fall back to. I have the cause isolated (the driver refusesvkAllocateMemoryon a host range with a read-only page, which the write tracking of shared mappings arms), and will follow up with numbers in the next PR.Imported from boykopovar/AnyPS5. Originally posted by boykopovar on 2026-09-30T08:33:35Z.
It is advisable to open a PR that will contain only the fix for the causes of these three problems: