Permalink
Browse files

[ORBIS] Add Menu toggle combo and some cleaning

  • Loading branch information...
frangarcj committed Jan 2, 2019
1 parent 63044b2 commit 4204bfc67f6e28535e60f3fc097f661aa32f51ad
Showing with 2 additions and 13 deletions.
  1. +1 −1 config.def.h
  2. +1 −12 input/drivers_joypad/ps4_joypad.c
@@ -402,7 +402,7 @@ static bool default_screenshots_in_content_dir = false;
static unsigned menu_toggle_gamepad_combo = INPUT_TOGGLE_L3_R3;
#elif defined(VITA)
static unsigned menu_toggle_gamepad_combo = INPUT_TOGGLE_L1_R1_START_SELECT;
#elif defined(SWITCH)
#elif defined(SWITCH) || defined(ORBIS)
static unsigned menu_toggle_gamepad_combo = INPUT_TOGGLE_START_SELECT;
#else
static unsigned menu_toggle_gamepad_combo = INPUT_TOGGLE_NONE;
@@ -134,16 +134,13 @@ static bool ps4_joypad_init(void *data)

static bool ps4_joypad_button(unsigned port_num, uint16_t joykey)
{
RARCH_LOG("[JOYPAD] BUTTONS %x\n" , port_num);
if (port_num >= PS4_MAX_ORBISPADS)
return false;
RARCH_LOG("[JOYPAD] BUTTONS %x\n" , (pad_state[port_num] & (UINT64_C(1) << joykey)));
return (pad_state[port_num] & (UINT64_C(1) << joykey));
}

static void ps4_joypad_get_buttons(unsigned port_num, input_bits_t *state)
{
RARCH_LOG("[JOYPAD] BUTTONS %x\n" , port_num);
if (port_num < PS4_MAX_ORBISPADS)
{
BITS_COPY16_PTR( state, pad_state[port_num] );
@@ -162,7 +159,6 @@ static void ps4_joypad_poll(void)
unsigned player;
unsigned players_count = num_players;
ScePadData buttons;
RARCH_LOG("[JOYPAD] Polling \n");

for (player = 0; player < players_count; player++)
{
@@ -171,19 +167,17 @@ static void ps4_joypad_poll(void)
unsigned p = player;

int ret = scePadReadState(ds_joypad_states[player].handle,&buttons);
RARCH_LOG("[JOYPAD] Returned %x\n" , ret);
if (ret == 0)
{
int32_t state_tmp = buttons.buttons;
RARCH_LOG("[JOYPAD] BUTTONS %x\n" , buttons.buttons);
pad_state[i] = 0;

pad_state[i] |= (state_tmp & ORBISPAD_LEFT) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_LEFT) : 0;
pad_state[i] |= (state_tmp & ORBISPAD_DOWN) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_DOWN) : 0;
pad_state[i] |= (state_tmp & ORBISPAD_RIGHT) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_RIGHT) : 0;
pad_state[i] |= (state_tmp & ORBISPAD_UP) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_UP) : 0;
pad_state[i] |= (state_tmp & ORBISPAD_OPTIONS) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_START) : 0;
//pad_state[i] |= (state_tmp & ORBISPAD_SELECT) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_SELECT) : 0;
pad_state[i] |= (state_tmp & ORBISPAD_TOUCH_PAD) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_SELECT) : 0;
pad_state[i] |= (state_tmp & ORBISPAD_TRIANGLE) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_X) : 0;
pad_state[i] |= (state_tmp & ORBISPAD_SQUARE) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_Y) : 0;
pad_state[i] |= (state_tmp & ORBISPAD_CROSS) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_B) : 0;
@@ -194,24 +188,19 @@ static void ps4_joypad_poll(void)
pad_state[i] |= (state_tmp & ORBISPAD_L2) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_L2) : 0;
pad_state[i] |= (state_tmp & ORBISPAD_R3) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_R3) : 0;
pad_state[i] |= (state_tmp & ORBISPAD_L3) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_L3) : 0;
RARCH_LOG("[JOYPAD] BUTTONS %x\n" , pad_state[i]);
}
}

}

static bool ps4_joypad_query_pad(unsigned pad)
{
RARCH_LOG("[JOYPAD] BUTTONS %x\n" , pad);

return pad < PS4_MAX_ORBISPADS && pad_state[pad];
}

static bool ps4_joypad_rumble(unsigned pad,
enum retro_rumble_effect effect, uint16_t strength)
{
RARCH_LOG("[JOYPAD] BUTTONS %x\n" , pad);

return false;
}

0 comments on commit 4204bfc

Please sign in to comment.