diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7750454..5674ea7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -201,11 +201,13 @@ jobs: run: make createzip - name: Build Apollo App Package - run: make + run: | + make + mv IV0000-APOL00004_00-APOLLO0000000PS4.pkg apollo-ps4-build_${{ env.sha_name }}.pkg - name: Push package artifact uses: actions/upload-artifact@v3 with: name: apollo-ps4-build_${{ env.sha_name }} - path: IV0000-APOL00004_00-APOLLO0000000PS4.pkg + path: apollo-ps4-build_${{ env.sha_name }}.pkg if-no-files-found: error diff --git a/include/orbisPad.h b/include/orbisPad.h index 1f012d4..abc984d 100644 --- a/include/orbisPad.h +++ b/include/orbisPad.h @@ -35,9 +35,10 @@ typedef struct OrbisPadConfig unsigned int buttonsHold; unsigned int idle; int padHandle; + int crossButtonOK; }OrbisPadConfig; -int orbisPadInit(); +int orbisPadInit(void); void orbisPadFinish(); OrbisPadConfig *orbisPadGetConf(); bool orbisPadGetButtonHold(unsigned int filter); diff --git a/source/main.c b/source/main.c index 9ef4f8e..e0f8a8b 100644 --- a/source/main.c +++ b/source/main.c @@ -71,22 +71,6 @@ SDL_Renderer* renderer; // SDL software renderer uint32_t* texture_mem; // Pointers to texture memory uint32_t* free_mem; // Pointer after last texture - -const char * menu_pad_help[TOTAL_MENU_IDS] = { NULL, //Main - "\x10 Select \x13 Back \x12 Details \x11 Refresh", //Trophy list - "\x10 Select \x13 Back \x12 Details \x11 Refresh", //USB list - "\x10 Select \x13 Back \x12 Details \x11 Refresh", //HDD list - "\x10 Select \x13 Back \x11 Refresh", //Online list - "\x10 Select \x13 Back \x11 Refresh", //User backup - "\x10 Select \x13 Back", //Options - "\x13 Back", //About - "\x10 Select \x12 View Code \x13 Back", //Select Cheats - "\x13 Back", //View Cheat - "\x10 Select \x13 Back", //Cheat Option - "\x13 Back", //View Details - "\x10 Value Up \x11 Value Down \x13 Exit", //Hex Editor - }; - /* * HDD save list */ @@ -152,6 +136,67 @@ save_list_t user_backup = { .UpdatePath = NULL, }; +static const char* get_button_prompts(int menu_id) +{ + const char* prompt = NULL; + + switch (menu_id) + { + case MENU_TROPHIES: + case MENU_USB_SAVES: + case MENU_HDD_SAVES: + prompt = "\x10 Select \x13 Back \x12 Details \x11 Refresh"; + break; + + case MENU_USER_BACKUP: + case MENU_ONLINE_DB: + prompt = "\x10 Select \x13 Back \x11 Refresh"; + break; + + case MENU_SETTINGS: + case MENU_CODE_OPTIONS: + prompt = "\x10 Select \x13 Back"; + break; + + case MENU_CREDITS: + case MENU_PATCH_VIEW: + case MENU_SAVE_DETAILS: + prompt = "\x13 Back"; + break; + + case MENU_PATCHES: + prompt = "\x10 Select \x12 View Code \x13 Back"; + break; + + case MENU_HEX_EDITOR: + prompt = "\x10 Value Up \x11 Value Down \x13 Exit"; + break; + + case MENU_MAIN_SCREEN: + default: + prompt = ""; + break; + } + + return prompt; +} + +static void helpFooter(void) +{ + u8 alpha = 0xFF; + + if (apollo_config.doAni && orbisPadGetConf()->idle > 0x100) + { + int dec = (orbisPadGetConf()->idle - 0x100) * 2; + alpha = (dec > alpha) ? 0 : (alpha - dec); + } + + SetFontSize(APP_FONT_SIZE_DESCRIPTION); + SetFontAlign(FONT_ALIGN_SCREEN_CENTER); + SetFontColor(APP_FONT_COLOR | alpha, 0); + DrawString(0, SCREEN_HEIGHT - 94, get_button_prompts(menu_id)); + SetFontAlign(FONT_ALIGN_LEFT); +} static int initPad() { @@ -355,7 +400,7 @@ void update_db_path(char* path) strcpy(path, apollo_config.save_db); } -static void registerSpecialChars() +static void registerSpecialChars(void) { // Register save tags RegisterSpecialCharacter(CHAR_TAG_PS1, 2, 1.5, &menu_textures[tag_ps1_png_index]); @@ -374,10 +419,10 @@ static void registerSpecialChars() RegisterSpecialCharacter(CHAR_TAG_TRANSFER, 0, 1.0, &menu_textures[tag_transfer_png_index]); // Register button icons - RegisterSpecialCharacter(CHAR_BTN_X, 0, 1.2, &menu_textures[footer_ico_cross_png_index]); + RegisterSpecialCharacter(orbisPadGetConf()->crossButtonOK ? CHAR_BTN_X : CHAR_BTN_O, 0, 1.2, &menu_textures[footer_ico_cross_png_index]); RegisterSpecialCharacter(CHAR_BTN_S, 0, 1.2, &menu_textures[footer_ico_square_png_index]); RegisterSpecialCharacter(CHAR_BTN_T, 0, 1.2, &menu_textures[footer_ico_triangle_png_index]); - RegisterSpecialCharacter(CHAR_BTN_O, 0, 1.2, &menu_textures[footer_ico_circle_png_index]); + RegisterSpecialCharacter(orbisPadGetConf()->crossButtonOK ? CHAR_BTN_O : CHAR_BTN_X, 0, 1.2, &menu_textures[footer_ico_circle_png_index]); // Register trophy icons RegisterSpecialCharacter(CHAR_TRP_BRONZE, 2, 0.9f, &menu_textures[trp_bronze_png_index]); @@ -584,24 +629,7 @@ s32 main(s32 argc, const char* argv[]) drawScene(); //Draw help - if (menu_pad_help[menu_id]) - { - u8 alpha = 0xFF; - if (orbisPadGetConf()->idle > 0x100) - { - int dec = (orbisPadGetConf()->idle - 0x100) * 2; - if (dec > alpha) - dec = alpha; - alpha -= dec; - } - - SetFontSize(APP_FONT_SIZE_DESCRIPTION); - SetCurrentFont(font_adonais_regular); - SetFontAlign(FONT_ALIGN_SCREEN_CENTER); - SetFontColor(APP_FONT_COLOR | alpha, 0); - DrawString(0, SCREEN_HEIGHT - 94, (char *)menu_pad_help[menu_id]); - SetFontAlign(FONT_ALIGN_LEFT); - } + helpFooter(); #ifdef APOLLO_ENABLE_LOGGING // Calculate FPS and ms/frame diff --git a/source/menu_options.c b/source/menu_options.c index 411ae20..f558c58 100644 --- a/source/menu_options.c +++ b/source/menu_options.c @@ -6,6 +6,7 @@ #include "menu.h" #include "menu_gui.h" #include "libfont.h" +#include "orbisPad.h" static void _draw_OptionsMenu(u8 alpha) { @@ -32,7 +33,7 @@ static void _draw_OptionsMenu(u8 alpha) DrawTexture(&menu_textures[c], OPTION_ITEM_OFF - 29, y_off, 0, menu_textures[c].width, menu_textures[c].height, 0xFFFFFF00 | alpha); break; case APP_OPTION_CALL: - DrawTexture(&menu_textures[footer_ico_cross_png_index], OPTION_ITEM_OFF - 29, y_off+2, 0, menu_textures[footer_ico_cross_png_index].width, menu_textures[footer_ico_cross_png_index].height, 0xFFFFFF00 | alpha); + DrawTexture(&menu_textures[orbisPadGetConf()->crossButtonOK ? footer_ico_cross_png_index : footer_ico_circle_png_index], OPTION_ITEM_OFF - 29, y_off+2, 0, menu_textures[footer_ico_cross_png_index].width, menu_textures[footer_ico_cross_png_index].height, 0xFFFFFF00 | alpha); break; case APP_OPTION_LIST: SetFontAlign(FONT_ALIGN_CENTER); diff --git a/source/orbisPad.c b/source/orbisPad.c index aae118f..159a79b 100644 --- a/source/orbisPad.c +++ b/source/orbisPad.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "orbisPad.h" #define LOG dbglogger_log @@ -103,6 +104,9 @@ bool orbisPadGetButtonHold(unsigned int filter) bool orbisPadGetButtonPressed(unsigned int filter) { + if (!orbisPadConf.crossButtonOK && (filter & (ORBIS_PAD_BUTTON_CROSS|ORBIS_PAD_BUTTON_CIRCLE))) + filter ^= (ORBIS_PAD_BUTTON_CROSS|ORBIS_PAD_BUTTON_CIRCLE); + if((orbisPadConf.buttonsPressed&filter)==filter) { orbisPadConf.buttonsPressed ^= filter; @@ -173,7 +177,7 @@ int orbisPadUpdate() return -1; } -int orbisPadInit() +int orbisPadInit(void) { int ret; OrbisUserServiceInitializeParams param; @@ -214,6 +218,14 @@ int orbisPadInit() return -1; } + ret = sceSystemServiceParamGetInt(ORBIS_SYSTEM_SERVICE_PARAM_ID_ENTER_BUTTON_ASSIGN, &orbisPadConf.crossButtonOK); + if (ret < 0) + { + LOG("sceSystemServiceParamGetInt error 0x%08X", ret); + LOG("Failed to obtain ORBIS_SYSTEM_SERVICE_PARAM_ID_ENTER_BUTTON_ASSIGN info!, assigning X as main button."); + orbisPadConf.crossButtonOK = 1; + } + orbispad_initialized=1; g_time = timeInMilliseconds(); LOG("ORBISPAD initialized: scePadOpen return handle 0x%X", orbisPadConf.padHandle);