From aa13f5afb7bef28ef0a7d9d770cf3d964b32a3e9 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 27 Feb 2021 12:01:52 -0800 Subject: [PATCH] Dialog: Track type id on dialog class. --- Core/Dialog/PSPDialog.cpp | 2 +- Core/Dialog/PSPDialog.h | 4 +++- Core/Dialog/PSPGamedataInstallDialog.cpp | 2 +- Core/Dialog/PSPGamedataInstallDialog.h | 2 +- Core/Dialog/PSPMsgDialog.cpp | 5 +---- Core/Dialog/PSPMsgDialog.h | 4 ++-- Core/Dialog/PSPNetconfDialog.cpp | 2 +- Core/Dialog/PSPNetconfDialog.h | 2 +- Core/Dialog/PSPOskDialog.cpp | 2 +- Core/Dialog/PSPOskDialog.h | 2 +- Core/Dialog/PSPPlaceholderDialog.cpp | 2 +- Core/Dialog/PSPPlaceholderDialog.h | 2 +- Core/Dialog/PSPSaveDialog.cpp | 7 +------ Core/Dialog/PSPSaveDialog.h | 10 +++++----- Core/Dialog/PSPScreenshotDialog.cpp | 3 +-- Core/Dialog/PSPScreenshotDialog.h | 2 +- Core/HLE/sceUtility.cpp | 12 ++++++------ 17 files changed, 29 insertions(+), 36 deletions(-) diff --git a/Core/Dialog/PSPDialog.cpp b/Core/Dialog/PSPDialog.cpp index a23324f8e1..47b68c1018 100644 --- a/Core/Dialog/PSPDialog.cpp +++ b/Core/Dialog/PSPDialog.cpp @@ -31,7 +31,7 @@ #define FADE_TIME 1.0 const float FONT_SCALE = 0.55f; -PSPDialog::PSPDialog() { +PSPDialog::PSPDialog(int type) : dialogType_(type) { } PSPDialog::~PSPDialog() { diff --git a/Core/Dialog/PSPDialog.h b/Core/Dialog/PSPDialog.h index 7a156bad6c..a6208d9ab3 100644 --- a/Core/Dialog/PSPDialog.h +++ b/Core/Dialog/PSPDialog.h @@ -53,7 +53,7 @@ struct pspUtilityDialogCommon class PSPDialog { public: - PSPDialog(); + PSPDialog(int type); virtual ~PSPDialog(); virtual int Update(int animSpeed) = 0; @@ -80,6 +80,7 @@ public: }; DialogStatus GetStatus(); + int DialogType() { return dialogType_; } void StartDraw(); void EndDraw(); @@ -127,5 +128,6 @@ protected: private: DialogStatus status = SCE_UTILITY_STATUS_NONE; + int dialogType_; bool volatileLocked_ = false; }; diff --git a/Core/Dialog/PSPGamedataInstallDialog.cpp b/Core/Dialog/PSPGamedataInstallDialog.cpp index 319314fd20..2354efd18a 100644 --- a/Core/Dialog/PSPGamedataInstallDialog.cpp +++ b/Core/Dialog/PSPGamedataInstallDialog.cpp @@ -55,7 +55,7 @@ namespace } } -PSPGamedataInstallDialog::PSPGamedataInstallDialog() { +PSPGamedataInstallDialog::PSPGamedataInstallDialog(int type) : PSPDialog(type) { } PSPGamedataInstallDialog::~PSPGamedataInstallDialog() { diff --git a/Core/Dialog/PSPGamedataInstallDialog.h b/Core/Dialog/PSPGamedataInstallDialog.h index d3ef321ae6..16dd5a585b 100644 --- a/Core/Dialog/PSPGamedataInstallDialog.h +++ b/Core/Dialog/PSPGamedataInstallDialog.h @@ -35,7 +35,7 @@ struct SceUtilityGamedataInstallParam { class PSPGamedataInstallDialog: public PSPDialog { public: - PSPGamedataInstallDialog(); + PSPGamedataInstallDialog(int type); virtual ~PSPGamedataInstallDialog(); virtual int Init(u32 paramAddr); diff --git a/Core/Dialog/PSPMsgDialog.cpp b/Core/Dialog/PSPMsgDialog.cpp index abfe39d7a0..8bc972d9cc 100755 --- a/Core/Dialog/PSPMsgDialog.cpp +++ b/Core/Dialog/PSPMsgDialog.cpp @@ -35,10 +35,7 @@ static const float FONT_SCALE = 0.65f; const static int MSG_INIT_DELAY_US = 300000; const static int MSG_SHUTDOWN_DELAY_US = 26000; -PSPMsgDialog::PSPMsgDialog() - : PSPDialog() - , flag(0) -{ +PSPMsgDialog::PSPMsgDialog(int type) : PSPDialog(type) { } PSPMsgDialog::~PSPMsgDialog() { diff --git a/Core/Dialog/PSPMsgDialog.h b/Core/Dialog/PSPMsgDialog.h index 78490393f8..e457e75368 100644 --- a/Core/Dialog/PSPMsgDialog.h +++ b/Core/Dialog/PSPMsgDialog.h @@ -58,7 +58,7 @@ struct pspMessageDialog class PSPMsgDialog: public PSPDialog { public: - PSPMsgDialog(); + PSPMsgDialog(int type); virtual ~PSPMsgDialog(); virtual int Init(unsigned int paramAddr); @@ -92,7 +92,7 @@ private: DS_ABORT = 0x200, }; - u32 flag; + u32 flag = 0; pspMessageDialog messageDialog; int messageDialogAddr; diff --git a/Core/Dialog/PSPNetconfDialog.cpp b/Core/Dialog/PSPNetconfDialog.cpp index ee3bb1b739..578b856851 100644 --- a/Core/Dialog/PSPNetconfDialog.cpp +++ b/Core/Dialog/PSPNetconfDialog.cpp @@ -54,7 +54,7 @@ struct ScanInfos { } PACK; -PSPNetconfDialog::PSPNetconfDialog() { +PSPNetconfDialog::PSPNetconfDialog(int type) : PSPDialog(type) { } PSPNetconfDialog::~PSPNetconfDialog() { diff --git a/Core/Dialog/PSPNetconfDialog.h b/Core/Dialog/PSPNetconfDialog.h index e02ebae5a0..447f21a2cf 100644 --- a/Core/Dialog/PSPNetconfDialog.h +++ b/Core/Dialog/PSPNetconfDialog.h @@ -37,7 +37,7 @@ struct SceUtilityNetconfParam { class PSPNetconfDialog: public PSPDialog { public: - PSPNetconfDialog(); + PSPNetconfDialog(int type); virtual ~PSPNetconfDialog(); virtual int Init(u32 paramAddr); diff --git a/Core/Dialog/PSPOskDialog.cpp b/Core/Dialog/PSPOskDialog.cpp index c049225f02..29d71e7b57 100755 --- a/Core/Dialog/PSPOskDialog.cpp +++ b/Core/Dialog/PSPOskDialog.cpp @@ -156,7 +156,7 @@ int allowedInputFlagsMap[OSK_KEYBOARD_COUNT] = { PSP_UTILITY_OSK_INPUTTYPE_JAPANESE_UPPERCASE | PSP_UTILITY_OSK_INPUTTYPE_JAPANESE_SYMBOL, }; -PSPOskDialog::PSPOskDialog() : PSPDialog() { +PSPOskDialog::PSPOskDialog(int type) : PSPDialog(type) { // This can break all kinds of stuff, changing the decimal point in sprintf for example. // Not sure what the intended effect is so commented out for now. // setlocale(LC_ALL, ""); diff --git a/Core/Dialog/PSPOskDialog.h b/Core/Dialog/PSPOskDialog.h index a244fd419a..de9949e4af 100644 --- a/Core/Dialog/PSPOskDialog.h +++ b/Core/Dialog/PSPOskDialog.h @@ -213,7 +213,7 @@ enum class PSPOskNativeStatus { class PSPOskDialog: public PSPDialog { public: - PSPOskDialog(); + PSPOskDialog(int type); virtual ~PSPOskDialog(); virtual int Init(u32 oskPtr); diff --git a/Core/Dialog/PSPPlaceholderDialog.cpp b/Core/Dialog/PSPPlaceholderDialog.cpp index 70bf4ccaef..6b120b4983 100644 --- a/Core/Dialog/PSPPlaceholderDialog.cpp +++ b/Core/Dialog/PSPPlaceholderDialog.cpp @@ -17,7 +17,7 @@ #include "PSPPlaceholderDialog.h" -PSPPlaceholderDialog::PSPPlaceholderDialog() : PSPDialog() { +PSPPlaceholderDialog::PSPPlaceholderDialog(int type) : PSPDialog(type) { } diff --git a/Core/Dialog/PSPPlaceholderDialog.h b/Core/Dialog/PSPPlaceholderDialog.h index 921ae9123f..bed1bfe43b 100644 --- a/Core/Dialog/PSPPlaceholderDialog.h +++ b/Core/Dialog/PSPPlaceholderDialog.h @@ -21,7 +21,7 @@ class PSPPlaceholderDialog: public PSPDialog { public: - PSPPlaceholderDialog(); + PSPPlaceholderDialog(int type); virtual ~PSPPlaceholderDialog(); virtual int Init(); diff --git a/Core/Dialog/PSPSaveDialog.cpp b/Core/Dialog/PSPSaveDialog.cpp index 7dd52c8965..eec688ac77 100755 --- a/Core/Dialog/PSPSaveDialog.cpp +++ b/Core/Dialog/PSPSaveDialog.cpp @@ -56,12 +56,7 @@ const static int SAVEDATA_DIALOG_SIZE_V2 = 1500; const static int SAVEDATA_DIALOG_SIZE_V3 = 1536; -PSPSaveDialog::PSPSaveDialog() - : PSPDialog() - , display(DS_NONE) - , currentSelectedSave(0) - , ioThread(0) -{ +PSPSaveDialog::PSPSaveDialog(int type) : PSPDialog(type) { param.SetPspParam(0); } diff --git a/Core/Dialog/PSPSaveDialog.h b/Core/Dialog/PSPSaveDialog.h index fd1efa88d5..505d440024 100644 --- a/Core/Dialog/PSPSaveDialog.h +++ b/Core/Dialog/PSPSaveDialog.h @@ -71,7 +71,7 @@ class PSPSaveDialog: public PSPDialog { public: - PSPSaveDialog(); + PSPSaveDialog(int type); virtual ~PSPSaveDialog(); virtual int Init(int paramAddr); @@ -136,14 +136,14 @@ private: DB_DELETE }; - DisplayState display; + DisplayState display = DS_NONE; SavedataParam param; SceUtilitySavedataParam request; // For detecting changes made by the game. SceUtilitySavedataParam originalRequest; - u32 requestAddr; - int currentSelectedSave; + u32 requestAddr = 0; + int currentSelectedSave = 0; int yesnoChoice; @@ -154,7 +154,7 @@ private: SAVEIO_DONE, }; - std::thread *ioThread; + std::thread *ioThread = nullptr; std::mutex paramLock; volatile SaveIOStatus ioThreadStatus; }; diff --git a/Core/Dialog/PSPScreenshotDialog.cpp b/Core/Dialog/PSPScreenshotDialog.cpp index a4aa6ff5bf..47cb87af33 100644 --- a/Core/Dialog/PSPScreenshotDialog.cpp +++ b/Core/Dialog/PSPScreenshotDialog.cpp @@ -52,8 +52,7 @@ struct SceUtilityScreenshotParams { // TODO }; -PSPScreenshotDialog::PSPScreenshotDialog() : PSPDialog() { - +PSPScreenshotDialog::PSPScreenshotDialog(int type) : PSPDialog(type) { } PSPScreenshotDialog::~PSPScreenshotDialog() { diff --git a/Core/Dialog/PSPScreenshotDialog.h b/Core/Dialog/PSPScreenshotDialog.h index 60a639e9ef..4165d0943c 100644 --- a/Core/Dialog/PSPScreenshotDialog.h +++ b/Core/Dialog/PSPScreenshotDialog.h @@ -24,7 +24,7 @@ struct SceUtilityScreenshotParams; class PSPScreenshotDialog : public PSPDialog { public: - PSPScreenshotDialog(); + PSPScreenshotDialog(int type); virtual ~PSPScreenshotDialog(); virtual int Init(u32 paramAddr); diff --git a/Core/HLE/sceUtility.cpp b/Core/HLE/sceUtility.cpp index 6895ab32b5..5886ec1d5c 100644 --- a/Core/HLE/sceUtility.cpp +++ b/Core/HLE/sceUtility.cpp @@ -132,12 +132,12 @@ enum UtilityDialogType { // Only a single dialog is allowed at a time. static UtilityDialogType currentDialogType; bool currentDialogActive; -static PSPSaveDialog saveDialog; -static PSPMsgDialog msgDialog; -static PSPOskDialog oskDialog; -static PSPNetconfDialog netDialog; -static PSPScreenshotDialog screenshotDialog; -static PSPGamedataInstallDialog gamedataInstallDialog; +static PSPSaveDialog saveDialog(UTILITY_DIALOG_SAVEDATA); +static PSPMsgDialog msgDialog(UTILITY_DIALOG_MSG); +static PSPOskDialog oskDialog(UTILITY_DIALOG_OSK); +static PSPNetconfDialog netDialog(UTILITY_DIALOG_NET); +static PSPScreenshotDialog screenshotDialog(UTILITY_DIALOG_SCREENSHOT); +static PSPGamedataInstallDialog gamedataInstallDialog(UTILITY_DIALOG_GAMEDATAINSTALL); static int oldStatus = 100; //random value static std::map currentlyLoadedModules;