Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define MAX_LOADED_MODS 256
- static int (* _sceAppMgrPspSaveDataRootMount)(char *mount_point);
- /*
- Find the address of the module by name
- */
- uint32_t findModuleAddressByName(char *name) {
- SceUID mod_list[MAX_LOADED_MODS];
- unsigned int num_loaded = MAX_LOADED_MODS;
- if (sceKernelGetModuleList(0xFF, mod_list, &num_loaded) >= 0) {
- int i;
- for (i = 0; i < num_loaded; i++) {
- Psp2LoadedModuleInfo info;
- info.size = sizeof(info);
- if (sceKernelGetModuleInfo(mod_list[i], &info) >= 0) {
- if (strcmp(info.module_name, name) == 0) {
- return (uint32_t)info.segments[0].vaddr;
- }
- }
- }
- }
- return 0;
- }
- /*
- Simple method to find our desired syscall. Should support 3.18-3.51 (firmwares below aren't tested yet)
- */
- void findSceAppUtilFunctions() {
- uint32_t text_addr = findModuleAddressByName("SceAppUtil");
- uint32_t SceAppMgr_text_addr = 0;
- uint32_t SceAppMgr_imports_addr = 0;
- uint32_t i;
- for (i = 0; i < 0x10000; i += 4) {
- if (SceAppMgr_text_addr) {
- if (*(uint32_t *)(text_addr + i) == SceAppMgr_text_addr) {
- SceAppMgr_imports_addr = *(uint32_t *)(text_addr + i + 0xC);
- break;
- }
- } else {
- if (strcmp((char *)(text_addr + i), "SceAppMgr") == 0) {
- SceAppMgr_text_addr = text_addr + i;
- i = 0;
- continue;
- }
- }
- }
- if (SceAppMgr_imports_addr) {
- _sceAppMgrPspSaveDataRootMount = (void *)(*(uint32_t *)(SceAppMgr_imports_addr - 0x14));
- }
- }
- /*
- Get pspemu mount point
- */
- char mount_point[16];
- memset(mount_point, 0, sizeof(mount_point));
- _sceAppMgrPspSaveDataRootMount(mount_point);
- /*
- Demonstration of the mount point :)
- 'path' is now equivalent to ms0:/hello_world.bin
- */
- char path[128];
- sprintf(path, "%s/hello_world.bin", mount_point);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement