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

Function error_code savedata_op

ps3fw/cellSaveData.cpp:781–2423  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

779}
780
781static NEVER_INLINE error_code
782savedata_op(ppu_thread& ppu, u32 operation, u32 version, vm::cptr<char> dirName,
783 u32 errDialog, PSetList setList, PSetBuf setBuf, PFuncList funcList,
784 PFuncFixed funcFixed, PFuncStat funcStat, PFuncFile funcFile,
785 u32 container, u32 unk_op_flags /*TODO*/, vm::ptr<void> userdata,
786 u32 userId, PFuncDone funcDone)
787{
788 if (const auto& [ok, list] = setList.try_read(); ok)
789 cellSaveData.notice("savedata_op(): setList = { .sortType=%d, "
790 ".sortOrder=%d, .dirNamePrefix='%s' }",
791 list.sortType, list.sortOrder, list.dirNamePrefix);
792
793 if (const auto& [ok, buf] = setBuf.try_read(); ok)
794 cellSaveData.notice("savedata_op(): setBuf = { .dirListMax=%d, "
795 ".fileListMax=%d, .bufSize=%d }",
796 buf.dirListMax, buf.fileListMax, buf.bufSize);
797
798 if (const auto ecode = savedata_check_args(
799 operation, version, dirName, errDialog, setList, setBuf, funcList,
800 funcFixed, funcStat, funcFile, container, unk_op_flags, userdata,
801 userId, funcDone))
802 {
803 return {CELL_SAVEDATA_ERROR_PARAM, " (error %d)", ecode};
804 }
805
806 std::unique_lock hle_lock(g_fxo->get<hle_locks_t>(), std::try_to_lock);
807
808 if (!hle_lock)
809 {
810 ppu.state += cpu_flag::again;
811 return {};
812 }
813
814 std::unique_lock lock(g_fxo->get<savedata_manager>().mutex, std::try_to_lock);
815
816 if (!lock)
817 {
818 return CELL_SAVEDATA_ERROR_BUSY;
819 }
820
821 // Simulate idle time while data is being sent to VSH
822 const auto lv2_sleep = [](ppu_thread& ppu, usz sleep_time)
823 {
824 lv2_obj::sleep(ppu);
825 lv2_obj::wait_timeout(sleep_time);
826 ppu.check_state();
827 };
828
829 lv2_sleep(ppu, 500);
830
831 std::memset(g_savedata_context.get_ptr(), 0, g_savedata_context.size());
832
833 vm::ptr<CellSaveDataCBResult> result =
834 g_savedata_context.ptr(&savedata_context::result);
835 vm::ptr<CellSaveDataListGet> listGet =
836 g_savedata_context.ptr(&savedata_context::listGet);
837 vm::ptr<CellSaveDataListSet> listSet =
838 g_savedata_context.ptr(&savedata_context::listSet);

Callers

nothing calls this directly

Calls 15

savedata_check_argsFunction · 0.85
lv2_sleepFunction · 0.85
getFunction · 0.85
dirClass · 0.85
load_objectFunction · 0.85
get_stringFunction · 0.85
check_filenameFunction · 0.85
strcpy_truncFunction · 0.85
throw_exceptionClass · 0.85
size32Function · 0.85

Tested by

no test coverage detected