Skip to content

Commit

Permalink
RMG-Input: fix freeze when opening configuration GUI during netplay
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosalie241 committed Dec 29, 2024
1 parent c102aa0 commit 4514b53
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Source/RMG-Input/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ static void *l_DebugCallContext = nullptr;
// keyboard state
static bool l_KeyboardState[SDL_NUM_SCANCODES];

// config GUI state
static bool l_IsConfigGuiOpen = false;

//
// Local Functions
//
Expand Down Expand Up @@ -1076,6 +1079,8 @@ EXPORT m64p_error CALL PluginConfig2(int romConfig)
return M64ERR_NOT_INIT;
}

l_IsConfigGuiOpen = true;

// close controllers
close_controllers();

Expand Down Expand Up @@ -1103,15 +1108,20 @@ EXPORT m64p_error CALL PluginConfig2(int romConfig)
// reload settings
load_settings();

// apply profiles
apply_controller_profiles();
// apply profiles when we're not in netplay
if (!CoreHasInitNetplay())
{
apply_controller_profiles();
}

// apply gameboy settings
apply_gameboy_settings();

// open controllers
open_controllers();

l_IsConfigGuiOpen = false;

return M64ERR_SUCCESS;
}

Expand Down Expand Up @@ -1186,7 +1196,7 @@ EXPORT void CALL GetKeys(int Control, BUTTONS* Keys)
{
InputProfile* profile = &l_InputProfiles[Control];

if (!profile->PluggedIn)
if (!profile->PluggedIn || l_IsConfigGuiOpen)
{
return;
}
Expand Down

0 comments on commit 4514b53

Please sign in to comment.