-
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.
time to put it down and play a rom! up next, scraping!
- Loading branch information
1 parent
dd693a4
commit 966d0fd
Showing
10 changed files
with
643 additions
and
89 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,62 @@ | ||
{ | ||
// http://eslint.org/docs/rules/ | ||
"extends": "google", | ||
"env": { | ||
"node": true, | ||
"jasmine": true, | ||
"es6": true, | ||
}, | ||
"globals": { | ||
readline: false | ||
}, | ||
"plugins": [], | ||
"settings": { | ||
}, | ||
"rules": { | ||
"no-use-before-define": 0, | ||
"camelcase": 0, | ||
"no-unused-vars": 1, | ||
"no-underscore-dangle": 0, | ||
"no-multi-spaces": 0, | ||
"no-shadow": 0, | ||
"no-console": 0, | ||
"no-dupe-args": 1, | ||
"no-unsafe-negation": 1, | ||
"no-dupe-keys": 2, | ||
"no-duplicate-case": 2, | ||
"no-empty": 0, | ||
"no-extra-boolean-cast": 1, | ||
"no-extra-parens": 0, | ||
"no-invalid-this": 0, | ||
"no-undefined": 0, | ||
"no-var": 0, | ||
'no-multiple-empty-lines': [2, { | ||
max: 3 | ||
}], | ||
"one-var": 0, | ||
"one-var-declaration-per-line": ["error", "initializations"], | ||
"global-require": 2, | ||
"block-spacing": ["error", "never"], | ||
"consistent-this": [1, "bad"], | ||
"line-comment-position": 0, | ||
"newline-after-var": [0, "always"], | ||
"new-cap": [1, {"properties": false}], | ||
"padded-blocks": 0, | ||
"brace-style": [2, "1tbs", { "allowSingleLine": true }], | ||
"max-statements-per-line": [1, { "max": 1 }], | ||
"curly": [2, "multi-line"], | ||
"no-eval": 2, | ||
"no-extend-native": 2, | ||
"no-new-wrappers": 2, | ||
"no-with": 2, | ||
"array-bracket-spacing": [2, "never"], | ||
"no-array-constructor": 2, | ||
"no-mixed-spaces-and-tabs": 2, | ||
"no-new-object": 2, | ||
"object-curly-spacing": [2, "never"], | ||
"semi": 2, | ||
"require-jsdoc": 0, | ||
"valid-jsdoc": 0, | ||
"max-len": [2, 80, 2, { "ignoreComments": true, "ignoreUrls": true, "ignoreTemplateLiterals": true, "ignorePattern": "^[\\s\\w\\s=]*goog\\.(?:module|provide|require)\\([\"'](.*)[\"']\\)"}], | ||
} | ||
} |
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 @@ | ||
61228 |
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,11 @@ | ||
{ | ||
"libs": [ | ||
"node" | ||
], | ||
"loadEagerly": [ | ||
], | ||
"plugins": { | ||
"node_resolve": {}, | ||
"es_modules": {} | ||
} | ||
} |
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 @@ | ||
"cb560220b7b1b8202e92381aee19cd36" |
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 |
---|---|---|
@@ -1,30 +1,60 @@ | ||
const ROM = require('./rom.js'); | ||
const fs = require('fs'); | ||
const vt_base_patch = require('./vt_base_patch.json'); | ||
const daily = require('./daily.json'); | ||
const current_rom_hash = require('./current_rom_hash.json'); | ||
|
||
const s3_prefix = "https://s3.us-east-2.amazonaws.com/alttpr-patches"; | ||
|
||
const loadFile = (file) => { | ||
console.log({file}); | ||
return ROM(fs.readFileSync(file), (rom) => { | ||
console.log('loaded'); | ||
let patch = require('./base_patch.json'); | ||
let daily = require('./daily.json'); | ||
rom.setBasePatch(patch) | ||
const patchRomFromJSON = (rom) => { | ||
return new Promise((resolve, reject) => { | ||
if (typeof vt_base_patch !== 'undefined') { | ||
if (!Array.isArray(vt_base_patch)) { | ||
return reject('base patch corrupt'); | ||
} | ||
return rom.parsePatch({patch: vt_base_patch}).then((rom) => { | ||
rom.setBasePatch(vt_base_patch); | ||
resolve(rom); | ||
}); | ||
} | ||
}); | ||
}; | ||
|
||
rom.parsePatch(daily).then((rom) => { | ||
rom.setBasePatch(patch); | ||
rom.save('n_' + downloadFilename() + '.sfc'); | ||
}); | ||
|
||
// rom.reset().then((rom_) => { | ||
// parsePatch(); | ||
// save(downloadFilename() + '.sfc'); | ||
// }) | ||
}, () => { | ||
console.log('error') | ||
const buildRom = (file, quickswap=false, musicVolume=false, menuSpeed='normal', | ||
heartColor='red', heartSpeed='half', spriteName='001.link.1.zspr') => { | ||
return new ROM(fs.readFileSync(file), (rom) => { | ||
patchRomFromJSON(rom).then((rom) => { | ||
if (rom.checkMD5() != current_rom_hash) { | ||
console.log('error', 'error.bad_file'); | ||
return; | ||
} | ||
rom.parsePatch(daily).then((rom) => { | ||
rom.setQuickswap(quickswap); | ||
rom.setMusicVolume(musicVolume); | ||
rom.setMenuSpeed(menuSpeed); | ||
rom.setHeartColor(heartColor); | ||
rom.setHeartSpeed(heartSpeed); | ||
let sprite = fs.readFileSync(`./${spriteName}`); | ||
rom.parseSprGfx(sprite); | ||
console.log({ | ||
quickswap, | ||
musicVolume, | ||
menuSpeed, | ||
heartColor, | ||
heartSpeed, | ||
spriteName | ||
}); | ||
rom.save('n_' + rom.downloadFilename() + '.sfc'); | ||
}) | ||
}).catch((e) => { | ||
console.log('error', e) | ||
}); | ||
}) | ||
|
||
} | ||
|
||
module.exports = { | ||
ROM, | ||
loadFile | ||
buildRom, | ||
}; |
Oops, something went wrong.