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

Function cellGameContentPermit

ps3fw/cellGame.cpp:1024–1141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1022}
1023
1024error_code
1025cellGameContentPermit(ppu_thread& ppu,
1026 vm::ptr<char[CELL_GAME_PATH_MAX]> contentInfoPath,
1027 vm::ptr<char[CELL_GAME_PATH_MAX]> usrdirPath)
1028{
1029 cellGame.warning(
1030 "cellGameContentPermit(contentInfoPath=*0x%x, usrdirPath=*0x%x)",
1031 contentInfoPath, usrdirPath);
1032
1033 if (!contentInfoPath || !usrdirPath)
1034 {
1035 return CELL_GAME_ERROR_PARAM;
1036 }
1037
1038 auto& perm = g_fxo->get<content_permission>();
1039
1040 const auto init = acquire_reset_lock(perm.init);
1041
1042 if (!init)
1043 {
1044 return CELL_GAME_ERROR_FAILURE;
1045 }
1046
1047 const std::string dir =
1048 perm.dir.empty() ? "/dev_bdvd/PS3_GAME"s : "/dev_hdd0/game/" + perm.dir;
1049
1050 if (perm.temp.empty() && !perm.exists)
1051 {
1052 perm.reset();
1053 strcpy_trunc(*contentInfoPath, "");
1054 strcpy_trunc(*usrdirPath, "");
1055 return CELL_OK;
1056 }
1057
1058 lv2_obj::sleep(ppu);
1059
1060 const u64 start_sleep = ppu.start_time;
1061
1062 if (!perm.temp.empty())
1063 {
1064 std::vector<shared_ptr<lv2_file>> lv2_files;
1065
1066 const std::string real_dir = vfs::get(dir) + "/";
1067
1068 std::lock_guard lock(g_mp_sys_dev_hdd0.mutex);
1069
1070 // Create PARAM.SFO
1071 fs::pending_file temp(perm.temp + "/PARAM.SFO");
1072 temp.file.write(psf::save_object(perm.sfo));
1073 ensure(temp.commit());
1074
1075 idm::select<lv2_fs_object, lv2_file>([&](u32 id, lv2_file& file)
1076 {
1077 if (file.mp != &g_mp_sys_dev_hdd0)
1078 {
1079 return;
1080 }
1081

Callers

nothing calls this directly

Calls 15

acquire_reset_lockFunction · 0.85
strcpy_truncFunction · 0.85
getFunction · 0.85
save_objectFunction · 0.85
renameFunction · 0.85
lv2_sleepFunction · 0.85
get_guest_system_timeFunction · 0.85
commitMethod · 0.80
emplace_backMethod · 0.80
successMethod · 0.80
errorMethod · 0.80
ensureFunction · 0.50

Tested by

no test coverage detected