mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 03:25:16 +00:00
cellGame slightly rearranged
This commit is contained in:
parent
85b63de631
commit
94b3cdf9e7
4 changed files with 243 additions and 229 deletions
|
@ -8,6 +8,7 @@
|
|||
#include "Emu/FS/VFS.h"
|
||||
#include "Emu/FS/vfsFile.h"
|
||||
#include "Loader/PSF.h"
|
||||
#include "cellSysutil.h"
|
||||
#include "cellGame.h"
|
||||
|
||||
extern Module cellGame;
|
||||
|
@ -16,10 +17,78 @@ std::string contentInfo = "";
|
|||
std::string usrdir = "";
|
||||
bool path_set = false;
|
||||
|
||||
int cellGameBootCheck(vm::ptr<u32> type, vm::ptr<u32> attributes, vm::ptr<CellGameContentSize> size, vm::ptr<char[CELL_GAME_DIRNAME_SIZE]> dirName)
|
||||
s32 cellHddGameCheck(u32 version, vm::ptr<const char> dirName, u32 errDialog, vm::ptr<CellHddGameStatCallback> funcStat, u32 container)
|
||||
{
|
||||
cellGame.Warning("cellGameBootCheck(type_addr=0x%x, attributes_addr=0x%x, size_addr=0x%x, dirName_addr=0x%x)",
|
||||
type.addr(), attributes.addr(), size.addr(), dirName.addr());
|
||||
cellGame.Warning("cellHddGameCheck(version=%d, dirName=*0x%x, errDialog=%d, funcStat=*0x%x, container=%d)", version, dirName, errDialog, funcStat, container);
|
||||
|
||||
std::string dir = dirName.get_ptr();
|
||||
if (dir.size() != 9)
|
||||
return CELL_HDDGAME_ERROR_PARAM;
|
||||
|
||||
vm::var<CellHddGameSystemFileParam> param;
|
||||
vm::var<CellHddGameCBResult> result;
|
||||
vm::var<CellHddGameStatGet> get;
|
||||
vm::var<CellHddGameStatSet> set;
|
||||
|
||||
get->hddFreeSizeKB = 40 * 1024 * 1024; // 40 GB, TODO: Use the free space of the computer's HDD where RPCS3 is being run.
|
||||
get->isNewData = CELL_HDDGAME_ISNEWDATA_EXIST;
|
||||
get->sysSizeKB = 0; // TODO
|
||||
get->atime = 0; // TODO
|
||||
get->ctime = 0; // TODO
|
||||
get->mtime = 0; // TODO
|
||||
get->sizeKB = CELL_HDDGAME_SIZEKB_NOTCALC;
|
||||
memcpy(get->contentInfoPath, ("/dev_hdd0/game/" + dir).c_str(), CELL_HDDGAME_PATH_MAX);
|
||||
memcpy(get->hddGamePath, ("/dev_hdd0/game/" + dir + "/USRDIR").c_str(), CELL_HDDGAME_PATH_MAX);
|
||||
|
||||
if (!Emu.GetVFS().ExistsDir(("/dev_hdd0/game/" + dir).c_str()))
|
||||
{
|
||||
get->isNewData = CELL_HDDGAME_ISNEWDATA_NODIR;
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Is cellHddGameCheck really responsible for writing the information in get->getParam ? (If not, delete this else)
|
||||
|
||||
vfsFile f(("/dev_hdd0/game/" + dir + "/PARAM.SFO").c_str());
|
||||
PSFLoader psf(f);
|
||||
if (!psf.Load(false)) {
|
||||
return CELL_HDDGAME_ERROR_BROKEN;
|
||||
}
|
||||
|
||||
get->getParam.parentalLevel = psf.GetInteger("PARENTAL_LEVEL");
|
||||
get->getParam.attribute = psf.GetInteger("ATTRIBUTE");
|
||||
get->getParam.resolution = psf.GetInteger("RESOLUTION");
|
||||
get->getParam.soundFormat = psf.GetInteger("SOUND_FORMAT");
|
||||
std::string title = psf.GetString("TITLE");
|
||||
strcpy_trunc(get->getParam.title, title);
|
||||
std::string app_ver = psf.GetString("APP_VER");
|
||||
strcpy_trunc(get->getParam.dataVersion, app_ver);
|
||||
strcpy_trunc(get->getParam.titleId, dir);
|
||||
|
||||
for (u32 i = 0; i<CELL_HDDGAME_SYSP_LANGUAGE_NUM; i++) {
|
||||
char key[16];
|
||||
sprintf(key, "TITLE_%02d", i);
|
||||
title = psf.GetString(key);
|
||||
strcpy_trunc(get->getParam.titleLang[i], title);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO ?
|
||||
|
||||
//funcStat(result, get, set);
|
||||
|
||||
if (result->result != CELL_HDDGAME_CBRESULT_OK &&
|
||||
result->result != CELL_HDDGAME_CBRESULT_OK_CANCEL) {
|
||||
return CELL_HDDGAME_ERROR_CBRESULT;
|
||||
}
|
||||
|
||||
// TODO ?
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellGameBootCheck(vm::ptr<u32> type, vm::ptr<u32> attributes, vm::ptr<CellGameContentSize> size, vm::ptr<char[CELL_GAME_DIRNAME_SIZE]> dirName)
|
||||
{
|
||||
cellGame.Warning("cellGameBootCheck(type=*0x%x, attributes=*0x%x, size=*0x%x, dirName=*0x%x)", type, attributes, size, dirName);
|
||||
|
||||
if (size)
|
||||
{
|
||||
|
@ -84,15 +153,9 @@ int cellGameBootCheck(vm::ptr<u32> type, vm::ptr<u32> attributes, vm::ptr<CellGa
|
|||
return CELL_GAME_RET_OK;
|
||||
}
|
||||
|
||||
int cellGamePatchCheck(vm::ptr<CellGameContentSize> size, u32 reserved_addr)
|
||||
s32 cellGamePatchCheck(vm::ptr<CellGameContentSize> size, vm::ptr<void> reserved)
|
||||
{
|
||||
cellGame.Warning("cellGamePatchCheck(size_addr=0x%x, reserved_addr=0x%x)", size.addr(), reserved_addr);
|
||||
|
||||
if (reserved_addr != 0)
|
||||
{
|
||||
cellGame.Error("cellGamePatchCheck(): CELL_GAME_ERROR_PARAM");
|
||||
return CELL_GAME_ERROR_PARAM;
|
||||
}
|
||||
cellGame.Warning("cellGamePatchCheck(size=*0x%x, reserved=*0x%x)", size, reserved);
|
||||
|
||||
if (size)
|
||||
{
|
||||
|
@ -133,9 +196,9 @@ int cellGamePatchCheck(vm::ptr<CellGameContentSize> size, u32 reserved_addr)
|
|||
return CELL_GAME_RET_OK;
|
||||
}
|
||||
|
||||
int cellGameDataCheck(u32 type, vm::ptr<const char> dirName, vm::ptr<CellGameContentSize> size)
|
||||
s32 cellGameDataCheck(u32 type, vm::ptr<const char> dirName, vm::ptr<CellGameContentSize> size)
|
||||
{
|
||||
cellGame.Warning("cellGameDataCheck(type=0x%x, dirName_addr=0x%x, size_addr=0x%x)", type, dirName.addr(), size.addr());
|
||||
cellGame.Warning("cellGameDataCheck(type=%d, dirName=*0x%x, size=*0x%x)", type, dirName, size);
|
||||
|
||||
if ((type - 1) >= 3)
|
||||
{
|
||||
|
@ -191,15 +254,16 @@ int cellGameDataCheck(u32 type, vm::ptr<const char> dirName, vm::ptr<CellGameCon
|
|||
return CELL_GAME_RET_OK;
|
||||
}
|
||||
|
||||
int cellGameContentPermit(vm::ptr<char[CELL_GAME_PATH_MAX]> contentInfoPath, vm::ptr<char[CELL_GAME_PATH_MAX]> usrdirPath)
|
||||
s32 cellGameContentPermit(vm::ptr<char[CELL_GAME_PATH_MAX]> contentInfoPath, vm::ptr<char[CELL_GAME_PATH_MAX]> usrdirPath)
|
||||
{
|
||||
cellGame.Warning("cellGameContentPermit(contentInfoPath_addr=0x%x, usrdirPath_addr=0x%x)",
|
||||
contentInfoPath.addr(), usrdirPath.addr());
|
||||
cellGame.Warning("cellGameContentPermit(contentInfoPath=*0x%x, usrdirPath=*0x%x)", contentInfoPath, usrdirPath);
|
||||
|
||||
if (!contentInfoPath || !usrdirPath)
|
||||
{
|
||||
return CELL_GAME_ERROR_PARAM;
|
||||
}
|
||||
|
||||
cellGame.Warning("cellGameContentPermit(): path_set=%d, contentInfo='%s', usrdir='%s'", path_set, contentInfo, usrdir);
|
||||
|
||||
if (!path_set)
|
||||
{
|
||||
|
@ -216,15 +280,13 @@ int cellGameContentPermit(vm::ptr<char[CELL_GAME_PATH_MAX]> contentInfoPath, vm:
|
|||
return CELL_GAME_RET_OK;
|
||||
}
|
||||
|
||||
int cellGameDataCheckCreate2(PPUThread& CPU, u32 version, vm::ptr<const char> dirName, u32 errDialog,
|
||||
vm::ptr<void(vm::ptr<CellGameDataCBResult> cbResult, vm::ptr<CellGameDataStatGet> get, vm::ptr<CellGameDataStatSet> set)> funcStat, u32 container)
|
||||
s32 cellGameDataCheckCreate2(PPUThread& CPU, u32 version, vm::ptr<const char> dirName, u32 errDialog, vm::ptr<CellGameDataStatCallback> funcStat, u32 container)
|
||||
{
|
||||
cellGame.Warning("cellGameDataCheckCreate(2)(version=0x%x, dirName_addr=0x%x, errDialog=0x%x, funcStat_addr=0x%x, container=%d)",
|
||||
version, dirName.addr(), errDialog, funcStat.addr(), container);
|
||||
cellGame.Warning("cellGameDataCheckCreate2(version=0x%x, dirName=*0x%x, errDialog=0x%x, funcStat=*0x%x, container=%d)", version, dirName, errDialog, funcStat, container);
|
||||
|
||||
if (version != CELL_GAMEDATA_VERSION_CURRENT || errDialog > 1)
|
||||
{
|
||||
cellGame.Error("cellGameDataCheckCreate(2)(): CELL_GAMEDATA_ERROR_PARAM");
|
||||
cellGame.Error("cellGameDataCheckCreate2(): CELL_GAMEDATA_ERROR_PARAM");
|
||||
return CELL_GAMEDATA_ERROR_PARAM;
|
||||
}
|
||||
|
||||
|
@ -234,7 +296,7 @@ int cellGameDataCheckCreate2(PPUThread& CPU, u32 version, vm::ptr<const char> di
|
|||
|
||||
if (!Emu.GetVFS().ExistsDir(dir))
|
||||
{
|
||||
cellGame.Todo("cellGameDataCheckCreate(2)(): creating directory '%s'", dir.c_str());
|
||||
cellGame.Todo("cellGameDataCheckCreate2(): creating directory '%s'", dir.c_str());
|
||||
// TODO: create data
|
||||
return CELL_GAMEDATA_RET_OK;
|
||||
}
|
||||
|
@ -242,14 +304,14 @@ int cellGameDataCheckCreate2(PPUThread& CPU, u32 version, vm::ptr<const char> di
|
|||
vfsFile f(dir + "/PARAM.SFO");
|
||||
if (!f.IsOpened())
|
||||
{
|
||||
cellGame.Error("cellGameDataCheckCreate(2)(): CELL_GAMEDATA_ERROR_BROKEN (cannot open PARAM.SFO)");
|
||||
cellGame.Error("cellGameDataCheckCreate2(): CELL_GAMEDATA_ERROR_BROKEN (cannot open PARAM.SFO)");
|
||||
return CELL_GAMEDATA_ERROR_BROKEN;
|
||||
}
|
||||
|
||||
PSFLoader psf(f);
|
||||
if (!psf.Load(false))
|
||||
{
|
||||
cellGame.Error("cellGameDataCheckCreate(2)(): CELL_GAMEDATA_ERROR_BROKEN (cannot read PARAM.SFO)");
|
||||
cellGame.Error("cellGameDataCheckCreate2(): CELL_GAMEDATA_ERROR_BROKEN (cannot read PARAM.SFO)");
|
||||
return CELL_GAMEDATA_ERROR_BROKEN;
|
||||
}
|
||||
|
||||
|
@ -287,66 +349,92 @@ int cellGameDataCheckCreate2(PPUThread& CPU, u32 version, vm::ptr<const char> di
|
|||
if (cbSet->setParam)
|
||||
{
|
||||
// TODO: write PARAM.SFO from cbSet
|
||||
cellGame.Todo("cellGameDataCheckCreate(2)(): writing PARAM.SFO parameters (addr=0x%x)", cbSet->setParam);
|
||||
cellGame.Todo("cellGameDataCheckCreate2(): writing PARAM.SFO parameters (addr=0x%x)", cbSet->setParam);
|
||||
}
|
||||
|
||||
switch ((s32)cbResult->result)
|
||||
{
|
||||
case CELL_GAMEDATA_CBRESULT_OK_CANCEL:
|
||||
// TODO: do not process game data
|
||||
cellGame.Warning("cellGameDataCheckCreate(2)(): callback returned CELL_GAMEDATA_CBRESULT_OK_CANCEL");
|
||||
cellGame.Warning("cellGameDataCheckCreate2(): callback returned CELL_GAMEDATA_CBRESULT_OK_CANCEL");
|
||||
|
||||
case CELL_GAMEDATA_CBRESULT_OK:
|
||||
return CELL_GAMEDATA_RET_OK;
|
||||
|
||||
case CELL_GAMEDATA_CBRESULT_ERR_NOSPACE: // TODO: process errors, error message and needSizeKB result
|
||||
cellGame.Error("cellGameDataCheckCreate(2)(): callback returned CELL_GAMEDATA_CBRESULT_ERR_NOSPACE");
|
||||
cellGame.Error("cellGameDataCheckCreate2(): callback returned CELL_GAMEDATA_CBRESULT_ERR_NOSPACE");
|
||||
return CELL_GAMEDATA_ERROR_CBRESULT;
|
||||
|
||||
case CELL_GAMEDATA_CBRESULT_ERR_BROKEN:
|
||||
cellGame.Error("cellGameDataCheckCreate(2)(): callback returned CELL_GAMEDATA_CBRESULT_ERR_BROKEN");
|
||||
cellGame.Error("cellGameDataCheckCreate2(): callback returned CELL_GAMEDATA_CBRESULT_ERR_BROKEN");
|
||||
return CELL_GAMEDATA_ERROR_CBRESULT;
|
||||
|
||||
case CELL_GAMEDATA_CBRESULT_ERR_NODATA:
|
||||
cellGame.Error("cellGameDataCheckCreate(2)(): callback returned CELL_GAMEDATA_CBRESULT_ERR_NODATA");
|
||||
cellGame.Error("cellGameDataCheckCreate2(): callback returned CELL_GAMEDATA_CBRESULT_ERR_NODATA");
|
||||
return CELL_GAMEDATA_ERROR_CBRESULT;
|
||||
|
||||
case CELL_GAMEDATA_CBRESULT_ERR_INVALID:
|
||||
cellGame.Error("cellGameDataCheckCreate(2)(): callback returned CELL_GAMEDATA_CBRESULT_ERR_INVALID");
|
||||
cellGame.Error("cellGameDataCheckCreate2(): callback returned CELL_GAMEDATA_CBRESULT_ERR_INVALID");
|
||||
return CELL_GAMEDATA_ERROR_CBRESULT;
|
||||
|
||||
default:
|
||||
cellGame.Error("cellGameDataCheckCreate(2)(): callback returned unknown error (code=0x%x)");
|
||||
cellGame.Error("cellGameDataCheckCreate2(): callback returned unknown error (code=0x%x)");
|
||||
return CELL_GAMEDATA_ERROR_CBRESULT;
|
||||
}
|
||||
}
|
||||
|
||||
int cellGameDataCheckCreate(PPUThread& CPU, u32 version, vm::ptr<const char> dirName, u32 errDialog,
|
||||
vm::ptr<void(vm::ptr<CellGameDataCBResult> cbResult, vm::ptr<CellGameDataStatGet> get, vm::ptr<CellGameDataStatSet> set)> funcStat, u32 container)
|
||||
s32 cellGameDataCheckCreate(PPUThread& CPU, u32 version, vm::ptr<const char> dirName, u32 errDialog, vm::ptr<CellGameDataStatCallback> funcStat, u32 container)
|
||||
{
|
||||
cellGame.Warning("cellGameDataCheckCreate(version=0x%x, dirName=*0x%x, errDialog=0x%x, funcStat=*0x%x, container=%d)", version, dirName, errDialog, funcStat, container);
|
||||
|
||||
// TODO: almost identical, the only difference is that this function will always calculate the size of game data
|
||||
return cellGameDataCheckCreate2(CPU, version, dirName, errDialog, funcStat, container);
|
||||
}
|
||||
|
||||
int cellGameCreateGameData(vm::ptr<CellGameSetInitParams> init, vm::ptr<char> tmp_contentInfoPath, vm::ptr<char> tmp_usrdirPath)
|
||||
s32 cellGameCreateGameData(vm::ptr<CellGameSetInitParams> init, vm::ptr<char[CELL_GAME_PATH_MAX]> tmp_contentInfoPath, vm::ptr<char[CELL_GAME_PATH_MAX]> tmp_usrdirPath)
|
||||
{
|
||||
cellGame.Todo("cellGameCreateGameData(init_addr=0x%x, tmp_contentInfoPath_addr=0x%x, tmp_usrdirPath_addr=0x%x)",
|
||||
init.addr(), tmp_contentInfoPath.addr(), tmp_usrdirPath.addr());
|
||||
cellGame.Error("cellGameCreateGameData(init=*0x%x, tmp_contentInfoPath=*0x%x, tmp_usrdirPath=*0x%x)", init, tmp_contentInfoPath, tmp_usrdirPath);
|
||||
|
||||
std::string titleId = init->titleId;
|
||||
contentInfo = "/dev_hdd0/game/" + titleId;
|
||||
usrdir = "/dev_hdd0/game/" + titleId + "/USRDIR";
|
||||
|
||||
if (!Emu.GetVFS().CreateDir(contentInfo))
|
||||
{
|
||||
cellGame.Error("cellGameCreateGameData(): failed to create content directory ('%s')", contentInfo);
|
||||
return CELL_GAME_ERROR_ACCESS_ERROR; // ???
|
||||
}
|
||||
|
||||
if (!Emu.GetVFS().CreateDir(usrdir))
|
||||
{
|
||||
cellGame.Error("cellGameCreateGameData(): failed to create USRDIR directory ('%s')", usrdir);
|
||||
return CELL_GAME_ERROR_ACCESS_ERROR; // ???
|
||||
}
|
||||
|
||||
// TODO: create temporary game directory, set initial PARAM.SFO parameters
|
||||
// cellGameContentPermit should then move files in non-temporary location and return their non-temporary displacement
|
||||
strcpy_trunc(*tmp_contentInfoPath, contentInfo);
|
||||
strcpy_trunc(*tmp_usrdirPath, contentInfo);
|
||||
path_set = true;
|
||||
|
||||
cellGame.Success("cellGameCreateGameData(): gamedata directory created ('%s')", contentInfo);
|
||||
|
||||
//Emu.GetVFS().CreateFile(contentInfo + "/ICON0.PNG");
|
||||
//Emu.GetVFS().CreateFile(contentInfo + "/PIC1.PNG");
|
||||
|
||||
// TODO: set initial PARAM.SFO parameters
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellGameDeleteGameData()
|
||||
s32 cellGameDeleteGameData()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellGame);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellGameGetParamInt(u32 id, vm::ptr<u32> value)
|
||||
s32 cellGameGetParamInt(u32 id, vm::ptr<u32> value)
|
||||
{
|
||||
cellGame.Warning("cellGameGetParamInt(id=%d, value_addr=0x%x)", id, value.addr());
|
||||
cellGame.Warning("cellGameGetParamInt(id=%d, value=*0x%x)", id, value);
|
||||
|
||||
// TODO: Access through cellGame***Check functions
|
||||
vfsFile f("/app_home/../PARAM.SFO");
|
||||
|
@ -367,9 +455,9 @@ int cellGameGetParamInt(u32 id, vm::ptr<u32> value)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellGameGetParamString(u32 id, vm::ptr<char> buf, u32 bufsize)
|
||||
s32 cellGameGetParamString(u32 id, vm::ptr<char> buf, u32 bufsize)
|
||||
{
|
||||
cellGame.Warning("cellGameGetParamString(id=%d, buf_addr=0x%x, bufsize=%d)", id, buf.addr(), bufsize);
|
||||
cellGame.Warning("cellGameGetParamString(id=%d, buf=*0x%x, bufsize=%d)", id, buf, bufsize);
|
||||
|
||||
// TODO: Access through cellGame***Check functions
|
||||
vfsFile f("/app_home/../PARAM.SFO");
|
||||
|
@ -415,33 +503,33 @@ int cellGameGetParamString(u32 id, vm::ptr<char> buf, u32 bufsize)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellGameSetParamString()
|
||||
s32 cellGameSetParamString()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellGame);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellGameGetSizeKB()
|
||||
s32 cellGameGetSizeKB()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellGame);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellGameGetDiscContentInfoUpdatePath()
|
||||
s32 cellGameGetDiscContentInfoUpdatePath()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellGame);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellGameGetLocalWebContentPath()
|
||||
s32 cellGameGetLocalWebContentPath()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellGame);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, vm::ptr<const char> dirName)
|
||||
s32 cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, vm::ptr<const char> dirName)
|
||||
{
|
||||
cellGame.Warning("cellGameContentErrorDialog(type=%d, errNeedSizeKB=%d, dirName_addr=0x%x)", type, errNeedSizeKB, dirName.addr());
|
||||
cellGame.Warning("cellGameContentErrorDialog(type=%d, errNeedSizeKB=%d, dirName=*0x%x)", type, errNeedSizeKB, dirName);
|
||||
|
||||
std::string errorName;
|
||||
switch (type)
|
||||
|
@ -475,13 +563,13 @@ int cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, vm::ptr<const char>
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellGameThemeInstall()
|
||||
s32 cellGameThemeInstall()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellGame);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellGameThemeInstallFromBuffer()
|
||||
s32 cellGameThemeInstallFromBuffer()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellGame);
|
||||
return CELL_OK;
|
||||
|
@ -517,3 +605,15 @@ Module cellGame("cellGame", []()
|
|||
REG_FUNC(cellGame, cellGameThemeInstallFromBuffer);
|
||||
//cellGame.AddFunc(, CellGameThemeInstallCallback);
|
||||
});
|
||||
|
||||
void cellSysutil_GameData_init()
|
||||
{
|
||||
REG_FUNC(cellGame, cellHddGameCheck);
|
||||
//REG_FUNC(cellGame, cellHddGameCheck2);
|
||||
//REG_FUNC(cellGame, cellHddGameGetSizeKB);
|
||||
//REG_FUNC(cellGame, cellHddGameSetSystemVer);
|
||||
//REG_FUNC(cellGame, cellHddGameExitBroken);
|
||||
|
||||
REG_FUNC(cellGame, cellGameDataCheckCreate);
|
||||
REG_FUNC(cellGame, cellGameDataCheckCreate2);
|
||||
}
|
||||
|
|
|
@ -200,3 +200,92 @@ struct CellGameDataStatSet
|
|||
vm::bptr<CellGameDataSystemFileParam> setParam;
|
||||
be_t<u32> reserved;
|
||||
};
|
||||
|
||||
typedef void(CellGameDataStatCallback)(vm::ptr<CellGameDataCBResult> cbResult, vm::ptr<CellGameDataStatGet> get, vm::ptr<CellGameDataStatSet> set);
|
||||
|
||||
// cellSysutil: cellHddGame
|
||||
enum
|
||||
{
|
||||
// Return Codes
|
||||
CELL_HDDGAME_RET_CANCEL = 1,
|
||||
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,
|
||||
|
||||
// Callback Result
|
||||
CELL_HDDGAME_CBRESULT_OK_CANCEL = 1,
|
||||
CELL_HDDGAME_CBRESULT_OK = 0,
|
||||
CELL_HDDGAME_CBRESULT_ERR_NOSPACE = -1,
|
||||
CELL_HDDGAME_CBRESULT_ERR_BROKEN = -3,
|
||||
CELL_HDDGAME_CBRESULT_ERR_NODATA = -4,
|
||||
CELL_HDDGAME_CBRESULT_ERR_INVALID = -5,
|
||||
|
||||
// Character Strings
|
||||
CELL_HDDGAME_INVALIDMSG_MAX = 256,
|
||||
CELL_HDDGAME_PATH_MAX = 1055,
|
||||
CELL_HDDGAME_SYSP_TITLE_SIZE = 128,
|
||||
CELL_HDDGAME_SYSP_TITLEID_SIZE = 10,
|
||||
CELL_HDDGAME_SYSP_VERSION_SIZE = 6,
|
||||
CELL_HDDGAME_SYSP_SYSTEMVER_SIZE = 8,
|
||||
|
||||
// HDD Directory exists
|
||||
CELL_HDDGAME_ISNEWDATA_EXIST = 0,
|
||||
CELL_HDDGAME_ISNEWDATA_NODIR = 1,
|
||||
|
||||
// Languages
|
||||
CELL_HDDGAME_SYSP_LANGUAGE_NUM = 20,
|
||||
|
||||
// Stat Get
|
||||
CELL_HDDGAME_SIZEKB_NOTCALC = -1,
|
||||
};
|
||||
|
||||
struct CellHddGameSystemFileParam
|
||||
{
|
||||
char title[CELL_HDDGAME_SYSP_TITLE_SIZE];
|
||||
char titleLang[CELL_HDDGAME_SYSP_LANGUAGE_NUM][CELL_HDDGAME_SYSP_TITLE_SIZE];
|
||||
char titleId[CELL_HDDGAME_SYSP_TITLEID_SIZE];
|
||||
char reserved0[2];
|
||||
char dataVersion[CELL_HDDGAME_SYSP_VERSION_SIZE];
|
||||
char reserved1[2];
|
||||
be_t<u32> attribute;
|
||||
be_t<u32> parentalLevel;
|
||||
be_t<u32> resolution;
|
||||
be_t<u32> soundFormat;
|
||||
char reserved2[256];
|
||||
};
|
||||
|
||||
struct CellHddGameCBResult
|
||||
{
|
||||
be_t<u32> result;
|
||||
be_t<s32> errNeedSizeKB;
|
||||
vm::bptr<char> invalidMsg;
|
||||
vm::bptr<void> reserved;
|
||||
};
|
||||
|
||||
struct CellHddGameStatGet
|
||||
{
|
||||
be_t<s32> hddFreeSizeKB;
|
||||
be_t<u32> isNewData;
|
||||
char contentInfoPath[CELL_HDDGAME_PATH_MAX];
|
||||
char hddGamePath[CELL_HDDGAME_PATH_MAX];
|
||||
char reserved0[2];
|
||||
be_t<s64> atime;
|
||||
be_t<s64> mtime;
|
||||
be_t<s64> ctime;
|
||||
CellHddGameSystemFileParam getParam;
|
||||
be_t<s32> sizeKB;
|
||||
be_t<s32> sysSizeKB;
|
||||
char reserved1[68];
|
||||
};
|
||||
|
||||
struct CellHddGameStatSet
|
||||
{
|
||||
vm::bptr<CellHddGameSystemFileParam> setParam;
|
||||
vm::bptr<void> reserved;
|
||||
};
|
||||
|
||||
typedef void(CellHddGameStatCallback)(vm::ptr<CellHddGameCBResult> cbResult, vm::ptr<CellHddGameStatGet> get, vm::ptr<CellHddGameStatSet> set);
|
||||
|
|
|
@ -16,11 +16,8 @@
|
|||
#include "Emu/Audio/AudioManager.h"
|
||||
#include "Emu/FS/VFS.h"
|
||||
#include "cellMsgDialog.h"
|
||||
#include "cellGame.h"
|
||||
#include "cellSysutil.h"
|
||||
|
||||
typedef void (CellHddGameStatCallback)(vm::ptr<CellHddGameCBResult> cbResult, vm::ptr<CellHddGameStatGet> get, vm::ptr<CellHddGameStatSet> set);
|
||||
|
||||
extern Module cellSysutil;
|
||||
|
||||
int cellSysutilGetSystemParamInt(int id, vm::ptr<u32> value)
|
||||
|
@ -688,76 +685,6 @@ int cellSysCacheMount(vm::ptr<CellSysCacheParam> param)
|
|||
return CELL_SYSCACHE_RET_OK_RELAYED;
|
||||
}
|
||||
|
||||
int cellHddGameCheck(u32 version, vm::ptr<const char> dirName, u32 errDialog, vm::ptr<CellHddGameStatCallback> funcStat, u32 container)
|
||||
{
|
||||
cellSysutil.Warning("cellHddGameCheck(version=%d, dirName_addr=0x%x, errDialog=%d, funcStat_addr=0x%x, container=%d)",
|
||||
version, dirName.addr(), errDialog, funcStat.addr(), container);
|
||||
|
||||
std::string dir = dirName.get_ptr();
|
||||
if (dir.size() != 9)
|
||||
return CELL_HDDGAME_ERROR_PARAM;
|
||||
|
||||
vm::var<CellHddGameSystemFileParam> param;
|
||||
vm::var<CellHddGameCBResult> result;
|
||||
vm::var<CellHddGameStatGet> get;
|
||||
vm::var<CellHddGameStatSet> set;
|
||||
|
||||
get->hddFreeSizeKB = 40 * 1024 * 1024; // 40 GB, TODO: Use the free space of the computer's HDD where RPCS3 is being run.
|
||||
get->isNewData = CELL_HDDGAME_ISNEWDATA_EXIST;
|
||||
get->sysSizeKB = 0; // TODO
|
||||
get->st_atime__ = 0; // TODO
|
||||
get->st_ctime__ = 0; // TODO
|
||||
get->st_mtime__ = 0; // TODO
|
||||
get->sizeKB = CELL_HDDGAME_SIZEKB_NOTCALC;
|
||||
memcpy(get->contentInfoPath, ("/dev_hdd0/game/" + dir).c_str(), CELL_HDDGAME_PATH_MAX);
|
||||
memcpy(get->hddGamePath, ("/dev_hdd0/game/" + dir + "/USRDIR").c_str(), CELL_HDDGAME_PATH_MAX);
|
||||
|
||||
if (!Emu.GetVFS().ExistsDir(("/dev_hdd0/game/" + dir).c_str()))
|
||||
{
|
||||
get->isNewData = CELL_HDDGAME_ISNEWDATA_NODIR;
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Is cellHddGameCheck really responsible for writing the information in get->getParam ? (If not, delete this else)
|
||||
|
||||
vfsFile f(("/dev_hdd0/game/" + dir + "/PARAM.SFO").c_str());
|
||||
PSFLoader psf(f);
|
||||
if (!psf.Load(false)) {
|
||||
return CELL_HDDGAME_ERROR_BROKEN;
|
||||
}
|
||||
|
||||
get->getParam.parentalLevel = psf.GetInteger("PARENTAL_LEVEL");
|
||||
get->getParam.attribute = psf.GetInteger("ATTRIBUTE");
|
||||
get->getParam.resolution = psf.GetInteger("RESOLUTION");
|
||||
get->getParam.soundFormat = psf.GetInteger("SOUND_FORMAT");
|
||||
std::string title = psf.GetString("TITLE");
|
||||
strcpy_trunc(get->getParam.title, title);
|
||||
std::string app_ver = psf.GetString("APP_VER");
|
||||
strcpy_trunc(get->getParam.dataVersion, app_ver);
|
||||
strcpy_trunc(get->getParam.titleId, dir);
|
||||
|
||||
for (u32 i=0; i<CELL_HDDGAME_SYSP_LANGUAGE_NUM; i++) {
|
||||
char key [16];
|
||||
sprintf(key, "TITLE_%02d", i);
|
||||
title = psf.GetString(key);
|
||||
strcpy_trunc(get->getParam.titleLang[i], title);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO ?
|
||||
|
||||
funcStat(result, get, set);
|
||||
|
||||
if (result->result != CELL_HDDGAME_CBRESULT_OK &&
|
||||
result->result != CELL_HDDGAME_CBRESULT_OK_CANCEL) {
|
||||
return CELL_HDDGAME_ERROR_CBRESULT;
|
||||
}
|
||||
|
||||
// TODO ?
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
bool bgm_playback_enabled = true;
|
||||
|
||||
int cellSysutilEnableBgmPlayback()
|
||||
|
@ -835,13 +762,8 @@ int cellWebBrowserEstimate2(const vm::ptr<const CellWebBrowserConfig2> config, v
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
extern int cellGameDataCheckCreate2(PPUThread& CPU, u32 version, vm::ptr<const char> dirName, u32 errDialog,
|
||||
vm::ptr<void(vm::ptr<CellGameDataCBResult> cbResult, vm::ptr<CellGameDataStatGet> get, vm::ptr<CellGameDataStatSet> set)> funcStat, u32 container);
|
||||
|
||||
extern int cellGameDataCheckCreate(PPUThread& CPU, u32 version, vm::ptr<const char> dirName, u32 errDialog,
|
||||
vm::ptr<void(vm::ptr<CellGameDataCBResult> cbResult, vm::ptr<CellGameDataStatGet> get, vm::ptr<CellGameDataStatSet> set)> funcStat, u32 container);
|
||||
|
||||
extern void cellSysutil_SaveData_init();
|
||||
extern void cellSysutil_GameData_init();
|
||||
|
||||
Module cellSysutil("cellSysutil", []()
|
||||
{
|
||||
|
@ -851,6 +773,9 @@ Module cellSysutil("cellSysutil", []()
|
|||
v.arg.set(0);
|
||||
}
|
||||
|
||||
cellSysutil_SaveData_init(); // cellSaveData functions
|
||||
cellSysutil_GameData_init(); // cellGameData, cellHddGame functions
|
||||
|
||||
REG_FUNC(cellSysutil, cellSysutilGetSystemParamInt);
|
||||
REG_FUNC(cellSysutil, cellSysutilGetSystemParamString);
|
||||
|
||||
|
@ -893,22 +818,8 @@ Module cellSysutil("cellSysutil", []()
|
|||
REG_FUNC(cellSysutil, cellSysCacheMount);
|
||||
REG_FUNC(cellSysutil, cellSysCacheClear);
|
||||
|
||||
REG_FUNC(cellSysutil, cellHddGameCheck);
|
||||
//REG_FUNC(cellSysutil, cellHddGameCheck2);
|
||||
//REG_FUNC(cellSysutil, cellHddGameGetSizeKB);
|
||||
//REG_FUNC(cellSysutil, cellHddGameSetSystemVer);
|
||||
//REG_FUNC(cellSysutil, cellHddGameExitBroken);
|
||||
|
||||
//REG_FUNC(cellSysutil, cellSysutilRegisterCallbackDispatcher);
|
||||
//REG_FUNC(cellSysutil, cellSysutilPacketWrite);
|
||||
//REG_FUNC(cellSysutil, doc.write);
|
||||
//REG_FUNC(cellSysutil, packet_read);
|
||||
|
||||
// cellSaveData functions
|
||||
cellSysutil_SaveData_init();
|
||||
|
||||
REG_FUNC(cellSysutil, cellWebBrowserEstimate2);
|
||||
|
||||
REG_FUNC(cellSysutil, cellGameDataCheckCreate);
|
||||
REG_FUNC(cellSysutil, cellGameDataCheckCreate2);
|
||||
});
|
||||
|
|
|
@ -152,91 +152,6 @@ enum
|
|||
CELL_SYSCACHE_ERROR_NOTMOUNTED = 0x8002bc04, // We don't really need to simulate the mounting, so this is probably useless
|
||||
};
|
||||
|
||||
// cellSysutil: cellHddGame
|
||||
enum
|
||||
{
|
||||
// Return Codes
|
||||
CELL_HDDGAME_RET_CANCEL = 1,
|
||||
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,
|
||||
|
||||
// Callback Result
|
||||
CELL_HDDGAME_CBRESULT_OK_CANCEL = 1,
|
||||
CELL_HDDGAME_CBRESULT_OK = 0,
|
||||
CELL_HDDGAME_CBRESULT_ERR_NOSPACE = -1,
|
||||
CELL_HDDGAME_CBRESULT_ERR_BROKEN = -3,
|
||||
CELL_HDDGAME_CBRESULT_ERR_NODATA = -4,
|
||||
CELL_HDDGAME_CBRESULT_ERR_INVALID = -5,
|
||||
|
||||
// Character Strings
|
||||
CELL_HDDGAME_INVALIDMSG_MAX = 256,
|
||||
CELL_HDDGAME_PATH_MAX = 1055,
|
||||
CELL_HDDGAME_SYSP_TITLE_SIZE = 128,
|
||||
CELL_HDDGAME_SYSP_TITLEID_SIZE = 10,
|
||||
CELL_HDDGAME_SYSP_VERSION_SIZE = 6,
|
||||
CELL_HDDGAME_SYSP_SYSTEMVER_SIZE = 8,
|
||||
|
||||
// HDD Directory exists
|
||||
CELL_HDDGAME_ISNEWDATA_EXIST = 0,
|
||||
CELL_HDDGAME_ISNEWDATA_NODIR = 1,
|
||||
|
||||
// Languages
|
||||
CELL_HDDGAME_SYSP_LANGUAGE_NUM = 20,
|
||||
|
||||
// Stat Get
|
||||
CELL_HDDGAME_SIZEKB_NOTCALC = -1,
|
||||
};
|
||||
|
||||
struct CellHddGameSystemFileParam
|
||||
{
|
||||
char title[CELL_HDDGAME_SYSP_TITLE_SIZE];
|
||||
char titleLang[CELL_HDDGAME_SYSP_LANGUAGE_NUM][CELL_HDDGAME_SYSP_TITLE_SIZE];
|
||||
char titleId[CELL_HDDGAME_SYSP_TITLEID_SIZE];
|
||||
u8 reserved0[2];
|
||||
char dataVersion[CELL_HDDGAME_SYSP_VERSION_SIZE];
|
||||
u8 reserved1[2];
|
||||
be_t<u32> attribute;
|
||||
be_t<u32> parentalLevel;
|
||||
be_t<u32> resolution;
|
||||
be_t<u32> soundFormat;
|
||||
u8 reserved2[256];
|
||||
};
|
||||
|
||||
struct CellHddGameStatGet
|
||||
{
|
||||
be_t<s32> hddFreeSizeKB;
|
||||
be_t<u32> isNewData;
|
||||
u8 contentInfoPath[CELL_HDDGAME_PATH_MAX];
|
||||
u8 hddGamePath[CELL_HDDGAME_PATH_MAX];
|
||||
u8 reserved0[2];
|
||||
be_t<u64> st_atime__;
|
||||
be_t<u64> st_mtime__;
|
||||
be_t<u64> st_ctime__;
|
||||
CellHddGameSystemFileParam getParam;
|
||||
be_t<s32> sizeKB;
|
||||
be_t<s32> sysSizeKB;
|
||||
u8 reserved1[68];
|
||||
};
|
||||
|
||||
struct CellHddGameStatSet
|
||||
{
|
||||
vm::bptr<CellHddGameSystemFileParam> setParam;
|
||||
be_t<u32> reserved_addr; // void*
|
||||
};
|
||||
|
||||
struct CellHddGameCBResult
|
||||
{
|
||||
be_t<u32> result;
|
||||
be_t<s32> errNeedSizeKB;
|
||||
be_t<u32> invalidMsg_addr; // char*
|
||||
be_t<u32> reserved_addr; // void*
|
||||
};
|
||||
|
||||
typedef s32 CellWebBrowserId;
|
||||
typedef vm::ptr<void> CellWebBrowserClientSession;
|
||||
typedef void(CellWebBrowserCallback)(s32 cb_type, CellWebBrowserClientSession, vm::ptr<void> usrdata);
|
||||
|
@ -303,4 +218,3 @@ struct CellWebBrowserConfig2
|
|||
be_t<float> resolution_factor;
|
||||
be_t<s32> magic_number_;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue