Esempio n. 1
0
static void
handle_pads(glw_ps3_t *gp)
{
  PadInfo2 padinfo2;
  int i;

  if(gp->osk_widget) {
    clear_btns();
    return;
  }

  // Check the pads.
  ioPadGetInfo2(&padinfo2);
  for(i=0; i<7; i++){
    if(!padinfo2.port_status[i])
      continue;

    if(padinfo2.device_type[i] == 4) {
      uint32_t type = 4;
      int r = ioPadGetDataExtra(i, &type, &paddata[i]);

      if(r == 0) {
	int btn = paddata[i].button[25];
	if(btn != remote_last_btn[i]) {
	  if(remote_last_btn[i] < 0xff)
	    handle_btn(gp, i, bd_to_local_map[remote_last_btn[i]], 0, 0, 0);
	  remote_last_btn[i] = btn;
	}

	if(btn != 0xff)
	  handle_btn(gp, i, bd_to_local_map[btn], 1, 0, 0);
      }
      continue;
    }


    ioPadGetData(i, &paddata[i]);
    PadData *pd = &paddata[i];
    int sel = !!pd->BTN_SELECT;
    handle_btn(gp, i, BTN_LEFT,     pd->BTN_LEFT,     sel, pd->PRE_LEFT);
    handle_btn(gp, i, BTN_UP,       pd->BTN_UP,       sel, pd->PRE_UP);
    handle_btn(gp, i, BTN_RIGHT,    pd->BTN_RIGHT,    sel, pd->PRE_RIGHT);
    handle_btn(gp, i, BTN_DOWN,     pd->BTN_DOWN,     sel, pd->PRE_DOWN);
    handle_btn(gp, i, BTN_CROSS,    pd->BTN_CROSS,    sel, pd->PRE_CROSS);
    handle_btn(gp, i, BTN_CIRCLE,   pd->BTN_CIRCLE,   sel, pd->PRE_CIRCLE);
    handle_btn(gp, i, BTN_TRIANGLE, pd->BTN_TRIANGLE, sel, pd->PRE_TRIANGLE);
    handle_btn(gp, i, BTN_SQUARE,   pd->BTN_SQUARE,   sel, pd->PRE_SQUARE);
    handle_btn(gp, i, BTN_START,    pd->BTN_START,    sel, 0);
    handle_btn(gp, i, BTN_R1,       pd->BTN_R1,       sel, pd->PRE_R1);
    handle_btn(gp, i, BTN_L1,       pd->BTN_L1,       sel, pd->PRE_L1);
    handle_btn(gp, i, BTN_R3,       pd->BTN_R3,       sel, 0);
    handle_btn(gp, i, BTN_L3,       pd->BTN_L3,       sel, 0);


    if(gp->gp_seekmode == 0 || (gp->gp_seekmode == 1 && sel)) {
      handle_seek(gp, i, 1,        pd->BTN_R2,       pd->PRE_R2);
      handle_seek(gp, i, -1,       pd->BTN_L2,       pd->PRE_L2);
    }
  }
}
Esempio n. 2
0
static void
handle_pads(glw_ps3_t *gp)
{
  PadInfo2 padinfo2;
  int i;

  // Check the pads.
  ioPadGetInfo2(&padinfo2);
  for(i=0; i<MAX_PADS; i++){
    if(!padinfo2.port_status[i])
      continue;

    if(padinfo2.device_type[i] == 4) {
      uint32_t type = 4;
      int r = ioPadGetDataExtra(i, &type, &paddata[i]);

      if(r == 0) {
	int btn = paddata[i].button[25];
	if(btn != remote_last_btn[i]) {
	  if(remote_last_btn[i] < 0xff)
	    handle_btn(gp, i, bd_to_local_map[remote_last_btn[i]], 0);
	  remote_last_btn[i] = btn;
	}

	if(btn != 0xff)
	  handle_btn(gp, i, bd_to_local_map[btn], 1);
      }
      continue;
    }


    ioPadGetData(i, &paddata[i]);
    PadData *pd = &paddata[i];
    handle_btn(gp, i, BTN_LEFT,     pd->BTN_LEFT);
    handle_btn(gp, i, BTN_UP,       pd->BTN_UP);
    handle_btn(gp, i, BTN_RIGHT,    pd->BTN_RIGHT);
    handle_btn(gp, i, BTN_DOWN,     pd->BTN_DOWN);
    handle_btn(gp, i, BTN_CROSS,    pd->BTN_CROSS);
    handle_btn(gp, i, BTN_CIRCLE,   pd->BTN_CIRCLE);
    handle_btn(gp, i, BTN_TRIANGLE, pd->BTN_TRIANGLE);
    handle_btn(gp, i, BTN_SQUARE,   pd->BTN_SQUARE);
    handle_btn(gp, i, BTN_START,    pd->BTN_START);
    handle_btn(gp, i, BTN_SELECT,   pd->BTN_SELECT);
    handle_btn(gp, i, BTN_R1,       pd->BTN_R1);
    handle_btn(gp, i, BTN_L1,       pd->BTN_L1);
    handle_btn(gp, i, BTN_R2,       pd->BTN_R2);
    handle_btn(gp, i, BTN_L2,       pd->BTN_L2);
    handle_btn(gp, i, BTN_R3,       pd->BTN_R3);
    handle_btn(gp, i, BTN_L3,       pd->BTN_L3);
  }
}