Skip to content

Commit b50f7d1

Browse files
committed
validateAssetData NES fix rletag
1 parent 90b34c3 commit b50f7d1

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/ide/pixeleditor.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ export function convertWordsToImages(words: UintArray, fmt: PixelEditorImageForm
193193

194194
export function validateAssetData(datastr: string, fmt): string | null {
195195
var words = parseHexWords(convertToHexStatements(datastr));
196+
if (fmt.comp == 'rletag') {
197+
words = Array.from(rle_unpack(new Uint8Array(words)));
198+
}
196199
if (fmt.w > 0 && fmt.h > 0) {
197200
// same variables as convertWordsToImages
198201
var count = fmt.count || 1;
@@ -202,7 +205,7 @@ export function validateAssetData(datastr: string, fmt): string | null {
202205
var wordsperline = fmt.sl || Math.ceil(fmt.w * bpp / bitsperword);
203206
var pofs = fmt.pofs || wordsperline * fmt.h * count;
204207
var skip = fmt.skip || 0;
205-
var wpimg = fmt.wpimg || wordsperline * fmt.h;
208+
var wpimg = fmt.wpimg || (fmt.map === 'nesnt' ? 1024 : wordsperline * fmt.h);
206209

207210
var maxOffset = 0;
208211
for (var n = 0; n < count; n++) {

0 commit comments

Comments
 (0)