haroldo-ok / choice4genesis

A ChoiceScript clone that generates SGDK-compatible C source for the Sega Genesis
https://haroldo-ok.itch.io/choice4genesis
MIT License
20 stars 2 forks source link

Background images are being shown incorrectly #89

Closed haroldo-ok closed 1 year ago

haroldo-ok commented 1 year ago

momoutake sure! this can help narrow down the automatic image process.. the woman image is the one scrambling. the one with pencil on guy is working (the pencil color doesnt show up but thats ok for now...) pencil Thanks Originally posted by @zartan9 in https://github.com/haroldo-ok/choice4genesis/issues/66#issuecomment-1348872185

Okay, thanks; it seems that, indeed, that image is being displayed incorrectly, no matter how many ways one tries to convert it. I'll have to take a look at this one later.

bug.zip

haroldo-ok commented 1 year ago

Starting to look at the bug. Working branch: https://github.com/haroldo-ok/choice4genesis/tree/fix-background-image-bug

haroldo-ok commented 1 year ago

It does not seem to be a tileMap problem; if the tilemap part gets commented out, the bug still happens. VDP_loadTileSet() does return null, though, indicating that it is running out of memory.

void VN_showImage(const Image *image, VDPPlane plane, u16 palNum, u16 x, u16 y) {
    VDP_loadTileSet(image->tileset, imageInfo.tileNumber, DMA);

    TileMap *tmap = unpackTileMap(image->tilemap, NULL);
    VDP_setTileMapEx(plane, tmap, TILE_ATTR_FULL(palNum, FALSE, FALSE, FALSE, imageInfo.tileNumber), 
        x, y,  0, 0, tmap->w, tmap->h, CPU);
    MEM_free(tmap);

    VDP_setPalette(palNum, (u16*)image->palette->data);
    imageInfo.tileNumber += image->tileset->numTile;
}

Tested various permutations of the code, with various configurations, even going as far as removing compression; the problem persists.

zartan9 commented 1 year ago

ok keep me posted im sure youll get it!! Im working on the text in the meantime! thanks! On Sunday, January 8, 2023 at 05:49:53 PM EST, Haroldo de Oliveira Pinheiro @.***> wrote:

It does not seem to be a tileMap problem; if the tilemap part gets commented out, the bug still happens. VDP_loadTileSet() does return null, though, indicating that it is running out of memory. void VN_showImage(const Image *image, VDPPlane plane, u16 palNum, u16 x, u16 y) { VDP_loadTileSet(image->tileset, imageInfo.tileNumber, DMA);

TileMap *tmap = unpackTileMap(image->tilemap, NULL);
VDP_setTileMapEx(plane, tmap, TILE_ATTR_FULL(palNum, FALSE, FALSE, FALSE, imageInfo.tileNumber), 
    x, y,  0, 0, tmap->w, tmap->h, CPU);
MEM_free(tmap);

VDP_setPalette(palNum, (u16*)image->palette->data);
imageInfo.tileNumber += image->tileset->numTile;

} Tested various permutations of the code, with various configurations, even going as far as removing compression; the problem persists.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

zartan9 commented 1 year ago

i knew you could do it! it works! On Sunday, January 8, 2023 at 05:49:53 PM EST, Haroldo de Oliveira Pinheiro @.***> wrote:

It does not seem to be a tileMap problem; if the tilemap part gets commented out, the bug still happens. VDP_loadTileSet() does return null, though, indicating that it is running out of memory. void VN_showImage(const Image *image, VDPPlane plane, u16 palNum, u16 x, u16 y) { VDP_loadTileSet(image->tileset, imageInfo.tileNumber, DMA);

TileMap *tmap = unpackTileMap(image->tilemap, NULL);
VDP_setTileMapEx(plane, tmap, TILE_ATTR_FULL(palNum, FALSE, FALSE, FALSE, imageInfo.tileNumber), 
    x, y,  0, 0, tmap->w, tmap->h, CPU);
MEM_free(tmap);

VDP_setPalette(palNum, (u16*)image->palette->data);
imageInfo.tileNumber += image->tileset->numTile;

} Tested various permutations of the code, with various configurations, even going as far as removing compression; the problem persists.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

haroldo-ok commented 1 year ago

Thanks!