Dialog: Track type id on dialog class.

This commit is contained in:
Unknown W. Brackets 2021-02-27 12:01:52 -08:00
parent 2b9b157151
commit aa13f5afb7
17 changed files with 29 additions and 36 deletions

View file

@ -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() {

View file

@ -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;
};

View file

@ -55,7 +55,7 @@ namespace
}
}
PSPGamedataInstallDialog::PSPGamedataInstallDialog() {
PSPGamedataInstallDialog::PSPGamedataInstallDialog(int type) : PSPDialog(type) {
}
PSPGamedataInstallDialog::~PSPGamedataInstallDialog() {

View file

@ -35,7 +35,7 @@ struct SceUtilityGamedataInstallParam {
class PSPGamedataInstallDialog: public PSPDialog {
public:
PSPGamedataInstallDialog();
PSPGamedataInstallDialog(int type);
virtual ~PSPGamedataInstallDialog();
virtual int Init(u32 paramAddr);

View file

@ -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() {

View file

@ -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;

View file

@ -54,7 +54,7 @@ struct ScanInfos {
} PACK;
PSPNetconfDialog::PSPNetconfDialog() {
PSPNetconfDialog::PSPNetconfDialog(int type) : PSPDialog(type) {
}
PSPNetconfDialog::~PSPNetconfDialog() {

View file

@ -37,7 +37,7 @@ struct SceUtilityNetconfParam {
class PSPNetconfDialog: public PSPDialog {
public:
PSPNetconfDialog();
PSPNetconfDialog(int type);
virtual ~PSPNetconfDialog();
virtual int Init(u32 paramAddr);

View file

@ -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, "");

View file

@ -213,7 +213,7 @@ enum class PSPOskNativeStatus {
class PSPOskDialog: public PSPDialog {
public:
PSPOskDialog();
PSPOskDialog(int type);
virtual ~PSPOskDialog();
virtual int Init(u32 oskPtr);

View file

@ -17,7 +17,7 @@
#include "PSPPlaceholderDialog.h"
PSPPlaceholderDialog::PSPPlaceholderDialog() : PSPDialog() {
PSPPlaceholderDialog::PSPPlaceholderDialog(int type) : PSPDialog(type) {
}

View file

@ -21,7 +21,7 @@
class PSPPlaceholderDialog: public PSPDialog {
public:
PSPPlaceholderDialog();
PSPPlaceholderDialog(int type);
virtual ~PSPPlaceholderDialog();
virtual int Init();

View file

@ -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);
}

View file

@ -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;
};

View file

@ -52,8 +52,7 @@ struct SceUtilityScreenshotParams {
// TODO
};
PSPScreenshotDialog::PSPScreenshotDialog() : PSPDialog() {
PSPScreenshotDialog::PSPScreenshotDialog(int type) : PSPDialog(type) {
}
PSPScreenshotDialog::~PSPScreenshotDialog() {

View file

@ -24,7 +24,7 @@ struct SceUtilityScreenshotParams;
class PSPScreenshotDialog : public PSPDialog {
public:
PSPScreenshotDialog();
PSPScreenshotDialog(int type);
virtual ~PSPScreenshotDialog();
virtual int Init(u32 paramAddr);

View file

@ -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<int, u32> currentlyLoadedModules;