add shit
This commit is contained in:
commit
7d6759db51
5 changed files with 641 additions and 0 deletions
35
index.js
Normal file
35
index.js
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
const fs = require('node:fs')
|
||||
const sharp = require('sharp')
|
||||
const imageDimensions = require('image-dimensions')
|
||||
const config = require('./config.json')
|
||||
|
||||
console.log(`selerifying game ${config.session.game}`)
|
||||
|
||||
if (fs.existsSync(`${config.general.dolphinFolder}Dump/Textures/${config.session.game}`)) {
|
||||
if (!fs.existsSync(`${config.general.dolphinFolder}Load/Textures/${config.session.game}`)) {
|
||||
console.log('creating Load folder')
|
||||
fs.mkdirSync(`${config.general.dolphinFolder}Load/Textures/${config.session.game}`)
|
||||
}
|
||||
let dumpDir = fs.readdirSync(`${config.general.dolphinFolder}Dump/Textures/${config.session.game}`)
|
||||
dumpDir.forEach(async element => {
|
||||
console.log(`selerifying texture: ${element}`)
|
||||
let stream = await ReadableStream.from(fs.createReadStream(`${config.general.dolphinFolder}Dump/Textures/${config.session.game}/${element}`))
|
||||
let dims = await imageDimensions.imageDimensionsFromStream(stream)
|
||||
let img = sharp('./seler.png')
|
||||
if (config.session.rotateUpsideDown) {
|
||||
img = await img.rotate(180)
|
||||
}
|
||||
if (config.session.flipHorizontal) {
|
||||
img = await img.flop()
|
||||
}
|
||||
img = await img.resize({
|
||||
width: dims.width,
|
||||
height: dims.height,
|
||||
fit: "fill"
|
||||
})
|
||||
await img.toFile(`${config.general.dolphinFolder}Load/Textures/${config.session.game}/${element}`)
|
||||
})
|
||||
|
||||
} else {
|
||||
console.log("you don't have a texture dump for this game you fucking idiot")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue