aboutsummaryrefslogtreecommitdiff
path: root/shell/menu/menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/menu/menu.c')
-rw-r--r--shell/menu/menu.c97
1 files changed, 49 insertions, 48 deletions
diff --git a/shell/menu/menu.c b/shell/menu/menu.c
index 2ea1636..1de8a15 100644
--- a/shell/menu/menu.c
+++ b/shell/menu/menu.c
@@ -14,6 +14,7 @@
#include "video_blit.h"
#include "config.h"
#include "menu.h"
+#include "buttons.h"
t_config option;
uint32_t emulator_state = 0;
@@ -76,21 +77,21 @@ static void config_load()
else
{
/* Default mapping for Horizontal */
- option.config_buttons[0][0] = SDLK_UP; // UP
- option.config_buttons[0][1] = SDLK_RIGHT; // RIGHT
- option.config_buttons[0][2] = SDLK_DOWN; // DOWN
- option.config_buttons[0][3] = SDLK_LEFT; // LEFT
+ option.config_buttons[0][0] = BTN_UP;
+ option.config_buttons[0][1] = BTN_RIGHT;
+ option.config_buttons[0][2] = BTN_DOWN;
+ option.config_buttons[0][3] = BTN_LEFT;
- option.config_buttons[0][4] = SDLK_SPACE; // A
- option.config_buttons[0][5] = SDLK_LCTRL; // B
- option.config_buttons[0][6] = SDLK_LSHIFT; // X
- option.config_buttons[0][7] = SDLK_LALT; // Y
+ option.config_buttons[0][4] = BTN_A;
+ option.config_buttons[0][5] = BTN_B;
+ option.config_buttons[0][6] = BTN_X;
+ option.config_buttons[0][7] = BTN_Y;
- option.config_buttons[0][8] = SDLK_TAB; // L
- option.config_buttons[0][9] = SDLK_BACKSPACE; // R
+ option.config_buttons[0][8] = BTN_L;
+ option.config_buttons[0][9] = BTN_R;
- option.config_buttons[0][10] = SDLK_RETURN; // START
- option.config_buttons[0][11] = SDLK_RCTRL; // SELECT
+ option.config_buttons[0][10] = BTN_START;
+ option.config_buttons[0][11] = BTN_SELECT;
option.fullscreen = 1;
}
@@ -115,67 +116,67 @@ static const char* Return_Text_Button(uint32_t button)
switch(button)
{
/* UP button */
- case SDLK_UP:
+ case BTN_UP:
return "DPAD UP";
break;
/* DOWN button */
- case SDLK_DOWN:
+ case BTN_DOWN:
return "DPAD DOWN";
break;
/* LEFT button */
- case SDLK_LEFT:
+ case BTN_LEFT:
return "DPAD LEFT";
break;
/* RIGHT button */
- case SDLK_RIGHT:
+ case BTN_RIGHT:
return "DPAD RIGHT";
break;
/* A button */
- case SDLK_SPACE:
+ case BTN_A:
return "A";
break;
/* B button */
- case SDLK_LCTRL:
+ case BTN_B:
return "B";
break;
/* X button */
- case SDLK_LSHIFT:
+ case BTN_X:
return "X";
break;
/* Y button */
- case SDLK_LALT:
+ case BTN_Y:
return "Y";
break;
/* L button */
- case SDLK_TAB:
+ case BTN_L:
return "L";
break;
/* R button */
- case SDLK_BACKSPACE:
+ case BTN_R:
return "R";
break;
/* Power button */
- case SDLK_END:
+ case BTN_L2:
return "L2";
break;
/* Brightness */
- case SDLK_3:
+ case BTN_R2:
return "R2";
break;
/* Volume - */
- case SDLK_AMPERSAND:
+ case BTN_VOLUMEUP:
return "Volume -";
break;
/* Volume + */
- case SDLK_WORLD_73:
+ case BTN_VOLUMEDOWN:
return "Volume +";
break;
/* Start */
- case SDLK_RETURN:
+ case BTN_START:
return "Start";
break;
/* Select */
- case SDLK_RCTRL:
+ case BTN_SELECT:
return "Select";
break;
default:
@@ -207,7 +208,7 @@ static void Input_Remapping()
{
switch(Event.key.keysym.sym)
{
- case SDLK_UP:
+ case BTN_UP:
currentselection--;
if (currentselection < 1)
{
@@ -215,33 +216,33 @@ static void Input_Remapping()
else currentselection = 9;
}
break;
- case SDLK_DOWN:
+ case BTN_DOWN:
currentselection++;
if (currentselection == 10)
{
currentselection = 1;
}
break;
- case SDLK_SPACE:
- case SDLK_RETURN:
+ case BTN_A:
+ case BTN_START:
pressed = 1;
break;
- case SDLK_ESCAPE:
+ case BTN_MENU:
option.config_buttons[controls_chosen][currentselection - 1] = 0;
break;
- case SDLK_LCTRL:
+ case BTN_B:
exit_input = 1;
break;
- case SDLK_LEFT:
+ case BTN_LEFT:
if (currentselection > 9) currentselection -= 9;
break;
- case SDLK_RIGHT:
+ case BTN_RIGHT:
if (currentselection < 10) currentselection += 9;
break;
- case SDLK_BACKSPACE:
+ case BTN_R:
controls_chosen = 1;
break;
- case SDLK_TAB:
+ case BTN_L:
controls_chosen = 0;
break;
default:
@@ -265,7 +266,7 @@ static void Input_Remapping()
{
if (Event.type == SDL_KEYDOWN)
{
- if (Event.key.keysym.sym != SDLK_ESCAPE)
+ if (Event.key.keysym.sym != BTN_MENU)
{
option.config_buttons[controls_chosen][currentselection - 1] = Event.key.keysym.sym;
exit_map = 1;
@@ -427,27 +428,27 @@ void Menu()
{
switch(Event.key.keysym.sym)
{
- case SDLK_UP:
+ case BTN_UP:
currentselection--;
if (currentselection == 0)
currentselection = 6;
break;
- case SDLK_DOWN:
+ case BTN_DOWN:
currentselection++;
if (currentselection == 7)
currentselection = 1;
break;
- case SDLK_END:
- case SDLK_RCTRL:
- case SDLK_LCTRL:
+ case BTN_L2:
+ case BTN_SELECT:
+ case BTN_B:
pressed = 1;
currentselection = 1;
break;
- case SDLK_SPACE:
- case SDLK_RETURN:
+ case BTN_A:
+ case BTN_START:
pressed = 1;
break;
- case SDLK_LEFT:
+ case BTN_LEFT:
switch(currentselection)
{
case 2:
@@ -461,7 +462,7 @@ void Menu()
break;
}
break;
- case SDLK_RIGHT:
+ case BTN_RIGHT:
switch(currentselection)
{
case 2: