diff options
Diffstat (limited to 'games/SameBoy/joypad.patch')
-rw-r--r-- | games/SameBoy/joypad.patch | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/games/SameBoy/joypad.patch b/games/SameBoy/joypad.patch new file mode 100644 index 0000000000..fc089e4223 --- /dev/null +++ b/games/SameBoy/joypad.patch @@ -0,0 +1,66 @@ +From 7ffed9c43cd533c4ab16ab9d8b0879a39a00a02b Mon Sep 17 00:00:00 2001 +From: Lior Halphon <LIJI32@gmail.com> +Date: Sat, 10 Nov 2018 19:39:57 +0200 +Subject: [PATCH] Reconnect the joypad when SameBoy starts directly to a ROM + (fixes #131) + +--- + SDL/gui.c | 10 ++++++++-- + SDL/gui.h | 1 + + SDL/main.c | 3 +++ + 3 files changed, 12 insertions(+), 2 deletions(-) + +diff --git a/SDL/gui.c b/SDL/gui.c +index c32eec4d..ed9f3573 100644 +--- a/SDL/gui.c ++++ b/SDL/gui.c +@@ -721,8 +721,7 @@ joypad_axis_t get_joypad_axis(uint8_t physical_axis) + } + + +-extern void set_filename(const char *new_filename, bool new_should_free); +-void run_gui(bool is_running) ++void connect_joypad(void) + { + if (joystick && !SDL_NumJoysticks()) { + if (controller) { +@@ -743,6 +742,13 @@ void run_gui(bool is_running) + joystick = SDL_JoystickOpen(0); + } + } ++} ++ ++extern void set_filename(const char *new_filename, bool new_should_free); ++void run_gui(bool is_running) ++{ ++ connect_joypad(); ++ + /* Draw the background screen */ + static SDL_Surface *converted_background = NULL; + if (!converted_background) { +diff --git a/SDL/gui.h b/SDL/gui.h +index 9893eb61..4d106143 100644 +--- a/SDL/gui.h ++++ b/SDL/gui.h +@@ -92,6 +92,7 @@ extern configuration_t configuration; + void update_viewport(void); + void run_gui(bool is_running); + void render_texture(void *pixels, void *previous); ++void connect_joypad(void); + + joypad_button_t get_joypad_button(uint8_t physical_button); + joypad_axis_t get_joypad_axis(uint8_t physical_axis); +diff --git a/SDL/main.c b/SDL/main.c +index 7db59be4..99facf8d 100755 +--- a/SDL/main.c ++++ b/SDL/main.c +@@ -616,6 +616,9 @@ int main(int argc, char **argv) + if (filename == NULL) { + run_gui(false); + } ++ else { ++ connect_joypad(); ++ } + SDL_PauseAudioDevice(device_id, 0); + run(); // Never returns + return 0; |