Skip to content

fix(libSceCommonDialog): return ALREADY_SYSTEM_INITIALIZED from a second sceCommonDialogInitialize - #8618

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
Lindamea1:fix/commondialog-second-init-system-initialized
Oct 23, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
Lindamea1:fix/commondialog-second-init-system-initialized

Conversation

@Lindamea1

@Lindamea1 Lindamea1 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What

On main d6eafa5, a second sceCommonDialogInitialize returns 0x80B80004 (Export.cpp L12-L18, value in CommonDialog.hpp L251). That is SCE_COMMON_DIALOG_ERROR_ALREADY_INITIALIZED, the code a dialog's own Initialize returns, such as sceMsgDialogInitialize. sceCommonDialogInitialize is the common-dialog system initializer under those dialogs, and its second call returns SCE_COMMON_DIALOG_ERROR_ALREADY_SYSTEM_INITIALIZED, 0x80B80002:

Some callers accept only SCE_OK or the system code. In EA DirtySDK's PS4 source, PrivilegeApiCreate returns NULL unless sceCommonDialogInitialize returns SCE_OK or ALREADY_SYSTEM_INITIALIZED, so on main it fails whenever something in the process initialized the common dialog first.

Titles do call it twice. @JJenkx found two:

  • Daxter (PPSA09695), a PSP game in Sony's PSP emulator, stops on main with FAILED REQUIRE(ret == SCE_OK || ret == SCE_COMMON_DIALOG_ERROR_ALREADY_SYSTEM_INITIALIZED) Could not initialize CommonDialog (80B80004) (comment, Daxter (PPSA09695) #8661). In its eboot.bin, the caller of sceCommonDialogInitialize compares the result with 0x80b80002 before testing for 0; a second call site accepts 0 or 0x80b80002 and handles 0x80b80004 and 0x80b80008 separately.
  • Arkanoid - Eternal Battle (PPSA06327) stops on main 2 s in with uncaught exception 'sceCommonDialogInitialize error, code=0x80b80004' of type Stormancer::PSN::PSNException. With the previous revision of this PR, which returns the same codes as this one, it reaches its mode-select menu (comment, Arkanoid - Eternal Battle (PPSA06327) #9476).

8ad0a9897 returned 0x80B80002. #7572 changed it to 0x80B80004, and its merge comment checked the value against MsgDialog and PlayerSelectionDialog, whose own Initialize does return 0x80B80004. A #5852 comment draws the line between the two: "0x80B80004 (per-dialog), not 0x80B80002, which is ALREADY_SYSTEM_INITIALIZED".

This change:

  • Adds COMMON_DIALOG_ERROR_ALREADY_SYSTEM_INITIALIZED (0x80B80002) to CommonDialog.hpp and returns it from a second sceCommonDialogInitialize, instead of fix(libSceCommonDialog): ALREADY_INITIALIZED is 0x80B80004 #7572's 0x80B80004.
  • Keeps COMMON_DIALOG_ERROR_ALREADY_INITIALIZED (0x80B80004) in the header. Eight of the ten dialog libraries that include the header return it from their own Initialize; their values stay as they are.
  • Keeps fix(libSceCommonDialog): ALREADY_INITIALIZED is 0x80B80004 #7572's compare_exchange_strong.
  • Adds a Functional entry to docs/dev/debt/libSceCommonDialog.md: the value of a repeated call is not measured on a console by the project. The entry lists the sources and notes that a third call is not covered.

sceCommonDialogIsUsed stays the silent stub listed in docs/dev/debt/libSceCommonDialog.md. Not measured on a console by me: the hardware log above is a third-party run of two calls on firmware 12.40, and the test's third call is not in it.

Tested

Gentoo Linux, kernel 7.2.8, GCC 16.2.1, glibc 2.43, Ninja, Release, BUILD_TESTING=ON, on main 7e2ba73.

  • guest_common_dialog (core/libs/tests/GuestCommonDialog.cpp) compared the second call with the header constant, so it followed fix(libSceCommonDialog): ALREADY_INITIALIZED is 0x80B80004 #7572. It now pins the literal 0x80B80002 for the second call and checks that a third call returns it too. The sceCommonDialogIsUsed checks are unchanged.
  • Negative control: with Export.cpp and CommonDialog.hpp from main and the library rebuilt, the test aborts at the second call (ctest Subprocess aborted). With this change it passes, 20 runs out of 20.
  • Tests the change reaches, selected by tools/select_tests.py as CI selects them: 244 passed, 0 failed, 0 skipped. They include the tests of the ten dialog libraries that include CommonDialog.hpp; eight of those libraries and two of their tests use COMMON_DIALOG_ERROR_ALREADY_INITIALIZED.
  • tools/check_compile.py --base upstream/main: 2 translation units compile.
  • Windows: Export.cpp, GuestCommonDialog.cpp and the 20 other files that include CommonDialog.hpp (ten dialog libraries' Export.cpp and their tests) pass x86_64-w64-mingw32-g++ 16.2.0 -fsyntax-only -Wall -Wextra. Only libSceWebBrowserDialog/Export.cpp warns, with the same two -Wunused-parameter warnings as with main's header. This is a syntax check, not a Windows build or run.
  • tools/check_conventions.py --base upstream/main with this title and body: all checks passed.
  • tools/pr_overlap.py --branch fix/commondialog-second-init-system-initialized: besides this PR itself, it lists feat(libSceCommonDialog): declare 14 pending exports #9623, which also adds a section after Silent stubs in docs/dev/debt/libSceCommonDialog.md; whichever merges second keeps both sections (Unknown function info, then Functional). No order is agreed with its author yet (asked in this pull request's thread), so Depends on is none. feat(libSceNpProfileDialog): implement the dialog lifecycle #9152 adds constants after COMMON_DIALOG_ERROR_ALREADY_INITIALIZED; the two no longer conflict textually (git merge-tree).
  • Not run with a title by me. @JJenkx ran two titles with the previous revision of this branch, whose sceCommonDialogInitialize returns the same codes:

Not run by me on Windows, macOS or a console.

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: PPSA09695 Daxter (PPSA09695) #8661, PPSA06327 Arkanoid - Eternal Battle (PPSA06327) #9476
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

@JJenkx

JJenkx commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Title evidence from Windows, for what it's worth: Daxter (PPSA09695, PS5 PSP Classics, Sony's libpsemu emulator) needs this change to start.

@Lindamea1

Copy link
Copy Markdown
Contributor Author

Thanks, this is the title evidence the PR was missing, and the disassembly shows the title's SDK code telling the two codes apart. I've put PPSA09695 #8661 on the Unblocks line and added your findings to the description, linking this comment and #8661.

AI-assisted: yes (Claude Code).

@JJenkx

JJenkx commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Title evidence for this fix: Arkanoid - Eternal Battle (PPSA06327) 01.000.000. Linux 7.2.9, Radeon RX 6650 XT, RADV Mesa 26.2.4, GCC Release.

Setup

  • Base: my Release build of main 38d3c0858a + fix(agc): resolve and render a multisampled target through its sRGB twin format #8847 (an unrelated AGC change).
  • Candidate: the same libraries with only libSceCommonDialog.prx replaced by a build of 38d3c0858a with this PR merged. Every other library is byte-identical, and the title is relinked against each set. Candidate libSceCommonDialog.prx sha256 prefix fd25c6d951b3fec9.
  • Same 180 s input schedule in both runs, Cross every 15 s.

Result

  • Base: the title stops 2 s in with Terminating due to uncaught exception 'sceCommonDialogInitialize error, code=0x80b80004' of type Stormancer::PSN::PSNException. 0x80B80004 is the code main returns from a repeat sceCommonDialogInitialize. I didn't trace which caller came first.
  • This PR: no exception, so Stormancer continues with the code this PR returns. The title reaches its mode-select carousel (Retro / Eternal Battle / Versus) and runs at 59.94 FPS for 183 s with no driver stop. The scripted Cross selects Eternal Battle, an online mode, which shows "Connection attempt failed". That's expected without PSN.

Candidate at 60 s: 20261021-pr8618-PPSA06327-after-60s.png

AI-assisted testing and report: yes, Claude Code.

…ond sceCommonDialogInitialize

A second sceCommonDialogInitialize returned 0x80B80004
(ALREADY_INITIALIZED), the code each dialog's own Initialize returns.
The common-dialog system initializer returns 0x80B80002
(ALREADY_SYSTEM_INITIALIZED), as shadPS4 and the SDK error names have
it, so callers that accept only SCE_OK or ALREADY_SYSTEM_INITIALIZED
treated a second call as a failure. The header keeps
ALREADY_INITIALIZED for the dialog libraries that return it. The test
pins the literal instead of the header constant, and the debt entry
records that a repeated call's value is not measured on a console.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Lindamea1
Lindamea1 force-pushed the fix/commondialog-second-init-system-initialized branch from 0f2dc38 to 93170e6 Compare October 22, 2026 08:25
@Lindamea1

Copy link
Copy Markdown
Contributor Author

Thanks for the Arkanoid run and the bring-up thread. I've put PPSA06327 #9476 on the Unblocks line next to Daxter and added your findings to the description, linking your comment.

While rebasing I found a problem with the branch as it was. On current main, CommonDialog.hpp is included by eight dialog libraries and two tests that use COMMON_DIALOG_ERROR_ALREADY_INITIALIZED, the constant this PR had replaced. The merge was textually clean but would not have compiled. The header now keeps that constant (0x80B80004, which those libraries' own Initialize returns) and adds COMMON_DIALOG_ERROR_ALREADY_SYSTEM_INITIALIZED (0x80B80002) next to it. sceCommonDialogInitialize returns the same codes as in the build you tested. This also removes the textual conflict with #9152.

Rebased onto main 7e2ba73, and added a Functional entry to docs/dev/debt/libSceCommonDialog.md with the sources for the repeated-call value, which the project has not measured on a console. guest_common_dialog passes 20 times out of 20, and still aborts at the second call with Export.cpp and the header from main. The 244 tests tools/select_tests.py picks, including the ten dialog libraries' tests, pass. The description is updated.

The new debt entry conflicts textually with #9623, which adds an Unknown function info section at the same place in that file. @xdCloudy, either order works for me: whichever merges second keeps both sections, Unknown function info before Functional as in the index, and I'll rebase this one if #9623 goes first.

AI-assisted: yes (Claude Code).

@github-actions github-actions Bot added the docs label Oct 22, 2026
@oneandonlydean oneandonlydean self-assigned this Oct 22, 2026
@oneandonlydean
oneandonlydean merged commit f77ad55 into boykopovar:main Oct 23, 2026
11 of 12 checks passed
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.

3 participants