Skip to content

[Feature request] Discontiguous "regions" of tileset and palette space #1886

@Rangi42

Description

@Rangi42

RGBGFX currently lets you control tile and palette output by specifying a base/starting ID and a maximum number of IDs:

  • Tiles: -b/--base-tiles B₀,B₁ and -N/--nb-tiles N₀,N₁
    This places tiles in bank 0 with the IDs B₀, B₀+1, B₀+2, ...B₀+N₀−1; then continues in bank 1 with the IDs B₁, B₁+1, B₁+2, ...B₁+N₁−1; for a max total of N₀+N₁ tiles.
  • Palettes: -l/--base-palette B and -n/--nb-palettes N
    This places palettes with the IDs B, B+1, B+2, ...B+N−1; for a max total of N palettes.

This is sufficient if your output needs to take up one contiguous region (or for tiles, one contiguous region per bank).

However, there are cases where you'd want to use multiple discontiguous regions. For example, I want to start my tile output in $1:00-7E, continue in $1:80-FE, and continue further in $0:00-7E, but skip tiles $1:7F and $1:FF. Or maybe I'd want to use all of VRAM1 except $1:60-7F (let's say those $20 are font tiles instead of my tilemapped rgbgfx-generated graphic). Sometimes I can use the existing options to hackily fake this, if I can pretend that two discontiguous regions are two different banks (as long as I can ignore or postprocess-correct the attribute data). But three or more is just not possible. All of that also applies to palettes, e.g. if I've reserved palettes 3 and 7 for some purpose, but can freely generate into 0-2 and 4-6.

Proposal: add two new flags to specify a sequence of "regions":

  • Tiles: -R/--tile-regions "B₀:P₀-Q₀, B₁:P₁-Q₁, ..."
    This places tiles in bank B₀ with the IDs P₀, P₀+1, P₀+2, ...Q₀; then continues in bank B₁ with the IDs P₁, P₁+1, P₁+2, ...Q₁; and so on for each region, for a max total of (Q₀−P₀+1 + Q₁−P₁+1 + ...) tiles.
  • Palettes: -S/--palette-regions "P₀-Q₀, P₁-Q₁, ..."
    This places palettes with the IDs P₀, P₀+1, P₀+2, ...Q₀; then continues with the IDs P₁, P₁+1, P₁+2, ...Q₁; and so on for each region, for a max total of (Q₀−P₀+1 + Q₁−P₁+1 + ...) palettes.
  • Regions with a single tile/palette, like X-X, could be abbreviated as X without a hyphen.

I imagine this could be implemented by calculating the max total number of tiles/palettes, and allocating them from 0 to that quantity; then remapping into the discontiguous IDs just before output.

There was already some discussion of this proposal on GBDev's Discord, after my motivating use case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementTypically new features; lesser priority than bugsrgbgfxThis affects RGBGFX

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions