diff --git a/rpcs3/Emu/Cell/Modules/cellGame.cpp b/rpcs3/Emu/Cell/Modules/cellGame.cpp index 1b61cb66f1..5d2222b281 100644 --- a/rpcs3/Emu/Cell/Modules/cellGame.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGame.cpp @@ -218,22 +218,43 @@ s32 cellHddGameGetSizeKB(vm::ptr size) return CELL_OK; } -s32 cellHddGameSetSystemVer() +s32 cellHddGameSetSystemVer(vm::cptr systemVersion) { - UNIMPLEMENTED_FUNC(cellGame); + cellGame.todo("cellHddGameSetSystemVer(systemVersion=%s)", systemVersion); + + if (!systemVersion) + { + return CELL_HDDGAME_ERROR_PARAM; + } + return CELL_OK; } s32 cellHddGameExitBroken() { - fmt::throw_exception("Unimplemented" HERE); -} + cellGame.warning("cellHddGameExitBroken()"); + s32 res = open_msg_dialog(CELL_MSGDIALOG_TYPE_SE_TYPE_ERROR | CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK | CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_ON, + vm::make_str("There has been an error!\n\nPlease reinstall the HDD boot game.")); + + if (res != CELL_OK) + { + return CELL_HDDGAME_ERROR_INTERNAL; + } + + sysutil_send_system_cmd(CELL_SYSUTIL_REQUEST_EXITGAME, 0); + return CELL_OK; +} s32 cellGameDataGetSizeKB(vm::ptr size) { cellGame.warning("cellGameDataGetSizeKB(size=*0x%x)", size); + if (!size) + { + return CELL_GAMEDATA_ERROR_PARAM; + } + const std::string local_dir = vfs::get(Emu.GetDir()); if (!fs::is_dir(local_dir)) @@ -246,17 +267,33 @@ s32 cellGameDataGetSizeKB(vm::ptr size) return CELL_OK; } -s32 cellGameDataSetSystemVer() +s32 cellGameDataSetSystemVer(vm::cptr systemVersion) { - UNIMPLEMENTED_FUNC(cellGame); + cellGame.todo("cellGameDataSetSystemVer(systemVersion=%s)", systemVersion); + + if (!systemVersion) + { + return CELL_GAMEDATA_ERROR_PARAM; + } + return CELL_OK; } s32 cellGameDataExitBroken() { - fmt::throw_exception("Unimplemented" HERE); -} + cellGame.warning("cellGameDataExitBroken()"); + s32 res = open_msg_dialog(CELL_MSGDIALOG_TYPE_SE_TYPE_ERROR | CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK | CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_ON, + vm::make_str("There has been an error!\n\nPlease delete the game's game data.")); + + if (res != CELL_OK) + { + return CELL_GAMEDATA_ERROR_INTERNAL; + } + + sysutil_send_system_cmd(CELL_SYSUTIL_REQUEST_EXITGAME, 0); + return CELL_OK; +} error_code cellGameBootCheck(vm::ptr type, vm::ptr attributes, vm::ptr size, vm::ptr dirName) { @@ -629,9 +666,15 @@ error_code cellGameCreateGameData(vm::ptr init, vm::ptr dirName) { - UNIMPLEMENTED_FUNC(cellGame); + cellGame.todo("cellGameDeleteGameData(dirName=%s)", dirName); + + if (!dirName) + { + return CELL_GAME_ERROR_PARAM; + } + return CELL_OK; } @@ -639,6 +682,11 @@ error_code cellGameGetParamInt(s32 id, vm::ptr value) { cellGame.warning("cellGameGetParamInt(id=%d, value=*0x%x)", id, value); + if (!value) + { + return CELL_GAME_ERROR_PARAM; + } + const auto prm = fxm::get(); if (!prm) @@ -772,6 +820,11 @@ error_code cellGameGetSizeKB(vm::ptr size) { cellGame.warning("cellGameGetSizeKB(size=*0x%x)", size); + if (!size) + { + return CELL_GAME_ERROR_PARAM; + } + const auto prm = fxm::get(); if (!prm) @@ -791,15 +844,27 @@ error_code cellGameGetSizeKB(vm::ptr size) return CELL_OK; } -s32 cellGameGetDiscContentInfoUpdatePath() +s32 cellGameGetDiscContentInfoUpdatePath(vm::ptr updatePath) { - UNIMPLEMENTED_FUNC(cellGame); + cellGame.todo("cellGameGetDiscContentInfoUpdatePath(updatePath=*0x%x)", updatePath); + + if (!updatePath) + { + return CELL_GAME_ERROR_PARAM; + } + return CELL_OK; } -s32 cellGameGetLocalWebContentPath() +s32 cellGameGetLocalWebContentPath(vm::ptr contentPath) { - UNIMPLEMENTED_FUNC(cellGame); + cellGame.todo("cellGameGetLocalWebContentPath(contentPath=*0x%x)", contentPath); + + if (!contentPath) + { + return CELL_GAME_ERROR_PARAM; + } + return CELL_OK; } @@ -834,45 +899,30 @@ error_code cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, vm::cptrtype.bg_invisible = true; - dlg->type.button_type = 2; // OK - dlg->type.disable_cancel = true; + return CELL_OK; +} - atomic_t result(false); +s32 cellGameThemeInstall(vm::cptr usrdirPath, vm::cptr fileName, u32 option) +{ + cellGame.todo("cellGameThemeInstall(usrdirPath=%s, fileName=%s, option=0x%x)", usrdirPath, fileName, option); - dlg->on_close = [&](s32 status) + if (!fileName || !usrdirPath || usrdirPath.size() > CELL_GAME_PATH_MAX) { - result = true; - }; - - Emu.CallAfter([&]() - { - dlg->Create(errorMsg); - }); - - while (!result) - { - thread_ctrl::wait_for(1000); + return CELL_GAME_ERROR_PARAM; } return CELL_OK; } -s32 cellGameThemeInstall() +s32 cellGameThemeInstallFromBuffer(u32 fileSize, u32 bufSize, vm::ptr buf, vm::ptr func, u32 option) { - UNIMPLEMENTED_FUNC(cellGame); + cellGame.todo("cellGameThemeInstallFromBuffer(fileSize=%d, bufSize=%d, buf=*0x%x, func=*0x%x, option=0x%x)", fileSize, bufSize, buf, func, option); + return CELL_OK; } -s32 cellGameThemeInstallFromBuffer() -{ - UNIMPLEMENTED_FUNC(cellGame); - return CELL_OK; -} - - s32 cellDiscGameGetBootDiscInfo(vm::ptr getParam) { cellGame.warning("cellDiscGameGetBootDiscInfo(getParam=*0x%x)", getParam); @@ -899,31 +949,34 @@ s32 cellDiscGameGetBootDiscInfo(vm::ptr getParam) return CELL_OK; } -s32 cellDiscGameRegisterDiscChangeCallback() +s32 cellDiscGameRegisterDiscChangeCallback(vm::ptr funcEject, vm::ptr funcInsert) { - UNIMPLEMENTED_FUNC(cellGame); + cellGame.todo("cellDiscGameRegisterDiscChangeCallback(funcEject=*0x%x, funcInsert=*0x%x)", funcEject, funcInsert); + return CELL_OK; } s32 cellDiscGameUnregisterDiscChangeCallback() { - UNIMPLEMENTED_FUNC(cellGame); + cellGame.todo("cellDiscGameUnregisterDiscChangeCallback()"); + return CELL_OK; } -s32 cellGameRegisterDiscChangeCallback() +s32 cellGameRegisterDiscChangeCallback(vm::ptr funcEject, vm::ptr funcInsert) { - UNIMPLEMENTED_FUNC(cellGame); + cellGame.todo("cellGameRegisterDiscChangeCallback(funcEject=*0x%x, funcInsert=*0x%x)", funcEject, funcInsert); + return CELL_OK; } s32 cellGameUnregisterDiscChangeCallback() { - UNIMPLEMENTED_FUNC(cellGame); + cellGame.todo("cellGameUnregisterDiscChangeCallback()"); + return CELL_OK; } - void cellSysutil_GameData_init() { REG_FUNC(cellSysutil, cellHddGameCheck); diff --git a/rpcs3/Emu/Cell/Modules/cellGame.h b/rpcs3/Emu/Cell/Modules/cellGame.h index a84ccff9ed..91d01bc5d1 100644 --- a/rpcs3/Emu/Cell/Modules/cellGame.h +++ b/rpcs3/Emu/Cell/Modules/cellGame.h @@ -57,6 +57,7 @@ enum CELL_GAME_DIRNAME_SIZE = 32, CELL_GAME_HDDGAMEPATH_SIZE = 128, CELL_GAME_THEMEFILENAME_SIZE = 48, + CELL_GAME_SYSP_LANGUAGE_NUM = 20, CELL_GAME_SYSP_TITLE_SIZE = 128, CELL_GAME_SYSP_TITLEID_SIZE = 10, @@ -64,12 +65,11 @@ enum CELL_GAME_SYSP_PS3_SYSTEM_VER_SIZE = 8, CELL_GAME_SYSP_APP_VER_SIZE = 6, - CELL_GAME_GAMETYPE_SYS = 0, - CELL_GAME_GAMETYPE_DISC = 1, - CELL_GAME_GAMETYPE_HDD = 2, - CELL_GAME_GAMETYPE_HOME = 4, - + CELL_GAME_GAMETYPE_SYS = 0, + CELL_GAME_GAMETYPE_DISC = 1, + CELL_GAME_GAMETYPE_HDD = 2, CELL_GAME_GAMETYPE_GAMEDATA = 3, + CELL_GAME_GAMETYPE_HOME = 4, CELL_GAME_SIZEKB_NOTCALC = -1, @@ -81,6 +81,12 @@ enum CELL_GAME_ATTRIBUTE_INVITE_MESSAGE = 0x20, CELL_GAME_ATTRIBUTE_CUSTOM_DATA_MESSAGE = 0x40, CELL_GAME_ATTRIBUTE_WEB_BROWSER = 0x100, + + CELL_GAME_THEME_OPTION_NONE = 0x0, + CELL_GAME_THEME_OPTION_APPLY = 0x1, + + CELL_GAME_DISCTYPE_OTHER = 0, + CELL_GAME_DISCTYPE_PS3 = 1, }; //Parameter IDs of PARAM.SFO @@ -202,7 +208,9 @@ struct CellGameDataSystemFileParam be_t attribute; char reserved2[256]; }; -struct CellDiscGameSystemFileParam { + +struct CellDiscGameSystemFileParam +{ char titleId[CELL_DISCGAME_SYSP_TITLEID_SIZE]; char reserved0[2]; be_t parentalLevel; @@ -319,3 +327,8 @@ struct CellHddGameStatSet }; typedef void(CellHddGameStatCallback)(vm::ptr cbResult, vm::ptr get, vm::ptr set); +typedef void(CellGameThemeInstallCallback)(u32 fileOffset, u32 readSize, vm::ptr buf); +typedef void(CellGameDiscEjectCallback)(void); +typedef void(CellGameDiscInsertCallback)(u32 discType, vm::ptr titleId); +typedef void(CellDiscGameDiscEjectCallback)(void); +typedef void(CellDiscGameDiscInsertCallback)(u32 discType, vm::ptr titleId); diff --git a/rpcs3/Emu/Cell/Modules/cellMsgDialog.cpp b/rpcs3/Emu/Cell/Modules/cellMsgDialog.cpp index 5e8113bc8e..43a335ba60 100644 --- a/rpcs3/Emu/Cell/Modules/cellMsgDialog.cpp +++ b/rpcs3/Emu/Cell/Modules/cellMsgDialog.cpp @@ -19,7 +19,7 @@ MsgDialogBase::~MsgDialogBase() s32 cellMsgDialogOpen2(u32 type, vm::cptr msgString, vm::ptr callback, vm::ptr userData, vm::ptr extParam); // wrapper to call for other hle dialogs -s32 open_msg_dialog(u32 type, vm::cptr msgString, vm::ptr callback = vm::null, vm::ptr userData = vm::null, vm::ptr extParam = vm::null) +s32 open_msg_dialog(u32 type, vm::cptr msgString, vm::ptr callback, vm::ptr userData, vm::ptr extParam) { cellSysutil.warning("open_msg_dialog called. This will call cellMsgDialogOpen2"); return cellMsgDialogOpen2(type, msgString, callback, userData, extParam); diff --git a/rpcs3/Emu/Cell/Modules/cellMsgDialog.h b/rpcs3/Emu/Cell/Modules/cellMsgDialog.h index 6a428b3075..930edbffb1 100644 --- a/rpcs3/Emu/Cell/Modules/cellMsgDialog.h +++ b/rpcs3/Emu/Cell/Modules/cellMsgDialog.h @@ -71,7 +71,7 @@ enum class MsgDialogState Close, }; -s32 open_msg_dialog(u32 type, vm::cptr msgString, vm::ptr callback, vm::ptr userData, vm::ptr extParam); +s32 open_msg_dialog(u32 type, vm::cptr msgString, vm::ptr callback = vm::null, vm::ptr userData = vm::null, vm::ptr extParam = vm::null); class MsgDialogBase {