diff --git a/CMakeLists.txt b/CMakeLists.txt index 040db1f..3119c48 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -159,7 +159,7 @@ if(BUILD_PSP2) SceSysmodule_stub SceDisplay_stub SceGxm_stub SceCtrl_stub ScePgf_stub ScePower_stub SceCommonDialog_stub SceAudio_stub SceShellSvc_stub SceHid_stub SceTouch_stub png jpeg z m c - SceAppUtil_stub + SceAppUtil_stub SceAppMgr_stub ) if (BUILD_DEBUG) @@ -178,7 +178,7 @@ if(BUILD_PSP2) vita_create_self(${PROJECT_NAME}.self ${PROJECT_NAME} ${UNSAFE_FLAG}) add_custom_target(${PROJECT_NAME}.vpk - DEPENDS ${PROJECT_NAME}.self + DEPENDS ${PROJECT_NAME}.self-self COMMAND rm -rf vpk && mkdir -p vpk/sce_sys COMMAND ${VITASDK}/bin/vita-mksfoex -s TITLE_ID=${TITLEID} "${PROJECT_NAME}" vpk/sce_sys/param.sfo COMMAND cp ${PROJECT_NAME}.self vpk/eboot.bin diff --git a/psp2launcher/Makefile b/psp2launcher/Makefile new file mode 100755 index 0000000..efac5fa --- /dev/null +++ b/psp2launcher/Makefile @@ -0,0 +1,34 @@ +TITLE_ID = UAE2XXXXX +TARGET = Launcher +OBJS = main.o + +LIBS = -lSceAppMgr_stub + +PREFIX = arm-vita-eabi +CC = $(PREFIX)-gcc +CFLAGS = -Wl,-q -Wall +ASFLAGS = $(CFLAGS) + +all: builder/eboot.bin + +%.vpk: eboot.bin + vita-mksfoex -s TITLE_ID=$(TITLE_ID) "Launcher" param.sfo + vita-pack-vpk -s param.sfo -b eboot.bin $@ \ + -a assets/icon0.png=sce_sys/icon0.png \ + -a assets/bg.png=sce_sys/livearea/contents/bg.png \ + -a assets/startup.png=sce_sys/livearea/contents/startup.png \ + -a assets/template.xml=sce_sys/livearea/contents/template.xml \ + -a assets/args.txt=args.txt + +builder/eboot.bin: $(TARGET).velf + vita-make-fself -s $< $@ + +%.velf: %.elf + vita-elf-create $< $@ + +$(TARGET).elf: $(OBJS) + $(CC) $(CFLAGS) $^ $(LIBS) -o $@ + +clean: + @rm -rf $(TARGET).vpk $(TARGET).velf $(TARGET).elf $(OBJS) \ + eboot.bin param.sfo diff --git a/psp2launcher/builder/assets/bg.png b/psp2launcher/builder/assets/bg.png new file mode 100644 index 0000000..6040f4b Binary files /dev/null and b/psp2launcher/builder/assets/bg.png differ diff --git a/psp2launcher/builder/assets/icon0.png b/psp2launcher/builder/assets/icon0.png new file mode 100644 index 0000000..0bcc403 Binary files /dev/null and b/psp2launcher/builder/assets/icon0.png differ diff --git a/psp2launcher/builder/assets/startup.png b/psp2launcher/builder/assets/startup.png new file mode 100644 index 0000000..f49fdb5 Binary files /dev/null and b/psp2launcher/builder/assets/startup.png differ diff --git a/psp2launcher/builder/assets/template.xml b/psp2launcher/builder/assets/template.xml new file mode 100755 index 0000000..60e0b8e --- /dev/null +++ b/psp2launcher/builder/assets/template.xml @@ -0,0 +1,11 @@ + + + + + bg.png + + + + startup.png + + \ No newline at end of file diff --git a/psp2launcher/builder/build.bat b/psp2launcher/builder/build.bat new file mode 100755 index 0000000..41b6dad --- /dev/null +++ b/psp2launcher/builder/build.bat @@ -0,0 +1,6 @@ +@set /p title="Insert bubble name: " +@set /p rom="Insert rom name: " +@set /p id="Insert bubble title ID (9 characters [NOTE: Only UPPERCASE letters or numbers]): " +@echo|set /p="%rom%"> "assets/args.txt" +vita-mksfoex -s TITLE_ID=%id% "%title%" param.sfo +vita-pack-vpk -s param.sfo -b eboot.bin "%title%.vpk" -a assets/icon0.png=sce_sys/icon0.png -a assets/bg.png=sce_sys/livearea/contents/bg.png -a assets/startup.png=sce_sys/livearea/contents/startup.png -a assets/template.xml=sce_sys/livearea/contents/template.xml -a assets/args.txt=args.txt \ No newline at end of file diff --git a/psp2launcher/builder/vita-mksfoex.exe b/psp2launcher/builder/vita-mksfoex.exe new file mode 100755 index 0000000..0da9a2a Binary files /dev/null and b/psp2launcher/builder/vita-mksfoex.exe differ diff --git a/psp2launcher/builder/vita-pack-vpk.exe b/psp2launcher/builder/vita-pack-vpk.exe new file mode 100755 index 0000000..b75a752 Binary files /dev/null and b/psp2launcher/builder/vita-pack-vpk.exe differ diff --git a/psp2launcher/main.c b/psp2launcher/main.c new file mode 100755 index 0000000..2b66f53 --- /dev/null +++ b/psp2launcher/main.c @@ -0,0 +1,23 @@ +#include +#include +#include +#include + +int main(int argc, const char *argv[]) { + char buffer[256]; + memset(buffer, 0, 256); + FILE *f = fopen("app0:args.txt", "rb"); + if (f) { + fread(buffer, 1, 256, f); + fclose(f); + char uri[512]; + sprintf(uri, "psgm:play?titleid=%s¶m=%s", "UAE4ALL00", buffer); + + sceAppMgrLaunchAppByUri(0xFFFFF, uri); + sceKernelDelayThread(1000); + } + + sceKernelExitProcess(0); + + return 0; +} diff --git a/src/filesys.cpp b/src/filesys.cpp index f5bbc7d..d8c7699 100755 --- a/src/filesys.cpp +++ b/src/filesys.cpp @@ -410,8 +410,11 @@ struct uaedev_mount_info *dup_mountinfo (struct uaedev_mount_info *mip) uip->volname = my_strdup (uip->volname); if (uip->rootdir) uip->rootdir = my_strdup (uip->rootdir); +#if !(defined __PSP2__) + // Broken in latest VitaSDK 20240214 (fdopen returns 0), causing crashes with hdf if (uip->hf.fd) uip->hf.fd = fdopen ( dup (fileno (uip->hf.fd)), uip->readonly ? "rb" : "r+b"); +#endif } return i2; } diff --git a/src/gp2x/menu/menu_config.cpp b/src/gp2x/menu/menu_config.cpp index 104c00b..92af894 100755 --- a/src/gp2x/menu/menu_config.cpp +++ b/src/gp2x/menu/menu_config.cpp @@ -1514,7 +1514,13 @@ void loadconfig(int general) } if (general == 1) - snprintf(path, 300, "%s/conf/uaeconfig.conf", launchDir); + if (config_load_filename[0] != 0) { + // custom config was specified as command line argument + snprintf(path, 300, "%s",config_load_filename); + } + else { + snprintf(path, 300, "%s/conf/uaeconfig.conf", launchDir); + } else if (general == 3) snprintf(path, 300, config_filename, launchDir); else if(general == 0) diff --git a/src/gp2x/menu/menu_main.cpp b/src/gp2x/menu/menu_main.cpp index ef51ae7..bbaa81a 100755 --- a/src/gp2x/menu/menu_main.cpp +++ b/src/gp2x/menu/menu_main.cpp @@ -78,6 +78,8 @@ extern char filename3[256]; extern char config_load_filename[300]; +extern bool resetOnStartingApp; + #ifdef __PSP2__ static const char *text_str_title= "----- UAE4All Vita " VERSION_MAJOR "." VERSION_MINOR " -----"; #else @@ -1019,10 +1021,18 @@ int run_mainMenu() raise_mainMenu(); end=0; draw_mainMenu(c); - while(!end) + if (!resetOnStartingApp) + { + while(!end) + { + draw_mainMenu(c); + end=key_mainMenu(&c); + } + } + else { - draw_mainMenu(c); - end=key_mainMenu(&c); + mainMenu_case = MAIN_MENU_CASE_RESET; + resetOnStartingApp = false; } unraise_mainMenu(); switch(mainMenu_case) diff --git a/src/gui.cpp b/src/gui.cpp index 332f9fb..caf616a 100755 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -206,14 +206,18 @@ int no_limiter = 0; #ifdef __SWITCH__ int singleJoycons = 0; // are single Joycons being used at the moment? void update_joycon_mode() { - int handheld = hidGetHandheldMode(); + int handheld; + if (appletGetOperationMode() == AppletOperationMode_Handheld) + handheld = 1; + else + handheld = 0; if (!handheld) { if (mainMenu_singleJoycons) { if (!singleJoycons) { singleJoycons = 1; for (int id=0; id<8; id++) { hidSetNpadJoyHoldType(HidNpadJoyHoldType_Horizontal); - hidScanInput(); + //hidScanInput(); hidSetNpadJoyAssignmentModeSingleByDefault((HidNpadIdType) id); } } @@ -247,7 +251,7 @@ void update_joycon_mode() { singleJoycons = 0; for (int id=0; id<8; id++) { hidSetNpadJoyHoldType(HidNpadJoyHoldType_Vertical); - hidScanInput(); + //hidScanInput(); hidSetNpadJoyAssignmentModeDual((HidNpadIdType) id); } } diff --git a/src/main.cpp b/src/main.cpp index cec3b0c..c701cf4 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -66,6 +66,8 @@ extern SDL_Surface *current_screenshot; #include //Touch input #include "psp2_touch.h" +//Custom bubble +#include #ifdef DEBUG_UAE4ALL #include #endif @@ -90,6 +92,9 @@ struct gui_info gui_data; char warning_buffer[256]; +bool resetOnStartingApp = false; +extern char config_load_filename[300]; + /* If you want to pipe printer output to a file, put something like * "cat >>printerfile.tmp" above. * The printer support was only tested with the driver "PostScript" on @@ -300,16 +305,30 @@ void real_main (int argc, char **argv) #ifdef GP2X gp2x_init(argc, argv); #endif - // Set everthing to default and clear HD settings - SetDefaultMenuSettings(1); - - loadconfig (1); + // Set everthing to default and clear HD settings + SetDefaultMenuSettings(1); + //Check if UAE4All2 was launched by a custom bubble +#if defined(__SWITCH__) + if (argc == 2) { + snprintf(config_load_filename, 300, argv[1]); + resetOnStartingApp = true; + } +#endif +#if defined(__PSP2__) // NOT __SWITCH__ + char boot_params[1024]; + sceAppMgrGetAppParam(boot_params); + if (strstr(boot_params,"psgm:play") && strstr(boot_params, "¶m=")) { + snprintf(config_load_filename, 300, strstr(boot_params, "¶m=") + 7); + resetOnStartingApp = true; + } +#endif + loadconfig (1); if (! graphics_setup ()) { - exit (1); + exit (1); } rtarea_init (); - hardfile_install(); + hardfile_install(); if (! setup_sound ()) { write_log ("Sound driver unavailable: Sound output disabled\n"); diff --git a/src/psp2/psp2-dirent.c b/src/psp2/psp2-dirent.c index 4aeae76..52a1423 100644 --- a/src/psp2/psp2-dirent.c +++ b/src/psp2/psp2-dirent.c @@ -33,7 +33,7 @@ DEALINGS IN THE SOFTWARE. #define SCE_ERRNO_MASK 0xFF -int mkdir(const char *path, mode_t mode) +/*int mkdir(const char *path, mode_t mode) { return sceIoMkdir(path, 0777); } @@ -42,7 +42,7 @@ int rmdir(const char *path) { return sceIoRmdir(path); } - +*/ struct DIR_ { SceUID uid; diff --git a/src/psp2/vita2d_fbo/lib/libvita2d.a b/src/psp2/vita2d_fbo/lib/libvita2d.a index a66e40f..58e07c5 100644 Binary files a/src/psp2/vita2d_fbo/lib/libvita2d.a and b/src/psp2/vita2d_fbo/lib/libvita2d.a differ