cemu-smm
Advanced tools
Comparing version 1.0.2-b to 1.0.3
51
index.js
@@ -42,3 +42,3 @@ const crc32 = require("buffer-crc32"); | ||
return new Promise((resolve) => { | ||
await new Promise((resolve) => { | ||
try { | ||
@@ -62,3 +62,3 @@ let fileWithoutCrc = this.data.slice(16); | ||
return new Promise(async (resolve, reject) => { | ||
await new Promise(async (resolve, reject) => { | ||
try { | ||
@@ -130,2 +130,48 @@ if (this.data.slice(SAVE_ORDER_OFFSET, SAVE_ORDER_OFFSET + SAVE_ORDER_SIZE).readUInt32BE(0) !== 0) { | ||
}, | ||
exportJpeg: async function () { | ||
let promises = []; | ||
for (let i = 0; i < SAVE_ORDER_SIZE; i++) { | ||
let coursePath = path.resolve(`${this.pathToSave}/course${i.pad(3)}/`); | ||
promises.push(new Promise(async (resolve) => { | ||
let exists = false; | ||
await new Promise((resolve) => { | ||
fs.access(coursePath, fs.constants.R_OK | fs.constants.W_OK, (err) => { | ||
exists = !err; | ||
resolve(); | ||
}); | ||
}); | ||
if (exists) { | ||
await Promise.all([ | ||
new Promise(async (resolve) => { | ||
try { | ||
let tnl = new Tnl(coursePath + "/thumbnail0.tnl"); | ||
let jpeg = await tnl.toJpeg(); | ||
fs.writeFile(coursePath + "/thumbnail0.jpg", jpeg, null, () => { | ||
resolve(); | ||
}) | ||
} catch (err) { | ||
resolve(); | ||
} | ||
}), | ||
new Promise(async (resolve) => { | ||
try { | ||
let tnl = new Tnl(coursePath + "/thumbnail1.tnl"); | ||
let jpeg = await tnl.toJpeg(); | ||
fs.writeFile(coursePath + "/thumbnail1.jpg", jpeg, null, () => { | ||
resolve(); | ||
}); | ||
} catch (err) { | ||
resolve(); | ||
} | ||
}) | ||
]); | ||
} | ||
resolve(); | ||
})); | ||
} | ||
await Promise.all(promises); | ||
} | ||
@@ -137,2 +183,3 @@ | ||
this.pathToFile = path.resolve(pathToFile); | ||
if (!fs.existsSync(this.pathToFile)) throw new Error(`No such file exists:\n${this.pathToFile}`); | ||
} | ||
@@ -139,0 +186,0 @@ |
{ | ||
"name": "cemu-smm", | ||
"version": "1.0.2b", | ||
"description": "", | ||
"version": "1.0.3", | ||
"description": "This is a module to simplify all kinds of tasks with Loadiine Super Mario Maker save files and respectively Cemu", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
@@ -5,2 +5,3 @@ # cemu-smm | ||
It uses Javascript's async/await keywords that are available from Node >= 7.6. | ||
## Installation | ||
@@ -31,3 +32,6 @@ | ||
save.writeCrc(); | ||
// extract all tnl files to jpeg in their respective course folder | ||
save.exportJpeg(); | ||
// convert tnl to jpeg | ||
@@ -48,1 +52,8 @@ let tnl = smm.loadImage("path/to/your/tnl/file"); | ||
MIT License | ||
Copyright (c) 2017 Mario Reder | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
@@ -8,3 +8,4 @@ let smm = require("./index"); | ||
save.reorder(); | ||
//save.reorder(); | ||
save.exportJpeg(); | ||
@@ -11,0 +12,0 @@ // internally done by reorder() |
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
12651
200
2
57
0