early-access version 3165
This commit is contained in:
parent
b556d68683
commit
16daf3faf8
11 changed files with 135 additions and 113 deletions
|
@ -1,7 +1,7 @@
|
||||||
yuzu emulator early access
|
yuzu emulator early access
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is the source code for early-access 3164.
|
This is the source code for early-access 3165.
|
||||||
|
|
||||||
## Legal Notice
|
## Legal Notice
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include "alignment.h"
|
#include "common/cache_management.h"
|
||||||
#include "cache_management.h"
|
|
||||||
#include "common_types.h"
|
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "stdlib.h"
|
#include <cstddef>
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
|
|
|
@ -384,6 +384,16 @@ void RegisterFactory(const std::string& name, std::shared_ptr<Factory<InputDevic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void RegisterInputFactory(const std::string& name,
|
||||||
|
std::shared_ptr<Factory<InputDevice>> factory) {
|
||||||
|
RegisterFactory<InputDevice>(name, std::move(factory));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void RegisterOutputFactory(const std::string& name,
|
||||||
|
std::shared_ptr<Factory<OutputDevice>> factory) {
|
||||||
|
RegisterFactory<OutputDevice>(name, std::move(factory));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unregisters an input device factory.
|
* Unregisters an input device factory.
|
||||||
* @tparam InputDeviceType the type of input devices the factory can create
|
* @tparam InputDeviceType the type of input devices the factory can create
|
||||||
|
@ -396,6 +406,14 @@ void UnregisterFactory(const std::string& name) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void UnregisterInputFactory(const std::string& name) {
|
||||||
|
UnregisterFactory<InputDevice>(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void UnregisterOutputFactory(const std::string& name) {
|
||||||
|
UnregisterFactory<OutputDevice>(name);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an input device from given paramters.
|
* Create an input device from given paramters.
|
||||||
* @tparam InputDeviceType the type of input devices to create
|
* @tparam InputDeviceType the type of input devices to create
|
||||||
|
@ -417,13 +435,21 @@ std::unique_ptr<InputDeviceType> CreateDeviceFromString(const std::string& param
|
||||||
return pair->second->Create(package);
|
return pair->second->Create(package);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline std::unique_ptr<InputDevice> CreateInputDeviceFromString(const std::string& params) {
|
||||||
|
return CreateDeviceFromString<InputDevice>(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::unique_ptr<OutputDevice> CreateOutputDeviceFromString(const std::string& params) {
|
||||||
|
return CreateDeviceFromString<OutputDevice>(params);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an input device from given paramters.
|
* Create an input device from given parameters.
|
||||||
* @tparam InputDeviceType the type of input devices to create
|
* @tparam InputDeviceType the type of input devices to create
|
||||||
* @param A ParamPackage that contains all parameters for creating the device
|
* @param package A ParamPackage that contains all parameters for creating the device
|
||||||
*/
|
*/
|
||||||
template <typename InputDeviceType>
|
template <typename InputDeviceType>
|
||||||
std::unique_ptr<InputDeviceType> CreateDevice(const Common::ParamPackage package) {
|
std::unique_ptr<InputDeviceType> CreateDevice(const ParamPackage& package) {
|
||||||
const std::string engine = package.Get("engine", "null");
|
const std::string engine = package.Get("engine", "null");
|
||||||
const auto& factory_list = Impl::FactoryList<InputDeviceType>::list;
|
const auto& factory_list = Impl::FactoryList<InputDeviceType>::list;
|
||||||
const auto pair = factory_list.find(engine);
|
const auto pair = factory_list.find(engine);
|
||||||
|
@ -436,4 +462,12 @@ std::unique_ptr<InputDeviceType> CreateDevice(const Common::ParamPackage package
|
||||||
return pair->second->Create(package);
|
return pair->second->Create(package);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline std::unique_ptr<InputDevice> CreateInputDevice(const ParamPackage& package) {
|
||||||
|
return CreateDevice<InputDevice>(package);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::unique_ptr<OutputDevice> CreateOutputDevice(const ParamPackage& package) {
|
||||||
|
return CreateDevice<OutputDevice>(package);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Common::Input
|
} // namespace Common::Input
|
||||||
|
|
|
@ -68,7 +68,7 @@ void EmulatedConsole::ReloadInput() {
|
||||||
// If you load any device here add the equivalent to the UnloadInput() function
|
// If you load any device here add the equivalent to the UnloadInput() function
|
||||||
SetTouchParams();
|
SetTouchParams();
|
||||||
|
|
||||||
motion_devices = Common::Input::CreateDevice<Common::Input::InputDevice>(motion_params);
|
motion_devices = Common::Input::CreateInputDevice(motion_params);
|
||||||
if (motion_devices) {
|
if (motion_devices) {
|
||||||
motion_devices->SetCallback({
|
motion_devices->SetCallback({
|
||||||
.on_change =
|
.on_change =
|
||||||
|
@ -79,7 +79,7 @@ void EmulatedConsole::ReloadInput() {
|
||||||
// Unique index for identifying touch device source
|
// Unique index for identifying touch device source
|
||||||
std::size_t index = 0;
|
std::size_t index = 0;
|
||||||
for (auto& touch_device : touch_devices) {
|
for (auto& touch_device : touch_devices) {
|
||||||
touch_device = Common::Input::CreateDevice<Common::Input::InputDevice>(touch_params[index]);
|
touch_device = Common::Input::CreateInputDevice(touch_params[index]);
|
||||||
if (!touch_device) {
|
if (!touch_device) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "common/thread.h"
|
#include "common/thread.h"
|
||||||
#include "core/hid/emulated_controller.h"
|
#include "core/hid/emulated_controller.h"
|
||||||
#include "core/hid/input_converter.h"
|
#include "core/hid/input_converter.h"
|
||||||
|
@ -143,29 +145,23 @@ void EmulatedController::LoadDevices() {
|
||||||
|
|
||||||
LoadTASParams();
|
LoadTASParams();
|
||||||
|
|
||||||
std::transform(button_params.begin() + Settings::NativeButton::BUTTON_HID_BEGIN,
|
std::ranges::transform(button_params, button_devices.begin(), Common::Input::CreateInputDevice);
|
||||||
button_params.begin() + Settings::NativeButton::BUTTON_NS_END,
|
std::ranges::transform(stick_params, stick_devices.begin(), Common::Input::CreateInputDevice);
|
||||||
button_devices.begin(), Common::Input::CreateDevice<Common::Input::InputDevice>);
|
std::ranges::transform(motion_params, motion_devices.begin(), Common::Input::CreateInputDevice);
|
||||||
std::transform(stick_params.begin() + Settings::NativeAnalog::STICK_HID_BEGIN,
|
std::ranges::transform(trigger_params, trigger_devices.begin(),
|
||||||
stick_params.begin() + Settings::NativeAnalog::STICK_HID_END,
|
Common::Input::CreateInputDevice);
|
||||||
stick_devices.begin(), Common::Input::CreateDevice<Common::Input::InputDevice>);
|
std::ranges::transform(battery_params, battery_devices.begin(),
|
||||||
std::transform(motion_params.begin() + Settings::NativeMotion::MOTION_HID_BEGIN,
|
Common::Input::CreateInputDevice);
|
||||||
motion_params.begin() + Settings::NativeMotion::MOTION_HID_END,
|
camera_devices = Common::Input::CreateInputDevice(camera_params);
|
||||||
motion_devices.begin(), Common::Input::CreateDevice<Common::Input::InputDevice>);
|
nfc_devices = Common::Input::CreateInputDevice(nfc_params);
|
||||||
std::transform(trigger_params.begin(), trigger_params.end(), trigger_devices.begin(),
|
std::ranges::transform(output_params, output_devices.begin(),
|
||||||
Common::Input::CreateDevice<Common::Input::InputDevice>);
|
Common::Input::CreateOutputDevice);
|
||||||
std::transform(battery_params.begin(), battery_params.end(), battery_devices.begin(),
|
|
||||||
Common::Input::CreateDevice<Common::Input::InputDevice>);
|
|
||||||
camera_devices = Common::Input::CreateDevice<Common::Input::InputDevice>(camera_params);
|
|
||||||
nfc_devices = Common::Input::CreateDevice<Common::Input::InputDevice>(nfc_params);
|
|
||||||
std::transform(output_params.begin(), output_params.end(), output_devices.begin(),
|
|
||||||
Common::Input::CreateDevice<Common::Input::OutputDevice>);
|
|
||||||
|
|
||||||
// Initialize TAS devices
|
// Initialize TAS devices
|
||||||
std::transform(tas_button_params.begin(), tas_button_params.end(), tas_button_devices.begin(),
|
std::ranges::transform(tas_button_params, tas_button_devices.begin(),
|
||||||
Common::Input::CreateDevice<Common::Input::InputDevice>);
|
Common::Input::CreateInputDevice);
|
||||||
std::transform(tas_stick_params.begin(), tas_stick_params.end(), tas_stick_devices.begin(),
|
std::ranges::transform(tas_stick_params, tas_stick_devices.begin(),
|
||||||
Common::Input::CreateDevice<Common::Input::InputDevice>);
|
Common::Input::CreateInputDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmulatedController::LoadTASParams() {
|
void EmulatedController::LoadTASParams() {
|
||||||
|
|
|
@ -25,12 +25,12 @@ void EmulatedDevices::ReloadInput() {
|
||||||
Common::ParamPackage mouse_params;
|
Common::ParamPackage mouse_params;
|
||||||
mouse_params.Set("engine", "mouse");
|
mouse_params.Set("engine", "mouse");
|
||||||
mouse_params.Set("button", static_cast<int>(key_index));
|
mouse_params.Set("button", static_cast<int>(key_index));
|
||||||
mouse_device = Common::Input::CreateDevice<Common::Input::InputDevice>(mouse_params);
|
mouse_device = Common::Input::CreateInputDevice(mouse_params);
|
||||||
key_index++;
|
key_index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
mouse_stick_device = Common::Input::CreateDeviceFromString<Common::Input::InputDevice>(
|
mouse_stick_device =
|
||||||
"engine:mouse,axis_x:0,axis_y:1");
|
Common::Input::CreateInputDeviceFromString("engine:mouse,axis_x:0,axis_y:1");
|
||||||
|
|
||||||
// First two axis are reserved for mouse position
|
// First two axis are reserved for mouse position
|
||||||
key_index = 2;
|
key_index = 2;
|
||||||
|
@ -38,7 +38,7 @@ void EmulatedDevices::ReloadInput() {
|
||||||
Common::ParamPackage mouse_params;
|
Common::ParamPackage mouse_params;
|
||||||
mouse_params.Set("engine", "mouse");
|
mouse_params.Set("engine", "mouse");
|
||||||
mouse_params.Set("axis", static_cast<int>(key_index));
|
mouse_params.Set("axis", static_cast<int>(key_index));
|
||||||
mouse_device = Common::Input::CreateDevice<Common::Input::InputDevice>(mouse_params);
|
mouse_device = Common::Input::CreateInputDevice(mouse_params);
|
||||||
key_index++;
|
key_index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ void EmulatedDevices::ReloadInput() {
|
||||||
keyboard_params.Set("button", static_cast<int>(key_index));
|
keyboard_params.Set("button", static_cast<int>(key_index));
|
||||||
keyboard_params.Set("port", 1);
|
keyboard_params.Set("port", 1);
|
||||||
keyboard_params.Set("pad", 0);
|
keyboard_params.Set("pad", 0);
|
||||||
keyboard_device = Common::Input::CreateDevice<Common::Input::InputDevice>(keyboard_params);
|
keyboard_device = Common::Input::CreateInputDevice(keyboard_params);
|
||||||
key_index++;
|
key_index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,11 +62,11 @@ void EmulatedDevices::ReloadInput() {
|
||||||
keyboard_params.Set("button", static_cast<int>(key_index));
|
keyboard_params.Set("button", static_cast<int>(key_index));
|
||||||
keyboard_params.Set("port", 1);
|
keyboard_params.Set("port", 1);
|
||||||
keyboard_params.Set("pad", 1);
|
keyboard_params.Set("pad", 1);
|
||||||
keyboard_device = Common::Input::CreateDevice<Common::Input::InputDevice>(keyboard_params);
|
keyboard_device = Common::Input::CreateInputDevice(keyboard_params);
|
||||||
key_index++;
|
key_index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ring_analog_device = Common::Input::CreateDevice<Common::Input::InputDevice>(ring_params);
|
ring_analog_device = Common::Input::CreateInputDevice(ring_params);
|
||||||
|
|
||||||
for (std::size_t index = 0; index < mouse_button_devices.size(); ++index) {
|
for (std::size_t index = 0; index < mouse_button_devices.size(); ++index) {
|
||||||
if (!mouse_button_devices[index]) {
|
if (!mouse_button_devices[index]) {
|
||||||
|
|
|
@ -294,6 +294,15 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static constexpr Common::Input::AnalogProperties properties{
|
||||||
|
.deadzone = 0.0f,
|
||||||
|
.range = 1.0f,
|
||||||
|
.threshold = 0.5f,
|
||||||
|
.offset = 0.0f,
|
||||||
|
.inverted = false,
|
||||||
|
.toggle = false,
|
||||||
|
};
|
||||||
|
|
||||||
Button up;
|
Button up;
|
||||||
Button down;
|
Button down;
|
||||||
Button left;
|
Button left;
|
||||||
|
@ -311,23 +320,17 @@ private:
|
||||||
float last_x_axis_value{};
|
float last_x_axis_value{};
|
||||||
float last_y_axis_value{};
|
float last_y_axis_value{};
|
||||||
Common::Input::ButtonStatus modifier_status{};
|
Common::Input::ButtonStatus modifier_status{};
|
||||||
const Common::Input::AnalogProperties properties{0.0f, 1.0f, 0.5f, 0.0f, false};
|
|
||||||
std::chrono::time_point<std::chrono::steady_clock> last_update;
|
std::chrono::time_point<std::chrono::steady_clock> last_update;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<Common::Input::InputDevice> StickFromButton::Create(
|
std::unique_ptr<Common::Input::InputDevice> StickFromButton::Create(
|
||||||
const Common::ParamPackage& params) {
|
const Common::ParamPackage& params) {
|
||||||
const std::string null_engine = Common::ParamPackage{{"engine", "null"}}.Serialize();
|
const std::string null_engine = Common::ParamPackage{{"engine", "null"}}.Serialize();
|
||||||
auto up = Common::Input::CreateDeviceFromString<Common::Input::InputDevice>(
|
auto up = Common::Input::CreateInputDeviceFromString(params.Get("up", null_engine));
|
||||||
params.Get("up", null_engine));
|
auto down = Common::Input::CreateInputDeviceFromString(params.Get("down", null_engine));
|
||||||
auto down = Common::Input::CreateDeviceFromString<Common::Input::InputDevice>(
|
auto left = Common::Input::CreateInputDeviceFromString(params.Get("left", null_engine));
|
||||||
params.Get("down", null_engine));
|
auto right = Common::Input::CreateInputDeviceFromString(params.Get("right", null_engine));
|
||||||
auto left = Common::Input::CreateDeviceFromString<Common::Input::InputDevice>(
|
auto modifier = Common::Input::CreateInputDeviceFromString(params.Get("modifier", null_engine));
|
||||||
params.Get("left", null_engine));
|
|
||||||
auto right = Common::Input::CreateDeviceFromString<Common::Input::InputDevice>(
|
|
||||||
params.Get("right", null_engine));
|
|
||||||
auto modifier = Common::Input::CreateDeviceFromString<Common::Input::InputDevice>(
|
|
||||||
params.Get("modifier", null_engine));
|
|
||||||
auto modifier_scale = params.Get("modifier_scale", 0.5f);
|
auto modifier_scale = params.Get("modifier_scale", 0.5f);
|
||||||
auto modifier_angle = params.Get("modifier_angle", 5.5f);
|
auto modifier_angle = params.Get("modifier_angle", 5.5f);
|
||||||
return std::make_unique<Stick>(std::move(up), std::move(down), std::move(left),
|
return std::make_unique<Stick>(std::move(up), std::move(down), std::move(left),
|
||||||
|
|
|
@ -59,18 +59,25 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static constexpr Common::Input::AnalogProperties properties{
|
||||||
|
.deadzone = 0.0f,
|
||||||
|
.range = 1.0f,
|
||||||
|
.threshold = 0.5f,
|
||||||
|
.offset = 0.0f,
|
||||||
|
.inverted = false,
|
||||||
|
.toggle = false,
|
||||||
|
};
|
||||||
|
|
||||||
Button button;
|
Button button;
|
||||||
bool last_button_value;
|
bool last_button_value;
|
||||||
const float x;
|
const float x;
|
||||||
const float y;
|
const float y;
|
||||||
const Common::Input::AnalogProperties properties{0.0f, 1.0f, 0.5f, 0.0f, false};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<Common::Input::InputDevice> TouchFromButton::Create(
|
std::unique_ptr<Common::Input::InputDevice> TouchFromButton::Create(
|
||||||
const Common::ParamPackage& params) {
|
const Common::ParamPackage& params) {
|
||||||
const std::string null_engine = Common::ParamPackage{{"engine", "null"}}.Serialize();
|
const std::string null_engine = Common::ParamPackage{{"engine", "null"}}.Serialize();
|
||||||
auto button = Common::Input::CreateDeviceFromString<Common::Input::InputDevice>(
|
auto button = Common::Input::CreateInputDeviceFromString(params.Get("button", null_engine));
|
||||||
params.Get("button", null_engine));
|
|
||||||
const float x = params.Get("x", 0.0f) / 1280.0f;
|
const float x = params.Get("x", 0.0f) / 1280.0f;
|
||||||
const float y = params.Get("y", 0.0f) / 720.0f;
|
const float y = params.Get("y", 0.0f) / 720.0f;
|
||||||
return std::make_unique<TouchFromButtonDevice>(std::move(button), x, y);
|
return std::make_unique<TouchFromButtonDevice>(std::move(button), x, y);
|
||||||
|
|
|
@ -33,129 +33,113 @@ struct InputSubsystem::Impl {
|
||||||
keyboard->SetMappingCallback(mapping_callback);
|
keyboard->SetMappingCallback(mapping_callback);
|
||||||
keyboard_factory = std::make_shared<InputFactory>(keyboard);
|
keyboard_factory = std::make_shared<InputFactory>(keyboard);
|
||||||
keyboard_output_factory = std::make_shared<OutputFactory>(keyboard);
|
keyboard_output_factory = std::make_shared<OutputFactory>(keyboard);
|
||||||
Common::Input::RegisterFactory<Common::Input::InputDevice>(keyboard->GetEngineName(),
|
Common::Input::RegisterInputFactory(keyboard->GetEngineName(), keyboard_factory);
|
||||||
keyboard_factory);
|
Common::Input::RegisterOutputFactory(keyboard->GetEngineName(), keyboard_output_factory);
|
||||||
Common::Input::RegisterFactory<Common::Input::OutputDevice>(keyboard->GetEngineName(),
|
|
||||||
keyboard_output_factory);
|
|
||||||
|
|
||||||
mouse = std::make_shared<Mouse>("mouse");
|
mouse = std::make_shared<Mouse>("mouse");
|
||||||
mouse->SetMappingCallback(mapping_callback);
|
mouse->SetMappingCallback(mapping_callback);
|
||||||
mouse_factory = std::make_shared<InputFactory>(mouse);
|
mouse_factory = std::make_shared<InputFactory>(mouse);
|
||||||
mouse_output_factory = std::make_shared<OutputFactory>(mouse);
|
mouse_output_factory = std::make_shared<OutputFactory>(mouse);
|
||||||
Common::Input::RegisterFactory<Common::Input::InputDevice>(mouse->GetEngineName(),
|
Common::Input::RegisterInputFactory(mouse->GetEngineName(), mouse_factory);
|
||||||
mouse_factory);
|
Common::Input::RegisterOutputFactory(mouse->GetEngineName(), mouse_output_factory);
|
||||||
Common::Input::RegisterFactory<Common::Input::OutputDevice>(mouse->GetEngineName(),
|
|
||||||
mouse_output_factory);
|
|
||||||
|
|
||||||
touch_screen = std::make_shared<TouchScreen>("touch");
|
touch_screen = std::make_shared<TouchScreen>("touch");
|
||||||
touch_screen_factory = std::make_shared<InputFactory>(touch_screen);
|
touch_screen_factory = std::make_shared<InputFactory>(touch_screen);
|
||||||
Common::Input::RegisterFactory<Common::Input::InputDevice>(touch_screen->GetEngineName(),
|
Common::Input::RegisterInputFactory(touch_screen->GetEngineName(), touch_screen_factory);
|
||||||
touch_screen_factory);
|
|
||||||
|
|
||||||
gcadapter = std::make_shared<GCAdapter>("gcpad");
|
gcadapter = std::make_shared<GCAdapter>("gcpad");
|
||||||
gcadapter->SetMappingCallback(mapping_callback);
|
gcadapter->SetMappingCallback(mapping_callback);
|
||||||
gcadapter_input_factory = std::make_shared<InputFactory>(gcadapter);
|
gcadapter_input_factory = std::make_shared<InputFactory>(gcadapter);
|
||||||
gcadapter_output_factory = std::make_shared<OutputFactory>(gcadapter);
|
gcadapter_output_factory = std::make_shared<OutputFactory>(gcadapter);
|
||||||
Common::Input::RegisterFactory<Common::Input::InputDevice>(gcadapter->GetEngineName(),
|
Common::Input::RegisterInputFactory(gcadapter->GetEngineName(), gcadapter_input_factory);
|
||||||
gcadapter_input_factory);
|
Common::Input::RegisterOutputFactory(gcadapter->GetEngineName(), gcadapter_output_factory);
|
||||||
Common::Input::RegisterFactory<Common::Input::OutputDevice>(gcadapter->GetEngineName(),
|
|
||||||
gcadapter_output_factory);
|
|
||||||
|
|
||||||
udp_client = std::make_shared<CemuhookUDP::UDPClient>("cemuhookudp");
|
udp_client = std::make_shared<CemuhookUDP::UDPClient>("cemuhookudp");
|
||||||
udp_client->SetMappingCallback(mapping_callback);
|
udp_client->SetMappingCallback(mapping_callback);
|
||||||
udp_client_input_factory = std::make_shared<InputFactory>(udp_client);
|
udp_client_input_factory = std::make_shared<InputFactory>(udp_client);
|
||||||
udp_client_output_factory = std::make_shared<OutputFactory>(udp_client);
|
udp_client_output_factory = std::make_shared<OutputFactory>(udp_client);
|
||||||
Common::Input::RegisterFactory<Common::Input::InputDevice>(udp_client->GetEngineName(),
|
Common::Input::RegisterInputFactory(udp_client->GetEngineName(), udp_client_input_factory);
|
||||||
udp_client_input_factory);
|
Common::Input::RegisterOutputFactory(udp_client->GetEngineName(),
|
||||||
Common::Input::RegisterFactory<Common::Input::OutputDevice>(udp_client->GetEngineName(),
|
udp_client_output_factory);
|
||||||
udp_client_output_factory);
|
|
||||||
|
|
||||||
tas_input = std::make_shared<TasInput::Tas>("tas");
|
tas_input = std::make_shared<TasInput::Tas>("tas");
|
||||||
tas_input->SetMappingCallback(mapping_callback);
|
tas_input->SetMappingCallback(mapping_callback);
|
||||||
tas_input_factory = std::make_shared<InputFactory>(tas_input);
|
tas_input_factory = std::make_shared<InputFactory>(tas_input);
|
||||||
tas_output_factory = std::make_shared<OutputFactory>(tas_input);
|
tas_output_factory = std::make_shared<OutputFactory>(tas_input);
|
||||||
Common::Input::RegisterFactory<Common::Input::InputDevice>(tas_input->GetEngineName(),
|
Common::Input::RegisterInputFactory(tas_input->GetEngineName(), tas_input_factory);
|
||||||
tas_input_factory);
|
Common::Input::RegisterOutputFactory(tas_input->GetEngineName(), tas_output_factory);
|
||||||
Common::Input::RegisterFactory<Common::Input::OutputDevice>(tas_input->GetEngineName(),
|
|
||||||
tas_output_factory);
|
|
||||||
|
|
||||||
camera = std::make_shared<Camera>("camera");
|
camera = std::make_shared<Camera>("camera");
|
||||||
camera->SetMappingCallback(mapping_callback);
|
camera->SetMappingCallback(mapping_callback);
|
||||||
camera_input_factory = std::make_shared<InputFactory>(camera);
|
camera_input_factory = std::make_shared<InputFactory>(camera);
|
||||||
camera_output_factory = std::make_shared<OutputFactory>(camera);
|
camera_output_factory = std::make_shared<OutputFactory>(camera);
|
||||||
Common::Input::RegisterFactory<Common::Input::InputDevice>(camera->GetEngineName(),
|
Common::Input::RegisterInputFactory(camera->GetEngineName(), camera_input_factory);
|
||||||
camera_input_factory);
|
Common::Input::RegisterOutputFactory(camera->GetEngineName(), camera_output_factory);
|
||||||
Common::Input::RegisterFactory<Common::Input::OutputDevice>(camera->GetEngineName(),
|
|
||||||
camera_output_factory);
|
|
||||||
|
|
||||||
virtual_amiibo = std::make_shared<VirtualAmiibo>("virtual_amiibo");
|
virtual_amiibo = std::make_shared<VirtualAmiibo>("virtual_amiibo");
|
||||||
virtual_amiibo->SetMappingCallback(mapping_callback);
|
virtual_amiibo->SetMappingCallback(mapping_callback);
|
||||||
virtual_amiibo_input_factory = std::make_shared<InputFactory>(virtual_amiibo);
|
virtual_amiibo_input_factory = std::make_shared<InputFactory>(virtual_amiibo);
|
||||||
virtual_amiibo_output_factory = std::make_shared<OutputFactory>(virtual_amiibo);
|
virtual_amiibo_output_factory = std::make_shared<OutputFactory>(virtual_amiibo);
|
||||||
Common::Input::RegisterFactory<Common::Input::InputDevice>(virtual_amiibo->GetEngineName(),
|
Common::Input::RegisterInputFactory(virtual_amiibo->GetEngineName(),
|
||||||
virtual_amiibo_input_factory);
|
virtual_amiibo_input_factory);
|
||||||
Common::Input::RegisterFactory<Common::Input::OutputDevice>(virtual_amiibo->GetEngineName(),
|
Common::Input::RegisterOutputFactory(virtual_amiibo->GetEngineName(),
|
||||||
virtual_amiibo_output_factory);
|
virtual_amiibo_output_factory);
|
||||||
|
|
||||||
#ifdef HAVE_SDL2
|
#ifdef HAVE_SDL2
|
||||||
sdl = std::make_shared<SDLDriver>("sdl");
|
sdl = std::make_shared<SDLDriver>("sdl");
|
||||||
sdl->SetMappingCallback(mapping_callback);
|
sdl->SetMappingCallback(mapping_callback);
|
||||||
sdl_input_factory = std::make_shared<InputFactory>(sdl);
|
sdl_input_factory = std::make_shared<InputFactory>(sdl);
|
||||||
sdl_output_factory = std::make_shared<OutputFactory>(sdl);
|
sdl_output_factory = std::make_shared<OutputFactory>(sdl);
|
||||||
Common::Input::RegisterFactory<Common::Input::InputDevice>(sdl->GetEngineName(),
|
Common::Input::RegisterInputFactory(sdl->GetEngineName(), sdl_input_factory);
|
||||||
sdl_input_factory);
|
Common::Input::RegisterOutputFactory(sdl->GetEngineName(), sdl_output_factory);
|
||||||
Common::Input::RegisterFactory<Common::Input::OutputDevice>(sdl->GetEngineName(),
|
|
||||||
sdl_output_factory);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Common::Input::RegisterFactory<Common::Input::InputDevice>(
|
Common::Input::RegisterInputFactory("touch_from_button",
|
||||||
"touch_from_button", std::make_shared<TouchFromButton>());
|
std::make_shared<TouchFromButton>());
|
||||||
Common::Input::RegisterFactory<Common::Input::InputDevice>(
|
Common::Input::RegisterInputFactory("analog_from_button",
|
||||||
"analog_from_button", std::make_shared<StickFromButton>());
|
std::make_shared<StickFromButton>());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shutdown() {
|
void Shutdown() {
|
||||||
Common::Input::UnregisterFactory<Common::Input::InputDevice>(keyboard->GetEngineName());
|
Common::Input::UnregisterInputFactory(keyboard->GetEngineName());
|
||||||
Common::Input::UnregisterFactory<Common::Input::OutputDevice>(keyboard->GetEngineName());
|
Common::Input::UnregisterOutputFactory(keyboard->GetEngineName());
|
||||||
keyboard.reset();
|
keyboard.reset();
|
||||||
|
|
||||||
Common::Input::UnregisterFactory<Common::Input::InputDevice>(mouse->GetEngineName());
|
Common::Input::UnregisterInputFactory(mouse->GetEngineName());
|
||||||
Common::Input::UnregisterFactory<Common::Input::OutputDevice>(mouse->GetEngineName());
|
Common::Input::UnregisterOutputFactory(mouse->GetEngineName());
|
||||||
mouse.reset();
|
mouse.reset();
|
||||||
|
|
||||||
Common::Input::UnregisterFactory<Common::Input::InputDevice>(touch_screen->GetEngineName());
|
Common::Input::UnregisterInputFactory(touch_screen->GetEngineName());
|
||||||
touch_screen.reset();
|
touch_screen.reset();
|
||||||
|
|
||||||
Common::Input::UnregisterFactory<Common::Input::InputDevice>(gcadapter->GetEngineName());
|
Common::Input::UnregisterInputFactory(gcadapter->GetEngineName());
|
||||||
Common::Input::UnregisterFactory<Common::Input::OutputDevice>(gcadapter->GetEngineName());
|
Common::Input::UnregisterOutputFactory(gcadapter->GetEngineName());
|
||||||
gcadapter.reset();
|
gcadapter.reset();
|
||||||
|
|
||||||
Common::Input::UnregisterFactory<Common::Input::InputDevice>(udp_client->GetEngineName());
|
Common::Input::UnregisterInputFactory(udp_client->GetEngineName());
|
||||||
Common::Input::UnregisterFactory<Common::Input::OutputDevice>(udp_client->GetEngineName());
|
Common::Input::UnregisterOutputFactory(udp_client->GetEngineName());
|
||||||
udp_client.reset();
|
udp_client.reset();
|
||||||
|
|
||||||
Common::Input::UnregisterFactory<Common::Input::InputDevice>(tas_input->GetEngineName());
|
Common::Input::UnregisterInputFactory(tas_input->GetEngineName());
|
||||||
Common::Input::UnregisterFactory<Common::Input::OutputDevice>(tas_input->GetEngineName());
|
Common::Input::UnregisterOutputFactory(tas_input->GetEngineName());
|
||||||
tas_input.reset();
|
tas_input.reset();
|
||||||
|
|
||||||
Common::Input::UnregisterFactory<Common::Input::InputDevice>(camera->GetEngineName());
|
Common::Input::UnregisterInputFactory(camera->GetEngineName());
|
||||||
Common::Input::UnregisterFactory<Common::Input::OutputDevice>(camera->GetEngineName());
|
Common::Input::UnregisterOutputFactory(camera->GetEngineName());
|
||||||
camera.reset();
|
camera.reset();
|
||||||
|
|
||||||
Common::Input::UnregisterFactory<Common::Input::InputDevice>(
|
Common::Input::UnregisterInputFactory(virtual_amiibo->GetEngineName());
|
||||||
virtual_amiibo->GetEngineName());
|
Common::Input::UnregisterOutputFactory(virtual_amiibo->GetEngineName());
|
||||||
Common::Input::UnregisterFactory<Common::Input::OutputDevice>(
|
|
||||||
virtual_amiibo->GetEngineName());
|
|
||||||
virtual_amiibo.reset();
|
virtual_amiibo.reset();
|
||||||
|
|
||||||
#ifdef HAVE_SDL2
|
#ifdef HAVE_SDL2
|
||||||
Common::Input::UnregisterFactory<Common::Input::InputDevice>(sdl->GetEngineName());
|
Common::Input::UnregisterInputFactory(sdl->GetEngineName());
|
||||||
Common::Input::UnregisterFactory<Common::Input::OutputDevice>(sdl->GetEngineName());
|
Common::Input::UnregisterOutputFactory(sdl->GetEngineName());
|
||||||
sdl.reset();
|
sdl.reset();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Common::Input::UnregisterFactory<Common::Input::InputDevice>("touch_from_button");
|
Common::Input::UnregisterInputFactory("touch_from_button");
|
||||||
Common::Input::UnregisterFactory<Common::Input::InputDevice>("analog_from_button");
|
Common::Input::UnregisterInputFactory("analog_from_button");
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] std::vector<Common::ParamPackage> GetInputDevices() const {
|
[[nodiscard]] std::vector<Common::ParamPackage> GetInputDevices() const {
|
||||||
|
|
|
@ -4060,7 +4060,6 @@ void GMainWindow::UpdateUITheme() {
|
||||||
const QString default_theme =
|
const QString default_theme =
|
||||||
QString::fromUtf8(UISettings::themes[static_cast<size_t>(Config::default_theme)].second);
|
QString::fromUtf8(UISettings::themes[static_cast<size_t>(Config::default_theme)].second);
|
||||||
QString current_theme = UISettings::values.theme;
|
QString current_theme = UISettings::values.theme;
|
||||||
QStringList theme_paths(default_theme_paths);
|
|
||||||
|
|
||||||
if (current_theme.isEmpty()) {
|
if (current_theme.isEmpty()) {
|
||||||
current_theme = default_theme;
|
current_theme = default_theme;
|
||||||
|
@ -4073,7 +4072,7 @@ void GMainWindow::UpdateUITheme() {
|
||||||
if (current_theme == QStringLiteral("default") || current_theme == QStringLiteral("colorful")) {
|
if (current_theme == QStringLiteral("default") || current_theme == QStringLiteral("colorful")) {
|
||||||
QIcon::setThemeName(current_theme == QStringLiteral("colorful") ? current_theme
|
QIcon::setThemeName(current_theme == QStringLiteral("colorful") ? current_theme
|
||||||
: startup_icon_theme);
|
: startup_icon_theme);
|
||||||
QIcon::setThemeSearchPaths(theme_paths);
|
QIcon::setThemeSearchPaths(QStringList(default_theme_paths));
|
||||||
if (CheckDarkMode()) {
|
if (CheckDarkMode()) {
|
||||||
current_theme = QStringLiteral("default_dark");
|
current_theme = QStringLiteral("default_dark");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue