Rewrite RGBFIX

- Make it work inside pipelines
- Add RGBFIX tests to the suite
- Be more flexible in accepted MBC names
- Add warnings for dangerous or nonsensical input params
- Improve man page
This commit is contained in:
ISSOtm
2020-12-26 01:53:16 +01:00
committed by Eldred Habert
parent f28b4abafc
commit 41d544a4eb
215 changed files with 1450 additions and 541 deletions

1
test/fix/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/padding*_*

16
test/fix/README.md Normal file
View File

@@ -0,0 +1,16 @@
# RGBFIX tests
These tests check that RGBFIX behaves properly.
## Structure of a test
- `test.bin`: The file passed as input to RGBFIX.
- `test.flags`: The command-line flags passed to RGBFIX's invocation.
Actually, only the first line is considered; the rest of the file may contain comments about the test.
- `test.gb`: The expected output.
May not exist, generally when the test expects an error, in which case the comparison is skipped.
- `test.err`: The expected error output.
## Special tests
- `noexist.err` is the expected error output when RGBFIX is given a non-existent input file.

View File

@@ -0,0 +1,3 @@
‡Ýà!H0‡;<ýNË—ñãí=ÌÊÏç^{ KC}b“Q¤&<14>3ð ñ/]¿—¹”d<E2809D>ÙZ=ÃÀ¢bÄaËi:öeSŸ>ñU@¼Ay<aeš‰¹$vfÅå­ˆ┚ý¬gŒ VC†ò~>•‘¨þ©† ³s_ Úç&nWFoKÚšíX`'ñêÁ§ë·blƒ{‡›Œ¿
¯­çÎ8îù†<$:VÍ"ã³™Ú<E284A2>h™ÑD©¤Ð¶ñ­QcµïØÐ㸺Zû§T†ž©ø½¨ºVۼݪÏ4ªÐd T“« ÄI<1A>
Ô(/×»ç¿{hÝ:ƒ<>QmÓ$*|

View File

@@ -0,0 +1,3 @@
warning: Ignoring 'm' in fix spec
warning: Ignoring 'a' in fix spec
warning: Ignoring 'o' in fix spec

View File

@@ -0,0 +1 @@
-f lmao

2
test/fix/color.bin Normal file
View File

@@ -0,0 +1,2 @@
╧ы+2l}~Ч╨я╕├Ж}╧Я1xЙаШЩ&)Y├q*▀ОТ═и▓┌г^ H─p@v6}Юг[┬╙&оЧ┘hё▒лBn~пT┘0Ьнuf┬\╗8╫≥÷жуЗВЖц▒ЬW╫╬Ф╥ 5^Bq<░K╫"S%╤ВU!▓╦r,7Нg┘4х╗┴▌╔╖╜А░ЗhL╟жь²У)√÷┘У6U@Ёв█`щ▒TзT├ М╕·Dи╕▓8zс5╡·~AбИ╠╫э°Щ|
>Т]Е/╧K╠▄Ыd~ис"gF* AU╩"W▌7]}≈ы/Ц}<▀─s[lx■э■}п╚[МлО█≥╛А═

0
test/fix/color.err Normal file
View File

1
test/fix/color.flags Normal file
View File

@@ -0,0 +1 @@
-C

2
test/fix/color.gb Normal file
View File

@@ -0,0 +1,2 @@
╧ы+2l}~Ч╨я╕├Ж}╧Я1xЙаШЩ&)Y├q*▀ОТ═и▓┌г^ H─p@v6}Юг[┬╙&оЧ┘hё▒лBn~пT┘0Ьнuf┬\╗8╫≥÷жуЗВЖц▒ЬW╫╬Ф╥ 5^Bq<░K╫"S%╤ВU!▓╦r,7Нg┘4х╗┴▌╔╖╜А░ЗhL╟жь²У)√÷┘У6U@Ёв█`щ▒TзT├ М╕·Dи╕▓8zс5╡·~AбИ╠╫э°Щ|
>Т]Е/╧K╠▄Ыd~ис"gF* AU╩"W▌7]}≈ы/Ц}<▀─s[lx■э■}п╚[МлО█≥╛А═

BIN
test/fix/compatible.bin Normal file

Binary file not shown.

0
test/fix/compatible.err Normal file
View File

View File

@@ -0,0 +1 @@
-c

BIN
test/fix/compatible.gb Normal file

Binary file not shown.

0
test/fix/empty.bin Normal file
View File

2
test/fix/empty.err Normal file
View File

@@ -0,0 +1,2 @@
FATAL: "<filename>" too short, expected at least 336 ($150) bytes, got only 0
Fixing "<filename>" failed with 1 error

0
test/fix/empty.flags Normal file
View File

0
test/fix/empty.gb Normal file
View File

BIN
test/fix/fix-override.bin Normal file

Binary file not shown.

View File

@@ -0,0 +1 @@
warning: 'l' overriding 'L' in fix spec

View File

@@ -0,0 +1 @@
-f Ll

BIN
test/fix/fix-override.gb Normal file

Binary file not shown.

BIN
test/fix/gameid-trunc.bin Normal file

Binary file not shown.

View File

@@ -0,0 +1 @@
warning: Truncating game ID "FOUR!" to 4 chars

View File

@@ -0,0 +1 @@
-i 'FOUR!'

BIN
test/fix/gameid-trunc.gb Normal file

Binary file not shown.

BIN
test/fix/gameid.bin Normal file

Binary file not shown.

0
test/fix/gameid.err Normal file
View File

1
test/fix/gameid.flags Normal file
View File

@@ -0,0 +1 @@
-i RGBD

BIN
test/fix/gameid.gb Normal file

Binary file not shown.

BIN
test/fix/global-large.bin Normal file

Binary file not shown.

View File

View File

@@ -0,0 +1 @@
-fg

BIN
test/fix/global-large.gb Normal file

Binary file not shown.

BIN
test/fix/global-larger.bin Normal file

Binary file not shown.

View File

View File

@@ -0,0 +1 @@
-fg

BIN
test/fix/global-larger.gb Normal file

Binary file not shown.

BIN
test/fix/global-trash.bin Normal file

Binary file not shown.

View File

View File

@@ -0,0 +1 @@
-f G

BIN
test/fix/global-trash.gb Normal file

Binary file not shown.

BIN
test/fix/global.bin Normal file

Binary file not shown.

0
test/fix/global.err Normal file
View File

1
test/fix/global.flags Normal file
View File

@@ -0,0 +1 @@
-f g

BIN
test/fix/global.gb Normal file

Binary file not shown.

BIN
test/fix/header-edit.bin Normal file

Binary file not shown.

0
test/fix/header-edit.err Normal file
View File

View File

@@ -0,0 +1,2 @@
-Cf h
Checks that the header checksum properly accounts for header modifications

BIN
test/fix/header-edit.gb Normal file

Binary file not shown.

BIN
test/fix/header-trash.bin Normal file

Binary file not shown.

View File

View File

@@ -0,0 +1 @@
-f H

BIN
test/fix/header-trash.gb Normal file

Binary file not shown.

BIN
test/fix/header.bin Normal file

Binary file not shown.

0
test/fix/header.err Normal file
View File

1
test/fix/header.flags Normal file
View File

@@ -0,0 +1 @@
-f h

BIN
test/fix/header.gb Normal file

Binary file not shown.

BIN
test/fix/jp.bin Normal file

Binary file not shown.

0
test/fix/jp.err Normal file
View File

1
test/fix/jp.flags Normal file
View File

@@ -0,0 +1 @@
-j

BIN
test/fix/jp.gb Normal file

Binary file not shown.

BIN
test/fix/logo-trash.bin Normal file

Binary file not shown.

0
test/fix/logo-trash.err Normal file
View File

View File

@@ -0,0 +1 @@
-f L

BIN
test/fix/logo-trash.gb Normal file

Binary file not shown.

BIN
test/fix/logo.bin Normal file

Binary file not shown.

0
test/fix/logo.err Normal file
View File

1
test/fix/logo.flags Normal file
View File

@@ -0,0 +1 @@
-f l

BIN
test/fix/logo.gb Normal file

Binary file not shown.

BIN
test/fix/mbc.bin Normal file

Binary file not shown.

0
test/fix/mbc.err Normal file
View File

1
test/fix/mbc.flags Normal file
View File

@@ -0,0 +1 @@
-m 177

BIN
test/fix/mbc.gb Normal file

Binary file not shown.

BIN
test/fix/mbcless-ram.bin Normal file

Binary file not shown.

1
test/fix/mbcless-ram.err Normal file
View File

@@ -0,0 +1 @@
warning: MBC "ROM" has no RAM, but RAM size was set to 2

View File

@@ -0,0 +1 @@
-m ROM -r 2

BIN
test/fix/mbcless-ram.gb Normal file

Binary file not shown.

View File

@@ -0,0 +1,3 @@
ÁÓi& š˙ĹyŕĺSĐěäŇaJ¨ň‘'ZDÉyşč§1nź
¬íŮ9µQńHĽpçąyFź”»ŃŐß<C590>ĐÖ8^ŞŠ]Ŕbł˘ F‰§mĹ“š
ױьM‡FíîWóŐwţk÷°± O`ŘÚíčUě0ńär©íşĆΙܥâ±7"®”"fęŕ<C499>ďfw<58>:Đ޸ň˝XpéVËÄŞ\-¶`xť˛ř*NđŐy†a4ÄJĹç´ÄëˇăÜŠĽp—„ľ.7öc+ÝQ<C39D>řŐŽ·B÷He<48>§1ĘO<n_&KHhŁ´vŽűx榢Y˘—ČAŮÇćĚ;Cęożlý  ®Ą®żĚ’ýÜ©!ěľ<>`@¸:‡z‰v‰˝ädéŁZÓ"±a*m*.:?¤ŁďżĎYËc3”Č >#`çí\_Úw<C39A>™Ď

