diff --git a/Core/Dialog/PSPMsgDialog.cpp b/Core/Dialog/PSPMsgDialog.cpp index d90354f70f..7ddd1f8a73 100755 --- a/Core/Dialog/PSPMsgDialog.cpp +++ b/Core/Dialog/PSPMsgDialog.cpp @@ -17,6 +17,7 @@ #include #include "Core/Dialog/PSPMsgDialog.h" +#include "Core/Dialog/PSPSaveDialog.h" #include "Core/Util/PPGeDraw.h" #include "Core/HLE/sceCtrl.h" #include "Core/MemMapHelpers.h" @@ -133,7 +134,7 @@ int PSPMsgDialog::Init(unsigned int paramAddr) { } if (flag & DS_ERRORMSG) { - snprintf(msgText, 512, "Error code: %08x", messageDialog.errorNum); + FormatErrorCode(messageDialog.errorNum); } else { truncate_cpy(msgText, messageDialog.string); } @@ -145,6 +146,40 @@ int PSPMsgDialog::Init(unsigned int paramAddr) { return 0; } + +void PSPMsgDialog::FormatErrorCode(uint32_t code) { + auto di = GetI18NCategory("Dialog"); + + switch (code) { + case SCE_UTILITY_SAVEDATA_ERROR_LOAD_DATA_BROKEN: + snprintf(msgText, 512, "%s (%08x)", di->T("MsgErrorSavedataDataBroken", "Save data was corrupt."), code); + break; + + case SCE_UTILITY_SAVEDATA_ERROR_LOAD_NO_MS: + case SCE_UTILITY_SAVEDATA_ERROR_RW_NO_MEMSTICK: + case SCE_UTILITY_SAVEDATA_ERROR_SAVE_NO_MS: + case SCE_UTILITY_SAVEDATA_ERROR_DELETE_NO_MS: + case SCE_UTILITY_SAVEDATA_ERROR_SIZES_NO_MS: + snprintf(msgText, 512, "%s (%08x)", di->T("MsgErrorSavedataNoMS", "Memory stick not inserted."), code); + break; + + case SCE_UTILITY_SAVEDATA_ERROR_LOAD_NO_DATA: + case SCE_UTILITY_SAVEDATA_ERROR_RW_NO_DATA: + case SCE_UTILITY_SAVEDATA_ERROR_DELETE_NO_DATA: + case SCE_UTILITY_SAVEDATA_ERROR_SIZES_NO_DATA: + snprintf(msgText, 512, "%s (%08x)", di->T("MsgErrorSavedataNoData", "Warning: no save data was found."), code); + break; + + case SCE_UTILITY_SAVEDATA_ERROR_RW_MEMSTICK_FULL: + case SCE_UTILITY_SAVEDATA_ERROR_SAVE_MS_NOSPACE: + snprintf(msgText, 512, "%s (%08x)", di->T("MsgErrorSavedataMSFull", "Memory stick full. Check your storage space."), code); + break; + + default: + snprintf(msgText, 512, "%s %08x", di->T("MsgErrorCode", "Error code:"), code); + } +} + void PSPMsgDialog::DisplayMessage(std::string text, bool hasYesNo, bool hasOK) { auto di = GetI18NCategory("Dialog"); diff --git a/Core/Dialog/PSPMsgDialog.h b/Core/Dialog/PSPMsgDialog.h index 64309f4659..78490393f8 100644 --- a/Core/Dialog/PSPMsgDialog.h +++ b/Core/Dialog/PSPMsgDialog.h @@ -74,7 +74,8 @@ protected: return false; } -private : +private: + void FormatErrorCode(uint32_t code); void DisplayMessage(std::string text, bool hasYesNo = false, bool hasOK = false); enum Flags diff --git a/Core/Dialog/SavedataParam.h b/Core/Dialog/SavedataParam.h index e509463712..857c69779b 100644 --- a/Core/Dialog/SavedataParam.h +++ b/Core/Dialog/SavedataParam.h @@ -17,6 +17,7 @@ #pragma once +#include #include "Common/CommonTypes.h" #include "Core/MemMap.h" #include "Core/HLE/sceRtc.h"