diff --git a/src/gfx/main.cpp b/src/gfx/main.cpp index 96c2405af..438ad8eff 100644 --- a/src/gfx/main.cpp +++ b/src/gfx/main.cpp @@ -108,7 +108,7 @@ void Options::verbosePrint(uint8_t level, char const *fmt, ...) const { } // Short options -static char const *optstring = "-Aa:b:Cc:Dd:Ffhi:L:mN:n:Oo:Pp:Qq:r:s:Tt:U:uVvx:Z"; +static char const *optstring = "-Aa:b:Cc:d:i:L:mN:n:Oo:Pp:Qq:r:s:Tt:U:uVvXx:YZ"; /* * Equivalent long options @@ -139,6 +139,7 @@ static option const longopts[] = { {"auto-palette-map", no_argument, nullptr, 'Q'}, {"palette-map", required_argument, nullptr, 'q'}, {"reverse", required_argument, nullptr, 'r'}, + {"palette-size", required_argument, nullptr, 's'}, {"auto-tilemap", no_argument, nullptr, 'T'}, {"tilemap", required_argument, nullptr, 't'}, {"unit-size", required_argument, nullptr, 'U'}, diff --git a/test/gfx/empty_lines.hex b/test/gfx/empty_lines.hex index 29d4022e5..946ab11c7 100644 --- a/test/gfx/empty_lines.hex +++ b/test/gfx/empty_lines.hex @@ -1,7 +1,7 @@ 5721d9 -a9d4fe +A9D4FE -ffffff +ffFFfF diff --git a/test/gfx/full_aco.aco b/test/gfx/full_aco.aco new file mode 100644 index 000000000..c01be6f3c Binary files /dev/null and b/test/gfx/full_aco.aco differ diff --git a/test/gfx/full_aco.flags b/test/gfx/full_aco.flags new file mode 100644 index 000000000..a9f5c93ee --- /dev/null +++ b/test/gfx/full_aco.flags @@ -0,0 +1 @@ +-c aco:full_aco.aco diff --git a/test/gfx/full_aco.out.2bpp b/test/gfx/full_aco.out.2bpp new file mode 100644 index 000000000..f96101918 Binary files /dev/null and b/test/gfx/full_aco.out.2bpp differ diff --git a/test/gfx/full_aco.out.attrmap b/test/gfx/full_aco.out.attrmap new file mode 100644 index 000000000..cb1ce59c0 Binary files /dev/null and b/test/gfx/full_aco.out.attrmap differ diff --git a/test/gfx/full_aco.out.pal b/test/gfx/full_aco.out.pal new file mode 100644 index 000000000..820ff240b Binary files /dev/null and b/test/gfx/full_aco.out.pal differ diff --git a/test/gfx/full_aco.out.tilemap b/test/gfx/full_aco.out.tilemap new file mode 100644 index 000000000..6cf04740a Binary files /dev/null and b/test/gfx/full_aco.out.tilemap differ diff --git a/test/gfx/full_aco.png b/test/gfx/full_aco.png new file mode 100644 index 000000000..de5a5849a Binary files /dev/null and b/test/gfx/full_aco.png differ diff --git a/test/gfx/full_act.act b/test/gfx/full_act.act new file mode 100644 index 000000000..f5d08a978 Binary files /dev/null and b/test/gfx/full_act.act differ diff --git a/test/gfx/full_act.flags b/test/gfx/full_act.flags new file mode 100644 index 000000000..bf8db89e3 --- /dev/null +++ b/test/gfx/full_act.flags @@ -0,0 +1 @@ +-c act:full_act.act diff --git a/test/gfx/full_act.out.2bpp b/test/gfx/full_act.out.2bpp new file mode 100644 index 000000000..f96101918 Binary files /dev/null and b/test/gfx/full_act.out.2bpp differ diff --git a/test/gfx/full_act.out.attrmap b/test/gfx/full_act.out.attrmap new file mode 100644 index 000000000..cb1ce59c0 Binary files /dev/null and b/test/gfx/full_act.out.attrmap differ diff --git a/test/gfx/full_act.out.pal b/test/gfx/full_act.out.pal new file mode 100644 index 000000000..820ff240b Binary files /dev/null and b/test/gfx/full_act.out.pal differ diff --git a/test/gfx/full_act.out.tilemap b/test/gfx/full_act.out.tilemap new file mode 100644 index 000000000..6cf04740a Binary files /dev/null and b/test/gfx/full_act.out.tilemap differ diff --git a/test/gfx/full_act.png b/test/gfx/full_act.png new file mode 100644 index 000000000..de5a5849a Binary files /dev/null and b/test/gfx/full_act.png differ diff --git a/test/gfx/full_gbc.flags b/test/gfx/full_gbc.flags new file mode 100644 index 000000000..85557aa44 --- /dev/null +++ b/test/gfx/full_gbc.flags @@ -0,0 +1 @@ +-c gbc:full_gbc.pal diff --git a/test/gfx/full_gbc.out.2bpp b/test/gfx/full_gbc.out.2bpp new file mode 100644 index 000000000..f96101918 Binary files /dev/null and b/test/gfx/full_gbc.out.2bpp differ diff --git a/test/gfx/full_gbc.out.attrmap b/test/gfx/full_gbc.out.attrmap new file mode 100644 index 000000000..cb1ce59c0 Binary files /dev/null and b/test/gfx/full_gbc.out.attrmap differ diff --git a/test/gfx/full_gbc.out.pal b/test/gfx/full_gbc.out.pal new file mode 100644 index 000000000..820ff240b Binary files /dev/null and b/test/gfx/full_gbc.out.pal differ diff --git a/test/gfx/full_gbc.out.tilemap b/test/gfx/full_gbc.out.tilemap new file mode 100644 index 000000000..6cf04740a Binary files /dev/null and b/test/gfx/full_gbc.out.tilemap differ diff --git a/test/gfx/full_gbc.pal b/test/gfx/full_gbc.pal new file mode 100644 index 000000000..820ff240b Binary files /dev/null and b/test/gfx/full_gbc.pal differ diff --git a/test/gfx/full_gbc.png b/test/gfx/full_gbc.png new file mode 100644 index 000000000..de5a5849a Binary files /dev/null and b/test/gfx/full_gbc.png differ diff --git a/test/gfx/full_psp.flags b/test/gfx/full_psp.flags new file mode 100644 index 000000000..e390a3a44 --- /dev/null +++ b/test/gfx/full_psp.flags @@ -0,0 +1 @@ +-c psp:full_psp.pal diff --git a/test/gfx/full_psp.out.2bpp b/test/gfx/full_psp.out.2bpp new file mode 100644 index 000000000..f96101918 Binary files /dev/null and b/test/gfx/full_psp.out.2bpp differ diff --git a/test/gfx/full_psp.out.attrmap b/test/gfx/full_psp.out.attrmap new file mode 100644 index 000000000..cb1ce59c0 Binary files /dev/null and b/test/gfx/full_psp.out.attrmap differ diff --git a/test/gfx/full_psp.out.pal b/test/gfx/full_psp.out.pal new file mode 100644 index 000000000..820ff240b Binary files /dev/null and b/test/gfx/full_psp.out.pal differ diff --git a/test/gfx/full_psp.out.tilemap b/test/gfx/full_psp.out.tilemap new file mode 100644 index 000000000..6cf04740a Binary files /dev/null and b/test/gfx/full_psp.out.tilemap differ diff --git a/test/gfx/full_psp.pal b/test/gfx/full_psp.pal new file mode 100644 index 000000000..e38186f07 --- /dev/null +++ b/test/gfx/full_psp.pal @@ -0,0 +1,35 @@ +JASC-PAL +0100 +32 +0 0 0 +252 252 252 +196 199 238 +154 143 224 +99 93 150 +41 47 101 +27 29 52 +255 227 174 +205 187 171 +166 133 143 +207 93 139 +150 73 104 +255 180 130 +221 134 125 +178 105 111 +246 198 94 +228 144 87 +196 104 51 +176 208 126 +102 170 93 +82 181 171 +42 131 121 +28 86 89 +123 225 246 +88 159 252 +80 105 228 +46 68 174 +128 86 212 +90 59 150 +255 186 225 +230 135 197 +167 89 185 diff --git a/test/gfx/full_psp.png b/test/gfx/full_psp.png new file mode 100644 index 000000000..de5a5849a Binary files /dev/null and b/test/gfx/full_psp.png differ diff --git a/test/gfx/mirror_x.flags b/test/gfx/mirror_x.flags new file mode 100644 index 000000000..653774072 --- /dev/null +++ b/test/gfx/mirror_x.flags @@ -0,0 +1 @@ +-X diff --git a/test/gfx/mirror_x.out.2bpp b/test/gfx/mirror_x.out.2bpp new file mode 100644 index 000000000..b8b665313 --- /dev/null +++ b/test/gfx/mirror_x.out.2bpp @@ -0,0 +1 @@ +˙˙ńńńńńńńńńńńń˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ńńńńńń˙˙˙˙˙˙˙˙ńńńńńń˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ \ No newline at end of file diff --git a/test/gfx/mirror_x.out.attrmap b/test/gfx/mirror_x.out.attrmap new file mode 100644 index 000000000..6469acef8 Binary files /dev/null and b/test/gfx/mirror_x.out.attrmap differ diff --git a/test/gfx/mirror_x.out.tilemap b/test/gfx/mirror_x.out.tilemap new file mode 100644 index 000000000..57f7fba3c Binary files /dev/null and b/test/gfx/mirror_x.out.tilemap differ diff --git a/test/gfx/mirror_x.png b/test/gfx/mirror_x.png new file mode 100644 index 000000000..36ffd6034 Binary files /dev/null and b/test/gfx/mirror_x.png differ diff --git a/test/gfx/mirror_xy.flags b/test/gfx/mirror_xy.flags new file mode 100644 index 000000000..1012adfe6 --- /dev/null +++ b/test/gfx/mirror_xy.flags @@ -0,0 +1 @@ +-XY diff --git a/test/gfx/mirror_xy.out.2bpp b/test/gfx/mirror_xy.out.2bpp new file mode 100644 index 000000000..4248f2114 --- /dev/null +++ b/test/gfx/mirror_xy.out.2bpp @@ -0,0 +1 @@ +˙˙ńńńńńńńńńńńń˙˙˙˙˙˙˙˙˙˙˙˙˙˙ńńńńńń˙˙˙˙ńńńńńń˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ \ No newline at end of file diff --git a/test/gfx/mirror_xy.out.attrmap b/test/gfx/mirror_xy.out.attrmap new file mode 100644 index 000000000..c1fcbd64f Binary files /dev/null and b/test/gfx/mirror_xy.out.attrmap differ diff --git a/test/gfx/mirror_xy.out.tilemap b/test/gfx/mirror_xy.out.tilemap new file mode 100644 index 000000000..16b4b4bf9 Binary files /dev/null and b/test/gfx/mirror_xy.out.tilemap differ diff --git a/test/gfx/mirror_xy.png b/test/gfx/mirror_xy.png new file mode 100644 index 000000000..36ffd6034 Binary files /dev/null and b/test/gfx/mirror_xy.png differ diff --git a/test/gfx/mirror_y.flags b/test/gfx/mirror_y.flags new file mode 100644 index 000000000..b18b986b0 --- /dev/null +++ b/test/gfx/mirror_y.flags @@ -0,0 +1 @@ +-Y diff --git a/test/gfx/mirror_y.out.2bpp b/test/gfx/mirror_y.out.2bpp new file mode 100644 index 000000000..8993ce19d --- /dev/null +++ b/test/gfx/mirror_y.out.2bpp @@ -0,0 +1 @@ +˙˙ńńńńńńńńńńńń˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ńńńńńń˙˙˙˙˙˙˙˙ńńńńńń˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ \ No newline at end of file diff --git a/test/gfx/mirror_y.out.attrmap b/test/gfx/mirror_y.out.attrmap new file mode 100644 index 000000000..4802e0533 Binary files /dev/null and b/test/gfx/mirror_y.out.attrmap differ diff --git a/test/gfx/mirror_y.out.tilemap b/test/gfx/mirror_y.out.tilemap new file mode 100644 index 000000000..f297387fd Binary files /dev/null and b/test/gfx/mirror_y.out.tilemap differ diff --git a/test/gfx/mirror_y.png b/test/gfx/mirror_y.png new file mode 100644 index 000000000..36ffd6034 Binary files /dev/null and b/test/gfx/mirror_y.png differ diff --git a/test/gfx/reverse_curve.2bpp b/test/gfx/reverse_curve.2bpp new file mode 100644 index 000000000..d8eb117df --- /dev/null +++ b/test/gfx/reverse_curve.2bpp @@ -0,0 +1 @@ +? @Lóˆóˆ˙€˙€˙€˙‰~G|C<# \ No newline at end of file diff --git a/test/gfx/reverse_curve.attrmap b/test/gfx/reverse_curve.attrmap new file mode 100644 index 000000000..61516adee Binary files /dev/null and b/test/gfx/reverse_curve.attrmap differ diff --git a/test/gfx/reverse_curve.flags b/test/gfx/reverse_curve.flags new file mode 100644 index 000000000..6f3e38c19 --- /dev/null +++ b/test/gfx/reverse_curve.flags @@ -0,0 +1,4 @@ +-m +-t reverse_curve.tilemap +-a reverse_curve.attrmap +-p reverse_curve.pal diff --git a/test/gfx/reverse_curve.pal b/test/gfx/reverse_curve.pal new file mode 100644 index 000000000..9f2400f84 Binary files /dev/null and b/test/gfx/reverse_curve.pal differ diff --git a/test/gfx/reverse_curve.tilemap b/test/gfx/reverse_curve.tilemap new file mode 100644 index 000000000..dee9c4c8a Binary files /dev/null and b/test/gfx/reverse_curve.tilemap differ diff --git a/test/gfx/test.sh b/test/gfx/test.sh index 8de743188..3b54f0343 100755 --- a/test/gfx/test.sh +++ b/test/gfx/test.sh @@ -37,11 +37,19 @@ failTest () { echo "${bold}${red}Test ${cmdline} failed!${1:+ (RC=$1)}${rescolors}${resbold}" } +tryCmp () { + if ! cmp "$1" "$2"; then + ../../contrib/gbdiff.bash "$1" "$2" + echo "${bold}${red}$1 mismatch!${rescolors}${resbold}" + false + fi +} + checkOutput () { out_rc=0 for ext in 1bpp 2bpp pal tilemap attrmap palmap; do if [[ -e "$1.out.$ext" ]]; then - cmp "$1.out.$ext" "result.$ext" + tryCmp "$1.out.$ext" "result.$ext" (( out_rc = out_rc || $? )) fi done @@ -95,10 +103,10 @@ for f in *.[12]bpp; do continue fi - flags="$([[ -e "${f%.[12]bpp}.flags" ]] && echo "@${f%.[12]bpp}.flags")" + flags="$([[ -e "${f%.[12]bpp}.flags" ]] && echo "@${f%.[12]bpp}.flags") $([[ -e "${f%.1bpp}.flags" ]] && echo "-d 1")" newTest "$RGBGFX $flags -o $f -r 1 result.png && $RGBGFX $flags -o result.2bpp result.png" - runTest && cmp "$f" result.2bpp || failTest $? + runTest && tryCmp "$f" result.2bpp || failTest $? done if [[ "$failed" -eq 0 ]]; then