View File

@@ -0,0 +1 @@
warning: Truncating new licensee "HOMEBREW" to 2 chars

View File

@@ -0,0 +1 @@
-k HOMEBREW

View File

@@ -0,0 +1,3 @@
ÁÓi& šÿÅyàåSÐìäÒaJ¨ò‘'ZDÉyºè§1nŸ
¬íÙ9µQñH¼pç¹yFŸ”»ÑÕߘÐÖ8^ªŠ]Àb³¢ F‰§mÅ“š
ױьM‡FíîWóÕwþk÷°± O`ØÚíèUì0ñär©íºÆÎ™Ü¥â±7"®”"fêàˆïfw<58>:ÐÞ¸ò½XpéVËĪ\-¶`x<>²ø*NðÕy†a4ÄJÅç´Äë¡ãÜŠ¼p—„¾.7öc+ÝQ<C39D>øÕŽ·B÷He<48>§1ÊO<n_&KHh£´vŽûx榢Y¢—ÈAÙÇæÌ;Cêo¿lý  ®¥®¿Ì’ýÜ©!ì¾<>`@¸:‡z‰v‰½ädé£ZÓ"±a*m*.:?¤£ï¿ÏYHOc3”È >#`çí\_Úw<C39A>™Ï

3
test/fix/new-lic.bin Normal file
View File

