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

Function prx_load_module

kernel/cellos/src/sys_prx.cpp:189–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

187bool ppu_register_library_lock(std::string_view libname, bool lock_lib);
188
189static error_code
190prx_load_module(const std::string &vpath, u64 flags,
191 vm::ptr<sys_prx_load_module_option_t> /*pOpt*/,
192 fs::file src = {}, s64 file_offset = 0) {
193 if (flags != 0) {
194 if (flags & SYS_PRX_LOAD_MODULE_FLAGS_INVALIDMASK) {
195 return CELL_EINVAL;
196 }
197
198 if (flags & SYS_PRX_LOAD_MODULE_FLAGS_FIXEDADDR &&
199 !g_ps3_process_info.ppc_seg) {
200 return CELL_ENOSYS;
201 }
202
203 fmt::throw_exception("sys_prx: Unimplemented fixed address allocations");
204 }
205
206 std::string vpath0;
207 std::string path = vfs::get(vpath, nullptr, &vpath0);
208 std::string name = vpath0.substr(vpath0.find_last_of('/') + 1);
209
210 bool ignore = false;
211
212 constexpr std::string_view firmware_sprx_dir = "/dev_flash/sys/external/";
213 const bool is_firmware_sprx =
214 vpath0.starts_with(firmware_sprx_dir) &&
215 g_prx_list.count(
216 std::string_view(vpath0).substr(firmware_sprx_dir.size()));
217
218 if (is_firmware_sprx) {
219 if (g_cfg.core.libraries_control.get_set().count(name + ":lle")) {
220 // Force LLE
221 ignore = false;
222 } else if (g_cfg.core.libraries_control.get_set().count(name + ":hle")) {
223 // Force HLE
224 ignore = true;
225 } else {
226 // Use list
227 ignore = ::at32(g_prx_list, name) != 0;
228 }
229 } else if (vpath0.starts_with("/")) {
230 // Special case : HLE for files outside of "/dev_flash/sys/external/"
231 // Have to specify full path for them
232 ignore = g_prx_list.count(vpath0) && ::at32(g_prx_list, vpath0);
233 }
234
235 auto hle_load = [&]() {
236 const auto prx = idm::make_ptr<lv2_obj, lv2_prx>();
237
238 prx->name = std::move(name);
239 prx->path = std::move(path);
240
241 sys_prx.warning("Ignored module: \"%s\" (id=0x%x)", vpath, idm::last_id());
242
243 return not_an_error(idm::last_id());
244 };
245
246 if (ignore) {

Callers 4

prx_load_module_listFunction · 0.85
_sys_prx_load_moduleFunction · 0.85

Calls 15

throw_exceptionClass · 0.85
getFunction · 0.85
openFunction · 0.85
decrypt_selfFunction · 0.85
ppu_load_prxFunction · 0.85
dump_executableFunction · 0.85
ppu_initializeFunction · 0.85
substrMethod · 0.80
errorMethod · 0.80
last_keyMethod · 0.80
get_errorMethod · 0.80
successMethod · 0.80

Tested by

no test coverage detected