darthcloud / BlueRetro

Multiplayer Bluetooth controllers adapter for retro video game consoles
https://blueretro.io
Apache License 2.0
1.23k stars 103 forks source link

Fixed typo which prevents the auto detection of certain wired adapters #918

Closed pdaehne closed 4 months ago

pdaehne commented 4 months ago

Since restructuring the code on Apr 14, 2023, there seems to be a small typo in BlueRetro/main/wired/detect.c which prevents the auto detection of certain HW1 wired adapters. The buggy line 34 currently looks like this:

if (io & BIT(detect_pin[i] - 32)) {

In my opinion this should be

if (io & BIT(detect_pin[i] < 32 ? detect_pin[i] : detect_pin[i] - 32)) {

or much simpler

if (io & BIT(detect_pin[i] & 31)) {

darthcloud commented 4 months ago

Great catch!

Thank a lot!!