@@ -0,0 +1,3 @@
ÁÓi& š˙ĹyŕĺSĐěäŇaJ¨ň‘'ZDÉyşč§1nź
¬íŮ9µQńHĽpçąyFź”»ŃŐß<C590>ĐÖ8^ŞŠ]Ŕbł˘ F‰§mĹ“š
ױьM‡FíîWóŐwţk÷°± O`ŘÚíčUě0ńär©íşĆΙܥâ±7"®”"fęŕ<C499>ďfw<58>:Đ޸ň˝XpéVËÄŞ\-¶`xť˛ř*NđŐy†a4ÄJĹç´ÄëˇăÜŠĽp—„ľ.7öc+ÝQ<C39D>řŐŽ·B÷He<48>§1ĘO<n_&KHhŁ´vŽűx榢Y˘—ČAŮÇćĚ;Cęożlý  ®Ą®żĚ’ýÜ©!ěľ<>`@¸:‡z‰v‰˝ädéŁZÓ"±a*m*.:?¤ŁďżĎYËc3”Č >#`çí\_Úw<C39A>™Ď

0
test/fix/new-lic.err Normal file
View File

1
test/fix/new-lic.flags Normal file
View File

@@ -0,0 +1 @@
-k HB

3
test/fix/new-lic.gb Normal file
View File

