Skip to content

Commit

Permalink
Basic version
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry260 committed Dec 9, 2022
0 parents commit 73ce880
Show file tree
Hide file tree
Showing 15 changed files with 1,659 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.prettierignore
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Harry

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# GTA V OPT-X

Optimize/Boost your GTA V FPS according to your PC configuration! You just need NodeJS preinstalled. This works with GTA V online/offline on **Steam, EpicGames, Rockstar** and any other version!

![OPTX](./screenshot.jpg)

# Usage

After installing NodeJS, just run the below command to get started. After that proceed with your prefered configuration.

```npm
npx goptx
```

# Support

If you found this useful, consider buying me a coffee and starring this repo ⭐<br>
<br>
<a href="https://www.buymeacoffee.com/harrytom" target="_blank"><img src="https://i.imgur.com/TDIEpi5.png" alt="Buy Me A Coffee" style="height: 57px !important;width: 217px !important;max-width: 207px !important;" ></a><br>
<br>

<hr>

This was inspired by ▶️ [GTA V: Dramatically increase performance / FPS with any setup! / Best Settings! GTA 5 Ceyo Perico by Panjno](https://www.youtube.com/watch?v=XvAueyGJTt0)
146 changes: 146 additions & 0 deletions bin/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
#! /usr/bin/env node

import dialog from "node-file-dialog";
import chalk from "chalk";
import boxen from "boxen";

import {
createSettings,
createValues,
setHPET,
writeCommandFile,
} from "../lib/index.js";

import inquirer from "inquirer";
import "./intro.js";

const config = { type: "directory" };

var optimizationConfig = {
opt: ["Settings", "Registry", "Disable HPET"],
tier: 2,
level: 1,
};
var gameFolder = "";
var procCount = false;
var procCountDone = 0;

inquirer
.prompt([
{
type: "checkbox",
name: "opt-list",
message: "Check all the optimization you want to do right now",
choices: ["Settings", "Registry", "Disable HPET"],
checked: true,
},
{
type: "rawlist",
name: "pc-tier",
message: "What's your PC configuration?",
choices: ["Ultra-Low-End", "Low-End", "Mid-End", "High-End"],
},
{
type: "rawlist",
name: "config-level",
message: "Which optimization would you use?",
choices: [
"Recomended for Most PCs",
"Good PC but shutters",
"Best FPS with low visual",
],
},
])

.then(
(answers) => {
var pc_tier = answers["pc-tier"];
var pc_opt = answers["opt-list"];
var pc_level = answers["config-level"];

if (pc_opt.length) {
optimizationConfig.opt = pc_opt;
}

if (pc_tier === "Low-End") {
optimizationConfig.tier = 2;
} else if (pc_tier === "Ultra-Low-End") {
optimizationConfig.tier = 1;
} else if (pc_tier === "High-End") {
optimizationConfig.tier = 4;
} else {
optimizationConfig.tier = 3;
}

if (pc_level === "Good PC but shutters") {
optimizationConfig.level = 2;
} else if (pc_level === "Best FPS with low visual") {
optimizationConfig.level = 3;
} else {
optimizationConfig.level = 1;
}

console.log(
"\nNow, you have to choose your game directory to continue. Press any key to go on!"
);

process.stdin.setRawMode(true);
process.stdin.resume();
process.stdin.once("data", function () {
dialog(config)
.then(async (dir) => {
gameFolder = dir[0];

procCount = optimizationConfig.opt.length + 1;

writeCommandFile(gameFolder, optimizationConfig.level, (t) => {
logStatus(t, "Creating commndline file ");
});

if (optimizationConfig.opt.includes("Settings")) {
createSettings(optimizationConfig.tier, (t) => {
logStatus(t, "Editing Settings Configuration");
});
}
if (optimizationConfig.opt.includes("Registry")) {
await createValues(optimizationConfig, (t) => {
logStatus(t, "Creating Registry Values");
});
}
if (optimizationConfig.opt.includes("Disable HPET")) {
setHPET((t) => {
logStatus(t, "Disabling HPET");
});
}
})
.catch((err) => {
console.log("No directory was selected! Aborting..");
process.exit();
});
});
},
function (err) {
console.log("we died! %s", err);
}
);

function logStatus(s, t) {
procCountDone = procCountDone + 1;
s ? (s = chalk.green("Success")) : chalk.red("Failed!");
console.log(chalk.gray(procCountDone + "/" + procCount) + " " + t + ": " + s);
checkProcCount();
}

function checkProcCount() {
if (procCountDone === procCount) {
console.log(
"\n" +
chalk.yellow(
boxen(
"If this really helped you, please consider buying me a coffee :) https://buymeacoffee.com/harrytom"
)
)
);
process.exit();
}
}
19 changes: 19 additions & 0 deletions bin/intro.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import chalk from "chalk";
import boxen from "boxen";

const introText = ` ) ( )
( * ) ( ( /( )\\ ) * ) ( /(
)\\ ) ' ) /( )\\ ( ( )\\()) (()/(' ) /( )\\())
(()/( ( )(_))((((_)( )\\ )\\ ((_)\\ /(_))( )(_))((_)\
/(_))_ (_(_()) )\\ _ )\\ ((_)((_) ((_) (_)) (_(_()) __((_)
(_)) __||_ _| (_)_\\(_) \\ \\ / / / _ \\ | _ \\|_ _| \\ \\/ /
| (_ | | | / _ \\ \\ V / | (_) || _/ | | > <
\\___| |_| /_/ \\_\\ \\_/ \\___/ |_| |_| /_/\\_\\`;

const caption = `Optimize/Boost your GTA V FPS according to your PC configuration!\nMade by ${chalk.blue(
"Harry"
)} (https://github.com/Harry260)`;

console.log(chalk.green(introText));
console.log("\r\n");
console.log(boxen(caption), "\r\n");
11 changes: 11 additions & 0 deletions lib/HPET.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { execSync } from "child_process";

export default function setHPET(callback = console.log) {
try {
execSync("bcdedit /deletevalue useplatformclock", {
encoding: "utf-8",
});
} catch {
callback(true);
}
}
40 changes: 40 additions & 0 deletions lib/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import fs from "fs";
import chalk from "chalk";

var commands = {
1: `-borderless
-FrameQueueLimit 0
-DX11`,
2: `-noquanttransform
-borderless
-FrameQueueLimit 1
-DX11
-disableHyperthreading`,
3: `-noquanttransform
-fullscreen
-FrameQueueLimit 1
-DX10
-cityDensity 0.3
-anisotropicQualityLevel 0
-grassQuality 0
-hdr
-lodScale 0.0
-noInGameDOF
-particalQuality 0
-pedLodBias 0.0
-postFX 0
-reflectionQuality 0
-shaderQuality 0
-vehicleLodBias 0.0`,
};

export default function writeCommandFile(gf, level, callback = console.log) {
console.log("Set Game directory to: ", chalk.gray(gf), "\n");
fs.writeFile(gf + "/commandline.txt", commands[level], function (err) {
if (err) {
callback(false);
} else {
callback(true);
}
});
}
4 changes: 4 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export { default as createValues } from "../lib/registry.js";
export { default as setHPET } from "../lib/HPET.js";
export { default as createSettings } from "../lib/settings.js";
export { default as writeCommandFile } from "../lib/commands.js";
99 changes: 99 additions & 0 deletions lib/registry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import regedit from "regedit";

export default async function createValues(
config = {
opt: ["Settings", "Registry", "Disable HPET"],
tier: 2,
level: 1,
},
callback = console.log
) {
try {
await regedit.putValue(
{
"HKCU\\System\\GameConfigStore": {
GameDVR_Enabled: {
value: "00000000",
type: "REG_DWORD",
},
GameDVR_HonorUserFSEBehaviorMode: {
value: "00000001",
type: "REG_DWORD",
},
GameDVR_DXGIHonorFSEWindowsCompatible: {
value: "00000001",
type: "REG_DWORD",
},
GameDVR_FSEBehaviorMode: {
value: "00000002",
type: "REG_DWORD",
},
GameDVR_FSEBehavior: {
value: "00000002",
type: "REG_DWORD",
},
},

"HKLM\\SOFTWARE\\Microsoft\\PolicyManager\\default\\ApplicationManagement\\AllowGameDVR":
{
value: {
value: "00000000",
type: "REG_DWORD",
},
},
"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Multimedia\\SystemProfile\\Tasks\\Games":
{
"GPU Priority": {
value: "00000008",
type: "REG_DWORD",
},
Priority: {
value: "00000006",
type: "REG_DWORD",
},
"Scheduling Category": {
value: "High",
type: "REG_SZ",
},
"SFIO Priority": {
value: "High",
type: "REG_SZ",
},
},
},
() => {}
);

if (config.tier === 1 || config.tier === 2 || config.tier === 3) {
await regedit.putValue(
{
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Multimedia\\SystemProfile":
{
SystemResponsiveness: {
value: "00000001",
type: "REG_DWORD",
},
},
},
() => {}
);
} else {
await regedit.putValue(
{
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Multimedia\\SystemProfile":
{
SystemResponsiveness: {
value: "00000000",
type: "REG_DWORD",
},
},
},
() => {}
);
}

callback(true);
} catch (error) {
callback(false);
}
}
6 changes: 6 additions & 0 deletions lib/settings-xml.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 73ce880

Please sign in to comment.