early-access version 3302
This commit is contained in:
parent
94223944e1
commit
c997a92b1d
7 changed files with 27 additions and 112 deletions
|
@ -1,7 +1,7 @@
|
||||||
yuzu emulator early access
|
yuzu emulator early access
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is the source code for early-access 3301.
|
This is the source code for early-access 3302.
|
||||||
|
|
||||||
## Legal Notice
|
## Legal Notice
|
||||||
|
|
||||||
|
|
|
@ -44,12 +44,6 @@ void Joycons::Reset() {
|
||||||
}
|
}
|
||||||
device->Stop();
|
device->Stop();
|
||||||
}
|
}
|
||||||
for (const auto& device : pro_joycons) {
|
|
||||||
if (!device) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
device->Stop();
|
|
||||||
}
|
|
||||||
SDL_hid_exit();
|
SDL_hid_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,11 +59,6 @@ void Joycons::Setup() {
|
||||||
PreSetController(GetIdentifier(port, Joycon::ControllerType::Right));
|
PreSetController(GetIdentifier(port, Joycon::ControllerType::Right));
|
||||||
device = std::make_shared<Joycon::JoyconDriver>(port++);
|
device = std::make_shared<Joycon::JoyconDriver>(port++);
|
||||||
}
|
}
|
||||||
port = 0;
|
|
||||||
for (auto& device : pro_joycons) {
|
|
||||||
PreSetController(GetIdentifier(port, Joycon::ControllerType::Pro));
|
|
||||||
device = std::make_shared<Joycon::JoyconDriver>(port++);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!scan_thread_running) {
|
if (!scan_thread_running) {
|
||||||
scan_thread = std::jthread([this](std::stop_token stop_token) { ScanThread(stop_token); });
|
scan_thread = std::jthread([this](std::stop_token stop_token) { ScanThread(stop_token); });
|
||||||
|
@ -77,10 +66,11 @@ void Joycons::Setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Joycons::ScanThread(std::stop_token stop_token) {
|
void Joycons::ScanThread(std::stop_token stop_token) {
|
||||||
|
constexpr u16 nintendo_vendor_id = 0x057e;
|
||||||
Common::SetCurrentThreadName("yuzu:input:JoyconScanThread");
|
Common::SetCurrentThreadName("yuzu:input:JoyconScanThread");
|
||||||
scan_thread_running = true;
|
scan_thread_running = true;
|
||||||
while (!stop_token.stop_requested()) {
|
while (!stop_token.stop_requested()) {
|
||||||
SDL_hid_device_info* devs = SDL_hid_enumerate(0x0, 0x0);
|
SDL_hid_device_info* devs = SDL_hid_enumerate(nintendo_vendor_id, 0x0);
|
||||||
SDL_hid_device_info* cur_dev = devs;
|
SDL_hid_device_info* cur_dev = devs;
|
||||||
|
|
||||||
while (cur_dev) {
|
while (cur_dev) {
|
||||||
|
@ -140,14 +130,6 @@ bool Joycons::IsDeviceNew(SDL_hid_device_info* device_info) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Joycon::ControllerType::Pro:
|
|
||||||
case Joycon::ControllerType::Grip:
|
|
||||||
for (const auto& device : pro_joycons) {
|
|
||||||
if (is_handle_identical(device)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -218,13 +200,6 @@ std::shared_ptr<Joycon::JoyconDriver> Joycons::GetNextFreeHandle(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type == Joycon::ControllerType::Pro || type == Joycon::ControllerType::Grip) {
|
|
||||||
for (const auto& device : pro_joycons) {
|
|
||||||
if (!device->IsConnected()) {
|
|
||||||
return device;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,13 +405,6 @@ std::shared_ptr<Joycon::JoyconDriver> Joycons::GetHandle(PadIdentifier identifie
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type == Joycon::ControllerType::Pro || type == Joycon::ControllerType::Grip) {
|
|
||||||
for (const auto& device : pro_joycons) {
|
|
||||||
if (is_handle_active(device)) {
|
|
||||||
return device;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,9 +442,6 @@ std::vector<Common::ParamPackage> Joycons::GetInputDevices() const {
|
||||||
for (const auto& controller : right_joycons) {
|
for (const auto& controller : right_joycons) {
|
||||||
add_entry(controller);
|
add_entry(controller);
|
||||||
}
|
}
|
||||||
for (const auto& controller : pro_joycons) {
|
|
||||||
add_entry(controller);
|
|
||||||
}
|
|
||||||
|
|
||||||
// List dual joycon pairs
|
// List dual joycon pairs
|
||||||
for (std::size_t i = 0; i < MaxSupportedControllers; i++) {
|
for (std::size_t i = 0; i < MaxSupportedControllers; i++) {
|
||||||
|
|
|
@ -104,7 +104,6 @@ private:
|
||||||
// Joycon types are split by type to ease supporting dualjoycon configurations
|
// Joycon types are split by type to ease supporting dualjoycon configurations
|
||||||
std::array<std::shared_ptr<Joycon::JoyconDriver>, MaxSupportedControllers> left_joycons{};
|
std::array<std::shared_ptr<Joycon::JoyconDriver>, MaxSupportedControllers> left_joycons{};
|
||||||
std::array<std::shared_ptr<Joycon::JoyconDriver>, MaxSupportedControllers> right_joycons{};
|
std::array<std::shared_ptr<Joycon::JoyconDriver>, MaxSupportedControllers> right_joycons{};
|
||||||
std::array<std::shared_ptr<Joycon::JoyconDriver>, MaxSupportedControllers> pro_joycons{};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace InputCommon
|
} // namespace InputCommon
|
||||||
|
|
|
@ -319,7 +319,8 @@ void SDLDriver::InitJoystick(int joystick_index) {
|
||||||
const auto guid = GetGUID(sdl_joystick);
|
const auto guid = GetGUID(sdl_joystick);
|
||||||
|
|
||||||
if (Settings::values.enable_joycon_driver) {
|
if (Settings::values.enable_joycon_driver) {
|
||||||
if (guid.uuid[5] == 0x05 && guid.uuid[4] == 0x7e) {
|
if (guid.uuid[5] == 0x05 && guid.uuid[4] == 0x7e &&
|
||||||
|
(guid.uuid[8] == 0x06 || guid.uuid[8] == 0x07)) {
|
||||||
LOG_ERROR(Input, "Device black listed {}", joystick_index);
|
LOG_ERROR(Input, "Device black listed {}", joystick_index);
|
||||||
SDL_JoystickClose(sdl_joystick);
|
SDL_JoystickClose(sdl_joystick);
|
||||||
return;
|
return;
|
||||||
|
@ -451,11 +452,10 @@ SDLDriver::SDLDriver(std::string input_engine_) : InputEngine(std::move(input_en
|
||||||
// Disable hidapi drivers for switch controllers when the custom joycon driver is enabled
|
// Disable hidapi drivers for switch controllers when the custom joycon driver is enabled
|
||||||
if (Settings::values.enable_joycon_driver) {
|
if (Settings::values.enable_joycon_driver) {
|
||||||
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "0");
|
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "0");
|
||||||
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_SWITCH, "0");
|
|
||||||
} else {
|
} else {
|
||||||
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "1");
|
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "1");
|
||||||
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_SWITCH, "1");
|
|
||||||
}
|
}
|
||||||
|
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_SWITCH, "1");
|
||||||
|
|
||||||
// Disable hidapi driver for xbox. Already default on Windows, this causes conflict with native
|
// Disable hidapi driver for xbox. Already default on Windows, this causes conflict with native
|
||||||
// driver on Linux.
|
// driver on Linux.
|
||||||
|
|
|
@ -28,7 +28,6 @@ void JoyconDriver::Stop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
DriverResult JoyconDriver::RequestDeviceAccess(SDL_hid_device_info* device_info) {
|
DriverResult JoyconDriver::RequestDeviceAccess(SDL_hid_device_info* device_info) {
|
||||||
constexpr u16 nintendo_vendor_id = 0x057e;
|
|
||||||
std::scoped_lock lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
|
|
||||||
handle_device_type = ControllerType::None;
|
handle_device_type = ControllerType::None;
|
||||||
|
@ -36,7 +35,6 @@ DriverResult JoyconDriver::RequestDeviceAccess(SDL_hid_device_info* device_info)
|
||||||
if (handle_device_type == ControllerType::None) {
|
if (handle_device_type == ControllerType::None) {
|
||||||
return DriverResult::UnsupportedControllerType;
|
return DriverResult::UnsupportedControllerType;
|
||||||
}
|
}
|
||||||
is_third_party = nintendo_vendor_id != device_info->vendor_id;
|
|
||||||
|
|
||||||
hidapi_handle->handle =
|
hidapi_handle->handle =
|
||||||
SDL_hid_open(device_info->vendor_id, device_info->product_id, device_info->serial_number);
|
SDL_hid_open(device_info->vendor_id, device_info->product_id, device_info->serial_number);
|
||||||
|
@ -336,15 +334,8 @@ JoyconDriver::SupportedFeatures JoyconDriver::GetSupportedFeatures() {
|
||||||
.passive = true,
|
.passive = true,
|
||||||
.motion = true,
|
.motion = true,
|
||||||
.vibration = true,
|
.vibration = true,
|
||||||
.home_led = true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (is_third_party) {
|
|
||||||
features.passive = false;
|
|
||||||
features.home_led = false;
|
|
||||||
return features;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (device_type == ControllerType::Right) {
|
if (device_type == ControllerType::Right) {
|
||||||
features.nfc = true;
|
features.nfc = true;
|
||||||
features.irs = true;
|
features.irs = true;
|
||||||
|
@ -354,7 +345,6 @@ JoyconDriver::SupportedFeatures JoyconDriver::GetSupportedFeatures() {
|
||||||
if (device_type == ControllerType::Pro) {
|
if (device_type == ControllerType::Pro) {
|
||||||
features.nfc = true;
|
features.nfc = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return features;
|
return features;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -550,65 +540,23 @@ void JoyconDriver::SetCallbacks(const JoyconCallbacks& callbacks) {
|
||||||
|
|
||||||
DriverResult JoyconDriver::GetDeviceType(SDL_hid_device_info* device_info,
|
DriverResult JoyconDriver::GetDeviceType(SDL_hid_device_info* device_info,
|
||||||
ControllerType& controller_type) {
|
ControllerType& controller_type) {
|
||||||
|
static constexpr std::array<std::pair<u32, ControllerType>, 2> supported_devices{
|
||||||
|
std::pair<u32, ControllerType>{0x2006, ControllerType::Left},
|
||||||
|
{0x2007, ControllerType::Right},
|
||||||
|
};
|
||||||
constexpr u16 nintendo_vendor_id = 0x057e;
|
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;
|
controller_type = ControllerType::None;
|
||||||
if (nintendo_vendor_id == device_info->vendor_id) {
|
if (device_info->vendor_id != nintendo_vendor_id) {
|
||||||
switch (device_info->product_id) {
|
return DriverResult::UnsupportedControllerType;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const auto& [product_id, type] : supported_devices) {
|
||||||
|
if (device_info->product_id == static_cast<u16>(product_id)) {
|
||||||
|
controller_type = type;
|
||||||
|
return Joycon::DriverResult::Success;
|
||||||
|
}
|
||||||
|
}
|
||||||
return Joycon::DriverResult::UnsupportedControllerType;
|
return Joycon::DriverResult::UnsupportedControllerType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,6 @@ private:
|
||||||
bool motion{};
|
bool motion{};
|
||||||
bool nfc{};
|
bool nfc{};
|
||||||
bool vibration{};
|
bool vibration{};
|
||||||
bool home_led{};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Main thread, actively request new data from the handle
|
/// Main thread, actively request new data from the handle
|
||||||
|
@ -131,7 +130,6 @@ private:
|
||||||
RingCalibration ring_calibration{};
|
RingCalibration ring_calibration{};
|
||||||
|
|
||||||
// Fixed joycon info
|
// Fixed joycon info
|
||||||
bool is_third_party{};
|
|
||||||
FirmwareVersion version{};
|
FirmwareVersion version{};
|
||||||
Color color{};
|
Color color{};
|
||||||
std::size_t port{};
|
std::size_t port{};
|
||||||
|
|
|
@ -889,10 +889,15 @@ void Device::RemoveUnsuitableExtensions() {
|
||||||
VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_EXTENSION_NAME);
|
VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_EXTENSION_NAME);
|
||||||
|
|
||||||
// VK_KHR_pipeline_executable_properties
|
// VK_KHR_pipeline_executable_properties
|
||||||
|
if (Settings::values.renderer_shader_feedback.GetValue()) {
|
||||||
extensions.pipeline_executable_properties =
|
extensions.pipeline_executable_properties =
|
||||||
features.pipeline_executable_properties.pipelineExecutableInfo;
|
features.pipeline_executable_properties.pipelineExecutableInfo;
|
||||||
RemoveExtensionIfUnsuitable(extensions.pipeline_executable_properties,
|
RemoveExtensionIfUnsuitable(extensions.pipeline_executable_properties,
|
||||||
VK_KHR_PIPELINE_EXECUTABLE_PROPERTIES_EXTENSION_NAME);
|
VK_KHR_PIPELINE_EXECUTABLE_PROPERTIES_EXTENSION_NAME);
|
||||||
|
} else {
|
||||||
|
extensions.pipeline_executable_properties = false;
|
||||||
|
loaded_extensions.erase(VK_KHR_PIPELINE_EXECUTABLE_PROPERTIES_EXTENSION_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
// VK_KHR_workgroup_memory_explicit_layout
|
// VK_KHR_workgroup_memory_explicit_layout
|
||||||
extensions.workgroup_memory_explicit_layout =
|
extensions.workgroup_memory_explicit_layout =
|
||||||
|
|
Loading…
Reference in a new issue