allow buttons to be mapped to left analog stick

Issue #55
This commit is contained in:
Flyinghead 2020-04-04 18:18:36 +02:00
parent 8482b9130c
commit 553447ed76
4 changed files with 25 additions and 8 deletions

View File

@ -43,6 +43,10 @@ enum DreamcastKey
EMU_BTN_TRIGGER_RIGHT = 1 << 18,
EMU_BTN_MENU = 1 << 19,
EMU_BTN_FFORWARD = 1 << 20,
EMU_BTN_ANA_UP = 1 << 21,
EMU_BTN_ANA_DOWN = 1 << 22,
EMU_BTN_ANA_LEFT = 1 << 23,
EMU_BTN_ANA_RIGHT = 1 << 24,
// Real axes
DC_AXIS_LT = 0x10000,

View File

@ -126,6 +126,18 @@ bool GamepadDevice::gamepad_btn_input(u32 code, bool pressed)
case EMU_BTN_TRIGGER_RIGHT:
rt[_maple_port] = pressed ? 255 : 0;
break;
case EMU_BTN_ANA_UP:
joyy[_maple_port] = pressed ? -128 : 0;
break;
case EMU_BTN_ANA_DOWN:
joyy[_maple_port] = pressed ? 127 : 0;
break;
case EMU_BTN_ANA_LEFT:
joyx[_maple_port] = pressed ? -128 : 0;
break;
case EMU_BTN_ANA_RIGHT:
joyx[_maple_port] = pressed ? 127 : 0;
break;
default:
return false;
}

View File

@ -48,7 +48,11 @@ button_list[] =
{ EMU_BTN_MENU, "emulator", "btn_menu" },
{ EMU_BTN_FFORWARD, "emulator", "btn_fforward" },
{ EMU_BTN_TRIGGER_LEFT, "compat", "btn_trigger_left" },
{ EMU_BTN_TRIGGER_RIGHT, "compat", "btn_trigger_right" }
{ EMU_BTN_TRIGGER_RIGHT, "compat", "btn_trigger_right" },
{ EMU_BTN_ANA_UP, "compat", "btn_analog_up" },
{ EMU_BTN_ANA_DOWN, "compat", "btn_analog_down" },
{ EMU_BTN_ANA_LEFT, "compat", "btn_analog_left" },
{ EMU_BTN_ANA_RIGHT, "compat", "btn_analog_right" },
};
static struct

View File

@ -441,10 +441,12 @@ static const char *maple_expansion_device_name(MapleDeviceType type)
const char *maple_ports[] = { "None", "A", "B", "C", "D" };
const DreamcastKey button_keys[] = { DC_BTN_START, DC_BTN_A, DC_BTN_B, DC_BTN_X, DC_BTN_Y, DC_DPAD_UP, DC_DPAD_DOWN, DC_DPAD_LEFT, DC_DPAD_RIGHT,
EMU_BTN_MENU, EMU_BTN_ESCAPE, EMU_BTN_FFORWARD, EMU_BTN_TRIGGER_LEFT, EMU_BTN_TRIGGER_RIGHT,
DC_BTN_C, DC_BTN_D, DC_BTN_Z, DC_DPAD2_UP, DC_DPAD2_DOWN, DC_DPAD2_LEFT, DC_DPAD2_RIGHT };
DC_BTN_C, DC_BTN_D, DC_BTN_Z, DC_DPAD2_UP, DC_DPAD2_DOWN, DC_DPAD2_LEFT, DC_DPAD2_RIGHT,
EMU_BTN_ANA_UP, EMU_BTN_ANA_DOWN, EMU_BTN_ANA_LEFT, EMU_BTN_ANA_RIGHT };
const char *button_names[] = { "Start", "A", "B", "X", "Y", "DPad Up", "DPad Down", "DPad Left", "DPad Right",
"Menu", "Exit", "Fast-forward", "Left Trigger", "Right Trigger",
"C", "D", "Z", "Right Dpad Up", "Right DPad Down", "Right DPad Left", "Right DPad Right" };
"C", "D", "Z", "Right Dpad Up", "Right DPad Down", "Right DPad Left", "Right DPad Right",
"Left Stick Up", "Left Stick Down", "Left Stick Left", "Left Stick Right" };
const char *arcade_button_names[] = { "Start", "Button 1", "Button 2", "Button 3", "Button 4", "Up", "Down", "Left", "Right",
"Menu", "Exit", "Fast-forward", "N/A", "N/A",
"Service", "Coin", "Test", "Button 5", "Button 6", "Button 7", "Button 8" };
@ -1414,11 +1416,6 @@ static void gui_display_settings()
settings.dynarec.Enable = (bool)dynarec_enabled;
}
#ifdef __ANDROID__
static std::string current_library_path("/storage/emulated/0/Download");
#else
static std::string current_library_path("/home/raph/RetroPie/roms/dreamcast/");
#endif
struct GameMedia {
std::string name;
std::string path;