Validate options in MsgDialog v3 per tests.

This commit is contained in:
Unknown W. Brackets 2014-01-23 00:41:42 -08:00
parent fa1c5e0f87
commit bcdcd528b2
2 changed files with 20 additions and 15 deletions

View file

@ -54,7 +54,7 @@ int PSPMsgDialog::Init(unsigned int paramAddr)
Memory::Memcpy(&messageDialog,paramAddr,size); Memory::Memcpy(&messageDialog,paramAddr,size);
// debug info // debug info
int optionsNotCoded = ((messageDialog.options | SCE_UTILITY_MSGDIALOG_DEBUG_OPTION_CODED) ^ SCE_UTILITY_MSGDIALOG_DEBUG_OPTION_CODED); int optionsNotCoded = messageDialog.options & ~SCE_UTILITY_MSGDIALOG_OPTION_SUPPORTED;
if(optionsNotCoded) if(optionsNotCoded)
{ {
ERROR_LOG_REPORT(SCEUTILITY, "PSPMsgDialog options not coded : 0x%08x", optionsNotCoded); ERROR_LOG_REPORT(SCEUTILITY, "PSPMsgDialog options not coded : 0x%08x", optionsNotCoded);
@ -70,7 +70,7 @@ int PSPMsgDialog::Init(unsigned int paramAddr)
} }
else if(size == SCE_UTILITY_MSGDIALOG_SIZE_V2 && messageDialog.type == 1) else if(size == SCE_UTILITY_MSGDIALOG_SIZE_V2 && messageDialog.type == 1)
{ {
unsigned int validOp = SCE_UTILITY_MSGDIALOG_OPTION_TEXT | unsigned int validOp = SCE_UTILITY_MSGDIALOG_OPTION_TEXTSOUND |
SCE_UTILITY_MSGDIALOG_OPTION_YESNO | SCE_UTILITY_MSGDIALOG_OPTION_YESNO |
SCE_UTILITY_MSGDIALOG_OPTION_DEFAULT_NO; SCE_UTILITY_MSGDIALOG_OPTION_DEFAULT_NO;
if (((messageDialog.options | validOp) ^ validOp) != 0) if (((messageDialog.options | validOp) ^ validOp) != 0)
@ -87,6 +87,11 @@ int PSPMsgDialog::Init(unsigned int paramAddr)
flag |= DS_ERROR; flag |= DS_ERROR;
messageDialog.result = SCE_UTILITY_MSGDIALOG_ERROR_BADOPTION; messageDialog.result = SCE_UTILITY_MSGDIALOG_ERROR_BADOPTION;
} }
if (messageDialog.options & ~SCE_UTILITY_MSGDIALOG_OPTION_SUPPORTED)
{
flag |= DS_ERROR;
messageDialog.result = SCE_UTILITY_MSGDIALOG_ERROR_BADOPTION;
}
} }
if(flag == 0) if(flag == 0)

View file

@ -19,8 +19,8 @@
#include "PSPDialog.h" #include "PSPDialog.h"
#define SCE_UTILITY_MSGDIALOG_OPTION_ERROR 0x00000000 #define SCE_UTILITY_MSGDIALOG_OPTION_ERRORSOUND 0x00000000
#define SCE_UTILITY_MSGDIALOG_OPTION_TEXT 0x00000001 #define SCE_UTILITY_MSGDIALOG_OPTION_TEXTSOUND 0x00000001
#define SCE_UTILITY_MSGDIALOG_OPTION_NOSOUND 0x00000002 #define SCE_UTILITY_MSGDIALOG_OPTION_NOSOUND 0x00000002
#define SCE_UTILITY_MSGDIALOG_OPTION_YESNO 0x00000010 #define SCE_UTILITY_MSGDIALOG_OPTION_YESNO 0x00000010
#define SCE_UTILITY_MSGDIALOG_OPTION_OK 0x00000020 #define SCE_UTILITY_MSGDIALOG_OPTION_OK 0x00000020
@ -31,7 +31,7 @@
#define SCE_UTILITY_MSGDIALOG_SIZE_V2 580 #define SCE_UTILITY_MSGDIALOG_SIZE_V2 580
#define SCE_UTILITY_MSGDIALOG_SIZE_V3 708 #define SCE_UTILITY_MSGDIALOG_SIZE_V3 708
#define SCE_UTILITY_MSGDIALOG_DEBUG_OPTION_CODED 0x000001B3 // OR of all options coded to display warning #define SCE_UTILITY_MSGDIALOG_OPTION_SUPPORTED 0x000001B3 // OR of all options coded to display warning
#define SCE_UTILITY_MSGDIALOG_ERROR_BADOPTION 0x80110501 #define SCE_UTILITY_MSGDIALOG_ERROR_BADOPTION 0x80110501
#define SCE_UTILITY_MSGDIALOG_ERROR_ERRORCODEINVALID 0x80110502 #define SCE_UTILITY_MSGDIALOG_ERROR_ERRORCODEINVALID 0x80110502