From 50dc064fd17b866db45dee10a66edb705ec218bd Mon Sep 17 00:00:00 2001
From: Sparronator9999 <86388887+Sparronator9999@users.noreply.github.com>
Date: Wed, 25 Sep 2024 14:22:35 +1000
Subject: [PATCH] Template configs: the beginning
---
Configs/MSI-10th-gen-or-newer.template.xml | 150 +++++++++++++++++++++
Configs/MSI-9th-gen-or-older.template.xml | 115 ++++++++++++++++
YAMDCC.Config/FanConf.cs | 4 +
YAMDCC.Config/YAMDCC_Config.cs | 7 +
YAMDCC.GUI/MainWindow.cs | 19 ++-
YAMDCC.Service/FanControlService.cs | 9 ++
6 files changed, 301 insertions(+), 3 deletions(-)
create mode 100644 Configs/MSI-10th-gen-or-newer.template.xml
create mode 100644 Configs/MSI-9th-gen-or-older.template.xml
diff --git a/Configs/MSI-10th-gen-or-newer.template.xml b/Configs/MSI-10th-gen-or-newer.template.xml
new file mode 100644
index 0000000..e300d95
--- /dev/null
+++ b/Configs/MSI-10th-gen-or-newer.template.xml
@@ -0,0 +1,150 @@
+
+
+ MSI laptops (10th-gen Intel or newer) Template Config
+ Sparronator9999
+ true
+
+
+ CPU Fan
+ 0
+ 100
+ 1
+ 113
+ 104
+
+ 200
+ true
+ true
+ 478000
+ true
+ true
+
+
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+
+
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+
+
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+
+
+
+
+ GPU Fan
+ 0
+ 100
+ 1
+ 137
+ 128
+
+ 200
+ true
+ true
+ 478000
+ true
+ true
+
+
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+
+
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+
+
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+
+
+
+
+
+ 152
+ 134
+ 6
+
+
+ 215
+ 128
+ 228
+ 60
+
+
+ 210
+ 2
+
+
+ Maximum battery life
+ Optimises your laptop for maximum battery life.
+Limits CPU power draw to 10W.
+If set to default fan curve, uses an alternative fan curve.
+ 194
+
+
+ Silent
+ Reduces the maximum fan speed to 60%.
+ 193
+
+
+ Balanced
+ Balances battery life and performance.
+ 192
+
+
+ High performance
+ Optimises your laptop for maximum performance.
+Old (pre-alpha) versions of MSI Fan Control/YAMDCC set this setting.
+ 196
+
+
+
+
+ 232
+ false
+ 16
+ 0
+
+
+ 211
+ 128
+ 131
+
+
+
+ Set fan mode to Advanced. Fixes fans not working at all with certain fan settings.
+ 212
+ 77
+
+
+
diff --git a/Configs/MSI-9th-gen-or-older.template.xml b/Configs/MSI-9th-gen-or-older.template.xml
new file mode 100644
index 0000000..2abba6e
--- /dev/null
+++ b/Configs/MSI-9th-gen-or-older.template.xml
@@ -0,0 +1,115 @@
+
+
+ MSI laptops (9th-gen Intel or earlier) Template Config
+ Sparronator9999
+ true
+
+
+ CPU Fan
+ 0
+ 100
+ 0
+ 113
+ 104
+
+ 200
+ true
+ true
+ 478000
+ true
+ true
+
+
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+
+
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+
+
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+
+
+
+
+ GPU Fan
+ 0
+ 100
+ 0
+ 137
+ 128
+
+ 200
+ true
+ true
+ 478000
+ true
+ true
+
+
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+
+
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+
+
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+
+
+
+
+
+ 152
+ 134
+ 6
+
+
+ 239
+ 128
+ 228
+ 60
+
+
+ 243
+ 128
+ 131
+
+
+
+ Set fan mode to Advanced. Fixes fans not working at all with certain fan settings.
+ 244
+ 77
+
+
+
diff --git a/YAMDCC.Config/FanConf.cs b/YAMDCC.Config/FanConf.cs
index 4ebd37b..3ec0e17 100644
--- a/YAMDCC.Config/FanConf.cs
+++ b/YAMDCC.Config/FanConf.cs
@@ -90,6 +90,10 @@ public sealed class FanConf
///
/// The list of s associated with this fan.
///
+ ///
+ /// If the base config is a template, this may be null,
+ /// otherwise at least one fan curve (the "default" curve) must exist.
+ ///
[XmlArray]
public FanCurveConf[] FanCurveConfs { get; set; }
}
diff --git a/YAMDCC.Config/YAMDCC_Config.cs b/YAMDCC.Config/YAMDCC_Config.cs
index f72b407..010614e 100644
--- a/YAMDCC.Config/YAMDCC_Config.cs
+++ b/YAMDCC.Config/YAMDCC_Config.cs
@@ -51,6 +51,13 @@ public sealed class YAMDCC_Config
[XmlElement]
public string Author { get; set; }
+ ///
+ /// Is this config a "template" config that is used
+ /// when generating other (non-template) configs?
+ ///
+ [XmlElement]
+ public bool Template { get; set; }
+
///
/// The list of s associated with the laptop.
///
diff --git a/YAMDCC.GUI/MainWindow.cs b/YAMDCC.GUI/MainWindow.cs
index 7d7e966..2b3f76f 100644
--- a/YAMDCC.GUI/MainWindow.cs
+++ b/YAMDCC.GUI/MainWindow.cs
@@ -684,8 +684,11 @@ private void LoadConf(string confPath)
try
{
- Config = YAMDCC_Config.Load(confPath);
- LoadConf(Config);
+ YAMDCC_Config tmpConf = YAMDCC_Config.Load(confPath);
+ if (LoadConf(tmpConf))
+ {
+ Config = tmpConf;
+ }
}
catch
{
@@ -695,9 +698,18 @@ private void LoadConf(string confPath)
tsiSaveConf.Enabled = true;
}
- private void LoadConf(YAMDCC_Config config)
+ private bool LoadConf(YAMDCC_Config config)
{
lblStatus.Text = "Loading config, please wait...";
+ if (config.Template)
+ {
+ MessageBox.Show(
+ "This is a template config.\n" +
+ "Template configs are currently WIP and cannot be used yet.\n" +
+ "Please load a different config.");
+ return false;
+ }
+
tsiSaveConf.Enabled = true;
if (config.FullBlastConf is null)
@@ -768,6 +780,7 @@ private void LoadConf(YAMDCC_Config config)
tsiECMon.Enabled = true;
lblStatus.Text = "Ready";
+ return true;
}
private void ApplyConf()
diff --git a/YAMDCC.Service/FanControlService.cs b/YAMDCC.Service/FanControlService.cs
index 115482b..1efad5f 100644
--- a/YAMDCC.Service/FanControlService.cs
+++ b/YAMDCC.Service/FanControlService.cs
@@ -278,6 +278,15 @@ private void LoadConf()
Log.Error(Strings.GetString("cfgInvalid"));
}
+ if (Config.Template)
+ {
+ Log.Error(
+ "Template configs are still WIP and unsupported for now.\n" +
+ "Please load another config using the configurator app.");
+ ConfigLoaded = false;
+ return;
+ }
+
ConfigLoaded = true;
Log.Info(Strings.GetString("cfgLoadSuccess"));
}