-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d429ff6
commit aa33203
Showing
9 changed files
with
85 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
VERSION=0.3 | ||
VERSION=0.4 | ||
RELEASE_URL=https://api.github.com/repos/alvindimas05/AMDHelper/releases | ||
INSTALL_URL=https://raw.githubusercontent.com/alvindimas05/AMDHelper/main/install.sh | ||
INSTALL_URL=https://raw.githubusercontent.com/alvindimas05/AMDHelper/main/install.sh | ||
INSTALL_RYZENADJ_URL=https://raw.githubusercontent.com/alvindimas05/AMDHelper/main/install_ryzenadj.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { escapePathSpaces, exec } from "@src/utils"; | ||
import fs from "fs"; | ||
import inquirer from "inquirer"; | ||
import path from "path"; | ||
|
||
const bashPath = path.join("/", "Library", "amdhelper", "amdhelper_ryzenadj"); | ||
const plistPath = path.join("/", "Library", "LaunchAgents", "org.alvindimas05.amdhelper_ryzenadj.plist"); | ||
const tuning = "--stapm-limit=13000 --slow-limit=14000 --fast-limit=15000 --vrm-current=11000 --vrmmax-current=16000 --vrmsoc-current=0 --vrmsocmax-current=0 --vrmgfx-current=0 --psi0-current=0 --psi0soc-current=0 --tctl-temp=59 --apu-skin-temp=59 --stapm-time=64 --slow-time=128 --power-saving" | ||
export default class Ryzenadj { | ||
enabled(){ | ||
return fs.existsSync(bashPath) || fs.existsSync(plistPath); | ||
} | ||
async apply(){ | ||
// @ts-ignore | ||
const answers = await inquirer.prompt([{ type: "input", name: "password", message: "Enter Password: " }]); | ||
|
||
await this.installRyzenadj(); | ||
|
||
try { await exec("sudo ryzenadj " + tuning) } catch {} | ||
|
||
console.log("Applying battery optimization..."); | ||
|
||
fs.mkdirSync(path.join(bashPath, ".."), { recursive: true }); | ||
fs.writeFileSync(bashPath, `echo '${answers.password}' | sudo -S /usr/local/bin/ryzenadj ${tuning}`); | ||
await exec(`sudo chmod +x ${escapePathSpaces(bashPath)}`); | ||
|
||
fs.writeFileSync(plistPath, plist); | ||
} | ||
async installRyzenadj(){ | ||
const curl = await exec(`curl -sL ${process.env.INSTALL_RYZENADJ_URL}`); | ||
for(let cmd of curl.stdout.split("\n")){ | ||
if(cmd.length === 0) return; | ||
const { stdout } = await exec(cmd); | ||
if(stdout != "") console.log(`${stdout.slice(0, -1)}`); | ||
} | ||
} | ||
async remove(){ | ||
console.log("Removing battery optimization..."); | ||
try { fs.rmSync(bashPath) } catch {} | ||
try { fs.rmSync(plistPath) } catch {} | ||
} | ||
} | ||
const plist = ` | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>Label</key> | ||
<string>org.alvindimas05.amdhelper_ryzenadj</string> | ||
<key>ProgramArguments</key> | ||
<array> | ||
<string>/Library/amdhelper/amdhelper_ryzenadj</string> | ||
</array> | ||
<key>RunAtLoad</key> | ||
<true/> | ||
</dict> | ||
</plist>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
echo 'password' | sudo -S /usr/local/bin/ryzenadj --stapm-limit=13000 --slow-limit=14000 --fast-limit=15000 --vrm-current=11000 --vrmmax-current=16000 --vrmsoc-current=0 --vrmsocmax-current=0 --vrmgfx-current=0 --psi0-current=0 --psi0soc-current=0 --tctl-temp=59 --apu-skin-temp=59 --stapm-time=64 --slow-time=128 --power-saving |
14 changes: 14 additions & 0 deletions
14
src/scripts/ryzenadj/org.alvindimas05.amdhelper_ryzenadj.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>Label</key> | ||
<string>org.alvindimas05.amdhelper_ryzenadj</string> | ||
<key>ProgramArguments</key> | ||
<array> | ||
<string>/Library/amdhelper/amdhelper_ryzenadj</string> | ||
</array> | ||
<key>RunAtLoad</key> | ||
<true/> | ||
</dict> | ||
</plist> |