mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-17 02:08:27 +00:00
Even more miscellaneous gamepad buttons!
This commit is contained in:
parent
cb70e972e3
commit
d04fea8b87
6 changed files with 23 additions and 1 deletions
|
@ -122,6 +122,8 @@ typedef enum
|
||||||
SDL_GAMEPAD_BUTTON_MISC2, /* Additional button */
|
SDL_GAMEPAD_BUTTON_MISC2, /* Additional button */
|
||||||
SDL_GAMEPAD_BUTTON_MISC3, /* Additional button */
|
SDL_GAMEPAD_BUTTON_MISC3, /* Additional button */
|
||||||
SDL_GAMEPAD_BUTTON_MISC4, /* Additional button */
|
SDL_GAMEPAD_BUTTON_MISC4, /* Additional button */
|
||||||
|
SDL_GAMEPAD_BUTTON_MISC5, /* Additional button */
|
||||||
|
SDL_GAMEPAD_BUTTON_MISC6, /* Additional button */
|
||||||
SDL_GAMEPAD_BUTTON_MAX
|
SDL_GAMEPAD_BUTTON_MAX
|
||||||
} SDL_GamepadButton;
|
} SDL_GamepadButton;
|
||||||
|
|
||||||
|
|
|
@ -1088,7 +1088,9 @@ static const char *map_StringForGamepadButton[] = {
|
||||||
"touchpad",
|
"touchpad",
|
||||||
"misc2",
|
"misc2",
|
||||||
"misc3",
|
"misc3",
|
||||||
"misc4"
|
"misc4",
|
||||||
|
"misc5",
|
||||||
|
"misc6"
|
||||||
};
|
};
|
||||||
SDL_COMPILE_TIME_ASSERT(map_StringForGamepadButton, SDL_arraysize(map_StringForGamepadButton) == SDL_GAMEPAD_BUTTON_MAX);
|
SDL_COMPILE_TIME_ASSERT(map_StringForGamepadButton, SDL_arraysize(map_StringForGamepadButton) == SDL_GAMEPAD_BUTTON_MAX);
|
||||||
|
|
||||||
|
@ -1757,6 +1759,8 @@ static GamepadMapping_t *SDL_PrivateGenerateAutomaticGamepadMapping(const char *
|
||||||
SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "misc2", &raw_map->misc2);
|
SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "misc2", &raw_map->misc2);
|
||||||
SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "misc3", &raw_map->misc3);
|
SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "misc3", &raw_map->misc3);
|
||||||
SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "misc4", &raw_map->misc4);
|
SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "misc4", &raw_map->misc4);
|
||||||
|
SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "misc5", &raw_map->misc5);
|
||||||
|
SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "misc6", &raw_map->misc6);
|
||||||
/* Keep using paddle1-4 in the generated mapping so that it can be
|
/* Keep using paddle1-4 in the generated mapping so that it can be
|
||||||
* reused with SDL2 */
|
* reused with SDL2 */
|
||||||
SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "paddle1", &raw_map->right_paddle1);
|
SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "paddle1", &raw_map->right_paddle1);
|
||||||
|
|
|
@ -215,6 +215,8 @@ typedef struct SDL_GamepadMapping
|
||||||
SDL_InputMapping misc2;
|
SDL_InputMapping misc2;
|
||||||
SDL_InputMapping misc3;
|
SDL_InputMapping misc3;
|
||||||
SDL_InputMapping misc4;
|
SDL_InputMapping misc4;
|
||||||
|
SDL_InputMapping misc5;
|
||||||
|
SDL_InputMapping misc6;
|
||||||
SDL_InputMapping right_paddle1;
|
SDL_InputMapping right_paddle1;
|
||||||
SDL_InputMapping left_paddle1;
|
SDL_InputMapping left_paddle1;
|
||||||
SDL_InputMapping right_paddle2;
|
SDL_InputMapping right_paddle2;
|
||||||
|
|
|
@ -702,6 +702,16 @@ static SDL_bool VIRTUAL_JoystickGetGamepadMapping(int device_index, SDL_GamepadM
|
||||||
out->misc4.target = current_button++;
|
out->misc4.target = current_button++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_GAMEPAD_BUTTON_MISC5))) {
|
||||||
|
out->misc5.kind = EMappingKind_Button;
|
||||||
|
out->misc5.target = current_button++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_GAMEPAD_BUTTON_MISC6))) {
|
||||||
|
out->misc6.kind = EMappingKind_Button;
|
||||||
|
out->misc6.target = current_button++;
|
||||||
|
}
|
||||||
|
|
||||||
if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_GAMEPAD_AXIS_LEFTX))) {
|
if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_GAMEPAD_AXIS_LEFTX))) {
|
||||||
out->leftx.kind = EMappingKind_Axis;
|
out->leftx.kind = EMappingKind_Axis;
|
||||||
out->leftx.target = current_axis++;
|
out->leftx.target = current_axis++;
|
||||||
|
|
|
@ -652,6 +652,8 @@ static const char *gamepad_button_names[] = {
|
||||||
"Misc2",
|
"Misc2",
|
||||||
"Misc3",
|
"Misc3",
|
||||||
"Misc4",
|
"Misc4",
|
||||||
|
"Misc5",
|
||||||
|
"Misc6",
|
||||||
};
|
};
|
||||||
SDL_COMPILE_TIME_ASSERT(gamepad_button_names, SDL_arraysize(gamepad_button_names) == SDL_GAMEPAD_BUTTON_MAX);
|
SDL_COMPILE_TIME_ASSERT(gamepad_button_names, SDL_arraysize(gamepad_button_names) == SDL_GAMEPAD_BUTTON_MAX);
|
||||||
|
|
||||||
|
|
|
@ -785,6 +785,8 @@ static const char *GetBindingInstruction(void)
|
||||||
case SDL_GAMEPAD_BUTTON_MISC2:
|
case SDL_GAMEPAD_BUTTON_MISC2:
|
||||||
case SDL_GAMEPAD_BUTTON_MISC3:
|
case SDL_GAMEPAD_BUTTON_MISC3:
|
||||||
case SDL_GAMEPAD_BUTTON_MISC4:
|
case SDL_GAMEPAD_BUTTON_MISC4:
|
||||||
|
case SDL_GAMEPAD_BUTTON_MISC5:
|
||||||
|
case SDL_GAMEPAD_BUTTON_MISC6:
|
||||||
return "Press any additional button not already bound";
|
return "Press any additional button not already bound";
|
||||||
case SDL_GAMEPAD_ELEMENT_AXIS_LEFTX_NEGATIVE:
|
case SDL_GAMEPAD_ELEMENT_AXIS_LEFTX_NEGATIVE:
|
||||||
return "Move the left thumbstick to the left";
|
return "Move the left thumbstick to the left";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue