From 951d3afcda8ba4b93996f9350dbda6b409417475 Mon Sep 17 00:00:00 2001 From: Freakler Date: Wed, 15 Feb 2017 23:39:48 +0100 Subject: [PATCH] Add files via upload --- Makefile | 7 +- file.c | 79 ++++++++++--- file.h | 8 ++ main.c | 332 ++++++++++++++++++++++++++++--------------------------- main.h | 7 +- 5 files changed, 250 insertions(+), 183 deletions(-) diff --git a/Makefile b/Makefile index f8bb938..ada42ca 100644 --- a/Makefile +++ b/Makefile @@ -2,14 +2,14 @@ TITLE_ID = ADRINSTAL TARGET = EasyInstaller OBJS = main.o font.o graphics.o init.o file.o -PSVITAIP = 192.168.0.110 +PSVITAIP = 192.168.0.111 RESOURCES_PNG = materials/button_pad.png materials/button_cross.png materials/button_circle.png OBJS += $(RESOURCES_PNG:.png=.o) -LIBS = -lvita2d -lSceKernel_stub -lScePower_stub -lSceDisplay_stub -lSceGxm_stub -lSceAppUtil_stub -lSceAppMgr_stub \ +LIBS = -lvita2d -lScePower_stub -lSceLibKernel_stub -lSceDisplay_stub -lSceGxm_stub -lSceAppUtil_stub -lSceAppMgr_stub \ -lSceSysmodule_stub -lSceCtrl_stub -lScePgf_stub -lSceHttp_stub -lSceNet_stub -lSceNetCtl_stub\ - -lSceCommonDialog_stub -lSceVshBridge_stub -lfreetype -lpng -ljpeg -lz -lm -lc + -lSceCommonDialog_stub -lSceVshBridge_stub -lSceShellSvc_stub -lfreetype -lpng -ljpeg -lz -lm -lc PREFIX = arm-vita-eabi CC = $(PREFIX)-gcc @@ -25,6 +25,7 @@ all: $(TARGET).vpk -a livearea/template.xml=sce_sys/livearea/contents/template.xml \ -a livearea/startup.png=sce_sys/livearea/contents/startup.png \ -a livearea/bg0.png=sce_sys/livearea/contents/bg0.png \ + -a livearea/changeinfo.xml=sce_sys/changeinfo/changeinfo.xml \ -a files/adrenaline.skprx=files/adrenaline.skprx \ -a files/adrenaline.suprx=files/adrenaline.suprx \ -a files/icon0.dds=files/icon0.dds \ diff --git a/file.c b/file.c index 72c1a58..b3a60eb 100644 --- a/file.c +++ b/file.c @@ -170,6 +170,30 @@ int copyFile(char *src_path, char *dst_path) { //thx Flow VitaShell return 0; } +int makePath(const char *dir) { //thx molecule + char dir_copy[0x400] = {0}; + snprintf(dir_copy, sizeof(dir_copy) - 2, "%s", dir); + dir_copy[strlen(dir_copy)] = '/'; + char *c; + + for (c = dir_copy; *c; ++c) { + if (*c == '/') { + *c = '\0'; + sceIoMkdir(dir_copy, 0777); + *c = '/'; + } + } + + //test + SceUID test = sceIoDopen(dir); + if (test >= 0) { + sceIoDclose(test); + return 0; //success + } else { + return 1; + } +} + int removePath(char *path) { //thx Flow VitaShell SceUID dfd = sceIoDopen(path); if (dfd >= 0) { @@ -224,25 +248,28 @@ int removePath(char *path) { //thx Flow VitaShell int download_file(const char *src, const char *dst) { //thx molecule offline installer + int ret; + int coord = psvDebugScreenGetX(); //save current position of screen once + int tpl = sceHttpCreateTemplate("henkaku offline", 2, 1); if (tpl < 0) { - //printf("sceHttpCreateTemplate: 0x%x\n", tpl); + printf("sceHttpCreateTemplate: 0x%x\n", tpl); return tpl; } int conn = sceHttpCreateConnectionWithURL(tpl, src, 0); if (conn < 0) { - //printf("sceHttpCreateConnectionWithURL: 0x%x\n", conn); + printf("sceHttpCreateConnectionWithURL: 0x%x\n", conn); return conn; } int req = sceHttpCreateRequestWithURL(conn, 0, src, 0); if (req < 0) { - //printf("sceHttpCreateRequestWithURL: 0x%x\n", req); + printf("sceHttpCreateRequestWithURL: 0x%x\n", req); return req; } ret = sceHttpSendRequest(req, NULL, 0); if (ret < 0) { - //printf("sceHttpSendRequest: 0x%x\n", ret); + printf("sceHttpSendRequest: 0x%x\n", ret); return ret; } unsigned char buf[4096] = {0}; @@ -253,18 +280,15 @@ int download_file(const char *src, const char *dst) { //thx molecule offline ins int fd = sceIoOpen(dst, SCE_O_WRONLY | SCE_O_CREAT | SCE_O_TRUNC, 6); int total_read = 0; if (fd < 0) { - //printf("sceIoOpen: 0x%x\n", fd); + printf("sceIoOpen: 0x%x\n", fd); return fd; } - // draw progress bar background - //fg_color = 0xFF666666; - //draw_rect(psvDebugScreenGetX(), psvDebugScreenGetY(), PROGRESS_BAR_WIDTH, PROGRESS_BAR_HEIGHT); - //fg_color = 0xFFFFFFFF; + while (1) { int read = sceHttpReadData(req, buf, sizeof(buf)); if (read < 0) { - //printf("sceHttpReadData error! 0x%x\n", read); + printf("sceHttpReadData error! 0x%x\n", read); return read; } @@ -272,18 +296,20 @@ int download_file(const char *src, const char *dst) { //thx molecule offline ins ret = sceIoWrite(fd, buf, read); if (ret < 0 || ret != read) { - //printf("sceIoWrite error! 0x%x\n", ret); + printf("sceIoWrite error! 0x%x\n", ret); if (ret < 0) return ret; return -1; } total_read += read; - //draw_rect(psvDebugScreenGetX() + 1, psvDebugScreenGetY() + 1, (PROGRESS_BAR_WIDTH - 2) * total_read / length, PROGRESS_BAR_HEIGHT - 2); + + psvDebugScreenSetXY( coord, psvDebugScreenGetY() ); + printf("(%i bytes) ", total_read); } - printf("\n\n"); + ret = sceIoClose(fd); - //if (ret < 0) - //printf("sceIoClose: 0x%x\n", ret); + if (ret < 0) + printf("sceIoClose: 0x%x\n", ret); return 0; } @@ -321,6 +347,7 @@ const char *get_id_of_psp_game_that_adrenaline_is_installed_to() { //return PSP int write_adrenaline_to_config(char *id) { char buffer[1024]; + FILE *file = fopen("ux0:tai/config.txt", "r"); FILE *temp = fopen("ux0:tai/temp.txt", "w"); @@ -331,6 +358,7 @@ int write_adrenaline_to_config(char *id) { } else { while (fgets(buffer, sizeof(buffer), file) != NULL) { + if ( buffer[0] != '\n' ) { //empty row fix fprintf(temp, "%s", buffer); } @@ -342,6 +370,8 @@ int write_adrenaline_to_config(char *id) { } } + + //end of file (append the rest) fprintf(temp, "*%s\n", id); fprintf(temp, "vs0:sys/external/libpgf.suprx\n"); @@ -502,3 +532,22 @@ void trigger_rebuild_database() { sceIoRemove("ur0:shell/db/app.db"); } + +int writeChangeinfo(const char* id) { // return 1 on success + + char temp_buffer[256]; + int ret; + + sprintf(temp_buffer, "ux0:patch/%s/sce_sys/changeinfo", id); + ret = makePath(temp_buffer); //0 on success + + if ( ret == 0 ) { //if success + sprintf(temp_buffer, "ux0:patch/%s/sce_sys/changeinfo/changeinfo.xml", id); + ret = copyFile("app0:sce_sys/changeinfo/changeinfo.xml", temp_buffer); //0 on success + + if ( ret == 0 ) return 1; //success + } + + return 0; +} + diff --git a/file.h b/file.h index 00e6f9b..900023c 100644 --- a/file.h +++ b/file.h @@ -12,9 +12,12 @@ #include #include +#define printf psvDebugScreenPrintf + #define TRANSFER_SIZE 64 * 1024 //64kb #define MAX_PATH_LENGTH 1024 + char PSP_GAME_ID[32]; struct PSPContent { @@ -28,7 +31,10 @@ char *getEbootTitle(char *src_path); int doesFileExist(const char* path); int doesDirExist(const char* path); + int copyFile(char *src_path, char *dst_path); + +int makePath(const char *dir); int removePath(char *path); int download_file(const char *src, const char *dst); @@ -40,4 +46,6 @@ int check_for_psp_content(char *path); void trigger_update_database(); void trigger_rebuild_database(); + +int writeChangeinfo(const char* id); #endif \ No newline at end of file diff --git a/main.c b/main.c index 5759edd..e6c1653 100644 --- a/main.c +++ b/main.c @@ -4,21 +4,25 @@ /* Notes & TODO * - add sqlite method for the theme maybe?! -* - block PS button on install maybe?! -* - add progress indicator to 661 download -* - add check for right size of 661 pbp +* - add check for right size of 661 pbp (32580549 bytes) +* - * - * -* "Ultra-Secret-Debug-Info-Mesages"-combo is: LEFT + L-TRIGGER + R-TRIGGER + START */ /** Changelog +* v1.05 +* - added 6.61 Update file download progress indicator +* - added update history info to livearea +* - while installing the Home button is now blocked +* - fixed a bug with wrongly formatted tai-config files +* * v1.04 * - added PSP names in selection menu * - changed method to update database (addressed to bugs reported) * - added another safety dialog before actually installing Adrenaline * - added more message screens -* - added option to install a small basegame (thx to CeleseteBlue for the files) +* - added option to install a small basegame (thx to CelesteBlue for the files) * - added option to delete adrenaline flash files * - added option to delete 661 Update file * - bugs fixed @@ -32,39 +36,40 @@ * - * * v1.02 -* - bug fixes +* - bugs fixed */ + /// Main Menu ///////////// Menu recovery_menu[] = { - //*title //type //*function //*message - {"1. Install Adrenaline eCFW" , MENU_BLOCKED , draw_psp_games , "* Install 6.61 Adrenaline eCFW to a Basegame of your choice" }, + //*title //type //*function //*message + {"1. Install Adrenaline eCFW" , MENU_BLOCKED , draw_psp_games , "* Install 6.61 Adrenaline eCFW to a Basegame of your choice" }, {"2. Uninstall Adrenaline eCFW" , MENU_BLOCKED , uninstall_adrenaline , "* Remove Adrenaline from this device" }, - {"3. Theming Options" , MENU_BLOCKED , theme_options , "* Access theming options menu" }, - {"4. Advanced Options" , MENU_ACTIVE , more_options , "* Access advanced options menu" }, - {"5. Exit" , MENU_EXIT , NULL , "* Exit EasyInstaller" }, + {"3. Theming Options" , MENU_BLOCKED , theme_options , "* Access theming options menu" }, + {"4. Advanced Options" , MENU_ACTIVE , more_options , "* Access advanced options menu" }, + {"5. Exit" , MENU_EXIT , NULL , "* Exit EasyInstaller" }, {NULL,0,"",""} }; Menu theme_menu[] = { - //*title //type //*function //*message - {"Add Custom LiveArea Theme" , MENU_BLOCKED , install_theme , "* Add a custom LiveArea Theme (optional)" }, - {"Restore LiveArea Theme" , MENU_BLOCKED , uninstall_theme , "* Remove the custom LiveArea Theme and restore the default look" }, - {"back" , MENU_EXIT , NULL , "" }, + //*title //type //*function //*message + {"Add Custom LiveArea Theme" , MENU_BLOCKED , install_theme , "* Add a custom LiveArea Theme (optional)" }, + {"Restore LiveArea Theme" , MENU_BLOCKED , uninstall_theme , "* Remove the custom LiveArea Theme and restore the default look" }, + {"back" , MENU_EXIT , NULL , "" }, {NULL,0,"",""} }; Menu more_menu[] = { - //*title //type //*function //*message - {"Install a small PSP Basegame if needed" , MENU_BLOCKED , install_pspgame , "" }, + //*title //type //*function //*message + {"Install a small PSP Basegame if needed" , MENU_BLOCKED , install_pspgame , "" }, {"Delete installed Adrenaline flash files" , MENU_BLOCKED , option_delete_flash , "" }, - {"Delete 661.PBP update file" , MENU_BLOCKED , option_delete_pbp , "" }, - {"Rebuild Database" , MENU_ACTIVE , option_rebuildDatabase , "" }, - {"Update Database" , MENU_ACTIVE , option_updateDatabase , "" }, - //{"Reboot System" , MENU_ACTIVE , option_reboot , "" }, - {"back" , MENU_EXIT , NULL , "" }, + {"Delete 661.PBP update file" , MENU_BLOCKED , option_delete_pbp , "" }, + {"Rebuild Database" , MENU_ACTIVE , option_rebuildDatabase , "" }, + {"Update Database" , MENU_ACTIVE , option_updateDatabase , "" }, + //{"Reboot System" , MENU_ACTIVE , option_reboot , "" }, + {"back" , MENU_EXIT , NULL , "" }, {NULL,0,"",""} }; @@ -83,18 +88,19 @@ int system_check() { /// Model Check printf("Model check: "); if ( vshSblAimgrIsVITA() == 1 ) printf("Vita\n\n"); - else { - printf("PlayStationTV\n\n"); - //deactivate Game installing here - } + else printf("PlayStationTV\n\n"); /// Enter Button check printf("Enter Button = "); if ( SCE_CTRL_ENTER == SCE_CTRL_CROSS ) printf("X\n\n"); - else printf("O\n\n"); + else printf("O\n\n"); - printf("\n"); + /// Write Changeinfo for Livearea manually. (Does vpk promoting not feature this? [https://www.vitadevwiki.com/index.php?title=File:PKGdirstruct.png] Deleteing the bubble will delete patch/xxx though) + printf("Writing changeinfo.xml.. "); + if ( writeChangeinfo(TITLEID) ) print_color("OK\n\n", GREEN); + else print_color("Error\n\n", RED); + printf("\n"); /// taiHENkaku check printf("Checking for taiHENkaku.. "); @@ -147,19 +153,7 @@ int system_check() { } else { print_color("No content!!\n\n", YELLOW); - more_menu[0].type = MENU_ACTIVE; //unblock basegame install here - - /**old - print_color("\n!!! Please install any PSP Game/Demo first !!!\n\n", RED); - - if ( SCE_CTRL_ENTER == SCE_CTRL_CROSS ) printf("Press X to exit..\n\n"); - else printf("Press O to exit..\n\n"); - - while (1) { - readPad(); - if (pressed_buttons & SCE_CTRL_ENTER) return 0; - }**/ } @@ -213,7 +207,10 @@ int system_check() { /// check for 661.PBP printf("Checking for 661.PBP.. "); if ( doesFileExist("ux0:pspemu/adrenaline/661.PBP") ) { - print_color("Found!!\n\n", GREEN); + print_color("Found!!\n\n", GREEN); + + //add check here for correct/complete update file + more_menu[2].type = MENU_ACTIVE; //activate "Delete Update PBP" } else { @@ -456,6 +453,7 @@ void *uninstall_adrenaline() { int ret = drawdialog("Do you really want to continue uninstalling Adrenaline?",""); if ( ret ) { closeVita2DLib(); //shutdown Vita2dLib + lock_psbutton(); uninstall_adrenaline_files(PSP_GAME_ID); } @@ -580,7 +578,8 @@ void *draw_psp_games() { int ret = drawdialog(content_array[selection].title, "Do you really want to continue installing to this Game?"); if ( ret ) { - closeVita2DLib(); //shutdown Vita2dLib + closeVita2DLib(); //shutdown Vita2dLib + lock_psbutton(); install_adrenaline_files(content_array[selection].titleID); } @@ -596,10 +595,7 @@ void *draw_psp_games() { void *theme_options() { - // - draw_submenu(theme_menu, "Themeing Options"); - return 0; } @@ -608,6 +604,7 @@ void *install_theme() { int ret = drawdialog("Do you really want to continue installing the theme?",""); if ( ret ) { closeVita2DLib(); //shutdown Vita2dLib + lock_psbutton(); install_theme_files(PSP_GAME_ID); } @@ -619,6 +616,7 @@ void *uninstall_theme() { int ret = drawdialog("Do you really want to restore the original livearea theme?",""); if ( ret ) { closeVita2DLib(); //shutdown Vita2dLib + lock_psbutton(); uninstall_theme_files(PSP_GAME_ID); } @@ -630,9 +628,8 @@ void *uninstall_theme() { void *more_options() { - + draw_submenu(more_menu, "Advanced Options"); - return 0; } @@ -641,6 +638,7 @@ void *more_options() { int ret = drawdialog("Do you really want to continue installing a PSP Game?","After that you will be able to install Adrenaline to it!"); if ( ret ) { closeVita2DLib(); //shutdown Vita2dLib + lock_psbutton(); install_psp_basegame(); } @@ -1127,6 +1125,8 @@ void install_adrenaline_files(char *id) { } } + //unlock_psbutton(); + if (SCE_CTRL_ENTER == SCE_CTRL_CROSS) print_color("\n\nDone! Press X to reboot..\n", GREEN); //or O to exit normally..\n", GREEN); else print_color("\n\nDone! Press O to reboot..\n", GREEN); //or X to exit normally..\n", GREEN); @@ -1178,6 +1178,7 @@ void uninstall_adrenaline_files(char *id) { if ( ret == 0 ) print_color("OK\n\n", GREEN); else print_color("ERROR\n\n", RED); + //unlock_psbutton(); if ( SCE_CTRL_ENTER == SCE_CTRL_CROSS ) { print_color("\n\nDone! Press X to reboot..\n", GREEN); // or O to exit normally..\n", GREEN); @@ -1228,7 +1229,9 @@ void install_theme_files(char *id) { sceKernelDelayThread(1000 * 1000); // 1 sec print_color("1.. ", YELLOW); sceKernelDelayThread(1000 * 1000); // 1 sec - + + unlock_psbutton(); + sprintf(temp_buffer, "psgm:play?titleid=%s", id); sceAppMgrLaunchAppByUri(0x20000, temp_buffer); //launch flag 0x40000 | open flag 0x20000 @@ -1242,7 +1245,10 @@ void install_theme_files(char *id) { while (1) { readPad(); - if (pressed_buttons & SCE_CTRL_ENTER) break; + if (pressed_buttons & SCE_CTRL_ENTER) { + lock_psbutton(); + break; + } } } else { @@ -1313,8 +1319,10 @@ void install_theme_files(char *id) { print_color("Not found!\n", YELLOW); print_color("It seems you haven't installed Adrenaline via this app!\nThe bubble's name won't change!\n\n", YELLOW); } - - sceKernelDelayThread(1000 * 1000); // 1 sec for pad conflict maybe + + //unlock_psbutton(); + + sceKernelDelayThread(1000 * 1000); // 1 sec if ( SCE_CTRL_ENTER == SCE_CTRL_CROSS ) { print_color("\nDone! Press X to reboot..", GREEN); //or O to exit normally..\n", GREEN); @@ -1415,6 +1423,7 @@ void uninstall_theme_files(char *id) { else print_color("ERROR\n\n", RED); + //unlock_psbutton(); if ( SCE_CTRL_ENTER == SCE_CTRL_CROSS ) { print_color("\n\nDone! Press X to reboot..\n", GREEN); // or O to exit normally..\n", GREEN); @@ -1513,126 +1522,119 @@ void install_psp_basegame() { continue_install: - /// make dir + /// install in bgdl printf("Creating folder %s.. ", bgdl); - ret = sceIoMkdir(bgdl, 0777); - if ( ret == 0 ) print_color("OK\n\n", GREEN); - else print_color("ERROR\n\n", RED); + ret = makePath(bgdl); + if ( ret == 0 ) { + print_color("OK\n\n", GREEN); + + /// d0.pdb + sprintf(temp_buffer, "%s/d0.pdb", bgdl); + printf("Writing %s.. ", temp_buffer); + ret = copyFile("app0:files/basegame/bgdl/d0.pdb", temp_buffer); + if ( ret == 0 ) print_color("OK\n", GREEN); + else print_color("ERROR\n", RED); + + /// d1.pdb + sprintf(temp_buffer, "%s/d1.pdb", bgdl); + printf("Writing %s.. ", temp_buffer); + ret = copyFile("app0:files/basegame/bgdl/d1.pdb", temp_buffer); + if ( ret == 0 ) print_color("OK\n", GREEN); + else print_color("ERROR\n", RED); - /// d0.pdb - sprintf(temp_buffer, "%s/d0.pdb", bgdl); - printf("Writing %s.. ", temp_buffer); - ret = copyFile("app0:files/basegame/bgdl/d0.pdb", temp_buffer); - if ( ret == 0 ) print_color("OK\n", GREEN); - else print_color("ERROR\n", RED); - - /// d1.pdb - sprintf(temp_buffer, "%s/d1.pdb", bgdl); - printf("Writing %s.. ", temp_buffer); - ret = copyFile("app0:files/basegame/bgdl/d1.pdb", temp_buffer); - if ( ret == 0 ) print_color("OK\n", GREEN); - else print_color("ERROR\n", RED); - - /// f0.pdb - sprintf(temp_buffer, "%s/f0.pdb", bgdl); - printf("Writing %s.. ", temp_buffer); - ret = copyFile("app0:files/basegame/bgdl/f0.pdb", temp_buffer); - if ( ret == 0 ) print_color("OK\n", GREEN); - else print_color("ERROR\n", RED); - - /// icon.png - sprintf(temp_buffer, "%s/icon.png", bgdl); - printf("Writing %s.. ", temp_buffer); - ret = copyFile("app0:files/basegame/bgdl/icon.png", temp_buffer); - if ( ret == 0 ) print_color("OK\n", GREEN); - else print_color("ERROR\n", RED); - - /*/// temp.dat - sprintf(temp_buffer, "%s/temp.dat", bgdl); - printf("Writing %s.. ", temp_buffer); - ret = copyFile("app0:files/basegame/bgdl/temp.dat", temp_buffer); - if ( ret == 0 ) print_color("OK\n\n", GREEN); - else print_color("ERROR\n\n", RED);*/ - + /// f0.pdb + sprintf(temp_buffer, "%s/f0.pdb", bgdl); + printf("Writing %s.. ", temp_buffer); + ret = copyFile("app0:files/basegame/bgdl/f0.pdb", temp_buffer); + if ( ret == 0 ) print_color("OK\n", GREEN); + else print_color("ERROR\n", RED); + + /// icon.png + sprintf(temp_buffer, "%s/icon.png", bgdl); + printf("Writing %s.. ", temp_buffer); + ret = copyFile("app0:files/basegame/bgdl/icon.png", temp_buffer); + if ( ret == 0 ) print_color("OK\n", GREEN); + else print_color("ERROR\n", RED); + + /*/// temp.dat + sprintf(temp_buffer, "%s/temp.dat", bgdl); + printf("Writing %s.. ", temp_buffer); + ret = copyFile("app0:files/basegame/bgdl/temp.dat", temp_buffer); + if ( ret == 0 ) print_color("OK\n\n", GREEN); + else print_color("ERROR\n\n", RED);*/ - /// pspemu bgdl /////// + } else print_color("ERROR\n\n", RED); - /// make dirs - printf("\nCreating folders in %s.. ", pspemu); - sceIoMkdir("ux0:pspemu/bgdl", 0777); //make bgdl (unlikely but necessary) - sceIoMkdir(pspemu, 0777); //make 00000001 - sprintf(temp_buffer, "%s/PCSC80018", pspemu); - sceIoMkdir(temp_buffer, 0777); //make 00000001/PCSC80018 + /// install in PSPemu + printf("\nCreating folders in %s.. ", pspemu); - sprintf(temp_buffer, "%s/PCSC80018/sce_sys", pspemu); - sceIoMkdir(temp_buffer, 0777); //make 00000001/PCSC80018/sce_sys + sprintf(temp_buffer, "%s/PCSC80018/USRDIR/CONTENT", pspemu); + makePath(temp_buffer); - sprintf(temp_buffer, "%s/PCSC80018/sce_sys/package", pspemu); - sceIoMkdir(temp_buffer, 0777); //make 00000001/PCSC80018/sce_sys/package + sprintf(temp_buffer, "%s/PCSC80018/sce_sys/package", pspemu); + ret = makePath(temp_buffer); + + if ( ret == 0 ) { + print_color("OK\n\n", GREEN); + + /// PCSC80018/sce_sys/package/body.bin + sprintf(temp_buffer, "%s/PCSC80018/sce_sys/package/body.bin", pspemu); + //printf("Writing %s.. ", temp_buffer); + printf("Writing /PCSC80018/sce_sys/package/body.bin.. "); + ret = copyFile("app0:files/basegame/pspemu/body.bin", temp_buffer); + if ( ret == 0 ) print_color("OK\n", GREEN); + else print_color("ERROR\n", RED); + + /// PCSC80018/sce_sys/package/head.bin + sprintf(temp_buffer, "%s/PCSC80018/sce_sys/package/head.bin", pspemu); + //printf("Writing %s.. ", temp_buffer); + printf("Writing /PCSC80018/sce_sys/package/head.bin.. "); + ret = copyFile("app0:files/basegame/pspemu/head.bin", temp_buffer); + if ( ret == 0 ) print_color("OK\n", GREEN); + else print_color("ERROR\n", RED); + + /// PCSC80018/sce_sys/package/stat.bin + sprintf(temp_buffer, "%s/PCSC80018/sce_sys/package/stat.bin", pspemu); + //printf("Writing %s.. ", temp_buffer); + printf("Writing /PCSC80018/sce_sys/package/stat.bin.. "); + ret = copyFile("app0:files/basegame/pspemu/stat.bin", temp_buffer); + if ( ret == 0 ) print_color("OK\n", GREEN); + else print_color("ERROR\n", RED); + + /// PCSC80018/sce_sys/package/tail.bin + sprintf(temp_buffer, "%s/PCSC80018/sce_sys/package/tail.bin", pspemu); + //printf("Writing %s.. ", temp_buffer); + printf("Writing /PCSC80018/sce_sys/package/tail.bin.. "); + ret = copyFile("app0:files/basegame/pspemu/tail.bin", temp_buffer); + if ( ret == 0 ) print_color("OK\n", GREEN); + else print_color("ERROR\n", RED); + + /// PCSC80018/sce_sys/package/work.bin + sprintf(temp_buffer, "%s/PCSC80018/sce_sys/package/work.bin", pspemu); + //printf("Writing %s.. ", temp_buffer); + printf("Writing /PCSC80018/sce_sys/package/work.bin.. "); + ret = copyFile("app0:files/basegame/pspemu/work.bin", temp_buffer); + if ( ret == 0 ) print_color("OK\n", GREEN); + else print_color("ERROR\n", RED); + + /// PCSC80018/USRDIR/CONTENT/EBOOT.PBP + sprintf(temp_buffer, "%s/PCSC80018/USRDIR/CONTENT/EBOOT.PBP", pspemu); + //printf("Writing %s.. ", temp_buffer); + printf("Writing /PCSC80018/USRDIR/CONTENT/EBOOT.PBP.. "); + ret = copyFile("app0:files/basegame/pspemu/EBOOT.PBP", temp_buffer); + if ( ret == 0 ) print_color("OK\n", GREEN); + else print_color("ERROR\n", RED); + + } else print_color("ERROR\n\n", RED); - sprintf(temp_buffer, "%s/PCSC80018/USRDIR", pspemu); - sceIoMkdir(temp_buffer, 0777); //make 00000001/PCSC80018/USRDIR - sprintf(temp_buffer, "%s/PCSC80018/USRDIR/CONTENT", pspemu); - ret = sceIoMkdir(temp_buffer, 0777); //make 00000001/PCSC80018/USRDIR/CONTENT - - if ( ret == 0 ) print_color("OK\n\n", GREEN); - else print_color("ERROR\n\n", RED); - /// PCSC80018/sce_sys/package/body.bin - sprintf(temp_buffer, "%s/PCSC80018/sce_sys/package/body.bin", pspemu); - //printf("Writing %s.. ", temp_buffer); - printf("Writing /PCSC80018/sce_sys/package/body.bin.. "); - ret = copyFile("app0:files/basegame/pspemu/body.bin", temp_buffer); - if ( ret == 0 ) print_color("OK\n", GREEN); - else print_color("ERROR\n", RED); - - /// PCSC80018/sce_sys/package/head.bin - sprintf(temp_buffer, "%s/PCSC80018/sce_sys/package/head.bin", pspemu); - //printf("Writing %s.. ", temp_buffer); - printf("Writing /PCSC80018/sce_sys/package/head.bin.. "); - ret = copyFile("app0:files/basegame/pspemu/head.bin", temp_buffer); - if ( ret == 0 ) print_color("OK\n", GREEN); - else print_color("ERROR\n", RED); - - /// PCSC80018/sce_sys/package/stat.bin - sprintf(temp_buffer, "%s/PCSC80018/sce_sys/package/stat.bin", pspemu); - //printf("Writing %s.. ", temp_buffer); - printf("Writing /PCSC80018/sce_sys/package/stat.bin.. "); - ret = copyFile("app0:files/basegame/pspemu/stat.bin", temp_buffer); - if ( ret == 0 ) print_color("OK\n", GREEN); - else print_color("ERROR\n", RED); - - /// PCSC80018/sce_sys/package/tail.bin - sprintf(temp_buffer, "%s/PCSC80018/sce_sys/package/tail.bin", pspemu); - //printf("Writing %s.. ", temp_buffer); - printf("Writing /PCSC80018/sce_sys/package/tail.bin.. "); - ret = copyFile("app0:files/basegame/pspemu/tail.bin", temp_buffer); - if ( ret == 0 ) print_color("OK\n", GREEN); - else print_color("ERROR\n", RED); - - /// PCSC80018/sce_sys/package/work.bin - sprintf(temp_buffer, "%s/PCSC80018/sce_sys/package/work.bin", pspemu); - //printf("Writing %s.. ", temp_buffer); - printf("Writing /PCSC80018/sce_sys/package/work.bin.. "); - ret = copyFile("app0:files/basegame/pspemu/work.bin", temp_buffer); - if ( ret == 0 ) print_color("OK\n", GREEN); - else print_color("ERROR\n", RED); - - /// PCSC80018/USRDIR/CONTENT/EBOOT.PBP - sprintf(temp_buffer, "%s/PCSC80018/USRDIR/CONTENT/EBOOT.PBP", pspemu); - //printf("Writing %s.. ", temp_buffer); - printf("Writing /PCSC80018/USRDIR/CONTENT/EBOOT.PBP.. "); - ret = copyFile("app0:files/basegame/pspemu/EBOOT.PBP", temp_buffer); - if ( ret == 0 ) print_color("OK\n", GREEN); - else print_color("ERROR\n", RED); - - - - if (SCE_CTRL_ENTER == SCE_CTRL_CROSS) print_color("\n\nDone! Press X to reboot..\n", GREEN); //or O to exit normally..\n", GREEN); - else print_color("\n\nDone! Press O to reboot..\n", GREEN); //or X to exit normally..\n", GREEN); + //unlock_psbutton(); + + if (SCE_CTRL_ENTER == SCE_CTRL_CROSS) print_color("\n\nDone! Press X to reboot..\n", GREEN); + else print_color("\n\nDone! Press O to reboot..\n", GREEN); while (1) { readPad(); @@ -1667,13 +1669,15 @@ void readPad() { //thx TheFlow } } -/*void lock_psbutton() { + +void lock_psbutton() { sceShellUtilLock(SCE_SHELL_UTIL_LOCK_TYPE_PS_BTN | SCE_SHELL_UTIL_LOCK_TYPE_QUICK_MENU); } void unlock_psbutton() { sceShellUtilUnlock(SCE_SHELL_UTIL_LOCK_TYPE_PS_BTN | SCE_SHELL_UTIL_LOCK_TYPE_QUICK_MENU); -}*/ +} + int main() { @@ -1687,6 +1691,8 @@ int main() { netInit(); httpInit(); + sceShellUtilInitEvents(0); //for blocking buttons + if ( system_check() ) { initVita2DLib(); //initiate Vita2dLib draw_recovery_menu(); @@ -1694,4 +1700,4 @@ int main() { sceKernelExitProcess(0); return 0; -} +} \ No newline at end of file diff --git a/main.h b/main.h index 8e0de6c..9d1a776 100644 --- a/main.h +++ b/main.h @@ -8,7 +8,7 @@ #include #include //for button input //#include //for battery percentage -//#include //for blocking home button +#include //for blocking home button #include #include //for sceDisplayWaitVblankStart(); @@ -25,7 +25,8 @@ #define TEXT_SIZE 1.0f #define TITLE "Adrenaline EasyInstaller" -#define VERSION "1.04" +#define TITLEID "ADRINSTAL" +#define VERSION "1.05" #define DEFAULT_BASEGAME "NPEZ00104" #define UPDATE_LINK "http://du01.psp.update.playstation.org/update/psp/image/us/2014_1212_6be8878f475ac5b1a499b95ab2f7d301/EBOOT.PBP" @@ -74,6 +75,8 @@ int vshSblAimgrIsVITA(); void scePowerRequestColdReset(); void readPad(); +void lock_psbutton(); +void unlock_psbutton(); int system_check(); void draw_recovery_menu();