Skip to content

Add Fire Emblem GBA format - #92

Open
kagnusdev wants to merge 1 commit into
Rangi42:masterfrom
kagnusdev:issues/74
Open

Add Fire Emblem GBA format#92
kagnusdev wants to merge 1 commit into
Rangi42:masterfrom
kagnusdev:issues/74

Conversation

@kagnusdev

Copy link
Copy Markdown

This PR handles the requested format from #74. I named it "FEGBA struct" for lack of a better name.

This was tested with files from the statscreen folder, the bin files (new format) are generated from the tmap files (regular GBA 4BPP format) by the rules in graphics_file_rules.mk.

@laqieer

laqieer commented Jun 11, 2026

Copy link
Copy Markdown

Independent verification from a fireemblem8u user — the FEGBA format loads our tilemaps byte-for-byte, and the branch builds cleanly. 👍 for merge.

I tested the FEGBA_4BPP ("FEGBA struct") format this PR adds against the current fireemblem8u decomp. The round-trip is exact and the branch builds clean — details below in case they help this land.

Format round-trips with the decomp

The decomp emits these .bin tilemaps from .tmap sources via scripts/tmap2tsa.py, whose writer is the precise inverse of this PR's reader:

  • writes a 2-byte zero-based [width, height] header (tsa_f.write(bytes([width, height]))), then
  • writes the rows bottom-to-top (revert_lines).

This PR's reader in src/tilemap.cpp matches exactly: width = 1 + tbytes[0], expected_tiles_count = (1 + tbytes[1]) * width, rows read for row = tbytes[1] … 0 at offset 2 + row*width*2, with each 2-byte word decoding a 10-bit tile id + 16-palette + X/Y flip.

Concrete check on a real file — graphics/statscreen/StatscreenEquipmentBG.bin, built with --width 15 --height 5:

  • first bytes: 0f 05
  • size: 194 = 2 + (15+1)·(5+1)·2 → parses as a 16×6 tilemap, byte-for-byte.

(Nice touch that the format comment already points at {fireemblem8u|fireemblem6j}/graphics/*/*.bin.)

Builds cleanly on Linux

Built this branch (issues/74, a36d548) from source on Ubuntu 24.04 with g++ 13.3.0 against FLTK 1.4.4 — produces a working tilemapstudio ELF binary with no errors, and strings confirms the new "FEGBA struct" format is compiled in. (Minor headless-Linux note, not a PR issue: FLTK's make install aborts unless libfltk_gl.a builds, i.e. libgl1-mesa-dev/libglu1-mesa-dev must be installed.) I couldn't exercise the GUI here (no display), but the byte-level match above already confirms load compatibility.

This unblocks using Tilemap Studio for FE GBA status-screen / UI backgrounds straight from the decomp — would be great to see it merged. Happy to help test fireemblem6j files too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants