From 686d3eb1df36b1fb7520df6d9104fbdffef20ad8 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Thu, 7 Jun 2018 13:20:09 +0200 Subject: [PATCH] cellMsgDialog: improvements --- rpcs3/Emu/Cell/Modules/cellMsgDialog.cpp | 27 +++++++++++++++--------- rpcs3/Emu/Cell/Modules/cellMsgDialog.h | 13 +++++++++++- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellMsgDialog.cpp b/rpcs3/Emu/Cell/Modules/cellMsgDialog.cpp index 43a335ba60..183a508247 100644 --- a/rpcs3/Emu/Cell/Modules/cellMsgDialog.cpp +++ b/rpcs3/Emu/Cell/Modules/cellMsgDialog.cpp @@ -29,7 +29,7 @@ s32 cellMsgDialogOpen2(u32 type, vm::cptr msgString, vm::ptr= 0x200 || type & -0x33f8) + if (!msgString || std::strlen(msgString.get_ptr()) >= CELL_MSGDIALOG_STRING_SIZE || type & -0x33f8) { return CELL_MSGDIALOG_ERROR_PARAM; } @@ -149,12 +149,12 @@ s32 cellMsgDialogOpen2(u32 type, vm::cptr msgString, vm::ptr msgString, vm::ptr callback, vm::ptr userData, vm::ptr extParam) { - //Note: This function needs proper implementation, solve first argument "type" conflict with MsgDialogOpen2 in cellMsgDialog.h. + // Note: This function needs proper implementation, solve first argument "type" conflict with MsgDialogOpen2 in cellMsgDialog.h. cellSysutil.todo("cellMsgDialogOpen(type=0x%x, msgString=%s, callback=*0x%x, userData=*0x%x, extParam=*0x%x)", type, msgString, callback, userData, extParam); return cellMsgDialogOpen2(type, msgString, callback, userData, extParam); } -s32 cellMsgDialogOpenErrorCode(ppu_thread& ppu, u32 errorCode, vm::ptr callback, vm::ptr userData, vm::ptr extParam) +s32 cellMsgDialogOpenErrorCode(u32 errorCode, vm::ptr callback, vm::ptr userData, vm::ptr extParam) { cellSysutil.warning("cellMsgDialogOpenErrorCode(errorCode=0x%x, callback=*0x%x, userData=*0x%x, extParam=*0x%x)", errorCode, callback, userData, extParam); @@ -231,12 +231,6 @@ s32 cellMsgDialogOpenErrorCode(ppu_thread& ppu, u32 errorCode, vm::ptr callback, vm::ptr userData, vm::ptr extParam) -{ - cellSysutil.todo("cellMsgDialogOpenSimulViewWarning(callback=*0x%x, userData=*0x%x, extParam=*0x%x)", callback, userData, extParam); - return CELL_OK; -} - s32 cellMsgDialogClose(f32 delay) { cellSysutil.warning("cellMsgDialogClose(delay=%f)", delay); @@ -319,11 +313,24 @@ s32 cellMsgDialogAbort() return CELL_OK; } +s32 cellMsgDialogOpenSimulViewWarning(vm::ptr callback, vm::ptr userData, vm::ptr extParam) +{ + cellSysutil.todo("cellMsgDialogOpenSimulViewWarning(callback=*0x%x, userData=*0x%x, extParam=*0x%x)", callback, userData, extParam); + + s32 ret = cellMsgDialogOpen2(CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL | CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK, vm::make_str("SimulView Warning"), callback, userData, extParam); + + // The dialog should ideally only be closeable by pressing ok after 3 seconds until it closes itself automatically after 5 seconds + if (ret == CELL_OK) + cellMsgDialogClose(5000.0f); + + return ret; +} + s32 cellMsgDialogProgressBarSetMsg(u32 progressBarIndex, vm::cptr msgString) { cellSysutil.warning("cellMsgDialogProgressBarSetMsg(progressBarIndex=%d, msgString=%s)", progressBarIndex, msgString); - if (!msgString) + if (!msgString || std::strlen(msgString.get_ptr()) >= CELL_MSGDIALOG_PROGRESSBAR_STRING_SIZE) { return CELL_MSGDIALOG_ERROR_PARAM; } diff --git a/rpcs3/Emu/Cell/Modules/cellMsgDialog.h b/rpcs3/Emu/Cell/Modules/cellMsgDialog.h index 930edbffb1..3587cb55af 100644 --- a/rpcs3/Emu/Cell/Modules/cellMsgDialog.h +++ b/rpcs3/Emu/Cell/Modules/cellMsgDialog.h @@ -2,7 +2,11 @@ #include "Utilities/BitField.h" - +enum +{ + CELL_MSGDIALOG_PROGRESSBAR_STRING_SIZE = 64, + CELL_MSGDIALOG_STRING_SIZE = 512, +}; enum { @@ -49,6 +53,13 @@ enum : s32 CELL_MSGDIALOG_BUTTON_ESCAPE = 3, }; +enum CellMsgDialogProgressBarIndex +{ + CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE = 0, // the only bar in a single bar dialog + CELL_MSGDIALOG_PROGRESSBAR_INDEX_DOUBLE_UPPER = 0, // the upper bar in a double bar dialog + CELL_MSGDIALOG_PROGRESSBAR_INDEX_DOUBLE_LOWER = 1, // the lower bar in a double bar dialog +}; + using CellMsgDialogCallback = void(s32 buttonType, vm::ptr userData); union MsgDialogType