From 093a70482f693c179e3646c512acf649ebcebc37 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 14 Jul 2014 04:50:52 +0200 Subject: Get rid of PND_BUILD/RPI_BUILD/POLLUX_BUILD/GIZ_BUILD --- input.c | 302 ---------------------------------------------------------------- 1 file changed, 302 deletions(-) (limited to 'input.c') diff --git a/input.c b/input.c index f01c53d..fa1072e 100644 --- a/input.c +++ b/input.c @@ -346,257 +346,6 @@ void init_input() #endif -#if defined(GP2X_BUILD) || defined(PND_BUILD) - -extern u32 fps_debug; - -gui_action_type get_gui_input() -{ - gui_action_type new_button = CURSOR_NONE; - u32 buttons = gpsp_plat_joystick_read(); - u32 new_buttons; - - static u32 last_buttons = 0; - static u64 button_repeat_timestamp; - - delay_us(25000); - - new_buttons = (last_buttons ^ buttons) & buttons; - last_buttons = buttons; - - new_button = gpsp_plat_buttons_to_cursor(new_buttons); - if(new_button != CURSOR_NONE) - { - get_ticks_us(&button_repeat_timestamp); - button_repeat_state = BUTTON_HELD_INITIAL; - button_repeat = new_buttons; - cursor_repeat = new_button; - } - else - { - if(buttons & button_repeat) - { - u64 new_ticks; - get_ticks_us(&new_ticks); - - if(button_repeat_state == BUTTON_HELD_INITIAL) - { - if((new_ticks - button_repeat_timestamp) > - BUTTON_REPEAT_START) - { - new_button = cursor_repeat; - button_repeat_timestamp = new_ticks; - button_repeat_state = BUTTON_HELD_REPEAT; - } - } - - if(button_repeat_state == BUTTON_HELD_REPEAT) - { - if((new_ticks - button_repeat_timestamp) > - BUTTON_REPEAT_CONTINUE) - { - new_button = cursor_repeat; - button_repeat_timestamp = new_ticks; - } - } - } - } - - return new_button; -} - -u32 button_id_to_gba_mask[] = -{ - BUTTON_UP, - BUTTON_DOWN, - BUTTON_LEFT, - BUTTON_RIGHT, - BUTTON_A, - BUTTON_B, - BUTTON_L, - BUTTON_R, - BUTTON_START, - BUTTON_SELECT, - BUTTON_NONE, - BUTTON_NONE, - BUTTON_NONE, - BUTTON_NONE -}; - -u32 update_input() -{ - static u32 rapidfire_flag = 1; - static u32 last_buttons; - u32 handled_buttons; - u32 button_id; - u32 new_key = 0; - u32 buttons = gpsp_plat_joystick_read(); - u32 i; - -#ifdef GP2X_BUILD - if((buttons & GP2X_VOL_DOWN) && (buttons & GP2X_VOL_UP)) - { - buttons &= ~(GP2X_VOL_DOWN | GP2X_VOL_UP); - buttons |= GP2X_VOL_MIDDLE; - } - - /* for Wiz */ - if((buttons & GP2X_VOL_DOWN) && (buttons & GP2X_SELECT)) - { - buttons &= ~(GP2X_VOL_DOWN | GP2X_SELECT); - buttons |= GP2X_VOL_MIDDLE; - } - - last_buttons &= ~(GP2X_VOL_DOWN | GP2X_VOL_UP); -#endif - - handled_buttons = (last_buttons ^ buttons) & buttons; - last_buttons = buttons; - - for(i = 0; i < PLAT_BUTTON_COUNT; i++) - { - if(handled_buttons & button_plat_mask_to_config[i]) - button_id = gamepad_config_map[i]; - else - button_id = BUTTON_ID_NONE; - - switch(button_id) - { - case BUTTON_ID_MENU: - { - u16 *screen_copy = copy_screen(); - u32 ret_val = menu(screen_copy); - free(screen_copy); - - return ret_val; - } - - case BUTTON_ID_LOADSTATE: - { - char current_savestate_filename[512]; - get_savestate_filename_noshot(savestate_slot, - current_savestate_filename); - load_state(current_savestate_filename); - return 1; - } - - case BUTTON_ID_SAVESTATE: - { - char current_savestate_filename[512]; - u16 *current_screen = copy_screen(); - get_savestate_filename_noshot(savestate_slot, - current_savestate_filename); - save_state(current_savestate_filename, current_screen); - free(current_screen); - return 0; - } - - case BUTTON_ID_FASTFORWARD: - synchronize_flag ^= 1; - return 0; - -#ifdef GP2X_BUILD - case BUTTON_ID_VOLUP: - gp2x_sound_volume(1); - break; - - case BUTTON_ID_VOLDOWN: - gp2x_sound_volume(0); - break; -#endif - - case BUTTON_ID_FPS: - fps_debug ^= 1; - break; - } - - if(buttons & button_plat_mask_to_config[i]) - { - button_id = gamepad_config_map[i]; - if(button_id < BUTTON_ID_MENU) - { - new_key |= button_id_to_gba_mask[button_id]; - } - else - - if((button_id >= BUTTON_ID_RAPIDFIRE_A) && - (button_id <= BUTTON_ID_RAPIDFIRE_L)) - { - rapidfire_flag ^= 1; - if(rapidfire_flag) - { - new_key |= button_id_to_gba_mask[button_id - - BUTTON_ID_RAPIDFIRE_A + BUTTON_ID_A]; - } - else - { - new_key &= ~button_id_to_gba_mask[button_id - - BUTTON_ID_RAPIDFIRE_A + BUTTON_ID_A]; - } - } - } - } - - if((new_key | key) != key) - trigger_key(new_key); - - key = new_key; - - io_registers[REG_P1] = (~key) & 0x3FF; - - return 0; -} - -void init_input() -{ - -} - -#endif - - -#if defined(RPI_BUILD) - -u32 key_map(SDLKey key_sym) -{ - switch(key_sym) - { - case SDLK_a: - return BUTTON_L; - - case SDLK_s: - return BUTTON_R; - - case SDLK_DOWN: - return BUTTON_DOWN; - - case SDLK_UP: - return BUTTON_UP; - - case SDLK_LEFT: - return BUTTON_LEFT; - - case SDLK_RIGHT: - return BUTTON_RIGHT; - - case SDLK_RETURN: - return BUTTON_START; - - case SDLK_BACKSPACE: - return BUTTON_SELECT; - - case SDLK_x: - return BUTTON_B; - - case SDLK_z: - return BUTTON_A; - - default: - return BUTTON_NONE; - } -} -#endif - #if defined(PC_BUILD) u32 key_map(SDLKey key_sym) @@ -637,8 +386,6 @@ u32 key_map(SDLKey key_sym) return BUTTON_NONE; } } -#endif -#if defined(PC_BUILD) || defined(RPI_BUILD) u32 joy_map(u32 button) { @@ -717,40 +464,6 @@ gui_action_type get_gui_input() } } break; -#ifdef RPI_BUILD - case SDL_JOYBUTTONDOWN: - { - switch (event.jbutton.button) - { - case 2: - gui_action = CURSOR_BACK; - break; - - case 1: - gui_action = CURSOR_EXIT; - break; - - case 0: - gui_action = CURSOR_SELECT; - break; - } - } - break; - - case SDL_JOYAXISMOTION: - { - if (event.jaxis.axis==0) { //Left-Right - if (event.jaxis.value < -3200) gui_action = CURSOR_LEFT; - else if (event.jaxis.value > 3200) gui_action = CURSOR_RIGHT; - } - if (event.jaxis.axis==1) { //Up-Down - if (event.jaxis.value < -3200) gui_action = CURSOR_UP; - else if (event.jaxis.value > 3200) gui_action = CURSOR_DOWN; - } - } - break; - -#endif default: break; } @@ -875,21 +588,6 @@ u32 update_input() key &= ~(joy_map(event.jbutton.button)); break; } -#ifdef RPI_BUILD - case SDL_JOYAXISMOTION: - { - if (event.jaxis.axis==0) { //Left-Right - key &= ~(BUTTON_LEFT|BUTTON_RIGHT); - if (event.jaxis.value < -3200) key |= BUTTON_LEFT; - else if (event.jaxis.value > 3200) key |= BUTTON_RIGHT; - } - if (event.jaxis.axis==1) { //Up-Down - key &= ~(BUTTON_UP|BUTTON_DOWN); - if (event.jaxis.value < -3200) key |= BUTTON_UP; - else if (event.jaxis.value > 3200) key |= BUTTON_DOWN; - } - break; -#endif } } } -- cgit v1.2.3