MCPcopy Create free account
hub / github.com/RPCSX/rpcsx / error_code savedata_get_list_item

Function error_code savedata_get_list_item

ps3fw/cellSaveData.cpp:2425–2536  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2423}
2424
2425static NEVER_INLINE error_code
2426savedata_get_list_item(vm::cptr<char> dirName, vm::ptr<CellSaveDataDirStat> dir,
2427 vm::ptr<CellSaveDataSystemFileParam> sysFileParam,
2428 vm::ptr<u32> bind, vm::ptr<u32> sizeKB, u32 userId)
2429{
2430 if (userId == CELL_SYSUTIL_USERID_CURRENT)
2431 {
2432 userId = Emu.GetUsrId();
2433 }
2434 else if (userId > CELL_USERINFO_USER_MAX)
2435 {
2436 // ****** sysutil savedata parameter error : 137 ******
2437 return {CELL_SAVEDATA_ERROR_PARAM, "137 (userId=0x%x)", userId};
2438 }
2439
2440 if (!dirName)
2441 {
2442 // ****** sysutil savedata parameter error : 107 ******
2443 return {CELL_SAVEDATA_ERROR_PARAM, "107"};
2444 }
2445
2446 switch (sysutil_check_name_string(dirName.get_ptr(), 1,
2447 CELL_SAVEDATA_DIRLIST_MAX))
2448 {
2449 case -1:
2450 {
2451 // ****** sysutil savedata parameter error : 108 ******
2452 return {CELL_SAVEDATA_ERROR_PARAM, "108"};
2453 }
2454 case -2:
2455 {
2456 // ****** sysutil savedata parameter error : 109 ******
2457 return {CELL_SAVEDATA_ERROR_PARAM, "109"};
2458 }
2459 case 0:
2460 break;
2461 default:
2462 fmt::throw_exception("Unreachable");
2463 }
2464
2465 const std::string base_dir =
2466 fmt::format("/dev_hdd0/home/%08u/savedata/", userId);
2467
2468 if (!fs::is_dir(vfs::get(base_dir)))
2469 {
2470 return CELL_SAVEDATA_ERROR_NOUSER;
2471 }
2472
2473 const std::string save_path = vfs::get(base_dir + dirName.get_ptr() + '/');
2474 std::string sfo = save_path + "PARAM.SFO";
2475
2476 if (!fs::is_dir(save_path) && !fs::is_file(sfo))
2477 {
2478 cellSaveData.error(
2479 "cellSaveDataGetListItem(): Savedata at %s does not exist", dirName);
2480 return CELL_SAVEDATA_ERROR_NODATA;
2481 }
2482

Callers

nothing calls this directly

Calls 12

throw_exceptionClass · 0.85
getFunction · 0.85
load_objectFunction · 0.85
strcpy_truncFunction · 0.85
get_stringFunction · 0.85
dirClass · 0.85
check_filenameFunction · 0.85
GetUsrIdMethod · 0.80
errorMethod · 0.80
formatEnum · 0.50
get_ptrMethod · 0.45

Tested by

no test coverage detected