Created
February 3, 2017 06:48
-
-
Save tcdw/16fe6a81bb62c6849ae51bf78addfeb0 to your computer and use it in GitHub Desktop.
Fix SPCs dumped via Snes9x for split700
This file contains hidden or 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
| #!/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