Input reserved device menu item cleanup
Description
- Changed the empty option value to "None" like in the dropdown, because it looks confusing otherwise
- Fixed dropdown current selection detection
- Added reinit also to option reset just like in option change
- Trivial nits
The option is also missing left+right change, but decided to not add those since they will trigger reinit, which makes it rather annoying.
Re: #16647
Thanks for the care, I re-executed the tests in the original PR:
./retroarch --appendconfig tests-other/testinput_device_reservation_test.cfg\|tests-other/all_binds_empty.cfg
But now reserved devices set up in the test do not appear in menu. On the other hand, I guess there was something wrong with current selection detection, if it did not work as expected, maybe related to how the device is actually saved to config. Allow me some time to recollect my memories and do some more testing.
I have no idea how and why these changes would prevent anything from showing in the menu..
Seems to be the "None" related change. The code is prepared for cases when reserved device is given without vid:pid prefix (the tests set it up like that), it was carried over from the Android physical keyboard setting part, and in some corner cases it may be useful.
The needed change is quite small, in my tests it will work correctly in both ways with this modification:
if (string_is_empty(setting->value.target.string))
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NONE), len);
else if (sscanf(setting->value.target.string, "%04x:%04x ", &dev_vendor_id, &dev_product_id) != 2)
strlcpy(s, setting->value.target.string, len);
else
strlcpy(s, &setting->value.target.string[10], len);
Ok, thanks, fixed.
Kudos, re-tested, works as expected.