Skip to content

Instantly share code, notes, and snippets.

@tcdw
Created February 3, 2017 06:48
Show Gist options
  • Select an option

  • Save tcdw/16fe6a81bb62c6849ae51bf78addfeb0 to your computer and use it in GitHub Desktop.

Select an option

Save tcdw/16fe6a81bb62c6849ae51bf78addfeb0 to your computer and use it in GitHub Desktop.
Fix SPCs dumped via Snes9x for split700
#!/usr/bin/env nodejs
/*
Fix SPCs dumped via Snes9x for split700
This script will let you avoid split700's bug and dump BRRs properly.
Just put the script into your SPC folder, this scrpit will scan and fix all SPCs in the folder.
(Node.js is required)
This script is in the public domain.
*/
var fs = require('fs');
var dirpath = process.cwd();
var filelist = fs.readdirSync(dirpath);
readExt = function(fileName){
var tempName = fileName.split(".");
return tempName[tempName.length - 1];
}
for(i = 0; i < filelist.length; i++){
if (readExt(filelist[i]) == "spc") {
var chunk = fs.readFileSync(filelist[i]);
for (j = 0; j < 8; j++) {
chunk[0x1010A + j * 16] = 0x00;
chunk[0x1010B + j * 16] = 0x00;
chunk[0x1010E + j * 16] = 0x00;
}
fs.writeFileSync(filelist[i], chunk);
console.log("Fixed " + filelist[i]);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment