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

Method load

kernel/cellos/src/sys_overlay.cpp:84–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82fs::file make_file_view(fs::file &&file, u64 offset, u64 size);
83
84std::function<void(void *)> lv2_overlay::load(utils::serial &ar) {
85 const std::string vpath = ar.pop<std::string>();
86 const std::string path = vfs::get(vpath);
87 const s64 offset = ar.pop<s64>();
88
89 sys_overlay.success("lv2_overlay::load(): vpath='%s', path='%s', offset=0x%x",
90 vpath, path, offset);
91
92 shared_ptr<lv2_overlay> ovlm;
93
94 fs::file file{path.substr(
95 0, path.size() - (offset ? fmt::format("_x%x", offset).size() : 0))};
96
97 if (file) {
98 u128 klic = g_fxo->get<loaded_npdrm_keys>().last_key();
99 file = make_file_view(std::move(file), offset, umax);
100 ovlm =
101 ppu_load_overlay(ppu_exec_object{decrypt_self(
102 std::move(file), reinterpret_cast<u8 *>(&klic))},
103 false, path, 0, &ar)
104 .first;
105
106 if (!ovlm) {
107 fmt::throw_exception("lv2_overlay::load(): ppu_load_overlay() failed. "
108 "(vpath='%s', offset=0x%x)",
109 vpath, offset);
110 }
111 } else if (!g_cfg.savestate.state_inspection_mode.get()) {
112 fmt::throw_exception(
113 "lv2_overlay::load(): Failed to find file. (vpath='%s', offset=0x%x)",
114 vpath, offset);
115 } else {
116 sys_overlay.error(
117 "lv2_overlay::load(): Failed to find file. (vpath='%s', offset=0x%x)",
118 vpath, offset);
119 }
120
121 return [ovlm](void *storage) {
122 *static_cast<atomic_ptr<lv2_obj> *>(storage) = ovlm;
123 };
124}
125
126void lv2_overlay::save(utils::serial &ar) {
127 USING_SERIALIZATION_VERSION(lv2_prx_overlay);

Callers

nothing calls this directly

Calls 12

getFunction · 0.85
make_file_viewFunction · 0.85
ppu_load_overlayFunction · 0.85
decrypt_selfFunction · 0.85
throw_exceptionClass · 0.85
successMethod · 0.80
substrMethod · 0.80
last_keyMethod · 0.80
errorMethod · 0.80
formatEnum · 0.50
sizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected