feat(libSceWebBrowserDialog): implement sceWebBrowserDialogSetCookie, ResetCookie, OpenForPredeterminedContent #1583

Closed
Deses wants to merge 1 commit from upstream-pr/1583 into main
Deses commented 2026-10-08 13:34:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Deses on 2026-10-08T13:34:57Z.


What

Implements three libSceWebBrowserDialog calls (core/libs/prx/libSceWebBrowserDialog/Export.cpp).

int sceWebBrowserDialogSetCookie(const SceWebBrowserDialogSetCookieParam* param) (NID TZnDVkP91Rg). The param is 280 bytes: size, url, cookie, 256 reserved bytes. Returns NOT_INITIALIZED (0x80B80003) before sceWebBrowserDialogInitialize and ARG_NULL (0x80B8000D) for a null param. Throws for a size other than 280, a null url or cookie, or a url/cookie that does not end within its 2048-/4096-byte buffer. Otherwise copies the url and cookie into an in-memory store (mutex-guarded) and returns 0. Allowed in any initialized state, including finished.

int sceWebBrowserDialogResetCookie(const SceWebBrowserDialogResetCookieParam* param) (NID Cya+jvTtPqg). The param is 264 bytes: size, 256 reserved bytes. Same NOT_INITIALIZED/ARG_NULL checks, throws for a size other than 264, otherwise empties the store and returns 0.

int sceWebBrowserDialogOpenForPredeterminedContent(const SceWebBrowserDialogParam* param, const SceWebBrowserDialogPredeterminedContentParam* contentParam) (NID O7dIZQrwVFY). Same state machine as sceWebBrowserDialogOpen: NOT_INITIALIZED when not initialized, BUSY while running, ARG_NULL when either pointer is null, otherwise the dialog finishes at once and sceWebBrowserDialogGetResult reports USER_CANCELED. The domain allow-list in the second param is not read.

Cookies are kept until sceWebBrowserDialogResetCookie (Terminate does not clear them). No page is ever loaded, so they are never sent. Nothing in the library reads the store yet; it is the state a future dialog implementation would send. #1002 (closed by its author) accepted and discarded the cookie; this keeps it in a store that ResetCookie empties.

TechnicalDebt: WebBrowserDialog is removed from the two "added without an implementation" entries (PPSA12544 Unity plugins: SetCookie; PPSA14632: ResetCookie, OpenForPredeterminedContent). One new "Unknown function info" entry (signature sources, unconfirmed error codes, what throws) and one new "Functional" entry (the dialog shows nothing, domains not read, cookies kept but never sent).

Test guest_web_browser_dialog (core/libs/tests/GuestWebBrowserDialog.cpp) is extended: the three calls before Initialize, null params, valid cookie set/reset, wrong sizes, null url, unterminated url and cookie throw, the 2047-/4095-character boundary is accepted, OpenForPredeterminedContent after Open with null first/second param and valid params, status FINISHED, result USER_CANCELED, cookie calls in the finished state. The test now links libc and calls configure_windows_unwind, as the other tests that catch library exceptions do (catching needs the guest libc's __gxx_personality_v0).

Not settled: no source gives error codes for these three calls or says whether the cookie calls need an initialized library; NOT_INITIALIZED/ARG_NULL follow the library's other calls. SCE_WEB_BROWSER_DIALOG_COOKIE_COUNT (the sample's loop bound) has no known value, so the store has no limit. Recorded in TechnicalDebt.

