Merge pull request #740 from tambry/ErrorDialogFix

Improve content errors and fix access violation
This commit is contained in:
B1ackDaemon 2014-08-13 00:23:52 +03:00
commit 72f1206585

View File

@ -421,23 +421,37 @@ int cellGameGetLocalWebContentPath()
int cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, u32 dirName_addr) int cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, u32 dirName_addr)
{ {
cellGame->Warning("cellGameContentErrorDialog(type=%d, errNeedSizeKB=%d, dirName_addr=0x%x)", type, errNeedSizeKB, dirName_addr); cellGame->Warning("cellGameContentErrorDialog(type=%d, errNeedSizeKB=%d, dirName_addr=0x%x)", type, errNeedSizeKB, dirName_addr);
char* dirName = (char*)Memory.VirtualToRealAddr(dirName_addr);
std::string errorName; std::string errorName;
switch(type) std::string errorMsg;
char* dirName;
if (type == CELL_GAME_ERRDIALOG_NOSPACE || CELL_GAME_ERRDIALOG_NOSPACE_EXIT)
{ {
case CELL_GAME_ERRDIALOG_BROKEN_GAMEDATA: errorName = "Game data is corrupted (can be continued)."; break; char* dirName = (char*)Memory.VirtualToRealAddr(dirName_addr);
case CELL_GAME_ERRDIALOG_BROKEN_HDDGAME: errorName = "HDD boot game is corrupted (can be continued)."; break; }
case CELL_GAME_ERRDIALOG_NOSPACE: errorName = "Not enough available space (can be continued)."; break;
case CELL_GAME_ERRDIALOG_BROKEN_EXIT_GAMEDATA: errorName = "Game data is corrupted (terminate application)."; break; switch (type)
case CELL_GAME_ERRDIALOG_BROKEN_EXIT_HDDGAME: errorName = "HDD boot game is corrupted (terminate application)."; break; {
case CELL_GAME_ERRDIALOG_NOSPACE_EXIT: errorName = "Not enough available space (terminate application)."; break; case CELL_GAME_ERRDIALOG_BROKEN_GAMEDATA: errorName = "Game data is corrupted (can be continued)."; break;
default: return CELL_GAME_ERROR_PARAM; case CELL_GAME_ERRDIALOG_BROKEN_HDDGAME: errorName = "HDD boot game is corrupted (can be continued)."; break;
case CELL_GAME_ERRDIALOG_NOSPACE: errorName = "Not enough available space (can be continued)."; break;
case CELL_GAME_ERRDIALOG_BROKEN_EXIT_GAMEDATA: errorName = "Game data is corrupted (terminate application)."; break;
case CELL_GAME_ERRDIALOG_BROKEN_EXIT_HDDGAME: errorName = "HDD boot game is corrupted (terminate application)."; break;
case CELL_GAME_ERRDIALOG_NOSPACE_EXIT: errorName = "Not enough available space (terminate application)."; break;
default: return CELL_GAME_ERROR_PARAM;
}
if (type == CELL_GAME_ERRDIALOG_NOSPACE || CELL_GAME_ERRDIALOG_NOSPACE_EXIT)
{
errorMsg = fmt::Format("ERROR: %s\nSpace needed: %d KB\nDirectory name: %s", errorName.c_str(), errNeedSizeKB, dirName);
}
else
{
errorMsg = fmt::Format("ERROR: %s", errorName.c_str());
} }
std::string errorMsg = fmt::Format("%s\nSpace needed: %d KB\nDirectory name: %s",
errorName.c_str(), errNeedSizeKB, dirName);
rMessageBox(errorMsg, "Error", rICON_ERROR | rOK); rMessageBox(errorMsg, "Error", rICON_ERROR | rOK);
return CELL_OK; return CELL_OK;
} }