Utility: Stand in for the HtmlViewer, offering to open the page in a browser

Instead of the PSP's web browser, a dialog shows the URL the game wants
and opens it in the host's browser on X, or backs out on O. Either way the
game sees the browser closed normally. Platforms that can't open a URL
(the new SYSPROP_CAN_LAUNCH_URL) only offer to back out. Only plain
printable-ASCII http(s) addresses are handed over, and on Linux without a
shell.

What the firmware does (sceUtility_Driver, 6.61, plus
utility/dialog/htmlviewer): the HtmlViewer has its own state apart from the
other dialogs, so they don't block each other, and its calls return
WRONG_TYPE until one has started. The request size picks the 2.00 to 3.00
layout, and InitStart allocates 3.5MB of user memory (4.5MB with options
bit 0x400 from 2.70 on), failing with 800200d9 without it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-09-25 12:50:23 -06:00
1 parent 3c15b2b112
commit 5f261bd7ff
22 files changed
+373 -11

No files matched your search

+39 -6
View File
@@ -55,6 +55,7 @@
#include "Core/Dialog/PSPDialog.h"
#include "Core/Dialog/PSPSaveDialog.h"
#include "Core/Dialog/PSPMsgDialog.h"
#include "Core/Dialog/PSPHtmlViewerDialog.h"
#include "Core/Dialog/PSPPlaceholderDialog.h"
#include "Core/Dialog/PSPOskDialog.h"
#include "Core/Dialog/PSPGamedataInstallDialog.h"
@@ -327,6 +328,8 @@ static PSPScreenshotDialog *screenshotDialog;
static PSPGamedataInstallDialog *gamedataInstallDialog;
static PSPNpSigninDialog *npSigninDialog;
static PSPPlaceholderDialog *gameSharingDialog;
// Not one of the dialogs above: it has its own state on a PSP, and doesn't count as the current dialog.
static PSPHtmlViewerDialog *htmlViewerDialog;
// A lot of state seems to be shared between the various dialog types.
static int oldStatus = -1;
@@ -400,6 +403,8 @@ static PSPDialog *CurrentDialog(UtilityDialogType type) {
return gamedataInstallDialog;
case UtilityDialogType::NPSIGNIN:
return npSigninDialog;
case UtilityDialogType::HTMLVIEWER:
return htmlViewerDialog;
}
return nullptr;
}
@@ -522,6 +527,7 @@ void __UtilityInit() {
gamedataInstallDialog = new PSPGamedataInstallDialog(UtilityDialogType::GAMEDATAINSTALL);
npSigninDialog = new PSPNpSigninDialog(UtilityDialogType::NPSIGNIN);
gameSharingDialog = new PSPPlaceholderDialog(UtilityDialogType::GAMESHARING);
htmlViewerDialog = new PSPHtmlViewerDialog(UtilityDialogType::HTMLVIEWER);
currentDialogType = UtilityDialogType::NONE;
DeactivateDialog();
@@ -534,7 +540,7 @@ void __UtilityInit() {
}
void __UtilityDoState(PointerWrap &p) {
auto s = p.Section("sceUtility", 1, 8);
auto s = p.Section("sceUtility", 1, 9);
if (!s) {
return;
}
@@ -608,6 +614,9 @@ void __UtilityDoState(PointerWrap &p) {
if (s >= 8) {
gameSharingDialog->DoState(p);
}
if (s >= 9) {
htmlViewerDialog->DoState(p);
}
if (!hasAccessThread && accessThread) {
accessThread->Forget();
@@ -626,6 +635,7 @@ void __UtilityShutdown() {
gamedataInstallDialog->Shutdown(true);
npSigninDialog->Shutdown(true);
gameSharingDialog->Shutdown(true);
htmlViewerDialog->Shutdown(true);
if (accessThread) {
// Don't need to free it during shutdown, may have already been freed.
@@ -645,6 +655,7 @@ void __UtilityShutdown() {
delete gamedataInstallDialog;
delete npSigninDialog;
delete gameSharingDialog;
delete htmlViewerDialog;
}
// On a PSP, dialog init and shutdown happen partly at the accessThread priority and partly at the
@@ -1677,9 +1688,31 @@ static int sceUtilityGameSharingGetStatus() {
return hleLogVerbose(Log::sceUtility, status, "status: %s", UtilityDialogStatusToString(status));
}
// We never run an HtmlViewer, so it's never the current type.
// The HtmlViewer keeps its own state on a PSP: other dialogs don't make it busy or change its type,
// and until one has been started its calls return WRONG_TYPE (utility/dialog/htmlviewer).
static int sceUtilityHtmlViewerInitStart(u32 paramsPtr) {
return hleLogInfo(Log::sceUtility, htmlViewerDialog->Init(paramsPtr));
}
static int sceUtilityHtmlViewerShutdownStart() {
if (!htmlViewerDialog->HasStarted()) {
return hleLogDebug(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type");
}
return hleLogDebug(Log::sceUtility, htmlViewerDialog->Shutdown());
}
static int sceUtilityHtmlViewerUpdate(int animSpeed) {
if (!htmlViewerDialog->HasStarted()) {
return hleLogDebug(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type");
}
return hleLogDebug(Log::sceUtility, htmlViewerDialog->Update(animSpeed));
}
static int sceUtilityHtmlViewerGetStatus() {
return hleLogDebug(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type");
if (!htmlViewerDialog->HasStarted()) {
return hleLogDebug(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type");
}
return hleLogVerbose(Log::sceUtility, htmlViewerDialog->GetStatus());
}
static u32 sceUtilityLoadUsbModule(u32 module) {
@@ -1741,9 +1774,9 @@ const HLEFunction sceUtility[] = {
{0X88BC7406, nullptr, "sceUtilitySavedataErrGetStatus", '?', "" },
{0XBDA7D894, &WrapI_V<sceUtilityHtmlViewerGetStatus>, "sceUtilityHtmlViewerGetStatus", 'i', "" },
{0XCDC3AA41, nullptr, "sceUtilityHtmlViewerInitStart", '?', "" },
{0XF5CE1134, nullptr, "sceUtilityHtmlViewerShutdownStart", '?', "" },
{0X05AFB9E4, nullptr, "sceUtilityHtmlViewerUpdate", '?', "" },
{0XCDC3AA41, &WrapI_U<sceUtilityHtmlViewerInitStart>, "sceUtilityHtmlViewerInitStart", 'i', "x" },
{0XF5CE1134, &WrapI_V<sceUtilityHtmlViewerShutdownStart>, "sceUtilityHtmlViewerShutdownStart", 'i', "" },
{0X05AFB9E4, &WrapI_I<sceUtilityHtmlViewerUpdate>, "sceUtilityHtmlViewerUpdate", 'i', "i" },
{0X16A1A8D8, nullptr, "sceUtilityAuthDialogGetStatus", '?', "" },
{0X943CBA46, nullptr, "sceUtilityAuthDialogInitStart", '?', "" },