Sources:

  • Signatures and struct layouts: SharpProspero src/SharpProspero/Interop/Dialog/WebBrowserDialog.cs (PS5; structs lines 145-189, bindings 252-284, commit 5dfdb4b0): github.com/SvenGDK/SharpProspero@5dfdb4b0b1/src/SharpProspero/Interop/Dialog/WebBrowserDialog.cs
  • PS4 prototypes: orbital tools/ida/db_types.json lines 2509-2511 (param counts and pointer types agree with SharpProspero): https://github.com/AlexAltea/orbital/blob/master/tools/ida/db_types.json
  • The 280-byte cookie param and the SCE_WEB_BROWSER_DIALOG_COOKIE_URL_SIZE (2048) / COOKIE_DATA_SIZE (4096) buffer sizes: ps5debug Vanilla/include/imports.h lines 282-290: https://github.com/someguythatmods/PS5Debug-CleanELF/blob/master/Vanilla/include/imports.h
  • Call order and field names on PS5: Sony PS5 SDK sample ps5_api_webbrowser/webbrowser_dialog_menu.cpp in DNNDHH/PS5-PKGs (commit c41e0cd1). sceWebBrowserDialogInitialize at module start-up (line 514). openBrowserSetCookie (lines 408-470) calls ResetCookie and then SetCookie once per cookie on what its comments call a "temporary buffer", then sceWebBrowserDialogOpen. openBrowserForPredeterminedContent (lines 304-338) fills domain[0], domain[1] and size and calls sceWebBrowserDialogOpenForPredeterminedContent(&param, &param2): github.com/DNNDHH/PS5-PKGs@c41e0cd19d/ps5_api_webbrowser/webbrowser_dialog_menu.cpp
  • NIDs: shadPS4 src/core/libraries/web_browser_dialog/webbrowserdialog.cpp lines 131-136 (PS4) and the PS5 3.20 library stubs in DNNDHH/PS5-3.20_Libs libSceWebBrowserDialog.c lines 111-113.
  • The 264-byte reset param and the 424-byte predetermined content param (size, 20 domain pointers, 256 reserved bytes) come from SharpProspero only; the sample confirms only the size and domain fields.

Side note, not part of this PR: the library's existing COMMON_DIALOG_ERROR_BUSY is 0x80B80007, which shadPS4's commondialog.h lists as RESULT_NONE (BUSY there is 0x80B80008); the same value is used by LoginDialog, MsgDialog and CdlgPlayerReview. OpenForPredeterminedContent reuses the library's constant to match Open; the state is never RUNNING here, so the path is not reached. Left for a separate PR.

Tested

Windows 11, MinGW-w64 GCC 15.2.0, built in this branch's own tree: full build, the libs target and ctest -R "web_browser|dialog" (8 tests, guest_web_browser_dialog included) pass, last on 4d03ecf4 after an incremental rebuild; check_conventions.py and check_test_registration.py pass. No title run.

