mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-13 02:08:49 +12:00
cellMsgDialogOpen2(): argument checking improved
This commit is contained in:
parent
d2964c1fa4
commit
e9653f1029
4 changed files with 112 additions and 93 deletions
|
@ -32,29 +32,13 @@ MsgDialogProgressBarSetMsgCb MsgDialogProgressBarSetMsg = nullptr;
|
|||
MsgDialogProgressBarResetCb MsgDialogProgressBarReset = nullptr;
|
||||
MsgDialogProgressBarIncCb MsgDialogProgressBarInc = nullptr;
|
||||
|
||||
void SetMsgDialogCreateCallback(MsgDialogCreateCb cb)
|
||||
void SetMsgDialogCallbacks(MsgDialogCreateCb ccb, MsgDialogDestroyCb dcb, MsgDialogProgressBarSetMsgCb pbscb, MsgDialogProgressBarResetCb pbrcb, MsgDialogProgressBarIncCb pbicb)
|
||||
{
|
||||
MsgDialogCreate = cb;
|
||||
}
|
||||
|
||||
void SetMsgDialogDestroyCallback(MsgDialogDestroyCb cb)
|
||||
{
|
||||
MsgDialogDestroy = cb;
|
||||
}
|
||||
|
||||
void SetMsgDialogProgressBarSetMsgCallback(MsgDialogProgressBarSetMsgCb cb)
|
||||
{
|
||||
MsgDialogProgressBarSetMsg = cb;
|
||||
}
|
||||
|
||||
void SetMsgDialogProgressBarResetCallback(MsgDialogProgressBarResetCb cb)
|
||||
{
|
||||
MsgDialogProgressBarReset = cb;
|
||||
}
|
||||
|
||||
void SetMsgDialogProgressBarIncCallback(MsgDialogProgressBarIncCb cb)
|
||||
{
|
||||
MsgDialogProgressBarInc = cb;
|
||||
MsgDialogCreate = ccb;
|
||||
MsgDialogDestroy = dcb;
|
||||
MsgDialogProgressBarSetMsg = pbscb;
|
||||
MsgDialogProgressBarReset = pbrcb;
|
||||
MsgDialogProgressBarInc = pbicb;
|
||||
}
|
||||
|
||||
void MsgDialogClose()
|
||||
|
@ -63,13 +47,64 @@ void MsgDialogClose()
|
|||
g_msg_dialog_wait_until = get_system_time();
|
||||
}
|
||||
|
||||
int cellMsgDialogOpen2(u32 type, vm::ptr<const char> msgString, vm::ptr<CellMsgDialogCallback> callback, u32 userData, u32 extParam)
|
||||
s32 cellMsgDialogOpen2(u32 type, vm::ptr<const char> msgString, vm::ptr<CellMsgDialogCallback> callback, u32 userData, u32 extParam)
|
||||
{
|
||||
cellSysutil->Warning("cellMsgDialogOpen2(type=0x%x, msgString_addr=0x%x, callback_addr=0x%x, userData=0x%x, extParam=0x%x)",
|
||||
type, msgString.addr(), callback.addr(), userData, extParam);
|
||||
|
||||
//type |= CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE | CELL_MSGDIALOG_TYPE_BG_INVISIBLE;
|
||||
//type |= CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO | CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO;
|
||||
|
||||
if (!msgString || strlen(msgString.get_ptr()) >= 0x200 || type & -0x33f8)
|
||||
{
|
||||
return CELL_MSGDIALOG_ERROR_PARAM;
|
||||
}
|
||||
|
||||
switch (type & CELL_MSGDIALOG_TYPE_BUTTON_TYPE)
|
||||
{
|
||||
case CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE:
|
||||
{
|
||||
if (type & CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR)
|
||||
{
|
||||
return CELL_MSGDIALOG_ERROR_PARAM;
|
||||
}
|
||||
switch (type & CELL_MSGDIALOG_TYPE_PROGRESSBAR)
|
||||
{
|
||||
case CELL_MSGDIALOG_TYPE_PROGRESSBAR_NONE: break;
|
||||
case CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE: break;
|
||||
case CELL_MSGDIALOG_TYPE_PROGRESSBAR_DOUBLE: break;
|
||||
default: return CELL_MSGDIALOG_ERROR_PARAM;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO:
|
||||
{
|
||||
switch (type & CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR)
|
||||
{
|
||||
case CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_YES: break;
|
||||
case CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO: break;
|
||||
default: return CELL_MSGDIALOG_ERROR_PARAM;
|
||||
}
|
||||
if (type & CELL_MSGDIALOG_TYPE_PROGRESSBAR)
|
||||
{
|
||||
return CELL_MSGDIALOG_ERROR_PARAM;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK:
|
||||
{
|
||||
if (type & CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR)
|
||||
{
|
||||
return CELL_MSGDIALOG_ERROR_PARAM;
|
||||
}
|
||||
if (type & CELL_MSGDIALOG_TYPE_PROGRESSBAR)
|
||||
{
|
||||
return CELL_MSGDIALOG_ERROR_PARAM;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default: return CELL_MSGDIALOG_ERROR_PARAM;
|
||||
}
|
||||
|
||||
MsgDialogState old = msgDialogNone;
|
||||
if (!g_msg_dialog_state.compare_exchange_strong(old, msgDialogOpen))
|
||||
|
@ -83,10 +118,10 @@ int cellMsgDialogOpen2(u32 type, vm::ptr<const char> msgString, vm::ptr<CellMsgD
|
|||
{
|
||||
case CELL_MSGDIALOG_TYPE_PROGRESSBAR_DOUBLE: g_msg_dialog_progress_bar_count = 2; break;
|
||||
case CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE: g_msg_dialog_progress_bar_count = 1; break;
|
||||
default: g_msg_dialog_progress_bar_count = 0; break; // ???
|
||||
default: g_msg_dialog_progress_bar_count = 0; break;
|
||||
}
|
||||
|
||||
std::string msg = (msgString.addr() != 0) ? msgString.get_ptr() : "";
|
||||
std::string msg = msgString.get_ptr();
|
||||
|
||||
thread t("MsgDialog thread", [type, msg, callback, userData, extParam]()
|
||||
{
|
||||
|
@ -156,7 +191,7 @@ int cellMsgDialogOpen2(u32 type, vm::ptr<const char> msgString, vm::ptr<CellMsgD
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellMsgDialogOpenErrorCode(u32 errorCode, vm::ptr<CellMsgDialogCallback> callback, u32 userData, u32 extParam)
|
||||
s32 cellMsgDialogOpenErrorCode(u32 errorCode, vm::ptr<CellMsgDialogCallback> callback, u32 userData, u32 extParam)
|
||||
{
|
||||
cellSysutil->Warning("cellMsgDialogOpenErrorCode(errorCode=0x%x, callback_addr=0x%x, userData=0x%x, extParam=%d)",
|
||||
errorCode, callback.addr(), userData, extParam);
|
||||
|
@ -255,7 +290,7 @@ int cellMsgDialogOpenErrorCode(u32 errorCode, vm::ptr<CellMsgDialogCallback> cal
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellMsgDialogClose(float delay)
|
||||
s32 cellMsgDialogClose(float delay)
|
||||
{
|
||||
cellSysutil->Warning("cellMsgDialogClose(delay=%f)", delay);
|
||||
|
||||
|
@ -277,7 +312,7 @@ int cellMsgDialogClose(float delay)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellMsgDialogAbort()
|
||||
s32 cellMsgDialogAbort()
|
||||
{
|
||||
cellSysutil->Warning("cellMsgDialogAbort()");
|
||||
|
||||
|
@ -298,7 +333,7 @@ int cellMsgDialogAbort()
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellMsgDialogProgressBarSetMsg(u32 progressBarIndex, vm::ptr<const char> msgString)
|
||||
s32 cellMsgDialogProgressBarSetMsg(u32 progressBarIndex, vm::ptr<const char> msgString)
|
||||
{
|
||||
cellSysutil->Warning("cellMsgDialogProgressBarSetMsg(progressBarIndex=%d, msgString_addr=0x%x ['%s'])",
|
||||
progressBarIndex, msgString.addr(), msgString.get_ptr());
|
||||
|
@ -322,7 +357,7 @@ int cellMsgDialogProgressBarSetMsg(u32 progressBarIndex, vm::ptr<const char> msg
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellMsgDialogProgressBarReset(u32 progressBarIndex)
|
||||
s32 cellMsgDialogProgressBarReset(u32 progressBarIndex)
|
||||
{
|
||||
cellSysutil->Warning("cellMsgDialogProgressBarReset(progressBarIndex=%d)", progressBarIndex);
|
||||
|
||||
|
@ -343,7 +378,7 @@ int cellMsgDialogProgressBarReset(u32 progressBarIndex)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellMsgDialogProgressBarInc(u32 progressBarIndex, u32 delta)
|
||||
s32 cellMsgDialogProgressBarInc(u32 progressBarIndex, u32 delta)
|
||||
{
|
||||
cellSysutil->Warning("cellMsgDialogProgressBarInc(progressBarIndex=%d, delta=%d)", progressBarIndex, delta);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue