This repository has been archived by the owner on Jan 18, 2024. It is now read-only.
-
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
a2d219d
commit f5189c0
Showing
3 changed files
with
109 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Basically we need to delete pipelines cache files in the rdr2 settings folder continuously | ||
|
||
// Imports : | ||
const { unlinkSync, existsSync, readdirSync } = require('fs') | ||
const { extname } = require('path') | ||
const { homedir } = require('os') | ||
const cron = require('node-cron') | ||
|
||
// Constants : | ||
|
||
// Evaluates to C:\Users\xxxx\Documents\Rockstar Games\Red Dead Redemption 2\Settings | ||
const RDR2SETTINGSFOLDER = homedir() + `\\Documents\\Rockstar Games\\Red Dead Redemption 2\\Settings`; | ||
|
||
// List of pipeline cache file extensions i've found so far | ||
const CACHE_EXTENSIONS = [ '.vkPipelineCacheWindows', '.d3d12PipelineCacheWindows', '.vkPipelineCacheHeaderWindows' ]; | ||
|
||
// Verification : | ||
|
||
// If it doesn't exist, well "it works on my machine :)" | ||
if ( !existsSync(RDR2SETTINGSFOLDER) ) throw "Can't find settings folder!\n( Documents/Rockstar Games/RDR2/Settings/ )"; | ||
|
||
// Main function : | ||
|
||
function delete_cache () { | ||
|
||
// Scan each file in the settings directory | ||
readdirSync(RDR2SETTINGSFOLDER).forEach( file => { | ||
|
||
if ( CACHE_EXTENSIONS.includes( extname(file) ) ) { // If the file is a pipeline cache file, delete it. | ||
|
||
unlinkSync( RDR2SETTINGSFOLDER + `\\${file}` ).catch(e => { console.log(e) }) | ||
|
||
} | ||
|
||
}); | ||
|
||
} | ||
|
||
// Cronjob scheduled for every 3 seconds : | ||
|
||
var count = 1; | ||
|
||
console.log("Running RDR2 Cache clearer! Leave this on while you play RDR2.") | ||
|
||
cron.schedule('*/3 * * * * *', () => { // Delete cache every 3 seconds | ||
|
||
console.log(`${count}: Clearing cache`) | ||
delete_cache(); | ||
count += 1; | ||
|
||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,23 @@ | ||
{ | ||
"name": "rdr2-cache-clearer", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "fixer.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"run": "node fixer.js" | ||
}, | ||
"bin" : { | ||
"execute" : "fixer.js" | ||
}, | ||
"keywords": [ | ||
"red dead redemption 2", | ||
"rdr2", | ||
"rockstar games" | ||
], | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"node-cron": "^3.0.2" | ||
} | ||
} |