cellGame: add error_code

This commit is contained in:
Megamouse 2019-01-20 22:57:13 +01:00 committed by Ivan
parent 982b2ab88f
commit 17a5e0bc98
5 changed files with 59 additions and 33 deletions

View File

@ -1,4 +1,4 @@
#include "stdafx.h" #include "stdafx.h"
#include "Emu/System.h" #include "Emu/System.h"
#include "Emu/IdManager.h" #include "Emu/IdManager.h"
#include "Emu/Cell/PPUModule.h" #include "Emu/Cell/PPUModule.h"
@ -79,6 +79,26 @@ void fmt_class_string<CellDiscGameError>::format(std::string& out, u64 arg)
}); });
} }
template<>
void fmt_class_string<CellHddGameError>::format(std::string& out, u64 arg)
{
format_enum(out, arg, [](auto error)
{
switch (error)
{
STR_CASE(CELL_HDDGAME_ERROR_CBRESULT);
STR_CASE(CELL_HDDGAME_ERROR_ACCESS_ERROR);
STR_CASE(CELL_HDDGAME_ERROR_INTERNAL);
STR_CASE(CELL_HDDGAME_ERROR_PARAM);
STR_CASE(CELL_HDDGAME_ERROR_NOSPACE);
STR_CASE(CELL_HDDGAME_ERROR_BROKEN);
STR_CASE(CELL_HDDGAME_ERROR_FAILURE);
}
return unknown;
});
}
// If dir is empty: // If dir is empty:
// contentInfo = "/dev_bdvd/PS3_GAME" // contentInfo = "/dev_bdvd/PS3_GAME"
// usrdir = "/dev_bdvd/PS3_GAME/USRDIR" // usrdir = "/dev_bdvd/PS3_GAME/USRDIR"
@ -125,7 +145,7 @@ struct content_permission final
} }
}; };
s32 cellHddGameCheck(ppu_thread& ppu, u32 version, vm::cptr<char> dirName, u32 errDialog, vm::ptr<CellHddGameStatCallback> funcStat, u32 container) error_code cellHddGameCheck(ppu_thread& ppu, u32 version, vm::cptr<char> dirName, u32 errDialog, vm::ptr<CellHddGameStatCallback> funcStat, u32 container)
{ {
cellGame.error("cellHddGameCheck(version=%d, dirName=%s, errDialog=%d, funcStat=*0x%x, container=%d)", version, dirName, errDialog, funcStat, container); cellGame.error("cellHddGameCheck(version=%d, dirName=%s, errDialog=%d, funcStat=*0x%x, container=%d)", version, dirName, errDialog, funcStat, container);
@ -133,7 +153,7 @@ s32 cellHddGameCheck(ppu_thread& ppu, u32 version, vm::cptr<char> dirName, u32 e
if (dir.size() != 9) if (dir.size() != 9)
{ {
return (s32)CELL_HDDGAME_ERROR_PARAM; return CELL_HDDGAME_ERROR_PARAM;
} }
vm::var<CellHddGameCBResult> result; vm::var<CellHddGameCBResult> result;
@ -189,7 +209,7 @@ s32 cellHddGameCheck(ppu_thread& ppu, u32 version, vm::cptr<char> dirName, u32 e
if (result->result != CELL_HDDGAME_CBRESULT_OK && result->result != CELL_HDDGAME_CBRESULT_OK_CANCEL) if (result->result != CELL_HDDGAME_CBRESULT_OK && result->result != CELL_HDDGAME_CBRESULT_OK_CANCEL)
{ {
return (s32)CELL_HDDGAME_ERROR_CBRESULT; return CELL_HDDGAME_ERROR_CBRESULT;
} }
// TODO ? // TODO ?
@ -197,12 +217,12 @@ s32 cellHddGameCheck(ppu_thread& ppu, u32 version, vm::cptr<char> dirName, u32 e
return CELL_OK; return CELL_OK;
} }
s32 cellHddGameCheck2() error_code cellHddGameCheck2()
{ {
fmt::throw_exception("Unimplemented" HERE); fmt::throw_exception("Unimplemented" HERE);
} }
s32 cellHddGameGetSizeKB(vm::ptr<u32> size) error_code cellHddGameGetSizeKB(vm::ptr<u32> size)
{ {
cellGame.warning("cellHddGameGetSizeKB(size=*0x%x)", size); cellGame.warning("cellHddGameGetSizeKB(size=*0x%x)", size);
@ -210,7 +230,7 @@ s32 cellHddGameGetSizeKB(vm::ptr<u32> size)
if (!fs::is_dir(local_dir)) if (!fs::is_dir(local_dir))
{ {
return (s32)CELL_HDDGAME_ERROR_FAILURE; return CELL_HDDGAME_ERROR_FAILURE;
} }
*size = ::narrow<u32>(fs::get_dir_size(local_dir) / 1024); *size = ::narrow<u32>(fs::get_dir_size(local_dir) / 1024);
@ -218,7 +238,7 @@ s32 cellHddGameGetSizeKB(vm::ptr<u32> size)
return CELL_OK; return CELL_OK;
} }
s32 cellHddGameSetSystemVer(vm::cptr<char> systemVersion) error_code cellHddGameSetSystemVer(vm::cptr<char> systemVersion)
{ {
cellGame.todo("cellHddGameSetSystemVer(systemVersion=%s)", systemVersion); cellGame.todo("cellHddGameSetSystemVer(systemVersion=%s)", systemVersion);
@ -230,7 +250,7 @@ s32 cellHddGameSetSystemVer(vm::cptr<char> systemVersion)
return CELL_OK; return CELL_OK;
} }
s32 cellHddGameExitBroken() error_code cellHddGameExitBroken()
{ {
cellGame.warning("cellHddGameExitBroken()"); cellGame.warning("cellHddGameExitBroken()");
@ -246,7 +266,7 @@ s32 cellHddGameExitBroken()
return CELL_OK; return CELL_OK;
} }
s32 cellGameDataGetSizeKB(vm::ptr<u32> size) error_code cellGameDataGetSizeKB(vm::ptr<u32> size)
{ {
cellGame.warning("cellGameDataGetSizeKB(size=*0x%x)", size); cellGame.warning("cellGameDataGetSizeKB(size=*0x%x)", size);
@ -267,7 +287,7 @@ s32 cellGameDataGetSizeKB(vm::ptr<u32> size)
return CELL_OK; return CELL_OK;
} }
s32 cellGameDataSetSystemVer(vm::cptr<char> systemVersion) error_code cellGameDataSetSystemVer(vm::cptr<char> systemVersion)
{ {
cellGame.todo("cellGameDataSetSystemVer(systemVersion=%s)", systemVersion); cellGame.todo("cellGameDataSetSystemVer(systemVersion=%s)", systemVersion);
@ -279,7 +299,7 @@ s32 cellGameDataSetSystemVer(vm::cptr<char> systemVersion)
return CELL_OK; return CELL_OK;
} }
s32 cellGameDataExitBroken() error_code cellGameDataExitBroken()
{ {
cellGame.warning("cellGameDataExitBroken()"); cellGame.warning("cellGameDataExitBroken()");
@ -607,7 +627,7 @@ error_code cellGameDataCheckCreate2(ppu_thread& ppu, u32 version, vm::cptr<char>
} }
} }
s32 cellGameDataCheckCreate(ppu_thread& ppu, u32 version, vm::cptr<char> dirName, u32 errDialog, vm::ptr<CellGameDataStatCallback> funcStat, u32 container) error_code cellGameDataCheckCreate(ppu_thread& ppu, u32 version, vm::cptr<char> dirName, u32 errDialog, vm::ptr<CellGameDataStatCallback> funcStat, u32 container)
{ {
cellGame.warning("cellGameDataCheckCreate(version=0x%x, dirName=%s, errDialog=0x%x, funcStat=*0x%x, container=%d)", version, dirName, errDialog, funcStat, container); cellGame.warning("cellGameDataCheckCreate(version=0x%x, dirName=%s, errDialog=0x%x, funcStat=*0x%x, container=%d)", version, dirName, errDialog, funcStat, container);
@ -667,7 +687,7 @@ error_code cellGameCreateGameData(vm::ptr<CellGameSetInitParams> init, vm::ptr<c
return CELL_OK; return CELL_OK;
} }
s32 cellGameDeleteGameData(vm::cptr<char> dirName) error_code cellGameDeleteGameData(vm::cptr<char> dirName)
{ {
cellGame.todo("cellGameDeleteGameData(dirName=%s)", dirName); cellGame.todo("cellGameDeleteGameData(dirName=%s)", dirName);
@ -853,7 +873,7 @@ error_code cellGameGetSizeKB(vm::ptr<s32> size)
return CELL_OK; return CELL_OK;
} }
s32 cellGameGetDiscContentInfoUpdatePath(vm::ptr<char> updatePath) error_code cellGameGetDiscContentInfoUpdatePath(vm::ptr<char> updatePath)
{ {
cellGame.todo("cellGameGetDiscContentInfoUpdatePath(updatePath=*0x%x)", updatePath); cellGame.todo("cellGameGetDiscContentInfoUpdatePath(updatePath=*0x%x)", updatePath);
@ -865,7 +885,7 @@ s32 cellGameGetDiscContentInfoUpdatePath(vm::ptr<char> updatePath)
return CELL_OK; return CELL_OK;
} }
s32 cellGameGetLocalWebContentPath(vm::ptr<char> contentPath) error_code cellGameGetLocalWebContentPath(vm::ptr<char> contentPath)
{ {
cellGame.todo("cellGameGetLocalWebContentPath(contentPath=*0x%x)", contentPath); cellGame.todo("cellGameGetLocalWebContentPath(contentPath=*0x%x)", contentPath);
@ -925,14 +945,14 @@ s32 cellGameThemeInstall(vm::cptr<char> usrdirPath, vm::cptr<char> fileName, u32
return CELL_OK; return CELL_OK;
} }
s32 cellGameThemeInstallFromBuffer(u32 fileSize, u32 bufSize, vm::ptr<void> buf, vm::ptr<CellGameThemeInstallCallback> func, u32 option) error_code cellGameThemeInstallFromBuffer(u32 fileSize, u32 bufSize, vm::ptr<void> buf, vm::ptr<CellGameThemeInstallCallback> func, u32 option)
{ {
cellGame.todo("cellGameThemeInstallFromBuffer(fileSize=%d, bufSize=%d, buf=*0x%x, func=*0x%x, option=0x%x)", fileSize, bufSize, buf, func, option); cellGame.todo("cellGameThemeInstallFromBuffer(fileSize=%d, bufSize=%d, buf=*0x%x, func=*0x%x, option=0x%x)", fileSize, bufSize, buf, func, option);
return CELL_OK; return CELL_OK;
} }
s32 cellDiscGameGetBootDiscInfo(vm::ptr<CellDiscGameSystemFileParam> getParam) error_code cellDiscGameGetBootDiscInfo(vm::ptr<CellDiscGameSystemFileParam> getParam)
{ {
cellGame.warning("cellDiscGameGetBootDiscInfo(getParam=*0x%x)", getParam); cellGame.warning("cellDiscGameGetBootDiscInfo(getParam=*0x%x)", getParam);
@ -958,28 +978,28 @@ s32 cellDiscGameGetBootDiscInfo(vm::ptr<CellDiscGameSystemFileParam> getParam)
return CELL_OK; return CELL_OK;
} }
s32 cellDiscGameRegisterDiscChangeCallback(vm::ptr<CellDiscGameDiscEjectCallback> funcEject, vm::ptr<CellDiscGameDiscInsertCallback> funcInsert) error_code cellDiscGameRegisterDiscChangeCallback(vm::ptr<CellDiscGameDiscEjectCallback> funcEject, vm::ptr<CellDiscGameDiscInsertCallback> funcInsert)
{ {
cellGame.todo("cellDiscGameRegisterDiscChangeCallback(funcEject=*0x%x, funcInsert=*0x%x)", funcEject, funcInsert); cellGame.todo("cellDiscGameRegisterDiscChangeCallback(funcEject=*0x%x, funcInsert=*0x%x)", funcEject, funcInsert);
return CELL_OK; return CELL_OK;
} }
s32 cellDiscGameUnregisterDiscChangeCallback() error_code cellDiscGameUnregisterDiscChangeCallback()
{ {
cellGame.todo("cellDiscGameUnregisterDiscChangeCallback()"); cellGame.todo("cellDiscGameUnregisterDiscChangeCallback()");
return CELL_OK; return CELL_OK;
} }
s32 cellGameRegisterDiscChangeCallback(vm::ptr<CellGameDiscEjectCallback> funcEject, vm::ptr<CellGameDiscInsertCallback> funcInsert) error_code cellGameRegisterDiscChangeCallback(vm::ptr<CellGameDiscEjectCallback> funcEject, vm::ptr<CellGameDiscInsertCallback> funcInsert)
{ {
cellGame.todo("cellGameRegisterDiscChangeCallback(funcEject=*0x%x, funcInsert=*0x%x)", funcEject, funcInsert); cellGame.todo("cellGameRegisterDiscChangeCallback(funcEject=*0x%x, funcInsert=*0x%x)", funcEject, funcInsert);
return CELL_OK; return CELL_OK;
} }
s32 cellGameUnregisterDiscChangeCallback() error_code cellGameUnregisterDiscChangeCallback()
{ {
cellGame.todo("cellGameUnregisterDiscChangeCallback()"); cellGame.todo("cellGameUnregisterDiscChangeCallback()");

View File

@ -242,17 +242,23 @@ struct CellGameDataStatSet
typedef void(CellGameDataStatCallback)(vm::ptr<CellGameDataCBResult> cbResult, vm::ptr<CellGameDataStatGet> get, vm::ptr<CellGameDataStatSet> set); typedef void(CellGameDataStatCallback)(vm::ptr<CellGameDataCBResult> cbResult, vm::ptr<CellGameDataStatGet> get, vm::ptr<CellGameDataStatSet> set);
// cellSysutil: cellHddGame // cellSysutil: cellHddGame
enum CellHddGameError : u32
{
CELL_HDDGAME_ERROR_CBRESULT = 0x8002ba01,
CELL_HDDGAME_ERROR_ACCESS_ERROR = 0x8002ba02,
CELL_HDDGAME_ERROR_INTERNAL = 0x8002ba03,
CELL_HDDGAME_ERROR_PARAM = 0x8002ba04,
CELL_HDDGAME_ERROR_NOSPACE = 0x8002ba05,
CELL_HDDGAME_ERROR_BROKEN = 0x8002ba06,
CELL_HDDGAME_ERROR_FAILURE = 0x8002ba07,
};
enum enum
{ {
// Return Codes // Return Codes
CELL_HDDGAME_RET_CANCEL = 1, CELL_HDDGAME_RET_OK = 0,
CELL_HDDGAME_ERROR_CBRESULT = 0x8002ba01, CELL_HDDGAME_RET_CANCEL = 1,
CELL_HDDGAME_ERROR_ACCESS_ERROR = 0x8002ba02,
CELL_HDDGAME_ERROR_INTERNAL = 0x8002ba03,
CELL_HDDGAME_ERROR_PARAM = 0x8002ba04,
CELL_HDDGAME_ERROR_NOSPACE = 0x8002ba05,
CELL_HDDGAME_ERROR_BROKEN = 0x8002ba06,
CELL_HDDGAME_ERROR_FAILURE = 0x8002ba07,
// Callback Result // Callback Result
CELL_HDDGAME_CBRESULT_OK_CANCEL = 1, CELL_HDDGAME_CBRESULT_OK_CANCEL = 1,

View File

@ -34,7 +34,7 @@ MsgDialogBase::~MsgDialogBase()
error_code cellMsgDialogOpen2(u32 type, vm::cptr<char> msgString, vm::ptr<CellMsgDialogCallback> callback, vm::ptr<void> userData, vm::ptr<void> extParam); error_code cellMsgDialogOpen2(u32 type, vm::cptr<char> msgString, vm::ptr<CellMsgDialogCallback> callback, vm::ptr<void> userData, vm::ptr<void> extParam);
// wrapper to call for other hle dialogs // wrapper to call for other hle dialogs
s32 open_msg_dialog(u32 type, vm::cptr<char> msgString, vm::ptr<CellMsgDialogCallback> callback, vm::ptr<void> userData, vm::ptr<void> extParam) error_code open_msg_dialog(u32 type, vm::cptr<char> msgString, vm::ptr<CellMsgDialogCallback> callback, vm::ptr<void> userData, vm::ptr<void> extParam)
{ {
cellSysutil.warning("open_msg_dialog called. This will call cellMsgDialogOpen2"); cellSysutil.warning("open_msg_dialog called. This will call cellMsgDialogOpen2");
return cellMsgDialogOpen2(type, msgString, callback, userData, extParam); return cellMsgDialogOpen2(type, msgString, callback, userData, extParam);

View File

@ -82,7 +82,7 @@ enum class MsgDialogState
Close, Close,
}; };
s32 open_msg_dialog(u32 type, vm::cptr<char> msgString, vm::ptr<CellMsgDialogCallback> callback = vm::null, vm::ptr<void> userData = vm::null, vm::ptr<void> extParam = vm::null); error_code open_msg_dialog(u32 type, vm::cptr<char> msgString, vm::ptr<CellMsgDialogCallback> callback = vm::null, vm::ptr<void> userData = vm::null, vm::ptr<void> extParam = vm::null);
class MsgDialogBase class MsgDialogBase
{ {

View File

@ -925,7 +925,7 @@ namespace rsx
close(); close();
} }
s32 show(const std::string& text, const MsgDialogType &type, std::function<void(s32 status)> on_close) error_code show(const std::string text, const MsgDialogType &type, std::function<void(s32 status)> on_close)
{ {
num_progress_bars = type.progress_bar_count; num_progress_bars = type.progress_bar_count;
if (num_progress_bars) if (num_progress_bars)