Reconnect the joypad when SameBoy starts directly to a ROM (fixes #131)
This commit is contained in:
parent
94136f5741
commit
7ffed9c43c
10
SDL/gui.c
10
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 connect_joypad(void)
|
||||||
void run_gui(bool is_running)
|
|
||||||
{
|
{
|
||||||
if (joystick && !SDL_NumJoysticks()) {
|
if (joystick && !SDL_NumJoysticks()) {
|
||||||
if (controller) {
|
if (controller) {
|
||||||
@ -743,6 +742,13 @@ void run_gui(bool is_running)
|
|||||||
joystick = SDL_JoystickOpen(0);
|
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 */
|
/* Draw the background screen */
|
||||||
static SDL_Surface *converted_background = NULL;
|
static SDL_Surface *converted_background = NULL;
|
||||||
if (!converted_background) {
|
if (!converted_background) {
|
||||||
|
@ -92,6 +92,7 @@ extern configuration_t configuration;
|
|||||||
void update_viewport(void);
|
void update_viewport(void);
|
||||||
void run_gui(bool is_running);
|
void run_gui(bool is_running);
|
||||||
void render_texture(void *pixels, void *previous);
|
void render_texture(void *pixels, void *previous);
|
||||||
|
void connect_joypad(void);
|
||||||
|
|
||||||
joypad_button_t get_joypad_button(uint8_t physical_button);
|
joypad_button_t get_joypad_button(uint8_t physical_button);
|
||||||
joypad_axis_t get_joypad_axis(uint8_t physical_axis);
|
joypad_axis_t get_joypad_axis(uint8_t physical_axis);
|
||||||
|
@ -616,6 +616,9 @@ int main(int argc, char **argv)
|
|||||||
if (filename == NULL) {
|
if (filename == NULL) {
|
||||||
run_gui(false);
|
run_gui(false);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
connect_joypad();
|
||||||
|
}
|
||||||
SDL_PauseAudioDevice(device_id, 0);
|
SDL_PauseAudioDevice(device_id, 0);
|
||||||
run(); // Never returns
|
run(); // Never returns
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user