Added options to select ryzenadj.exe.

This commit is contained in:
Quentin Decaunes 2019-02-28 08:11:03 +01:00
parent 32089ec336
commit 57a9e70d49
7 changed files with 137 additions and 75 deletions

View File

@ -4,18 +4,9 @@
### Pre-requisite
- Go to https://github.com/FlyGoat/RyzenAdj/releases
- Download the latest compiled version.
- Put the content into the bin folder where the "RyzenController.exe" is.
- So you have
```
RyzenFolder/
| RyzenController.exe
| | bin/
| | | ryzenadj.exe
| | | WinRing0x64.dll
| | | WinRing0x64.sys
```
- Go to https://github.com/FlyGoat/RyzenAdj/releases and download the latest compiled version.
- Execute Ryzen Controller, go select ryzenadj.exe into settings tab.
- Enjoy!
## For developpers

View File

View File

@ -12,6 +12,7 @@
<h1>Ryzen Controller</h1>
<ul uk-switcher uk-tab>
<li><a href="#">Controller</a></li>
<li><a href="#">Settings</a></li>
<li><a href="#">Presets</a></li>
<li><a href="#">Logs</a></li>
@ -90,6 +91,19 @@
<button class="uk-button uk-button-default" onClick="applyRyzenSettings()">Apply</button>
</li>
<li class="uk-container">
<h2>Ryzenadj path:</h2>
<div class="uk-grid-small" uk-grid>
<div class="uk-width-2-3@s">
<input class="uk-input" type="text" id="ryzen_adj_path">
</div>
<div class="uk-width-1-3@s">
<button class="uk-button uk-button-default" type="button" onClick="askingForRyzenAdjExecutablePath()">
Select path to ryzenadj.exe
</button>
</div>
</div>
</li>
<li class="uk-container">Will be available soon!</li>
<li class="uk-container">Will be available soon!</li>

View File

@ -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) {

View File

@ -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();
});
}

20
package-lock.json generated
View File

@ -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"
}

View File

@ -23,6 +23,7 @@
"electron-packager": "^13.1.0"
},
"dependencies": {
"electron-settings": "^3.2.0",
"uikit": "^3.0.3"
}
}