From cbd3eb09b375b3a76d2961215e2b1b19019fee49 Mon Sep 17 00:00:00 2001 From: Brennen Murphy Date: Sun, 29 Sep 2024 12:55:52 -0400 Subject: [PATCH] Full Flash Installer better menu (spun from FinalSpeed) also model depended options will properly display --- Makefile | 4 +- .../{fatms371.prx => _fatms371.prx} | Bin .../{fatmshlp.prx => _fatmshlp.prx} | Bin extras/apps/installer/main.c | 315 ++++++++++++++---- 4 files changed, 257 insertions(+), 62 deletions(-) rename contrib/PSP/fatms371mod/{fatms371.prx => _fatms371.prx} (100%) rename contrib/PSP/fatms371mod/{fatmshlp.prx => _fatmshlp.prx} (100%) diff --git a/Makefile b/Makefile index 1f453735..b3d7c8cf 100644 --- a/Makefile +++ b/Makefile @@ -100,7 +100,7 @@ copy-bin: $(Q)cp extras/menus/arkMenu/themes/ARK_Revamped/THEME.ARK dist/ARK_01234/THEME.ARK # Launcher resources $(Q)cp extras/menus/vshmenu/satelite.prx dist/ARK_01234/VSHMENU.PRX # New Default & Advanced VSH Menu $(Q)cp extras/apps/installer/EBOOT.PBP dist/PSP/ARK_Full_Installer # Full installer - $(Q)cp contrib/PSP/fatms371mod/*.prx dist/PSP/ARK_Full_Installer/ # Full installer + $(Q)cp contrib/PSP/fatms371mod/*.prx dist/PSP/ARK_Full_Installer/kd/ # Full installer $(Q)cp extras/apps/uninstaller/EBOOT.PBP dist/PSP/ARK_Uninstaller # ARK-4 Uninstaller $(Q)cp contrib/UPDATER.TXT dist/ARK_01234/ $(Q)cp contrib/SETTINGS.TXT dist/ARK_01234/ @@ -377,7 +377,7 @@ mkdir-dist: $(Q)mkdir dist/PSP/ARK_Uninstaller | true $(Q)mkdir dist/PSP/ARK_DC | true $(Q)mkdir dist/PSP/ARK_cIPL | true - $(Q)mkdir dist/PSP/ARK_Full_Installer | true + $(Q)mkdir -p dist/PSP/ARK_Full_Installer/kd | true $(Q)mkdir dist/PSP/FinalSpeed | true $(Q)mkdir dist/PSP/Pops4Tool | true $(Q)mkdir dist/PSP/Pops4Tool/TT | true diff --git a/contrib/PSP/fatms371mod/fatms371.prx b/contrib/PSP/fatms371mod/_fatms371.prx similarity index 100% rename from contrib/PSP/fatms371mod/fatms371.prx rename to contrib/PSP/fatms371mod/_fatms371.prx diff --git a/contrib/PSP/fatms371mod/fatmshlp.prx b/contrib/PSP/fatms371mod/_fatmshlp.prx similarity index 100% rename from contrib/PSP/fatms371mod/fatmshlp.prx rename to contrib/PSP/fatms371mod/_fatmshlp.prx diff --git a/extras/apps/installer/main.c b/extras/apps/installer/main.c index 82e70d20..90d0be80 100644 --- a/extras/apps/installer/main.c +++ b/extras/apps/installer/main.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -19,6 +20,39 @@ PSP_HEAP_SIZE_KB(4096); #define BUF_SIZE 16*1024 #define KERNELIFY(a) ((u32)a|0x80000000) +#define setbcolor pspDebugScreenSetBackColor +#define setcolor pspDebugScreenSetTextColor +#define setc pspDebugScreenSetXY +#define printf pspDebugScreenPrintf + +#define RGB(r, g, b) (0xFF000000 | ((b)<<16) | ((g)<<8) | (r)) +#define RED RGB(255, 0, 0) +#define GREEN RGB(0, 255, 0) +#define BLUE RGB(0, 0, 255) +#define BLACK RGB(0, 0, 0) +#define ORANGE RGB(255, 127, 0) +#define WHITE RGB(255, 255, 255) +#define YELLOW RGB(255, 255, 0) +#define GRAY RGB(103, 120, 137) + +ARKConfig ark_config; + +void printfc(int x, int y, char *fmt, ...) +{ + char msg[256]; + + va_list list; + va_start(list, fmt); + vsprintf(msg, fmt, list); + va_end(list); + + setc(x, y); + printf(msg); + setcolor(WHITE); +} + + + struct { char* orig; char* dest; @@ -30,13 +64,55 @@ struct { {RECOVERY_PRX, RECOVERY_PRX_FLASH}, {UPDATER_FILE, UPDATER_FILE_FLASH}, {ARK_SETTINGS, ARK_SETTINGS_FLASH}, - {PATH_FATMS_371, PATH_FATMS_371_FLASH}, - {PATH_FATMS_HELPER, PATH_FATMS_HELPER_FLASH}, }; static const int N_FLASH_FILES = (sizeof(flash_files)/sizeof(flash_files[0])); +void install(char *argv[]) { + pspDebugScreenClear(); + + printf("ARK Full Installer Started\n"); + + + u32 my_ver = (ARK_MAJOR_VERSION << 16) | (ARK_MINOR_VERSION << 8) | ARK_MICRO_VERSION; + u32 cur_ver = sctrlHENGetMinorVersion(); + int major = (cur_ver&0xFF0000)>>16; + int minor = (cur_ver&0xFF00)>>8; + int micro = (cur_ver&0xFF); + + printf("Version %d.%d.%.2i\n", major, minor, micro); + + printf("Opening flash0 for writing\n"); + open_flash(); + + char path[ARK_PATH_SIZE]; + int len = strlen(argv[0])-8; + char fatms[len]; + for (int i=0; i= 0){ - pspDebugScreenPrintf("Installing %s\n", flash_path); + printf("Installing %s\n", flash_path); copy_file(pops_files[i], flash_path); + } + else { + printf("\n\nError files not found.\n"); + printf("Exiting...\n"); + sceKernelDelayThread(1000000); + sceKernelExitGame(); + } + } + printf("\n\nExiting...\n"); + sceKernelDelayThread(1000000); + sceKernelExitGame(); +} + +void fatms371_mod(void) { + static char* fatms371_files[] = { "kd/_fatms371.prx", "kd/_fatmshlp.prx" }; + SceIoStat stat; + + open_flash(); + for (int i=0; i= 0){ + printf("Installing %s\n", flash_path); + copy_file(fatms371_files[i], flash_path); } } - pspDebugScreenPrintf("Done\n"); + printf("\n\nExiting...\n"); + sceKernelDelayThread(1000000); + sceKernelExitGame(); } +//from ospbt by cory1492 +void wait_release(unsigned int buttons) +{ + SceCtrlData pad; + + sceCtrlReadBufferPositive(&pad, 1); + while(pad.Buttons & buttons) + sceCtrlReadBufferPositive(&pad, 1); +} + +//from ospbt by cory1492 +unsigned int wait_press(unsigned int buttons) +{ + SceCtrlData pad; + + sceCtrlReadBufferPositive(&pad, 1); + while(1) + { + if(pad.Buttons & buttons) + return pad.Buttons & buttons; + + sceCtrlReadBufferPositive(&pad, 1); + } + + return 0; +} // Entry Point int main(int argc, char * argv[]) { - ARKConfig ark_config; sctrlHENGetArkConfig(&ark_config); @@ -93,69 +215,142 @@ int main(int argc, char * argv[]) pspDebugScreenInit(); if (ark_config.magic != ARK_CONFIG_MAGIC){ - pspDebugScreenPrintf("ERROR: not running ARK\n"); + printf("ERROR: not running ARK\n"); sceKernelDelayThread(100000); sceKernelExitGame(); } - SceCtrlData pad; - pspDebugScreenPrintf("ARK-4 Full Installer\n"); - pspDebugScreenPrintf("Press X to install\n"); - pspDebugScreenPrintf("Press O to uninstall\n"); - pspDebugScreenPrintf("Press [] to install pops files for toolkits\n"); - pspDebugScreenPrintf("Press R Trigger to quit\n"); - - while(1) { - sceCtrlReadBufferPositive(&pad, 1); - if(pad.Buttons & PSP_CTRL_CIRCLE) - uninstall(); - else if(pad.Buttons & PSP_CTRL_CROSS) - break; - else if (pad.Buttons & PSP_CTRL_SQUARE){ - pops4tool(); - sceKernelDelayThread(100000); - sceKernelExitGame(); - } - else if(pad.Buttons & PSP_CTRL_RTRIGGER) - sceKernelExitGame(); +/* printf("ARK-4 Full Installer\n"); + printf("Press X to install\n"); + printf("Press O to uninstall\n"); + if(kuKernelGetModel() != PSP_GO) + printf("Press /\\ to install fatms371_mod\n"); + if(sctrlHENIsToolKit()) + printf("Press [] to install pops files for toolkits\n"); + printf("Press R Trigger to quit\n"); + */ - } - pspDebugScreenClear(); + printf("\n\n\tARK-4 Full Installer\n"); - pspDebugScreenPrintf("ARK Full Installer Started\n"); + int cursor = 0; + while(1) { - u32 my_ver = (ARK_MAJOR_VERSION << 16) | (ARK_MINOR_VERSION << 8) | ARK_MICRO_VERSION; - u32 cur_ver = sctrlHENGetMinorVersion(); - int major = (cur_ver&0xFF0000)>>16; - int minor = (cur_ver&0xFF00)>>8; - int micro = (cur_ver&0xFF); + if(kuKernelGetModel() == PSP_GO) { + if(cursor > 2) + cursor = 0; + } + if(sctrlHENIsToolKit()) { + if(cursor > 4) + cursor = 0; + } + else if(!sctrlHENIsToolKit() && kuKernelGetModel() != PSP_GO && cursor > 3) cursor = 0; + if(cursor < 0) { + if(kuKernelGetModel() == PSP_GO) + cursor = 2; + if(sctrlHENIsToolKit()) + cursor = 4; + if(!sctrlHENIsToolKit() && kuKernelGetModel() != PSP_GO) + cursor = 3; + } - pspDebugScreenPrintf("Version %d.%d.%.2i\n", major, minor, micro); - pspDebugScreenPrintf("Opening flash0 for writing\n"); - open_flash(); + if(cursor == 0) setbcolor(GRAY); + printfc(3, 4, " Install "); + setbcolor(BLACK); + if(cursor == 1) setbcolor(GRAY); + printfc(3, 5, " Uninstall "); + setbcolor(BLACK); + if(cursor == 2) setbcolor(GRAY); + if (sctrlHENIsToolKit()) { + if(cursor == 2) + setbcolor(GRAY); + printfc(3, 6, " Install popsTool "); + setbcolor(BLACK); + if(cursor == 3) + setbcolor(GRAY); + printfc(3, 7, " Install fatms371_mod "); + setbcolor(BLACK); + } + else if((kuKernelGetModel() == PSP_GO)) { + if(cursor == 2) + setbcolor(GRAY); + printfc(3, 6, " Exit "); + setbcolor(BLACK); + } + else if(!sctrlHENIsToolKit() && kuKernelGetModel() != PSP_GO) { + if(cursor == 2) + setbcolor(GRAY); + printfc(3, 6, " Install fatms371_mod "); + setbcolor(BLACK); + } - char path[ARK_PATH_SIZE]; - int len = strlen(argv[0])-8; - char fatms[len]; - for (int i=0; i"); + u32 Buttons = wait_press(PSP_CTRL_CROSS | PSP_CTRL_UP | PSP_CTRL_DOWN); + wait_release(PSP_CTRL_CROSS | PSP_CTRL_UP | PSP_CTRL_DOWN); + + SceCtrlData pad; + sceCtrlReadBufferPositive(&pad, 1); + if (Buttons & PSP_CTRL_CROSS) { + + setc(0, 9); + if(cursor == 0) + install(argv); + if(cursor == 1) + uninstall(); + if(cursor == 2 && sctrlHENIsToolKit()) + pops4tool(); + if(cursor == 2 && !sctrlHENIsToolKit() && kuKernelGetModel() != PSP_GO) + fatms371_mod(); + if(cursor == 2 && (kuKernelGetModel() == PSP_GO)) { + printf("\n\nExiting...\n"); + sceKernelDelayThread(1000000); + sceKernelExitGame(); + } + if(cursor == 3 && !sctrlHENIsToolKit()) { + printf("\n\nExiting...\n"); + sceKernelDelayThread(1000000); + sceKernelExitGame(); + } + if(cursor == 3 && sctrlHENIsToolKit()) + fatms371_mod(); + if(cursor == 4 && sctrlHENIsToolKit()) { + printf("\n\nExiting...\n"); + sceKernelDelayThread(1000000); + sceKernelExitGame(); + } + + /*else if(cursor == 3) { + printf("\n\nExiting...\n"); + sceKernelDelayThread(1000000); + sceKernelExitGame(); + } + */ + + } + else if(Buttons & PSP_CTRL_UP) + cursor--; + else if(Buttons & PSP_CTRL_DOWN) + cursor++; + } // Exit Function return 0; }