mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-31 01:59:52 -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:
@ -2,6 +2,8 @@
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "Core/Movie.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cctype>
|
||||
@ -10,6 +12,7 @@
|
||||
#include <mbedtls/md.h>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/Assert.h"
|
||||
@ -34,7 +37,6 @@
|
||||
#include "Core/HW/WiimoteEmu/WiimoteHid.h"
|
||||
#include "Core/IOS/USB/Bluetooth/BTEmu.h"
|
||||
#include "Core/IOS/USB/Bluetooth/WiimoteDevice.h"
|
||||
#include "Core/Movie.h"
|
||||
#include "Core/NetPlayProto.h"
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
#include "Core/State.h"
|
||||
@ -91,8 +93,8 @@ static bool s_bPolled = false;
|
||||
static std::mutex s_input_display_lock;
|
||||
static std::string s_InputDisplay[8];
|
||||
|
||||
static GCManipFunction gcmfunc = nullptr;
|
||||
static WiiManipFunction wiimfunc = nullptr;
|
||||
static GCManipFunction gcmfunc;
|
||||
static WiiManipFunction wiimfunc;
|
||||
|
||||
// NOTE: Host / CPU Thread
|
||||
static void EnsureTmpInputSize(size_t bound)
|
||||
@ -1440,25 +1442,25 @@ void SaveRecording(const std::string& filename)
|
||||
|
||||
void SetGCInputManip(GCManipFunction func)
|
||||
{
|
||||
gcmfunc = func;
|
||||
gcmfunc = std::move(func);
|
||||
}
|
||||
void SetWiiInputManip(WiiManipFunction func)
|
||||
{
|
||||
wiimfunc = func;
|
||||
wiimfunc = std::move(func);
|
||||
}
|
||||
|
||||
// NOTE: CPU Thread
|
||||
void CallGCInputManip(GCPadStatus* PadStatus, int controllerID)
|
||||
{
|
||||
if (gcmfunc)
|
||||
(*gcmfunc)(PadStatus, controllerID);
|
||||
gcmfunc(PadStatus, controllerID);
|
||||
}
|
||||
// NOTE: CPU Thread
|
||||
void CallWiiInputManip(u8* data, WiimoteEmu::ReportFeatures rptf, int controllerID, int ext,
|
||||
const wiimote_key key)
|
||||
{
|
||||
if (wiimfunc)
|
||||
(*wiimfunc)(data, rptf, controllerID, ext, key);
|
||||
wiimfunc(data, rptf, controllerID, ext, key);
|
||||
}
|
||||
|
||||
// NOTE: GPU Thread
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
@ -181,8 +182,9 @@ std::string GetInputDisplay();
|
||||
std::string GetRTCDisplay();
|
||||
|
||||
// Done this way to avoid mixing of core and gui code
|
||||
typedef void (*GCManipFunction)(GCPadStatus*, int);
|
||||
typedef void (*WiiManipFunction)(u8*, WiimoteEmu::ReportFeatures, int, int, wiimote_key);
|
||||
using GCManipFunction = std::function<void(GCPadStatus*, int)>;
|
||||
using WiiManipFunction =
|
||||
std::function<void(u8*, WiimoteEmu::ReportFeatures, int, int, wiimote_key)>;
|
||||
|
||||
void SetGCInputManip(GCManipFunction);
|
||||
void SetWiiInputManip(WiiManipFunction);
|
||||
|
Reference in New Issue
Block a user