feat(libSceGnmDriver): add mode-aware init states #18217
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18217"
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 DonRyuzaki on 2026-11-10T21:43:27Z.
What
inFAMOUS Second Son's regular GNM import report #17581 includes sceGnmDrawInitDefaultHardwareState350 (yb2cRhagD1I) and sceGnmDrawInitToDefaultContextState400 (im2ZuItabu4). Both currently exist only in the Neo provider, while the title imports the regular libSceGnmDriver.prx.
This adds the two regular exports. They select the base or Neo command packet sequence through sceKernelIsNeoMode, which already derives its answer from title metadata. The Neo arrays are shared with the existing Neo provider; the derived base 350 and 400 sequences were compared word-for-word with pinned shadPS4 source and matched exactly. A new test checks base and Neo title metadata in separate processes, packet boundaries, mode-specific registers and buffer errors.
This fixes two imports, not the rest of #17581 or title execution. Packet contents and null-buffer error are not measured on a PS5; the debt entry records that limit. Actual open patches in #16882, #17711, #17942, #6977, #17393 and #17396 were checked for these two regular exports; none owns them.
Tested
Merged upstream main
00cb2314f490fea6e113bf9a2773867a60ee4771; exact validated head610b60ec08fb66f19423e7fa245109ce9603be73, tree8d92278bbf16648ea0798d36bc8b38afeb5b440a.BUILD_TESTING=ON, eight compiler jobs. The completelibsruntime target and the named focused test executables built on this exact tree. Third-party submodule pins are unchanged from the build cache.public_headers,guest_gnm_driver_init_modes,gnm_default_state_200,guest_gnm_driver, andguest_gnm_neo_default_stateeach passed three consecutive CTest runs: 15/15 executions across 5 test names, zero skips, 84.61 seconds combined CTest wall time. Usedctest --no-tests=error --output-on-failure --repeat until-fail:3with the exact-name filter.git diff --checkandtools/check_conventions.pyagainst the pinned main and this PR's title/body pass. A merge preview against later mainab6ef0b5629d5f0412217dcceea6deac7b8b0b01passed before push.Checklist
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-12T21:04:10Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The new test for
sceGnmDrawInitToDefaultContextState400cannot pass as written: it walks packet boundaries over all 256 words, but the function writes only 98 (base) or 102 (Neo) words.Changes are required before merge: fix the packet-boundary check in
core/libs/prx/libSceGnmDriver/tests/InitModes.cpp:106so it covers only the words the function writes.What I ran
8bd393e782b1322b89afc80f8436dfaf21f169a1, basemain.Export.cpp440–456, the NeoWriteContextState, the start of the NeoContextState400array).InitSequences.hpp.Results
Findings
Blocking
core/libs/prx/libSceGnmDriver/tests/InitModes.cpp:106: the 400 test callsWholePackets(words)over the whole 256-word buffer. The function writes only 98 words in base mode and 102 in Neo mode (Export.cpp:453, and the Neo array has 102 entries). The rest of the buffer keeps the0xdeadbeeffill. That value decodes as a packet with a count of0x1ead, so the walk runs past the end,WholePacketsreturns false, and the test throws "400 packets are invalid" in both modes. The test therefore fails by its own logic, whatever the sequences contain.WholePackets(98 for base, 102 for Neo) and check that prefix only. The prefix checks at lines 102–105 already assume this layout.Non-blocking
core/libs/prx/libSceGnmDriver/Export.cpp:453: the 400 writer returns 256 while it writes only 98 or 102 words. This matches the Neo provider'sWriteContextState(core/libs/prx/libSceGnmDriverForNeoMode/Export.cpp:33-38), so it is consistent, but the unwritten tail of the caller's buffer is left as it was. Worth a sentence in the debt entry if that is the intended contract.Sources
github.com/boykopovar/AnyPS5@8bd393e782/core/libs/prx/libSceGnmDriver/tests/InitModes.cpp (L106)github.com/boykopovar/AnyPS5@8bd393e782/core/libs/prx/libSceGnmDriver/Export.cpp (L449-L455)Not verified
8bd393e(9/9 and 12/12 passes, the PRX hash, the hosted Windows job). I did not repeat them, and the code reading above says the 400 check cannot pass. Only a fresh run settles which is right.sceKernelIsNeoModereads theparam.sfofixture from the working directory, which the test's child process depends on.To get this to a good state
guest_gnm_driver_init_modeson the new head and post the unedited output.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T03:02:22Z.
Review: APPROVED
Reviewed — looks good
The changed packet writers and mode selection are consistent with the inspected sequences and buffer handling; the author reports focused builds and tests, which I did not run.
What I ran
Reviewed head
599084acf8fc3bbc0e16a5c9e12efb1c60c0f736from the prepared bundle. No build or tests were run in this review. The PR description reports successful Linux builds and 12/12 focused test executions.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No build or test was run independently. Console, game, GPU, Windows runtime, and full-suite behavior were not verified.
review/files.jsonwas not supplied; the manifest lists five changed files and marks each as included, and all five were read. No files were excluded in the manifest excerpt reviewed.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T19:22:53Z.
Review: APPROVED
Reviewed — looks good
The change adds the two regular GNM exports with base/Neo packet selection and focused tests; I found no blocking defect in the changed code I read.
What I ran
Reviewed head
610b60ec08fb66f19423e7fa245109ce9603be73usingrepo_read.pyto inspect the prepared diff and repository files. I ran no build or tests; the test runs described in the PR are author-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No commands, builds, or tests were run. Console behavior and the packet sequences were not independently verified. All changed files listed in the manifest were read:
core/libs/prx/libSceGnmDriver/CMakeLists.txt,core/libs/prx/libSceGnmDriver/Export.cpp,core/libs/prx/libSceGnmDriver/include/Api.hpp,core/libs/prx/libSceGnmDriver/tests/InitModes.cpp, anddocs/dev/debt/libSceGnmDriver.md. No changed files were excluded.To get this to a good state
Nothing is required.