This commit is contained in:
Peter Tissen 2014-03-20 00:51:58 +01:00
commit 6e4203998a
7 changed files with 185 additions and 28 deletions

View file

@ -5,7 +5,11 @@
#include "cellSysutil.h" #include "cellSysutil.h"
#include "Loader/PSF.h"
typedef void (*CellMsgDialogCallback)(int buttonType, mem_ptr_t<void> userData); typedef void (*CellMsgDialogCallback)(int buttonType, mem_ptr_t<void> userData);
typedef void (*CellHddGameStatCallback)(mem_ptr_t<CellHddGameCBResult> cbResult, mem_ptr_t<CellHddGameStatGet> get, mem_ptr_t<CellHddGameStatSet> set);
void cellSysutil_init(); void cellSysutil_init();
Module cellSysutil(0x0015, cellSysutil_init); Module cellSysutil(0x0015, cellSysutil_init);
@ -840,6 +844,72 @@ int cellSysCacheMount(mem_ptr_t<CellSysCacheParam> param)
return CELL_SYSCACHE_RET_OK_RELAYED; return CELL_SYSCACHE_RET_OK_RELAYED;
} }
int cellHddGameCheck(u32 version, u32 dirName_addr, u32 errDialog, mem_func_ptr_t<CellHddGameStatCallback> funcStat, u32 container)
{
cellSysutil.Warning("cellHddGameCheck(version=%d, dirName_addr=0x%xx, errDialog=%d, funcStat_addr=0x%x, container=%d)",
version, dirName_addr, errDialog, funcStat, container);
if (!Memory.IsGoodAddr(dirName_addr) || !funcStat.IsGood())
return CELL_HDDGAME_ERROR_PARAM;
std::string dirName = Memory.ReadString(dirName_addr).ToStdString();
if (dirName.size() != 9)
return CELL_HDDGAME_ERROR_PARAM;
MemoryAllocator<CellHddGameSystemFileParam> param;
MemoryAllocator<CellHddGameCBResult> result;
MemoryAllocator<CellHddGameStatGet> get;
MemoryAllocator<CellHddGameStatSet> set;
get->hddFreeSizeKB = 40000000; // 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/"+dirName).c_str(), CELL_HDDGAME_PATH_MAX);
memcpy(get->hddGamePath, ("/dev_hdd0/game/"+dirName+"/USRDIR").c_str(), CELL_HDDGAME_PATH_MAX);
if (!Emu.GetVFS().ExistsDir(("/dev_hdd0/game/"+dirName).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/"+dirName+"/PARAM.SFO").c_str());
PSFLoader psf(f);
if (!psf.Load(false)) {
return CELL_HDDGAME_ERROR_BROKEN;
}
get->getParam.parentalLevel = psf.m_info.parental_lvl;
get->getParam.attribute = psf.m_info.attr;
get->getParam.resolution = psf.m_info.resolution;
get->getParam.soundFormat = psf.m_info.sound_format;
memcpy(get->getParam.title, psf.m_info.name.mb_str(), CELL_HDDGAME_SYSP_TITLE_SIZE);
memcpy(get->getParam.dataVersion, psf.m_info.app_ver.mb_str(), CELL_HDDGAME_SYSP_VERSION_SIZE);
memcpy(get->getParam.titleId, dirName.c_str(), CELL_HDDGAME_SYSP_TITLEID_SIZE);
for (u32 i=0; i<CELL_HDDGAME_SYSP_LANGUAGE_NUM; i++) {
memcpy(get->getParam.titleLang[i], psf.m_info.name.mb_str(), CELL_HDDGAME_SYSP_TITLE_SIZE); // TODO: Get real titleLang name
}
}
// TODO ?
funcStat(result.GetAddr(), get.GetAddr(), set.GetAddr());
if (result->result != CELL_HDDGAME_CBRESULT_OK &&
result->result != CELL_HDDGAME_CBRESULT_OK_CANCEL)
return CELL_HDDGAME_ERROR_CBRESULT;
// TODO ?
return CELL_OK;
}
void cellSysutil_init() void cellSysutil_init()
{ {
cellSysutil.AddFunc(0x40e895d3, cellSysutilGetSystemParamInt); cellSysutil.AddFunc(0x40e895d3, cellSysutilGetSystemParamInt);
@ -872,4 +942,6 @@ void cellSysutil_init()
cellSysutil.AddFunc(0x1e7bff94, cellSysCacheMount); cellSysutil.AddFunc(0x1e7bff94, cellSysCacheMount);
cellSysutil.AddFunc(0x744c1544, cellSysCacheClear); cellSysutil.AddFunc(0x744c1544, cellSysCacheClear);
cellSysutil.AddFunc(0x9117df20, cellHddGameCheck);
} }

View file

@ -140,3 +140,88 @@ enum CellMsgDialogType
CELL_MSGDIALOG_DEFAULT_CURSOR_YES = 0x00000000, CELL_MSGDIALOG_DEFAULT_CURSOR_YES = 0x00000000,
CELL_MSGDIALOG_DEFAULT_CURSOR_NO = 0x00000100, CELL_MSGDIALOG_DEFAULT_CURSOR_NO = 0x00000100,
}; };
// cellSysutil: cellHddGame
enum
{
// Return Codes
CELL_HDDGAME_RET_CANCEL = 0,
CELL_HDDGAME_ERROR_CBRESULT = 0,
CELL_HDDGAME_ERROR_ACCESS_ERROR = 0,
CELL_HDDGAME_ERROR_INTERNAL = 0,
CELL_HDDGAME_ERROR_PARAM = 0,
CELL_HDDGAME_ERROR_BROKEN = 0,
CELL_HDDGAME_ERROR_FAILURE = 0,
// 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
{
u8 title[CELL_HDDGAME_SYSP_TITLE_SIZE];
u8 titleLang[CELL_HDDGAME_SYSP_LANGUAGE_NUM][CELL_HDDGAME_SYSP_TITLE_SIZE];
u8 titleId[CELL_HDDGAME_SYSP_TITLEID_SIZE];
u8 reserved0[2];
u8 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
{
CellHddGameSystemFileParam *setParam;
u32 reserved_addr; // void*
};
struct CellHddGameCBResult
{
be_t<u32> result;
be_t<s32> errNeedSizeKB;
u8 *invalidMsg;
u32 reserved_addr; // void*
};

View file

@ -28,28 +28,28 @@ enum CellUserInfoListType
// Structs // Structs
struct CellUserInfoUserStat struct CellUserInfoUserStat
{ {
u32 id; be_t<u32> id;
u8 name[CELL_USERINFO_USERNAME_SIZE]; u8 name[CELL_USERINFO_USERNAME_SIZE];
}; };
struct CellUserInfoUserList struct CellUserInfoUserList
{ {
u32 userId[CELL_USERINFO_USER_MAX]; be_t<u32> userId[CELL_USERINFO_USER_MAX];
}; };
struct CellUserInfoListSet struct CellUserInfoListSet
{ {
u32 title_addr; // (char*) be_t<u32> title_addr; // (char*)
u32 focus; be_t<u32> focus;
u32 fixedListNum; be_t<u32> fixedListNum;
mem_ptr_t<CellUserInfoUserList> fixedList; mem_ptr_t<CellUserInfoUserList> fixedList;
u32 reserved_addr; // (void*) be_t<u32> reserved_addr; // (void*)
}; };
struct CellUserInfoTypeSet struct CellUserInfoTypeSet
{ {
u32 title_addr; // (char*) be_t<u32> title_addr; // (char*)
u32 focus; be_t<u32> focus;
CellUserInfoListType type; CellUserInfoListType type;
u32 reserved_addr; // (void*) be_t<u32> reserved_addr; // (void*)
}; };

View file

@ -68,11 +68,11 @@ enum SceNpTrophyGrade
struct SceNpTrophyGameDetails struct SceNpTrophyGameDetails
{ {
u32 numTrophies; be_t<u32> numTrophies;
u32 numPlatinum; be_t<u32> numPlatinum;
u32 numGold; be_t<u32> numGold;
u32 numSilver; be_t<u32> numSilver;
u32 numBronze; be_t<u32> numBronze;
u8 title[SCE_NP_TROPHY_TITLE_MAX_SIZE]; u8 title[SCE_NP_TROPHY_TITLE_MAX_SIZE];
u8 description[SCE_NP_TROPHY_GAME_DESCR_MAX_SIZE]; u8 description[SCE_NP_TROPHY_GAME_DESCR_MAX_SIZE];
u8 reserved[4]; u8 reserved[4];
@ -80,17 +80,17 @@ struct SceNpTrophyGameDetails
struct SceNpTrophyGameData struct SceNpTrophyGameData
{ {
u32 unlockedTrophies; be_t<u32> unlockedTrophies;
u32 unlockedPlatinum; be_t<u32> unlockedPlatinum;
u32 unlockedGold; be_t<u32> unlockedGold;
u32 unlockedSilver; be_t<u32> unlockedSilver;
u32 unlockedBronze; be_t<u32> unlockedBronze;
}; };
struct SceNpTrophyDetails struct SceNpTrophyDetails
{ {
s32 trophyId; // SceNpTrophyId be_t<s32> trophyId; // SceNpTrophyId
u32 trophyGrade; // SceNpTrophyGrade be_t<u32> trophyGrade; // SceNpTrophyGrade
u8 name[SCE_NP_TROPHY_NAME_MAX_SIZE]; u8 name[SCE_NP_TROPHY_NAME_MAX_SIZE];
u8 description[SCE_NP_TROPHY_DESCR_MAX_SIZE]; u8 description[SCE_NP_TROPHY_DESCR_MAX_SIZE];
bool hidden; bool hidden;
@ -99,7 +99,7 @@ struct SceNpTrophyDetails
struct SceNpTrophyData { struct SceNpTrophyData {
CellRtcTick timestamp; CellRtcTick timestamp;
s32 trophyId; // SceNpTrophyId be_t<s32> trophyId; // SceNpTrophyId
bool unlocked; bool unlocked;
u8 reserved[3]; u8 reserved[3];
}; };

View file

@ -2,9 +2,9 @@
struct sys_net_initialize_parameter struct sys_net_initialize_parameter
{ {
u32 memory_addr; be_t<u32> memory_addr;
int memory_size; be_t<s32> memory_size;
int flags; be_t<s32> flags;
}; };
// The names of the following structs are modified to avoid overloading problems // The names of the following structs are modified to avoid overloading problems

View file

@ -61,7 +61,6 @@ AboutDialog::AboutDialog(wxWindow *parent)
wxButton* b_forum = new wxButton(this, b_id_forum, "Forum"); wxButton* b_forum = new wxButton(this, b_id_forum, "Forum");
Connect(b_id_website, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AboutDialog::OpenWebsite)); Connect(b_id_website, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AboutDialog::OpenWebsite));
Connect(b_id_forum, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AboutDialog::OpenForum)); Connect(b_id_forum, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AboutDialog::OpenForum));
b_website->Disable();
s_panel_buttons->AddSpacer(12); s_panel_buttons->AddSpacer(12);
s_panel_buttons->Add(new wxButton(this, wxID_OK), wxLEFT, 0, 5); s_panel_buttons->Add(new wxButton(this, wxID_OK), wxLEFT, 0, 5);
@ -82,10 +81,10 @@ AboutDialog::AboutDialog(wxWindow *parent)
void AboutDialog::OpenWebsite(wxCommandEvent& WXUNUSED(event)) void AboutDialog::OpenWebsite(wxCommandEvent& WXUNUSED(event))
{ {
wxLaunchDefaultBrowser("http://www.emunewz.net/forum/forumdisplay.php?fid=162"); wxLaunchDefaultBrowser("http://rpcs3.net/");
} }
void AboutDialog::OpenForum(wxCommandEvent& WXUNUSED(event)) void AboutDialog::OpenForum(wxCommandEvent& WXUNUSED(event))
{ {
wxLaunchDefaultBrowser("http://www.emunewz.net/forum/forumdisplay.php?fid=162"); wxLaunchDefaultBrowser("http://forum.rpcs3.net/");
} }

View file

@ -18,6 +18,7 @@ bool TRPLoader::Install(std::string dest, bool show)
if (!dest.empty() && dest.back() != '/') if (!dest.empty() && dest.back() != '/')
dest += '/'; dest += '/';
Emu.GetVFS().CreateDir(dest);
for (const TRPEntry& entry : m_entries) for (const TRPEntry& entry : m_entries)
{ {
char* buffer = new char [entry.size]; char* buffer = new char [entry.size];