-
Notifications
You must be signed in to change notification settings - Fork 14
Developer menu should have seperate folder to drag and drop menus so they can be loaded #54
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
The Developer menu should have seperate folder to drag and drop .sprx or .bin menus so they can be loaded.
Example /dev_hdd0/plugins/RouLetteVshMenu/modmenus/autoscan this will scan all .sprx in the folder and load them up into a submenu. Maybe we can do the same for all .sprx in the tmp folder /dev_hdd0/tmp/plugin.sprx
other names that might be better
/dev_hdd0/plugins/RouLetteVshMenu/menuloader/sprx/
/dev_hdd0/plugins/RouLetteVshMenu/menuloader/bin/
RouLetteVshMenu/src/Core/Menu/Submenus.cpp
Lines 252 to 351 in 84ca622
| void DeveloperSubmenu() | |
| { | |
| g_Menu.Title(L"Developer"); | |
| g_Menu.Option(L"Load /dev_hdd0/tmp/plugin.sprx into game process").Action([] | |
| { | |
| if (FileExist("/dev_hdd0/tmp/plugin.sprx")) | |
| { | |
| bool couldLoad = GamePatching::StartSprx("/dev_hdd0/tmp/plugin.sprx"); | |
| if (couldLoad) | |
| vsh::ShowNavigationMessage(L"Successfully loaded /dev_hdd0/tmp/plugin.sprx into process"); | |
| else | |
| vsh::ShowNavigationMessage(L"You are not in game"); | |
| } | |
| else | |
| { | |
| vsh::ShowNavigationMessage(L"File does not exist"); | |
| } | |
| }); | |
| g_Menu.Option(L"Unload /dev_hdd0/tmp/plugin.sprx from game process").Action([] | |
| { | |
| if (FileExist("/dev_hdd0/tmp/plugin.sprx")) | |
| { | |
| sys_pid_t processId = vsh::GetGameProcessId(); | |
| if (processId) | |
| { | |
| sys_prx_id_t prxId = GamePatching::GetProcessModuleIdByFilePath(processId, "/dev_hdd0/tmp/plugin.sprx"); | |
| if (prxId) | |
| { | |
| ps3mapi_unload_process_modules(vsh::GetGameProcessId(), prxId); | |
| vsh::ShowNavigationMessage(L"Successfully unloaded /dev_hdd0/tmp/plugin.sprx from process"); | |
| } | |
| else | |
| vsh::ShowNavigationMessage(L"sprx is not loaded into game"); | |
| } | |
| else | |
| vsh::ShowNavigationMessage(L"You are not in game"); | |
| } | |
| else | |
| { | |
| vsh::ShowNavigationMessage(L"File does not exist"); | |
| } | |
| }); | |
| static uint64_t pageTable[2]{}; | |
| g_Menu.Option(L"Load /dev_hdd0/tmp/payload.bin into game process").Action([] | |
| { | |
| const char* fileName = "/dev_hdd0/tmp/payload.bin"; | |
| if (FileExist(fileName)) | |
| { | |
| // I need to find a way to get file size on disk; see https://imgur.com/a/bSFHbGT | |
| CellFsStat st; | |
| cellFsStat(fileName, &st); | |
| uint64_t fileSize = st.st_size; | |
| uint64_t blockSize = st.st_blksize; | |
| uint64_t payloadPadding = 0x4000; // https://imgur.com/a/aFEfVIM | |
| uint64_t fileSizeOnDisk = fileSize + (4 * blockSize); | |
| uint64_t fileSizeOnDisk2 = fileSize + payloadPadding; | |
| vsh::printf("fileSize = %d | blockSize = %d | payloadPadding = %d | fileSizeOnDisk = %d | fileSizeOnDisk2 = %d\n", fileSize, blockSize, payloadPadding, fileSizeOnDisk, fileSizeOnDisk2); | |
| if (GamePatching::StartPayload(fileName, KB(4), 0x7D0, 0x4000, pageTable)) | |
| { | |
| vsh::printf("Payload injected at table[0] = 0x%016llX\n", pageTable[0]); | |
| vsh::printf("Payload injected at table[1] = 0x%016llX\n", pageTable[1]); | |
| vsh::ShowNavigationMessage(L"Successfully loaded /dev_hdd0/tmp/payload.bin into process"); | |
| } | |
| } | |
| else | |
| { | |
| vsh::ShowNavigationMessage(L"File does not exist"); | |
| } | |
| }); | |
| g_Menu.Option(L"Unload /dev_hdd0/tmp/payload.bin from game process").Action([] | |
| { | |
| sys_pid_t processId = vsh::GetGameProcessId(); | |
| if (processId) | |
| { | |
| if (pageTable[0] && pageTable[1]) | |
| { | |
| int ret = ps3mapi_process_page_free(processId, 0x2F, pageTable); | |
| vsh::memset(pageTable, 0, sizeof(pageTable)); | |
| if (ret == SUCCEEDED) | |
| vsh::ShowNavigationMessage(L"page sucessfully free'd"); | |
| else | |
| { | |
| vsh::printf("failed to free page 0x%X\n", ret); | |
| vsh::ShowNavigationMessage(L"failed to free page"); | |
| } | |
| } | |
| else | |
| { | |
| vsh::ShowNavigationMessage(L"page has not been allocated"); | |
| } | |
| } | |
| else | |
| vsh::ShowNavigationMessage(L"You are not in game"); | |
| }); | |
| } |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request