refactor(common-dialog): define the shared dialog status and error codes once #16362

Merged
LeandroLP23 merged 2 commits from upstream-pr/16362 into main 2026-11-12 13:34:42 +00:00
LeandroLP23 commented 2026-11-06 12:02:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-11-06T12:02:51Z.


What

Step 1 of #15643, without the busy change. The common dialog statuses, results and error codes were redefined in an anonymous namespace in 22 dialog libraries and 2 tests. CommonDialog.hpp now defines them once, and the copies are removed. No library returns a different value.

  • CommonDialog.hpp gains STATUS_NONE/INITIALIZED/RUNNING/FINISHED, RESULT_OK, RESULT_USER_CANCELED and the errors NOT_SYSTEM_INITIALIZED (0x80B80001), NOT_INITIALIZED, NOT_FINISHED, INVALID_STATE (0x80B80006), INVALID_ARGUMENT (0x80B8000A), NOT_RUNNING and ARG_NULL. COMMON_DIALOG_OK, ALREADY_SYSTEM_INITIALIZED and ALREADY_INITIALIZED were already there. Every removed copy had the same value as the shared one.
  • COMMON_DIALOG_ERROR_PARAMETER (libSceWebBrowserDialog's name for 0x80B8000A) is an alias of INVALID_ARGUMENT. #15643 proposed a single PARAM_INVALID name. Renaming would touch 59 lines in 11 files, inside functions that open pull requests are changing, so it is left for later.
  • COMMON_DIALOG_ERROR_BUSY stays in each library. 14 use 0x80B80007 and libSceInvitationDialog 0x80B80008, and which one is right is still the open question on #15643, so nothing changes there until it is decided.
  • libScePlayGoDialog (unprefixed names, its busy case is ERROR_INVALID_STATE = 0x80B80007) keeps its own codes except NOT_FINISHED. libScePlayerInvitationDialog is left as on main, because #14300 adds a busy code beside its constants.
  • GuestPlayerReviewDialog.cpp and GuestWebBrowserDialog.cpp included CommonDialog.hpp and defined the same names, which would now be ambiguous, so their copies go too. To keep an independent check of the numbers, GuestCommonDialog.cpp pins every shared value with a static_assert against its literal.

Tested

  • Windows 11, WinLibs GCC 15.2: all 25 changed C++ files compile with -fsyntax-only and the exact flags of a main build (ninja -t compdb), with the include paths pointed at this branch. As a negative check, a duplicate COMMON_DIALOG_STATUS_NONE planted in libSceSigninDialog fails with reference to 'COMMON_DIALOG_STATUS_NONE' is ambiguous.
  • I didn't build or run the dialog test executables locally. No value changes, and the static_asserts pin the shared ones. The Windows pull request job runs the changed guest tests.
  • python tools/check_conventions.py --base origin/main passes.
  • python tools/pr_overlap.py: 22 open pull requests touch these files, and none edits the constant lines. #16049 and #16051 conflict with main already, and their code hunks start at lines 39 and 45, after the constant blocks this changes. Rebased onto main 6c1efc7c59 after #15391, #15392 and #15420 merged: their files keep their new include, RACE_ROUNDS and Terminate race test, and lose only the duplicated constants. #16746 (opened 7 Nov) adds two test constants right after GuestWebBrowserDialog.cpp's constant block: whichever merges second keeps its new lines and drops the old block, since a local copy beside the header's names makes them ambiguous. The 25 changed .cpp files pass -fsyntax-only with the build's flags.

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 (step 1 of #15643; the busy value and the shared state helper stay open there)
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5187523256 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16362). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-11-06T12:02:51Z. --- ### What Step 1 of #15643, without the busy change. The common dialog statuses, results and error codes were redefined in an anonymous namespace in 22 dialog libraries and 2 tests. `CommonDialog.hpp` now defines them once, and the copies are removed. No library returns a different value. - `CommonDialog.hpp` gains `STATUS_NONE/INITIALIZED/RUNNING/FINISHED`, `RESULT_OK`, `RESULT_USER_CANCELED` and the errors `NOT_SYSTEM_INITIALIZED` (`0x80B80001`), `NOT_INITIALIZED`, `NOT_FINISHED`, `INVALID_STATE` (`0x80B80006`), `INVALID_ARGUMENT` (`0x80B8000A`), `NOT_RUNNING` and `ARG_NULL`. `COMMON_DIALOG_OK`, `ALREADY_SYSTEM_INITIALIZED` and `ALREADY_INITIALIZED` were already there. Every removed copy had the same value as the shared one. - `COMMON_DIALOG_ERROR_PARAMETER` (libSceWebBrowserDialog's name for `0x80B8000A`) is an alias of `INVALID_ARGUMENT`. #15643 proposed a single `PARAM_INVALID` name. Renaming would touch 59 lines in 11 files, inside functions that open pull requests are changing, so it is left for later. - `COMMON_DIALOG_ERROR_BUSY` stays in each library. 14 use `0x80B80007` and libSceInvitationDialog `0x80B80008`, and which one is right is still the open question on #15643, so nothing changes there until it is decided. - libScePlayGoDialog (unprefixed names, its busy case is `ERROR_INVALID_STATE` = `0x80B80007`) keeps its own codes except `NOT_FINISHED`. libScePlayerInvitationDialog is left as on `main`, because #14300 adds a busy code beside its constants. - `GuestPlayerReviewDialog.cpp` and `GuestWebBrowserDialog.cpp` included `CommonDialog.hpp` and defined the same names, which would now be ambiguous, so their copies go too. To keep an independent check of the numbers, `GuestCommonDialog.cpp` pins every shared value with a `static_assert` against its literal. ### Tested - Windows 11, WinLibs GCC 15.2: all 25 changed C++ files compile with `-fsyntax-only` and the exact flags of a `main` build (`ninja -t compdb`), with the include paths pointed at this branch. As a negative check, a duplicate `COMMON_DIALOG_STATUS_NONE` planted in libSceSigninDialog fails with `reference to 'COMMON_DIALOG_STATUS_NONE' is ambiguous`. - I didn't build or run the dialog test executables locally. No value changes, and the `static_assert`s pin the shared ones. The Windows pull request job runs the changed guest tests. - `python tools/check_conventions.py --base origin/main` passes. - `python tools/pr_overlap.py`: 22 open pull requests touch these files, and none edits the constant lines. #16049 and #16051 conflict with `main` already, and their code hunks start at lines 39 and 45, after the constant blocks this changes. Rebased onto `main` `6c1efc7c59` after #15391, #15392 and #15420 merged: their files keep their new include, `RACE_ROUNDS` and Terminate race test, and lose only the duplicated constants. #16746 (opened 7 Nov) adds two test constants right after `GuestWebBrowserDialog.cpp`'s constant block: whichever merges second keeps its new lines and drops the old block, since a local copy beside the header's names makes them ambiguous. The 25 changed `.cpp` files pass `-fsyntax-only` with the build's flags. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none (step 1 of #15643; the busy value and the shared state helper stay open there) - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!16362
No description provided.