summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt6
-rw-r--r--CMakeLists.txt2
-rw-r--r--agbsum/include/agbsum.h2
-rw-r--r--agbsum/src/chkparams.c19
-rw-r--r--agbsum/src/help.c4
5 files changed, 22 insertions, 11 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 50a94d7..16fa013 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,3 +1,9 @@
+| 6
+
+- Fix errors during parameter checks;
+- Use susinfo more;
+- Update help screen;
+
| 5
- Fix version number not being updated;
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0d02993..d0b2faa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,7 +6,7 @@ cmake_minimum_required(
project(
agbsum
VERSION
- 5
+ 6
DESCRIPTION
"GBA ROM header checksum patcher."
HOMEPAGE_URL
diff --git a/agbsum/include/agbsum.h b/agbsum/include/agbsum.h
index 19333fc..7cf7940 100644
--- a/agbsum/include/agbsum.h
+++ b/agbsum/include/agbsum.h
@@ -21,7 +21,7 @@
#define nullptr NULL
#define typeof __typeof__
-constexpr uint_least64_t agbsum_ver = 0x5u;
+constexpr uint_least64_t agbsum_ver = 0x6u;
constexpr size_t agbsum_romstart = 0xA0u;
diff --git a/agbsum/src/chkparams.c b/agbsum/src/chkparams.c
index 481888f..b99816f 100644
--- a/agbsum/src/chkparams.c
+++ b/agbsum/src/chkparams.c
@@ -13,6 +13,7 @@
#include <agbsum.h>
#include <stdio.h>
+#include <sus/extra.h>
#include <sus/os.h>
#include <zap/mem.h>
@@ -39,7 +40,11 @@ static bool agbsum_chkchrparam(char const * const _param) {
agbsum_exit(agbsum_stat_ok);
case 'i':
{
- if (paramval[0x0u] == '\x0') {agbsum_expectparamval(chrparam);}
+ sus_unlikely (paramval[0x0u] == '\x0') {agbsum_expectparamval(chrparam);}
+ sus_unlikely (agbsum_dat.pth != nullptr) {
+ fprintf(stderr,"ROM already set (to \"%s\", now \"%s\")\n",agbsum_dat.pth,paramval);
+ agbsum_exit(agbsum_stat_err);
+ }
#if defined(sus_os_win)
#else
struct stat statstruct;
@@ -80,7 +85,7 @@ void agbsum_chkparams(int const _argc,char const * const * const _argv) {
if (param[0x1u] == '-') {
char const * const lngparam = &param[0x2u];
if (lngparam[0x0u] == '\x0') {
- fputs("Missing longe parameter after '--' sequence\n",stderr);
+ fputs("Missing long parameter after '--' sequence\n",stderr);
agbsum_exit(agbsum_stat_err);
}
if (zap_streq(lngparam,"help")) {
@@ -90,16 +95,16 @@ void agbsum_chkparams(int const _argc,char const * const * const _argv) {
fprintf(stderr,"Invalid long parameter \"%s\"\n",lngparam);
agbsum_exit(agbsum_stat_err);
}
+ sus_unlikely (param[0x1u] == '\x0') {
+ fputs("Missing character parameter after '-'\n",stderr);
+ agbsum_exit(agbsum_stat_err);
+ }
for (char const * chrpos = &param[0x1u];;++chrpos) {if (agbsum_chkchrparam(chrpos)) {break;}}
continue;
}
- if (agbsum_dat.pth != nullptr) {
- fprintf(stderr,"ROM already set (to \"%s\", now \"%s\")\n",agbsum_dat.pth,param);
- agbsum_exit(agbsum_stat_err);
- }
}
if (agbsum_dat.pth == nullptr) {
- fputs("ROM not set (missing parameter)\n",stderr);
+ fputs("ROM not set (missing character parameter 'i')\n",stderr);
agbsum_exit(agbsum_stat_err);
}
}
diff --git a/agbsum/src/help.c b/agbsum/src/help.c
index 8cd3866..1bfb4ad 100644
--- a/agbsum/src/help.c
+++ b/agbsum/src/help.c
@@ -22,9 +22,9 @@ void agbsum_help(void) {
fputs("Usage: agbsum [options] <ROM>\n",stderr);
fputc('\n',stderr);
fputs("Options:\n",stderr);
- fputs(" --help -h Print an help screen\n",stderr);
+ fputs(" --help -h Print the help screen\n",stderr);
fputs(" -p Patch the ROM\n",stderr);
- fputs(" -s Don't print results\n",stderr);
+ fputs(" -s Don't print the results\n",stderr);
fputc('\n',stderr);
fputs("Built at " __TIME__ ", " __DATE__ ".\n",stderr);
}