From c6d560b0adc5b321115f2597091422787588b807 Mon Sep 17 00:00:00 2001 From: gameblabla Date: Fri, 16 Oct 2020 05:25:14 +0200 Subject: Revert some of the Miyoo specific changes and make it so the menu button code works on most OpenDingux like platform. --- Makefile.retrostone | 2 +- shell/input/sdl/input.c | 27 ++++++++++++++++++++++++--- shell/menu/menu.c | 26 ++++++++++++-------------- 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; } -- cgit v1.2.3