Skip to content

fix(libSceNgs2): keep CalcListener basis when front and up are parallel - #6594

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
notaxeltv:fix/ngs2-parallel-listener-orient
Oct 19, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
notaxeltv:fix/ngs2-parallel-listener-orient

Conversation

@notaxeltv

@notaxeltv notaxeltv commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What

sceNgs2GeomCalcListener threw Unit: invalid argument when orient_front and orient_up were parallel (zero cross product). PPSA15552 (Dead Cells) hits that after moving the listener with orient_front={0,0,1} and orient_up={0,0,1}.

When the right axis vanishes, replace up with (0,1,0) or (1,0,0) and rebuild the orthonormal basis. Zero-length orientation vectors still throw. Does not implement GeomApply (see #5974).

Tested

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: PPSA15552
  • GPUs tested: n/a
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5797 docs/dev/debt/libSceNgs2.native.md
PR 6680 core/libs/prx/libSceNgs2.native/src/Geom.cpp
core/libs/prx/libSceNgs2.native/tests/Ngs2Geom.cpp
docs/dev/debt/libSceNgs2.native.md

@jotitadev jotitadev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linux run: head 4a486a7ed merged onto main 5d9dcc42d (clean merge), in one tree with seven other library PRs that share no files with this one. The description lists Windows only.

Machine: Ubuntu 26.04, Intel i7-8700, GCC 15.2, full build, Release, BUILD_TESTING=ON.

  • ngs2_geom passes, and passes 5/5 with --repeat until-fail:5.
  • Test only, with Geom.cpp from main: ngs2_geom aborts with Unit: invalid argument, which is the original error. So the new parallel front/up case covers the fix.
  • Non-GPU suite (ctest -E "^agc|gpu|vulkan|video_out"): no regressions. The only failures are file_writer_binary and file_writer_text, which also fail on main on this machine.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

@Matheuswells

Copy link
Copy Markdown

Windows run: head 4a486a7ed merged onto main 5d9dcc42d (clean apply). The description lists Windows only.

Machine: Windows 11 Pro 10.0.26200, Intel i5-13450HX, 24 GB RAM, NVIDIA GeForce RTX 3050 6GB Laptop GPU (Windows driver 32.0.16.1742), WinLibs GCC 15.2.0 r7, full build, Release, BUILD_TESTING=ON.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
image

@notaxeltv
notaxeltv force-pushed the fix/ngs2-parallel-listener-orient branch from 4a486a7 to dae7b88 Compare October 16, 2026 17:15
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 16, 2026
@blawesom

Copy link
Copy Markdown
Contributor

Rebase handoff — rebased onto current main (authorship unchanged). One docs-debt conflict, unioned.

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV):

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/6594
git checkout <your branch>
git merge --ff-only FETCH_HEAD

Head is e0bb29b9f.

@xXPBSXx

xXPBSXx commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Dead Cells (PPSA15552) reaches this throw on main 7bc790597 after leaving the title menu.

  • Log: PPSA15552_rRT un_054747.err lines 287-290: [libc] unhandled exception 'St16invalid_argument', terminate called after throwing an instance of 'std::invalid_argument', what(): Unit: invalid argument, FATAL: abort() (SIGABRT). The throwing address is libSceNgs2.prx+0x2b3f3 (line 297, [rsp+0x98]). Unit in core/libs/prx/libSceNgs2.native/src/Geom.cpp throws for a zero-length vector (APS5_INVALID_ARG_EX). Ngs2GeomCalcListener calls it three times (front, up and the cross product, which is zero for parallel vectors); the throw address does not tell them apart, so this matches the case fix(libSceNgs2): keep CalcListener basis when front and up are parallel #6594 handles but does not prove it.
  • Conditions: Windows 10, NVIDIA RTX 4080 SUPER, main 7bc790597, all 126 libs rebuilt, fresh relink, APS5_PAD_INPUT_FILE navigation only (cross x12 and down/right over 190 s after start, no window events), run 05:47-05:51 local. The same title ran 300 s with no input on the same build without stopping (run_052847.err, no what() or FATAL), so the throw is behind the first menu entry.
  • Not established: the actual orient_front and orient_up values the title passes (the log does not print them). I did not run this title with the PR applied, so this confirms the throw on main, not the fix.
  • Superseded check: git log upstream/main -S"front and up are parallel" finds nothing. fix(libSceNgs2): keep CalcListener basis when front and up are parallel #6594 is open and conflicts with main; a rebase variant was posted on 17.10. in this thread.

