mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-22 00:22:57 -05:00
A title asks for a module by its console name and the relinker names the converted module after the ELF it was built from: Unity IL2CPP titles load Media/Modules/<name>.prx and Media/Plugins/<name>.prx while the dump holds <name>.elf.guest.prx, so sceKernelLoadStartModule failed with 0x80020002 and the title stopped 3 s after start. After the exact and the case-insensitive <name>.guest.prx lookups miss, take the sibling whose stem matches the request and ends with .guest.prx, shortest name first.
24 lines
904 B
C++
24 lines
904 B
C++
#include "prx/libc/include/general/VabiMacros.hpp"
|
|
#include <cstdio>
|
|
#include <cstdlib>
|
|
#include <source_location>
|
|
extern "C" {
|
|
void* APS5_VABI dlopen_nid_postfix(const char*, int);
|
|
void* APS5_VABI dlsym_nid_postfix(void*, const char*);
|
|
int APS5_VABI dlclose_nid_postfix(void*);
|
|
}
|
|
static void Require(bool value, const std::source_location& location = std::source_location::current()) {
|
|
if (value) return;
|
|
std::fprintf(stderr, "guest_dynamic_loader_variants: failed at %s:%u\n", location.file_name(), location.line());
|
|
std::abort();
|
|
}
|
|
int main() {
|
|
using Add = int (APS5_VABI *)(int, int);
|
|
void* extension = dlopen_nid_postfix("guest_module_fixture.prx", 2);
|
|
Require(extension != nullptr);
|
|
auto add = reinterpret_cast<Add>(dlsym_nid_postfix(extension, "GuestModuleAdd"));
|
|
Require(add && add(19, 23) == 42);
|
|
Require(dlclose_nid_postfix(extension) == 0);
|
|
return 0;
|
|
}
|