mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Frame: Make TAS dialogs private
Amends the TAS callbacks to internally store functions using std::function instead of raw function pointers. This allows binding extra contextual state via lambda functions, as well as keeping the dialogs internal to the main frame (on top of being a more flexible interface).
This commit is contained in:
@ -47,6 +47,7 @@
|
||||
#include "Core/HW/GCKeyboard.h"
|
||||
#include "Core/HW/GCPad.h"
|
||||
#include "Core/HW/Wiimote.h"
|
||||
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
||||
#include "Core/HotkeyManager.h"
|
||||
#include "Core/IOS/IPC.h"
|
||||
#include "Core/IOS/USB/Bluetooth/BTBase.h"
|
||||
@ -389,11 +390,7 @@ CFrame::CFrame(wxFrame* parent, wxWindowID id, const wxString& title, wxRect geo
|
||||
m_LogWindow->Hide();
|
||||
m_LogWindow->Disable();
|
||||
|
||||
for (int i = 0; i < 8; ++i)
|
||||
g_TASInputDlg[i] = new TASInputDlg(this);
|
||||
|
||||
Movie::SetGCInputManip(GCTASManipFunction);
|
||||
Movie::SetWiiInputManip(WiiTASManipFunction);
|
||||
InitializeTASDialogs();
|
||||
|
||||
State::SetOnAfterLoadCallback(OnAfterLoadCallback);
|
||||
Core::SetOnStoppedCallback(OnStoppedCallback);
|
||||
@ -502,6 +499,21 @@ void CFrame::BindEvents()
|
||||
Bind(DOLPHIN_EVT_STOP_SOFTWARE, &CFrame::OnStop, this);
|
||||
}
|
||||
|
||||
void CFrame::InitializeTASDialogs()
|
||||
{
|
||||
for (int i = 0; i < 8; ++i)
|
||||
g_TASInputDlg[i] = new TASInputDlg(this);
|
||||
|
||||
Movie::SetGCInputManip([this](GCPadStatus* pad_status, int controller_id) {
|
||||
g_TASInputDlg[controller_id]->GetValues(pad_status);
|
||||
});
|
||||
|
||||
Movie::SetWiiInputManip([this](u8* data, WiimoteEmu::ReportFeatures rptf, int controller_id,
|
||||
int ext, wiimote_key key) {
|
||||
g_TASInputDlg[controller_id + 4]->GetValues(data, rptf, ext, key);
|
||||
});
|
||||
}
|
||||
|
||||
bool CFrame::RendererIsFullscreen()
|
||||
{
|
||||
bool fullscreen = false;
|
||||
@ -1034,21 +1046,6 @@ void OnStoppedCallback()
|
||||
}
|
||||
}
|
||||
|
||||
void GCTASManipFunction(GCPadStatus* PadStatus, int controllerID)
|
||||
{
|
||||
if (main_frame)
|
||||
main_frame->g_TASInputDlg[controllerID]->GetValues(PadStatus);
|
||||
}
|
||||
|
||||
void WiiTASManipFunction(u8* data, WiimoteEmu::ReportFeatures rptf, int controllerID, int ext,
|
||||
const wiimote_key key)
|
||||
{
|
||||
if (main_frame)
|
||||
{
|
||||
main_frame->g_TASInputDlg[controllerID + 4]->GetValues(data, rptf, ext, key);
|
||||
}
|
||||
}
|
||||
|
||||
void CFrame::OnKeyDown(wxKeyEvent& event)
|
||||
{
|
||||
// On OS X, we claim all keyboard events while
|
||||
|
Reference in New Issue
Block a user