mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-22 19:44:21 +01:00
e447f17fc5
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
66 lines
1.8 KiB
Diff
66 lines
1.8 KiB
Diff
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;
|