Skip to content

Support settings keys and hotkey config embedded in settings INI for RA1#943

Open
CO2-code wants to merge 41 commits intoCnCNet:developfrom
CO2-code:Ra1-Options
Open

Support settings keys and hotkey config embedded in settings INI for RA1#943
CO2-code wants to merge 41 commits intoCnCNet:developfrom
CO2-code:Ra1-Options

Conversation

@CO2-code
Copy link
Contributor

@CO2-code CO2-code commented Mar 6, 2026

Fixes an issue where hotkeys and client settings overwrite each other when using same INI file.
Updated UserINISettings key mapping to match RA1's expected keys.
Made the hotkey section configurable (allowing RA1 to use WinHotkeys while other games continue using Hotkey).

@github-actions
Copy link

github-actions bot commented Mar 6, 2026

Nightly build for this pull request:

  • artifacts.zip
    This comment is automatic and is meant to allow guests to get latest automatic builds without registering. It is updated on every successful build.

Copy link
Member

@Metadorius Metadorius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The keyboard INI change is good and if you split it out it can be merged even now, the rest needs more refinement

{
private readonly string HOTKEY_TIP_TEXT = "Press a key...".L10N("Client:DTAConfig:PressAKey");
private const string HOTKEY_INI_SECTION = "Hotkey";
private readonly string HOTKEY_TIP_TEXT = "Press a key...".L10N("Client:DTAConfig:PressAKey");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what changed in this specific line? did line ending change? that should be reverted as it litters the history with unnecessary changes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deleted (private const string HOTKEY_INI_SECTION = "Hotkey";) only

/* AUDIO */
/*********/

public DoubleSetting MultiplayerScoreVolume { get; private set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what is this for, some other score volume?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what is this for, some other score volume?

yes ScoreVolume and MultiplayerScoreVolume are the game's "Music volume"
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be done in another way probably, not sure. @SadPencil @11EJDE11 opinions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be done in another way probably, not sure. @SadPencil @11EJDE11 opinions?

can you re-review please

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what is this for, some other score volume?

yes ScoreVolume and MultiplayerScoreVolume are the game's "Music volume" image

Can we assume ScoreVolume and MultiplayerScoreVolume always have the same values?

Copy link
Contributor Author

@CO2-code CO2-code Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what is this for, some other score volume?

yes ScoreVolume and MultiplayerScoreVolume are the game's "Music volume" image

Can we assume ScoreVolume and MultiplayerScoreVolume always have the same values?

I am 100% sure that they should always have the same values , according to Iran's RAConfigTool ,

double MusicVolume = ((double)this.Slider_MusicVolume.Value) / 1000;
Files.RedAlertINI.setStringValue("Options", "ScoreVolume", MusicVolume.ToString());
Files.RedAlertINI.setStringValue("Options", "MultiplayerScoreVolume", MusicVolume.ToString());

@Metadorius
Copy link
Member

Metadorius commented Mar 6, 2026

The keyboard INI change is good

although keep in mind that this is a basic review of only changed files, I suspect there may be more places to handle this

@Metadorius
Copy link
Member

have you handled "reset to defaults" part of the keyboard INI to work with RA1 setup and your changes?

@CO2-code
Copy link
Contributor Author

CO2-code commented Mar 6, 2026

have you handled "reset to defaults" part of the keyboard INI to work with RA1 setup and your changes?

I think it is already done as it uses WriteKeyboardINI() , right ?

Copy link
Member

@Metadorius Metadorius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks much better now! remind me to review in more details on weekend

@CO2-code
Copy link
Contributor Author

CO2-code commented Mar 6, 2026

looks much better now! remind me to review in more details on weekend

for me the weekend is Saturday and Sunday , which starts tomorrow :)

@Metadorius
Copy link
Member

yea correct, I'll just forget by tomorrow likely 🤣

@CO2-code
Copy link
Contributor Author

CO2-code commented Mar 7, 2026

yea correct, I'll just forget by tomorrow likely 🤣

Reminder :)
also don't forget to check why hotkeys getting deleted after Clickin "Save" button in the options window
Edit : I think I have fixed that tho , just let me know if thats the correct way :)
Edit 2 : It only works if hotkeys section exists before firstluanch :( , but assigning doesn't work :(

Comment on lines +51 to +55
if (ClientConfiguration.Instance.ClientGameType == ClientType.RA)
{
_instance = new UserINISettings(userIni);
return;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this for?

@Metadorius Metadorius changed the title features and fixes for RA1 Support settings keys and hotkey config embedded in settings INI for RA1 Mar 7, 2026
using Rampastring.XNAUI.XNAControls;
using System;
using System.Collections.Generic;
using ClientCore.Enums;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this, it's unused.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines +499 to +501
// TODO should it be like this and main settings window will handle it, or should we flush even here, saving all settings?
if (!ClientConfiguration.Instance.SettingsIniAsKeyboardIni)
keyboardIni.WriteIniFile(SafePath.CombineFilePath(ProgramConstants.GamePath, ClientConfiguration.Instance.KeyboardINI));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency I'd say flush here. The hotkey window has its own save button.

  if (ClientConfiguration.Instance.SettingsIniAsKeyboardIni)
       keyboardIni.WriteIniFile();
  else
       keyboardIni.WriteIniFile(SafePath.CombineFilePath(ProgramConstants.GamePath, ClientConfiguration.Instance.KeyboardINI));

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just as you said this I realized it's not gonna work. Imagine a situation when the user pressed save in the hotkey config window, then decided they don't want config changes they did in the options.

If we don't flush here, everything (including hotkeys) can be restored by hitting a cancel.

If we flush here - you can't cancel anymore at all.

The hotkeys erased/not is a discrepancy in behavior, though, but I'd argue it's not as critical and the behavior with unified INI might be more logical

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, what a pain. I guess just add a comment explaining that for now.

Comment on lines +368 to +371
public bool SettingsIniAsKeyboardIni => SettingsIniName == KeyboardINI;

public string KeyboardHotkeySection => clientDefinitionsIni.GetStringValue(SETTINGS, "KeyboardHotkeySection", "Hotkey");

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider that we already introduced so many hard coded ini key names for RA, when providing the default value of KeyboardHotkeySection, provide "WinHotKeys" as the default value when it's RA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants