RetroArch icon indicating copy to clipboard operation
RetroArch copied to clipboard

only save retroarch.cfg as diff from defaults

Open warmenhoven opened this issue 2 months ago • 9 comments

warmenhoven avatar Nov 11 '25 18:11 warmenhoven

Really looking forward to this feature. If it can be implemented,no need to search for keywords in a huge amount of configuration data any more.

crashGG avatar Nov 13 '25 05:11 crashGG

Really looking forward to this feature. If it can be implemented,no need to search for keywords in a huge amount of configuration data any more.

Same for me. If this can be implemented it would theoretically make the retroarch.cfg file portable. For example, as long as all the assets directories are in their default locations and therefore don't appear in the retroarch.cfg file, the same file should theoretically work for Windows, Linux, Android and so on.

I have a retroarch.cfg file created by hand this way that works across multiple devices, but it was a pain to create it manually.

matheuswillder avatar Nov 16 '25 02:11 matheuswillder

I've been running with it in my branch for a few weeks now and haven't seen any side effects, so I think it's safe to merge. Also it's behind an option that's default off.

warmenhoven avatar Dec 01 '25 05:12 warmenhoven

Does this option apply only to the retroarch.cfg file, or will it also be used for the core configuration files (in /RetroArch main folder/config)?

I'll try to compile this soon to test it, but I'm in the middle of some personal issues so it might take some time.

Edit: correction.

matheuswillder avatar Dec 01 '25 23:12 matheuswillder

Just retroarch.cfg.

warmenhoven avatar Dec 01 '25 23:12 warmenhoven

I'm testing this right now and it seems to work well. Since it's disabled by default, I thought I'd need to create a empty retroarch.cfg file with config_save_minimal = "true", but it's not necessary, once you enable it, all the existing entries ​​are removed, leaving only the ones that have already been changed from default, which is great.

There's just one small problem, which I'm not sure if it's exactly a bug or not. When configuring Inputs, in Settings>Input>RetroPad Binds>Port 1 Controls, there are still a handful of entries ​​that are added with the "nul" value, like this:

input_player1_a = "l"
input_player1_a_axis = "nul"
input_player1_a_btn = "nul"
input_player1_a_mbtn = "nul"
input_player1_analog_dpad_mode = "1"
input_player1_b = "k"
input_player1_b_axis = "nul"
input_player1_b_btn = "nul"
input_player1_b_mbtn = "nul"
input_player1_l = "o"
input_player1_l2 = "n"
input_player1_l2_axis = "nul"
input_player1_l2_btn = "nul"
input_player1_l2_mbtn = "nul"
input_player1_l3 = "y"
input_player1_l3_axis = "nul"
input_player1_l3_btn = "nul"
input_player1_l3_mbtn = "nul"
input_player1_l_axis = "nul"
input_player1_l_btn = "nul"
input_player1_l_mbtn = "nul"
input_player1_l_x_minus = "a"
input_player1_l_x_minus_axis = "nul"
input_player1_l_x_minus_btn = "nul"
input_player1_l_x_minus_mbtn = "nul"
input_player1_l_x_plus = "d"
input_player1_l_x_plus_axis = "nul"
input_player1_l_x_plus_btn = "nul"
input_player1_l_x_plus_mbtn = "nul"
input_player1_l_y_minus = "w"
input_player1_l_y_minus_axis = "nul"
input_player1_l_y_minus_btn = "nul"
input_player1_l_y_minus_mbtn = "nul"
input_player1_l_y_plus = "s"
input_player1_l_y_plus_axis = "nul"
input_player1_l_y_plus_btn = "nul"
input_player1_l_y_plus_mbtn = "nul"
input_player1_r = "p"
input_player1_r2 = "m"
input_player1_r2_axis = "nul"
input_player1_r2_btn = "nul"
input_player1_r2_mbtn = "nul"
input_player1_r3 = "u"
input_player1_r3_axis = "nul"
input_player1_r3_btn = "nul"
input_player1_r3_mbtn = "nul"
input_player1_r_axis = "nul"
input_player1_r_btn = "nul"
input_player1_r_mbtn = "nul"
input_player1_r_x_minus = "f"
input_player1_r_x_minus_axis = "nul"
input_player1_r_x_minus_btn = "nul"
input_player1_r_x_minus_mbtn = "nul"
input_player1_r_x_plus = "h"
input_player1_r_x_plus_axis = "nul"
input_player1_r_x_plus_btn = "nul"
input_player1_r_x_plus_mbtn = "nul"
input_player1_r_y_minus = "t"
input_player1_r_y_minus_axis = "nul"
input_player1_r_y_minus_btn = "nul"
input_player1_r_y_minus_mbtn = "nul"
input_player1_r_y_plus = "g"
input_player1_r_y_plus_axis = "nul"
input_player1_r_y_plus_btn = "nul"
input_player1_r_y_plus_mbtn = "nul"
input_player1_select = "space"
input_player1_select_axis = "nul"
input_player1_select_btn = "nul"
input_player1_select_mbtn = "nul"
input_player1_x = "i"
input_player1_x_axis = "nul"
input_player1_x_btn = "nul"
input_player1_x_mbtn = "nul"
input_player1_y = "j"
input_player1_y_axis = "nul"
input_player1_y_btn = "nul"
input_player1_y_mbtn = "nul"

In the retroarch.cfg I created by hand, the same configuration for Port 1 Controls is just like this:

input_player1_a = "l"
input_player1_analog_dpad_mode = "1"
input_player1_b = "k"
input_player1_down = "down"
input_player1_gun_offscreen_shot_mbtn = "2"
input_player1_gun_trigger_mbtn = "1"
input_player1_l = "o"
input_player1_l2 = "n"
input_player1_l3 = "y"
input_player1_l_x_minus = "a"
input_player1_l_x_plus = "d"
input_player1_l_y_minus = "w"
input_player1_l_y_plus = "s"
input_player1_left = "left"
input_player1_r = "p"
input_player1_r2 = "m"
input_player1_r3 = "u"
input_player1_r_x_minus = "f"
input_player1_r_x_plus = "h"
input_player1_r_y_minus = "t"
input_player1_r_y_plus = "g"
input_player1_right = "right"
input_player1_select = "space"
input_player1_start = "enter"
input_player1_up = "up"
input_player1_x = "i"
input_player1_y = "j"

I think the entries with "nul" values ​​shouldn't be there, they're already default and don't even do anything. But anyway, this still better than the current retroarch.cfg, which is currently a file with 3365 lines.

Edit: with a few more testing, it seems that the entries with the "nul" values are related to the other modified input keys, for example, modifying input_player1_a = will also add input_player1_a_axis = "nul" and some other entries related to input_player1_a =, so it seems to be working as expected.

matheuswillder avatar Dec 02 '25 21:12 matheuswillder

I think this might not deal properly with overrides.

warmenhoven avatar Dec 04 '25 04:12 warmenhoven

Yeah if your retroarch.cfg would have had something as a default and the override changes it, when you unload the core/content and quit it will write the retroarch.cfg with the override.

warmenhoven avatar Dec 04 '25 04:12 warmenhoven

Ok, fixed that.

Yeah I noticed the nul entries for the hotkeys and agree they should go... it was just annoying to do it because they're all in a separate function and I was lazy. It's something I'll get to.

warmenhoven avatar Dec 04 '25 05:12 warmenhoven