Commit Graph

90 Commits

Author SHA1 Message Date
ISSOtm
60019cf476 Fix a bunch of Clang warnings
As reported by #789
Should avoid relying on 32-bit int (for implicit conversions)
and account for more extreme uses of RGBDS.
2021-03-10 10:56:57 +01:00
Rangi
464a3a4892 Separate extern getopt implementation from the unistd.h one
Fixes #710
2021-02-12 00:29:21 +01:00
ISSOtm
41d544a4eb 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
2021-01-20 21:22:55 +01:00
Rangi
e6552064bf Specify rgbfix --mbc-type by name
This supports the names listed in Pan Docs:
https://gbdev.io/pandocs/#_0147-cartridge-type
Spaces may be replaced with underscores.

It also supports "ROM" for "ROM ONLY".
2020-12-12 01:53:42 +01:00
ISSOtm
d22a667095 Update help text to redirect to new online docs 2020-09-17 03:10:02 +02:00
James Larrowe
e51701acaa Add platform-specific fixes file
Create a new file, platform.h, for platform-specific hacks

for MSVC, this includes defining strncasecmp to _stricmp and
strdup to _strdup, among other things like defining missing
stat macros

Change some things not supported in MSVC, like _Static_assert,
to their counterparts (in this case, static_assert)

Replace usage of VLAs with malloc and free

Update getopt_long and use the getopt implementation from musl
on Windows.

Use comments to show which functions from platform.h are being used
2020-07-21 14:24:22 -04:00
Eldred Habert
4dfa3157e5 Merge pull request #454 from ISSOtm/unlocked_windows
Fix mingw build
2020-01-08 13:14:13 +01:00
ISSOtm
b81faeccfa Rename rgbfix long opt verbose to validate
The previous name was probably copy-pasted, it was completely wrong
2019-12-29 17:41:19 +01:00
ISSOtm
6959b76749 Rework help/usage messages
Trimmed down the option lists as per @bentley's request;
Reinstated the man pages' synopsis
2019-12-29 17:38:08 +01:00
ISSOtm
34618e0294 Overhaul RGBDS man pages and help messages 2019-12-12 23:22:51 +01:00
ISSOtm
d93ad2e650 Rename all functions imported from musl
This is to avoid conflicting with libraries, which occurred in the mingw builds
2019-11-23 23:08:44 +01:00
ISSOtm
0649e6d65f Add long options 2019-11-06 00:48:41 +01:00
Marcus Huderle
b2c1f6122e Properly set all 16 characters in ROM header title 2019-05-18 19:43:54 -05:00
Ben10do
11c47570ce Fix the global checksum calculation in rgbfix
A regression was spotted in rgbfix 0.3.7, where we would accidentally include the first byte of the existing checksum when calculating a global checksum. We now correctly ignore both of the existing checksum bytes.

This was spotted when running rgbfix on the Pokémon Gold/Silver betas, as they have a non-zero global checksum.

Fixes #280.

Signed-off-by: Ben10do <Ben10do@users.noreply.github.com>
2018-06-03 10:11:55 +01:00
Antonio Niño Díaz
630933b148 rgbfix: Fix checkpatch issues
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2018-04-22 21:02:08 +01:00
Antonio Niño Díaz
efae6c7fd2 Merge pull request #264 from inmemrgbfix
Rewrite rgbfix to perform most actions in memory.

Limit file operations to a small number that can be reasonably checked,
and do the majority of the actual work on a buffered header in memory
where operations won't fail.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2018-04-22 20:03:32 +01:00
Anthony J. Bentley
8a559beeb8 Rewrite rgbfix to perform most actions in memory.
Limit file operations to a small number that can be reasonably checked,
and do the majority of the actual work on a buffered header in memory
where operations won't fail.
2018-04-05 00:41:09 -06:00
Antonio Niño Díaz
2e695334c1 rgbfix: Add check to malloc()
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2018-04-03 22:41:51 +01:00
Anthony J. Bentley
5a4bbe4985 Add a new flag, -f, which allows independently fixing or trashing checksums. 2018-03-10 21:48:23 -07:00
Antonio Niño Díaz
a6b244b12e Move version files out of extern folder
The folder extern is reserved for external contributions, not common
files.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2018-01-28 13:07:21 +00:00
Antonio Niño Díaz
1a5c423984 Relicense codebase under MIT license
With permission from the main authors [1], most of the code has been
relicensed under the MIT license.

SPDX license identifiers are used so that the license headers in source
code files aren't too large.

Add CONTRIBUTORS.rst file.

[1] https://github.com/rednex/rgbds/issues/128

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2018-01-26 22:59:02 +00:00
Antonio Niño Díaz
2ffaf72e39 Cleanup code of rgbfix, rgbgfx and external libs
Follow Linux kernel coding style.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2018-01-02 13:16:53 +01:00
Antonio Niño Díaz
4b0dfd4f4a Initialize variables in rgbfix
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-08-21 23:35:45 +01:00
Antonio Niño Díaz
d0e0525302 Add -V to all programs to show the version
This option has been added to all programs of the toolchain, and it
prints the version string of the toolchain.

Manpages and help command line output updated.

Add missing 'w' flag to the command line output of rgbasm. It was
correctly documented in the manpages.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-07-22 10:14:02 +01:00
Antonio Niño Díaz
3d8396b86f Remove progname variable
The error message shouldn't specify the name of the binary, that's
supposed to be known by the caller.

Update test reference outputs.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-08 18:10:14 +01:00
AntonioND
25be5c6561 Improve error and warning output
Improve error messages generated by `errx()`, `warnx()` and similar.

Set `progname` to a static string with the name of the program so that
the path of the binary isn't included in error messages.

Signed-off-by: AntonioND <antonio_nd@outlook.com>
2017-04-03 21:16:43 +01:00
stag019
6438ae2591 Remove __progname; add progname set to argv[0] in each main(). 2015-03-09 13:57:04 -04:00
Anthony J. Bentley
33ae6d8ca3 Use long for file offsets. 2015-03-07 14:21:57 -07:00
Anthony J. Bentley
8534f3a148 Unify usage strings/functions across programs.
The funny spacing is to make it easier to keep to 80 characters/line.
2015-01-07 23:13:18 -07:00
Anthony J. Bentley
bdc6401eba rgbfix: deal with options and arguments in the right order. 2015-01-07 23:07:09 -07:00
Anthony J. Bentley
21d0b402d3 Don't unnecessarily initialize variables. 2015-01-07 22:59:06 -07:00
Anthony J. Bentley
1e1339467e Use POSIX 2001 as the base standard. 2014-11-06 21:39:36 -07:00
stag019
80e2129f22 Merge https://github.com/bentley/rgbds
Conflicts:
	include/lib/types.h
	src/asm/symbol.c
2014-11-02 01:00:20 -05:00
Anthony J. Bentley
d661b3a532 Now that we replace missing libc functions, switch back to err(). 2014-09-24 02:50:39 -06:00
Anthony J. Bentley
c0be5ddbb2 Remove dead stores. 2014-09-24 01:19:05 -06:00
Anthony J. Bentley
08b1b97a45 Preserve the ability to set pad_value in rgbfix. 2014-02-09 02:58:00 -07:00
Anthony J. Bentley
17192ea6f0 Improve performance when padding: don't write a byte at a time. 2014-02-08 23:26:43 -07:00
stag019
c61c112218 Remove GNU-specific <getopt.h>. getopt() is defined in <unistd.h> in POSIX, which adding #define _XOPEN_SOURCE 500 causes GCC to include. 2013-12-23 14:57:06 -05:00
Anthony J. Bentley
8811784b71 rgbfix: exit on invalid usage. 2013-04-11 09:28:38 -06:00
Vegard Nossum
eb4f790a82 Include getopt.h (fix compilation on GNU/Linux)
Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
2012-10-21 06:05:30 +02:00
Anthony J. Bentley
fd724d10e4 Add support for the four‐character game ID. 2011-12-29 20:22:06 -07:00
Anthony J. Bentley
5d6559f15f Remove nonstandard <err.h>.
This provides some really nice functions, but does not exist in some
environments (particularly MinGW).
2011-12-02 01:23:23 -07:00
Anthony J. Bentley
d784b14615 Remove unneeded include. 2011-04-11 20:00:52 -06:00
Anthony J. Bentley
d2f52fdd0c Rewrite rgbfix from scratch, under a free ISC license.
Slight changes in usage; the man page has been updated accordingly.
2010-12-22 13:48:44 -07:00
Anthony J. Bentley
05be8e0011 Delete rgbfix, to be replaced with a freely-licensed version 2010-12-22 13:19:37 -07:00
bentley
7293da9084 fix some error messages: err() instead of errx(strerror()) 2010-02-17 18:28:03 -07:00
bentley
aea1990de3 rgbfix: minor correction to last error message commit 2010-01-18 16:29:48 -07:00
bentley
f97e856a1f rgbfix: improve file open error message 2010-01-18 16:17:13 -07:00
bentley
e5ba184ef3 fix strcpy() warning on OpenBSD 2010-01-15 17:07:33 -07:00
bentley
b69cd0c345 -v doesn't need to modify ROM size; -p can do that 2010-01-13 11:22:56 -07:00