-
+
+
+ VRM Current (A)
+
+
+
+
+
+ Ryzenadj path:
+
+
+
+
+
+
+
+
+
Will be available soon!
Will be available soon!
diff --git a/js/app.js b/js/app.js
index ffcaac1..47e167b 100644
--- a/js/app.js
+++ b/js/app.js
@@ -1,6 +1,7 @@
ready(function(){
registerRepeaterForAllInput();
checkForAdminRights();
+ preFillSettings();
});
/**
@@ -17,7 +18,7 @@ function applyRyzenSettings(e) {
};
const child = require('child_process').execFile;
- const executablePath = getCurrentWorkingDirectory() + "\\bin\\ryzenadj.exe";
+ const executablePath = getRyzenAdjExecutablePath();
var parameters = [];
for (const option in settings) {
diff --git a/js/methods.js b/js/methods.js
index fe8a11d..086bbbf 100644
--- a/js/methods.js
+++ b/js/methods.js
@@ -89,3 +89,46 @@ function notification(type, message) {
});
}
+/**
+ * Will return the ryzenadj.exe path registered, or default one if not provided.
+ */
+function getRyzenAdjExecutablePath() {
+ const settings = require('electron-settings');
+ var ryzen_adj_path = settings.get('settings.ryzen_adj_path');
+ if (!ryzen_adj_path) {
+ ryzen_adj_path = getCurrentWorkingDirectory() + "\\bin\\ryzenadj.exe";
+ }
+ return ryzen_adj_path;
+}
+
+/**
+ * Will fill settings page on render with saved data.
+ */
+function preFillSettings() {
+ var ryzen_adj_path = document.getElementById('ryzen_adj_path');
+ var fs = require('fs');
+ ryzen_adj_path.value = getRyzenAdjExecutablePath();
+ if (!fs.existsSync(ryzen_adj_path.value)) {
+ notification('danger', "Path to ryzenadj.exe is wrong, please fix it in settings tab.");
+ }
+}
+
+function askingForRyzenAdjExecutablePath() {
+ var remote = require('electron').remote;
+ var dialog = remote.require('electron').dialog;
+
+ var path = dialog.showOpenDialog({
+ properties: ['openFile']
+ }, function (filePaths) {
+ if (typeof filePaths[0] !== 'undefined') {
+ const settings = require('electron-settings');
+ settings.set("settings", {
+ ryzen_adj_path: filePaths[0]
+ });
+ notification('primary', 'Path to ryzenAdj.exe has been saved.');
+ } else {
+ notification('warning', 'No path given, nothing changed.');
+ }
+ preFillSettings();
+ });
+}
diff --git a/package-lock.json b/package-lock.json
index 8cbb2e5..a3d209f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,5 +1,5 @@
{
- "name": "electron-quick-start",
+ "name": "ryzen-controller",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
@@ -196,6 +196,11 @@
"integrity": "sha1-BKEGZywYsIWrd02YPfo+oTjyIgU=",
"dev": true
},
+ "clone": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz",
+ "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18="
+ },
"code-point-at": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
@@ -484,6 +489,15 @@
}
}
},
+ "electron-settings": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/electron-settings/-/electron-settings-3.2.0.tgz",
+ "integrity": "sha512-7U+vDKd5Gch4Z9K6FjGq80eB3Anwz2GuPc2h/6hOiuvZrS1w+UNPcAA0oAU8G1s9sWAVEadCsr4ZJR6J4iTdzA==",
+ "requires": {
+ "clone": "^2.1.1",
+ "jsonfile": "^4.0.0"
+ }
+ },
"env-paths": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/env-paths/-/env-paths-1.0.0.tgz",
@@ -755,8 +769,7 @@
"graceful-fs": {
"version": "4.1.15",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz",
- "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==",
- "dev": true
+ "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA=="
},
"har-schema": {
"version": "2.0.0",
@@ -916,7 +929,6 @@
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
"integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
- "dev": true,
"requires": {
"graceful-fs": "^4.1.6"
}
diff --git a/package.json b/package.json
index f7b0041..1acba54 100644
--- a/package.json
+++ b/package.json
@@ -23,6 +23,7 @@
"electron-packager": "^13.1.0"
},
"dependencies": {
+ "electron-settings": "^3.2.0",
"uikit": "^3.0.3"
}
}