AI-assisted (Claude Code).

@adriadam10 adriadam10 self-assigned this Oct 19, 2026
PPSA15552 passes matching front/up after a listener move; pick a perpendicular up hint instead of throwing so Dead Cells can keep running.

Co-authored-by: Cursor <cursoragent@cursor.com>
@adriadam10
adriadam10 force-pushed the fix/ngs2-parallel-listener-orient branch from dae7b88 to 07d9f40 Compare October 19, 2026 06:31
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 19, 2026
@xXPBSXx

xXPBSXx commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Dead Cells (PPSA15552): with this change the Unit: invalid argument throw from my earlier comment did not occur in the one run I did.

  • Without the change (main 7bc790597): run_054747.err line 285 umount2 mode=0x10001, lines 288-290 terminate called after throwing an instance of 'std::invalid_argument' / what(): Unit: invalid argument / FATAL: abort() (SIGABRT); the same throw in a second, independent run driven by NitroGen (run_073501.err). 2 of 2 runs with input threw without the change.
  • With the change: tree = main 9817d53cc + the PR commit dae7b8837 (cherry-picked, one docs-debt conflict resolved by taking the PR side, which does not affect runtime; blawesom's rebase handoff resolved the same conflict). Same title, same point: run_083422.err line 287 umount2 mode=0x10001, then no throw and no FATAL (545 NitroGen pad-file cycles, Stopp: kein FATAL). 1 of 1 runs did not throw with it. The old run printed about 1300 further lines (thread dump) after that point, the new one none.
  • The PR head is now 07d9f409a; I tested the earlier head dae7b8837 and did not run 07d9f409a.
  • Conditions: Windows 10, NVIDIA RTX 4080 SUPER, all 126 libs rebuilt on this tree, fresh relink, pad-file input only (APS5_PAD_INPUT_FILE, no window events), one run. The runner ran 560 s; the last stderr line is at about 403 s.
  • Not established: the game's actual orient_front/orient_up values (not logged), so the link between the throw and parallel vectors is a reading of Unit in Geom.cpp, not a logged value; what the game does after the save close (stderr stays silent for the last ~2.5 min and the screen changed in only 8 of 545 cycles, none after the first input: the runner marks the menu as unklar); I did not judge the picture. So this shows that the throw did not occur with the change, not that Dead Cells is playable.

AI-assisted (Claude Code).

@adriadam10
adriadam10 merged commit 3cda671 into boykopovar:main Oct 19, 2026
10 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the new basis construction: with front=up={0,0,1} it yields the identity, which the updated test pins and which aborts with Unit: invalid argument on main (confirmed by @jotitadev and @Matheuswells). Zero-length vectors still throw.

I rebased onto current main (only conflict: the sceNgs2GeomCalcListener line in docs/dev/debt/libSceNgs2.native.md; kept main's text and added the parallel front/up case). The 12 Ngs2 tests pass on the rebased tree. Merging via the queue.

@parl0v

parl0v commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Confirmation on plain main: Dead Cells (PPSA15552, v01.005) is playable on main 408455b with no other PRs on top, so without #5898 and #5974. Windows 10 19045, RTX 4060 8 GB, NVIDIA 617.42.

  • Title menu, intro and about 12 minutes of a run (combat, pickups, several areas) at about 60 FPS (the window title showed 58.9 to 59.9), with no abort.
  • On main 46f2762, from before this PR, the same path aborted when the run started: sceNgs2GeomCalcListener threw Unit: invalid argument.
  • Setup note for anyone relinking it: this dump's sce_module/libc.prx only unwraps with tools/unwrap_self.py from fix(tools): unwrap SELF dumps that leave out the version segment #7782 on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs prx unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants