mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-25 06:44:59 +00:00
ControllerInterface: DSU InputBackend implementation.
This commit is contained in:
parent
2e5cd5d519
commit
168a49c87f
3 changed files with 94 additions and 82 deletions
|
@ -76,7 +76,7 @@ void ControllerInterface::Initialize(const WindowSystemInfo& wsi)
|
||||||
// nothing needed
|
// nothing needed
|
||||||
#endif
|
#endif
|
||||||
#ifdef CIFACE_USE_DUALSHOCKUDPCLIENT
|
#ifdef CIFACE_USE_DUALSHOCKUDPCLIENT
|
||||||
ciface::DualShockUDPClient::Init();
|
m_input_backends.emplace_back(ciface::DualShockUDPClient::CreateInputBackend(this));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Don't allow backends to add devices before the first RefreshDevices() as they will be cleaned
|
// Don't allow backends to add devices before the first RefreshDevices() as they will be cleaned
|
||||||
|
@ -187,9 +187,6 @@ void ControllerInterface::RefreshDevices(RefreshReason reason)
|
||||||
#ifdef CIFACE_USE_PIPES
|
#ifdef CIFACE_USE_PIPES
|
||||||
ciface::Pipes::PopulateDevices();
|
ciface::Pipes::PopulateDevices();
|
||||||
#endif
|
#endif
|
||||||
#ifdef CIFACE_USE_DUALSHOCKUDPCLIENT
|
|
||||||
ciface::DualShockUDPClient::PopulateDevices();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (auto& backend : m_input_backends)
|
for (auto& backend : m_input_backends)
|
||||||
backend->PopulateDevices();
|
backend->PopulateDevices();
|
||||||
|
@ -241,9 +238,6 @@ void ControllerInterface::Shutdown()
|
||||||
#endif
|
#endif
|
||||||
#ifdef CIFACE_USE_ANDROID
|
#ifdef CIFACE_USE_ANDROID
|
||||||
// nothing needed
|
// nothing needed
|
||||||
#endif
|
|
||||||
#ifdef CIFACE_USE_DUALSHOCKUDPCLIENT
|
|
||||||
ciface::DualShockUDPClient::DeInit();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Empty the container of input backends to deconstruct and deinitialize them.
|
// Empty the container of input backends to deconstruct and deinitialize them.
|
||||||
|
|
|
@ -130,7 +130,7 @@ private:
|
||||||
public:
|
public:
|
||||||
void UpdateInput() override;
|
void UpdateInput() override;
|
||||||
|
|
||||||
Device(std::string name, int index, std::string server_address, u16 server_port);
|
Device(std::string name, int index, std::string server_address, u16 server_port, u32 client_uid);
|
||||||
|
|
||||||
std::string GetName() const final override;
|
std::string GetName() const final override;
|
||||||
std::string GetSource() const final override;
|
std::string GetSource() const final override;
|
||||||
|
@ -150,13 +150,15 @@ private:
|
||||||
bool m_prev_touch_valid = false;
|
bool m_prev_touch_valid = false;
|
||||||
int m_touch_x = 0;
|
int m_touch_x = 0;
|
||||||
int m_touch_y = 0;
|
int m_touch_y = 0;
|
||||||
std::string m_server_address;
|
const std::string m_server_address;
|
||||||
u16 m_server_port;
|
const u16 m_server_port;
|
||||||
|
|
||||||
s16 m_touch_x_min;
|
s16 m_touch_x_min;
|
||||||
s16 m_touch_y_min;
|
s16 m_touch_y_min;
|
||||||
s16 m_touch_x_max;
|
s16 m_touch_x_max;
|
||||||
s16 m_touch_y_max;
|
s16 m_touch_y_max;
|
||||||
|
|
||||||
|
const u32 m_client_uid;
|
||||||
};
|
};
|
||||||
|
|
||||||
using MathUtil::GRAVITY_ACCELERATION;
|
using MathUtil::GRAVITY_ACCELERATION;
|
||||||
|
@ -196,13 +198,34 @@ struct Server
|
||||||
SteadyClock::time_point m_disconnect_time = SteadyClock::now();
|
SteadyClock::time_point m_disconnect_time = SteadyClock::now();
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool s_has_init;
|
class InputBackend final : public ciface::InputBackend
|
||||||
static bool s_servers_enabled;
|
{
|
||||||
static std::vector<Server> s_servers;
|
public:
|
||||||
static u32 s_client_uid;
|
InputBackend(ControllerInterface* controller_interface);
|
||||||
static SteadyClock::time_point s_next_listports_time;
|
~InputBackend();
|
||||||
static std::thread s_hotplug_thread;
|
void PopulateDevices() override;
|
||||||
static Common::Flag s_hotplug_thread_running;
|
|
||||||
|
private:
|
||||||
|
void ConfigChanged();
|
||||||
|
void Restart();
|
||||||
|
|
||||||
|
void HotplugThreadFunc();
|
||||||
|
void StartHotplugThread();
|
||||||
|
void StopHotplugThread();
|
||||||
|
|
||||||
|
bool m_servers_enabled;
|
||||||
|
std::vector<Server> m_servers;
|
||||||
|
u32 m_client_uid;
|
||||||
|
SteadyClock::time_point m_next_listports_time;
|
||||||
|
std::thread m_hotplug_thread;
|
||||||
|
Common::Flag m_hotplug_thread_running;
|
||||||
|
std::size_t m_config_change_callback_id;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::unique_ptr<ciface::InputBackend> CreateInputBackend(ControllerInterface* controller_interface)
|
||||||
|
{
|
||||||
|
return std::make_unique<InputBackend>(controller_interface);
|
||||||
|
}
|
||||||
|
|
||||||
static bool IsSameController(const Proto::MessageType::PortInfo& a,
|
static bool IsSameController(const Proto::MessageType::PortInfo& a,
|
||||||
const Proto::MessageType::PortInfo& b)
|
const Proto::MessageType::PortInfo& b)
|
||||||
|
@ -212,29 +235,29 @@ static bool IsSameController(const Proto::MessageType::PortInfo& a,
|
||||||
std::tie(b.pad_id, b.pad_state, b.model, b.connection_type, b.pad_mac_address);
|
std::tie(b.pad_id, b.pad_state, b.model, b.connection_type, b.pad_mac_address);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HotplugThreadFunc()
|
void InputBackend::HotplugThreadFunc()
|
||||||
{
|
{
|
||||||
Common::SetCurrentThreadName("DualShockUDPClient Hotplug Thread");
|
Common::SetCurrentThreadName("DualShockUDPClient Hotplug Thread");
|
||||||
INFO_LOG_FMT(CONTROLLERINTERFACE, "DualShockUDPClient hotplug thread started");
|
INFO_LOG_FMT(CONTROLLERINTERFACE, "DualShockUDPClient hotplug thread started");
|
||||||
Common::ScopeGuard thread_stop_guard{
|
Common::ScopeGuard thread_stop_guard{
|
||||||
[] { INFO_LOG_FMT(CONTROLLERINTERFACE, "DualShockUDPClient hotplug thread stopped"); }};
|
[] { INFO_LOG_FMT(CONTROLLERINTERFACE, "DualShockUDPClient hotplug thread stopped"); }};
|
||||||
|
|
||||||
std::vector<bool> timed_out_servers(s_servers.size(), false);
|
std::vector<bool> timed_out_servers(m_servers.size(), false);
|
||||||
|
|
||||||
while (s_hotplug_thread_running.IsSet())
|
while (m_hotplug_thread_running.IsSet())
|
||||||
{
|
{
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
const auto now = SteadyClock::now();
|
const auto now = SteadyClock::now();
|
||||||
if (now >= s_next_listports_time)
|
if (now >= m_next_listports_time)
|
||||||
{
|
{
|
||||||
s_next_listports_time = now + SERVER_LISTPORTS_INTERVAL;
|
m_next_listports_time = now + SERVER_LISTPORTS_INTERVAL;
|
||||||
|
|
||||||
for (size_t i = 0; i < s_servers.size(); ++i)
|
for (size_t i = 0; i < m_servers.size(); ++i)
|
||||||
{
|
{
|
||||||
auto& server = s_servers[i];
|
auto& server = m_servers[i];
|
||||||
Proto::Message<Proto::MessageType::ListPorts> msg(s_client_uid);
|
Proto::Message<Proto::MessageType::ListPorts> msg(m_client_uid);
|
||||||
auto& list_ports = msg.m_message;
|
auto& list_ports = msg.m_message;
|
||||||
// We ask for x possible devices. We will receive a message for every connected device.
|
// We ask for x possible devices. We will receive a message for every connected device.
|
||||||
list_ports.pad_request_count = SERVER_ASKED_PADS;
|
list_ports.pad_request_count = SERVER_ASKED_PADS;
|
||||||
|
@ -250,12 +273,12 @@ static void HotplugThreadFunc()
|
||||||
}
|
}
|
||||||
|
|
||||||
sf::SocketSelector selector;
|
sf::SocketSelector selector;
|
||||||
for (auto& server : s_servers)
|
for (auto& server : m_servers)
|
||||||
{
|
{
|
||||||
selector.add(server.m_socket);
|
selector.add(server.m_socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto timeout = duration_cast<milliseconds>(s_next_listports_time - SteadyClock::now());
|
auto timeout = duration_cast<milliseconds>(m_next_listports_time - SteadyClock::now());
|
||||||
|
|
||||||
// Receive controller port info within a time from our request.
|
// Receive controller port info within a time from our request.
|
||||||
// Run this even if we sent no new requests, to disconnect devices,
|
// Run this even if we sent no new requests, to disconnect devices,
|
||||||
|
@ -271,9 +294,9 @@ static void HotplugThreadFunc()
|
||||||
if (selector.wait(sf::milliseconds(current_timeout.count())))
|
if (selector.wait(sf::milliseconds(current_timeout.count())))
|
||||||
{
|
{
|
||||||
// Now check all the servers because we don't know which one(s) sent a reply
|
// Now check all the servers because we don't know which one(s) sent a reply
|
||||||
for (size_t i = 0; i < s_servers.size(); ++i)
|
for (size_t i = 0; i < m_servers.size(); ++i)
|
||||||
{
|
{
|
||||||
auto& server = s_servers[i];
|
auto& server = m_servers[i];
|
||||||
if (!selector.isReady(server.m_socket))
|
if (!selector.isReady(server.m_socket))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@ -302,20 +325,20 @@ static void HotplugThreadFunc()
|
||||||
{
|
{
|
||||||
server.m_port_info[port_info->pad_id] = *port_info;
|
server.m_port_info[port_info->pad_id] = *port_info;
|
||||||
// Just remove and re-add all the devices for simplicity
|
// Just remove and re-add all the devices for simplicity
|
||||||
g_controller_interface.PlatformPopulateDevices([] { PopulateDevices(); });
|
GetControllerInterface().PlatformPopulateDevices([this] { PopulateDevices(); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!s_hotplug_thread_running.IsSet()) // Avoid hanging the thread for too long
|
if (!m_hotplug_thread_running.IsSet()) // Avoid hanging the thread for too long
|
||||||
return;
|
return;
|
||||||
} while (timeout > 0ms);
|
} while (timeout > 0ms);
|
||||||
|
|
||||||
// If we have failed to receive any information from the server (or even send it),
|
// If we have failed to receive any information from the server (or even send it),
|
||||||
// disconnect all devices from it (after enough time has elapsed, to avoid false positives).
|
// disconnect all devices from it (after enough time has elapsed, to avoid false positives).
|
||||||
for (size_t i = 0; i < s_servers.size(); ++i)
|
for (size_t i = 0; i < m_servers.size(); ++i)
|
||||||
{
|
{
|
||||||
auto& server = s_servers[i];
|
auto& server = m_servers[i];
|
||||||
if (timed_out_servers[i] && SteadyClock::now() >= server.m_disconnect_time)
|
if (timed_out_servers[i] && SteadyClock::now() >= server.m_disconnect_time)
|
||||||
{
|
{
|
||||||
bool any_connected = false;
|
bool any_connected = false;
|
||||||
|
@ -328,49 +351,49 @@ static void HotplugThreadFunc()
|
||||||
}
|
}
|
||||||
// We can't only remove devices added by this server as we wouldn't know which they are
|
// We can't only remove devices added by this server as we wouldn't know which they are
|
||||||
if (any_connected)
|
if (any_connected)
|
||||||
g_controller_interface.PlatformPopulateDevices([] { PopulateDevices(); });
|
GetControllerInterface().PlatformPopulateDevices([this] { PopulateDevices(); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void StartHotplugThread()
|
void InputBackend::StartHotplugThread()
|
||||||
{
|
{
|
||||||
// Mark the thread as running.
|
// Mark the thread as running.
|
||||||
if (!s_hotplug_thread_running.TestAndSet())
|
if (!m_hotplug_thread_running.TestAndSet())
|
||||||
{
|
{
|
||||||
// It was already running.
|
// It was already running.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
s_hotplug_thread = std::thread(HotplugThreadFunc);
|
m_hotplug_thread = std::thread(&InputBackend::HotplugThreadFunc, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void StopHotplugThread()
|
void InputBackend::StopHotplugThread()
|
||||||
{
|
{
|
||||||
// Tell the hotplug thread to stop.
|
// Tell the hotplug thread to stop.
|
||||||
if (!s_hotplug_thread_running.TestAndClear())
|
if (!m_hotplug_thread_running.TestAndClear())
|
||||||
{
|
{
|
||||||
// It wasn't running, we're done.
|
// It wasn't running, we're done.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
s_hotplug_thread.join();
|
m_hotplug_thread.join();
|
||||||
|
|
||||||
for (auto& server : s_servers)
|
for (auto& server : m_servers)
|
||||||
{
|
{
|
||||||
server.m_socket.unbind(); // interrupt blocking socket
|
server.m_socket.unbind(); // interrupt blocking socket
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Also just start
|
// Also just start
|
||||||
static void Restart()
|
void InputBackend::Restart()
|
||||||
{
|
{
|
||||||
INFO_LOG_FMT(CONTROLLERINTERFACE, "DualShockUDPClient Restart");
|
INFO_LOG_FMT(CONTROLLERINTERFACE, "DualShockUDPClient Restart");
|
||||||
|
|
||||||
StopHotplugThread();
|
StopHotplugThread();
|
||||||
|
|
||||||
for (auto& server : s_servers)
|
for (auto& server : m_servers)
|
||||||
{
|
{
|
||||||
for (size_t port_index = 0; port_index < server.m_port_info.size(); port_index++)
|
for (size_t port_index = 0; port_index < server.m_port_info.size(); port_index++)
|
||||||
{
|
{
|
||||||
|
@ -380,37 +403,34 @@ static void Restart()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only removes devices as servers have been cleaned
|
// Only removes devices as servers have been cleaned
|
||||||
g_controller_interface.PlatformPopulateDevices([] { PopulateDevices(); });
|
GetControllerInterface().PlatformPopulateDevices([this] { PopulateDevices(); });
|
||||||
|
|
||||||
s_client_uid = Common::Random::GenerateValue<u32>();
|
m_client_uid = Common::Random::GenerateValue<u32>();
|
||||||
s_next_listports_time = SteadyClock::now();
|
m_next_listports_time = SteadyClock::now();
|
||||||
|
|
||||||
if (s_servers_enabled && !s_servers.empty())
|
if (m_servers_enabled && !m_servers.empty())
|
||||||
StartHotplugThread();
|
StartHotplugThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ConfigChanged()
|
void InputBackend::ConfigChanged()
|
||||||
{
|
{
|
||||||
if (!s_has_init)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const bool servers_enabled = Config::Get(Settings::SERVERS_ENABLED);
|
const bool servers_enabled = Config::Get(Settings::SERVERS_ENABLED);
|
||||||
const std::string servers_setting = Config::Get(Settings::SERVERS);
|
const std::string servers_setting = Config::Get(Settings::SERVERS);
|
||||||
|
|
||||||
std::string new_servers_setting;
|
std::string new_servers_setting;
|
||||||
for (const auto& server : s_servers)
|
for (const auto& server : m_servers)
|
||||||
{
|
{
|
||||||
new_servers_setting +=
|
new_servers_setting +=
|
||||||
fmt::format("{}:{}:{};", server.m_description, server.m_address, server.m_port);
|
fmt::format("{}:{}:{};", server.m_description, server.m_address, server.m_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (servers_enabled != s_servers_enabled || servers_setting != new_servers_setting)
|
if (servers_enabled != m_servers_enabled || servers_setting != new_servers_setting)
|
||||||
{
|
{
|
||||||
// Stop the thread before writing to s_servers
|
// Stop the thread before writing to m_servers
|
||||||
StopHotplugThread();
|
StopHotplugThread();
|
||||||
|
|
||||||
s_servers_enabled = servers_enabled;
|
m_servers_enabled = servers_enabled;
|
||||||
s_servers.clear();
|
m_servers.clear();
|
||||||
|
|
||||||
const auto server_details = SplitString(servers_setting, ';');
|
const auto server_details = SplitString(servers_setting, ';');
|
||||||
for (const auto& server_detail : server_details)
|
for (const auto& server_detail : server_details)
|
||||||
|
@ -428,17 +448,15 @@ static void ConfigChanged()
|
||||||
}
|
}
|
||||||
u16 server_port = static_cast<u16>(port);
|
u16 server_port = static_cast<u16>(port);
|
||||||
|
|
||||||
s_servers.emplace_back(description, server_address, server_port);
|
m_servers.emplace_back(description, server_address, server_port);
|
||||||
}
|
}
|
||||||
Restart();
|
Restart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Init()
|
InputBackend::InputBackend(ControllerInterface* controller_interface)
|
||||||
|
: ciface::InputBackend(controller_interface)
|
||||||
{
|
{
|
||||||
// Does not support multiple init calls
|
|
||||||
s_has_init = true;
|
|
||||||
|
|
||||||
// The following is added for backwards compatibility
|
// The following is added for backwards compatibility
|
||||||
const auto server_address_setting = Config::Get(Settings::SERVER_ADDRESS);
|
const auto server_address_setting = Config::Get(Settings::SERVER_ADDRESS);
|
||||||
const auto server_port_setting = Config::Get(Settings::SERVER_PORT);
|
const auto server_port_setting = Config::Get(Settings::SERVER_PORT);
|
||||||
|
@ -454,29 +472,30 @@ void Init()
|
||||||
Config::SetBase(Settings::SERVER_PORT, 0);
|
Config::SetBase(Settings::SERVER_PORT, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// It would be much better to unbind from this callback on DeInit but it's not possible as of now
|
m_config_change_callback_id =
|
||||||
Config::AddConfigChangedCallback(ConfigChanged);
|
Config::AddConfigChangedCallback(std::bind(&InputBackend::ConfigChanged, this));
|
||||||
ConfigChanged(); // Call it immediately to load settings
|
// Call it immediately to load settings
|
||||||
|
ConfigChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This can be called by the host thread as well as the hotplug thread, concurrently.
|
// This can be called by the host thread as well as the hotplug thread, concurrently.
|
||||||
// So use PlatformPopulateDevices().
|
// So use PlatformPopulateDevices().
|
||||||
// s_servers is already safe because it can only be modified when the DSU thread is not running,
|
// m_servers is already safe because it can only be modified when the DSU thread is not running,
|
||||||
// from the main thread
|
// from the main thread
|
||||||
void PopulateDevices()
|
void InputBackend::PopulateDevices()
|
||||||
{
|
{
|
||||||
INFO_LOG_FMT(CONTROLLERINTERFACE, "DualShockUDPClient PopulateDevices");
|
INFO_LOG_FMT(CONTROLLERINTERFACE, "DualShockUDPClient PopulateDevices");
|
||||||
|
|
||||||
// s_servers has already been updated so we can't use it to know which devices we removed,
|
// m_servers has already been updated so we can't use it to know which devices we removed,
|
||||||
// also it's good to remove all of them before adding new ones so that their id will be set
|
// also it's good to remove all of them before adding new ones so that their id will be set
|
||||||
// correctly if they have the same name
|
// correctly if they have the same name
|
||||||
g_controller_interface.RemoveDevice(
|
GetControllerInterface().RemoveDevice(
|
||||||
[](const auto* dev) { return dev->GetSource() == DUALSHOCKUDP_SOURCE_NAME; });
|
[](const auto* dev) { return dev->GetSource() == DUALSHOCKUDP_SOURCE_NAME; });
|
||||||
|
|
||||||
// Users might have created more than one server on the same IP/Port.
|
// Users might have created more than one server on the same IP/Port.
|
||||||
// Devices might end up being duplicated (if the server responds two all requests)
|
// Devices might end up being duplicated (if the server responds two all requests)
|
||||||
// but they won't conflict.
|
// but they won't conflict.
|
||||||
for (const auto& server : s_servers)
|
for (const auto& server : m_servers)
|
||||||
{
|
{
|
||||||
for (size_t port_index = 0; port_index < server.m_port_info.size(); port_index++)
|
for (size_t port_index = 0; port_index < server.m_port_info.size(); port_index++)
|
||||||
{
|
{
|
||||||
|
@ -484,24 +503,23 @@ void PopulateDevices()
|
||||||
if (port_info.pad_state != Proto::DsState::Connected)
|
if (port_info.pad_state != Proto::DsState::Connected)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
g_controller_interface.AddDevice(std::make_shared<Device>(
|
GetControllerInterface().AddDevice(
|
||||||
server.m_description, static_cast<int>(port_index), server.m_address, server.m_port));
|
std::make_shared<Device>(server.m_description, static_cast<int>(port_index),
|
||||||
|
server.m_address, server.m_port, m_client_uid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeInit()
|
InputBackend::~InputBackend()
|
||||||
{
|
{
|
||||||
|
Config::RemoveConfigChangedCallback(m_config_change_callback_id);
|
||||||
StopHotplugThread();
|
StopHotplugThread();
|
||||||
|
|
||||||
s_has_init = false;
|
|
||||||
s_servers_enabled = false;
|
|
||||||
s_servers.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Device::Device(std::string name, int index, std::string server_address, u16 server_port)
|
Device::Device(std::string name, int index, std::string server_address, u16 server_port,
|
||||||
|
u32 client_uid)
|
||||||
: m_name{std::move(name)}, m_index{index}, m_server_address{std::move(server_address)},
|
: m_name{std::move(name)}, m_index{index}, m_server_address{std::move(server_address)},
|
||||||
m_server_port{server_port}
|
m_server_port{server_port}, m_client_uid(client_uid)
|
||||||
{
|
{
|
||||||
m_socket.setBlocking(false);
|
m_socket.setBlocking(false);
|
||||||
|
|
||||||
|
@ -604,7 +622,7 @@ void Device::UpdateInput()
|
||||||
{
|
{
|
||||||
m_next_reregister = now + SERVER_REREGISTER_INTERVAL;
|
m_next_reregister = now + SERVER_REREGISTER_INTERVAL;
|
||||||
|
|
||||||
Proto::Message<Proto::MessageType::PadDataRequest> msg(s_client_uid);
|
Proto::Message<Proto::MessageType::PadDataRequest> msg(m_client_uid);
|
||||||
auto& data_req = msg.m_message;
|
auto& data_req = msg.m_message;
|
||||||
data_req.register_flags = Proto::RegisterFlags::PadID;
|
data_req.register_flags = Proto::RegisterFlags::PadID;
|
||||||
data_req.pad_id_to_register = m_index;
|
data_req.pad_id_to_register = m_index;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Common/Config/Config.h"
|
#include "Common/Config/Config.h"
|
||||||
|
#include "InputCommon/ControllerInterface/InputBackend.h"
|
||||||
|
|
||||||
namespace ciface::DualShockUDPClient
|
namespace ciface::DualShockUDPClient
|
||||||
{
|
{
|
||||||
|
@ -20,7 +21,6 @@ extern const Config::Info<std::string> SERVERS;
|
||||||
extern const Config::Info<bool> SERVERS_ENABLED;
|
extern const Config::Info<bool> SERVERS_ENABLED;
|
||||||
} // namespace Settings
|
} // namespace Settings
|
||||||
|
|
||||||
void Init();
|
std::unique_ptr<ciface::InputBackend> CreateInputBackend(ControllerInterface* controller_interface);
|
||||||
void PopulateDevices();
|
|
||||||
void DeInit();
|
|
||||||
} // namespace ciface::DualShockUDPClient
|
} // namespace ciface::DualShockUDPClient
|
||||||
|
|
Loading…
Add table
Reference in a new issue