Commit Graph

349 Commits

Author SHA1 Message Date
Rangi42 cae31005f8 Always use braces with InsertBraces: true in .clang-format 2025-01-27 20:12:12 -05:00
Rangi42 25c9f8f383 Add more rules to .clang-format 2025-01-27 20:12:12 -05:00
Rangi42 9c8e327ae2 Zero-initialize trimmedTile array 2025-01-27 20:12:12 -05:00
Rangi42 b8b60207f5 Use // line comments not /* block comments 2025-01-27 20:12:12 -05:00
Rangi42 a354af3d08 Reformat source files with clang-format 19.1.7 2025-01-27 20:12:12 -05:00
Rangi42 890528812e Prefer C++ constructs to C-style sizeof-based macros 2025-01-24 18:56:41 -05:00
Rangi d9654b752f Support -h/--help for all programs (#1620) 2025-01-21 21:24:17 -05:00
Rangi42 a85d6b3b57 Remove unused readMagic function 2025-01-17 00:09:47 -05:00
Rangi b13c0f2f8e Use a constant for 0x8001 (#1596) 2025-01-04 04:03:40 -05:00
Rangi ad95d2e06f Allow deduplicating tiles with neither an input nor output tileset (#1585) 2024-12-30 18:58:07 +01:00
Rangi42 b058bb6e15 Sorting RGB palettes by luminance is not a "legacy" feature 2024-12-23 10:01:30 -05:00
Sylvie b877c81c32 Use C++-style casts (#1576) 2024-12-09 21:56:54 -05:00
Eldred Habert d5f39c8dce Remove the use of floating-point for palette packing (#1565)
This is primarily a correctness change, *not* a performance one.
The expected performance impact is minimal anyway.

The goal is to eliminate the use of platform-inconsistent floating-point operations
for this load-bearing task.
2024-11-29 13:44:19 -05:00
Rangi42 9216485bca Add TRACE-level verbose logging for efficiency calculations 2024-11-27 21:06:18 +01:00
Rangi42 c33acb905b Avoid precision loss from floating-point division in calculating efficiency
This was breaking test results on 32-bit MinGW
2024-11-27 21:06:18 +01:00
Sylvie e0ee9dc3ad Add reverse_1bit RGBGFX test (#1555)
Fixes a bug to always use 2bpp `_data` in `TileData`
2024-11-24 19:30:49 -05:00
Sylvie a7fdb2c3d3 Add more RGBGFX test coverage (#1553) 2024-10-27 11:32:21 -04:00
Sylvie 90286ccbbc Fix detection of tiles with too many colors (#1546) 2024-10-20 13:51:39 -04:00
ISSOtm 86bf289452 Process the last line of textual palette specs even without a trailing newline
Fixes #1519
2024-09-30 22:26:00 +02:00
Sylvie 9783671399 Simplify some C++ abstractions (#1518)
* Remove namespaces
* Prefer `bool operator==`, not `friend auto operator==`
* Prefer not to use `using`
* Use a `constexpr` function instead of a template for `flipTable`
2024-09-26 00:07:27 -04:00
Rangi42 8037b9e10a Run clang-format 2024-09-25 13:15:58 -04:00
Rangi42 9b3d19c3f2 Prefer snprintf to sprintf
This also simplifies advancing `ptr`
2024-09-15 00:01:09 -04:00
Eldred Habert 80d37f9988 Implement --input-tileset (#1464)
As discussed in https://github.com/gbdev/rgbds/issues/575#issuecomment-1991456862
2024-09-04 15:20:01 -04:00
Rangi42 26fcff831d Run clang-format 2024-08-27 01:49:05 -04:00
ISSOtm 23272f028f Update the best proto-pal relative size when a new best is found
*facepalm*
2024-08-23 13:35:48 +02:00
Sylvie 356367bfd3 Allow mirroring only the X or Y axes (#1468) 2024-08-18 21:47:39 -04:00
ISSOtm 68a6abd00e Fix ProtoPalette::compare
The function only stopped at the end of the *arrays*,
not of *their used portions*!
This could cause false negatives one way or the other.

This appears not to affect the palette packing, since the packing algorithm
deals with them efficiently; but it should speed up processing slightly,
and as the test changes show, it also improves the UX of palette packing
error messages!
2024-08-14 17:36:15 +02:00
Sylvie a3f9952b9e Advise on how to use -x to make -r work (#1459) 2024-08-08 19:50:51 +02:00
Sylvie 0cd79c33ef Fix RGBGFX reversal (#1425)
* Print all OoB tilemap IDs before aborting

* Rename `nbTileInstances` to `mapSize`

* Check that reversing doesn't overflow the tile array

---------

Co-authored-by: ISSOtm <me@eldred.fr>
2024-08-08 19:40:41 +02:00
ISSOtm 6b09838739 Sort proto-palettes by decreasing size when refitting overloaded palettes
Since that refitting process is a First-Fit, it benefits from that sorting step.
2024-08-08 12:12:29 +02:00
ISSOtm 0f1137c6ec Fix ineffective sorting of palettes pre-packing
We were sorting the *IDs*, not the proto-palettes...
2024-08-08 11:31:46 +02:00
Sylvie f304e1dd7f Implement state file output for RGBASM (#1435) 2024-08-05 12:41:40 -04:00
Sylvie d4231f9efa Remove redundant "unknown option" error messages (#1441)
`getopt` already prints "unrecognized option"
2024-08-05 16:04:53 +02:00
Sylvie 8af9e9d465 Add rgbgfx -r 0 to infer a width (#1437) 2024-08-04 20:31:05 +02:00
ISSOtm 98bca79df4 Run clang-format 2024-08-02 22:36:33 -04:00
ISSOtm dae4219acd With -r, print both palettes if -c and -p mismatch 2024-08-02 22:36:33 -04:00
ISSOtm 3d1f5386c2 Fix parsing of GPL files
Can you tell this was *not* tested whatsoever?
2024-08-02 22:36:33 -04:00
ISSOtm 1f8f28cac8 Fix parsing of textual colours
`n`'s input value was not honored, and its updating logic incorrect
2024-08-02 22:36:33 -04:00
ISSOtm 8e60d1f0b8 Fix textual palettes not accepting to be filled
A weird case of off-by-one error
2024-08-02 22:36:33 -04:00
ISSOtm d8aceaea4a Ignore empty lines in HEX files
They are free-form enough that empty lines should probably be supported.
2024-08-02 22:36:33 -04:00
ISSOtm a23b4732e3 Distinguish EOF and empty lines when parsing text pal files 2024-08-02 22:36:33 -04:00
ISSOtm 41046c287f Use appropriate format specifier for number of palettes 2024-08-02 21:59:51 +02:00
Sylvie 6a65cbc9ed Some refactoring and reformatting (#1431) 2024-07-26 11:51:27 -04:00
Eldred Habert 1d89d75381 Fix use-after-free when keeping pointers to args from at-files (#1426) 2024-07-25 23:00:48 +02:00
Sylvie ed5529d639 Fix generating a palette overriding a previous pal spec (#1415) 2024-06-25 18:27:01 +02:00
Sylvie 82f60e26c4 Fix reading ACO palette files (#1404) 2024-06-13 12:21:19 -04:00
Chris Pickel 7aecc00919 Fix rectangular rgbgfx --reverse --columns (#1392)
When width != height, the math was off, causing some tiles to be
repeated or skipped.
2024-04-20 18:20:16 +02:00
Sylvie a234da42a6 Replace assert with assume for release build optimization (#1390) 2024-04-02 11:09:31 -04:00
Rangi42 4a4656af1b Remove the deprecated RGBGFX --output-* options (use --auto-*) 2024-03-28 17:26:42 -04:00
Rangi42 cf7bdb19b6 Run clang-format 14 on everything
Later versions may need some proprties added or changed to not
format closing braces weirdly.
2024-03-28 09:17:27 -04:00