aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgameblabla2020-10-16 05:25:14 +0200
committergameblabla2020-10-16 05:25:14 +0200
commitc6d560b0adc5b321115f2597091422787588b807 (patch)
treef039e18bc7fca2c6cd2a999522620678c5b9ff07
parent9ea18f315c385ec85cb28d44659b45589cfc9ac0 (diff)
downloadsnesemu-c6d560b0adc5b321115f2597091422787588b807.tar.gz
snesemu-c6d560b0adc5b321115f2597091422787588b807.tar.bz2
snesemu-c6d560b0adc5b321115f2597091422787588b807.zip
Revert some of the Miyoo specific changes
and make it so the menu button code works on most OpenDingux like platform.
-rw-r--r--Makefile.retrostone2
-rw-r--r--shell/input/sdl/input.c27
-rw-r--r--shell/menu/menu.c26
3 files changed, 37 insertions, 18 deletions
diff --git a/Makefile.retrostone b/Makefile.retrostone
index 0857a1e..99ccaee 100644
--- a/Makefile.retrostone
+++ b/Makefile.retrostone
@@ -9,7 +9,7 @@ PROFILE = APPLY
CC = /opt/retrostone-toolchain/bin/arm-buildroot-linux-musleabihf-gcc
# change compilation / linking flag options
-CFLAGS = -DLSB_FIRST -I. -Ilibretro-common/include -Isrc -DINLINE="inline" -DRIGHTSHIFT_IS_SAR
+CFLAGS = -DLSB_FIRST -I. -Ilibretro-common/include -Isrc -DINLINE="inline" -DRIGHTSHIFT_IS_SAR -DFAST_ALIGNED_LSB_WORD_ACCESS
CFLAGS += -Isource -I./shell/emu -I./shell/scalers -I./shell/emu -I./shell/audio -I./shell/menu -I./shell/video/sdl -I./shell/input -Ishell/headers
CFLAGS += -Ofast -fsingle-precision-constant -fno-PIC -flto
diff --git a/shell/input/sdl/input.c b/shell/input/sdl/input.c
index b26af1f..89034c0 100644
--- a/shell/input/sdl/input.c
+++ b/shell/input/sdl/input.c
@@ -53,7 +53,30 @@ uint32_t S9xReadJoypad(int32_t port)
keystate = SDL_GetKeyState(NULL);
- SDL_PollEvent(&event);
+ while (SDL_PollEvent(&event))
+ {
+ switch (event.type)
+ {
+ case SDL_KEYDOWN:
+ switch(event.key.keysym.sym)
+ {
+ case SDLK_RCTRL:
+ case SDLK_END:
+ case SDLK_ESCAPE:
+ emulator_state = 1;
+ break;
+ }
+ break;
+ case SDLK_KEYUP:
+ switch(event.key.keysym.sym)
+ {
+ case SDLK_HOME:
+ emulator_state = 1;
+ break;
+ }
+ break;
+ }
+ }
CASE(option.config_buttons[0][10], SNES_START_MASK);
CASE(option.config_buttons[0][11], SNES_SELECT_MASK);
@@ -68,7 +91,5 @@ uint32_t S9xReadJoypad(int32_t port)
CASE(option.config_buttons[0][2], SNES_DOWN_MASK);
CASE(option.config_buttons[0][3], SNES_LEFT_MASK);
- if (keystate[option.config_buttons[0][12]]) emulator_state = 1;
-
return joypad;
}
diff --git a/shell/menu/menu.c b/shell/menu/menu.c
index 9eb2d2d..a8c24b5 100644
--- a/shell/menu/menu.c
+++ b/shell/menu/menu.c
@@ -76,23 +76,21 @@ static void config_load()
else
{
/* Default mapping for Horizontal */
- option.config_buttons[0][0] = 273; // UP
- option.config_buttons[0][1] = 275; // RIGHT
- option.config_buttons[0][2] = 274; // DOWN
- option.config_buttons[0][3] = 276; // LEFT
+ 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][4] = 308; // A
- option.config_buttons[0][5] = 306; // B
- option.config_buttons[0][6] = 304; // X
- option.config_buttons[0][7] = 32; // Y
+ option.config_buttons[0][4] = SDLK_LCTRL; // A
+ option.config_buttons[0][5] = SDLK_LALT; // B
+ option.config_buttons[0][6] = SDLK_LSHIFT; // X
+ option.config_buttons[0][7] = SDLK_SPACE; // Y
- option.config_buttons[0][8] = 9; // L
- option.config_buttons[0][9] = 8; // R
+ option.config_buttons[0][8] = SDLK_TAB; // L
+ option.config_buttons[0][9] = SDLK_BACKSPACE; // R
- option.config_buttons[0][10] = 13; // START
- option.config_buttons[0][11] = 27; // SELECT
-
- option.config_buttons[0][12] = 305; // MENU
+ option.config_buttons[0][10] = SDLK_RETURN; // START
+ option.config_buttons[0][11] = SDLK_ESCAPE; // SELECT
option.fullscreen = 1;
}