early-access version 3267

This commit is contained in:
pineappleEA 2022-12-30 22:42:54 +01:00
parent cc2219c160
commit 4014ed63c1
7 changed files with 123 additions and 21 deletions

View file

@ -1,7 +1,7 @@
yuzu emulator early access
=============
This is the source code for early-access 3266.
This is the source code for early-access 3267.
## Legal Notice

View file

@ -63,8 +63,6 @@ void IRS::ActivateIrsensor(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_IRS, "(STUBBED) called, applet_resource_user_id={}",
applet_resource_user_id);
npad_device->SetPollingMode(Common::Input::PollingMode::IR);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
@ -112,6 +110,7 @@ void IRS::StopImageProcessor(Kernel::HLERequestContext& ctx) {
auto result = IsIrCameraHandleValid(parameters.camera_handle);
if (result.IsSuccess()) {
// TODO: Stop Image processor
npad_device->SetPollingMode(Common::Input::PollingMode::Active);
result = ResultSuccess;
}
@ -143,6 +142,7 @@ void IRS::RunMomentProcessor(Kernel::HLERequestContext& ctx) {
MakeProcessor<MomentProcessor>(parameters.camera_handle, device);
auto& image_transfer_processor = GetProcessor<MomentProcessor>(parameters.camera_handle);
image_transfer_processor.SetConfig(parameters.processor_config);
npad_device->SetPollingMode(Common::Input::PollingMode::IR);
}
IPC::ResponseBuilder rb{ctx, 2};
@ -174,6 +174,7 @@ void IRS::RunClusteringProcessor(Kernel::HLERequestContext& ctx) {
auto& image_transfer_processor =
GetProcessor<ClusteringProcessor>(parameters.camera_handle);
image_transfer_processor.SetConfig(parameters.processor_config);
npad_device->SetPollingMode(Common::Input::PollingMode::IR);
}
IPC::ResponseBuilder rb{ctx, 2};
@ -223,6 +224,7 @@ void IRS::RunImageTransferProcessor(Kernel::HLERequestContext& ctx) {
GetProcessor<ImageTransferProcessor>(parameters.camera_handle);
image_transfer_processor.SetConfig(parameters.processor_config);
image_transfer_processor.SetTransferMemoryPointer(transfer_memory);
npad_device->SetPollingMode(Common::Input::PollingMode::IR);
}
IPC::ResponseBuilder rb{ctx, 2};
@ -298,6 +300,7 @@ void IRS::RunTeraPluginProcessor(Kernel::HLERequestContext& ctx) {
auto& image_transfer_processor =
GetProcessor<TeraPluginProcessor>(parameters.camera_handle);
image_transfer_processor.SetConfig(parameters.processor_config);
npad_device->SetPollingMode(Common::Input::PollingMode::IR);
}
IPC::ResponseBuilder rb{ctx, 2};
@ -347,6 +350,7 @@ void IRS::RunPointingProcessor(Kernel::HLERequestContext& ctx) {
MakeProcessor<PointingProcessor>(camera_handle, device);
auto& image_transfer_processor = GetProcessor<PointingProcessor>(camera_handle);
image_transfer_processor.SetConfig(processor_config);
npad_device->SetPollingMode(Common::Input::PollingMode::IR);
}
IPC::ResponseBuilder rb{ctx, 2};
@ -457,6 +461,7 @@ void IRS::RunImageTransferExProcessor(Kernel::HLERequestContext& ctx) {
GetProcessor<ImageTransferProcessor>(parameters.camera_handle);
image_transfer_processor.SetConfig(parameters.processor_config);
image_transfer_processor.SetTransferMemoryPointer(transfer_memory);
npad_device->SetPollingMode(Common::Input::PollingMode::IR);
}
IPC::ResponseBuilder rb{ctx, 2};
@ -483,6 +488,7 @@ void IRS::RunIrLedProcessor(Kernel::HLERequestContext& ctx) {
MakeProcessor<IrLedProcessor>(camera_handle, device);
auto& image_transfer_processor = GetProcessor<IrLedProcessor>(camera_handle);
image_transfer_processor.SetConfig(processor_config);
npad_device->SetPollingMode(Common::Input::PollingMode::IR);
}
IPC::ResponseBuilder rb{ctx, 2};
@ -508,6 +514,7 @@ void IRS::StopImageProcessorAsync(Kernel::HLERequestContext& ctx) {
auto result = IsIrCameraHandleValid(parameters.camera_handle);
if (result.IsSuccess()) {
// TODO: Stop image processor async
npad_device->SetPollingMode(Common::Input::PollingMode::IR);
result = ResultSuccess;
}
@ -529,8 +536,6 @@ void IRS::ActivateIrsensorWithFunctionLevel(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_IRS, "(STUBBED) called, function_level={}, applet_resource_user_id={}",
parameters.function_level.function_level, parameters.applet_resource_user_id);
npad_device->SetPollingMode(Common::Input::PollingMode::IR);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}

View file

@ -77,11 +77,10 @@ void Joycons::Setup() {
}
void Joycons::ScanThread(std::stop_token stop_token) {
constexpr u16 nintendo_vendor_id = 0x057e;
Common::SetCurrentThreadName("yuzu:input:JoyconScanThread");
scan_thread_running = true;
while (!stop_token.stop_requested()) {
SDL_hid_device_info* devs = SDL_hid_enumerate(nintendo_vendor_id, 0x0);
SDL_hid_device_info* devs = SDL_hid_enumerate(0x0, 0x0);
SDL_hid_device_info* cur_dev = devs;
while (cur_dev) {

View file

@ -28,6 +28,7 @@ void JoyconDriver::Stop() {
}
DriverResult JoyconDriver::RequestDeviceAccess(SDL_hid_device_info* device_info) {
constexpr u16 nintendo_vendor_id = 0x057e;
std::scoped_lock lock{mutex};
handle_device_type = ControllerType::None;
@ -35,6 +36,7 @@ DriverResult JoyconDriver::RequestDeviceAccess(SDL_hid_device_info* device_info)
if (handle_device_type == ControllerType::None) {
return DriverResult::UnsupportedControllerType;
}
is_third_party = nintendo_vendor_id != device_info->vendor_id;
hidapi_handle->handle =
SDL_hid_open(device_info->vendor_id, device_info->product_id, device_info->serial_number);
@ -334,8 +336,15 @@ JoyconDriver::SupportedFeatures JoyconDriver::GetSupportedFeatures() {
.passive = true,
.motion = true,
.vibration = true,
.home_led = true,
};
if (is_third_party) {
features.passive = false;
features.home_led = false;
return features;
}
if (device_type == ControllerType::Right) {
features.nfc = true;
features.irs = true;
@ -345,6 +354,7 @@ JoyconDriver::SupportedFeatures JoyconDriver::GetSupportedFeatures() {
if (device_type == ControllerType::Pro) {
features.nfc = true;
}
return features;
}
@ -530,25 +540,65 @@ void JoyconDriver::SetCallbacks(const JoyconCallbacks& callbacks) {
DriverResult JoyconDriver::GetDeviceType(SDL_hid_device_info* device_info,
ControllerType& controller_type) {
static constexpr std::array<std::pair<u32, ControllerType>, 4> supported_devices{
std::pair<u32, ControllerType>{0x2006, ControllerType::Left},
{0x2007, ControllerType::Right},
{0x2009, ControllerType::Pro},
{0x200E, ControllerType::Grip},
};
constexpr u16 nintendo_vendor_id = 0x057e;
constexpr u16 hori_vendor_id = 0x0f0d;
constexpr u16 pdp_vendor_id = 0x0e6f;
constexpr u16 powera_vendor_id = 0x20d6;
controller_type = ControllerType::None;
if (device_info->vendor_id != nintendo_vendor_id) {
return DriverResult::UnsupportedControllerType;
}
for (const auto& [product_id, type] : supported_devices) {
if (device_info->product_id == static_cast<u16>(product_id)) {
controller_type = type;
if (nintendo_vendor_id == device_info->vendor_id) {
switch (device_info->product_id) {
case 0x2006: // Nintendo Switch Joy-Con (Left)
controller_type = ControllerType::Left;
return Joycon::DriverResult::Success;
case 0x2007: // Nintendo Switch Joy-Con (Right)
controller_type = ControllerType::Right;
return Joycon::DriverResult::Success;
case 0x2008: // Nintendo Switch Joy-Con (Left+Right Combined)
case 0x2009: // Nintendo Switch Pro Controller
controller_type = ControllerType::Pro;
return Joycon::DriverResult::Success;
case 0x200E: // Nintendo Switch Grip Controller
controller_type = ControllerType::Grip;
return Joycon::DriverResult::Success;
}
}
if (hori_vendor_id == device_info->vendor_id) {
switch (device_info->product_id) {
case 0x00c1: // HORIPAD for Nintendo Switch
case 0x0092: // HORI Pokken Tournament DX Pro Pad
case 0x00f6: // HORI Wireless Switch Pad
case 0x00aa: // HORI Real Arcade Pro V Hayabusa in Switch Mode
controller_type = ControllerType::Pro;
return Joycon::DriverResult::Success;
}
}
if (pdp_vendor_id == device_info->vendor_id) {
switch (device_info->product_id) {
case 0x0180: // PDP Faceoff Wired Pro Controller for Nintendo Switch
case 0x0181: // PDP Faceoff Deluxe Wired Pro Controller for Nintendo Switch
case 0x0184: // PDP Faceoff Wired Deluxe+ Audio Controller
case 0x0185: // PDP Wired Fight Pad Pro for Nintendo Switch
case 0x0186: // PDP Afterglow Wireless Switch Controller
case 0x0187: // PDP Rockcandy Wired Controller
case 0x0188: // PDP Afterglow Wired Deluxe+ Audio Controller
controller_type = ControllerType::Pro;
return Joycon::DriverResult::Success;
}
}
if (powera_vendor_id == device_info->vendor_id) {
switch (device_info->product_id) {
case 0xa711: // PowerA Wired Controller Plus/PowerA Wired Controller Nintendo
case 0xa712: // PowerA Nintendo Switch Fusion Fight Pad
case 0xa713: // PowerA Super Mario Controller
case 0xa714: // PowerA Nintendo Switch Spectra Controller
case 0xa715: // Power A Fusion Wireless Arcade Stick (USB Mode)
case 0xa716: // PowerA Nintendo Switch Fusion Pro Controller
controller_type = ControllerType::Pro;
return Joycon::DriverResult::Success;
}
}
return Joycon::DriverResult::UnsupportedControllerType;
}

View file

@ -67,6 +67,7 @@ private:
bool motion{};
bool nfc{};
bool vibration{};
bool home_led{};
};
/// Main thread, actively request new data from the handle
@ -129,6 +130,7 @@ private:
RingCalibration ring_calibration{};
// Fixed joycon info
bool is_third_party{};
FirmwareVersion version{};
Color color{};
std::size_t port{};

View file

@ -14,6 +14,26 @@
#include "yuzu/configuration/configuration_shared.h"
#include "yuzu/configuration/configure_system.h"
constexpr std::array<u32, 7> LOCALE_BLOCKLIST{
// pzzefezrpnkzeidfej
// thhsrnhutlohsternp
// BHH4CG U
// Raa1AB S
// nn9
// ts
0b0100011100001100000, // Japan
0b0000001101001100100, // Americas
0b0100110100001000010, // Europe
0b0100110100001000010, // Australia
0b0000000000000000000, // China
0b0100111100001000000, // Korea
0b0100111100001000000, // Taiwan
};
static bool IsValidLocale(u32 region_index, u32 language_index) {
return ((LOCALE_BLOCKLIST.at(region_index) >> language_index) & 1) == 0;
}
ConfigureSystem::ConfigureSystem(Core::System& system_, QWidget* parent)
: QWidget(parent), ui{std::make_unique<Ui::ConfigureSystem>()}, system{system_} {
ui->setupUi(this);
@ -34,6 +54,22 @@ ConfigureSystem::ConfigureSystem(Core::System& system_, QWidget* parent)
}
});
const auto locale_check = [this](int index) {
const bool valid_locale =
IsValidLocale(ui->combo_region->currentIndex(), ui->combo_language->currentIndex());
ui->label_warn_invalid_locale->setVisible(!valid_locale);
if (!valid_locale) {
ui->label_warn_invalid_locale->setText(
tr("Warning: \"%1\" is not a valid language for region \"%2\"")
.arg(ui->combo_language->currentText())
.arg(ui->combo_region->currentText()));
}
};
connect(ui->combo_language, qOverload<int>(&QComboBox::currentIndexChanged), this,
locale_check);
connect(ui->combo_region, qOverload<int>(&QComboBox::currentIndexChanged), this, locale_check);
ui->label_console_id->setVisible(Settings::IsConfiguringGlobal());
ui->button_regenerate_console_id->setVisible(Settings::IsConfiguringGlobal());

View file

@ -326,7 +326,7 @@
</item>
<item>
<property name="text">
<string>English</string>
<string>American English</string>
</property>
</item>
<item>
@ -545,6 +545,16 @@
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_warn_invalid_locale">
<property name="text">
<string></string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_disable_info">
<property name="text">