Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix remap_tiles_for_output() for -W16 #57

Merged
merged 2 commits into from
Jan 2, 2025

Conversation

undisbeliever
Copy link
Contributor

@undisbeliever undisbeliever commented Jan 2, 2025

This PR fixes a bug when converting SNES tiles with the -W16 argument.

It also fixes a segfault when converting tiles with -W8 -H16 arguments.

EDIT: This PR has not been tested with non SNES tiles and it has not been tested with a tile size > 16 pixels.


Source image:
test

superfamiconv -B 4 -S -D -F -W 16 -H 16 -i test.png -t out/test.4bpp -p out/test.pal

Before (v0.11.0):
v0-11-0-output

After:
fixed-output

This commit fixes a bug where the tile data output was squished and
missing even columns when converting a SNES tileset with a `-W 16`
argument.

This commit also fixes a segfault when converting a snes tileset with
`-W 8 -H 16` (when _tile_width is 8 `(cells_per_tile_h - 2)` underflows).
@undisbeliever
Copy link
Contributor Author

This PR does not fix the 16px map bug reported in #34

The tiles are now correct. The map data is still incorrect.

Test image:
map-test

superfamiconv -B4 -W16 -H16 -i map-test.png -t out/map-test.4bpp -m out/map-test.map -p out/map-test.pal

Before (v0.11.0):
Screenshot_20250102_110056
Screenshot_20250102_110106

After:
Screenshot_20250102_110130
Screenshot_20250102_110132

@Optiroc
Copy link
Owner

Optiroc commented Jan 2, 2025

Thanks!

@Optiroc Optiroc merged commit 3691d8c into Optiroc:main Jan 2, 2025
3 checks passed
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