Skip to content

test(libSceFont): cover the sceFontRebindRenderer return codes - #12585

Merged
adriadam10 merged 2 commits into
boykopovar:mainfrom
xXPBSXx:test/font-rebind-renderer
Oct 29, 2026
Merged

adriadam10 merged 2 commits into
boykopovar:mainfrom
xXPBSXx:test/font-rebind-renderer

Conversation

@xXPBSXx

@xXPBSXx xXPBSXx commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds a test for sceFontRebindRenderer, which had none. The test opens a font without a renderer and checks each return the function has: a null handle and a block whose handle magic is zero give SCE_FONT_ERROR_INVALID_FONT_HANDLE, an unbound font gives SCE_FONT_ERROR_NOT_BOUND_RENDERER, a bound font gives SCE_FONT_OK (twice in a row), and after sceFontUnbindRenderer the font reports NOT_BOUND_RENDERER again.

The first commit adds the test; the library code is unchanged. The second commit adds an entry for sceFontRebindRenderer to the libSceFont technical debt: the function follows the shadPS4 port and its return codes are unmeasured. Three of the local titles import the function (imported, not measured as called). The SCE_FONT_ERROR_FATAL branch (a renderer with a wrong magic) and the style copy done on success are not covered: the first needs a corrupted renderer, the second cannot be observed through the public API.

Tested

Windows 10 (MinGW GCC 15.2, Release) and WSL2 Ubuntu 24.04 (GCC 13.3, Release; virtualised kernel, not bare-metal), on the first commit (head 9634513788) over main e4da19a:

  • ctest -R guest_font_rebind_renderer --repeat until-fail:3 passes 3 of 3 on both.
  • Two deliberate changes to the returned value make it fail, 3 of 3 on each system, with the test's own message: the unbound path returning SCE_FONT_OK, and the bound path returning SCE_FONT_ERROR_NOT_BOUND_RENDERER. The code was restored afterwards.
  • The other guest_font* tests pass on Windows (9 of 9, including this one).
  • tools/check_conventions.py --base upstream/main passes.
  • The second commit only adds a line to the technical debt file; tools/check_conventions.py --base upstream/main passes on the new head.
    Not tested: macOS.

Overlap

I took the changed files of each of the 1410 open pull requests from git diff --name-only against its merge base. Five other open pull requests changed core/libs/prx/libSceFont/CMakeLists.txt when I measured: #12018, #12025, #8250, #12012 and #11547 (the last two have since been merged). Three open pull requests change docs/dev/debt/libSceFont.md: #12528, #8250 and #5209; none touches the new entry or the "Unknown function info" heading. git merge-tree against main 319621b: this head alone merges cleanly, and so does each pair of this head with #12018, #12025, #12528, #5209, #12012 or #11547. The pair with #8250 conflicts, but #8250 conflicts with main on its own, so the conflict is not caused by this PR. Against main 3a2b919, which includes #12012 and #11547, this head merges cleanly. The PR is based on main e4da19a.

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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

AI-assisted (Claude Code).

🤖 Generated with Claude Code

sceFontRebindRenderer had no test. The new one opens a font without a renderer
and checks every return it reports: a null handle and a block with a zero
handle magic give SCE_FONT_ERROR_INVALID_FONT_HANDLE, an unbound font gives
SCE_FONT_ERROR_NOT_BOUND_RENDERER, a bound font gives SCE_FONT_OK (twice), and
the font reports NOT_BOUND_RENDERER again after sceFontUnbindRenderer.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@adriadam10 adriadam10 self-assigned this Oct 28, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

@xXPBSXx Thanks for the coverage; the cases are well chosen and the mutation checks are useful. One thing before this can go in: every expectation comes from our current Open.cpp (sceFontRebindRenderer, lines 574-596), which was ported from shadPS4's implementation, and nothing records where the behaviour comes from. In particular the INVALID_FONT_HANDLE for a zero-magic block, NOT_BOUND_RENDERER for an unbound font and OK repeated on a bound one. docs/dev/debt/libSceFont.md has no entry for this function, so the test would pin unmeasured behaviour as if it were the console's.

Could you do one of these?

  1. Point to a source for the codes (a libSceFont.sprx disassembly, a console measurement, SDK documentation) and mention it in the PR description.
  2. Add an "Unknown function info" bullet to docs/dev/debt/libSceFont.md saying sceFontRebindRenderer follows the shadPS4 port and its return codes are unmeasured.

Everything else (registration, the Windows unwind and PATH handling, allocation accounting) looks right.

…S4 port

The return codes of sceFontRebindRenderer come from our shadPS4-based port and
are unmeasured; the new test pins them, so the debt file now says so.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 12757 docs/dev/debt/libSceFont.md L26

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 8250 core/libs/prx/libSceFont/CMakeLists.txt
docs/dev/debt/libSceFont.md

@xXPBSXx

xXPBSXx commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. I have no console measurement or disassembly of these codes, so I took the second option: the new commit 75bb8cb adds an "Unknown function info" entry for sceFontRebindRenderer to docs/dev/debt/libSceFont.md. It says the function follows the shadPS4 port, lists the return codes as unmeasured (invalid handle, unbound font, wrong renderer magic, and SCE_FONT_OK on a bound font, repeated calls included), and notes that the test pins the invalid handle, unbound and bound cases while the wrong-magic case is not covered.

AI-assisted (Claude Code).

@adriadam10
adriadam10 merged commit cc0e00e into boykopovar:main Oct 29, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants