-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
85 additions
and
25 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
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,42 @@ | ||
import os from 'node:os'; | ||
import path from 'node:path'; | ||
import fs from 'node:fs'; | ||
import * as mkdirp from 'mkdirp'; | ||
import { get24BitPalette } from '../../api/palette/get24BitPalette'; | ||
import { BaseTile } from '../../types'; | ||
|
||
/** | ||
* Verifies all tiles are 16 colors or less. This takes into account index 0/transparency, | ||
* as get24BitPalette will ensure the palette has transparency at zero | ||
* @param tiles | ||
*/ | ||
function confirmTilesAre16ColorsOrLess<TTile extends BaseTile>(tiles: TTile[]) { | ||
const badTiles = tiles.filter((t) => { | ||
return get24BitPalette(t.canvasSource).length > 16; | ||
}); | ||
|
||
if (badTiles.length > 0) { | ||
const tmpDir = path.resolve( | ||
os.tmpdir(), | ||
`sromcromBadTiles-${Date.now().toString()}` | ||
); | ||
|
||
mkdirp.sync(tmpDir); | ||
|
||
for (let i = 0; i < badTiles.length; ++i) { | ||
const tile = badTiles[i]; | ||
const paletteLength = get24BitPalette(tile.canvasSource).length; | ||
const buffer = tile.canvasSource.toBuffer(); | ||
|
||
const tilePath = path.resolve(tmpDir, `tile-${i}-${paletteLength}.png`); | ||
|
||
fs.writeFileSync(tilePath, buffer); | ||
} | ||
|
||
throw new Error( | ||
`Some tiles have more than 16 colors, bad tiles written to: ${tmpDir}` | ||
); | ||
} | ||
} | ||
|
||
export { confirmTilesAre16ColorsOrLess }; |
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
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
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,18 @@ | ||
{ | ||
"romPathRoot": "./out/202-", | ||
"padCROMFilesTo": 1048576, | ||
"cromImages": [ | ||
{ | ||
"name": "bg_oceans", | ||
"imageFile": "./kof94te_bg_oceans.png" | ||
}, | ||
{ | ||
"name": "logo_countries", | ||
"imageFile": "./kof94te_logo_countries.png" | ||
}, | ||
{ | ||
"name": "characterGrid", | ||
"imageFile": "./kof94te_characterGrid.png" | ||
} | ||
] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,27 +1,10 @@ | ||
{ | ||
"romPathRoot": "./out/test-", | ||
"padCROMFilesTo": 1048576, | ||
"eyecatcher": { | ||
"mainLogoImageFile": "./eyecatcher_mainLogo.png", | ||
"max330MegaImageFile": "./eyecatcher_max330.png", | ||
"proGearSpecImageFile": "./eyecatcher_progear.png", | ||
"snkLogoImageFile": "./eyecatcher_companyLogo.png", | ||
"copyrightCharacterImageFile": "./eyecatcher_copyright.png" | ||
}, | ||
"sromImages": { | ||
"inputs": [ | ||
{ | ||
"name": "font", | ||
"imageFile": "./fixFont.png" | ||
} | ||
] | ||
}, | ||
"cromImages": { | ||
"inputs": [ | ||
{ | ||
"name": "fire", | ||
"imageFile": "./campFire.png" | ||
} | ||
] | ||
} | ||
"cromImages": [ | ||
{ | ||
"name": "test", | ||
"imageFile": "./test.png" | ||
} | ||
] | ||
} |
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