Compare commits
1 Commits
tera
...
burning-pr
Author | SHA1 | Date | |
---|---|---|---|
|
66ccd77115 |
@@ -111,16 +111,25 @@ void EmulatedController::ReloadFromSettings() {
|
|||||||
|
|
||||||
ring_params[0] = Common::ParamPackage(Settings::values.ringcon_analogs);
|
ring_params[0] = Common::ParamPackage(Settings::values.ringcon_analogs);
|
||||||
|
|
||||||
// Other or debug controller should always be a pro controller
|
// Player 1 shares config with handheld. Disable controller when handheld is selected
|
||||||
if (npad_id_type != NpadIdType::Other) {
|
// if (npad_id_type == NpadIdType::Player1 && npad_type == NpadStyleIndex::Handheld) {
|
||||||
SetNpadStyleIndex(MapSettingsTypeToNPad(player.controller_type));
|
// Disconnect();
|
||||||
original_npad_type = npad_type;
|
// ReloadInput();
|
||||||
} else {
|
// return;
|
||||||
SetNpadStyleIndex(NpadStyleIndex::ProController);
|
//}
|
||||||
original_npad_type = npad_type;
|
|
||||||
|
// Handheld shares config with player 1. Disable controller when handheld isn't selected
|
||||||
|
if (npad_id_type == NpadIdType::Handheld && npad_type != NpadStyleIndex::Handheld) {
|
||||||
|
Disconnect();
|
||||||
|
ReloadInput();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Disconnect();
|
Disconnect();
|
||||||
|
|
||||||
|
SetNpadStyleIndex(MapSettingsTypeToNPad(player.controller_type));
|
||||||
|
original_npad_type = npad_type;
|
||||||
|
|
||||||
if (player.connected) {
|
if (player.connected) {
|
||||||
Connect();
|
Connect();
|
||||||
}
|
}
|
||||||
@@ -593,8 +602,14 @@ bool EmulatedController::IsConfiguring() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EmulatedController::SaveCurrentConfig() {
|
void EmulatedController::SaveCurrentConfig() {
|
||||||
const auto player_index = NpadIdTypeToIndex(npad_id_type);
|
// Other and Handheld can't alter the config from here
|
||||||
|
if (npad_id_type == NpadIdType::Other || npad_id_type == NpadIdType::Handheld) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto player_index = NpadIdTypeToConfigIndex(npad_id_type);
|
||||||
auto& player = Settings::values.players.GetValue()[player_index];
|
auto& player = Settings::values.players.GetValue()[player_index];
|
||||||
|
|
||||||
player.connected = is_connected;
|
player.connected = is_connected;
|
||||||
player.controller_type = MapNPadToSettingsType(npad_type);
|
player.controller_type = MapNPadToSettingsType(npad_type);
|
||||||
for (std::size_t index = 0; index < player.buttons.size(); ++index) {
|
for (std::size_t index = 0; index < player.buttons.size(); ++index) {
|
||||||
|
@@ -281,10 +281,10 @@ static_assert(sizeof(ProcessorState) == 0xE20, "ProcessorState is an invalid siz
|
|||||||
|
|
||||||
// This is nn::irsensor::detail::DeviceFormat
|
// This is nn::irsensor::detail::DeviceFormat
|
||||||
struct DeviceFormat {
|
struct DeviceFormat {
|
||||||
Core::IrSensor::IrCameraStatus camera_status{Core::IrSensor::IrCameraStatus::Available};
|
Core::IrSensor::IrCameraStatus camera_status{Core::IrSensor::IrCameraStatus::Unconnected};
|
||||||
Core::IrSensor::IrCameraInternalStatus camera_internal_status{
|
Core::IrSensor::IrCameraInternalStatus camera_internal_status{
|
||||||
Core::IrSensor::IrCameraInternalStatus::Stopped};
|
Core::IrSensor::IrCameraInternalStatus::Ready};
|
||||||
Core::IrSensor::IrSensorMode mode{Core::IrSensor::IrSensorMode::ImageTransferProcessor};
|
Core::IrSensor::IrSensorMode mode{Core::IrSensor::IrSensorMode::None};
|
||||||
ProcessorState state{};
|
ProcessorState state{};
|
||||||
};
|
};
|
||||||
static_assert(sizeof(DeviceFormat) == 0xE30, "DeviceFormat is an invalid size");
|
static_assert(sizeof(DeviceFormat) == 0xE30, "DeviceFormat is an invalid size");
|
||||||
|
@@ -296,7 +296,7 @@ void IRS::RunTeraPluginProcessor(HLERequestContext& ctx) {
|
|||||||
|
|
||||||
if (result.IsSuccess()) {
|
if (result.IsSuccess()) {
|
||||||
auto& device = GetIrCameraSharedMemoryDeviceEntry(parameters.camera_handle);
|
auto& device = GetIrCameraSharedMemoryDeviceEntry(parameters.camera_handle);
|
||||||
MakeProcessorWithCoreContext<TeraPluginProcessor>(parameters.camera_handle, device);
|
MakeProcessor<TeraPluginProcessor>(parameters.camera_handle, device);
|
||||||
auto& image_transfer_processor =
|
auto& image_transfer_processor =
|
||||||
GetProcessor<TeraPluginProcessor>(parameters.camera_handle);
|
GetProcessor<TeraPluginProcessor>(parameters.camera_handle);
|
||||||
image_transfer_processor.SetConfig(parameters.processor_config);
|
image_transfer_processor.SetConfig(parameters.processor_config);
|
||||||
|
@@ -1,103 +1,29 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
#include "core/hid/emulated_controller.h"
|
|
||||||
#include "core/hid/hid_core.h"
|
|
||||||
#include "core/hle/service/hid/irsensor/tera_plugin_processor.h"
|
#include "core/hle/service/hid/irsensor/tera_plugin_processor.h"
|
||||||
|
|
||||||
namespace Service::IRS {
|
namespace Service::IRS {
|
||||||
TeraPluginProcessor::TeraPluginProcessor(Core::HID::HIDCore& hid_core_,
|
TeraPluginProcessor::TeraPluginProcessor(Core::IrSensor::DeviceFormat& device_format)
|
||||||
Core::IrSensor::DeviceFormat& device_format,
|
: device(device_format) {
|
||||||
std::size_t npad_index)
|
|
||||||
: device{device_format} {
|
|
||||||
npad_device = hid_core_.GetEmulatedControllerByIndex(npad_index);
|
|
||||||
|
|
||||||
device.mode = Core::IrSensor::IrSensorMode::TeraPluginProcessor;
|
device.mode = Core::IrSensor::IrSensorMode::TeraPluginProcessor;
|
||||||
device.camera_status = Core::IrSensor::IrCameraStatus::Unconnected;
|
device.camera_status = Core::IrSensor::IrCameraStatus::Unconnected;
|
||||||
device.camera_internal_status = Core::IrSensor::IrCameraInternalStatus::Stopped;
|
device.camera_internal_status = Core::IrSensor::IrCameraInternalStatus::Stopped;
|
||||||
|
|
||||||
shared_memory = std::construct_at(
|
|
||||||
reinterpret_cast<TeraSharedMemory*>(&device_format.state.processor_raw_data));
|
|
||||||
|
|
||||||
Core::HID::ControllerUpdateCallback engine_callback{
|
|
||||||
.on_change = [this](Core::HID::ControllerTriggerType type) { OnControllerUpdate(type); },
|
|
||||||
.is_npad_service = true,
|
|
||||||
};
|
|
||||||
callback_key = npad_device->SetCallback(engine_callback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TeraPluginProcessor::~TeraPluginProcessor() {
|
TeraPluginProcessor::~TeraPluginProcessor() = default;
|
||||||
npad_device->DeleteCallback(callback_key);
|
|
||||||
};
|
|
||||||
|
|
||||||
void TeraPluginProcessor::StartProcessor() {
|
void TeraPluginProcessor::StartProcessor() {}
|
||||||
device.camera_status = Core::IrSensor::IrCameraStatus::Available;
|
|
||||||
device.camera_internal_status = Core::IrSensor::IrCameraInternalStatus::Ready;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TeraPluginProcessor::SuspendProcessor() {}
|
void TeraPluginProcessor::SuspendProcessor() {}
|
||||||
|
|
||||||
void TeraPluginProcessor::StopProcessor() {}
|
void TeraPluginProcessor::StopProcessor() {}
|
||||||
|
|
||||||
void TeraPluginProcessor::OnControllerUpdate(Core::HID::ControllerTriggerType type) {
|
|
||||||
if (type != Core::HID::ControllerTriggerType::IrSensor) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
next_state = {};
|
|
||||||
const auto camera_data = npad_device->GetCamera();
|
|
||||||
auto filtered_image = camera_data.data;
|
|
||||||
|
|
||||||
memcpy(next_state.data.data(), filtered_image.data(), GetDataSize(format));
|
|
||||||
|
|
||||||
// These 4 bytes seem to control the brightness of a image
|
|
||||||
next_state.data[0] = 1;
|
|
||||||
next_state.data[1] = 2;
|
|
||||||
next_state.data[2] = 0xde;
|
|
||||||
next_state.data[3] = 0x07;
|
|
||||||
|
|
||||||
// Data from HW
|
|
||||||
/* next_state.data = {
|
|
||||||
0x01, 0x02, 0xde, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x48, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa4,
|
|
||||||
0x41, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x13, 0x13, 0x00, 0x00, 0x06, 0x00, 0xc0, 0x28,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x3c, 0x00, 0x05, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x20, 0xa8, 0x09, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x04,
|
|
||||||
0x12, 0x41, 0x00, 0x00, 0x13, 0x86, 0x02, 0x00, 0x00, 0x00, 0x1e, 0xc0, 0x02, 0x00, 0x00, 0x00,
|
|
||||||
0x40, 0x0f, 0x00, 0x00, 0x00, 0x30, 0xcd, 0x34, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x10, 0xa4, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x02, 0x00, 0x00, 0x80, 0xf3, 0x01, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x36, 0x08, 0x04, 0x60, 0x02, 0x00, 0x76, 0x80, 0x09, 0x00, 0x00, 0x88, 0xd1,
|
|
||||||
0x20, 0x00, 0x00, 0x00, 0x65, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x80, 0x06, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x28, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x40, 0x01, 0x68, 0x00, 0x00, 0x00,
|
|
||||||
0x80, 0xf2, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00,
|
|
||||||
0x04, 0x00, 0x00, 0x00, 0x04, 0x80, 0x04, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x06, 0x06, 0x00,
|
|
||||||
0x00, 0x00, 0x04, 0xa0, 0x57, 0x02, 0x04, 0x40, 0x51, 0x02, 0x00, 0x40, 0xc1, 0x01, 0x00, 0x50,
|
|
||||||
0x86, 0x02, 0x00, 0x50, 0x0d, 0x04, 0x00, 0xb0, 0x05, 0x00, 0x00, 0x50, 0x04, 0x00, 0x00, 0xb0,
|
|
||||||
0x09, 0x00, 0x00, 0xb0, 0x01, 0xc0, 0x06, 0xc0, 0x0e, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00, 0x20,
|
|
||||||
0x01, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x20, 0x05, 0x00, 0x00, 0x80,
|
|
||||||
0x01, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x86, 0x01, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x00,
|
|
||||||
0x00,
|
|
||||||
};*/
|
|
||||||
next_state.sampling_number = camera_data.sample;
|
|
||||||
next_state.timestamp = next_state.sampling_number + 131;
|
|
||||||
next_state.ambient_noise_level = Core::IrSensor::CameraAmbientNoiseLevel::Low;
|
|
||||||
|
|
||||||
shared_memory->tera_lifo.WriteNextEntry(next_state);
|
|
||||||
|
|
||||||
if (!IsProcessorActive()) {
|
|
||||||
StartProcessor();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void TeraPluginProcessor::SetConfig(Core::IrSensor::PackedTeraPluginProcessorConfig config) {
|
void TeraPluginProcessor::SetConfig(Core::IrSensor::PackedTeraPluginProcessorConfig config) {
|
||||||
current_config.mode = config.mode;
|
current_config.mode = config.mode;
|
||||||
current_config.unknown_1 = config.unknown_1;
|
current_config.unknown_1 = config.unknown_1;
|
||||||
current_config.unknown_2 = config.unknown_2;
|
current_config.unknown_2 = config.unknown_2;
|
||||||
current_config.unknown_3 = config.unknown_3;
|
current_config.unknown_3 = config.unknown_3;
|
||||||
|
|
||||||
LOG_ERROR(Service_IRS, "{} {} {} {}", config.mode, config.unknown_1, config.unknown_2,
|
|
||||||
config.unknown_3);
|
|
||||||
npad_device->SetCameraFormat(format);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::IRS
|
} // namespace Service::IRS
|
||||||
|
@@ -3,21 +3,15 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "common/bit_field.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/hid/irs_types.h"
|
#include "core/hid/irs_types.h"
|
||||||
#include "core/hle/service/hid/irs_ring_lifo.h"
|
|
||||||
#include "core/hle/service/hid/irsensor/processor_base.h"
|
#include "core/hle/service/hid/irsensor/processor_base.h"
|
||||||
|
|
||||||
namespace Core::HID {
|
|
||||||
class EmulatedController;
|
|
||||||
} // namespace Core::HID
|
|
||||||
|
|
||||||
namespace Service::IRS {
|
namespace Service::IRS {
|
||||||
class TeraPluginProcessor final : public ProcessorBase {
|
class TeraPluginProcessor final : public ProcessorBase {
|
||||||
public:
|
public:
|
||||||
explicit TeraPluginProcessor(Core::HID::HIDCore& hid_core_,
|
explicit TeraPluginProcessor(Core::IrSensor::DeviceFormat& device_format);
|
||||||
Core::IrSensor::DeviceFormat& device_format,
|
|
||||||
std::size_t npad_index);
|
|
||||||
~TeraPluginProcessor() override;
|
~TeraPluginProcessor() override;
|
||||||
|
|
||||||
// Called when the processor is initialized
|
// Called when the processor is initialized
|
||||||
@@ -33,10 +27,6 @@ public:
|
|||||||
void SetConfig(Core::IrSensor::PackedTeraPluginProcessorConfig config);
|
void SetConfig(Core::IrSensor::PackedTeraPluginProcessorConfig config);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr auto format = Core::IrSensor::ImageTransferProcessorFormat::Size20x15;
|
|
||||||
static constexpr std::size_t width = 40;
|
|
||||||
static constexpr std::size_t height = 30;
|
|
||||||
|
|
||||||
// This is nn::irsensor::TeraPluginProcessorConfig
|
// This is nn::irsensor::TeraPluginProcessorConfig
|
||||||
struct TeraPluginProcessorConfig {
|
struct TeraPluginProcessorConfig {
|
||||||
u8 mode;
|
u8 mode;
|
||||||
@@ -56,22 +46,8 @@ private:
|
|||||||
static_assert(sizeof(TeraPluginProcessorState) == 0x140,
|
static_assert(sizeof(TeraPluginProcessorState) == 0x140,
|
||||||
"TeraPluginProcessorState is an invalid size");
|
"TeraPluginProcessorState is an invalid size");
|
||||||
|
|
||||||
struct TeraSharedMemory {
|
|
||||||
Service::IRS::Lifo<TeraPluginProcessorState, 6> tera_lifo;
|
|
||||||
static_assert(sizeof(tera_lifo) == 0x790, "tera_lifo is an invalid size");
|
|
||||||
INSERT_PADDING_WORDS(0x1A4);
|
|
||||||
};
|
|
||||||
static_assert(sizeof(TeraSharedMemory) == 0xE20, "TeraSharedMemory is an invalid size");
|
|
||||||
|
|
||||||
void OnControllerUpdate(Core::HID::ControllerTriggerType type);
|
|
||||||
|
|
||||||
TeraSharedMemory* shared_memory = nullptr;
|
|
||||||
TeraPluginProcessorState next_state{};
|
|
||||||
|
|
||||||
TeraPluginProcessorConfig current_config{};
|
TeraPluginProcessorConfig current_config{};
|
||||||
Core::IrSensor::DeviceFormat& device;
|
Core::IrSensor::DeviceFormat& device;
|
||||||
Core::HID::EmulatedController* npad_device;
|
|
||||||
int callback_key{};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::IRS
|
} // namespace Service::IRS
|
||||||
|
@@ -196,6 +196,7 @@ void ConfigureInput::ApplyConfiguration() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
advanced->ApplyConfiguration();
|
advanced->ApplyConfiguration();
|
||||||
|
system.HIDCore().ReloadInputDevices();
|
||||||
|
|
||||||
const bool pre_docked_mode = Settings::values.use_docked_mode.GetValue();
|
const bool pre_docked_mode = Settings::values.use_docked_mode.GetValue();
|
||||||
Settings::values.use_docked_mode.SetValue(ui->radioDocked->isChecked());
|
Settings::values.use_docked_mode.SetValue(ui->radioDocked->isChecked());
|
||||||
|
@@ -89,17 +89,12 @@ void ConfigureInputPerGame::LoadConfiguration() {
|
|||||||
|
|
||||||
emulated_controller->ReloadFromSettings();
|
emulated_controller->ReloadFromSettings();
|
||||||
|
|
||||||
if (player_index > 0) {
|
if (player_index != HANDHELD_INDEX) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle Handheld cases
|
// Handle Handheld cases
|
||||||
auto& handheld_player = Settings::values.players.GetValue()[HANDHELD_INDEX];
|
auto handheld_controller = hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld);
|
||||||
auto* handheld_controller = hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld);
|
|
||||||
if (player.controller_type == Settings::ControllerType::Handheld) {
|
|
||||||
handheld_player = player;
|
|
||||||
} else {
|
|
||||||
handheld_player = {};
|
|
||||||
}
|
|
||||||
handheld_controller->ReloadFromSettings();
|
handheld_controller->ReloadFromSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -296,26 +296,11 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
|||||||
is_powered_on{is_powered_on_}, input_subsystem{input_subsystem_}, profiles(profiles_),
|
is_powered_on{is_powered_on_}, input_subsystem{input_subsystem_}, profiles(profiles_),
|
||||||
timeout_timer(std::make_unique<QTimer>()),
|
timeout_timer(std::make_unique<QTimer>()),
|
||||||
poll_timer(std::make_unique<QTimer>()), bottom_row{bottom_row_}, hid_core{hid_core_} {
|
poll_timer(std::make_unique<QTimer>()), bottom_row{bottom_row_}, hid_core{hid_core_} {
|
||||||
if (player_index == 0) {
|
|
||||||
auto* emulated_controller_p1 =
|
emulated_controller = hid_core.GetEmulatedControllerByIndex(player_index);
|
||||||
hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1);
|
emulated_controller->SaveCurrentConfig();
|
||||||
auto* emulated_controller_handheld =
|
emulated_controller->EnableConfiguration();
|
||||||
hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld);
|
|
||||||
emulated_controller_p1->SaveCurrentConfig();
|
|
||||||
emulated_controller_p1->EnableConfiguration();
|
|
||||||
emulated_controller_handheld->SaveCurrentConfig();
|
|
||||||
emulated_controller_handheld->EnableConfiguration();
|
|
||||||
if (emulated_controller_handheld->IsConnected(true)) {
|
|
||||||
emulated_controller_p1->Disconnect();
|
|
||||||
emulated_controller = emulated_controller_handheld;
|
|
||||||
} else {
|
|
||||||
emulated_controller = emulated_controller_p1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
emulated_controller = hid_core.GetEmulatedControllerByIndex(player_index);
|
|
||||||
emulated_controller->SaveCurrentConfig();
|
|
||||||
emulated_controller->EnableConfiguration();
|
|
||||||
}
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
setFocusPolicy(Qt::ClickFocus);
|
setFocusPolicy(Qt::ClickFocus);
|
||||||
@@ -747,29 +732,6 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
|||||||
UpdateMotionButtons();
|
UpdateMotionButtons();
|
||||||
const Core::HID::NpadStyleIndex type =
|
const Core::HID::NpadStyleIndex type =
|
||||||
GetControllerTypeFromIndex(ui->comboControllerType->currentIndex());
|
GetControllerTypeFromIndex(ui->comboControllerType->currentIndex());
|
||||||
|
|
||||||
if (player_index == 0) {
|
|
||||||
auto* emulated_controller_p1 =
|
|
||||||
hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1);
|
|
||||||
auto* emulated_controller_handheld =
|
|
||||||
hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld);
|
|
||||||
bool is_connected = emulated_controller->IsConnected(true);
|
|
||||||
|
|
||||||
emulated_controller_p1->SetNpadStyleIndex(type);
|
|
||||||
emulated_controller_handheld->SetNpadStyleIndex(type);
|
|
||||||
if (is_connected) {
|
|
||||||
if (type == Core::HID::NpadStyleIndex::Handheld) {
|
|
||||||
emulated_controller_p1->Disconnect();
|
|
||||||
emulated_controller_handheld->Connect(true);
|
|
||||||
emulated_controller = emulated_controller_handheld;
|
|
||||||
} else {
|
|
||||||
emulated_controller_handheld->Disconnect();
|
|
||||||
emulated_controller_p1->Connect(true);
|
|
||||||
emulated_controller = emulated_controller_p1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ui->controllerFrame->SetController(emulated_controller);
|
|
||||||
}
|
|
||||||
emulated_controller->SetNpadStyleIndex(type);
|
emulated_controller->SetNpadStyleIndex(type);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -805,32 +767,10 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
|||||||
}
|
}
|
||||||
|
|
||||||
ConfigureInputPlayer::~ConfigureInputPlayer() {
|
ConfigureInputPlayer::~ConfigureInputPlayer() {
|
||||||
if (player_index == 0) {
|
emulated_controller->DisableConfiguration();
|
||||||
auto* emulated_controller_p1 =
|
|
||||||
hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1);
|
|
||||||
auto* emulated_controller_handheld =
|
|
||||||
hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld);
|
|
||||||
emulated_controller_p1->DisableConfiguration();
|
|
||||||
emulated_controller_handheld->DisableConfiguration();
|
|
||||||
} else {
|
|
||||||
emulated_controller->DisableConfiguration();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInputPlayer::ApplyConfiguration() {
|
void ConfigureInputPlayer::ApplyConfiguration() {
|
||||||
if (player_index == 0) {
|
|
||||||
auto* emulated_controller_p1 =
|
|
||||||
hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1);
|
|
||||||
auto* emulated_controller_handheld =
|
|
||||||
hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld);
|
|
||||||
emulated_controller_p1->DisableConfiguration();
|
|
||||||
emulated_controller_p1->SaveCurrentConfig();
|
|
||||||
emulated_controller_p1->EnableConfiguration();
|
|
||||||
emulated_controller_handheld->DisableConfiguration();
|
|
||||||
emulated_controller_handheld->SaveCurrentConfig();
|
|
||||||
emulated_controller_handheld->EnableConfiguration();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
emulated_controller->DisableConfiguration();
|
emulated_controller->DisableConfiguration();
|
||||||
emulated_controller->SaveCurrentConfig();
|
emulated_controller->SaveCurrentConfig();
|
||||||
emulated_controller->EnableConfiguration();
|
emulated_controller->EnableConfiguration();
|
||||||
|
Reference in New Issue
Block a user