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

Function cellGameCreateGameData

ps3fw/cellGame.cpp:1385–1467  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1383}
1384
1385error_code
1386cellGameCreateGameData(vm::ptr<CellGameSetInitParams> init,
1387 vm::ptr<char[CELL_GAME_PATH_MAX]> tmp_contentInfoPath,
1388 vm::ptr<char[CELL_GAME_PATH_MAX]> tmp_usrdirPath)
1389{
1390 cellGame.success("cellGameCreateGameData(init=*0x%x, "
1391 "tmp_contentInfoPath=*0x%x, tmp_usrdirPath=*0x%x)",
1392 init, tmp_contentInfoPath, tmp_usrdirPath);
1393
1394 if (!init)
1395 {
1396 return CELL_GAME_ERROR_PARAM;
1397 }
1398
1399 auto& perm = g_fxo->get<content_permission>();
1400
1401 const auto _init = acquire_access_lock(perm.init);
1402
1403 lv2_sleep(2000);
1404
1405 if (!_init || perm.dir.empty())
1406 {
1407 return CELL_GAME_ERROR_FAILURE;
1408 }
1409
1410 if (!perm.can_create)
1411 {
1412 return CELL_GAME_ERROR_NOTSUPPORTED;
1413 }
1414
1415 if (perm.exists)
1416 {
1417 return CELL_GAME_ERROR_EXIST;
1418 }
1419
1420 // Account for for filesystem operations
1421 lv2_sleep(50'000);
1422
1423 std::string dirname =
1424 "_GDATA_" +
1425 std::to_string(steady_clock::now().time_since_epoch().count());
1426 std::string tmp_contentInfo = "/dev_hdd0/game/" + dirname;
1427 std::string tmp_usrdir = "/dev_hdd0/game/" + dirname + "/USRDIR";
1428
1429 if (!fs::create_dir(vfs::get(tmp_contentInfo)))
1430 {
1431 cellGame.error(
1432 "cellGameCreateGameData(): failed to create directory '%s' (%s)",
1433 tmp_contentInfo, fs::g_tls_error);
1434 return CELL_GAME_ERROR_ACCESS_ERROR; // ???
1435 }
1436
1437 // cellGameContentPermit should then move files in non-temporary location and
1438 // return their non-temporary displacement
1439 if (tmp_contentInfoPath)
1440 strcpy_trunc(*tmp_contentInfoPath, tmp_contentInfo);
1441
1442 if (!fs::create_dir(vfs::get(tmp_usrdir)))

Callers

nothing calls this directly

Calls 10

acquire_access_lockFunction · 0.85
lv2_sleepFunction · 0.85
to_stringFunction · 0.85
getFunction · 0.85
strcpy_truncFunction · 0.85
successMethod · 0.80
errorMethod · 0.80
stringFunction · 0.50
emptyMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected