Remove ReloadClient, parametrize cemuhookudp
Added logging code for gyro in npad Removed ReloadClient from cemuhookudp because it wasn't used.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include "common/assert.h"
|
||||
#include "common/bit_field.h"
|
||||
#include "common/common_types.h"
|
||||
@@ -371,6 +372,16 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
|
||||
Common::Vec3f accel, gyro;
|
||||
if (sixaxis_sensor_enabled && motion_sensors[i]) {
|
||||
std::tie(accel, gyro) = motion_sensors[i]->GetStatus();
|
||||
#if 1
|
||||
std::ostringstream builder{};
|
||||
builder << "Got gyro x=";
|
||||
builder << gyro.x;
|
||||
builder << " y=";
|
||||
builder << gyro.y;
|
||||
builder << " z=";
|
||||
builder << gyro.z;
|
||||
LOG_INFO(Service_HID, builder.str().c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
auto& main_controller =
|
||||
|
||||
@@ -40,9 +40,10 @@ private:
|
||||
|
||||
class UDPTouchFactory final : public Input::Factory<Input::TouchDevice> {
|
||||
public:
|
||||
explicit UDPTouchFactory(std::shared_ptr<DeviceStatus> status_) : status(std::move(status_)) {}
|
||||
explicit UDPTouchFactory() {}
|
||||
|
||||
std::unique_ptr<Input::TouchDevice> Create(const Common::ParamPackage& params) override {
|
||||
status = std::make_shared<DeviceStatus>();
|
||||
{
|
||||
std::lock_guard guard(status->update_mutex);
|
||||
status->touch_calibration = DeviceStatus::CalibrationData{};
|
||||
@@ -52,35 +53,41 @@ public:
|
||||
status->touch_calibration->max_x = params.Get("max_x", 1800);
|
||||
status->touch_calibration->max_y = params.Get("max_y", 850);
|
||||
}
|
||||
std::string host = params.Get("host", "127.0.0.1");
|
||||
int port = params.Get("port", 26760);
|
||||
int pad_index = params.Get("pad_index", 0);
|
||||
client = std::make_shared<Client>(status, host, port, pad_index);
|
||||
return std::make_unique<UDPTouchDevice>(status);
|
||||
}
|
||||
|
||||
private:
|
||||
std::shared_ptr<DeviceStatus> status;
|
||||
std::shared_ptr<Client> client;
|
||||
};
|
||||
|
||||
class UDPMotionFactory final : public Input::Factory<Input::MotionDevice> {
|
||||
public:
|
||||
explicit UDPMotionFactory(std::shared_ptr<DeviceStatus> status_) : status(std::move(status_)) {}
|
||||
explicit UDPMotionFactory() {}
|
||||
|
||||
std::unique_ptr<Input::MotionDevice> Create(const Common::ParamPackage& params) override {
|
||||
std::string host = params.Get("host", "127.0.0.1");
|
||||
int port = params.Get("port", 26760);
|
||||
int pad_index = params.Get("pad_index", 0);
|
||||
status = std::make_shared<DeviceStatus>();
|
||||
client = std::make_shared<Client>(status, host, port, pad_index);
|
||||
return std::make_unique<UDPMotionDevice>(status);
|
||||
}
|
||||
|
||||
private:
|
||||
std::shared_ptr<DeviceStatus> status;
|
||||
std::shared_ptr<Client> client;
|
||||
};
|
||||
|
||||
State::State() {
|
||||
auto status = std::make_shared<DeviceStatus>();
|
||||
client =
|
||||
std::make_unique<Client>(status, Settings::values.udp_input_address,
|
||||
Settings::values.udp_input_port, Settings::values.udp_pad_index);
|
||||
|
||||
Input::RegisterFactory<Input::TouchDevice>("cemuhookudp",
|
||||
std::make_shared<UDPTouchFactory>(status));
|
||||
Input::RegisterFactory<Input::TouchDevice>("cemuhookudp", std::make_shared<UDPTouchFactory>());
|
||||
Input::RegisterFactory<Input::MotionDevice>("cemuhookudp",
|
||||
std::make_shared<UDPMotionFactory>(status));
|
||||
std::make_shared<UDPMotionFactory>());
|
||||
}
|
||||
|
||||
State::~State() {
|
||||
@@ -88,11 +95,6 @@ State::~State() {
|
||||
Input::UnregisterFactory<Input::MotionDevice>("cemuhookudp");
|
||||
}
|
||||
|
||||
void State::ReloadUDPClient() {
|
||||
client->ReloadSocket(Settings::values.udp_input_address, Settings::values.udp_input_port,
|
||||
Settings::values.udp_pad_index);
|
||||
}
|
||||
|
||||
std::unique_ptr<State> Init() {
|
||||
return std::make_unique<State>();
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ class State {
|
||||
public:
|
||||
State();
|
||||
~State();
|
||||
void ReloadUDPClient();
|
||||
|
||||
private:
|
||||
std::unique_ptr<Client> client;
|
||||
|
||||
Reference in New Issue
Block a user