diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp index d984f910c7..01bb641aaf 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp @@ -5,7 +5,11 @@ #include "cellSysutil.h" +#include "Loader/PSF.h" + typedef void (*CellMsgDialogCallback)(int buttonType, mem_ptr_t userData); +typedef void (*CellHddGameStatCallback)(mem_ptr_t cbResult, mem_ptr_t get, mem_ptr_t set); + void cellSysutil_init(); Module cellSysutil(0x0015, cellSysutil_init); @@ -840,6 +844,72 @@ int cellSysCacheMount(mem_ptr_t param) return CELL_SYSCACHE_RET_OK_RELAYED; } +int cellHddGameCheck(u32 version, u32 dirName_addr, u32 errDialog, mem_func_ptr_t 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 param; + MemoryAllocator result; + MemoryAllocator get; + MemoryAllocator 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; igetParam.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() { cellSysutil.AddFunc(0x40e895d3, cellSysutilGetSystemParamInt); @@ -872,4 +942,6 @@ void cellSysutil_init() cellSysutil.AddFunc(0x1e7bff94, cellSysCacheMount); cellSysutil.AddFunc(0x744c1544, cellSysCacheClear); + cellSysutil.AddFunc(0x9117df20, cellHddGameCheck); + } diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutil.h b/rpcs3/Emu/SysCalls/Modules/cellSysutil.h index 0db281baef..3084fc537a 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysutil.h +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutil.h @@ -140,3 +140,88 @@ enum CellMsgDialogType CELL_MSGDIALOG_DEFAULT_CURSOR_YES = 0x00000000, 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 attribute; + be_t parentalLevel; + be_t resolution; + be_t soundFormat; + u8 reserved2[256]; +}; + +struct CellHddGameStatGet +{ + be_t hddFreeSizeKB; + be_t isNewData; + u8 contentInfoPath[CELL_HDDGAME_PATH_MAX]; + u8 hddGamePath[CELL_HDDGAME_PATH_MAX]; + u8 reserved0[2]; + be_t st_atime; + be_t st_mtime; + be_t st_ctime; + CellHddGameSystemFileParam getParam; + be_t sizeKB; + be_t sysSizeKB; + u8 reserved1[68]; +}; + +struct CellHddGameStatSet +{ + CellHddGameSystemFileParam *setParam; + u32 reserved_addr; // void* +}; + +struct CellHddGameCBResult +{ + be_t result; + be_t errNeedSizeKB; + u8 *invalidMsg; + u32 reserved_addr; // void* +}; diff --git a/rpcs3/Emu/SysCalls/Modules/cellUserInfo.h b/rpcs3/Emu/SysCalls/Modules/cellUserInfo.h index 3498b0293c..c48a2f9a2b 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellUserInfo.h +++ b/rpcs3/Emu/SysCalls/Modules/cellUserInfo.h @@ -28,28 +28,28 @@ enum CellUserInfoListType // Structs struct CellUserInfoUserStat { - u32 id; + be_t id; u8 name[CELL_USERINFO_USERNAME_SIZE]; }; struct CellUserInfoUserList { - u32 userId[CELL_USERINFO_USER_MAX]; + be_t userId[CELL_USERINFO_USER_MAX]; }; struct CellUserInfoListSet { - u32 title_addr; // (char*) - u32 focus; - u32 fixedListNum; + be_t title_addr; // (char*) + be_t focus; + be_t fixedListNum; mem_ptr_t fixedList; - u32 reserved_addr; // (void*) + be_t reserved_addr; // (void*) }; struct CellUserInfoTypeSet { - u32 title_addr; // (char*) - u32 focus; + be_t title_addr; // (char*) + be_t focus; CellUserInfoListType type; - u32 reserved_addr; // (void*) + be_t reserved_addr; // (void*) }; diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.h b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.h index f57f18679b..eae2c74ed7 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.h +++ b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.h @@ -68,11 +68,11 @@ enum SceNpTrophyGrade struct SceNpTrophyGameDetails { - u32 numTrophies; - u32 numPlatinum; - u32 numGold; - u32 numSilver; - u32 numBronze; + be_t numTrophies; + be_t numPlatinum; + be_t numGold; + be_t numSilver; + be_t numBronze; u8 title[SCE_NP_TROPHY_TITLE_MAX_SIZE]; u8 description[SCE_NP_TROPHY_GAME_DESCR_MAX_SIZE]; u8 reserved[4]; @@ -80,17 +80,17 @@ struct SceNpTrophyGameDetails struct SceNpTrophyGameData { - u32 unlockedTrophies; - u32 unlockedPlatinum; - u32 unlockedGold; - u32 unlockedSilver; - u32 unlockedBronze; + be_t unlockedTrophies; + be_t unlockedPlatinum; + be_t unlockedGold; + be_t unlockedSilver; + be_t unlockedBronze; }; struct SceNpTrophyDetails { - s32 trophyId; // SceNpTrophyId - u32 trophyGrade; // SceNpTrophyGrade + be_t trophyId; // SceNpTrophyId + be_t trophyGrade; // SceNpTrophyGrade u8 name[SCE_NP_TROPHY_NAME_MAX_SIZE]; u8 description[SCE_NP_TROPHY_DESCR_MAX_SIZE]; bool hidden; @@ -99,7 +99,7 @@ struct SceNpTrophyDetails struct SceNpTrophyData { CellRtcTick timestamp; - s32 trophyId; // SceNpTrophyId + be_t trophyId; // SceNpTrophyId bool unlocked; u8 reserved[3]; }; diff --git a/rpcs3/Emu/SysCalls/Modules/sys_net.h b/rpcs3/Emu/SysCalls/Modules/sys_net.h index 770a6958c2..6c7abd3f37 100644 --- a/rpcs3/Emu/SysCalls/Modules/sys_net.h +++ b/rpcs3/Emu/SysCalls/Modules/sys_net.h @@ -2,9 +2,9 @@ struct sys_net_initialize_parameter { - u32 memory_addr; - int memory_size; - int flags; + be_t memory_addr; + be_t memory_size; + be_t flags; }; // The names of the following structs are modified to avoid overloading problems diff --git a/rpcs3/Gui/AboutDialog.h b/rpcs3/Gui/AboutDialog.h index 794abf6d9d..975a99278d 100644 --- a/rpcs3/Gui/AboutDialog.h +++ b/rpcs3/Gui/AboutDialog.h @@ -61,7 +61,6 @@ AboutDialog::AboutDialog(wxWindow *parent) wxButton* b_forum = new wxButton(this, b_id_forum, "Forum"); Connect(b_id_website, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AboutDialog::OpenWebsite)); Connect(b_id_forum, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AboutDialog::OpenForum)); - b_website->Disable(); s_panel_buttons->AddSpacer(12); 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)) { - wxLaunchDefaultBrowser("http://www.emunewz.net/forum/forumdisplay.php?fid=162"); + wxLaunchDefaultBrowser("http://rpcs3.net/"); } void AboutDialog::OpenForum(wxCommandEvent& WXUNUSED(event)) { - wxLaunchDefaultBrowser("http://www.emunewz.net/forum/forumdisplay.php?fid=162"); + wxLaunchDefaultBrowser("http://forum.rpcs3.net/"); } diff --git a/rpcs3/Loader/TRP.cpp b/rpcs3/Loader/TRP.cpp index 23b55c5192..3de3738208 100644 --- a/rpcs3/Loader/TRP.cpp +++ b/rpcs3/Loader/TRP.cpp @@ -18,6 +18,7 @@ bool TRPLoader::Install(std::string dest, bool show) if (!dest.empty() && dest.back() != '/') dest += '/'; + Emu.GetVFS().CreateDir(dest); for (const TRPEntry& entry : m_entries) { char* buffer = new char [entry.size];