RetroArch icon indicating copy to clipboard operation
RetroArch copied to clipboard

Input reserved device menu item cleanup

Open sonninnos opened this issue 1 year ago • 5 comments

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.

sonninnos avatar Aug 31 '24 13:08 sonninnos

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.

zoltanvb avatar Sep 01 '24 10:09 zoltanvb

I have no idea how and why these changes would prevent anything from showing in the menu..

sonninnos avatar Sep 01 '24 10:09 sonninnos

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);

zoltanvb avatar Sep 01 '24 11:09 zoltanvb

Ok, thanks, fixed.

sonninnos avatar Sep 01 '24 11:09 sonninnos

Kudos, re-tested, works as expected.

zoltanvb avatar Sep 01 '24 12:09 zoltanvb