Skip to content

Commit

Permalink
Debugger: Re-apply controller buttons turned on in the controller tab…
Browse files Browse the repository at this point in the history
… after power cycle/reload rom

First frame after reload won't see the buttons as pressed, but they'll be pressed as expected after the first frame
  • Loading branch information
SourMesen committed Jul 30, 2023
1 parent 00c71cc commit f71d1e5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions UI/Debugger/ViewModels/ControllerInputViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ public ControllerInputViewModel(ConsoleType consoleType, int index)
}

private void ControllerInputViewModel_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
{
SetInputOverrides();
}

public void SetInputOverrides()
{
DebugApi.SetInputOverrides((uint)ControllerIndex - 1, new DebugControllerState() {
A = ButtonA,
Expand Down
7 changes: 7 additions & 0 deletions UI/Debugger/ViewModels/ControllerListViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,12 @@ public ControllerListViewModel(ConsoleType consoleType)
Controllers.Add(new ControllerInputViewModel(consoleType, index));
}
}

public void SetInputOverrides()
{
foreach(ControllerInputViewModel controller in Controllers) {
controller.SetInputOverrides();
}
}
}
}
2 changes: 2 additions & 0 deletions UI/Debugger/Windows/DebuggerWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ public void ProcessNotification(NotificationEventArgs e)
DataContext = _model;
});
}
} else {
_model.ControllerList.SetInputOverrides();
}

GameLoadedEventParams evtParams = Marshal.PtrToStructure<GameLoadedEventParams>(e.Parameter);
Expand Down

0 comments on commit f71d1e5

Please sign in to comment.