Closes eden-emulator/Issue-Reports#8 Closes eden-emulator/Issue-Reports#428 Currently, [Android's input layer](https://android.googlesource.com/platform/frameworks/base.git/+/refs/heads/android16-release/data/keyboards/Vendor_057e_Product_2009.kl#54) doesn't return `KEYCODE_DPAD_*` for the left Joy-Con, we fall back to the scan code in this case, this will also fix most third party Joy-Con controllers. - The scan codes are not reliable and may vary from device to another. I searched for (0x220-0x223) values in the [android repo](https://android.googlesource.com/platform/frameworks/base.git/+/refs/heads/android16-release/data/keyboards) and they all have the same DPAD_* key mapping, so not a big issue just might cause future issues if Google change the mapping in another vendor. I could simply limit the fix to the [left Joy-Con](https://github.com/torvalds/linux/blob/master/drivers/hid/hid-ids.h#L1096-L1105) `if (event.keyCode == 0 && event.device.vendorId == 0x057e && event.device.productId == 0x2006)`. - Auto mapping doesn't work, I'm not very familiar with the JNI Specification, I managed to implement the below workaround, it basically checks if it's the left Joy-Con and add the first four DPAD_* keycodes ```cpp // ./src/input_common/drivers/android.cpp ButtonMapping Android::GetButtonMappingForDevice(const Common::ParamPackage& params) { // ... const char *yuzu_device_name = env->GetStringUTFChars((jstring) env->CallObjectMethod(j_device, Common::Android::GetYuzuDeviceGetName()), &isCopy); const char *switch_left_string_name = "Nintendo Switch Left Joy-Con"; bool is_switch_left = strncmp(yuzu_device_name, switch_left_string_name, strlen(switch_left_string_name)) == 0; std::set<s32> available_keys; for (size_t i = 0; i < keycode_ids.size(); ++i) { if (j_has_keys[i] || (is_switch_left && i <= 3)) { available_keys.insert(keycode_ids[i]); } } // ... } ``` Signed-off-by: crueter <crueter@eden-emu.dev> Authored-by: Anas Bouzid <bouzid.anas.1@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4225 Reviewed-by: Lizzie <lizzie@eden-emu.dev> Reviewed-by: Maufeat <sahyno1996@gmail.com>
Eden
Eden is a free and opensource (FOSS) Switch 1 emulator, derived from Yuzu and Sudachi - started by developer Camille LaVey. It's written in C++ with portability in mind, with builds for Windows, Linux, macOS, Android, FreeBSD and more.
Compatibility | Development | Building | Download | Support | License
Compatibility
The emulator is capable of running most commercial games at full speed, provided you meet the necessary hardware requirements.
A list of supported games will be available in future. Please be patient.
Check out our website for the latest news on exciting features, monthly progress reports, and more!
Contribute
To contribute to Eden; be it financially, code, bug reports, or otherwise, see our Contributing guidelines.
Documentation
We have a user manual! See our User Handbook.
Building
See the General Build Guide
For information on provided development tooling, see the Tools directory
Download
You can download the latest releases from our release page.
Save us some bandwidth! We have mirrors available as well.
License
Eden is licensed under the GPLv3 (or any later version). Refer to the LICENSE.txt file.