CI: the upstream runs for this head are waiting for approval (#1631). The same Build workflow ran on the fork for head 582e5984: https://github.com/Deses/AnyPS5/actions/runs/37804534368, Linux and Windows (full build, libs, ctest) and the relinker jobs (Linux, Windows, macOS) green.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4787614297 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1583). Originally posted by [Deses](https://github.com/Deses) on 2026-10-08T13:34:57Z. --- ### What Implements three `libSceWebBrowserDialog` calls (`core/libs/prx/libSceWebBrowserDialog/Export.cpp`). `int sceWebBrowserDialogSetCookie(const SceWebBrowserDialogSetCookieParam* param)` (NID `TZnDVkP91Rg`). The param is 280 bytes: size, url, cookie, 256 reserved bytes. Returns `NOT_INITIALIZED` (0x80B80003) before `sceWebBrowserDialogInitialize` and `ARG_NULL` (0x80B8000D) for a null param. Throws for a size other than 280, a null url or cookie, or a url/cookie that does not end within its 2048-/4096-byte buffer. Otherwise copies the url and cookie into an in-memory store (mutex-guarded) and returns 0. Allowed in any initialized state, including finished. `int sceWebBrowserDialogResetCookie(const SceWebBrowserDialogResetCookieParam* param)` (NID `Cya+jvTtPqg`). The param is 264 bytes: size, 256 reserved bytes. Same `NOT_INITIALIZED`/`ARG_NULL` checks, throws for a size other than 264, otherwise empties the store and returns 0. `int sceWebBrowserDialogOpenForPredeterminedContent(const SceWebBrowserDialogParam* param, const SceWebBrowserDialogPredeterminedContentParam* contentParam)` (NID `O7dIZQrwVFY`). Same state machine as `sceWebBrowserDialogOpen`: `NOT_INITIALIZED` when not initialized, `BUSY` while running, `ARG_NULL` when either pointer is null, otherwise the dialog finishes at once and `sceWebBrowserDialogGetResult` reports `USER_CANCELED`. The domain allow-list in the second param is not read. Cookies are kept until `sceWebBrowserDialogResetCookie` (Terminate does not clear them). No page is ever loaded, so they are never sent. Nothing in the library reads the store yet; it is the state a future dialog implementation would send. #1002 (closed by its author) accepted and discarded the cookie; this keeps it in a store that ResetCookie empties. TechnicalDebt: WebBrowserDialog is removed from the two "added without an implementation" entries (PPSA12544 Unity plugins: SetCookie; PPSA14632: ResetCookie, OpenForPredeterminedContent). One new "Unknown function info" entry (signature sources, unconfirmed error codes, what throws) and one new "Functional" entry (the dialog shows nothing, domains not read, cookies kept but never sent). Test `guest_web_browser_dialog` (`core/libs/tests/GuestWebBrowserDialog.cpp`) is extended: the three calls before Initialize, null params, valid cookie set/reset, wrong sizes, null url, unterminated url and cookie throw, the 2047-/4095-character boundary is accepted, OpenForPredeterminedContent after Open with null first/second param and valid params, status FINISHED, result USER_CANCELED, cookie calls in the finished state. The test now links `libc` and calls `configure_windows_unwind`, as the other tests that catch library exceptions do (catching needs the guest libc's `__gxx_personality_v0`). Not settled: no source gives error codes for these three calls or says whether the cookie calls need an initialized library; `NOT_INITIALIZED`/`ARG_NULL` follow the library's other calls. `SCE_WEB_BROWSER_DIALOG_COOKIE_COUNT` (the sample's loop bound) has no known value, so the store has no limit. Recorded in TechnicalDebt. Sources: - Signatures and struct layouts: SharpProspero `src/SharpProspero/Interop/Dialog/WebBrowserDialog.cs` (PS5; structs lines 145-189, bindings 252-284, commit 5dfdb4b0): https://github.com/SvenGDK/SharpProspero/blob/5dfdb4b0b166e83dc9ae275001afb695f12c7174/src/SharpProspero/Interop/Dialog/WebBrowserDialog.cs - PS4 prototypes: orbital `tools/ida/db_types.json` lines 2509-2511 (param counts and pointer types agree with SharpProspero): https://github.com/AlexAltea/orbital/blob/master/tools/ida/db_types.json - The 280-byte cookie param and the `SCE_WEB_BROWSER_DIALOG_COOKIE_URL_SIZE` (2048) / `COOKIE_DATA_SIZE` (4096) buffer sizes: ps5debug `Vanilla/include/imports.h` lines 282-290: https://github.com/someguythatmods/PS5Debug-CleanELF/blob/master/Vanilla/include/imports.h - Call order and field names on PS5: Sony PS5 SDK sample `ps5_api_webbrowser/webbrowser_dialog_menu.cpp` in DNNDHH/PS5-PKGs (commit c41e0cd1). `sceWebBrowserDialogInitialize` at module start-up (line 514). `openBrowserSetCookie` (lines 408-470) calls `ResetCookie` and then `SetCookie` once per cookie on what its comments call a "temporary buffer", then `sceWebBrowserDialogOpen`. `openBrowserForPredeterminedContent` (lines 304-338) fills `domain[0]`, `domain[1]` and `size` and calls `sceWebBrowserDialogOpenForPredeterminedContent(&param, &param2)`: https://github.com/DNNDHH/PS5-PKGs/blob/c41e0cd19d7c6a9e9d2b03022e51c200b9ca659e/ps5_api_webbrowser/webbrowser_dialog_menu.cpp - NIDs: shadPS4 `src/core/libraries/web_browser_dialog/webbrowserdialog.cpp` lines 131-136 (PS4) and the PS5 3.20 library stubs in DNNDHH/PS5-3.20_Libs `libSceWebBrowserDialog.c` lines 111-113. - The 264-byte reset param and the 424-byte predetermined content param (size, 20 domain pointers, 256 reserved bytes) come from SharpProspero only; the sample confirms only the `size` and `domain` fields. Side note, not part of this PR: the library's existing `COMMON_DIALOG_ERROR_BUSY` is 0x80B80007, which shadPS4's `commondialog.h` lists as `RESULT_NONE` (BUSY there is 0x80B80008); the same value is used by LoginDialog, MsgDialog and CdlgPlayerReview. `OpenForPredeterminedContent` reuses the library's constant to match `Open`; the state is never RUNNING here, so the path is not reached. Left for a separate PR. ### Tested Windows 11, MinGW-w64 GCC 15.2.0, built in this branch's own tree: full build, the `libs` target and `ctest -R "web_browser|dialog"` (8 tests, `guest_web_browser_dialog` included) pass, last on `4d03ecf4` after an incremental rebuild; `check_conventions.py` and `check_test_registration.py` pass. No title run. CI: the upstream runs for this head are waiting for approval (#1631). The same Build workflow ran on the fork for head `582e5984`: https://github.com/Deses/AnyPS5/actions/runs/37804534368, Linux and Windows (full build, `libs`, ctest) and the relinker jobs (Linux, Windows, macOS) green. ### 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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes
Deses commented 2026-10-08 14:31:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Deses on 2026-10-08T14:31:22Z.


All three are text overlaps in docs/dev/TechnicalDebt.md, not shared exports or a dependency:

  • #1544 (L159): both PRs drop a library from the same PPSA12544 "added without an implementation" line (#1544 drops Share, this one drops WebBrowserDialog). The merged line drops both.
  • #1468 (L159-161): #1468 renames the WVorbis entry on the line between the two lines this PR edits (L159 and L161).
  • #1554 (L234): both PRs append an "Unknown function info" entry after the sceAjmBatchJobSetResampleParameters entry.

None of them implements these three calls and this PR does not build on any of them, so Depends on stays none. Whichever merges first, this branch is rebased on main and the line is resolved.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6062149113 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1583#issuecomment-6062149113). Originally posted by [Deses](https://github.com/Deses) on 2026-10-08T14:31:22Z. --- All three are text overlaps in `docs/dev/TechnicalDebt.md`, not shared exports or a dependency: - #1544 (L159): both PRs drop a library from the same PPSA12544 "added without an implementation" line (#1544 drops Share, this one drops WebBrowserDialog). The merged line drops both. - #1468 (L159-161): #1468 renames the WVorbis entry on the line between the two lines this PR edits (L159 and L161). - #1554 (L234): both PRs append an "Unknown function info" entry after the `sceAjmBatchJobSetResampleParameters` entry. None of them implements these three calls and this PR does not build on any of them, so Depends on stays none. Whichever merges first, this branch is rebased on `main` and the line is resolved.
oneandonlydean commented 2026-10-09 09:29:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T09:29:32Z.


Closing: these three calls come from import lists, no title is shown stopping at them on main, and nothing reads the cookie store yet. Reopen when one is a title's next stop on main, with the log line.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6078227890 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1583#issuecomment-6078227890). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-09T09:29:32Z. --- Closing: these three calls come from import lists, no title is shown stopping at them on main, and nothing reads the cookie store yet. Reopen when one is a title's next stop on main, with the log line.

Pull request closed

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!1583
No description provided.