libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.05k stars 1.81k forks source link

Sorted order in autoconfig profiles broken. #7873

Closed orbea closed 5 years ago

orbea commented 5 years ago

Description

When creating autoconfig profiles they are sorted alphabetically, this is a problem because they should be sorted like in the input settings.

This is causing a mess the retroarch-joypad-autoconfig repo.

See commit https://github.com/libretro/retroarch-joypad-autoconfig/commit/90508beb83bd241664131d03b89c714b4c34b4af for an example.

Expected behavior

Created autoconfig files should be sorted like in the input settings.

Actual behavior

Created autoconfig files are sorted alphabetically.

For example:

input_device = "Sony PLAYSTATION(R)3 Controller"
input_driver = "udev"
input_product_id = "616"
input_vendor_id = "1356"

When it should look like.

input_driver = "udev"
input_device = "Sony PLAYSTATION(R)3 Controller"
input_vendor_id = "1356"
input_product_id = "616"

Now if the the gamepad is actually configured before saving the autoconfig profile this is much more evident.

input_a_btn = "1"
input_b_btn = "0"
input_device = "Sony PLAYSTATION(R)3 Controller"
input_down_btn = "14"
input_driver = "udev"
input_l2_btn = "6"
input_l3_btn = "11"
input_l_btn = "4"
input_l_x_minus_axis = "-0"
input_l_x_plus_axis = "+0"
input_l_y_minus_axis = "-1"
input_l_y_plus_axis = "+1"
input_left_btn = "15"
input_product_id = "616"
input_r2_btn = "7"
input_r3_btn = "12"
input_r_btn = "5"
input_r_x_minus_axis = "-3"
input_r_x_plus_axis = "+3"
input_r_y_minus_axis = "-4"
input_r_y_plus_axis = "+4"
input_right_btn = "16"
input_select_btn = "8"
input_start_btn = "9"
input_up_btn = "13"
input_vendor_id = "1356"
input_x_btn = "2"
input_y_btn = "3"

It should look like in this file.

https://github.com/libretro/retroarch-joypad-autoconfig/blob/2e140141b5a2a202e6bec6120897b3a7c36f3e1a/udev/Sony-PlayStation3-DualShock3-Controller-USB.cfg

Steps to reproduce the bug

  1. Proceed to Settings -> Input -> Input User 1 Binds.
  2. Select User 1 Save Autoconfig.
  3. Examine the new config file.

Bisect Results

62e89974afbb6628344fb084c50712bfab4419de is the first bad commit
commit 62e89974afbb6628344fb084c50712bfab4419de
Author: Brad Parker <cbparker@gmail.com>
Date:   Mon Jul 16 00:15:49 2018 -0400

    sort config file variables

:040000 040000 8a5a3f0dddd578bb0f023883fbfdb1a8bc33ae86 4f033d0cb587d7b0809d99d3665d9007aaae2d6a M  libretro-common

62e89974afbb6628344fb084c50712bfab4419de

Version/Commit

You can find this information under Information/System Information

Environment information

orbea commented 5 years ago

@bparker06 Can you please take a look at this?