From 024f8ef89bb40e80c755cb4ef04ecf5dcafc16f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 18 Aug 2022 15:20:16 +0200 Subject: [PATCH] Initialize a bunch of Dialog structs --- Core/Dialog/PSPDialog.h | 10 +++++----- Core/Dialog/PSPGamedataInstallDialog.h | 18 +++++++++--------- Core/Dialog/PSPMsgDialog.h | 6 +++--- Core/Dialog/PSPOskDialog.h | 9 ++++----- Core/Dialog/PSPSaveDialog.h | 6 +++--- Core/Dialog/SavedataParam.cpp | 11 +---------- Core/Dialog/SavedataParam.h | 13 ++++++------- 7 files changed, 31 insertions(+), 42 deletions(-) diff --git a/Core/Dialog/PSPDialog.h b/Core/Dialog/PSPDialog.h index 54a9488e36..636fc20334 100644 --- a/Core/Dialog/PSPDialog.h +++ b/Core/Dialog/PSPDialog.h @@ -99,7 +99,7 @@ protected: void ChangeStatus(DialogStatus newStatus, int delayUs); void ChangeStatusInit(int delayUs); void ChangeStatusShutdown(int delayUs); - DialogStatus ReadStatus() { + DialogStatus ReadStatus() const { return status; } @@ -117,10 +117,10 @@ protected: unsigned int lastButtons = 0; unsigned int buttons = 0; - float fadeTimer; - bool isFading; - bool fadeIn; - u32 fadeValue; + float fadeTimer = 0.0f; + bool isFading = false; + bool fadeIn = false; + u32 fadeValue = 0; ImageID okButtonImg; ImageID cancelButtonImg; diff --git a/Core/Dialog/PSPGamedataInstallDialog.h b/Core/Dialog/PSPGamedataInstallDialog.h index 3dfd8687ef..e669a31873 100644 --- a/Core/Dialog/PSPGamedataInstallDialog.h +++ b/Core/Dialog/PSPGamedataInstallDialog.h @@ -59,16 +59,16 @@ private: void CloseCurrentFile(); void WriteSfoFile(); - SceUtilityGamedataInstallParam request; + SceUtilityGamedataInstallParam request{}; PSPPointer param; std::vector inFileNames; - int numFiles; - int readFiles; - u64 allFilesSize; // use this to calculate progress value. - u64 allReadSize; // use this to calculate progress value. - int progressValue; + int numFiles = 0; + int readFiles = 0; + u64 allFilesSize = 0; // use this to calculate progress value. + u64 allReadSize = 0; // use this to calculate progress value. + int progressValue = 0; - int currentInputFile; - u32 currentInputBytesLeft; - int currentOutputFile; + int currentInputFile = 0; + u32 currentInputBytesLeft = 0; + int currentOutputFile = 0; }; diff --git a/Core/Dialog/PSPMsgDialog.h b/Core/Dialog/PSPMsgDialog.h index e5912d2ee3..78ee4e54f4 100644 --- a/Core/Dialog/PSPMsgDialog.h +++ b/Core/Dialog/PSPMsgDialog.h @@ -94,11 +94,11 @@ private: u32 flag = 0; - pspMessageDialog messageDialog; - int messageDialogAddr; + pspMessageDialog messageDialog{}; + int messageDialogAddr = 0; char msgText[512]; - int yesnoChoice; + int yesnoChoice = 0; float scrollPos_ = 0.0f; int framesUpHeld_ = 0; int framesDownHeld_ = 0; diff --git a/Core/Dialog/PSPOskDialog.h b/Core/Dialog/PSPOskDialog.h index 8eb55586c0..c760afb1e4 100644 --- a/Core/Dialog/PSPOskDialog.h +++ b/Core/Dialog/PSPOskDialog.h @@ -148,7 +148,6 @@ struct SceUtilityOskParams SceUtilityOskState_le state; // Maybe just padding? s32_le unk_60; - }; // Internal enum, not from PSP. @@ -245,16 +244,16 @@ private: std::string oskIntext; std::string oskOuttext; - int selectedChar; + int selectedChar = 0; std::u16string inputChars; OskKeyboardDisplay currentKeyboard; OskKeyboardLanguage currentKeyboardLanguage; - bool isCombinated; + bool isCombinated = false; std::mutex nativeMutex_; PSPOskNativeStatus nativeStatus_ = PSPOskNativeStatus::IDLE; std::string nativeValue_; - int i_level; // for Korean Keyboard support - int i_value[3]; // for Korean Keyboard support + int i_level = 0; // for Korean Keyboard support + int i_value[3]{}; // for Korean Keyboard support }; diff --git a/Core/Dialog/PSPSaveDialog.h b/Core/Dialog/PSPSaveDialog.h index 8058d8a962..90f8d6312a 100644 --- a/Core/Dialog/PSPSaveDialog.h +++ b/Core/Dialog/PSPSaveDialog.h @@ -139,13 +139,13 @@ private: DisplayState display = DS_NONE; SavedataParam param; - SceUtilitySavedataParam request; + SceUtilitySavedataParam request{}; // For detecting changes made by the game. - SceUtilitySavedataParam originalRequest; + SceUtilitySavedataParam originalRequest{}; u32 requestAddr = 0; int currentSelectedSave = 0; - int yesnoChoice; + int yesnoChoice = 0; enum SaveIOStatus { diff --git a/Core/Dialog/SavedataParam.cpp b/Core/Dialog/SavedataParam.cpp index f4ba47a20e..980a3edf31 100644 --- a/Core/Dialog/SavedataParam.cpp +++ b/Core/Dialog/SavedataParam.cpp @@ -193,16 +193,7 @@ void SaveFileInfo::DoState(PointerWrap &p) } } -SavedataParam::SavedataParam() - : pspParam(0) - , selectedSave(0) - , saveDataList(0) - , noSaveIcon(0) - , saveDataListCount(0) - , saveNameListDataCount(0) -{ - -} +SavedataParam::SavedataParam() { } void SavedataParam::Init() { diff --git a/Core/Dialog/SavedataParam.h b/Core/Dialog/SavedataParam.h index b7daa02845..e7bdf9ad46 100644 --- a/Core/Dialog/SavedataParam.h +++ b/Core/Dialog/SavedataParam.h @@ -265,7 +265,6 @@ struct SceUtilitySavedataParam // Function 22 GETSIZES PSPPointer sizeInfo; - }; // Non native, this one we can reorganize as we like @@ -377,10 +376,10 @@ private: std::set GetSecureFileNames(const std::string &dirPath); bool GetExpectedHash(const std::string &dirPath, const std::string &filename, u8 hash[16]); - SceUtilitySavedataParam* pspParam; - int selectedSave; - SaveFileInfo *saveDataList; - SaveFileInfo *noSaveIcon; - int saveDataListCount; - int saveNameListDataCount; + SceUtilitySavedataParam* pspParam = nullptr; + int selectedSave = 0; + SaveFileInfo *saveDataList = nullptr; + SaveFileInfo *noSaveIcon = nullptr; + int saveDataListCount = 0; + int saveNameListDataCount = 0; };