//FIXME: Cellframework2 input stuff needs to be changed static int CellinpState(int nCode) { uint32_t numPadsConnected = 0; uint64_t pads_connected = cell_pad_input_pads_connected(); uint64_t new_state_p1 = cell_pad_input_poll_device(0); uint64_t pausemenu_condition = ArcadeJoystick ? (CTRL_SELECT(new_state_p1) && CTRL_START(new_state_p1)) : (CTRL_L2(new_state_p1) && CTRL_R2(new_state_p1) && CTRL_R1(new_state_p1)); if (nCode < 0) return 0; if (DoReset) { if (nCode == FBK_F3) { audio_stop(); is_running = 0; DoReset = false; return 1; } } numPadsConnected = cell_pad_input_pads_connected(); switch (nCode) { case P1_COIN: return CTRL_SELECT(new_state_p1); case P1_START: return CTRL_START(new_state_p1); case P1_UP: return ((CTRL_UP(new_state_p1) | CTRL_LSTICK_UP(new_state_p1)) != 0); case P1_DOWN: return ((CTRL_DOWN(new_state_p1) | CTRL_LSTICK_DOWN(new_state_p1)) != 0); case P1_LEFT: return ((CTRL_LEFT(new_state_p1) | CTRL_LSTICK_LEFT(new_state_p1)) != 0); case P1_RIGHT: return ((CTRL_RIGHT(new_state_p1) | CTRL_LSTICK_RIGHT(new_state_p1)) != 0); case P1_FIRE1: return CTRL_CROSS(new_state_p1); case P1_FIRE2: return CTRL_CIRCLE(new_state_p1); case P1_FIRE3: return CTRL_SQUARE(new_state_p1); case P1_FIRE4: return CTRL_TRIANGLE(new_state_p1); case P1_FIRE5: return CTRL_L1(new_state_p1); case P1_FIRE6: return CTRL_R1(new_state_p1); case 0x88: return CTRL_L2(new_state_p1); case 0x8A: return CTRL_R2(new_state_p1); case 0x3b: return CTRL_L3(new_state_p1); case P1_SERVICE: return CTRL_R3(new_state_p1); case 0x21: return CTRL_R2(new_state_p1); default: break; } if (numPadsConnected > 1) { uint64_t new_state_p2 = cell_pad_input_poll_device(1); switch (nCode) { case P2_COIN: return CTRL_SELECT(new_state_p2); case P2_START: return CTRL_START(new_state_p2); case P2_UP: return ((CTRL_UP(new_state_p2) | CTRL_LSTICK_UP(new_state_p2)) != 0); case P2_DOWN: return ((CTRL_DOWN(new_state_p2) | CTRL_LSTICK_DOWN(new_state_p2)) != 0); case P2_LEFT: return ((CTRL_LEFT(new_state_p2) | CTRL_LSTICK_LEFT(new_state_p2)) != 0); case P2_RIGHT: return ((CTRL_RIGHT(new_state_p2) | CTRL_LSTICK_RIGHT(new_state_p2)) != 0); case P2_FIRE1: return CTRL_CROSS(new_state_p2); case P2_FIRE2: return CTRL_CIRCLE(new_state_p2); case P2_FIRE3: return CTRL_SQUARE(new_state_p2); case P2_FIRE4: return CTRL_TRIANGLE(new_state_p2); case P2_FIRE5: return CTRL_L1(new_state_p2); case P2_FIRE6: return CTRL_R1(new_state_p2); case 0x4088: return CTRL_L2(new_state_p2); case 0x408A: return CTRL_R2(new_state_p2); case 0x408b: return CTRL_L3(new_state_p2); case 0x408c: return CTRL_R3(new_state_p2); } } if (numPadsConnected > 2) { uint64_t new_state_p3 = cell_pad_input_poll_device(2); switch (nCode) { case P3_COIN: return CTRL_SELECT(new_state_p3); case P3_START: return CTRL_START(new_state_p3); case P3_UP: return ((CTRL_UP(new_state_p3) | CTRL_LSTICK_UP(new_state_p3)) != 0); case P3_DOWN: return ((CTRL_DOWN(new_state_p3) | CTRL_LSTICK_DOWN(new_state_p3)) != 0); case P3_LEFT: return ((CTRL_LEFT(new_state_p3) | CTRL_LSTICK_LEFT(new_state_p3)) != 0); case P3_RIGHT: return ((CTRL_RIGHT(new_state_p3) | CTRL_LSTICK_RIGHT(new_state_p3)) != 0); case P3_FIRE1: return CTRL_CROSS(new_state_p3); case P3_FIRE2: return CTRL_CIRCLE(new_state_p3); case P3_FIRE3: return CTRL_SQUARE(new_state_p3); case P3_FIRE4: return CTRL_TRIANGLE(new_state_p3); case P3_FIRE5: return CTRL_L1(new_state_p3); case P3_FIRE6: return CTRL_R1(new_state_p3); case 0x4188: return CTRL_L2(new_state_p3); case 0x418A: return CTRL_R2(new_state_p3); case 0x418b: return CTRL_L3(new_state_p3); case 0x418c: return CTRL_R3(new_state_p3); } } if (numPadsConnected > 3) { uint64_t new_state_p4 = cell_pad_input_poll_device(3); switch (nCode) { case P4_COIN: return CTRL_SELECT(new_state_p4); case P4_START: return CTRL_START(new_state_p4); case P4_UP: return ((CTRL_UP(new_state_p4) | CTRL_LSTICK_UP(new_state_p4)) != 0); case P4_DOWN: return ((CTRL_DOWN(new_state_p4) | CTRL_LSTICK_DOWN(new_state_p4)) != 0); case P4_LEFT: return ((CTRL_LEFT(new_state_p4) | CTRL_LSTICK_LEFT(new_state_p4)) != 0); case P4_RIGHT: return ((CTRL_RIGHT(new_state_p4) | CTRL_LSTICK_RIGHT(new_state_p4)) != 0); case P4_FIRE1: return CTRL_CROSS(new_state_p4); case P4_FIRE2: return CTRL_CIRCLE(new_state_p4); case P4_FIRE3: return CTRL_SQUARE(new_state_p4); case P4_FIRE4: return CTRL_TRIANGLE(new_state_p4); case P4_FIRE5: return CTRL_L1(new_state_p4); case P4_FIRE6: return CTRL_R1(new_state_p4); case 0x4288: return CTRL_L2(new_state_p4); case 0x428A: return CTRL_R2(new_state_p4); case 0x428b: return CTRL_L3(new_state_p4); case 0x428c: return CTRL_R3(new_state_p4); } } return 0; }
static void select_rom(void) { char newpath[1024]; uint64_t state, diff_state, button_was_pressed; static uint64_t old_state = 0; state = cell_pad_input_poll_device(0); diff_state = old_state ^ state; button_was_pressed = old_state & diff_state; browser_update(&browser); if (CTRL_SELECT(button_was_pressed)) { menuStackindex++; menuStack[menuStackindex] = menu_generalvideosettings; } if (CTRL_START(button_was_pressed)) filebrowser_reset_start_directory(&browser, "/", ROM_EXTENSIONS); if (CTRL_CROSS(button_was_pressed)) { if(FILEBROWSER_IS_CURRENT_A_DIRECTORY(browser)) { /*if 'filename' is in fact '..' - then pop back directory instead of adding '..' to filename path */ if(browser.currently_selected == 0) { old_state = state; filebrowser_pop_directory(&browser); } else { const char * separatorslash = (strcmp(FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmpBrowser),"/") == 0) ? "" : "/"; snprintf(newpath, sizeof(newpath), "%s%s%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), separatorslash, FILEBROWSER_GET_CURRENT_FILENAME(browser)); filebrowser_push_directory(&browser, newpath, true); } } else if (FILEBROWSER_IS_CURRENT_A_FILE(browser)) { char rom_path_temp[MAX_PATH_LENGTH]; snprintf(rom_path_temp, sizeof(rom_path_temp), "%s/%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), FILEBROWSER_GET_CURRENT_FILENAME(browser)); if (strcmp(rom_path_temp, current_rom) != 0 || sgb_border_change) { snprintf(current_rom, sizeof(current_rom), rom_path_temp); vba_init_rom(); } else { if(Settings.EmulatedSystem == IMAGE_GBA) CPUReset(); else gbReset(); } menu_is_running = 0; is_running =1; mode_switch = MODE_EMULATION; old_state = state; return; } } if (FILEBROWSER_IS_CURRENT_A_DIRECTORY(browser)) { if(!strcmp(FILEBROWSER_GET_CURRENT_FILENAME(browser),"app_home") || !strcmp(FILEBROWSER_GET_CURRENT_FILENAME(browser),"host_root")) cellDbgFontPrintf(0.09f, 0.83f, 0.91f, RED, "WARNING - This path only works on DEX PS3 systems. Do not attempt to open\n this directory on CEX PS3 systems, or you might have to restart!"); else if(!strcmp(FILEBROWSER_GET_CURRENT_FILENAME(browser),"..")) cellDbgFontPrintf(0.09f, 0.83f, 0.91f, LIGHTBLUE, "INFO - Press X to go back to the previous directory."); else cellDbgFontPrintf(0.09f, 0.83f, 0.91f, LIGHTBLUE, "INFO - Press X to enter the directory."); } if (FILEBROWSER_IS_CURRENT_A_FILE(browser)) cellDbgFontPrintf(0.09f, 0.83f, 0.91f, LIGHTBLUE, "INFO - Press X to load the game. "); cellDbgFontPuts (0.09f, 0.05f, Emulator_GetFontSize(), RED, "FILE BROWSER"); cellDbgFontPrintf (0.7f, 0.05f, 0.82f, WHITE, "%s v%s", EMULATOR_NAME, EMULATOR_VERSION); cellDbgFontPrintf (0.09f, 0.09f, Emulator_GetFontSize(), YELLOW, "PATH: %s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser)); cellDbgFontPuts (0.09f, 0.93f, Emulator_GetFontSize(), YELLOW, "L3 + R3 - resume game SELECT - Settings screen"); cellDbgFontDraw(); browser_render(&browser); old_state = state; }