Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
SuppliedOrange committed Jul 8, 2023
1 parent a2d219d commit f5189c0
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 0 deletions.
51 changes: 51 additions & 0 deletions fixer.js
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;

});
35 changes: 35 additions & 0 deletions package-lock.json

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

23 changes: 23 additions & 0 deletions package.json
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"
}
}

0 comments on commit f5189c0

Please sign in to comment.