MCPcopy Create free account
hub / github.com/RPCSX/rpcsx / cellGameDataCheckCreate2

Function cellGameDataCheckCreate2

ps3fw/cellGame.cpp:1143–1368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1141}
1142
1143error_code cellGameDataCheckCreate2(ppu_thread& ppu, u32 version,
1144 vm::cptr<char> dirName, u32 errDialog,
1145 vm::ptr<CellGameDataStatCallback> funcStat,
1146 u32 container)
1147{
1148 cellGame.success("cellGameDataCheckCreate2(version=0x%x, dirName=%s, "
1149 "errDialog=0x%x, funcStat=*0x%x, container=%d)",
1150 version, dirName, errDialog, funcStat, container);
1151
1152 // older sdk. it might not care about game type.
1153
1154 if (version != CELL_GAMEDATA_VERSION_CURRENT || !funcStat || !dirName ||
1155 sysutil_check_name_string(dirName.get_ptr(), 1, CELL_GAME_DIRNAME_SIZE) !=
1156 0)
1157 {
1158 return CELL_GAMEDATA_ERROR_PARAM;
1159 }
1160
1161 const std::string game_dir = dirName.get_ptr();
1162 const std::string dir = "/dev_hdd0/game/"s + game_dir;
1163
1164 auto [sfo, psf_error] = psf::load(vfs::get(dir + "/PARAM.SFO"));
1165
1166 const u32 new_data = psf_error == psf::error::stream ? CELL_GAMEDATA_ISNEWDATA_YES : CELL_GAMEDATA_ISNEWDATA_NO;
1167
1168 if (!new_data)
1169 {
1170 const auto cat = psf::get_string(sfo, "CATEGORY", "");
1171 if (cat != "GD" && cat != "DG")
1172 {
1173 return CELL_GAMEDATA_ERROR_BROKEN;
1174 }
1175 }
1176
1177 const std::string usrdir = dir + "/USRDIR";
1178
1179 auto& cbResult = g_cb_result;
1180 auto& cbGet = g_stat_get;
1181 auto& cbSet = g_stat_set;
1182
1183 std::memset(cbGet.get_ptr(), 0, sizeof(*cbGet));
1184 std::memset(cbSet.get_ptr(), 0, sizeof(*cbSet));
1185 std::memset(cbResult.get_ptr(), 0, sizeof(*cbResult));
1186
1187 cbGet->isNewData = new_data;
1188
1189 // TODO: Use the free space of the computer's HDD where RPCS3 is being run.
1190 cbGet->hddFreeSizeKB =
1191 40 * 1024 * 1024 - 256; // Read explanation in cellHddGameCheck
1192
1193 strcpy_trunc(cbGet->contentInfoPath, dir);
1194 strcpy_trunc(cbGet->gameDataPath, usrdir);
1195
1196 // TODO: set correct time
1197 cbGet->st_atime_ = 0;
1198 cbGet->st_ctime_ = 0;
1199 cbGet->st_mtime_ = 0;
1200

Callers 1

cellGameDataCheckCreateFunction · 0.85

Calls 15

getFunction · 0.85
get_stringFunction · 0.85
strcpy_truncFunction · 0.85
get_integerFunction · 0.85
lv2_sleepFunction · 0.85
create_pathFunction · 0.85
assignFunction · 0.85
check_registryFunction · 0.85
save_objectFunction · 0.85
get_localized_stringFunction · 0.85
open_msg_dialogFunction · 0.85

Tested by

no test coverage detected