@@ -0,0 +1,3 @@
ÁÓi& š˙ĹyŕĺSĐěäŇaJ¨ň‘'ZDÉyşč§1nź
¬íŮ9µQńHĽpçąyFź”»ŃŐß<C590>ĐÖ8^ŞŠ]Ŕbł˘ F‰§mĹ“š
ױьM‡FíîWóŐwţk÷°± O`ŘÚíčUě0ńär©íşĆΙܥâ±7"®”"fęŕ<C499>ďfw<58>:Đ޸ň˝XpéVËÄŞ\-¶`xť˛ř*NđŐy†a4ÄJĹç´ÄëˇăÜŠĽp—„ľ.7öc+ÝQ<C39D>řŐŽ·B÷He<48>§1ĘO<n_&KHhŁ´vŽűx榢Y˘—ČAŮÇćĚ;Cęożlý  ®Ą®żĚ’ýÜ©!ěľ<>`@¸:‡z‰v‰˝ädéŁZÓ"±a*m*.:?¤ŁďżĎYHBc3”Č >#`çí\_Úw<C39A>™Ď

2
test/fix/noexist.err Normal file
View File

@@ -0,0 +1,2 @@
FATAL: Failed to open "noexist" for reading+writing: No such file or directory
Fixing "noexist" failed with 1 error

BIN
test/fix/old-lic-hex.bin Normal file

Binary file not shown.

0
test/fix/old-lic-hex.err Normal file
View File

View File

@@ -0,0 +1 @@
-l 0x2a

BIN
test/fix/old-lic-hex.gb Normal file

Binary file not shown.

2
test/fix/old-lic.bin Normal file
View File

@@ -0,0 +1,2 @@
EZ/:ÂÔΠøÐ€šÜJ/ŒÝõÊ_<ð&ÑA­¢Ž˜ÃXgAP
`°1@Wh<>õ||ø»e뻬e^"7(*YV<59>ÍTõœOY!Þâ Ì”]ˆðÈyV~xæaÛ]á;Ÿúý¡ÀzUm òüz:d@ÖªØb¸ 'vʆqËWŒÚ_ÂæºÓì2)G<05>v(k¨ª”g,<2C>p*@ùÚ!¶Dõ„0kãÿ§á<C2A7>eË%ÇšodÛñÎ$r‰ÚÊ <è:”æcgiŒ"aF'=f䳚ºEcVcL.03"w),æ HQiDŸfÝ3<C39D>s(-$?a0ó@†¦.O¡B{yÍz‰Ê«½ hØ/\ šSŠ]óoúåm'2D#/grÕW3¸Χ<C38E>°&UÓÌ÷EgMhÚ-A¾6ƒ…²ÿ…4M|1âq0Oì­*$²Où/n²ú•gžš2R»æQˆXú_½¬“[숔ÔpÒÚ\°)ƧTS±T”aP*'[ïx÷Ò>ß…¤Ub[Ô¦ã9sÎçI‰ÊP

0
test/fix/old-lic.err Normal file
View File

1
test/fix/old-lic.flags Normal file
View File

@@ -0,0 +1 @@
-l 42

2
test/fix/old-lic.gb Normal file
View File

@@ -0,0 +1,2 @@
EZ/:ÂÔΠøÐ€šÜJ/ŒÝõÊ_<ð&ÑA­¢Ž˜ÃXgAP
`°1@Wh<>õ||ø»e뻬e^"7(*YV<59>ÍTõœOY!Þâ Ì”]ˆðÈyV~xæaÛ]á;Ÿúý¡ÀzUm òüz:d@ÖªØb¸ 'vʆqËWŒÚ_ÂæºÓì2)G<05>v(k¨ª”g,<2C>p*@ùÚ!¶Dõ„0kãÿ§á<C2A7>eË%ÇšodÛñÎ$r‰ÚÊ <è:”æcgiŒ"aF'=f䳚ºEcVcL.03"w),æ HQiDŸfÝ3<C39D>s(-$?a0ó@†¦.O¡B{yÍz‰Ê«½ hØ/\ šSŠ]óoúåm'2D#/grÕW3¸Χ<C38E>°&UÓÌ÷EgMhÚ-A¾*6ƒ…²ÿ…4M|1âq0Oì­*$²Où/n²ú•gžš2R»æQˆXú_½¬“[숔ÔpÒÚ\°)ƧTS±T”aP*'[ïx÷Ò>ß…¤Ub[Ô¦ã9sÎçI‰ÊP

Binary file not shown.

View File

View File

@@ -0,0 +1 @@
-p0xff

Binary file not shown.

Binary file not shown.

View File

Some files were not shown because too many files have changed in this diff Show More