Files
ppsspp/Core/Dialog/PSPPlaceholderDialog.cpp
T
Henrik RydgårdandClaude Opus 5.5 30fada5833 Utility: Run GameSharing through a placeholder dialog, quiet its WRONG_TYPE logs
GameSharing InitStart used to return 0 without starting anything, so its
GetStatus stayed at NONE and a game waiting for the dialog to finish
would hang. It now goes through the normal lifecycle (INIT, RUNNING,
FINISHED, SHUTDOWN, NONE) and reports that the user cancelled.

PSPPlaceholderDialog was abstract and unused (and missing from CMake);
it's now that stand-in.

WRONG_TYPE from GameSharing GetStatus/Update/ShutdownStart is what a PSP
returns whenever another dialog type was the last one started, so log it
at debug like the other dialogs. Sega Rally polls it every frame.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-23 19:25:24 -06:00

90 lines
2.6 KiB
C++

// Copyright (c) 2012- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0 or later versions.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "Common/Serialize/Serializer.h"
#include "Common/Serialize/SerializeFuncs.h"
#include "Core/Dialog/PSPPlaceholderDialog.h"
#include "Core/HLE/ErrorCodes.h"
// Rough guesses, like the other dialogs'.
static const int PLACEHOLDER_INIT_DELAY_US = 200000;
static const int PLACEHOLDER_SHUTDOWN_DELAY_US = 2000;
PSPPlaceholderDialog::PSPPlaceholderDialog(UtilityDialogType type) : PSPDialog(type) {
}
int PSPPlaceholderDialog::Init(u32 paramAddr) {
if (ReadStatus() != SCE_UTILITY_STATUS_NONE) {
return SCE_ERROR_UTILITY_INVALID_STATUS;
}
if (!Memory::IsValidRange(paramAddr, sizeof(pspUtilityDialogCommon))) {
return SCE_KERNEL_ERROR_BAD_ARGUMENT;
}
params_ = paramAddr;
// The request sizes a PSP accepts for GameSharing.
const u32 size = params_->size;
if (DialogType() == UtilityDialogType::GAMESHARING && size != 0x50 && size != 0x54 && size != 0x64) {
params_ = 0;
return SCE_ERROR_UTILITY_INVALID_PARAM_SIZE;
}
ChangeStatusInit(PLACEHOLDER_INIT_DELAY_US);
InitCommon();
return 0;
}
int PSPPlaceholderDialog::Update(int animSpeed) {
if (ReadStatus() != SCE_UTILITY_STATUS_RUNNING) {
return SCE_ERROR_UTILITY_INVALID_STATUS;
}
if (params_.IsValid()) {
params_->result = SCE_UTILITY_DIALOG_RESULT_CANCEL;
params_.NotifyWrite("DialogResult");
}
ChangeStatus(SCE_UTILITY_STATUS_FINISHED, 0);
return 0;
}
int PSPPlaceholderDialog::Shutdown(bool force) {
if (ReadStatus() != SCE_UTILITY_STATUS_FINISHED && !force) {
return SCE_ERROR_UTILITY_INVALID_STATUS;
}
PSPDialog::Shutdown(force);
if (!force) {
ChangeStatusShutdown(PLACEHOLDER_SHUTDOWN_DELAY_US);
}
return 0;
}
void PSPPlaceholderDialog::DoState(PointerWrap &p) {
PSPDialog::DoState(p);
auto s = p.Section("PSPPlaceholderDialog", 1, 1);
if (!s)
return;
Do(p, params_);
}
pspUtilityDialogCommon *PSPPlaceholderDialog::GetCommonParam() {
if (params_.IsValid())
return params_;
return nullptr;
}