Beispiel #1
0
void UpdateInputState(u32 port)
{
  static char key = 0;

  kcode[port] = x11_dc_buttons;
  rt[port] = 0;
  lt[port] = 0;

  #if defined(TARGET_EMSCRIPTEN)
    return;
  #endif

  HandleJoystick(port);
  HandleKb(port);

  #if defined(TARGET_GCW0) || defined(TARGET_PANDORA)
    return;
  #endif

  for(;;)
  {
    key = 0;
    read(STDIN_FILENO, &key, 1);

    if (0  == key || EOF == key) { break; }
    if ('k' == key) { KillTex=true; }

    #ifdef TARGET_PANDORA
        if (' ' == key) { kcode[port] &= ~Btn_C; }
        if ('6' == key) { kcode[port] &= ~Btn_A; }
        if ('O' == key) { kcode[port] &= ~Btn_B; }
        if ('5' == key) { kcode[port] &= ~Btn_Y; }
        if ('H' == key) { kcode[port] &= ~Btn_X; }
        if ('A' == key) { kcode[port] &= ~DPad_Up; }
        if ('B' == key) { kcode[port] &= ~DPad_Down; }
        if ('D' == key) { kcode[port] &= ~DPad_Left; }
        if ('C' == key) { kcode[port] &= ~DPad_Right; }

        if ('q' == key) { die("death by escape key"); }
    #endif
    //if (0x1b == key){ die("death by escape key"); } //this actually quits when i press left for some reason

    if ('a' == key) { rt[port] = 255; }
    if ('s' == key) { lt[port] = 255; }

    #if FEAT_SHREC != DYNAREC_NONE
      if ('b' == key) { emit_WriteCodeCache(); }
      if ('n' == key) { bm_Reset(); }
      if ('m' == key) { bm_Sort(); }
      if (',' == key)
      {
        emit_WriteCodeCache();
        bm_Sort();
      }
    #endif
  }
}
Beispiel #2
0
void UpdateInputState(u32 port)
{
    static char key = 0;

    kcode[port]= x11_dc_buttons[port];
    rt[port]=0;
    lt[port]=0;

#if defined(TARGET_GCW0) || defined(TARGET_PANDORA)
    HandleJoystick(port);
    HandleKb(port);
return;
#elif defined(SUPPORT_X11)
    // kcode[port] = 0xFFFF;
    // Attempt to get input from a controller
    if (!HandleJoystick(port))
    {
        // Fallback to keyboard if no controller found
        HandleKb(port);
    }
    // Report the current buttons to the emulator
    report_controller_state(port);
    return;
#endif
    for(;;)
    {
        key = 0;
        read(STDIN_FILENO, &key, 1);

        if (0  == key || EOF == key) break;
        if ('k' == key) KillTex=true;

#ifdef TARGET_PANDORA
        if (' ' == key) { kcode[port] &= ~Btn_C; }
        if ('6' == key) { kcode[port] &= ~Btn_A; }
        if ('O' == key) { kcode[port] &= ~Btn_B; }
        if ('5' == key) { kcode[port] &= ~Btn_Y; }
        if ('H' == key) { kcode[port] &= ~Btn_X; }
        if ('A' == key) { kcode[port] &= ~DPad_Up;    }
        if ('B' == key) { kcode[port] &= ~DPad_Down;  }
        if ('D' == key) { kcode[port] &= ~DPad_Left;  }
        if ('C' == key) { kcode[port] &= ~DPad_Right; }
#else
        if ('b' == key) { kcode[port] &= ~Btn_C; }
        if ('v' == key) { kcode[port] &= ~Btn_A; }
        if ('c' == key) { kcode[port] &= ~Btn_B; }
        if ('x' == key) { kcode[port] &= ~Btn_Y; }
        if ('z' == key) { kcode[port] &= ~Btn_X; }
        if ('i' == key) { kcode[port] &= ~DPad_Up;    }
        if ('k' == key) { kcode[port] &= ~DPad_Down;  }
        if ('j' == key) { kcode[port] &= ~DPad_Left;  }
        if ('l' == key) { kcode[port] &= ~DPad_Right; }
#endif
        if (0x0A== key) { kcode[port] &= ~Btn_Start;  }
#ifdef TARGET_PANDORA
        if ('q' == key){ die("death by escape key"); }
#endif
        //if (0x1b == key){ die("death by escape key"); } //this actually quits when i press left for some reason

        if ('a' == key) rt[port]=255;
        if ('s' == key) lt[port]=255;
#if !defined(HOST_NO_REC)
        if ('b' == key) emit_WriteCodeCache();
        if ('n' == key) bm_Reset();
        if ('m' == key) bm_Sort();
        if (',' == key) { emit_WriteCodeCache(); bm_Sort(); }
#endif
    }
}