diff options
-rw-r--r-- | CHANGELOG.txt | 7 | ||||
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | agbsum/CMakeLists.txt | 20 | ||||
-rw-r--r-- | agbsum/include/agbsum.h | 61 | ||||
-rw-r--r-- | agbsum/src/chkpar.c | 94 | ||||
-rw-r--r-- | agbsum/src/chkparams.c | 96 | ||||
-rw-r--r-- | agbsum/src/exi.c (renamed from agbsum/src/exit.c) | 11 | ||||
-rw-r--r-- | agbsum/src/getsum.c (renamed from agbsum/src/calc.c) | 9 | ||||
-rw-r--r-- | agbsum/src/hlp.c (renamed from agbsum/src/help.c) | 11 | ||||
-rw-r--r-- | agbsum/src/inidat.c (renamed from agbsum/src/initdat.c) | 13 | ||||
-rw-r--r-- | agbsum/src/main.c | 33 | ||||
-rw-r--r-- | agbsum/src/opn.c (renamed from agbsum/src/open.c) | 11 | ||||
-rw-r--r-- | agbsum/src/pat.c | 11 | ||||
-rw-r--r-- | agbsum/src/red.c (renamed from agbsum/src/rd.c) | 13 |
14 files changed, 190 insertions, 204 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 96de3d6..bfefe67 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,10 @@ +| 8 + +- Update naming convention; +- Support C++99; +- Tag development releases; +- Update copyright notices; + | 7 - Don't use susinfo; diff --git a/CMakeLists.txt b/CMakeLists.txt index e49d1ab..d3b29f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.21) +cmake_minimum_required(VERSION 3.8) project( agbsum - VERSION 7 + VERSION 8 DESCRIPTION "GBA ROM header checksum patcher." HOMEPAGE_URL "https://mandelbrot.dk/agbsum" LANGUAGES C diff --git a/agbsum/CMakeLists.txt b/agbsum/CMakeLists.txt index df89bf3..5c104b8 100644 --- a/agbsum/CMakeLists.txt +++ b/agbsum/CMakeLists.txt @@ -1,19 +1,19 @@ -cmake_minimum_required(VERSION 3.21) +cmake_minimum_required(VERSION 3.8) -set(CMAKE_C_STANDARD 23) +set(CMAKE_C_STANDARD 99) add_executable( agbsum - "src/calc.c" - "src/chkparams.c" - "src/exit.c" - "src/help.c" - "src/initdat.c" + "src/chkpar.c" + "src/exi.c" + "src/getsum.c" + "src/hlp.c" + "src/inidat.c" "src/main.c" - "src/open.c" + "src/opn.c" "src/pat.c" - "src/rd.c" + "src/red.c" ) target_include_directories( @@ -25,7 +25,7 @@ target_include_directories( target_compile_definitions( agbsum PRIVATE - _FORTIFY_SOURCE=$<IF:$<STREQUAL:"${CMAKE_BUILD_TYPE}","Debug">,0x0,0x2> + _FORTIFY_SOURCE=$<IF:$<STREQUAL:"${CMAKE_BUILD_TYPE}","Debug">,0,2> ) if("${CMAKE_C_COMPILER_ID}" MATCHES "Clang|GNU") diff --git a/agbsum/include/agbsum.h b/agbsum/include/agbsum.h index 359cc1b..3d2fb80 100644 --- a/agbsum/include/agbsum.h +++ b/agbsum/include/agbsum.h @@ -1,61 +1,62 @@ /* - Copyright 2022 Gabriel Jensen. + Copyright 2022-2023 Gabriel Jensen. This file is part of agbsum. - agbsum is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - agbsum is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - You should have received a copy of the GNU Affero General Public License along with agbsum. If not, see <https://www.gnu.org/licenses/>. */ -#ifndef agbsum_hdr -#define agbsum_hdr +#ifndef agb_hdr +#define agb_hdr +#include <stdbool.h> #include <stdint.h> #include <stdio.h> -// Temporary C23 support: -#define constexpr static const // This can make arrays variadic-length. -#ifndef __clang__ -#define bool _Bool -#define false ((bool)+0x0u) -#define nullptr (NULL) -#define static_assert _Static_assert -#define true ((bool)+0x1u) -#define typeof __typeof__ +#if __STDC_VERSION__ > 199901 +#include <stdnoreturn.h> +#else +#ifdef __GNUC__ +#define _Noreturn __attribute__ ((noreturn)) +#elif defined(_MSC_VER) +#define _Noreturn __declspec (noreturn) +#else +#define _Noreturn +#endif +#define noreturn _Noreturn #endif -constexpr uint_least64_t agbsum_ver = 0x7u; +#define agb_rel ((uint_least64_t)+0x9u) -constexpr size_t agbsum_romstart = 0xA0u; -constexpr size_t agbsum_chksumoff = 0xBDu-agbsum_romstart; +#define agb_romsrt ((size_t)+0xA0u) +#define agb_chksumoff ((size_t)+0xBDu-agb_romsrt) typedef enum { - agbsum_stat_err, - agbsum_stat_ok, -} agbsum_stat; + agb_cnd_err, + agb_cnd_ok, +} agb_cnd; typedef struct { bool dopat; char const * pth; bool sil; FILE * rom; -} agbsum_dat; +} agb_dat; + +uint8_t agb_getsum(void const * rom); -uint8_t agbsum_calc(void const * rom); +void agb_pat(FILE * rom,unsigned char chksum); -void agbsum_help(void); +void agb_hlp(void); -void agbsum_chkparams(agbsum_dat * dat,int argc,char const * const * argv); +void agb_chkpar(agb_dat * dat,int argc,char const * const * argv); -void agbsum_initdat(agbsum_dat * dat); +void agb_inidat(agb_dat * dat); -FILE * agbsum_open(char const * pth); -void agbsum_pat( FILE * rom, unsigned char chksum); -void agbsum_rd( void * buf, FILE * rom); +FILE * agb_opn(char const * pth); +void agb_red(void * buf,FILE * rom); -[[noreturn]] void agbsum_exit(agbsum_stat stat,FILE * rom); +noreturn void agb_exi(agb_cnd stat,FILE * rom); #endif diff --git a/agbsum/src/chkpar.c b/agbsum/src/chkpar.c new file mode 100644 index 0000000..dcf198a --- /dev/null +++ b/agbsum/src/chkpar.c @@ -0,0 +1,94 @@ +/* + Copyright 2022-2023 Gabriel Jensen. + + This file is part of agbsum. + agbsum is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + agbsum is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + You should have received a copy of the GNU Affero General Public License along with agbsum. If not, see <https://www.gnu.org/licenses/>. +*/ + +#include <agbsum.h> + +#include <stddef.h> +#include <stdio.h> +#include <string.h> + +noreturn static void agb_xptparval(char const chrpar) { + fprintf(stderr,"Expected value for character parameter '%c'\n",chrpar); + agb_exi(agb_cnd_err,NULL); +} + +static bool agb_chkchrpar(agb_dat * const dat,char const * const par) { + char const chrpar = par[0x0u]; + if (chrpar == '\x0') {return true;} + + char const * const paramval = &par[0x1]; + + switch (chrpar) { + default: + fprintf(stderr,"Invalid character parameter '%c'\n",chrpar); + agb_exi(agb_cnd_err,NULL); + case 'h': + agb_hlp(); + agb_exi(agb_cnd_ok,NULL); + case 'i': + { + if (paramval[0x0u] == '\x0') {agb_xptparval(chrpar);} + dat->pth = paramval; + } + return true; + case 'p': + dat->dopat = true; + return false; + case 's': + dat->sil = true; + return false; + } +} + +void agb_chkpar(agb_dat * const dat,int const argc,char const * const * const argv) { + if (argc < 0x2) { + agb_hlp(); + agb_exi(agb_cnd_ok,NULL); + } + else { + size_t const numpar = argc; + + for (size_t pos = 0x1u;pos < numpar;++pos) { + + char const * const par = argv[pos]; + if (par[0x0u] == '-') { + if (par[0x1u] == '-') { + char const * const lngparam = &par[0x2u]; + + if (lngparam[0x0u] == '\x0') { + fputs("Missing long parameter after '--' sequence\n",stderr); + agb_exi(agb_cnd_err,NULL); + } + + if (!strcmp(lngparam,"help")) { + agb_hlp(); + agb_exi(agb_cnd_ok,NULL); + } + + fprintf(stderr,"Invalid long parameter \"%s\"\n",lngparam); + agb_exi(agb_cnd_err,NULL); + } + + if (par[0x1u] == '\x0') { + fputs("Missing character parameter after '-'\n",stderr); + agb_exi(agb_cnd_err,NULL); + } + + for (char const * chrpos = &par[0x1u];;++chrpos) {if (agb_chkchrpar(dat,chrpos)) {break;}} + + continue; + } + } + + if (dat->pth == NULL) { + fputs("ROM not set (missing character parameter 'i')\n",stderr); + agb_exi(agb_cnd_err,NULL); + } + } +} diff --git a/agbsum/src/chkparams.c b/agbsum/src/chkparams.c deleted file mode 100644 index e8dbc18..0000000 --- a/agbsum/src/chkparams.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - Copyright 2022 Gabriel Jensen. - - This file is part of agbsum. - - agbsum is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - - agbsum is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License along with agbsum. If not, see <https://www.gnu.org/licenses/>. -*/ - -#include <agbsum.h> - -#include <stdio.h> -#include <string.h> - -[[noreturn]] static void agbsum_expectparamval(char const chrparam) { - fprintf(stderr,"Expected value for character parameter '%c'\n",chrparam); - agbsum_exit(agbsum_stat_err,nullptr); -} - -static bool agbsum_chkchrparam(agbsum_dat * const dat,char const * const param) { - char const chrparam = param[0x0u]; - if (chrparam == '\x0') {return true;} - - char const * const paramval = ¶m[0x1]; - - switch (chrparam) { - default: - fprintf(stderr,"Invalid character parameter '%c'\n",chrparam); - agbsum_exit(agbsum_stat_err,nullptr); - case 'h': - agbsum_help(); - agbsum_exit(agbsum_stat_ok,nullptr); - case 'i': - { - if (paramval[0x0u] == '\x0') {agbsum_expectparamval(chrparam);} - dat->pth = paramval; - } - return true; - case 'p': - dat->dopat = true; - return false; - case 's': - dat->sil = true; - return false; - } -} - -void agbsum_chkparams(agbsum_dat * const dat,int const _argc,char const * const * const _argv) { - if (_argc < 0x2) { - agbsum_help(); - agbsum_exit(agbsum_stat_ok,nullptr); - } - else { - size_t const numparam = _argc; - - for (size_t pos = 0x1u;pos < numparam;++pos) { - - char const * const param = _argv[pos]; - if (param[0x0u] == '-') { - if (param[0x1u] == '-') { - char const * const lngparam = ¶m[0x2u]; - - if (lngparam[0x0u] == '\x0') { - fputs("Missing long parameter after '--' sequence\n",stderr); - agbsum_exit(agbsum_stat_err,nullptr); - } - - if (!strcmp(lngparam,"help")) { - agbsum_help(); - agbsum_exit(agbsum_stat_ok,nullptr); - } - - fprintf(stderr,"Invalid long parameter \"%s\"\n",lngparam); - agbsum_exit(agbsum_stat_err,nullptr); - } - - if (param[0x1u] == '\x0') { - fputs("Missing character parameter after '-'\n",stderr); - agbsum_exit(agbsum_stat_err,nullptr); - } - - for (char const * chrpos = ¶m[0x1u];;++chrpos) {if (agbsum_chkchrparam(dat,chrpos)) {break;}} - - continue; - } - } - - if (dat->pth == nullptr) { - fputs("ROM not set (missing character parameter 'i')\n",stderr); - agbsum_exit(agbsum_stat_err,nullptr); - } - } -} diff --git a/agbsum/src/exit.c b/agbsum/src/exi.c index 329c8ef..b24112a 100644 --- a/agbsum/src/exit.c +++ b/agbsum/src/exi.c @@ -1,12 +1,9 @@ /* - Copyright 2022 Gabriel Jensen. + Copyright 2022-2023 Gabriel Jensen. This file is part of agbsum. - agbsum is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - agbsum is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - You should have received a copy of the GNU Affero General Public License along with agbsum. If not, see <https://www.gnu.org/licenses/>. */ @@ -15,8 +12,8 @@ #include <stdio.h> #include <stdlib.h> -void agbsum_exit(agbsum_stat const stat,FILE * rom) { - if (rom != nullptr) {fclose(rom);} +void agb_exi(agb_cnd const cnd,FILE * rom) { + if (rom != NULL) {fclose(rom);} - exit(stat == agbsum_stat_ok ? EXIT_SUCCESS : EXIT_FAILURE); + exit(cnd == agb_cnd_ok ? EXIT_SUCCESS : EXIT_FAILURE); } diff --git a/agbsum/src/calc.c b/agbsum/src/getsum.c index a1aef02..1ec9459 100644 --- a/agbsum/src/calc.c +++ b/agbsum/src/getsum.c @@ -1,12 +1,9 @@ /* - Copyright 2022 Gabriel Jensen. + Copyright 2022-2023 Gabriel Jensen. This file is part of agbsum. - agbsum is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - agbsum is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - You should have received a copy of the GNU Affero General Public License along with agbsum. If not, see <https://www.gnu.org/licenses/>. */ @@ -14,11 +11,11 @@ #include <stdint.h> -uint8_t agbsum_calc(void const * const romptr) { +uint8_t agb_getsum(void const * const romptr) { uint8_t const * rom = romptr; uint8_t chksum = 0x0u; - for (unsigned char const * pos = rom;pos != rom+agbsum_chksumoff;++pos) {chksum += *pos;} + for (unsigned char const * pos = rom;pos != rom+agb_chksumoff;++pos) {chksum += *pos;} chksum = -(0x19u+chksum); diff --git a/agbsum/src/help.c b/agbsum/src/hlp.c index 91a5cdc..47f05b7 100644 --- a/agbsum/src/help.c +++ b/agbsum/src/hlp.c @@ -1,12 +1,9 @@ /* - Copyright 2022 Gabriel Jensen. + Copyright 2022-2023 Gabriel Jensen. This file is part of agbsum. - agbsum is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - agbsum is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - You should have received a copy of the GNU Affero General Public License along with agbsum. If not, see <https://www.gnu.org/licenses/>. */ @@ -15,10 +12,10 @@ #include <inttypes.h> #include <stdio.h> -void agbsum_help(void) { +void agb_hlp(void) { fprintf(stderr, "agbsum - Calculate GBA ROM header checksums.\n" - "Release #%" PRIXLEAST64 ". Copyright 2022 Gabriel Jensen.\n" + "Release #%" PRIXLEAST64 ". Copyright 2022-2023 Gabriel Jensen.\n" "\n" "Usage: agbsum [options] <ROM>\n" "Options:\n" @@ -27,6 +24,6 @@ void agbsum_help(void) { " -s Don't print the results\n" "\n" "Built at " __TIME__ ", " __DATE__ ".\n", - agbsum_ver + agb_rel ); } diff --git a/agbsum/src/initdat.c b/agbsum/src/inidat.c index 01eafed..4ac5d6e 100644 --- a/agbsum/src/initdat.c +++ b/agbsum/src/inidat.c @@ -1,20 +1,19 @@ /* - Copyright 2022 Gabriel Jensen. + Copyright 2022-2023 Gabriel Jensen. This file is part of agbsum. - agbsum is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - agbsum is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - You should have received a copy of the GNU Affero General Public License along with agbsum. If not, see <https://www.gnu.org/licenses/>. */ #include <agbsum.h> -void agbsum_initdat(agbsum_dat * const dat) { +#include <stddef.h> + +void agb_inidat(agb_dat * const dat) { dat->dopat = false; - dat->pth = nullptr; + dat->pth = NULL; dat->sil = false; - dat->rom = nullptr; + dat->rom = NULL; } diff --git a/agbsum/src/main.c b/agbsum/src/main.c index 58fc4ac..d573958 100644 --- a/agbsum/src/main.c +++ b/agbsum/src/main.c @@ -1,12 +1,9 @@ /* - Copyright 2022 Gabriel Jensen. + Copyright 2022-2023 Gabriel Jensen. This file is part of agbsum. - agbsum is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - agbsum is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - You should have received a copy of the GNU Affero General Public License along with agbsum. If not, see <https://www.gnu.org/licenses/>. */ @@ -16,32 +13,34 @@ #include <stdint.h> #include <stdio.h> -static_assert(CHAR_WIDTH == 0x8u,"agbsum only support 8-bit byte systems"); +#if CHAR_BIT != 0x8u +#error "agbsum only support 8-bit byte systems" +#endif int main(int const argc,char const * const * const argv) { - agbsum_dat dat; + agb_dat dat; - agbsum_initdat(&dat); + agb_inidat(&dat); - agbsum_chkparams(&dat,argc,argv); + agb_chkpar(&dat,argc,argv); - dat.rom = agbsum_open(dat.pth); + dat.rom = agb_opn(dat.pth); - unsigned char buf[agbsum_chksumoff+0x1u]; + unsigned char buf[agb_chksumoff+0x1u]; - agbsum_rd(buf,dat.rom); + agb_red(buf,dat.rom); - unsigned char const chksum = agbsum_calc(buf); - unsigned char const romchksum = buf[agbsum_chksumoff]; + unsigned char const chksum = agb_getsum(buf); + unsigned char const romchksum = buf[agb_chksumoff]; if (romchksum == chksum || !dat.dopat) { if (!dat.sil) {printf("\"%s\": %hhX (%hhX in file)\n",dat.pth,chksum,romchksum);} - agbsum_exit(agbsum_stat_ok,dat.rom); + agb_exi(agb_cnd_ok,dat.rom); } - agbsum_pat(dat.rom,chksum); + agb_pat(dat.rom,chksum); - if (!dat.sil) {printf("\"%s\" @ %zX: %hhX => %hhX\n",dat.pth,agbsum_romstart+agbsum_chksumoff,romchksum,chksum);} + if (!dat.sil) {printf("\"%s\" @ %zX: %hhX => %hhX\n",dat.pth,agb_romsrt+agb_chksumoff,romchksum,chksum);} - agbsum_exit(agbsum_stat_ok,dat.rom); + agb_exi(agb_cnd_ok,dat.rom); } diff --git a/agbsum/src/open.c b/agbsum/src/opn.c index 2b54cb7..6279462 100644 --- a/agbsum/src/open.c +++ b/agbsum/src/opn.c @@ -1,12 +1,9 @@ /* - Copyright 2022 Gabriel Jensen. + Copyright 2022-2023 Gabriel Jensen. This file is part of agbsum. - agbsum is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - agbsum is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - You should have received a copy of the GNU Affero General Public License along with agbsum. If not, see <https://www.gnu.org/licenses/>. */ @@ -14,12 +11,12 @@ #include <stdio.h> -FILE * agbsum_open(char const * const pth) { +FILE * agb_opn(char const * const pth) { FILE * rom = fopen(pth,"r+"); - if (rom == nullptr) { + if (rom == NULL) { fputs("Unable to open ROM\n",stderr); - agbsum_exit(agbsum_stat_err,nullptr); + agb_exi(agb_cnd_err,NULL); } return rom; diff --git a/agbsum/src/pat.c b/agbsum/src/pat.c index 07cf2e9..d849f5f 100644 --- a/agbsum/src/pat.c +++ b/agbsum/src/pat.c @@ -1,12 +1,9 @@ /* - Copyright 2022 Gabriel Jensen. + Copyright 2022-2023 Gabriel Jensen. This file is part of agbsum. - agbsum is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - agbsum is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - You should have received a copy of the GNU Affero General Public License along with agbsum. If not, see <https://www.gnu.org/licenses/>. */ @@ -14,11 +11,11 @@ #include <stdio.h> -void agbsum_pat(FILE * const rom,unsigned char chksum) { - fseek(rom,(long)(agbsum_romstart+agbsum_chksumoff),SEEK_SET); +void agb_pat(FILE * const rom,unsigned char chksum) { + fseek(rom,(long)(agb_romsrt+agb_chksumoff),SEEK_SET); if (fwrite(&chksum,0x1u,0x1u,rom) != 0x1u) { fputs("Unable to patch ROM\n",stderr); - agbsum_exit(agbsum_stat_err,rom); + agb_exi(agb_cnd_err,rom); } } diff --git a/agbsum/src/rd.c b/agbsum/src/red.c index 7094604..eb310b7 100644 --- a/agbsum/src/rd.c +++ b/agbsum/src/red.c @@ -1,12 +1,9 @@ /* - Copyright 2022 Gabriel Jensen. + Copyright 2022-2023 Gabriel Jensen. This file is part of agbsum. - agbsum is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - agbsum is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - You should have received a copy of the GNU Affero General Public License along with agbsum. If not, see <https://www.gnu.org/licenses/>. */ @@ -14,12 +11,12 @@ #include <stdio.h> -void agbsum_rd(void * const buf,FILE * rom) { - fseek(rom,agbsum_romstart,SEEK_SET); // We only need to read the part of the ROM that is used for the checksum. - size_t const num = agbsum_chksumoff+0x1u; +void agb_red(void * const buf,FILE * rom) { + fseek(rom,agb_romsrt,SEEK_SET); // We only need to read the part of the ROM that is used for the checksum. + size_t const num = agb_chksumoff+0x1u; if (fread(buf,0x1u,num,rom) != num) { fputs("Unable to read ROM\n",stderr); - agbsum_exit(agbsum_stat_err,rom); + agb_exi(agb_cnd_err,rom); } } |