diff --git a/tools/gfx4snes/readme.md b/tools/gfx4snes/readme.md index 4feb4a6b..caaaf663 100644 --- a/tools/gfx4snes/readme.md +++ b/tools/gfx4snes/readme.md @@ -34,7 +34,7 @@ where filename is a 256 color PNG or BMP file - `-g` Include high priority bit in map - `-y` Generate map in pages of 32x32 blocks (good for scrolling) - `-R` No tile reduction (not advised) -- `-M (1|5|6|7)` Convert the whole picture for mode 1, 5, 6 or 7 format [1] +- `-M (1|5|6|7||9)` Convert the whole picture for mode 1, 5, 6 or 7 format, 9 is without map constraint [1] ### Palette options - `-a` Rearrange palette, and preserve palette numbers in tilemap diff --git a/tools/gfx4snes/src/arguments.c b/tools/gfx4snes/src/arguments.c index 856b35e1..fa8c3c00 100644 --- a/tools/gfx4snes/src/arguments.c +++ b/tools/gfx4snes/src/arguments.c @@ -108,7 +108,7 @@ cmdp_action_t argument_callback(cmdp_process_param_st *params) } // check map mode (default is 1) - if ( (gfx4snes_args.mapscreenmode!=1) && (gfx4snes_args.mapscreenmode!=5) && (gfx4snes_args.mapscreenmode!=6) && (gfx4snes_args.mapscreenmode!=7) ) + if ( (gfx4snes_args.mapscreenmode!=1) && (gfx4snes_args.mapscreenmode!=5) && (gfx4snes_args.mapscreenmode!=6) && (gfx4snes_args.mapscreenmode!=7) && (gfx4snes_args.mapscreenmode!=9) ) { fatal("incorrect value for map mode format [%d]\nconversion terminated.", gfx4snes_args.mapscreenmode); // exit gfx4snes at this point } @@ -139,7 +139,7 @@ cmdp_action_t argument_callback(cmdp_process_param_st *params) gfx4snes_args.paletteoutput=nbcols; } // check palette entry (default is 0) - if ( (gfx4snes_args.paletteentry<0) || (gfx4snes_args.paletteentry>2047) ) + if ( (gfx4snes_args.paletteentry<0) || (gfx4snes_args.paletteentry>7) ) { fatal("incorrect value for palette entry [%d]\nconversion terminated.", gfx4snes_args.paletteentry); // exit gfx4snes at this point } diff --git a/tools/gfx4snes/src/gfx4snes.c b/tools/gfx4snes/src/gfx4snes.c index 746a1154..c4dcc248 100644 --- a/tools/gfx4snes/src/gfx4snes.c +++ b/tools/gfx4snes/src/gfx4snes.c @@ -54,7 +54,7 @@ static cmdp_command_st gfx4snes_command = { {0, 0, "Palettes options:\n", CMDP_TYPE_NONE, NULL,NULL}, {'a', "pal-rearrange", "rearrange palette and preserve palette numbers in tilemap", CMDP_TYPE_BOOL, &gfx4snes_args.paletterearrange}, {'d', "pal-rounded", "palette rounding (to a maximum value of 63)", CMDP_TYPE_BOOL, &gfx4snes_args.paletteround}, - {'e', "pal-entry", "palette entry to add to map tiles {0..15}", CMDP_TYPE_INT4, &gfx4snes_args.paletteentry}, + {'e', "pal-entry", "palette entry to add to map tiles {0..7}", CMDP_TYPE_INT4, &gfx4snes_args.paletteentry}, {'o', "pal-col-output", "number of colors to output to filename.pal {0..256}", CMDP_TYPE_INT4, &gfx4snes_args.paletteoutput}, {'p', "pal-output", "include palette for output", CMDP_TYPE_BOOL, &gfx4snes_args.palettesave}, {'u', "pal-col-use", "number of colors to use {4,16,128,[256]}", CMDP_TYPE_INT4, &gfx4snes_args.palettecolors}, diff --git a/tools/gfx4snes/src/maps.c b/tools/gfx4snes/src/maps.c index 2bad7edf..4392bfc7 100644 --- a/tools/gfx4snes/src/maps.c +++ b/tools/gfx4snes/src/maps.c @@ -65,7 +65,11 @@ unsigned short *map_convertsnes (unsigned char *imgbuf, int *nbtiles, int blksiz blksizex = 16; if (!isquiet) info("will use specific mode 5 & 6 values %d block for x, with tile size %dx%d...",nbblockx,16,blksizey); } - + // if mode 9, just put an infomation message + if (graphicmode==9) + { + if (!isquiet) info("will use specific mode without constrainst for %dx%d blocks with tile size %dx%d...",nbblockx,nbblocky,blksizex,blksizey); + } // size of a tile block (64 bytes for a 8x8 block) sizetile = blksizex*blksizey; @@ -77,15 +81,13 @@ unsigned short *map_convertsnes (unsigned char *imgbuf, int *nbtiles, int blksiz fatal("can't allocate enough memory for the buffer in map_convertsnes"); } - // clear map - //memset(map, 0, nbblockx * nbblocky * sizeof(unsigned short)); + // some information if (!isquiet) info("managed a map of %dx%d tiles of %dx%d pixels...",nbblockx,nbblocky,blksizex,blksizey); if ( !isquiet && is32size) info("rearrange map for 32x32 scrolling..."); // add the palette number to tiles if (!isquiet) info("add palette entry #%d to tiles in map...",offsetpal); currenttile = 0; - for (y = 0; y < nbblocky; y++) { for (x = 0; x < nbblockx; x++) @@ -93,7 +95,8 @@ unsigned short *map_convertsnes (unsigned char *imgbuf, int *nbtiles, int blksiz // get the palette number (0-7 for both 4 & 16 color mode) paletteno = (nbcolors != 4) ? (imgbuf[currenttile * sizetile] >> 4) & 0x07 : (imgbuf[currenttile * sizetile] >> 2) & 0x07; tilevalue = ((paletteno + offsetpal) << 10); - + if ((tilevalue>>10)>=8) warning ("out of bounds palette %d for tile %d",currenttile,paletteno); + if ((graphicmode==5) || (graphicmode==6)) { map[y * nbblockx + x] = tilevalue; @@ -123,6 +126,10 @@ unsigned short *map_convertsnes (unsigned char *imgbuf, int *nbtiles, int blksiz else map[(y + 96 - 32) * 32 + x - 32] = tilevalue; } + else if (graphicmode==9) + { + map[y * nbblockx + x] = tilevalue; + } else if (is32size == 1) { // create pages of 32x32 @@ -275,7 +282,7 @@ unsigned short *map_convertsnes (unsigned char *imgbuf, int *nbtiles, int blksiz int idx = x_mult * 1024 + y * 32 + new_x; map[idx] += tilevalue; } - else // 32x32 or 128x128 screen + else // 32x32 or 128x128 screen or with no constrainst { map[y * nbblockx + x] += tilevalue; }