| 1022 | } |
| 1023 | |
| 1024 | error_code |
| 1025 | cellGameContentPermit(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 |
nothing calls this directly
no test coverage detected