MsgDialog: Show better error messages.

I think the PSP really did just show error codes, but that's not a reason
to keep that confusion going.  For common save errors, let's show the
messages.

Some games, for example, simply show the no data found error when you play
for the first time and trigger anything to check for data.
This commit is contained in:
Unknown W. Brackets committed 2020-07-13 18:24:05 -07:00
1 parent 3daf536e3c
commit f16a6b8abd
3 files changed
+39 -2

No files matched your search

+36 -1
View File
@@ -17,6 +17,7 @@
#include <algorithm>
#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");
+2 -1
View File
@@ -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
+1
View File
@@ -17,6 +17,7 @@
#pragma once
#include <set>
#include "Common/CommonTypes.h"
#include "Core/MemMap.h"
#include "Core/HLE/sceRtc.h"