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

Function overlay_load_module

kernel/cellos/src/sys_overlay.cpp:28–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26LOG_CHANNEL(sys_overlay);
27
28static error_code overlay_load_module(vm::ptr<u32> ovlmid,
29 const std::string &vpath, u64 /*flags*/,
30 vm::ptr<u32> entry, fs::file src = {},
31 s64 file_offset = 0) {
32 if (!src) {
33 auto [fs_error, ppath, path, lv2_file, type] = lv2_file::open(vpath, 0, 0);
34
35 if (fs_error) {
36 return {fs_error, vpath};
37 }
38
39 src = std::move(lv2_file);
40 }
41
42 u128 klic = g_fxo->get<loaded_npdrm_keys>().last_key();
43
44 src = decrypt_self(std::move(src), reinterpret_cast<u8 *>(&klic));
45
46 if (!src) {
47 return {CELL_ENOEXEC, +"Failed to decrypt file"};
48 }
49
50 ppu_exec_object obj = std::move(src);
51 src.close();
52
53 if (obj != elf_error::ok) {
54 return {CELL_ENOEXEC, obj.operator elf_error()};
55 }
56
57 const auto [ovlm, error] =
58 ppu_load_overlay(obj, false, vfs::get(vpath), file_offset);
59
60 obj.clear();
61
62 if (error) {
63 if (error == CELL_CANCEL + 0u) {
64 // Emulation stopped
65 return {};
66 }
67
68 return error;
69 }
70
71 ppu_initialize(*ovlm);
72
73 sys_overlay.success("Loaded overlay: \"%s\" (id=0x%x)", vpath,
74 idm::last_id());
75
76 *ovlmid = idm::last_id();
77 *entry = ovlm->entry;
78
79 return CELL_OK;
80}
81
82fs::file make_file_view(fs::file &&file, u64 offset, u64 size);
83

Callers 2

sys_overlay_load_moduleFunction · 0.85

Calls 9

openFunction · 0.85
decrypt_selfFunction · 0.85
ppu_load_overlayFunction · 0.85
getFunction · 0.85
ppu_initializeFunction · 0.85
last_keyMethod · 0.80
successMethod · 0.80
closeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected