Core: Add some error message when failing to load rom

This commit is contained in:
zilmar 2023-02-13 12:04:31 +10:30
parent 4390a0926c
commit baa5dbe257
4 changed files with 16 additions and 1 deletions

View File

@ -530,6 +530,10 @@
#2062# "Nintendo 64DD Development IPL ROM not found.\nIt is required to play development 64DD disk images.\n\nPlease select the required ROM in the Settings."
#2063# "Failed to update cheat, it is invalid"
#2064# "Invalid Cheat"
#2065# "Failed to read ident bytes"
#2066# "Invalid image file"
#2067# "Failed to allocate for rom"
#2068# "Failed to open rom"
/*** Android ***/

View File

@ -572,9 +572,12 @@ enum LanguageStringID
MSG_TOOL_IPL_REQUIRED = 2062,
MSG_CHEAT_INVALID_MSG = 2063,
MSG_CHEAT_INVALID_TITLE = 2064,
MSG_ROM_FAILED_READ_IDENT = 2065,
MSG_ROM_INVALID_IMAGE_FILE = 2066,
MSG_ROM_FAILED_ROM_ALLOCATE = 2067,
MSG_ROM_FAILED_TO_OPEN = 2068,
// Android
ANDROID_SETTINGS = 3000,
ANDROID_FORUM = 3001,
ANDROID_REPORT_BUG = 3002,

View File

@ -515,6 +515,10 @@ void CLanguage::LoadDefaultStrings(void)
DEF_STR(MSG_TOOL_IPL_REQUIRED, "Nintendo 64DD development IPL ROM not found.\nIt is required to play development 64DD disk images.\n\nPlease select the required ROM in the settings.");
DEF_STR(MSG_CHEAT_INVALID_MSG, "Failed to update cheat, it is invalid");
DEF_STR(MSG_CHEAT_INVALID_TITLE, "Invalid Cheat");
DEF_STR(MSG_ROM_FAILED_READ_IDENT, "Failed to read ident bytes");
DEF_STR(MSG_ROM_INVALID_IMAGE_FILE, "Invalid image file");
DEF_STR(MSG_ROM_FAILED_ROM_ALLOCATE, "Failed to allocate for rom");
DEF_STR(MSG_ROM_FAILED_TO_OPEN, "Failed to open rom");
/*** Android ***/

View File

@ -53,6 +53,7 @@ bool CN64Rom::AllocateAndLoadN64Image(const char * FileLoc, bool LoadBootCodeOnl
WriteTrace(TraceN64System, TraceDebug, "Trying to open %s", FileLoc);
if (!m_RomFile.Open(FileLoc, CFileBase::modeRead))
{
SetError(MSG_ROM_FAILED_TO_OPEN);
WriteTrace(TraceN64System, TraceError, "Failed to open %s", FileLoc);
return false;
}
@ -63,12 +64,14 @@ bool CN64Rom::AllocateAndLoadN64Image(const char * FileLoc, bool LoadBootCodeOnl
if (m_RomFile.Read(Test, sizeof(Test)) != sizeof(Test))
{
m_RomFile.Close();
SetError(MSG_ROM_FAILED_READ_IDENT);
WriteTrace(TraceN64System, TraceError, "Failed to read ident bytes");
return false;
}
if (!IsValidRomImage(Test))
{
m_RomFile.Close();
SetError(MSG_ROM_INVALID_IMAGE_FILE);
WriteTrace(TraceN64System, TraceError, "Invalid image file %X %X %X %X", Test[0], Test[1], Test[2], Test[3]);
return false;
}
@ -85,6 +88,7 @@ bool CN64Rom::AllocateAndLoadN64Image(const char * FileLoc, bool LoadBootCodeOnl
if (!AllocateRomImage(RomFileSize))
{
m_RomFile.Close();
SetError(MSG_ROM_FAILED_ROM_ALLOCATE);
return false;
}