Dialog: Update by button flag consistently.

Always check for the flag to change in Update().
This commit is contained in:
Unknown W. Brackets 2023-02-08 19:02:37 -08:00
parent 2d0252feb8
commit fcc1abc7c3
9 changed files with 34 additions and 44 deletions

View File

@ -39,6 +39,23 @@ PSPDialog::PSPDialog(UtilityDialogType type) : dialogType_(type) {
PSPDialog::~PSPDialog() {
}
void PSPDialog::InitCommon() {
UpdateCommon();
}
void PSPDialog::UpdateCommon() {
okButtonImg = ImageID("I_CIRCLE");
cancelButtonImg = ImageID("I_CROSS");
okButtonFlag = CTRL_CIRCLE;
cancelButtonFlag = CTRL_CROSS;
if (GetCommonParam() && GetCommonParam()->buttonSwap == 1) {
okButtonImg = ImageID("I_CROSS");
cancelButtonImg = ImageID("I_CIRCLE");
okButtonFlag = CTRL_CROSS;
cancelButtonFlag = CTRL_CIRCLE;
}
}
PSPDialog::DialogStatus PSPDialog::GetStatus() {
if (pendingStatusTicks != 0 && CoreTiming::GetTicks() >= pendingStatusTicks) {
bool changeAllowed = true;

View File

@ -89,6 +89,8 @@ public:
int FinishShutdown();
protected:
void InitCommon();
void UpdateCommon();
PPGeStyle FadedStyle(PPGeAlign align, float scale);
PPGeImageStyle FadedImageStyle();
void UpdateButtons();

View File

@ -97,6 +97,7 @@ int PSPGamedataInstallDialog::Init(u32 paramAddr) {
memset(&request, 0, sizeof(request));
// Only copy the right size to support different request format
Memory::Memcpy(&request, paramAddr, size, "sceGamedataInstallInitStart");
InitCommon();
ChangeStatusInit(GAMEDATA_INIT_DELAY_US);
return 0;
@ -114,6 +115,8 @@ int PSPGamedataInstallDialog::Update(int animSpeed) {
return 0;
}
UpdateCommon();
// TODO: param->mode == 1 should show a prompt to confirm, then a progress bar.
// Any other mode (i.e. 0 or negative) should proceed and show no UI.

View File

@ -140,6 +140,7 @@ int PSPMsgDialog::Init(unsigned int paramAddr) {
ChangeStatusInit(MSG_INIT_DELAY_US);
UpdateButtons();
InitCommon();
StartFade(true);
return 0;
}
@ -282,20 +283,9 @@ int PSPMsgDialog::Update(int animSpeed) {
ChangeStatus(SCE_UTILITY_STATUS_FINISHED, 0);
} else {
UpdateButtons();
UpdateCommon();
UpdateFade(animSpeed);
okButtonImg = ImageID("I_CIRCLE");
cancelButtonImg = ImageID("I_CROSS");
okButtonFlag = CTRL_CIRCLE;
cancelButtonFlag = CTRL_CROSS;
if (messageDialog.common.buttonSwap == 1)
{
okButtonImg = ImageID("I_CROSS");
cancelButtonImg = ImageID("I_CIRCLE");
okButtonFlag = CTRL_CROSS;
cancelButtonFlag = CTRL_CIRCLE;
}
StartDraw();
// white -> RGB(168,173,189), black -> RGB(129,134,150)
// (255 - a) + (x * a / 255) = 173, x * a / 255 = 134

View File

@ -73,18 +73,8 @@ int PSPNetconfDialog::Init(u32 paramAddr) {
ChangeStatusInit(NET_INIT_DELAY_US);
// Eat any keys pressed before the dialog inited.
InitCommon();
UpdateButtons();
okButtonImg = ImageID("I_CIRCLE");
cancelButtonImg = ImageID("I_CROSS");
okButtonFlag = CTRL_CIRCLE;
cancelButtonFlag = CTRL_CROSS;
if (request.common.buttonSwap == 1)
{
okButtonImg = ImageID("I_CROSS");
cancelButtonImg = ImageID("I_CIRCLE");
okButtonFlag = CTRL_CROSS;
cancelButtonFlag = CTRL_CIRCLE;
}
connResult = -1;
scanInfosAddr = 0;
@ -247,6 +237,7 @@ int PSPNetconfDialog::Update(int animSpeed) {
}
UpdateButtons();
UpdateCommon();
auto di = GetI18NCategory("Dialog");
auto err = GetI18NCategory("Error");
u64 now = (u64)(time_now_d() * 1000000.0);

View File

@ -67,17 +67,7 @@ int PSPNpSigninDialog::Init(u32 paramAddr) {
// Eat any keys pressed before the dialog inited.
UpdateButtons();
okButtonImg = ImageID("I_CIRCLE");
cancelButtonImg = ImageID("I_CROSS");
okButtonFlag = CTRL_CIRCLE;
cancelButtonFlag = CTRL_CROSS;
if (request.common.buttonSwap == 1)
{
okButtonImg = ImageID("I_CROSS");
cancelButtonImg = ImageID("I_CIRCLE");
okButtonFlag = CTRL_CROSS;
cancelButtonFlag = CTRL_CIRCLE;
}
InitCommon();
//npSigninResult = -1;
startTime = (u64)(time_now_d() * 1000000.0);
@ -244,6 +234,7 @@ int PSPNpSigninDialog::Update(int animSpeed) {
}
UpdateButtons();
UpdateCommon();
auto di = GetI18NCategory("Dialog");
auto err = GetI18NCategory("Error");
u64 now = (u64)(time_now_d() * 1000000.0);

View File

@ -27,6 +27,7 @@ PSPPlaceholderDialog::~PSPPlaceholderDialog() {
int PSPPlaceholderDialog::Init() {
ChangeStatus(SCE_UTILITY_STATUS_INITIALIZE, 0);
InitCommon();
return 0;
}
@ -38,6 +39,7 @@ int PSPPlaceholderDialog::Update(int animSpeed) {
} else if (ReadStatus() == SCE_UTILITY_STATUS_FINISHED) {
ChangeStatus(SCE_UTILITY_STATUS_SHUTDOWN, 0);
}
UpdateCommon();
return 0;
}

View File

@ -270,6 +270,7 @@ int PSPSaveDialog::Init(int paramAddr)
}
param.ClearCaches();
InitCommon();
UpdateButtons();
StartFade(true);
@ -654,16 +655,7 @@ int PSPSaveDialog::Update(int animSpeed)
UpdateButtons();
UpdateFade(animSpeed);
okButtonImg = ImageID("I_CIRCLE");
cancelButtonImg = ImageID("I_CROSS");
okButtonFlag = CTRL_CIRCLE;
cancelButtonFlag = CTRL_CROSS;
if (param.GetPspParam()->common.buttonSwap == 1) {
okButtonImg = ImageID("I_CROSS");
cancelButtonImg = ImageID("I_CIRCLE");
okButtonFlag = CTRL_CROSS;
cancelButtonFlag = CTRL_CIRCLE;
}
UpdateCommon();
auto di = GetI18NCategory("Dialog");

View File

@ -84,11 +84,13 @@ int PSPScreenshotDialog::Init(u32 paramAddr) {
mode = params_->mode;
ChangeStatus(SCE_UTILITY_STATUS_INITIALIZE, 0);
InitCommon();
return 0;
}
int PSPScreenshotDialog::Update(int animSpeed) {
UpdateCommon();
if (UseAutoStatus()) {
if (ReadStatus() == SCE_UTILITY_STATUS_INITIALIZE) {
ChangeStatus(SCE_UTILITY_STATUS_RUNNING, 0);