-
-
Notifications
You must be signed in to change notification settings - Fork 115
Support settings keys and hotkey config embedded in settings INI for RA1 #943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 14 commits
8beee92
9c6b1c6
7bf4645
1721273
512d1e9
542943c
44f15db
66928c0
7f0b5d9
3ddd460
0559426
625a1a7
8992461
5c2257a
11c4f4a
2820c26
2e042c3
a7fd805
624ed84
c80bb05
2325dfd
46e4166
5b39728
e8a8638
d6f7774
dc99624
9ea5c68
a4666c6
bca2b47
67c7eae
cc37971
bf9e323
cf857e3
81b0031
25bf147
05bed27
74ec0db
f25247f
896774e
4291069
5072fcd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Metadorius marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,6 +88,105 @@ protected UserINISettings(IniFile iniFile) | |
| { | ||
| SettingsIni = iniFile; | ||
|
|
||
| if (ClientConfiguration.Instance.ClientGameType == ClientType.RA) | ||
| { | ||
| // ==================== | ||
| // Display (Resolution) | ||
| // ==================== | ||
| IngameScreenWidth = new IntSetting(iniFile, OPTIONS, "Width", 1024); | ||
| IngameScreenHeight = new IntSetting(iniFile, OPTIONS, "Height", 768); | ||
| ClientTheme = new StringSetting(iniFile, MULTIPLAYER, "Theme", ClientConfiguration.Instance.GetThemeInfoFromIndex(0).Name); | ||
| Translation = new StringSetting(iniFile, OPTIONS, "Translation", I18N.Translation.GetDefaultTranslationLocaleCode()); | ||
| DetailLevel = new IntSetting(iniFile, OPTIONS, "DetailLevel", 2); | ||
| Renderer = new StringSetting(iniFile, COMPATIBILITY, "Renderer", string.Empty); | ||
| WindowedMode = new BoolSetting(iniFile, VIDEO, ClientConfiguration.Instance.WindowedModeKey, false); | ||
| BorderlessWindowedMode = new BoolSetting(iniFile, VIDEO, "NoWindowFrame", false); | ||
| BorderlessWindowedClient = new BoolSetting(iniFile, VIDEO, "BorderlessWindowedClient", ClientConfiguration.Instance.UserDefault_BorderlessWindowedClient); | ||
| IntegerScaledClient = new BoolSetting(iniFile, VIDEO, "IntegerScaledClient", ClientConfiguration.Instance.UserDefault_IntegerScaledClient); | ||
| ClientFPS = new IntSetting(iniFile, VIDEO, "ClientFPS", 60); | ||
| DisplayToggleableExtraTextures = new BoolSetting(iniFile, VIDEO, "DisplayToggleableExtraTextures", true); | ||
| Win8CompatMode = new StringSetting(iniFile, OPTIONS, "Win8Compat", "No"); | ||
| // ==================== | ||
| // GAME | ||
| // ==================== | ||
| ScrollRate = new IntSetting(iniFile, OPTIONS, "ScrollRate", 3); | ||
|
|
||
| Difficulty = new IntSetting(iniFile, OPTIONS, "Difficulty", 1); | ||
| GameSpeed = new IntSetting(iniFile, OPTIONS, "GameSpeed", 1); | ||
| BackBufferInVRAM = new BoolSetting(iniFile, VIDEO, "VideoBackBuffer", false); | ||
| DragDistance = new IntSetting(iniFile, OPTIONS, "DragDistance", 4); | ||
| ForceLowestDetailLevel = new BoolSetting(iniFile, VIDEO, "ForceLowestDetailLevel", false); | ||
| DoubleTapInterval = new IntSetting(iniFile, OPTIONS, "DoubleTapInterval", 30); | ||
| ScrollDelay = new IntSetting(iniFile, OPTIONS, "ScrollDelay", 4); | ||
|
|
||
| // Remove binding completely | ||
| // DetailLevel = null; | ||
| // DragDistance = null; | ||
| // WindowedMode = null; | ||
| // BorderlessWindowedMode = null; | ||
| // BackBufferInVRAM = null; | ||
|
|
||
| // ==================== | ||
| // AUDIO | ||
| // ==================== | ||
| SoundVolume = new DoubleSetting(iniFile, OPTIONS, "Volume", 0.7); | ||
| ScoreVolume = new DoubleSetting(iniFile, OPTIONS, "ScoreVolume", 0.7); | ||
| MultiplayerScoreVolume = new DoubleSetting(iniFile, OPTIONS, "MultiplayerScoreVolume", 0.7); | ||
| VoiceVolume = new DoubleSetting(iniFile, AUDIO, "VoiceVolume", 0.7); | ||
| IsScoreShuffle = new BoolSetting(iniFile, AUDIO, "IsScoreShuffle", true); | ||
| ClientVolume = new DoubleSetting(iniFile, AUDIO, "ClientVolume", 1.0); | ||
| PlayMainMenuMusic = new BoolSetting(iniFile, AUDIO, "PlayMainMenuMusic", true); | ||
| StopMusicOnMenu = new BoolSetting(iniFile, AUDIO, "StopMusicOnMenu", true); | ||
| StopGameLobbyMessageAudio = new BoolSetting(iniFile, AUDIO, "StopGameLobbyMessageAudio", true); | ||
| MessageSound = new BoolSetting(iniFile, AUDIO, "ChatMessageSound", true); | ||
|
|
||
| // ==================== | ||
| // Multiplayer | ||
| // ==================== | ||
| PlayerName = new StringSetting(iniFile, MULTIPLAYER, "Handle", string.Empty); | ||
|
|
||
| ChatColor = new IntSetting(iniFile, MULTIPLAYER, "ChatColor", -1); | ||
| LANChatColor = new IntSetting(iniFile, MULTIPLAYER, "LANChatColor", -1); | ||
| PingUnofficialCnCNetTunnels = new BoolSetting(iniFile, MULTIPLAYER, "PingCustomTunnels", true); | ||
| WritePathToRegistry = new BoolSetting(iniFile, OPTIONS, "WriteInstallationPathToRegistry", ClientConfiguration.Instance.UserDefault_WriteInstallationPathToRegistry); | ||
| PlaySoundOnGameHosted = new BoolSetting(iniFile, MULTIPLAYER, "PlaySoundOnGameHosted", true); | ||
| SkipConnectDialog = new BoolSetting(iniFile, MULTIPLAYER, "SkipConnectDialog", false); | ||
| PersistentMode = new BoolSetting(iniFile, MULTIPLAYER, "PersistentMode", false); | ||
| AutomaticCnCNetLogin = new BoolSetting(iniFile, MULTIPLAYER, "AutomaticCnCNetLogin", false); | ||
| DiscordIntegration = new BoolSetting(iniFile, MULTIPLAYER, "DiscordIntegration", true); | ||
| SteamIntegration = new BoolSetting(iniFile, MULTIPLAYER, "SteamIntegration", true); | ||
| AllowGameInvitesFromFriendsOnly = new BoolSetting(iniFile, MULTIPLAYER, "AllowGameInvitesFromFriendsOnly", false); | ||
| NotifyOnUserListChange = new BoolSetting(iniFile, MULTIPLAYER, "NotifyOnUserListChange", true); | ||
| DisablePrivateMessagePopups = new BoolSetting(iniFile, MULTIPLAYER, "DisablePrivateMessagePopups", false); | ||
| AllowPrivateMessagesFromState = new IntSetting(iniFile, MULTIPLAYER, "AllowPrivateMessagesFromState", (int)AllowPrivateMessagesFromEnum.All); | ||
| EnableMapSharing = new BoolSetting(iniFile, MULTIPLAYER, "EnableMapSharing", true); | ||
| AlwaysDisplayTunnelList = new BoolSetting(iniFile, MULTIPLAYER, "AlwaysDisplayTunnelList", false); | ||
| MapSortState = new IntSetting(iniFile, MULTIPLAYER, "MapSortState", (int)SortDirection.None); | ||
| SearchAllGameModes = new BoolSetting(iniFile, MULTIPLAYER, "SearchAllGameModes", false); | ||
|
|
||
| CheckForUpdates = new BoolSetting(iniFile, OPTIONS, "CheckforUpdates", true); | ||
|
|
||
| PrivacyPolicyAccepted = new BoolSetting(iniFile, OPTIONS, "PrivacyPolicyAccepted", false); | ||
| IsFirstRun = new BoolSetting(iniFile, OPTIONS, "IsFirstRun", true); | ||
| CustomComponentsDenied = new BoolSetting(iniFile, OPTIONS, "CustomComponentsDenied", false); | ||
| //PreloadMapPreviews = new BoolSetting(iniFile, VIDEO, "PreloadMapPreviews", false); | ||
| MinimizeWindowsOnGameStart = new BoolSetting(iniFile, OPTIONS, "MinimizeWindowsOnGameStart", true); | ||
| AutoRemoveUnderscoresFromName = new BoolSetting(iniFile, OPTIONS, "AutoRemoveUnderscoresFromName", true); | ||
| GenerateTranslationStub = new BoolSetting(iniFile, OPTIONS, nameof(GenerateTranslationStub), false); | ||
| GenerateOnlyNewValuesInTranslationStub = new BoolSetting(iniFile, OPTIONS, nameof(GenerateOnlyNewValuesInTranslationStub), false); | ||
|
|
||
| SortState = new IntSetting(iniFile, GAME_FILTERS, "SortState", (int)SortDirection.None); | ||
| ShowFriendGamesOnly = new BoolSetting(iniFile, GAME_FILTERS, "ShowFriendGamesOnly", DEFAULT_SHOW_FRIENDS_ONLY_GAMES); | ||
| HideLockedGames = new BoolSetting(iniFile, GAME_FILTERS, "HideLockedGames", DEFAULT_HIDE_LOCKED_GAMES); | ||
| HidePasswordedGames = new BoolSetting(iniFile, GAME_FILTERS, "HidePasswordedGames", DEFAULT_HIDE_PASSWORDED_GAMES); | ||
| HideIncompatibleGames = new BoolSetting(iniFile, GAME_FILTERS, "HideIncompatibleGames", DEFAULT_HIDE_INCOMPATIBLE_GAMES); | ||
| MaxPlayerCount = new IntRangeSetting(iniFile, GAME_FILTERS, "MaxPlayerCount", DEFAULT_MAX_PLAYER_COUNT, 2, 8); | ||
|
|
||
| LoadFavoriteMaps(iniFile); | ||
| } | ||
| else | ||
| { | ||
|
|
||
| if (ClientConfiguration.Instance.ClientGameType == ClientType.TS) | ||
| BackBufferInVRAM = new BoolSetting(iniFile, VIDEO, "UseGraphicsPatch", true); | ||
| else | ||
|
|
@@ -164,6 +263,7 @@ protected UserINISettings(IniFile iniFile) | |
| MaxPlayerCount = new IntRangeSetting(iniFile, GAME_FILTERS, "MaxPlayerCount", DEFAULT_MAX_PLAYER_COUNT, 2, 8); | ||
|
|
||
| LoadFavoriteMaps(iniFile); | ||
| } | ||
| } | ||
|
|
||
| public IniFile SettingsIni { get; private set; } | ||
|
|
@@ -200,6 +300,7 @@ protected UserINISettings(IniFile iniFile) | |
| /* AUDIO */ | ||
| /*********/ | ||
|
|
||
| public DoubleSetting MultiplayerScoreVolume { get; private set; } | ||
|
||
| public DoubleSetting ScoreVolume { get; private set; } | ||
| public DoubleSetting SoundVolume { get; private set; } | ||
| public DoubleSetting VoiceVolume { get; private set; } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,8 +15,7 @@ namespace ClientGUI | |
| /// </summary> | ||
| public class HotkeyConfigurationWindow : XNAWindow | ||
| { | ||
| 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"); | ||
|
||
| private const string KEYBOARD_COMMANDS_INI = "KeyboardCommands.ini"; | ||
|
|
||
| public HotkeyConfigurationWindow(WindowManager windowManager) : base(windowManager) | ||
|
|
@@ -298,7 +297,7 @@ private void LoadKeyboardINI() | |
| { | ||
| foreach (var command in gameCommands) | ||
| { | ||
| int hotkey = keyboardINI.GetIntValue("Hotkey", command.ININame, 0); | ||
| int hotkey = keyboardINI.GetIntValue(ClientConfiguration.Instance.KeyboardHotkeySection, command.ININame, 0); | ||
|
|
||
| Hotkey hotkeyStruct = new Hotkey(hotkey); | ||
| command.Hotkey = new Hotkey(GetKeyOverride(hotkeyStruct.Key), hotkeyStruct.Modifier); | ||
|
|
@@ -482,10 +481,13 @@ private KeyModifiers GetCurrentModifiers() | |
|
|
||
| private void WriteKeyboardINI() | ||
| { | ||
| var keyboardIni = new IniFile(); | ||
| var keyboardIni = new IniFile(SafePath.CombineFilePath(ProgramConstants.GamePath, ClientConfiguration.Instance.KeyboardINI)); | ||
|
|
||
| keyboardIni.RemoveSection(ClientConfiguration.Instance.KeyboardHotkeySection); | ||
|
|
||
| foreach (var command in gameCommands) | ||
| { | ||
| keyboardIni.SetStringValue("Hotkey", command.ININame, command.Hotkey.GetTSEncoded().ToString()); | ||
| keyboardIni.SetStringValue(ClientConfiguration.Instance.KeyboardHotkeySection, command.ININame, command.Hotkey.GetTSEncoded().ToString()); | ||
| } | ||
|
|
||
| keyboardIni.WriteIniFile(SafePath.CombineFilePath(ProgramConstants.GamePath, ClientConfiguration.Instance.KeyboardINI)); | ||
|
|
||


There was a problem hiding this comment.
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.