diff options
Diffstat (limited to '')
114 files changed, 5824 insertions, 3498 deletions
diff --git a/project/src/analyze.c b/project/src/analyze.c index 152b439..7809a7a 100644 --- a/project/src/analyze.c +++ b/project/src/analyze.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/crypt.h b/project/src/crypt.h index 2862466..d252aab 100644 --- a/project/src/crypt.h +++ b/project/src/crypt.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/crypto/ssl-asm.S b/project/src/crypto/ssl-asm.S index 0205a32..84963d4 100644 --- a/project/src/crypto/ssl-asm.S +++ b/project/src/crypto/ssl-asm.S @@ -16,7 +16,7 @@ * This file is part of the WIT project. * * Visit http://wit.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/crypto/ssl-asm.h b/project/src/crypto/ssl-asm.h index 0d1e49b..1219e16 100644 --- a/project/src/crypto/ssl-asm.h +++ b/project/src/crypto/ssl-asm.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/db-ctcode.c b/project/src/db-ctcode.c index d0171fe..4001a9f 100644 --- a/project/src/db-ctcode.c +++ b/project/src/db-ctcode.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/db-ctcode.h b/project/src/db-ctcode.h index eda97d2..5d1f8ac 100644 --- a/project/src/db-ctcode.h +++ b/project/src/db-ctcode.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-breff.c b/project/src/lib-breff.c index 45b37ab..8fe2a38 100644 --- a/project/src/lib-breff.c +++ b/project/src/lib-breff.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-breff.h b/project/src/lib-breff.h index 5799c18..bd82adc 100644 --- a/project/src/lib-breff.h +++ b/project/src/lib-breff.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-brres.c b/project/src/lib-brres.c index f19cada..10ab6d4 100644 --- a/project/src/lib-brres.c +++ b/project/src/lib-brres.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-brres.h b/project/src/lib-brres.h index 120565c..f0ae424 100644 --- a/project/src/lib-brres.h +++ b/project/src/lib-brres.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-bzip2.c b/project/src/lib-bzip2.c index aaefe2b..894463f 100644 --- a/project/src/lib-bzip2.c +++ b/project/src/lib-bzip2.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-bzip2.h b/project/src/lib-bzip2.h index 508f18f..b3662f2 100644 --- a/project/src/lib-bzip2.h +++ b/project/src/lib-bzip2.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-checksum.c b/project/src/lib-checksum.c index 3be8513..a96cd79 100644 --- a/project/src/lib-checksum.c +++ b/project/src/lib-checksum.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-checksum.h b/project/src/lib-checksum.h index ddde54c..25f8786 100644 --- a/project/src/lib-checksum.h +++ b/project/src/lib-checksum.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-common.c b/project/src/lib-common.c index 60d1184..1b7cffc 100644 --- a/project/src/lib-common.c +++ b/project/src/lib-common.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-common.h b/project/src/lib-common.h index 5da9043..8ca2390 100644 --- a/project/src/lib-common.h +++ b/project/src/lib-common.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-ctcode.c b/project/src/lib-ctcode.c index ed0e7b1..a24ecb2 100644 --- a/project/src/lib-ctcode.c +++ b/project/src/lib-ctcode.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -546,6 +546,12 @@ void ResetDataCTCODE ( ctcode_t * ctcode, bool create_empty ) //--- misc + if (ctcode->lpar) + { + FREE(ctcode->lpar); + ctcode->lpar = 0; + } + SetupUsedSlotsCTCODE(ctcode); CalcCupRefCTCODE(ctcode,true); #if USE_NEW_CONTAINER_CTC @@ -2651,6 +2657,13 @@ enumError ScanLEBinCTCODE } + //--- copy lecode parameter + + if (!ctcode->lpar) + ctcode->lpar = MALLOC(sizeof(*ctcode->lpar)); + *ctcode->lpar = ana.lpar; + + //--- terminate ResetLEAnalyse(&ana); diff --git a/project/src/lib-ctcode.h b/project/src/lib-ctcode.h index 15520f9..f444e8c 100644 --- a/project/src/lib-ctcode.h +++ b/project/src/lib-ctcode.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -290,6 +290,8 @@ typedef struct ctcode_t bool replace_at; // true: Replace "@..@" on track names bool use_lecode; // true: enable le-code support bool use_le_flags; // true: le_flags enabled + struct le_lpar_t *lpar; // NULL or LPAR parameters + //--- misc diff --git a/project/src/lib-ctdata.c b/project/src/lib-ctdata.c index 69afa41..f39f10f 100644 --- a/project/src/lib-ctdata.c +++ b/project/src/lib-ctdata.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-file.c b/project/src/lib-file.c index 979d875..3d6b65a 100644 --- a/project/src/lib-file.c +++ b/project/src/lib-file.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-geohit.c b/project/src/lib-geohit.c index 8090e0c..6acf70c 100644 --- a/project/src/lib-geohit.c +++ b/project/src/lib-geohit.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-image.h b/project/src/lib-image.h index 366d61f..40d6012 100644 --- a/project/src/lib-image.h +++ b/project/src/lib-image.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-image1.c b/project/src/lib-image1.c index f99154a..054fb6b 100644 --- a/project/src/lib-image1.c +++ b/project/src/lib-image1.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-image2.c b/project/src/lib-image2.c index 1f861b5..a91f9e3 100644 --- a/project/src/lib-image2.c +++ b/project/src/lib-image2.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-image3.c b/project/src/lib-image3.c index 2f04abb..916c379 100644 --- a/project/src/lib-image3.c +++ b/project/src/lib-image3.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-itemslot.c b/project/src/lib-itemslot.c index a7b7727..d2716e7 100644 --- a/project/src/lib-itemslot.c +++ b/project/src/lib-itemslot.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-kcl-image.c b/project/src/lib-kcl-image.c index 161e3cc..fcb2f9e 100644 --- a/project/src/lib-kcl-image.c +++ b/project/src/lib-kcl-image.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-kcl.c b/project/src/lib-kcl.c index b78a632..1257ef0 100644 --- a/project/src/lib-kcl.c +++ b/project/src/lib-kcl.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -1096,9 +1096,9 @@ void RoundPointsKCL for ( ; n-- > 0; td++ ) { - double *d = &td->pt->x; + double *d = td->pt->v; uint i; - for ( i = 0; i < sizeof(td->pt)/sizeof(*d); i++, d++ ) + for ( i = 0; i < sizeof(td->pt->v)/sizeof(*d); i++, d++ ) *d = ldexp(round(ldexp(*d,round_pow2)),-round_pow2); td->status |= TD_INVALID_NORM; } @@ -1129,9 +1129,9 @@ void RoundNormalsKCL for ( ; n-- > 0; td++ ) { - float *f = &td->normal->x; + float *f = td->normal->v; uint i; - for ( i = 0; i < sizeof(td->normal)/sizeof(*f); i++, f++ ) + for ( i = 0; i < sizeof(td->normal->v)/sizeof(*f); i++, f++ ) *f = ldexpf(roundf(ldexpf(*f,round_pow2)),-round_pow2); } } diff --git a/project/src/lib-kcl.h b/project/src/lib-kcl.h index 863e9e9..6deb16a 100644 --- a/project/src/lib-kcl.h +++ b/project/src/lib-kcl.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-kmp-diff.c b/project/src/lib-kmp-diff.c index 02fb9dc..35774f9 100644 --- a/project/src/lib-kmp-diff.c +++ b/project/src/lib-kmp-diff.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-kmp-draw.c b/project/src/lib-kmp-draw.c index b967a9f..11d6293 100644 --- a/project/src/lib-kmp-draw.c +++ b/project/src/lib-kmp-draw.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-kmp-pflags.c b/project/src/lib-kmp-pflags.c index bfe77e2..f62b246 100644 --- a/project/src/lib-kmp-pflags.c +++ b/project/src/lib-kmp-pflags.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-kmp-text.c b/project/src/lib-kmp-text.c index 2d6a46a..507cbc0 100644 --- a/project/src/lib-kmp-text.c +++ b/project/src/lib-kmp-text.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-kmp.c b/project/src/lib-kmp.c index 35069ea..5ffe9f0 100644 --- a/project/src/lib-kmp.c +++ b/project/src/lib-kmp.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-kmp.h b/project/src/lib-kmp.h index 4777c83..050444e 100644 --- a/project/src/lib-kmp.h +++ b/project/src/lib-kmp.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -45,7 +45,7 @@ #include "lib-std.h" #include "lib-object.h" -#include "lib-lecode.h" +#include "lib-lex.h" // /////////////////////////////////////////////////////////////////////////////// @@ -980,7 +980,7 @@ typedef enum kmp_mode_t KMPMD_M_TINY = KMPMD_TINY_7, KMPMD_RM_EMPTY = KMPMD_TINY_1 << 3, // skip empty KMP sections - KMPMD_MINIMIZE = KMPMD_RM_EMPTY << 1, // minimize KMP by reordering + KMPMD_MINIMIZE = KMPMD_RM_EMPTY << 1, // minimize KMP by reordering [[obsolete]] not used //--- tests diff --git a/project/src/lib-lecode.c b/project/src/lib-lecode.c index 5e7aa32..0222315 100644 --- a/project/src/lib-lecode.c +++ b/project/src/lib-lecode.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -41,7 +41,6 @@ #include "lib-mkw.h" #include "lib-szs.h" #include "lpar.inc" -#include "lex.inc" #include <stddef.h> @@ -72,43 +71,6 @@ bool opt_complete = false; // /////////////////////////////////////////////////////////////////////////////// -/////////////// LEX action log /////////////// -/////////////////////////////////////////////////////////////////////////////// - -bool LEX_ACTION_LOG ( bool is_patch, const char * format, ... ) -{ - #if HAVE_PRINT - { - char buf[200]; - snprintf(buf,sizeof(buf),">>>[LEX]<<< %s",format); - va_list arg; - va_start(arg,format); - PRINT_ARG_FUNC(buf,arg); - va_end(arg); - } - #endif - -// if ( verbose > 2 || KMP_MODE & KMPMD_LOG || is_patch && ~KMP_MODE & KMPMD_SILENT ) - if ( verbose > 2 || is_patch ) - { - fflush(stdout); - fprintf(stdlog," %s>[LEX]%s ", - colset->heading, - is_patch ? colset->highlight : colset->info ); - va_list arg; - va_start(arg,format); - vfprintf(stdlog,format,arg); - va_end(arg); - fputs(colset->reset,stdlog); - fflush(stdlog); - return true; - } - - return false; -} - -// -/////////////////////////////////////////////////////////////////////////////// /////////////// helpers /////////////// /////////////////////////////////////////////////////////////////////////////// @@ -2152,6 +2114,9 @@ enumError ApplyCTCODE ( le_analyse_t * ana, const ctcode_t * ctcode ) //--- setup + if (ctcode->lpar) + ana->lpar = *ctcode->lpar; + ana->n_cup_track = 0; ana->n_cup_arena = 0; ana->n_slot = 0; @@ -2703,2005 +2668,6 @@ enumError ScanTextLPAR_CHAT // /////////////////////////////////////////////////////////////////////////////// -/////////////// lecode extension LEX /////////////// -/////////////////////////////////////////////////////////////////////////////// - -enumError ScanLexFile - ( cvp data, uint data_size, lex_stream_func func, - cvp user_ptr, int user_int ) -{ - if ( !data || data_size < sizeof(lex_header_t) ) - return ERR_INVALID_DATA; - - const lex_header_t *hd = (lex_header_t*)data; - if (memcmp(hd->magic,LEX_BIN_MAGIC,4)) - return ERR_INVALID_DATA; - - if ( ntohs(hd->major_version) != LEX_MAJOR_VERSION ) - return ERR_INVALID_VERSION; - - const uint size = ntohl(hd->size); - const uint off = ntohl(hd->element_off); - if ( (size&3) || size > data_size || (off&3) || off + 4 > size ) - return ERR_INVALID_DATA; - - return ScanLexElements((u8*)data+off,size-off,func,user_ptr,user_int); -} - -/////////////////////////////////////////////////////////////////////////////// - -enumError ScanLexElements - ( cvp data, uint data_size, lex_stream_func func, - cvp user_ptr, int user_int ) -{ - if ( !data || !data_size || (data_size&3) ) - return ERR_INVALID_DATA; - - enumError max_err = ERR_OK; - - uint off = 0; - while ( off < data_size ) - { - const lex_element_t *s = (lex_element_t*)( (u8*)data + off ); - - const u32 magic = ntohl(s->magic); - if (!magic) - break; - - const uint size = ntohl(s->size); - off += sizeof(lex_element_t) + size; - if ( (size&3) || off > data_size ) - return ERR_INVALID_DATA; - - PRINT("LEX SECTION: %.4s, size:%x\n",PrintID(&s->magic,4,0),size); - if (func) - { - const int err = func(magic,s->data,size,user_ptr,user_int); - if (err<0) - return -err; - if ( max_err < err ) - max_err = err; - } - } - - return max_err; -} - -/////////////////////////////////////////////////////////////////////////////// - -lex_element_t * FindLexElement ( lex_header_t *head, uint data_size, u32 magic ) -{ - if ( !head || data_size <= sizeof(lex_header_t) || (data_size&3) ) - return 0; - - uint file_size = ntohl(head->size); - if ( file_size > data_size ) - return 0; - file_size -= sizeof(lex_element_t); - - uint offset = ntohl(head->element_off); - if ( offset > file_size ) - return 0; - - magic = htonl(magic); - for(;;) - { - lex_element_t *elem = (lex_element_t*)((u8*)head + offset); - offset += 8 + ntohl(elem->size); - if ( offset > file_size ) - return 0; - if ( elem->magic == magic ) - return elem; - } -} - -// -/////////////////////////////////////////////////////////////////////////////// -/////////////// fix lex items /////////////// -/////////////////////////////////////////////////////////////////////////////// - -typedef void (*FixElementFunc) ( lex_t * lex, lex_item_t * item ); - -/////////////////////////////////////////////////////////////////////////////// - -static void FixLEXElement_SET1 ( lex_set1_t *set1 ) -{ - DASSERT(set1); - - uint i; - for ( i = 0; i < 3; i++ ) - { - float f = bef4(set1->item_factor.v+i); - if ( !isnormal(f) || f < 1.0 ) - write_bef4(set1->item_factor.v+i,1.0); - } -} - -//----------------------------------------------------------------------------- - -static void FixLEXItem_SET1 -( - lex_t * lex, // LEX data structure - lex_item_t * item // item to fix -) -{ - DASSERT(lex); - DASSERT(item); - DASSERT( ntohl(item->elem.size) >= sizeof(lex_set1_t) ); - - lex_set1_t *set1 = (lex_set1_t*)item->elem.data; - FixLEXElement_SET1(set1); -} - -// -/////////////////////////////////////////////////////////////////////////////// -/////////////// lex_t helpers /////////////// -/////////////////////////////////////////////////////////////////////////////// - -static lex_item_t * FindElementLEX -( - const lex_t * lex, // LEX data structure - u32 magic // magic -) -{ - magic = htonl(magic); - - uint i; - lex_item_t **ss; - for ( i = 0, ss = lex->item; i < lex->item_used; i++, ss++ ) - if ( (*ss)->elem.magic == magic ) - return *ss; - return 0; -} - -/////////////////////////////////////////////////////////////////////////////// - -static uint GetLexSortOrder ( u32 magic ) -{ - switch(magic) - { - case LEXS_SET1: return 1; - case LEXS_TEST: return 9; - default: return 2; - } -} - -/////////////////////////////////////////////////////////////////////////////// - -static void UpdateHaveLex ( lex_t *lex ) -{ - DASSERT(lex); - uint have_lex = 0; - - uint i; - lex_item_t **ss; - for ( i = 0, ss = lex->item; i < lex->item_used; i++, ss++ ) - { - const u32 magic = ntohl((*ss)->elem.magic); - const uint size = ntohl((*ss)->elem.size); - uint j; - for ( j = 0; j < HAVELEX__N; j++ ) - if ( magic == have_lex_info[j].magic && size >= have_lex_info[j].min_size ) - { - have_lex |= 1 << j; - break; - } - } - - lex->have_lex = have_lex; -} - -/////////////////////////////////////////////////////////////////////////////// - -static lex_item_t * AppendElementLEX -( - lex_t * lex, // LEX data structure - u32 magic, // magic - const void * data, // data of section - uint size, // size of 'data' - bool overwrite // false: abort if exists and return 0 - // true: overwrite -) -{ - DASSERT(lex); - DASSERT( data || !size ); - - - //--- add have_lex - - uint i; - for ( i = 0; i < HAVELEX__N; i++ ) - if ( magic == have_lex_info[i].magic && size >= have_lex_info[i].min_size ) - { - lex->have_lex |= 1 << i; - break; - } - - - //--- check if already exists - - lex_item_t **ss; - const u32 be_magic = htonl(magic); - for ( i = 0, ss = lex->item; i < lex->item_used; i++, ss++ ) - if ( (*ss)->elem.magic == be_magic ) - { - if (!overwrite) - return 0; - break; - } - - - //--- grow item list if necessary - - if ( i == lex->item_size ) - { - lex->item_size = lex->item_size + 30; - lex->item = REALLOC( lex->item, lex->item_size * sizeof(*lex->item) ); - // 'ss' becomes invalid! - ss = lex->item + i; - } - - if ( i < lex->item_used ) - FREE(*ss); - else - lex->item_used++; - - - //--- fix item size - - uint size4 = ALIGN32(size,4); - FixElementFunc fix_func = 0; - - switch(magic) - { - case LEXS_SET1: - fix_func = FixLEXItem_SET1; - if ( size4 < sizeof(lex_set1_t) ) - size4 = ALIGN32(sizeof(lex_set1_t),4); - break; - - case LEXS_TEST: - if ( size4 < sizeof(lex_test_t) ) - size4 = ALIGN32(sizeof(lex_test_t),4); - break; - } - - - //--- setup item - - lex_item_t *s = MALLOC(sizeof(lex_item_t)+size4); - *ss = s; - s->sort_order = GetLexSortOrder(magic); - s->insert_order = i; - s->elem.magic = be_magic; - s->elem.size = htonl(size4); - memcpy(s->elem.data,data,size); - if ( size < size4 ) - memset(s->elem.data+size,0,size4-size); - - if (fix_func) - fix_func(lex,s); - - return s; -} - -/////////////////////////////////////////////////////////////////////////////// - -static bool RemoveElementLEX -( - lex_t *lex, // LEX data structure - const lex_item_t *li // element to remove (robust) -) -{ - if ( !li || !li->elem.magic ) - return 0; - - uint i; - lex_item_t **ss; - for ( i = 0, ss = lex->item; i < lex->item_used; i++, ss++ ) - if ( *ss == li ) - { - memmove(ss,ss+1,lex->item_used-i); - lex->item_used--; - FREE((lex_item_t*)li); - UpdateHaveLex(lex); - return true; - } - return false; -} - -//----------------------------------------------------------------------------- - -static uint RemoveElementByMagicLEX -( - lex_t *lex, // LEX data structure - u32 magic // magic -) -{ - if (!magic) - return 0; - - uint count = 0; - for(;;) - { - lex_item_t *li = FindElementLEX(lex,magic); - if (!li) - return count; - count += RemoveElementLEX(lex,li); - } -} - -/////////////////////////////////////////////////////////////////////////////// - -static int cmp_lex_item ( const lex_item_t ** pa, const lex_item_t ** pb ) -{ - const lex_item_t *a = *pa; - const lex_item_t *b = *pb; - noPRINT(">> SORT: %u.%u : %u.%u\n", - a->sort_order, a->insert_order, - b->sort_order, b->insert_order ); - - int res = (int)a->sort_order - (int)b->sort_order; - return res ? res : (int)a->insert_order - (int)b->insert_order; -} - -//----------------------------------------------------------------------------- - -static void SortItemsLEX -( - lex_t * lex // LEX data structure -) -{ - if ( lex->item_used > 1 ) - qsort( lex->item, lex->item_used, sizeof(*lex->item), - (qsort_func)cmp_lex_item ); -} - -// -/////////////////////////////////////////////////////////////////////////////// -/////////////// have lex support /////////////// -/////////////////////////////////////////////////////////////////////////////// -// order is important, compare have_lex_t and ct.wiimm.de - -const have_lex_info_t have_lex_info[HAVELEX__N] = -{ - { LEXS_SET1, "set1", 1 }, - { LEXS_CANN, "cannon", 0 }, - { LEXS_TEST, "test", 1 }, - { LEXS_HIPT, "hidepos", sizeof(lex_hipt_rule_t) }, - //--- add new sections here (order is important) -}; - -/////////////////////////////////////////////////////////////////////////////// - -ccp CreateSectionInfoLEX - ( have_lex_t special, bool add_value, ccp return_if_empty ) -{ - static char buf[500]; - char *dest = buf; - - if (add_value) - dest = snprintfE( dest, buf+sizeof(buf), "%u=" , special ); - - uint i, mask; - ccp sep = ""; - for ( i = 0, mask = 1; i < HAVELEX__N; i++, mask <<= 1 ) - if ( special & mask ) - { - dest = StringCat2E(dest,buf+sizeof(buf),sep,have_lex_info[i].name); - sep = ","; - } - - return dest == buf ? return_if_empty : CopyCircBuf0(buf,dest-buf); -} - -// -/////////////////////////////////////////////////////////////////////////////// -/////////////// LEX setup /////////////// -/////////////////////////////////////////////////////////////////////////////// - -void InitializeLEX ( lex_t * lex ) -{ - DASSERT(lex); - memset(lex,0,sizeof(*lex)); - - lex->fname = EmptyString; -} - -/////////////////////////////////////////////////////////////////////////////// - -void ResetLEX ( lex_t * lex ) -{ - if (lex) - { - FreeString(lex->fname); - if (lex->raw_data) - FREE(lex->raw_data); - - if (lex->item) - { - uint i; - for ( i = 0; i < lex->item_used; i++ ) - if (lex->item[i]) - FREE(lex->item[i]); - FREE(lex->item); - } - InitializeLEX(lex); - } -} - -/////////////////////////////////////////////////////////////////////////////// - -void UpdateLEX ( lex_t * lex, bool add_missing, bool add_test ) -{ - DASSERT(lex); - - if ( add_missing && lex->develop ) - { - } - - if (add_missing) - { - //--- SET1 - AppendSet1LEX(lex,false); - - //--- CANN - AppendCannLEX(lex,false); - - //--- HIPT - AppendHiptLEX(lex,false); - } - - if (add_test) //--- TEST - AppendTestLEX(lex,false); - - SortItemsLEX(lex); -} - -//----------------------------------------------------------------------------- - -lex_item_t * AppendSet1LEX ( lex_t * lex, bool overwrite ) -{ - lex_set1_t set1; - memset(&set1,0,sizeof(set1)); - // AppendElementLE() does call FixLEXItem_SET1() - return AppendElementLEX(lex,LEXS_SET1,&set1,sizeof(set1),false); -} - -//----------------------------------------------------------------------------- - -lex_item_t * AppendCannLEX ( lex_t * lex, bool overwrite ) -{ - return AppendElementLEX( lex, LEXS_CANN, CannonDataLEX, - sizeof(CannonDataLEX), overwrite); -} - -//----------------------------------------------------------------------------- - -lex_item_t * AppendHiptLEX ( lex_t * lex, bool overwrite ) -{ - return AppendElementLEX( lex, LEXS_HIPT, 0, 0, overwrite); -} - -//----------------------------------------------------------------------------- - -lex_item_t * AppendTestLEX ( lex_t * lex, bool overwrite ) -{ - return AppendElementLEX( lex, LEXS_TEST, TestDataLEX, - sizeof(TestDataLEX), overwrite); -} - -/////////////////////////////////////////////////////////////////////////////// - -void DumpElementsLEX ( FILE *f, lex_t *lex, bool hexdump ) -{ - DASSERT(f); - DASSERT(lex); - - fprintf(f,"LEX SECTIONS: %u/%u\n",lex->item_used,lex->item_size); - - uint i; - for ( i = 0; i < lex->item_used; i++ ) - { - lex_item_t *s = lex->item[i]; - const uint size = ntohl(s->elem.size); - fprintf(f," %-4.4s %08x, size: %5u = 0x%04x\n", - PrintID(&s->elem.magic,4,0), s->elem.magic, size, size ); - if ( size && hexdump ) - HexDump16(f,8,0,s->elem.data,size); - } -} - -// -/////////////////////////////////////////////////////////////////////////////// -/////////////// lex parser functions /////////////// -/////////////////////////////////////////////////////////////////////////////// - -static enumError F_isLEX -( - struct Var_t * res, // store result here - struct Var_t * param, // parameters, modified - uint n_param, // number of parameters - struct ScanInfo_t * si, // not NULL: use for error messages - const FuncParam_t * fpar // pointer to user parameter -) -{ - DASSERT(res); - DASSERT(param); - - uint result = 0; - if ( si && si->lex ) - { - result = 1; - - if (si->lex->fname) - { - ccp fname = strrchr(si->lex->fname,'/'); - if (fname) - fname++; - else - fname = si->lex->fname; - - if ( !strcasecmp(fname,"course.lex") - || !strcasecmp(fname,"course.txt") - || !strcasecmp(fname,"course.txt.lex") ) - { - result = 2; - } - } - } - - res->i = result; - res->mode = VAR_INT; - return ERR_OK; -} - -/////////////////////////////////////////////////////////////////////////////// - -static const struct FuncTable_t lex_func_tab[] = -{ - { 0, 0, "ISLEX", F_isLEX, 0, // replace only function call - "int", "isLEX()", 0 }, // but not info - - {0,0,0,0,0,0,0,0} -}; - -// -/////////////////////////////////////////////////////////////////////////////// -/////////////// setup lex parser /////////////// -/////////////////////////////////////////////////////////////////////////////// - -const VarMap_t * SetupVarsLEX() -{ - static VarMap_t vm = {0}; - if (!vm.used) - { - DefineMkwVars(&vm); - DefineParserFuncTab(lex_func_tab,FF_LEX); - DefineParserVars(&vm); - } - - return &vm; -} - -// -/////////////////////////////////////////////////////////////////////////////// -/////////////// ScanRawLEX() /////////////// -/////////////////////////////////////////////////////////////////////////////// - -enumError DumpLEXFunc - ( u32 magic, const u8 *data, uint size, cvp user_ptr, int user_int ) -{ - u32 m = htonl(magic); - printf(" %s 0x%08x, %5u = 0x%04x bytes\n", - PrintID(&m,4,0), magic, size, size ); - if ( user_int < 0 || user_int >= 0x10 ) - { - if ( user_int > 0 && size > user_int ) - size = user_int; - HexDump16(stdout,5,0,data,size); - putchar('\n'); - } - return ERR_OK; -} - -//----------------------------------------------------------------------------- - -enumError ScanLEXFunc - ( u32 magic, const u8 *data, uint size, cvp user_ptr, int user_int ) -{ - #if HAVE_PRINT - u32 m = htonl(magic); - PRINT(">>>>> %-4.4s %08x : size: %u = 0x%x\n", - PrintID(&m,4,0), magic, size, size ); - #endif - - lex_t *lex = (lex_t*)user_ptr; - DASSERT(lex); - - switch (magic) - { - case LEXS_TERMINATE: - case LEXS_IGNORE: - // ignore - break; - - default: - AppendElementLEX(lex,magic,data,size,true); - #if HAVE_PRINT0 - if (logging>1) - DumpElementsLEX(stdout,lex,logging>2); - #endif - } - return ERR_OK; -} - -//----------------------------------------------------------------------------- - -enumError ScanRawLEX -( - lex_t * lex, // LEX data structure - bool init_lex, // true: initialize 'lex' first - const void * data, // data to scan - uint data_size, // size of 'data' - uint dump_mode // 0: add element to lex->item - // 1: dump scanned elements - // >=0x10: add hexdump of max # bytes -) -{ - DASSERT(lex); - if (init_lex) - InitializeLEX(lex); - - if ( IsValidLEX(data,data_size,data_size,lex->fname) >= VALID_ERROR ) - { - return ERROR0(ERR_INVALID_DATA, - "Invalid LEX file: %s\n" - "Add option --lex=force or --force to ignore some validity checks.", - lex->fname ? lex->fname : "?" ); - } - - lex->fform = FF_LEX; - enumError err = ScanLexFile( data, data_size, - dump_mode ? DumpLEXFunc : ScanLEXFunc, lex, dump_mode ); - if (err) - ERROR0(err,"Scanning of LEX file failed: %s\n",lex->fname); - else - UpdateLEX(lex,opt_complete,false); - - if (logging>0) - DumpElementsLEX(stdout,lex,logging>2); - return err; -} - -// -/////////////////////////////////////////////////////////////////////////////// -/////////////// ScanTextLEX() /////////////// -/////////////////////////////////////////////////////////////////////////////// -// [[lex_section_id]] - -typedef enum lex_section_id -{ - LID_UNKNOWN, - LID_IGNORE, - LID_SETUP, - LID_HEXDUMP, - - LID_SETTINGS1, - LID_CANNON, - LID_HIDE_PT, - LID_TEST, -} -lex_section_id; - -/////////////////////////////////////////////////////////////////////////////// - -static const KeywordTab_t lex_section_name[] = -{ - //------------------------------------------------------------------------ - // ID NAME INFO unused - //------------------------------------------------------------------------ - - { LID_IGNORE, "END", "--", 0 }, - { LID_SETUP, "SETUP", "Setup", 0 }, - { LID_HEXDUMP, "HEXDUMP", "Hexdump of unknown section", 0 }, - - { LID_SETTINGS1, "SET1", "Basic settings", 0 }, - { LID_CANNON, "CANN", "Cannon settings", 0 }, - { LID_HIDE_PT, "HIPT", "Hide position tracker", 0 }, - { LID_TEST, "TEST", "Test case", 0 }, - - { 0,0,0,0 } -}; - -/////////////////////////////////////////////////////////////////////////////// - -static const KeywordTab_t lex_offline_online[] = -{ - { LEX_OO_AUTO, "AUTO", "0", 0 }, - { LEX_OO_OFFLINE, "OFFLINE", "1", 0 }, - { LEX_OO_OFFLINE, "NEVER", 0, 0 }, - { LEX_OO_ONLINE, "ONLINE", "2", 0 }, - { LEX_OO_ONLINE, "ALWAYS", 0, 0 }, - { -9, "OFF", "-1", -1 }, - { 0,0,0,0 } -}; - -/////////////////////////////////////////////////////////////////////////////// - -static const KeywordTab_t lex_game_mode[] = -{ - { LEX_GMODE_AUTO, "AUTO", "0", -1 }, - { LEX_GMODE_STD, "STANDARD", "1", KMP_GMODE_STD }, - { LEX_GMODE_STD, "STD", 0, KMP_GMODE_STD }, - { LEX_GMODE_BALLOON, "BALLOON", "2", KMP_GMODE_BALLOON }, - { LEX_GMODE_COIN, "COIN", "3", KMP_GMODE_COIN }, - { LEX_GMODE_VERSUS, "VERSUS", "4", KMP_GMODE_VERSUS }, - { LEX_GMODE_ITEMRAIN, "ITEMRAIN", "5", KMP_GMODE_ITEMRAIN }, - { -1, "OFF", "-1", -1 }, - { 0,0,0,0 } -}; - -/////////////////////////////////////////////////////////////////////////////// - -static const KeywordTab_t lex_engine[] = -{ - { LEX_ENGINE_AUTO, "AUTO", "0", -1 }, - { LEX_ENGINE_BATTLE, "BATTLE", 0, ENGINE_BATTLE }, - { LEX_ENGINE_50, "50CC", 0, ENGINE_50 }, - { LEX_ENGINE_100, "100CC", 0, ENGINE_100 }, - { LEX_ENGINE_150, "150CC", 0, ENGINE_150 }, - { LEX_ENGINE_200, "200CC", 0, ENGINE_200 }, - { LEX_ENGINE_150M, "150M", "150MIRROR", ENGINE_150M }, - { LEX_ENGINE_200M, "200M", "200MIRROR", ENGINE_200M }, - { -1, "OFF", "-1", -1 }, - { 0,0,0,0 } -}; - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -static enumError ScanLEXElementHexdump -( - lex_t * lex, // KMP data structure - ScanInfo_t * si // valid data -) -{ - DASSERT(lex); - DASSERT(si); - TRACE("ScanLEXElementHexdump()\n"); - - - //--- setup data - - u32 magic = LEXS_IGNORE; - ScanParam_t ptab[] = - { - { "MAGIC", SPM_U32, &magic, }, - {0} - }; - - char fb_buf[1000]; - FastBuf_t *fb = InitializeFastBuf(fb_buf,sizeof(fb_buf)); - - - //--- main loop - - for(;;) - { - char ch = NextCharSI(si,true); - if ( !ch || ch == '[' ) - break; - - if ( ch == '@' ) - ScanParamSI(si,ptab); - else - ScanHexlineSI(si,fb,true); - } - CheckLevelSI(si); - - if ( magic != LEXS_IGNORE || magic != LEXS_TERMINATE ) - AppendElementLEX(lex,magic,fb->buf,fb->ptr-fb->buf,true); - - ResetFastBuf(fb); - return ERR_OK; -} - -/////////////////////////////////////////////////////////////////////////////// - -static enumError ScanLEXElement_SET1 -( - lex_t * lex, // KMP data structure - ScanInfo_t * si // valid data -) -{ - DASSERT(lex); - DASSERT(si); - TRACE("ScanLEXElement_SET1()\n"); - - - //--- setup data - - lex_set1_t set1 = {0}; - - const ScanParam_t ptab[] = - { - { "ITEM-POS-FACTOR", SPM_FLOAT3_BE, &set1.item_factor }, - { "TEST1", SPM_U8, set1.test+0 }, - { "TEST2", SPM_U8, set1.test+1 }, - { "TEST3", SPM_U8, set1.test+2 }, - { "TEST4", SPM_U8, set1.test+3 }, - {0} - }; - - char fb_buf[1000]; - FastBuf_t *fb = InitializeFastBuf(fb_buf,sizeof(fb_buf)); - AppendFastBuf(fb,&set1,sizeof(set1)); - - - //--- main loop - - for(;;) - { - char ch = NextCharSI(si,true); - if ( !ch || ch == '[' ) - break; - - if ( ch == '@' ) - ScanParamSI(si,ptab); - else - ScanHexlineSI(si,fb,true); - } - CheckLevelSI(si); - - memcpy(fb->buf,&set1,sizeof(set1)); - HEXDUMP16(0,0,fb->buf,fb->ptr-fb->buf); - AppendElementLEX(lex,LEXS_SET1,fb->buf,fb->ptr-fb->buf,true); - - ResetFastBuf(fb); - return ERR_OK; -} - -/////////////////////////////////////////////////////////////////////////////// - -static enumError ScanLEXElement_CANN -( - lex_t * lex, // KMP data structure - ScanInfo_t * si // valid data -) -{ - DASSERT(lex); - DASSERT(si); - TRACE("ScanLEXElement_CANN()\n"); - - - //--- setup data - - ScanParam_t ptab[] = - { - {0} - }; - - char fb_buf[1000]; - FastBuf_t *fb = InitializeFastBuf(fb_buf,sizeof(fb_buf)); - AppendFastBuf(fb,EmptyString,4); - - - //--- main loop - - uint n_cannon = 0; - for(;;) - { - char ch = NextCharSI(si,true); - if ( !ch || ch == '[' ) - break; - - if ( ch == '@' ) - { - ScanParamSI(si,ptab); - continue; - } - - enumError err; - ScanIndexSI(si,&err,n_cannon,0,2); - if (err) - break; - - float f[4]; - ScanFloatSI(si,f,4); - - uint i; - u32 *fp = (u32*)f; - for ( i = 0; i < 4; i++, fp++ ) - *fp = htonl(*fp); - AppendFastBuf(fb,f,sizeof(f)); - n_cannon++; - CheckEolSI(si); - } - - if ( n_cannon > 0 ) - { - write_be32(fb->buf,n_cannon); - //HexDump16(stdout,0,0,fb->buf,fb->ptr-fb->buf); - AppendElementLEX(lex,LEXS_CANN,fb->buf,fb->ptr-fb->buf,true); - } - - ResetFastBuf(fb); - return ERR_OK; -} - -/////////////////////////////////////////////////////////////////////////////// - -static enumError ScanLEXElement_HIPT -( - lex_t * lex, // KMP data structure - ScanInfo_t * si // valid data -) -{ - DASSERT(lex); - DASSERT(si); - TRACE("ScanLEXElement_HIPT()\n"); - - - //--- setup data - - ScanParam_t ptab[] = - { - {0} - }; - - char fb_buf[1000]; - FastBuf_t *fb = InitializeFastBuf(fb_buf,sizeof(fb_buf)); - - - //--- main loop - - for(;;) - { - char ch = NextCharSI(si,true); - if ( !ch || ch == '[' ) - break; - - if ( ch == '@' ) - { - ScanParamSI(si,ptab); - continue; - } - - u8 num[sizeof(lex_hipt_rule_t)]; - ScanU8SI(si,num,sizeof(num),false); - AppendFastBuf(fb,num,sizeof(num)); - CheckEolSI(si); - } - - AppendElementLEX(lex,LEXS_HIPT,fb->buf,fb->ptr-fb->buf,true); - ResetFastBuf(fb); - - return ERR_OK; -} - -/////////////////////////////////////////////////////////////////////////////// - -static enumError ScanLEXElement_TEST -( - lex_t * lex, // KMP data structure - ScanInfo_t * si // valid data -) -{ - DASSERT(lex); - DASSERT(si); - TRACE("ScanLEXElement_TEST()\n"); - - - //--- setup data - - lex_test_t test; - memcpy(&test,TestDataLEX,sizeof(test)); - - const ScanParam_t ptab[] = - { - { "OFFLINE-ONLINE", SPM_U8, &test.offline_online }, - { "N-OFFLINE", SPM_U8, &test.n_offline }, - { "N-ONLINE", SPM_U8, &test.n_online }, - { "COND-BIT", SPM_S8, &test.cond_bit }, - { "GAME-MODE", SPM_U8, &test.game_mode }, - { "ENGINE", SPM_U8, &test.engine }, - { "RANDOM", SPM_U8, &test.random }, - {0} - }; - - char fb_buf[1000]; - FastBuf_t *fb = InitializeFastBuf(fb_buf,sizeof(fb_buf)); - AppendFastBuf(fb,&test,sizeof(test)); - - - //--- main loop - - for(;;) - { - char ch = NextCharSI(si,true); - if ( !ch || ch == '[' ) - break; - - if ( ch == '@' ) - ScanParamSI(si,ptab); - else - ScanHexlineSI(si,fb,true); - } - CheckLevelSI(si); - - memcpy(fb->buf,&test,sizeof(test)); - HEXDUMP16(0,0,fb->buf,fb->ptr-fb->buf); - AppendElementLEX(lex,LEXS_TEST,fb->buf,fb->ptr-fb->buf,true); - - ResetFastBuf(fb); - return ERR_OK; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -enumError ScanTextLEX -( - lex_t * lex, // LEX data structure - bool init_lex, // true: initialize 'lex' first - const void * data, // data to scan - uint data_size // size of 'data' -) -{ - PRINT("ScanTextLEX(init=%d)\n",init_lex); - - DASSERT(lex); - if (init_lex) - InitializeLEX(lex); - - ScanInfo_t si; - InitializeSI(&si,data,data_size,lex->fname,lex->revision); - si.predef = SetupVarsLEX(); - - enumError max_err = ERR_OK; - lex->is_pass2 = false; - - for(;;) - { - PRINT("----- SCAN LEX SECTIONS, PASS%u ...\n",lex->is_pass2+1); - - max_err = ERR_OK; - si.lex = lex; - si.no_warn = !lex->is_pass2; - si.total_err = 0; - DefineIntVar(&si.gvar, "$PASS", lex->is_pass2+1 ); - - for(;;) - { - char ch = NextCharSI(&si,true); - if (!ch) - break; - - if ( ch != '[' ) - { - NextLineSI(&si,true,false); - continue; - } - ResetLocalVarsSI(&si,lex->revision); - - si.cur_file->ptr++; - char sect_name[20]; - ScanNameSI(&si,sect_name,sizeof(sect_name),true,true,0); - PRINT0("--> pass=%u: #%04u: %s\n",lex->is_pass2+1,si.cur_file->line,sect_name); - - int abbrev_count; - const KeywordTab_t *cmd = ScanKeyword(&abbrev_count,sect_name,lex_section_name); - if ( !cmd || abbrev_count ) - continue; - NextLineSI(&si,false,false); - PRINT0("--> %-6s #%-4u |%.3s|\n",cmd->name1,si.cur_file->line,si.cur_file->ptr); - - enumError err = ERR_OK; - switch (cmd->id) - { - case LID_IGNORE: - // ignore it without warning - break; - - case LID_SETUP: - // nothing to do at the moment - break; - - case LID_HEXDUMP: - err = ScanLEXElementHexdump(lex,&si); - break; - - case LID_SETTINGS1: - err = ScanLEXElement_SET1(lex,&si); - break; - - case LID_CANNON: - err = ScanLEXElement_CANN(lex,&si); - break; - - case LID_HIDE_PT: - err = ScanLEXElement_HIPT(lex,&si); - break; - - case LID_TEST: - err = ScanLEXElement_TEST(lex,&si); - break; - - default: - err = ERROR0(ERR_WARNING,"Unknown section (ignored): %s\n",sect_name); - break; - } - - if ( max_err < err ) - max_err = err; - } - - if (lex->is_pass2) - break; - - lex->is_pass2 = true; - RestartSI(&si); - } - - ResetSI(&si); - - UpdateLEX(lex,opt_complete,false); - return max_err; -} - -// -/////////////////////////////////////////////////////////////////////////////// -/////////////// LEX: scan and load /////////////// -/////////////////////////////////////////////////////////////////////////////// - -enumError ScanLEX -( - lex_t * lex, // LEX data structure - bool init_lex, // true: initialize 'lex' first - const void * data, // data to scan - uint data_size // size of 'data' -) -{ - DASSERT(lex); - PRINT("ScanLEX() size=%u\n",data_size); - HEXDUMP16(0,0,data,16); - - enumError err; -// [[analyse-magic]] - switch (GetByMagicFF(data,data_size,data_size)) - { - case FF_LEX: - lex->fform = FF_LEX; - err = ScanRawLEX(lex,init_lex,data,data_size,0); - break; - - case FF_LEX_TXT: - lex->fform = FF_LEX_TXT; - err = ScanTextLEX(lex,init_lex,data,data_size); - break; - - default: - if (init_lex) - InitializeLEX(lex); - return ERROR0(ERR_INVALID_DATA, - "No LEX file: %s\n", lex->fname ? lex->fname : "?"); - } - - PatchLEX(lex); - return err; -} - -/////////////////////////////////////////////////////////////////////////////// - -enumError ScanRawDataLEX -( - lex_t * lex, // LEX data structure - bool init_lex, // true: initialize 'lex' first - struct raw_data_t * raw // valid raw data -) -{ - DASSERT(lex); - DASSERT(raw); - if (init_lex) - InitializeLEX(lex); - else - ResetLEX(lex); - - lex->fatt = raw->fatt; - lex->fname = raw->fname; - raw->fname = 0; - - return raw->is_0 ? ERR_OK : ScanLEX(lex,false,raw->data,raw->data_size); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -enumError LoadLEX -( - lex_t * lex, // LEX data structure - bool init_lex, // true: initialize 'lex' first - ccp fname, // valid pointer to filenname - bool ignore_no_file // ignore if file does not exists - // and return warning ERR_NOT_EXISTS -) -{ - DASSERT(lex); - DASSERT(fname); - if (init_lex) - InitializeLEX(lex); - else - ResetLEX(lex); - - //--- load and scan data - - raw_data_t raw; - enumError err = LoadRawData(&raw,true,fname,0,ignore_no_file,0); - if (!err) - { - lex->fname = raw.fname; - raw.fname = 0; - err = ScanLEX(lex,false,raw.data,raw.data_size); - } - - ResetRawData(&raw); - return err; -} - -// -/////////////////////////////////////////////////////////////////////////////// -/////////////// CreateRawLEX() /////////////// -/////////////////////////////////////////////////////////////////////////////// - -enumError CreateRawLEX -( - lex_t * lex // pointer to valid LEX -) -{ - DASSERT(lex); - if (lex->raw_data) - FREE(lex->raw_data); - - uint total_size = sizeof(lex_header_t) + sizeof(lex_element_t); // final term! - - uint i; - for ( i = 0; i < lex->item_used; i++ ) - { - lex_item_t *s = lex->item[i]; - total_size += sizeof(lex_element_t) + ntohl(s->elem.size); - } - - lex->raw_data = MALLOC(total_size); - lex->raw_data_size = total_size; - - lex_header_t *hd = (lex_header_t*)lex->raw_data; - memcpy(hd->magic,LEX_BIN_MAGIC,sizeof(hd->magic)); - hd->major_version = htons(LEX_MAJOR_VERSION); - hd->minor_version = htons(LEX_MINOR_VERSION); - hd->size = htonl(total_size); - hd->element_off = htonl(sizeof(lex_header_t)); - - u8 *dest = lex->raw_data + sizeof(lex_header_t); - for ( i = 0; i < lex->item_used; i++ ) - { - lex_item_t *s = lex->item[i]; - const uint size = sizeof(lex_element_t) + ntohl(s->elem.size); - ASSERT ( dest + size < lex->raw_data + lex->raw_data_size ); - memcpy(dest,&s->elem,size); - dest += size; - } - ASSERT ( dest + sizeof(lex_element_t) == lex->raw_data + lex->raw_data_size ); - memset(dest,0,sizeof(lex_element_t)); - - return ERR_OK; -} - -// -/////////////////////////////////////////////////////////////////////////////// -/////////////// SaveRawLEX() /////////////// -/////////////////////////////////////////////////////////////////////////////// - -enumError SaveRawLEX -( - lex_t * lex, // pointer to valid LEX - ccp fname, // filename of destination - bool set_time // true: set time stamps -) -{ - DASSERT(lex); - DASSERT(fname); - PRINT("SaveRawLEX(%s,%d)\n",fname,set_time); - - //--- create raw data - - enumError err = CreateRawLEX(lex); - if (err) - return err; - DASSERT(lex->raw_data); - DASSERT(lex->raw_data_size); - - - //--- write to file - - File_t F; - err = CreateFileOpt(&F,true,fname,testmode,lex->fname); - if ( err > ERR_WARNING || !F.f ) - return err; - SetFileAttrib(&F.fatt,&lex->fatt,0); - - if ( fwrite(lex->raw_data,1,lex->raw_data_size,F.f) != lex->raw_data_size ) - FILEERROR1(&F,ERR_WRITE_FAILED,"Write failed: %s\n",fname); - return ResetFile(&F,set_time); -} - -// -/////////////////////////////////////////////////////////////////////////////// -/////////////// SaveTextLEX() /////////////// -/////////////////////////////////////////////////////////////////////////////// - -static enumError SaveTextLEX_SET1 -( - FILE * f, // file to write - const lex_t * lex, // pointer to valid LEX - lex_item_t * item // item to save -) -{ - DASSERT(f); - DASSERT(lex); - DASSERT(item); - - const uint size = ntohl(item->elem.size); - noPRINT("SaveTextLEX_SET1(), size=%u\n",size); - DASSERT( size >= sizeof(lex_set1_t) ); - if ( size < sizeof(lex_set1_t)) - return ERR_OK; - - const u8 *data = item->elem.data; - const lex_set1_t *set1 = (lex_set1_t*)data; - - fprintf(f,text_lex_elem_set1_cr - ,item->sort_order - ,bef4(&set1->item_factor.x) - ,bef4(&set1->item_factor.y) - ,bef4(&set1->item_factor.z) - ); - - if (*(u32*)set1->test) - fprintf(f,text_lex_elem_set1_develop_cr - ,set1->test[0],set1->test[1],set1->test[2],set1->test[3] - ); - - if ( size > sizeof(lex_set1_t) ) - { - fputs("\n# Hex dump for unknown settings:\n",f); - HexDump(f,0,sizeof(lex_set1_t),5,16, - item->elem.data + sizeof(lex_set1_t), - size - sizeof(lex_set1_t) ); - } - - return ERR_OK; -} - -/////////////////////////////////////////////////////////////////////////////// - -static enumError SaveTextLEX_CANN -( - FILE * f, // file to write - const lex_t * lex, // pointer to valid LEX - lex_item_t * item // item to save -) -{ - DASSERT(f); - DASSERT(lex); - DASSERT(item); - - fprintf(f,text_lex_elem_cann_cr,item->sort_order); - if ( item->elem.size < 4 + 16 ) - return ERR_OK; - - const u8 *data = item->elem.data; - uint n = be32(data); - uint max = ( ntohl(item->elem.size) - 4 ) / 16; - if ( n > max ) - n = max; - - uint i, off = 4; - for ( i = 0; i < n; i++, off += 16 ) - fprintf(f,"%4u %10.3f %10.3f %10.3f %10.3f\r\n", - i, bef4(data+off), bef4(data+off+4), - bef4(data+off+8), bef4(data+off+12) ); - - return ERR_OK; -} - -/////////////////////////////////////////////////////////////////////////////// - -static enumError SaveTextLEX_HIPT -( - FILE * f, // file to write - const lex_t * lex, // pointer to valid LEX - lex_item_t * item // item to save -) -{ - DASSERT(f); - DASSERT(lex); - DASSERT(item); - - fprintf(f,text_lex_elem_hipt_cr,item->sort_order); - if ( item->elem.size < 4 + 16 ) - return ERR_OK; - - const lex_hipt_rule_t *rule = (lex_hipt_rule_t*)item->elem.data; - int n = ntohl(item->elem.size) / sizeof(*rule) ; - - int i, last_lap = 1000; - for ( i = 0; i < n; i++, rule++ ) - { - if ( last_lap != rule->lap ) - { - last_lap = rule->lap; - fputs("\r\n",f); - } - - fprintf(f,"%5u %4d %4u %4u %4u\r\n", - rule->cond, rule->lap, rule->from, rule->to, rule->mode ); - } - - return ERR_OK; -} - -/////////////////////////////////////////////////////////////////////////////// - -static enumError SaveTextLEX_TEST -( - FILE * f, // file to write - const lex_t * lex, // pointer to valid LEX - lex_item_t * item // item to save -) -{ - DASSERT(f); - DASSERT(lex); - DASSERT(item); - - const uint size = ntohl(item->elem.size); - PRINT("SaveTextLEX_TEST(), size=%u\n",size); - DASSERT( size >= sizeof(lex_test_t) ); - if ( size < sizeof(lex_test_t)) - return ERR_OK; - - const u8 *data = item->elem.data; - const lex_test_t *test = (lex_test_t*)data; - - const KeywordTab_t *off_on; - for ( off_on = lex_offline_online; off_on->name1; off_on++ ) - if ( off_on->id == test->offline_online && off_on->opt >= 0 ) - break; - - const KeywordTab_t *gmode; - for ( gmode = lex_game_mode; gmode->name1; gmode++ ) - if ( gmode->id == test->game_mode && gmode->opt >= 0 ) - break; - - const KeywordTab_t *engine; - for ( engine = lex_engine; engine->name1; engine++ ) - if ( engine->id == test->engine && engine->opt >= 0 ) - break; - - fprintf(f,text_lex_elem_test_cr - ,item->sort_order - ,off_on->name1 ? off_on->name1 : "AUTO" - ,test->n_offline - ,test->n_online - ,test->cond_bit - ,gmode->name1 ? gmode->name1 : "AUTO" - ,engine->name1 ? engine->name1 : "AUTO" - ,test->random - ); - - if ( size > sizeof(lex_test_t) ) - { - fputs("\n# Hex dump for unknown settings:\n",f); - HexDump(f,0,sizeof(lex_test_t),5,16, - item->elem.data + sizeof(lex_test_t), - size - sizeof(lex_test_t) ); - } - - return ERR_OK; -} - -/////////////////////////////////////////////////////////////////////////////// - -enumError SaveTextLEX -( - const lex_t * lex, // pointer to valid LEX - ccp fname, // filename of destination - bool set_time // true: set time stamps -) -{ - // use DOS/Windows line format -> unix can handle it ;) - - DASSERT(lex); - DASSERT(fname); - PRINT("SaveTextLEX(%s,%d)\n",fname,set_time); - - - //--- open file - - File_t F; - enumError err = CreateFileOpt(&F,true,fname,testmode,lex->fname); - if ( err > ERR_WARNING || !F.f ) - return err; - SetFileAttrib(&F.fatt,&lex->fatt,0); - - - //--- print header + syntax info - - if ( print_header && !brief_count && !export_count ) - fprintf(F.f,text_lex_head_cr); - else - fprintf(F.f, - "%s\r\n" - "# LEX syntax & semantics: https://szs.wiimm.de/info/lex-syntax.html\r\n" - ,LEX_TEXT_MAGIC); - - - //--- print info section & section counter alphabetically - - if ( brief_count || export_count ) - { - fprintf(F.f, - "%s[SETUP]\r\n\r\n" - "TOOL = %s\r\n" - "SYSTEM2 = %s\r\n" - "VERSION = %s\r\n" - "REVISION = %u\r\n" - "DATE = %s\r\n" - "\r\n", - section_sep, - tool_name, SYSTEM2, VERSION, REVISION_NUM, DATE ); - } - else - { - fprintf(F.f, text_lex_setup_cr, - tool_name, SYSTEM2, VERSION, REVISION_NUM, DATE ); - - uint i; - for ( i = 0; i < lex->item_used; i++ ) - { - lex_item_t *s = lex->item[i]; - const uint size = ntohl(s->elem.size); - fprintf(F.f,"# %-4.4s %08x, 0x%04x bytes\r\n", - PrintID(&s->elem.magic,4,0), s->elem.magic, size ); - } - } - - enumError max_err = ERR_OK; - - uint i; - for ( i = 0; i < lex->item_used; i++ ) - { - lex_item_t *s = lex->item[i]; - const uint size = ntohl(s->elem.size); - const u32 magic = ntohl(s->elem.magic); - enumError err = ERR_OK; - switch(magic) - { - case LEXS_SET1: - err = SaveTextLEX_SET1(F.f,lex,s); - break; - - case LEXS_CANN: - err = SaveTextLEX_CANN(F.f,lex,s); - break; - - case LEXS_HIPT: - err = SaveTextLEX_HIPT(F.f,lex,s); - break; - - case LEXS_TEST: - err = SaveTextLEX_TEST(F.f,lex,s); - break; - - default: - hexdump_eol = "\r\n"; - fprintf(F.f,text_lex_hexdump_cr, - s->sort_order, magic, PrintID(&s->elem.magic,4,0) ); - HexDump(F.f,0,0,5,16,s->elem.data,size); - break; - } - - if ( max_err < err ) - max_err = err; - } - - fputs(section_end,F.f); - ResetFile(&F,set_time); - return max_err; -} - -// -/////////////////////////////////////////////////////////////////////////////// -/////////////// LEX options /////////////// -/////////////////////////////////////////////////////////////////////////////// - -bool opt_lex_purge = false; -bool force_lex_test = false; -bool opt_lt_clear = false; -int opt_lt_online = -9; -int opt_lt_n_offline = -9; -int opt_lt_n_online = -9; -int opt_lt_cond_bit = -9; -int opt_lt_game_mode = -9; -int opt_lt_engine = -9; -int opt_lt_random = -9; - -//----------------------------------------------------------------------------- - -int ScanOptLtOnline ( ccp arg ) -{ - if ( !arg || !*arg ) - opt_lt_online = -9; - else - { - int abbrev; - const KeywordTab_t *key = ScanKeyword(&abbrev,arg,lex_offline_online); - if (!key) - { - PrintKeywordError(lex_offline_online,arg,abbrev,0, - "keyword for option --lt-online"); - return 1; - } - opt_lt_online = key->id; - } - return 0; -} - -//----------------------------------------------------------------------------- - -int ScanOptLtNPlayers ( ccp arg ) -{ - if ( !arg || !*arg ) - opt_lt_n_offline = opt_lt_n_online = -9; - else - { - ccp comma = strchr(arg,','); - if (comma) - { - opt_lt_n_offline = str2l(arg,0,10); - opt_lt_n_online = str2l(comma+1,0,10); - } - else - { - int n = str2l(arg,0,10); - if ( n > 4 ) - { - opt_lt_n_offline = -9; - opt_lt_n_online = n; - } - else - { - opt_lt_n_offline = n; - opt_lt_n_online = -9; - } - } - - if ( opt_lt_n_offline < 0 ) - opt_lt_n_offline = -9; - else if ( opt_lt_n_offline > 4 ) - opt_lt_n_offline = 4; - - if ( opt_lt_n_online < 0 ) - opt_lt_n_online = -9; - else if ( opt_lt_n_online > 99 ) - opt_lt_n_online = 99; - } - - return 0; -} - -//----------------------------------------------------------------------------- - -int ScanOptLtCondBit ( ccp arg ) -{ - if ( !arg || !*arg ) - opt_lt_cond_bit = -9; - else - { - int n = str2l(arg,0,10); - opt_lt_cond_bit = n < -1 || n >= 16 ? -9 : n; - } - return 0; -} - -//----------------------------------------------------------------------------- - -int ScanOptLtGameMode ( ccp arg ) -{ - if ( !arg || !*arg ) - opt_lt_game_mode = -1; - else - { - int abbrev; - const KeywordTab_t *key = ScanKeyword(&abbrev,arg,lex_game_mode); - if (!key) - { - PrintKeywordError(lex_game_mode,arg,abbrev,0, - "keyword for option --lt-game-mode"); - return 1; - } - opt_lt_game_mode = key->id; - } - return 0; -} - -//----------------------------------------------------------------------------- - -int ScanOptLtEngine ( ccp arg ) -{ - if ( !arg || !*arg ) - opt_lt_engine = -1; - else - { - int abbrev; - const KeywordTab_t *key = ScanKeyword(&abbrev,arg,lex_engine); - if (!key) - { - PrintKeywordError(lex_engine,arg,abbrev,0, - "keyword for option --lt-engine"); - return 1; - } - opt_lt_engine = key->id; - } - return 0; -} - -//----------------------------------------------------------------------------- - -int ScanOptLtRandom ( ccp arg ) -{ - if ( !arg || !*arg ) - opt_lt_random = -1; - else - { - int n = str2l(arg,0,10); - opt_lt_random = n < 0 || n > 6 ? -9 : n; - } - return 0; -} - -// -/////////////////////////////////////////////////////////////////////////////// -/////////////// lex_info_t /////////////// -/////////////////////////////////////////////////////////////////////////////// - -void SetupLexInfo ( lex_info_t *info, const lex_t *lex ) -{ - DASSERT(info); - InitializeLexInfo(info); - - if (lex) - { - info->lex_found = true; - lex_item_t *item; - - item = FindElementLEX(lex,LEXS_SET1); - if (item) - { - info->set1_found = true; - memcpy(&info->set1,item->elem.data,sizeof(info->set1)); - bef4n(info->set1.item_factor.v,info->set1.item_factor.v,3); - } - - item = FindElementLEX(lex,LEXS_TEST); - if (item) - { - info->test_found = true; - memcpy(&info->test,item->elem.data,sizeof(info->test)); - } - } -} - -/////////////////////////////////////////////////////////////////////////////// - -enumError SetupLexInfoByData ( lex_info_t *info, cvp data, uint data_size ) -{ - lex_t lex; - const enumError err = ScanLEX(&lex,true,data,data_size); - if (!err) - SetupLexInfo(info,&lex); - else - InitializeLexInfo(info); - ResetLEX(&lex); - return err; -} - -// -/////////////////////////////////////////////////////////////////////////////// -/////////////// LEX patching /////////////// -/////////////////////////////////////////////////////////////////////////////// - -// return TRUE if any option set -bool HavePatchTestLEX() -{ - return force_lex_test - || opt_lt_clear - || opt_lt_online >= 0 - || opt_lt_n_offline >= 0 - || opt_lt_n_online >= 0 - || opt_lt_game_mode >= 0 - || opt_lt_engine >= 0 - || opt_lt_random >= 0; -} - - -//----------------------------------------------------------------------------- - -// return TRUE if any option set and not default -bool HaveActivePatchTestLEX() -{ - return force_lex_test - || opt_lt_online > 0 - || opt_lt_n_offline > 0 - || opt_lt_n_online > 0 - || opt_lt_game_mode > LEX_GMODE_AUTO - || opt_lt_engine > LEX_ENGINE_AUTO - || opt_lt_random >= 0; -} - -//----------------------------------------------------------------------------- - -// return TRUE if modified / set optional 'empty' to true, if test section is empty -bool PatchTestLEX ( lex_test_t *lt, bool *empty ) -{ - DASSERT(lt); - PRINT0("--lt-*: clear=%d, online=%d, n=%d,%d, gm=%d, en=%d, rnd=%d\n", - opt_lt_clear, opt_lt_online, opt_lt_n_offline, opt_lt_n_online, - opt_lt_game_mode, opt_lt_engine, opt_lt_random ); - - lex_test_t temp; - memcpy( &temp, opt_lt_clear ? (lex_test_t*)&TestDataLEX : lt, sizeof(temp) ); - - if ( opt_lt_online >= LEX_OO_AUTO && opt_lt_online <= LEX_OO_ONLINE ) - temp.offline_online = opt_lt_online; - - if ( opt_lt_n_offline >= 0 ) - temp.n_offline = opt_lt_n_offline > 4 ? 4 : opt_lt_n_offline; - - if ( opt_lt_n_online >= 0 ) - temp.n_online = opt_lt_n_online > 99 ? 99 : opt_lt_n_online; - - if ( opt_lt_cond_bit >= -1 && opt_lt_cond_bit < 16 ) - temp.cond_bit = opt_lt_cond_bit; - - if ( opt_lt_game_mode >= 0 ) - temp.game_mode = opt_lt_game_mode; - - if ( opt_lt_engine >= 0 ) - temp.engine = opt_lt_engine; - - if ( opt_lt_random >= 0 ) - temp.random = opt_lt_random; - - if (empty) - *empty = !memcmp(&temp,&TestDataLEX,sizeof(temp)); - if (memcmp(lt,&temp,sizeof(*lt))) - { - memcpy(lt,&temp,sizeof(*lt)); - return true; - } - - return false; -} - -//----------------------------------------------------------------------------- - -bool PatchLEX ( lex_t * lex ) -{ - DASSERT(lex); - - bool modified = false; - if (HavePatchTestLEX()) - { - lex_item_t *li = FindElementLEX(lex,LEXS_TEST); - const bool had_test = li != 0; - if (!had_test) - { - if (!HaveActivePatchTestLEX()) - return 0; - li = AppendTestLEX(lex,false); - } - DASSERT(li); - lex_test_t orig; - memcpy(&orig,li->elem.data,sizeof(orig)); - - bool empty; - modified = PatchTestLEX((lex_test_t*)li->elem.data,&empty); - PRINT("PATCH+ LEX/TEST: had=%d, empty=%d, modified=%d => have_lex:%x\n", - had_test, empty, modified, lex->have_lex ); - if ( empty && !force_lex_test ) - { - if ( RemoveElementLEX(lex,li) && had_test ) - modified = true; - } - else if (!had_test) - modified = true; - - PRINT("PATCH- LEX/TEST: had=%d, empty=%d, modified=%d => have_lex:%x\n", - had_test, empty, modified, lex->have_lex ); - - if (modified) - lex->modified = true; - } - - if (opt_lex_purge) - modified |= PurgeLEX(lex); - - return modified; -} - -// -/////////////////////////////////////////////////////////////////////////////// -/////////////// LEX purging /////////////// -/////////////////////////////////////////////////////////////////////////////// - -bool PurgeLEX ( lex_t * lex ) -{ - DASSERT(lex); - - bool modified = false; - - uint i = 0; - while ( i < lex->item_used ) - { - lex_item_t **ss = lex->item+i; - const uint size = ntohl((*ss)->elem.size); - const u8 *data = (*ss)->elem.data; - - bool remove = false; - switch(ntohl((*ss)->elem.magic)) - { - case LEXS_SET1: - { - lex_set1_t set1; - memset(&set1,0,sizeof(set1)); - FixLEXElement_SET1(&set1); - remove = !memcmp(data,&set1,sizeof(set1)); - } - break; - - case LEXS_CANN: - remove = size <= sizeof(CannonDataLEX) - && !memcmp(data,&CannonDataLEX,size); - break; - - case LEXS_HIPT: - remove = size < sizeof(lex_hipt_rule_t); - break; - - case LEXS_TEST: - remove = !memcmp(data,TestDataLEX,sizeof(TestDataLEX)); - break; - - default: - remove = true; - break; - } - - if (remove) - modified |= RemoveElementLEX(lex,*ss); - else - i++; - } - - if (modified) - UpdateHaveLex(lex); - - return modified; -} - -// -/////////////////////////////////////////////////////////////////////////////// /////////////// END /////////////// /////////////////////////////////////////////////////////////////////////////// diff --git a/project/src/lib-lecode.h b/project/src/lib-lecode.h index b480166..edb1630 100644 --- a/project/src/lib-lecode.h +++ b/project/src/lib-lecode.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -543,358 +543,6 @@ void PatchLPAR ( le_lpar_t * lp ); // /////////////////////////////////////////////////////////////////////////////// -/////////////// lecode extension LEX /////////////// -/////////////////////////////////////////////////////////////////////////////// - -#define LEX_MAJOR_VERSION 1 -#define LEX_MINOR_VERSION 0 - -#define LEX_BIN_MAGIC "LE-X" -#define LEX_BIN_MAGIC_NUM 0x4c452d58 -#define LEX_TEXT_MAGIC "#LEX" -#define LEX_TEXT_MAGIC_NUM 0x234c4558 - -/////////////////////////////////////////////////////////////////////////////// -// [[have_lex_t]] -// order is important, compare have_lex_info[] and ct.wiimm.de - -typedef enum have_lex_t -{ - HAVELEX_SET1, - HAVELEX_CANN, - HAVELEX_TEST, - HAVELEX_HIPT, - //--- add new elements here (order is important) - HAVELEX__N -} -have_lex_t; - -//----------------------------------------------------------------------------- -// [[lex_stream_id]] - -typedef enum lex_stream_id -{ - LEXS_TERMINATE = 0, // terminate stream - LEXS_IGNORE = 0x2d2d2d2d, // "----" ignore and remove - - LEXS_SET1 = 0x53455431, // "SET1" primary settings - LEXS_CANN = 0x43414e4e, // "CANN" cannon settings - LEXS_HIPT = 0x48495054, // "HIPT" hide position tracker - LEXS_TEST = 0x54455354, // "TEST" settings for tests -} -lex_stream_id; - -//----------------------------------------------------------------------------- -// [[have_lex_info_t]] - -typedef struct have_lex_info_t -{ - lex_stream_id magic; // section magic - ccp name; // info name - uint min_size; // minimal size for 'is available' -} -have_lex_info_t; - -extern const have_lex_info_t have_lex_info[HAVELEX__N]; - -//----------------------------------------------------------------------------- -// [[lex_header_t]] - -typedef struct lex_header_t -{ - char magic[4]; // always LEX_BIN_MAGIC - u16 major_version; // usually LEX_MAJOR_VERSION - u16 minor_version; // usually LEX_MINOR_VERSION - u32 size; // size of this file (header+streams) - u32 element_off; // offset of first lex_element_t, 32-bit aligned -} -__attribute__ ((packed)) lex_header_t; - -//----------------------------------------------------------------------------- -// [[lex_element_t]] - -typedef struct lex_element_t -{ - u32 magic; // identification of section - u32 size; // size of 'data' (this header excluded) - u8 data[]; // section data, 32-bit aligned -} -__attribute__ ((packed)) lex_element_t; - -//----------------------------------------------------------------------------- -// [[lex_set1_t]] - -typedef struct lex_set1_t -{ - float3 item_factor; // factor for item positions, always >=1.0 - u8 test[4]; // 4 test values (TEST1..TEST4) -} -__attribute__ ((packed,aligned(4))) lex_set1_t; - -//----------------------------------------------------------------------------- -// [[lex_hipt_rule_t]] - -typedef struct lex_hipt_rule_t -{ - u8 cond; // condition bits: 1:offline, 2:online - s8 lap; // compare lap index with this. 99=all laps - u8 from; // compare CHKT >= from - u8 to; // && CHKT <= to - u8 mode; // result: 0=hide, 1:show -} -__attribute__ ((packed)) lex_hipt_rule_t; - -//----------------------------------------------------------------------------- -// [[lex_test_t]] - -typedef struct lex_test_t -{ - u8 offline_online; // 1: assume offline / 2: assume online - u8 n_offline; // >0: assume # offline humans at Wii - u8 n_online; // >0: assume # players total if playing online - s8 cond_bit; // >=0: use bit # for CONDITIONS - u8 game_mode; // one of LEX_GMODE_* - u8 random; // 1..6: force random scenario - u8 engine; // >=0: force engine := kmp_engine_t+1 - u8 padding; -} -__attribute__ ((packed,aligned(4))) lex_test_t; - -/////////////////////////////////////////////////////////////////////////////// - -typedef enumError (*lex_stream_func) - ( u32 magic, const u8 *data, uint size, cvp user_ptr, int user_int ); - -enumError ScanLexFile - ( cvp data, uint data_size, lex_stream_func func, cvp user_ptr, int user_int ); -enumError ScanLexElements - ( cvp data, uint data_size, lex_stream_func func, cvp user_ptr, int user_int ); - -lex_element_t * FindLexElement ( lex_header_t *head, uint data_size, u32 magic ); - -// -/////////////////////////////////////////////////////////////////////////////// -/////////////// lex_t /////////////// -/////////////////////////////////////////////////////////////////////////////// -// [[lex_item_t]] - -typedef struct lex_item_t -{ - uint sort_order; // sort priority, lesser comes first - uint insert_order; // second sort priority - - // always last element because of various size!! - lex_element_t elem; // raw element data, big endian -} -lex_item_t; - -/////////////////////////////////////////////////////////////////////////////// -// [[lex_t]] - -typedef struct lex_t -{ - //--- base info - - ccp fname; // alloced filename of loaded file - FileAttrib_t fatt; // file attribute - file_format_t fform; // FF_LEX | FF_LEX_TXT - bool develop; // true: enable developer mode - bool modified; // true: modified after loading - - - //--- sections - - uint item_used; // number of used items - uint item_size; // number of alloced items - lex_item_t **item; // NULL or item list (alloced) - uint have_lex; // status vector about found sections - - - //--- parser helpers - - int revision; // tool revision - bool is_pass2; // true: LEX compiler runs pass2 - - - //--- raw data, created by CreateRawLEX() - - u8 * raw_data; // NULL or data - uint raw_data_size; // size of 'raw_data' -} -lex_t; - -// -/////////////////////////////////////////////////////////////////////////////// -/////////////// LEX interface /////////////// -/////////////////////////////////////////////////////////////////////////////// - -void InitializeLEX ( lex_t * lex ); -void ResetLEX ( lex_t * lex ); -void UpdateLEX ( lex_t * lex, bool add_missing, bool add_test ); - -lex_item_t * AppendSet1LEX ( lex_t * lex, bool overwrite ); -lex_item_t * AppendCannLEX ( lex_t * lex, bool overwrite ); -lex_item_t * AppendHiptLEX ( lex_t * lex, bool overwrite ); -lex_item_t * AppendTestLEX ( lex_t * lex, bool overwrite ); - -const VarMap_t * SetupVarsLEX(); - -void DumpElementsLEX ( FILE *f, lex_t *lex, bool hexdump ); - -ccp CreateSectionInfoLEX - ( have_lex_t special, bool add_value, ccp return_if_empty ); - -static inline bool IsLexFF ( file_format_t fform ) - { return fform == FF_LEX || fform == FF_LEX_TXT; } - -/////////////////////////////////////////////////////////////////////////////// - -enumError ScanRawLEX -( - lex_t * lex, // LEX data structure - bool init_lex, // true: initialize 'lex' first - const void * data, // data to scan - uint data_size, // size of 'data' - uint dump_mode // 0: add element to lex->sect - // 1: dump scanned elements - // >=0x10: add hexdump of max # bytes -); - -//----------------------------------------------------------------------------- - -enumError ScanTextLEX -( - lex_t * lex, // LEX data structure - bool init_lex, // true: initialize 'lex' first - const void * data, // data to scan - uint data_size // size of 'data' -); - -//----------------------------------------------------------------------------- - -enumError ScanLEX -( - lex_t * lex, // LEX data structure - bool init_lex, // true: initialize 'lex' first - const void * data, // data to scan - uint data_size // size of 'data' -); - -//----------------------------------------------------------------------------- - -enumError ScanRawDataLEX -( - lex_t * lex, // LEX data structure - bool init_lex, // true: initialize 'lex' first - struct raw_data_t * raw // valid raw data -); - -/////////////////////////////////////////////////////////////////////////////// - -enumError LoadLEX -( - lex_t * lex, // LEX data structure - bool init_lex, // true: initialize 'lex' first - ccp fname, // valid pointer to filenname - bool ignore_no_file // ignore if file does not exists - // and return warning ERR_NOT_EXISTS -); - -//----------------------------------------------------------------------------- - -enumError CreateRawLEX -( - lex_t * lex // pointer to valid LEX -); - -//----------------------------------------------------------------------------- - -enumError SaveRawLEX -( - lex_t * lex, // pointer to valid LEX - ccp fname, // filename of destination - bool set_time // true: set time stamps -); - -//----------------------------------------------------------------------------- - -enumError SaveTextLEX -( - const lex_t * lex, // pointer to valid LEX - ccp fname, // filename of destination - bool set_time // true: set time stamps -); - -// -/////////////////////////////////////////////////////////////////////////////// -/////////////// lex_info_t /////////////// -/////////////////////////////////////////////////////////////////////////////// -// [[lex_info_t]] - -typedef struct lex_info_t -{ - bool lex_found; // true: LEX file found - - bool set1_found; // true: section SET1 found - lex_set1_t set1; // data of section SET1 - - bool test_found; // true: section TEST found - lex_set1_t test; // data of section TEST -} -lex_info_t; - -/////////////////////////////////////////////////////////////////////////////// - -static inline void InitializeLexInfo ( lex_info_t *info ) - { DASSERT(info); memset(info,0,sizeof(*info)); } - -static inline void ResetLexInfo ( lex_info_t *info ) - { if (info) memset(info,0,sizeof(*info)); } - -void SetupLexInfo ( lex_info_t *info, const lex_t *lex ); -enumError SetupLexInfoByData ( lex_info_t *info, cvp data, uint data_size ); - -// -/////////////////////////////////////////////////////////////////////////////// -/////////////// LEX patching /////////////// -/////////////////////////////////////////////////////////////////////////////// - -extern bool opt_lex_purge; -extern bool force_lex_test; -extern bool opt_lt_clear; -extern int opt_lt_online; -extern int opt_lt_n_offline; -extern int opt_lt_n_online; -extern int opt_lt_itemrain; - -int ScanOptLtOnline ( ccp arg ); -int ScanOptLtNPlayers ( ccp arg ); -int ScanOptLtCondBit ( ccp arg ); -int ScanOptLtGameMode ( ccp arg ); -int ScanOptLtEngine ( ccp arg ); -int ScanOptLtRandom ( ccp arg ); - -// return TRUE if any option set -bool HavePatchTestLEX(); -bool HaveActivePatchTestLEX(); -static inline bool HavePatchLEX() - { return opt_lex_purge || HavePatchTestLEX(); } -static inline bool HaveActivePatchLEX() - { return opt_lex_purge || HaveActivePatchTestLEX(); } - -// return TRUE if modified / set optional 'empty' to true, if test section is empty -bool PatchTestLEX ( lex_test_t *lt, bool *empty ); -bool PatchLEX ( lex_t *lex ); -bool PurgeLEX ( lex_t *lex ); - -struct szs_norm_t; -void AddTestLEX ( struct szs_file_t *szs, struct szs_norm_t *norm ); - -bool LEX_ACTION_LOG ( bool is_patch, const char * format, ... ) - __attribute__ ((__format__(__printf__,2,3))); - -// -/////////////////////////////////////////////////////////////////////////////// /////////////// misc /////////////// /////////////////////////////////////////////////////////////////////////////// diff --git a/project/src/lib-lex.c b/project/src/lib-lex.c new file mode 100644 index 0000000..357e062 --- /dev/null +++ b/project/src/lib-lex.c @@ -0,0 +1,2952 @@ + +/*************************************************************************** + * _______ _______ _______ * + * | ___ |____ | ___ | * + * | | |_| / /| | |_| * + * | |_____ / / | |_____ * + * |_____ | / / |_____ | * + * _ | | / / _ | | * + * | |___| |/ /____| |___| | * + * |_______|_______|_______| * + * * + * Wiimms SZS Tools * + * https://szs.wiimm.de/ * + * * + *************************************************************************** + * * + * This file is part of the SZS project. * + * Visit https://szs.wiimm.de/ for project details and sources. * + * * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * + * * + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program 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 General Public License for more details. * + * * + * See file gpl-2.0.txt or http://www.gnu.org/licenses/gpl-2.0.txt * + * * + ***************************************************************************/ + +#include "dclib-xdump.h" +#include "lib-lex.h" +#include "lib-std.h" +#include "lib-mkw.h" +#include "lib-szs.h" +#include "lex.inc" + +#include <stddef.h> + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// DEBUG settings /////////////// +/////////////////////////////////////////////////////////////////////////////// + +#undef CHECK_FEATURES + +#if defined(TEST) || defined(DEBUG) || defined(HAVE_WIIMM_EXT) + #define CHECK_FEATURES 1 +#else + #define CHECK_FEATURES 0 +#endif + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// LEX action log /////////////// +/////////////////////////////////////////////////////////////////////////////// + +bool LEX_ACTION_LOG ( bool is_patch, const char * format, ... ) +{ + #if HAVE_PRINT + { + char buf[200]; + snprintf(buf,sizeof(buf),">>>[LEX]<<< %s",format); + va_list arg; + va_start(arg,format); + PRINT_ARG_FUNC(buf,arg); + va_end(arg); + } + #endif + +// if ( verbose > 2 || KMP_MODE & KMPMD_LOG || is_patch && ~KMP_MODE & KMPMD_SILENT ) + if ( verbose > 2 || is_patch ) + { + fflush(stdout); + fprintf(stdlog," %s>[LEX]%s ", + colset->heading, + is_patch ? colset->highlight : colset->info ); + va_list arg; + va_start(arg,format); + vfprintf(stdlog,format,arg); + va_end(arg); + fputs(colset->reset,stdlog); + fflush(stdlog); + return true; + } + + return false; +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// features_szs_t /////////////// +/////////////////////////////////////////////////////////////////////////////// +// [[feature_var_t]] + +typedef struct feature_var_t +{ + u16 offset; // offset for features_szs_t + u8 index; // index or bit number of related analyse_szs_t + u8 no_lex; // suppress output for lex files + ccp name; // name of variable + ccp comment; // comment for variable +} +feature_var_t; + +#undef DEF_VAR +#define DEF_VAR(l,i,v,c) { offsetof(features_szs_t,v),i,l,#v,c } + +//----------------------------------------------------------------------------- + +static const feature_var_t szs_feature_list[] = +{ + DEF_VAR( 1,HAVESZS_COURSE_LEX, f_lex, "File course.lex" ), + DEF_VAR( 0,HAVESZS_ITEM_SLOT_TABLE, f_item_slot_table, "File ItemSlotTable/ItemSlotTable.slt" ), + DEF_VAR( 0,HAVESZS_OBJFLOW, f_objflow, "File common/ObjFlow.bin" ), + DEF_VAR( 0,HAVESZS_GHT_ITEM, f_ght_item, "File common/GeoHitTableItem.bin" ), + DEF_VAR( 0,HAVESZS_GHT_ITEM_OBJ, f_ght_item_obj, "File common/GeoHitTableItemObj.bin" ), + DEF_VAR( 0,HAVESZS_GHT_KART, f_ght_kart, "File common/GeoHitTableKart.bin" ), + DEF_VAR( 0,HAVESZS_GHT_KART_OBJ, f_ght_kart_obj, "File common/GeoHitTableKartObj.bin" ), + DEF_VAR( 0,HAVESZS_MINIGAME, f_minigame, "File common/minigame.kmg" ), + + {0,0,0,0,0} +}; + +//----------------------------------------------------------------------------- + +static const feature_var_t kmp_feature_list[] = +{ + DEF_VAR( 0,HAVEKMP_WOODBOX_HT, kmp_woodbox_ht, "KMP: Woodbox with fall height" ), + DEF_VAR( 0,HAVEKMP_MUSHROOM_CAR, kmp_mushroom_car, "KMP: penguin_m as mushroom car" ), + DEF_VAR( 0,HAVEKMP_PENGUIN_POS, kmp_penguin_pos, "KMP: Alternative start of penguin_m" ), + DEF_VAR( 0,HAVEKMP_SECOND_KTPT, kmp_second_ktpt, "KMP: Second KTPT with index -1" ), + DEF_VAR( 0,HAVEKMP_X_PFLAGS, kmp_extended_pflags, "KMP: Extended presence flags (XPF) used" ), + DEF_VAR( 0,HAVEKMP_X_COND, kmp_xpf_cond_obj, "KMP: XPF: Conditional object used" ), + DEF_VAR( 0,HAVEKMP_X_DEFOBJ, kmp_xpf_def_obj, "KMP: XPF: Definition object used" ), + DEF_VAR( 0,HAVEKMP_X_RANDOM, kmp_xpf_random, "KMP: XPF: Random scenarios used" ), + DEF_VAR( 0,HAVEKMP_EPROP_SPEED, kmp_eprop_speed, "KMP: Epropeller with speed setting" ), + DEF_VAR( 0,HAVEKMP_COOB_R, kmp_coob_riidefii, "KMP: Conditional OOB by Riidefi" ), + DEF_VAR( 0,HAVEKMP_COOB_K, kmp_coob_khacker, "KMP: Conditional OOB by kHacker35000vr" ), + DEF_VAR( 0,HAVEKMP_UOOB, kmp_uncond_oob, "KMP: Unconditional OOB" ), + + {0,0,0,0,0} +}; + +//----------------------------------------------------------------------------- + +static const feature_var_t lex_section_list[] = +{ + DEF_VAR( 1,HAVELEXS_FEA0, lex_sect_fea0, "LEX section FEA0" ), + DEF_VAR( 0,HAVELEXS_TEST, lex_sect_test, "LEX section TEST" ), + DEF_VAR( 0,HAVELEXS_SET1, lex_sect_set1, "LEX section SET1" ), + DEF_VAR( 0,HAVELEXS_CANN, lex_sect_cann, "LEX section CANN" ), + DEF_VAR( 0,HAVELEXS_HIPT, lex_sect_hipt, "LEX section HIPT" ), + // move HAVELEXS_TEST to here + + {0,0,0,0,0} +}; +//----------------------------------------------------------------------------- + +static const feature_var_t lex_feature_list[] = +{ + DEF_VAR( 0,HAVELEXF_TEST_ACTIVE, lex_test_active, "LEX: Active test scenario" ), + DEF_VAR( 0,HAVELEXF_ITEM_RANGE, lex_item_range, "LEX: Expand the range of item positions" ), + DEF_VAR( 0,HAVELEXF_CANNON, lex_cannon, "LEX: Alternative cannon settings" ), + DEF_VAR( 0,HAVELEXF_HIDE_POS, lex_hide_pos, "LEX: Hide position tracker conditionally" ), + // move HAVELEXF_TEST_ACTIVE to here + {0,0,0,0,0} +}; + +/////////////////////////////////////////////////////////////////////////////// +// [[feature_list_var_type]] + +enum feature_list_var_type +{ + FVT_BOOL_ARRAY, + FVT_BYTE_ARRAY, + FVT_UINT_BITS, +}; + +//----------------------------------------------------------------------------- +// [[feature_list_t]] + +typedef struct feature_list_t +{ + const feature_var_t *var; // var list + uint var_type; // one of enum feature_list_var_type + uint offset; // offset in analyse_szs_t + ccp ref_prefix; // prefix for references + ccp heading1; // heading1 + ccp heading2; // heading2 +} +feature_list_t; + +//----------------------------------------------------------------------------- + +static const feature_list_t feature_lists[] = +{ + { szs_feature_list, + FVT_BYTE_ARRAY, + offsetof(szs_have_t,szs), + "SZS file", + "Additional sub-files found in SZS file", + "0:no file, 1:unmodified file, 2:modified file" }, + + { kmp_feature_list, + FVT_BOOL_ARRAY, + offsetof(szs_have_t,kmp), + "KMP feature", + "Special features found in KMP (sub-file course.kmp)", + 0 }, + + { lex_section_list, + FVT_UINT_BITS, + offsetof(szs_have_t,lex_sect), + "LEX section", + "Sections found in LEX (sub-file course.lex)", + 0 }, + + { lex_feature_list, + FVT_UINT_BITS, + offsetof(szs_have_t,lex_feat), + "LEX feature", + "Special features found in LEX (sub-file course.lex)", + 0 }, + + {0,0,0,0,0} +}; + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +void InitializeFeaturesSZS ( features_szs_t * fs ) +{ + DASSERT(fs); + memset(fs,0,sizeof(*fs)); + fs->size_be = htons(sizeof(*fs)); +} + +/////////////////////////////////////////////////////////////////////////////// +#if CHECK_FEATURES + + static uint CheckUsageFeaturesSZS() + { + GetFeaturesModes(); + + static uint err_count = 0; + static bool done = false; + if (done) + return err_count; + done = true; + + features_szs_t fs; + InitializeFeaturesSZS(&fs); + u8 *fs_data = (u8*)&fs; + + ccp err_msg = "Invalid feature_var_t[]\n"; + + const feature_list_t *list; + for ( list = feature_lists; list->var; list++ ) + { + const feature_var_t *var; + for ( var = list->var; var->offset; var++ ) + { + uint offset = var->offset; + if ( offset < FIRST_FEATURE_SZS_OFFSET || offset > sizeof(features_szs_t) ) + { + if (!err_count++) + ERROR0(ERR_INVALID_DATA,err_msg,0); + fprintf(stderr,"!! * Offset %d out of range.\n",offset); + } + else + fs_data[offset]++; + } + } + + uint offset; + for ( offset = FIRST_FEATURE_SZS_OFFSET; offset < sizeof(features_szs_t); offset++ ) + { + const u8 count = fs_data[offset]; + if ( count != 1 ) + { + if (!err_count++) + ERROR0(ERR_INVALID_DATA,err_msg,0); + if (!count) + fprintf(stderr,"!! * Offset %d not used.\n",offset); + else + fprintf(stderr,"!! * Offset %d used %u times.\n",offset,count); + } + } + + ResetFeaturesSZS(&fs); + return err_count; + } + +#endif // CHECK_FEATURES +/////////////////////////////////////////////////////////////////////////////// + +void SetupFeaturesSZS ( features_szs_t *fs, const szs_have_t *have, bool is_lex ) +{ + #if CHECK_FEATURES + CheckUsageFeaturesSZS(); + #endif + + const feature_list_t *list; + const feature_var_t *var; + + for ( list = feature_lists; list->var; list++ ) + { + switch (list->var_type) + { + case FVT_BOOL_ARRAY: + { + const u8 *src = (u8*)have + list->offset; + for ( var = list->var; var->offset; var++ ) + ((u8*)fs)[var->offset] + = is_lex && var->no_lex + ? 1 + : src[var->index] > 0; + } + break; + + case FVT_BYTE_ARRAY: + { + const u8 *src = (u8*)have + list->offset; + for ( var = list->var; var->offset; var++ ) + ((u8*)fs)[var->offset] + = is_lex && var->no_lex + ? 1 + : src[var->index]; + } + break; + + case FVT_UINT_BITS: + { + const uint val = *(uint*)((u8*)have + list->offset); + for ( var = list->var; var->offset; var++ ) + ((u8*)fs)[var->offset] + = is_lex && var->no_lex + ? 1 + : ( val & 1 << var->index ) != 0; + } + break; + + default: + ASSERT(0); + } + } + + // ??? [[2do]] +} + +/////////////////////////////////////////////////////////////////////////////// + +void SetIsLexFeaturesSZS ( features_szs_t *fs ) +{ + DASSERT(fs); + + #if 1 + // short cut for code below + fs->f_lex = fs->lex_sect_fea0 = 1; + #else + // non optimized code + const feature_list_t *list; + for ( list = feature_lists; list->var; list++ ) + { + const feature_var_t *var; + for ( var = list->var; var->offset; var++ ) + if (var->no_lex) + ((u8*)fs)[var->offset] = 1; + } + #endif +} + +/////////////////////////////////////////////////////////////////////////////// + +int GetFeaturesStatusSZS ( const features_szs_t *fs ) +{ + // returns + // 0: all features set to null + // 1: all features except f_lex + lex_sect_fea0 are set to null + // 2: any features except f_lex + lex_sect_fea0 is not NULL + + DASSERT(fs); + + features_szs_t temp; + InitializeFeaturesSZS(&temp); + if (!memcmp(&temp,fs,sizeof(temp))) + return 0; + + temp.f_lex = fs->f_lex; + temp.lex_sect_fea0 = fs->lex_sect_fea0; + return memcmp(&temp,fs,sizeof(temp)) ? 2 : 1; +} + +/////////////////////////////////////////////////////////////////////////////// + +void PrintFeaturesSZS +( + PrintScript_t *ps, // valid output definition + const features_szs_t *fs, // valid source + bool is_lex, // TRUE: Create output for a LEX file + int comments, // >0: add extended comments + int print_modes, // >0: append ",MODES" + u8 include, // print only if all bits match + u8 exclude // exclude if any bit match +) +{ + DASSERT(ps); + DASSERT(fs); + + if ( ps->fform == PSFF_UNKNOWN && comments >= 0 ) + ps->fform = PSFF_ASSIGN; + + int head_mode = 0; + const u8 *modes = (u8*)GetFeaturesModes(); + const feature_list_t *list; + + for ( list = feature_lists; list->var; list++ ) + { + if ( comments >= 0 ) + head_mode = 2; + else if ( comments >= -1 ) + head_mode = 1; + + const feature_var_t *var; + for ( var = list->var; var->offset; var++ ) + { + if ( is_lex && var->no_lex ) + continue; + + const u8 mode = modes[var->offset]; + if ( ( mode & include ) != include || mode & exclude ) + continue; + + const u8 value = ((u8*)fs)[var->offset]; + if ( value || comments >= -2 ) + { + if ( head_mode == 1 ) + fputc('\n',ps->f); + else if ( head_mode == 2 ) + { + const int hlen1 = strlen(list->heading1); + const int hlen2 = list->heading2 ? strlen(list->heading2) : 0; + const int sep_len = ( hlen1 > hlen2 ? hlen1 : hlen2 ) + 2; + PrintScriptVars(ps,0,"\n#%.*s\n# %s\n", sep_len, Minus300, list->heading1 ); + if (list->heading2) + PrintScriptVars(ps,0,"# %s\n", list->heading2 ); + PrintScriptVars(ps,0,"#%.*s\n", sep_len, Minus300 ); + } + head_mode = 0; + + if ( comments >= 0 ) + { + fputc('\n',ps->f); + if ( comments >= 2 ) + PrintScriptVars(ps,0,"# %s #%u, feature offset %u, source index %u\n", + list->ref_prefix, (int)(var-list->var), + var->offset, var->index ); + PrintScriptVars(ps,0,"# %s\n",var->comment); + ccp effect = GetFeaturesEffects(mode); + if (effect) + PrintScriptVars(ps,0,"# %s\n",effect); + } + if ( print_modes > 0 ) + PrintScriptVars(ps,0,"%s=\"%u,%s\"\n", + var->name, value, GetFeaturesMode(mode) ); + else + PrintScriptVars(ps,0,"%s=%u\n",var->name,value); + } + } + } + + if ( comments >= -1 ) + fputc('\n',ps->f); +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// features_szs_mode_t /////////////// +/////////////////////////////////////////////////////////////////////////////// + +const features_szs_t * GetFeaturesModes() +{ + static features_szs_t m = {0}; // keep name short! + + if (!m.size_be) + { + InitializeFeaturesSZS(&m); + + const u8 invalid = FZM_SECTION | FZM_BATTLE | FZM_TIMETRIAL; + memset((u8*)&m+sizeof(m.size_be),invalid,sizeof(m)-sizeof(m.size_be)); + + const u8 no_timetrial = FZM_OFFLINE | FZM_ONLINE; + + m.f_lex = FZM_VISUAL | FZM_GAMEPLAY | FZM_M_TYPE | FZM_M_WHERE; + m.f_item_slot_table = FZM_GAMEPLAY | FZM_M_TYPE | FZM_M_WHERE; + m.f_objflow = FZM_VISUAL | FZM_GAMEPLAY | FZM_M_TYPE | FZM_M_WHERE; + m.f_ght_item = FZM_GAMEPLAY | FZM_M_TYPE | FZM_M_WHERE; + m.f_ght_item_obj = FZM_GAMEPLAY | FZM_M_TYPE | FZM_M_WHERE; + m.f_ght_kart = FZM_GAMEPLAY | FZM_M_TYPE | FZM_M_WHERE; + m.f_ght_kart_obj = FZM_GAMEPLAY | FZM_M_TYPE | FZM_M_WHERE; + m.f_minigame = FZM_GAMEPLAY | FZM_BATTLE | FZM_M_WHERE; + + m.kmp_woodbox_ht = FZM_GAMEPLAY | FZM_M_TYPE | no_timetrial; + m.kmp_mushroom_car = FZM_VISUAL | FZM_GAMEPLAY | FZM_M_TYPE | FZM_M_WHERE; + m.kmp_penguin_pos = FZM_GAMEPLAY | FZM_M_TYPE | FZM_M_WHERE; + m.kmp_second_ktpt = FZM_VISUAL | FZM_M_TYPE | FZM_M_WHERE; + m.kmp_extended_pflags = FZM_VISUAL | FZM_GAMEPLAY | FZM_M_TYPE | FZM_M_WHERE; + m.kmp_xpf_cond_obj = FZM_VISUAL | FZM_GAMEPLAY | FZM_M_TYPE | FZM_M_WHERE; + m.kmp_xpf_def_obj = FZM_VISUAL | FZM_GAMEPLAY | FZM_M_TYPE | FZM_M_WHERE; + m.kmp_xpf_random = FZM_VISUAL | FZM_GAMEPLAY | FZM_M_TYPE | no_timetrial; + m.kmp_eprop_speed = FZM_GAMEPLAY | FZM_M_TYPE | FZM_M_WHERE; + m.kmp_coob_riidefii = FZM_GAMEPLAY | FZM_M_TYPE | FZM_M_WHERE; + m.kmp_coob_khacker = FZM_GAMEPLAY | FZM_M_TYPE | FZM_M_WHERE; + m.kmp_uncond_oob = FZM_GAMEPLAY | FZM_M_TYPE | FZM_M_WHERE; + + m.lex_sect_fea0 = FZM_SECTION; + m.lex_sect_test = FZM_VISUAL | FZM_GAMEPLAY | FZM_M_TYPE | no_timetrial | FZM_SECTION; + m.lex_sect_set1 = FZM_GAMEPLAY | FZM_M_TYPE | FZM_ONLINE | FZM_SECTION; + m.lex_sect_cann = FZM_GAMEPLAY | FZM_M_TYPE | FZM_M_WHERE | FZM_SECTION; + m.lex_sect_hipt = FZM_VISUAL | FZM_M_TYPE | no_timetrial | FZM_SECTION; + + m.lex_test_active = FZM_VISUAL | FZM_GAMEPLAY | FZM_M_TYPE | no_timetrial; + m.lex_item_range = FZM_GAMEPLAY | FZM_M_TYPE | FZM_ONLINE; + m.lex_cannon = FZM_GAMEPLAY | FZM_M_TYPE | FZM_M_WHERE; + m.lex_hide_pos = FZM_VISUAL | FZM_M_TYPE | no_timetrial; + + #if CHECK_FEATURES + uint err_count = 0; + const feature_list_t *list; + for ( list = feature_lists; list->var; list++ ) + { + const feature_var_t *var; + for ( var = list->var; var->offset; var++ ) + { + u8 value = ((u8*)&m)[var->offset]; + if ( value == invalid ) + { + if (!err_count++) + ERROR0(ERR_INVALID_DATA,"Invalid features modes\n"); + fprintf(stderr,"!! * Mode %s not set.\n",var->name); + } + } + } + #endif + } + return &m; +} + +/////////////////////////////////////////////////////////////////////////////// + +ccp GetFeaturesMode ( features_szs_mode_t mode ) +{ + char *buf = GetCircBuf(CHAR_BIT+1); + char *src = "SVGBRTLO", *dest = buf; + u8 mask; + for ( mask = 1; mask; mask <<= 1, src++ ) + if ( mode & mask ) + *dest++ = *src; + *dest = 0; + return buf; +} + +//----------------------------------------------------------------------------- + +ccp GetFeaturesEffects ( features_szs_mode_t mode ) +{ + struct tab_t { u8 not; u8 mode; ccp info; }; + static const struct tab_t *ptr, tab[] = + { + { 0,FZM_SECTION, "section" }, + + { 1,FZM_M_KIND, "no effects" }, + { 0,FZM_M_KIND, "visual and gameplay effects" }, + { 0,FZM_VISUAL, "visual effects only" }, + { 0,FZM_GAMEPLAY, "gameplay effects" }, + + { 0,FZM_M_TYPE, 0 }, + { 0,FZM_BATTLE, "battle only" }, + { 0,FZM_RACING, "racing only" }, + + { 0,FZM_M_WHERE, 0 }, + { 0,FZM_OFFLINE|FZM_ONLINE, "except time trial" }, + { 0,FZM_OFFLINE|FZM_TIMETRIAL, "offline incl. time trial" }, + { 0,FZM_ONLINE|FZM_TIMETRIAL, "time trial and online" }, + { 0,FZM_TIMETRIAL, "time trial only" }, + { 0,FZM_OFFLINE, "offline except time trial" }, + { 0,FZM_ONLINE, "online only" }, + + {0,0} + }; + + char buf[200], *dest = buf, *sep = ""; + for ( ptr = tab; ptr->mode; ptr++ ) + { + const u8 mode1 = ptr->not ? ~mode : mode; + if ( (mode1 & ptr->mode) == ptr->mode ) + { + if (ptr->info) + { + dest = StringCat2E(dest,buf+sizeof(buf),sep,ptr->info); + sep = ", "; + } + if (!ptr->not) + mode &= ~ptr->mode; + } + } + + return dest == buf ? 0 : CopyCircBuf0(buf,dest-buf); +} + +//----------------------------------------------------------------------------- + +ccp GetFeaturesEffectsByOffset ( uint offset ) +{ + if ( offset < 2 && offset >= sizeof(features_szs_t) ) + return 0; + + const features_szs_t *fs = GetFeaturesModes(); + return GetFeaturesEffects(((u8*)fs)[offset]); +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// lecode extension LEX /////////////// +/////////////////////////////////////////////////////////////////////////////// + +enumError ScanLexFile + ( cvp data, uint data_size, lex_stream_func func, + cvp user_ptr, int user_int ) +{ + if ( !data || data_size < sizeof(lex_header_t) ) + return ERR_INVALID_DATA; + + const lex_header_t *hd = (lex_header_t*)data; + if (memcmp(hd->magic,LEX_BIN_MAGIC,4)) + return ERR_INVALID_DATA; + + if ( ntohs(hd->major_version) != LEX_MAJOR_VERSION ) + return ERR_INVALID_VERSION; + + const uint size = ntohl(hd->size); + const uint off = ntohl(hd->element_off); + if ( (size&3) || size > data_size || (off&3) || off + 4 > size ) + return ERR_INVALID_DATA; + + return ScanLexElements((u8*)data+off,size-off,func,user_ptr,user_int); +} + +/////////////////////////////////////////////////////////////////////////////// + +enumError ScanLexElements + ( cvp data, uint data_size, lex_stream_func func, + cvp user_ptr, int user_int ) +{ + if ( !data || !data_size || (data_size&3) ) + return ERR_INVALID_DATA; + + enumError max_err = ERR_OK; + + uint off = 0; + while ( off < data_size ) + { + const lex_element_t *s = (lex_element_t*)( (u8*)data + off ); + + const u32 magic = ntohl(s->magic); + if (!magic) + break; + + const uint size = ntohl(s->size); + off += sizeof(lex_element_t) + size; + if ( (size&3) || off > data_size ) + return ERR_INVALID_DATA; + + PRINT("LEX SECTION: %.4s, size:%x\n",PrintID(&s->magic,4,0),size); + if (func) + { + const int err = func(magic,s->data,size,user_ptr,user_int); + if (err<0) + return -err; + if ( max_err < err ) + max_err = err; + } + } + + return max_err; +} + +/////////////////////////////////////////////////////////////////////////////// + +lex_element_t * FindLexElement ( lex_header_t *head, uint data_size, u32 magic ) +{ + if ( !head || data_size <= sizeof(lex_header_t) || (data_size&3) ) + return 0; + + uint file_size = ntohl(head->size); + if ( file_size > data_size ) + return 0; + file_size -= sizeof(lex_element_t); + + uint offset = ntohl(head->element_off); + if ( offset > file_size ) + return 0; + + magic = htonl(magic); + for(;;) + { + lex_element_t *elem = (lex_element_t*)((u8*)head + offset); + offset += 8 + ntohl(elem->size); + if ( offset > file_size ) + return 0; + if ( elem->magic == magic ) + return elem; + } +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// fix lex items /////////////// +/////////////////////////////////////////////////////////////////////////////// + +typedef void (*FixElementFunc) ( lex_t * lex, lex_item_t * item ); + +/////////////////////////////////////////////////////////////////////////////// + +static void FixLEXElement_SET1 ( lex_set1_t *set1 ) +{ + DASSERT(set1); + + uint i; + for ( i = 0; i < 3; i++ ) + { + float f = bef4(set1->item_factor.v+i); + if ( !isnormal(f) || f < 1.0 ) + write_bef4(set1->item_factor.v+i,1.0); + } +} + +//----------------------------------------------------------------------------- + +static void FixLEXItem_SET1 +( + lex_t * lex, // LEX data structure + lex_item_t * item // item to fix +) +{ + DASSERT(lex); + DASSERT(item); + DASSERT( ntohl(item->elem.size) >= sizeof(lex_set1_t) ); + + lex_set1_t *set1 = (lex_set1_t*)item->elem.data; + FixLEXElement_SET1(set1); +} + +//----------------------------------------------------------------------------- +// [[+]] + +static void ClearLEXElement_SET1 ( lex_set1_t *set1 ) +{ + DASSERT(set1); + memset(set1,0,sizeof(*set1)); + FixLEXElement_SET1(set1); +} + +//----------------------------------------------------------------------------- +// [[+]] + +static bool IsActiveLEXElement_SET1 ( const lex_set1_t *set1 ) +{ + DASSERT(set1); + lex_set1_t empty, test = *set1; + ClearLEXElement_SET1(&empty); + FixLEXElement_SET1(&test); + return memcmp(&empty,&test,sizeof(empty)) != 0; +} + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +// [[+]] + +static void FixLEXElement_TEST ( lex_test_t *lt ) +{ + DASSERT(lt); + + if ( lt->offline_online < LEX_OO_AUTO || lt->offline_online > LEX_OO_ONLINE ) + lt->offline_online = LEX_OO_AUTO; + + if ( lt->n_offline > 4 ) + lt->n_offline = 4; + + if ( lt->n_online > 99 ) + lt->n_online = 99; + + if ( lt->cond_bit < -1 || lt->cond_bit > 15 ) + lt->cond_bit = -1; + + if ( lt->game_mode >= LEX_GMODE__N ) + lt->game_mode = LEX_GMODE_AUTO; + + if ( lt->random > 8 ) + lt->random = 0; + + if ( lt->engine > ENGINE__N ) + lt->engine = 0; + + lt->padding = 0; +} + +//----------------------------------------------------------------------------- +// [[+]] + +static void FixLEXItem_TEST +( + lex_t * lex, // LEX data structure + lex_item_t * item // item to fix +) +{ + DASSERT(lex); + DASSERT(item); + DASSERT( ntohl(item->elem.size) >= sizeof(lex_test_t) ); + + lex_test_t *lt = (lex_test_t*)item->elem.data; + FixLEXElement_TEST(lt); +} + +//----------------------------------------------------------------------------- +// [[+]] + +static void ClearLEXElement_TEST ( lex_test_t *lt ) +{ + DASSERT(lt); + memcpy(lt,TestDataLEX,sizeof(*lt)); +} + +//----------------------------------------------------------------------------- +// [[+]] + +static bool IsActiveLEXElement_TEST ( const lex_test_t *lt ) +{ + DASSERT(lt); + lex_test_t empty, test = *lt; + ClearLEXElement_TEST(&empty); + FixLEXElement_TEST(&test); + return memcmp(&empty,&test,sizeof(empty)) != 0; +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// lex_t helpers /////////////// +/////////////////////////////////////////////////////////////////////////////// + +static lex_item_t * FindElementLEX +( + const lex_t * lex, // LEX data structure + u32 magic // magic +) +{ + magic = htonl(magic); + + uint i; + lex_item_t **ss; + for ( i = 0, ss = lex->item; i < lex->item_used; i++, ss++ ) + if ( (*ss)->elem.magic == magic ) + return *ss; + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +static uint GetLexSortOrder ( u32 magic ) +{ + switch(magic) + { + case LEXS_FEA0: return 1; + case LEXS_SET1: return 2; + case LEXS_TEST: return 9; + default: return 5; + } +} + +/////////////////////////////////////////////////////////////////////////////// + +static void UpdateHaveLex ( lex_t *lex ) +{ + DASSERT(lex); + uint have_sect = 0; + uint have_feat = 0; + + uint i; + lex_item_t **ss; + for ( i = 0, ss = lex->item; i < lex->item_used; i++, ss++ ) + { + const u32 magic = ntohl((*ss)->elem.magic); + const uint size = ntohl((*ss)->elem.size); + uint j; + for ( j = 0; j < HAVELEXS__N; j++ ) + if ( magic == have_lex_sect_info[j].magic + && size >= have_lex_sect_info[j].min_size ) + { + have_sect |= 1 << j; + have_feat |= GetLexFeatures(&(*ss)->elem); + break; + } + } + + lex->have_sect = have_sect; + lex->have_feat = have_feat; +} + +/////////////////////////////////////////////////////////////////////////////// + +static lex_item_t * AppendElementLEX +( + lex_t * lex, // LEX data structure + u32 magic, // magic + const void * data, // data of section + uint size, // size of 'data' + bool overwrite // false: abort if exists and return 0 + // true: overwrite +) +{ + DASSERT(lex); + DASSERT( data || !size ); + PRINT("AppendElementLEX(%.4s) have=%02x,%02x, n=%u\n", + (ccp)&magic, lex->have_sect, lex->have_feat, lex->item_used); + + + //--- check if already exists + + lex_item_t **ss; + const u32 be_magic = htonl(magic); + uint i; + for ( i = 0, ss = lex->item; i < lex->item_used; i++, ss++ ) + if ( (*ss)->elem.magic == be_magic ) + { + if (!overwrite) + return 0; + break; + } + + + //--- grow item list if necessary + + if ( i == lex->item_size ) + { + lex->item_size = lex->item_size + 30; + lex->item = REALLOC( lex->item, lex->item_size * sizeof(*lex->item) ); + // 'ss' becomes invalid! + ss = lex->item + i; + } + + if ( i < lex->item_used ) + FREE(*ss); + else + lex->item_used++; + + + //--- fix item size + + uint size4 = ALIGN32(size,4); + FixElementFunc fix_func = 0; + + switch(magic) + { + case LEXS_FEA0: + if ( size4 < sizeof(features_szs_t) ) + size4 = ALIGN32(sizeof(features_szs_t),4); + break; + + case LEXS_SET1: + fix_func = FixLEXItem_SET1; + if ( size4 < sizeof(lex_set1_t) ) + size4 = ALIGN32(sizeof(lex_set1_t),4); + break; + + case LEXS_TEST: + if ( size4 < sizeof(lex_test_t) ) + size4 = ALIGN32(sizeof(lex_test_t),4); + break; + } + + + //--- setup item + + lex_item_t *s = MALLOC(sizeof(lex_item_t)+size4); + *ss = s; + s->sort_order = GetLexSortOrder(magic); + s->insert_order = i; + s->elem.magic = be_magic; + s->elem.size = htonl(size4); + memcpy(s->elem.data,data,size); + if ( size < size4 ) + memset(s->elem.data+size,0,size4-size); + + if (fix_func) + fix_func(lex,s); + + PRINT("AppendElementLEX(%.4s) have=%02x,%02x, n=%u\n", + (ccp)&magic, lex->have_sect, lex->have_feat, lex->item_used); + UpdateHaveLex(lex); + return s; +} + +/////////////////////////////////////////////////////////////////////////////// + +static bool RemoveElementLEX +( + lex_t *lex, // LEX data structure + const lex_item_t *li // element to remove (robust) +) +{ + if ( !li || !li->elem.magic ) + return 0; + + uint i; + lex_item_t **ss; + for ( i = 0, ss = lex->item; i < lex->item_used; i++, ss++ ) + if ( *ss == li ) + { + memmove(ss,ss+1,lex->item_used-i); + lex->item_used--; + FREE((lex_item_t*)li); + UpdateHaveLex(lex); + return true; + } + return false; +} + +//----------------------------------------------------------------------------- + +static uint RemoveElementByMagicLEX +( + lex_t *lex, // LEX data structure + u32 magic // magic +) +{ + if (!magic) + return 0; + + uint count = 0; + for(;;) + { + lex_item_t *li = FindElementLEX(lex,magic); + if (!li) + return count; + count += RemoveElementLEX(lex,li); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +static int cmp_lex_item ( const lex_item_t ** pa, const lex_item_t ** pb ) +{ + const lex_item_t *a = *pa; + const lex_item_t *b = *pb; + noPRINT(">> SORT: %u.%u : %u.%u\n", + a->sort_order, a->insert_order, + b->sort_order, b->insert_order ); + + int res = (int)a->sort_order - (int)b->sort_order; + return res ? res : (int)a->insert_order - (int)b->insert_order; +} + +//----------------------------------------------------------------------------- + +static void SortItemsLEX +( + lex_t * lex // LEX data structure +) +{ + if ( lex->item_used > 1 ) + qsort( lex->item, lex->item_used, sizeof(*lex->item), + (qsort_func)cmp_lex_item ); +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// LEX features /////////////// +/////////////////////////////////////////////////////////////////////////////// + +static uint GetLexFeaturesSET1 ( const lex_element_t *elem ) +{ + uint have_feat = 0; + const uint size = ntohl(elem->size); + const lex_set1_t *set1 = (lex_set1_t*)elem->data; + + if ( size >= offsetof(lex_set1_t,item_factor) + sizeof(set1->item_factor) ) + { + if ( bef4(set1->item_factor.v+0) != 1.0 + || bef4(set1->item_factor.v+1) != 1.0 + || bef4(set1->item_factor.v+2) != 1.0 + ) + { + have_feat |= 1 << HAVELEXF_ITEM_RANGE; + } + } + return have_feat; +} + +//----------------------------------------------------------------------------- + +static uint GetLexFeaturesCANN ( const lex_element_t *elem ) +{ + return ntohl(elem->size) != sizeof(CannonDataLEX) + || memcmp(elem->data,CannonDataLEX,sizeof(CannonDataLEX)) + ? 1 << HAVELEXF_CANNON : 0; +} + +//----------------------------------------------------------------------------- + +static uint GetLexFeaturesHIPT ( const lex_element_t *elem ) +{ + return ntohl(elem->size) >= sizeof(lex_hipt_rule_t) + ? 1 << HAVELEXF_HIDE_POS : 0; +} + +//----------------------------------------------------------------------------- + +static uint GetLexFeaturesTEST ( const lex_element_t *elem ) +{ + DASSERT(elem); + return IsActiveLEXElement_TEST((lex_test_t*)elem->data) + ? 1 << HAVELEXF_TEST_ACTIVE : 0; +} + +//----------------------------------------------------------------------------- + +uint GetLexFeatures ( const lex_element_t *elem ) +{ + switch(ntohl(elem->magic)) + { + case LEXS_SET1: return GetLexFeaturesSET1(elem); + case LEXS_CANN: return GetLexFeaturesCANN(elem); + case LEXS_HIPT: return GetLexFeaturesHIPT(elem); + case LEXS_TEST: return GetLexFeaturesTEST(elem); + } + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +const have_lex_info_t have_lex_feat_info[HAVELEXF__N] = +{ + { HAVELEXF_TEST_ACTIVE, "test", 0 }, + { HAVELEXF_ITEM_RANGE, "itempos", 0 }, + { HAVELEXF_CANNON, "cannon", 0 }, + { HAVELEXF_HIDE_POS, "hipt", 0 }, + //--- add new sections here (order is important) +}; + +/////////////////////////////////////////////////////////////////////////////// + +ccp CreateFeatureInfoLEX + ( have_lex_feat_t special, bool add_value, ccp return_if_empty ) +{ + static char buf[500]; + char *dest = buf; + + if (add_value) + dest = snprintfE( dest, buf+sizeof(buf), "%u=" , special ); + + uint i, mask; + ccp sep = ""; + for ( i = 0, mask = 1; i < HAVELEXF__N; i++, mask <<= 1 ) + if ( special & mask ) + { + dest = StringCat2E(dest,buf+sizeof(buf),sep,have_lex_feat_info[i].name); + sep = ","; + } + + return dest == buf ? return_if_empty : CopyCircBuf0(buf,dest-buf); +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// have lex sections /////////////// +/////////////////////////////////////////////////////////////////////////////// +// order is important, compare have_lex_sect_t and ct.wiimm.de + +const have_lex_info_t have_lex_sect_info[HAVELEXS__N] = +{ + { LEXS_SET1, "set1", 1 }, // HAVELEXS_SET1 + { LEXS_CANN, "cannon", 0 }, // HAVELEXS_CANN + { LEXS_TEST, "test", 1 }, // HAVELEXS_TEST + { LEXS_HIPT, "hidepos", sizeof(lex_hipt_rule_t) }, // HAVELEXS_HIPT + { LEXS_FEA0, "features", 2 }, // HAVELEXS_FEA0 + //--- add new sections here (order is important) +}; + +/////////////////////////////////////////////////////////////////////////////// + +ccp CreateSectionInfoLEX + ( have_lex_sect_t special, bool add_value, ccp return_if_empty ) +{ + static char buf[500]; + char *dest = buf; + + if (add_value) + dest = snprintfE( dest, buf+sizeof(buf), "%u=" , special ); + + uint i, mask; + ccp sep = ""; + for ( i = 0, mask = 1; i < HAVELEXS__N; i++, mask <<= 1 ) + if ( special & mask ) + { + dest = StringCat2E(dest,buf+sizeof(buf),sep,have_lex_sect_info[i].name); + sep = ","; + } + + return dest == buf ? return_if_empty : CopyCircBuf0(buf,dest-buf); +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// LEX setup /////////////// +/////////////////////////////////////////////////////////////////////////////// + +void InitializeLEX ( lex_t * lex ) +{ + DASSERT(lex); + memset(lex,0,sizeof(*lex)); + + lex->fname = EmptyString; +} + +/////////////////////////////////////////////////////////////////////////////// + +void ResetLEX ( lex_t * lex ) +{ + if (lex) + { + FreeString(lex->fname); + if (lex->raw_data) + FREE(lex->raw_data); + + if (lex->item) + { + uint i; + for ( i = 0; i < lex->item_used; i++ ) + if (lex->item[i]) + FREE(lex->item[i]); + FREE(lex->item); + } + InitializeLEX(lex); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +void UpdateLEX ( lex_t * lex, bool add_missing, bool add_test ) +{ + DASSERT(lex); + + if ( add_missing && lex->develop ) + { + //--- FEA0 + AppendFea0LEX(lex,false,0); + } + + if (add_missing) + { + //--- SET1 + AppendSet1LEX(lex,false); + + //--- CANN + AppendCannLEX(lex,false); + + //--- HIPT + AppendHiptLEX(lex,false); + } + + if (add_test) //--- TEST + AppendTestLEX(lex,false); + + SortItemsLEX(lex); +} + +//----------------------------------------------------------------------------- + +lex_item_t * AppendFea0LEX + ( lex_t * lex, bool overwrite, const features_szs_t *src_fs ) +{ + features_szs_t fs; + if (src_fs) + fs = *src_fs; + else + InitializeFeaturesSZS(&fs); + SetIsLexFeaturesSZS(&fs); + + return AppendElementLEX(lex,LEXS_FEA0,&fs,sizeof(fs),overwrite); +} + +//----------------------------------------------------------------------------- + +lex_item_t * AppendSet1LEX ( lex_t * lex, bool overwrite ) +{ + lex_set1_t set1; + memset(&set1,0,sizeof(set1)); + // AppendElementLEX() does call FixLEXItem_SET1() + return AppendElementLEX(lex,LEXS_SET1,&set1,sizeof(set1),overwrite); +} + +//----------------------------------------------------------------------------- + +lex_item_t * AppendCannLEX ( lex_t * lex, bool overwrite ) +{ + return AppendElementLEX( lex, LEXS_CANN, CannonDataLEX, + sizeof(CannonDataLEX), overwrite); +} + +//----------------------------------------------------------------------------- + +lex_item_t * AppendHiptLEX ( lex_t * lex, bool overwrite ) +{ + return AppendElementLEX( lex, LEXS_HIPT, 0, 0, overwrite); +} + +//----------------------------------------------------------------------------- + +lex_item_t * AppendTestLEX ( lex_t * lex, bool overwrite ) +{ + return AppendElementLEX( lex, LEXS_TEST, TestDataLEX, + sizeof(TestDataLEX), overwrite); +} + +/////////////////////////////////////////////////////////////////////////////// + +void DumpElementsLEX ( FILE *f, lex_t *lex, bool hexdump ) +{ + DASSERT(f); + DASSERT(lex); + + fprintf(f,"LEX SECTIONS: %u/%u\n",lex->item_used,lex->item_size); + + uint i; + for ( i = 0; i < lex->item_used; i++ ) + { + lex_item_t *s = lex->item[i]; + const uint size = ntohl(s->elem.size); + fprintf(f," %-4.4s %08x, size: %5u = 0x%04x\n", + PrintID(&s->elem.magic,4,0), s->elem.magic, size, size ); + if ( size && hexdump ) + HexDump16(f,8,0,s->elem.data,size); + } +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// lex parser functions /////////////// +/////////////////////////////////////////////////////////////////////////////// + +static enumError F_isLEX +( + struct Var_t * res, // store result here + struct Var_t * param, // parameters, modified + uint n_param, // number of parameters + struct ScanInfo_t * si, // not NULL: use for error messages + const FuncParam_t * fpar // pointer to user parameter +) +{ + DASSERT(res); + DASSERT(param); + + uint result = 0; + if ( si && si->lex ) + { + result = 1; + + if (si->lex->fname) + { + ccp fname = strrchr(si->lex->fname,'/'); + if (fname) + fname++; + else + fname = si->lex->fname; + + if ( !strcasecmp(fname,"course.lex") + || !strcasecmp(fname,"course.txt") + || !strcasecmp(fname,"course.txt.lex") ) + { + result = 2; + } + } + } + + res->i = result; + res->mode = VAR_INT; + return ERR_OK; +} + +/////////////////////////////////////////////////////////////////////////////// + +static const struct FuncTable_t lex_func_tab[] = +{ + { 0, 0, "ISLEX", F_isLEX, 0, // replace only function call + "int", "isLEX()", 0 }, // but not info + + {0,0,0,0,0,0,0,0} +}; + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// setup lex parser /////////////// +/////////////////////////////////////////////////////////////////////////////// + +const VarMap_t * SetupVarsLEX() +{ + static VarMap_t vm = {0}; + if (!vm.used) + { + DefineMkwVars(&vm); + DefineParserFuncTab(lex_func_tab,FF_LEX); + DefineParserVars(&vm); + } + + return &vm; +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// ScanRawLEX() /////////////// +/////////////////////////////////////////////////////////////////////////////// + +enumError DumpLEXFunc + ( u32 magic, const u8 *data, uint size, cvp user_ptr, int user_int ) +{ + u32 m = htonl(magic); + printf(" %s 0x%08x, %5u = 0x%04x bytes\n", + PrintID(&m,4,0), magic, size, size ); + if ( user_int < 0 || user_int >= 0x10 ) + { + if ( user_int > 0 && size > user_int ) + size = user_int; + HexDump16(stdout,5,0,data,size); + putchar('\n'); + } + return ERR_OK; +} + +//----------------------------------------------------------------------------- + +enumError ScanLEXFunc + ( u32 magic, const u8 *data, uint size, cvp user_ptr, int user_int ) +{ + #if HAVE_PRINT + u32 m = htonl(magic); + PRINT(">>>>> %-4.4s %08x : size: %u = 0x%x\n", + PrintID(&m,4,0), magic, size, size ); + #endif + + lex_t *lex = (lex_t*)user_ptr; + DASSERT(lex); + + switch (magic) + { + case LEXS_TERMINATE: + case LEXS_IGNORE: + // ignore + break; + + default: + AppendElementLEX(lex,magic,data,size,true); + #if HAVE_PRINT0 + if (logging>1) + DumpElementsLEX(stdout,lex,logging>2); + #endif + } + return ERR_OK; +} + +//----------------------------------------------------------------------------- + +enumError ScanRawLEX +( + lex_t * lex, // LEX data structure + bool init_lex, // true: initialize 'lex' first + const void * data, // data to scan + uint data_size, // size of 'data' + uint dump_mode // 0: add element to lex->item + // 1: dump scanned elements + // >=0x10: add hexdump of max # bytes +) +{ + DASSERT(lex); + if (init_lex) + InitializeLEX(lex); + + if ( IsValidLEX(data,data_size,data_size,lex->fname) >= VALID_ERROR ) + { + return ERROR0(ERR_INVALID_DATA, + "Invalid LEX file: %s\n" + "Add option --lex=force or --force to ignore some validity checks.", + lex->fname ? lex->fname : "?" ); + } + + lex->fform = FF_LEX; + enumError err = ScanLexFile( data, data_size, + dump_mode ? DumpLEXFunc : ScanLEXFunc, lex, dump_mode ); + if (err) + ERROR0(err,"Scanning of LEX file failed: %s\n",lex->fname); + else + UpdateLEX(lex,opt_complete,false); + + if (logging>0) + DumpElementsLEX(stdout,lex,logging>2); + return err; +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// ScanTextLEX() /////////////// +/////////////////////////////////////////////////////////////////////////////// +// [[lex_section_id]] + +typedef enum lex_section_id +{ + LID_UNKNOWN, + LID_IGNORE, + LID_SETUP, + LID_HEXDUMP, + + LID_SETTINGS1, + LID_CANNON, + LID_HIDE_PT, + LID_TEST, +} +lex_section_id; + +/////////////////////////////////////////////////////////////////////////////// + +static const KeywordTab_t lex_section_name[] = +{ + //------------------------------------------------------------------------ + // ID NAME INFO unused + //------------------------------------------------------------------------ + + { LID_IGNORE, "END", "--", 0 }, + { LID_SETUP, "SETUP", "Setup", 0 }, + { LID_HEXDUMP, "HEXDUMP", "Hexdump of unknown section", 0 }, + + { LID_SETTINGS1, "SET1", "Basic settings", 0 }, + { LID_CANNON, "CANN", "Cannon settings", 0 }, + { LID_HIDE_PT, "HIPT", "Hide position tracker", 0 }, + { LID_TEST, "TEST", "Test case", 0 }, + + { 0,0,0,0 } +}; + +/////////////////////////////////////////////////////////////////////////////// + +static const KeywordTab_t lex_offline_online[] = +{ + { LEX_OO_AUTO, "AUTO", "0", 0 }, + { LEX_OO_OFFLINE, "OFFLINE", "1", 0 }, + { LEX_OO_OFFLINE, "NEVER", 0, 0 }, + { LEX_OO_ONLINE, "ONLINE", "2", 0 }, + { LEX_OO_ONLINE, "ALWAYS", 0, 0 }, + { -9, "OFF", "-1", -1 }, + { 0,0,0,0 } +}; + +/////////////////////////////////////////////////////////////////////////////// + +static const KeywordTab_t lex_game_mode[] = +{ + { LEX_GMODE_AUTO, "AUTO", "0", -1 }, + { LEX_GMODE_STD, "STANDARD", "1", KMP_GMODE_STD }, + { LEX_GMODE_STD, "STD", 0, KMP_GMODE_STD }, + { LEX_GMODE_BALLOON, "BALLOON", "2", KMP_GMODE_BALLOON }, + { LEX_GMODE_COIN, "COIN", "3", KMP_GMODE_COIN }, + { LEX_GMODE_VERSUS, "VERSUS", "4", KMP_GMODE_VERSUS }, + { LEX_GMODE_ITEMRAIN, "ITEMRAIN", "5", KMP_GMODE_ITEMRAIN }, + { -1, "OFF", "-1", -1 }, + { 0,0,0,0 } +}; + +/////////////////////////////////////////////////////////////////////////////// + +static const KeywordTab_t lex_engine[] = +{ + { LEX_ENGINE_AUTO, "AUTO", "0", -1 }, + { LEX_ENGINE_BATTLE, "BATTLE", 0, ENGINE_BATTLE }, + { LEX_ENGINE_50, "50CC", 0, ENGINE_50 }, + { LEX_ENGINE_100, "100CC", 0, ENGINE_100 }, + { LEX_ENGINE_150, "150CC", 0, ENGINE_150 }, + { LEX_ENGINE_200, "200CC", 0, ENGINE_200 }, + { LEX_ENGINE_150M, "150M", "150MIRROR", ENGINE_150M }, + { LEX_ENGINE_200M, "200M", "200MIRROR", ENGINE_200M }, + { -1, "OFF", "-1", -1 }, + { 0,0,0,0 } +}; + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +static enumError ScanLEXElementHexdump +( + lex_t * lex, // KMP data structure + ScanInfo_t * si // valid data +) +{ + DASSERT(lex); + DASSERT(si); + TRACE("ScanLEXElementHexdump()\n"); + + + //--- setup data + + u32 magic = LEXS_IGNORE; + ScanParam_t ptab[] = + { + { "MAGIC", SPM_U32, &magic, }, + {0} + }; + + char fb_buf[1000]; + FastBuf_t *fb = InitializeFastBuf(fb_buf,sizeof(fb_buf)); + + + //--- main loop + + for(;;) + { + char ch = NextCharSI(si,true); + if ( !ch || ch == '[' ) + break; + + if ( ch == '@' ) + ScanParamSI(si,ptab); + else + ScanHexlineSI(si,fb,true); + } + CheckLevelSI(si); + + if ( magic != LEXS_IGNORE && magic != LEXS_TERMINATE ) + AppendElementLEX(lex,magic,fb->buf,fb->ptr-fb->buf,true); + + ResetFastBuf(fb); + return ERR_OK; +} + +/////////////////////////////////////////////////////////////////////////////// + +static enumError ScanLEXElement_SET1 +( + lex_t * lex, // KMP data structure + ScanInfo_t * si // valid data +) +{ + DASSERT(lex); + DASSERT(si); + TRACE("ScanLEXElement_SET1()\n"); + + + //--- setup data + + lex_set1_t set1 = {0}; + + const ScanParam_t ptab[] = + { + { "ITEM-POS-FACTOR", SPM_FLOAT3_BE, &set1.item_factor }, + { "TEST1", SPM_U8, set1.test+0 }, + { "TEST2", SPM_U8, set1.test+1 }, + { "TEST3", SPM_U8, set1.test+2 }, + { "TEST4", SPM_U8, set1.test+3 }, + {0} + }; + + char fb_buf[1000]; + FastBuf_t *fb = InitializeFastBuf(fb_buf,sizeof(fb_buf)); + AppendFastBuf(fb,&set1,sizeof(set1)); + + + //--- main loop + + for(;;) + { + char ch = NextCharSI(si,true); + if ( !ch || ch == '[' ) + break; + + if ( ch == '@' ) + ScanParamSI(si,ptab); + else + ScanHexlineSI(si,fb,true); + } + CheckLevelSI(si); + + memcpy(fb->buf,&set1,sizeof(set1)); + HEXDUMP16(0,0,fb->buf,fb->ptr-fb->buf); + AppendElementLEX(lex,LEXS_SET1,fb->buf,fb->ptr-fb->buf,true); + + ResetFastBuf(fb); + return ERR_OK; +} + +/////////////////////////////////////////////////////////////////////////////// + +static enumError ScanLEXElement_CANN +( + lex_t * lex, // KMP data structure + ScanInfo_t * si // valid data +) +{ + DASSERT(lex); + DASSERT(si); + TRACE("ScanLEXElement_CANN()\n"); + + + //--- setup data + + ScanParam_t ptab[] = + { + {0} + }; + + char fb_buf[1000]; + FastBuf_t *fb = InitializeFastBuf(fb_buf,sizeof(fb_buf)); + AppendFastBuf(fb,EmptyString,4); + + + //--- main loop + + uint n_cannon = 0; + for(;;) + { + char ch = NextCharSI(si,true); + if ( !ch || ch == '[' ) + break; + + if ( ch == '@' ) + { + ScanParamSI(si,ptab); + continue; + } + + enumError err; + ScanIndexSI(si,&err,n_cannon,0,2); + if (err) + break; + + float f[4]; + ScanFloatSI(si,f,4); + + uint i; + u32 *fp = (u32*)f; + for ( i = 0; i < 4; i++, fp++ ) + *fp = htonl(*fp); + AppendFastBuf(fb,f,sizeof(f)); + n_cannon++; + CheckEolSI(si); + } + + if ( n_cannon > 0 ) + { + write_be32(fb->buf,n_cannon); + //HexDump16(stdout,0,0,fb->buf,fb->ptr-fb->buf); + AppendElementLEX(lex,LEXS_CANN,fb->buf,fb->ptr-fb->buf,true); + } + + ResetFastBuf(fb); + return ERR_OK; +} + +/////////////////////////////////////////////////////////////////////////////// + +static enumError ScanLEXElement_HIPT +( + lex_t * lex, // KMP data structure + ScanInfo_t * si // valid data +) +{ + DASSERT(lex); + DASSERT(si); + TRACE("ScanLEXElement_HIPT()\n"); + + + //--- setup data + + ScanParam_t ptab[] = + { + {0} + }; + + char fb_buf[1000]; + FastBuf_t *fb = InitializeFastBuf(fb_buf,sizeof(fb_buf)); + + + //--- main loop + + for(;;) + { + char ch = NextCharSI(si,true); + if ( !ch || ch == '[' ) + break; + + if ( ch == '@' ) + { + ScanParamSI(si,ptab); + continue; + } + + u8 num[sizeof(lex_hipt_rule_t)]; + ScanU8SI(si,num,sizeof(num),false); + AppendFastBuf(fb,num,sizeof(num)); + CheckEolSI(si); + } + + AppendElementLEX(lex,LEXS_HIPT,fb->buf,fb->ptr-fb->buf,true); + ResetFastBuf(fb); + + return ERR_OK; +} + +/////////////////////////////////////////////////////////////////////////////// + +static enumError ScanLEXElement_TEST +( + lex_t * lex, // KMP data structure + ScanInfo_t * si // valid data +) +{ + DASSERT(lex); + DASSERT(si); + TRACE("ScanLEXElement_TEST()\n"); + + + //--- setup data + + lex_test_t test; + memcpy(&test,TestDataLEX,sizeof(test)); + + const ScanParam_t ptab[] = + { + { "OFFLINE-ONLINE", SPM_U8, &test.offline_online }, + { "N-OFFLINE", SPM_U8, &test.n_offline }, + { "N-ONLINE", SPM_U8, &test.n_online }, + { "COND-BIT", SPM_S8, &test.cond_bit }, + { "GAME-MODE", SPM_U8, &test.game_mode }, + { "ENGINE", SPM_U8, &test.engine }, + { "RANDOM", SPM_U8, &test.random }, + {0} + }; + + char fb_buf[1000]; + FastBuf_t *fb = InitializeFastBuf(fb_buf,sizeof(fb_buf)); + AppendFastBuf(fb,&test,sizeof(test)); + + + //--- main loop + + for(;;) + { + char ch = NextCharSI(si,true); + if ( !ch || ch == '[' ) + break; + + if ( ch == '@' ) + ScanParamSI(si,ptab); + else + ScanHexlineSI(si,fb,true); + } + CheckLevelSI(si); + + memcpy(fb->buf,&test,sizeof(test)); + HEXDUMP16(0,0,fb->buf,fb->ptr-fb->buf); + AppendElementLEX(lex,LEXS_TEST,fb->buf,fb->ptr-fb->buf,true); + + ResetFastBuf(fb); + return ERR_OK; +} + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +enumError ScanTextLEX +( + lex_t * lex, // LEX data structure + bool init_lex, // true: initialize 'lex' first + const void * data, // data to scan + uint data_size // size of 'data' +) +{ + PRINT("ScanTextLEX(init=%d)\n",init_lex); + + DASSERT(lex); + if (init_lex) + InitializeLEX(lex); + + ScanInfo_t si; + InitializeSI(&si,data,data_size,lex->fname,lex->revision); + si.predef = SetupVarsLEX(); + + enumError max_err = ERR_OK; + lex->is_pass2 = false; + + for(;;) + { + PRINT("----- SCAN LEX SECTIONS, PASS%u ...\n",lex->is_pass2+1); + + max_err = ERR_OK; + si.lex = lex; + si.no_warn = !lex->is_pass2; + si.total_err = 0; + DefineIntVar(&si.gvar, "$PASS", lex->is_pass2+1 ); + + for(;;) + { + char ch = NextCharSI(&si,true); + if (!ch) + break; + + if ( ch != '[' ) + { + NextLineSI(&si,true,false); + continue; + } + ResetLocalVarsSI(&si,lex->revision); + + si.cur_file->ptr++; + char sect_name[20]; + ScanNameSI(&si,sect_name,sizeof(sect_name),true,true,0); + PRINT0("--> pass=%u: #%04u: %s\n",lex->is_pass2+1,si.cur_file->line,sect_name); + + int abbrev_count; + const KeywordTab_t *cmd = ScanKeyword(&abbrev_count,sect_name,lex_section_name); + if ( !cmd || abbrev_count ) + continue; + NextLineSI(&si,false,false); + PRINT0("--> %-6s #%-4u |%.3s|\n",cmd->name1,si.cur_file->line,si.cur_file->ptr); + + enumError err = ERR_OK; + switch (cmd->id) + { + case LID_IGNORE: + // ignore it without warning + break; + + case LID_SETUP: + // nothing to do at the moment + break; + + case LID_HEXDUMP: + err = ScanLEXElementHexdump(lex,&si); + break; + + case LID_SETTINGS1: + err = ScanLEXElement_SET1(lex,&si); + break; + + case LID_CANNON: + err = ScanLEXElement_CANN(lex,&si); + break; + + case LID_HIDE_PT: + err = ScanLEXElement_HIPT(lex,&si); + break; + + case LID_TEST: + err = ScanLEXElement_TEST(lex,&si); + break; + + default: + err = ERROR0(ERR_WARNING,"Unknown section (ignored): %s\n",sect_name); + break; + } + + if ( max_err < err ) + max_err = err; + } + + if (lex->is_pass2) + break; + + lex->is_pass2 = true; + RestartSI(&si); + } + + ResetSI(&si); + + UpdateLEX(lex,opt_complete,false); + return max_err; +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// LEX: scan and load /////////////// +/////////////////////////////////////////////////////////////////////////////// + +enumError ScanLEX +( + lex_t * lex, // LEX data structure + bool init_lex, // true: initialize 'lex' first + const void * data, // data to scan + uint data_size // size of 'data' +) +{ + DASSERT(lex); + PRINT("ScanLEX() size=%u\n",data_size); + HEXDUMP16(0,0,data,16); + + enumError err; +// [[analyse-magic]] + switch (GetByMagicFF(data,data_size,data_size)) + { + case FF_LEX: + lex->fform = FF_LEX; + err = ScanRawLEX(lex,init_lex,data,data_size,0); + break; + + case FF_LEX_TXT: + lex->fform = FF_LEX_TXT; + err = ScanTextLEX(lex,init_lex,data,data_size); + break; + + default: + if (init_lex) + InitializeLEX(lex); + return ERROR0(ERR_INVALID_DATA, + "No LEX file: %s\n", lex->fname ? lex->fname : "?"); + } + + PatchLEX(lex,0); + return err; +} + +/////////////////////////////////////////////////////////////////////////////// + +enumError ScanRawDataLEX +( + lex_t * lex, // LEX data structure + bool init_lex, // true: initialize 'lex' first + struct raw_data_t * raw // valid raw data +) +{ + DASSERT(lex); + DASSERT(raw); + if (init_lex) + InitializeLEX(lex); + else + ResetLEX(lex); + + lex->fatt = raw->fatt; + lex->fname = raw->fname; + raw->fname = 0; + + return raw->is_0 ? ERR_OK : ScanLEX(lex,false,raw->data,raw->data_size); +} + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +enumError LoadLEX +( + lex_t * lex, // LEX data structure + bool init_lex, // true: initialize 'lex' first + ccp fname, // valid pointer to filenname + bool ignore_no_file // ignore if file does not exists + // and return warning ERR_NOT_EXISTS +) +{ + DASSERT(lex); + DASSERT(fname); + if (init_lex) + InitializeLEX(lex); + else + ResetLEX(lex); + + //--- load and scan data + + raw_data_t raw; + enumError err = LoadRawData(&raw,true,fname,0,ignore_no_file,0); + if (!err) + { + lex->fname = raw.fname; + raw.fname = 0; + err = ScanLEX(lex,false,raw.data,raw.data_size); + } + + ResetRawData(&raw); + return err; +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// CreateRawLEX() /////////////// +/////////////////////////////////////////////////////////////////////////////// + +enumError CreateRawLEX +( + lex_t * lex // pointer to valid LEX +) +{ + DASSERT(lex); + if (lex->raw_data) + FREE(lex->raw_data); + + uint total_size = sizeof(lex_header_t) + sizeof(lex_element_t); // final term! + + uint i; + for ( i = 0; i < lex->item_used; i++ ) + { + lex_item_t *s = lex->item[i]; + total_size += sizeof(lex_element_t) + ntohl(s->elem.size); + } + + lex->raw_data = MALLOC(total_size); + lex->raw_data_size = total_size; + + lex_header_t *hd = (lex_header_t*)lex->raw_data; + memcpy(hd->magic,LEX_BIN_MAGIC,sizeof(hd->magic)); + hd->major_version = htons(LEX_MAJOR_VERSION); + hd->minor_version = htons(LEX_MINOR_VERSION); + hd->size = htonl(total_size); + hd->element_off = htonl(sizeof(lex_header_t)); + + u8 *dest = lex->raw_data + sizeof(lex_header_t); + for ( i = 0; i < lex->item_used; i++ ) + { + lex_item_t *s = lex->item[i]; + const uint size = sizeof(lex_element_t) + ntohl(s->elem.size); + ASSERT ( dest + size < lex->raw_data + lex->raw_data_size ); + memcpy(dest,&s->elem,size); + dest += size; + } + ASSERT ( dest + sizeof(lex_element_t) == lex->raw_data + lex->raw_data_size ); + memset(dest,0,sizeof(lex_element_t)); + + return ERR_OK; +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// SaveRawLEX() /////////////// +/////////////////////////////////////////////////////////////////////////////// + +enumError SaveRawLEX +( + lex_t * lex, // pointer to valid LEX + ccp fname, // filename of destination + bool set_time // true: set time stamps +) +{ + DASSERT(lex); + DASSERT(fname); + PRINT("SaveRawLEX(%s,%d)\n",fname,set_time); + + //--- create raw data + + enumError err = CreateRawLEX(lex); + if (err) + return err; + DASSERT(lex->raw_data); + DASSERT(lex->raw_data_size); + + + //--- write to file + + File_t F; + err = CreateFileOpt(&F,true,fname,testmode,lex->fname); + if ( err > ERR_WARNING || !F.f ) + return err; + SetFileAttrib(&F.fatt,&lex->fatt,0); + + if ( fwrite(lex->raw_data,1,lex->raw_data_size,F.f) != lex->raw_data_size ) + FILEERROR1(&F,ERR_WRITE_FAILED,"Write failed: %s\n",fname); + return ResetFile(&F,set_time); +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// SaveTextLEX() /////////////// +/////////////////////////////////////////////////////////////////////////////// + +static enumError SaveTextLEX_FEA0 +( + FILE * f, // file to write + const lex_t * lex, // pointer to valid LEX + lex_item_t * item // item to save +) +{ + DASSERT(f); + DASSERT(lex); + DASSERT(item); + + const uint size = ntohl(item->elem.size); + noPRINT("SaveTextLEX_SET1(), size=%u\n",size); + DASSERT( size >= sizeof(lex_set1_t) ); + if ( size < sizeof(features_szs_t)) + return ERR_OK; + + fprintf(f,text_lex_elem_feat_cr,item->sort_order); + const features_szs_t *fs = (features_szs_t*)item->elem.data; + + PrintScript_t ps; + InitializePrintScript(&ps); + ps.f = f; + ps.fform = PSFF_ASSIGN; + ps.force_case = LOUP_UPPER; + PrintFeaturesSZS(&ps,fs,true,1,0,0,0); + ResetPrintScript(&ps); + + uint data_size = ntohs(fs->size_be); + if ( data_size > size ) + data_size = size; + + if ( data_size > sizeof(features_szs_t) ) + { + u8 size = data_size - sizeof(features_szs_t); + u8 *ptr = item->elem.data + sizeof(features_szs_t); + if ( size >= 4 || !IsMemConst(ptr,size,0) ) + { + fputs("\n# Hex dump for unknown settings:\n",f); + HexDump(f,0,sizeof(features_szs_t),5,16,ptr,size); + } + } + + return ERR_OK; +} + +/////////////////////////////////////////////////////////////////////////////// + +static enumError SaveTextLEX_SET1 +( + FILE * f, // file to write + const lex_t * lex, // pointer to valid LEX + lex_item_t * item // item to save +) +{ + DASSERT(f); + DASSERT(lex); + DASSERT(item); + + const uint size = ntohl(item->elem.size); + noPRINT("SaveTextLEX_SET1(), size=%u\n",size); + DASSERT( size >= sizeof(lex_set1_t) ); + if ( size < sizeof(lex_set1_t)) + return ERR_OK; + + const u8 *data = item->elem.data; + const lex_set1_t *set1 = (lex_set1_t*)data; + + fprintf(f,text_lex_elem_set1_cr + ,item->sort_order + ,bef4(&set1->item_factor.x) + ,bef4(&set1->item_factor.y) + ,bef4(&set1->item_factor.z) + ); + + if (*(u32*)set1->test) + fprintf(f,text_lex_elem_set1_develop_cr + ,set1->test[0],set1->test[1],set1->test[2],set1->test[3] + ); + + if ( size > sizeof(lex_set1_t) ) + { + fputs("\n# Hex dump for unknown settings:\n",f); + HexDump(f,0,sizeof(lex_set1_t),5,16, + item->elem.data + sizeof(lex_set1_t), + size - sizeof(lex_set1_t) ); + } + + return ERR_OK; +} + +/////////////////////////////////////////////////////////////////////////////// + +static enumError SaveTextLEX_CANN +( + FILE * f, // file to write + const lex_t * lex, // pointer to valid LEX + lex_item_t * item // item to save +) +{ + DASSERT(f); + DASSERT(lex); + DASSERT(item); + + fprintf(f,text_lex_elem_cann_cr,item->sort_order); + if ( item->elem.size < 4 + 16 ) + return ERR_OK; + + const u8 *data = item->elem.data; + uint n = be32(data); + uint max = ( ntohl(item->elem.size) - 4 ) / 16; + if ( n > max ) + n = max; + + uint i, off = 4; + for ( i = 0; i < n; i++, off += 16 ) + fprintf(f,"%4u %10.3f %10.3f %10.3f %10.3f\r\n", + i, bef4(data+off), bef4(data+off+4), + bef4(data+off+8), bef4(data+off+12) ); + + return ERR_OK; +} + +/////////////////////////////////////////////////////////////////////////////// + +static enumError SaveTextLEX_HIPT +( + FILE * f, // file to write + const lex_t * lex, // pointer to valid LEX + lex_item_t * item // item to save +) +{ + DASSERT(f); + DASSERT(lex); + DASSERT(item); + + fprintf(f,text_lex_elem_hipt_cr,item->sort_order); + if ( item->elem.size < 4 + 16 ) + return ERR_OK; + + const lex_hipt_rule_t *rule = (lex_hipt_rule_t*)item->elem.data; + int n = ntohl(item->elem.size) / sizeof(*rule) ; + + int i, last_lap = 1000; + for ( i = 0; i < n; i++, rule++ ) + { + if ( last_lap != rule->lap ) + { + last_lap = rule->lap; + fputs("\r\n",f); + } + + fprintf(f,"%5u %4d %4u %4u %4u\r\n", + rule->cond, rule->lap, rule->from, rule->to, rule->mode ); + } + + return ERR_OK; +} + +/////////////////////////////////////////////////////////////////////////////// + +static enumError SaveTextLEX_TEST +( + FILE * f, // file to write + const lex_t * lex, // pointer to valid LEX + lex_item_t * item // item to save +) +{ + DASSERT(f); + DASSERT(lex); + DASSERT(item); + + const uint size = ntohl(item->elem.size); + PRINT("SaveTextLEX_TEST(), size=%u\n",size); + DASSERT( size >= sizeof(lex_test_t) ); + if ( size < sizeof(lex_test_t)) + return ERR_OK; + + const u8 *data = item->elem.data; + const lex_test_t *test = (lex_test_t*)data; + + const KeywordTab_t *off_on; + for ( off_on = lex_offline_online; off_on->name1; off_on++ ) + if ( off_on->id == test->offline_online && off_on->opt >= 0 ) + break; + + const KeywordTab_t *gmode; + for ( gmode = lex_game_mode; gmode->name1; gmode++ ) + if ( gmode->id == test->game_mode && gmode->opt >= 0 ) + break; + + const KeywordTab_t *engine; + for ( engine = lex_engine; engine->name1; engine++ ) + if ( engine->id == test->engine && engine->opt >= 0 ) + break; + + fprintf(f,text_lex_elem_test_cr + ,item->sort_order + ,off_on->name1 ? off_on->name1 : "AUTO" + ,test->n_offline + ,test->n_online + ,test->cond_bit + ,gmode->name1 ? gmode->name1 : "AUTO" + ,engine->name1 ? engine->name1 : "AUTO" + ,test->random + ); + + if ( size > sizeof(lex_test_t) ) + { + fputs("\n# Hex dump for unknown settings:\n",f); + HexDump(f,0,sizeof(lex_test_t),5,16, + item->elem.data + sizeof(lex_test_t), + size - sizeof(lex_test_t) ); + } + + return ERR_OK; +} + +/////////////////////////////////////////////////////////////////////////////// + +enumError SaveTextLEX +( + const lex_t * lex, // pointer to valid LEX + ccp fname, // filename of destination + bool set_time // true: set time stamps +) +{ + // use DOS/Windows line format -> unix can handle it ;) + + DASSERT(lex); + DASSERT(fname); + PRINT("SaveTextLEX(%s,%d)\n",fname,set_time); + + + //--- open file + + File_t F; + enumError err = CreateFileOpt(&F,true,fname,testmode,lex->fname); + if ( err > ERR_WARNING || !F.f ) + return err; + SetFileAttrib(&F.fatt,&lex->fatt,0); + + + //--- print header + syntax info + + if ( print_header && !brief_count && !export_count ) + fprintf(F.f,text_lex_head_cr); + else + fprintf(F.f, + "%s\r\n" + "# LEX syntax & semantics: https://szs.wiimm.de/info/lex-syntax.html\r\n" + ,LEX_TEXT_MAGIC); + + + //--- print info section & section counter alphabetically + + if ( brief_count || export_count ) + { + fprintf(F.f, + "%s[SETUP]\r\n\r\n" + "TOOL = %s\r\n" + "SYSTEM2 = %s\r\n" + "VERSION = %s\r\n" + "REVISION = %u\r\n" + "DATE = %s\r\n" + "\r\n", + section_sep, + tool_name, SYSTEM2, VERSION, REVISION_NUM, DATE ); + } + else + { + fprintf(F.f, text_lex_setup_cr, + tool_name, SYSTEM2, VERSION, REVISION_NUM, DATE ); + + uint i; + for ( i = 0; i < lex->item_used; i++ ) + { + lex_item_t *s = lex->item[i]; + const uint size = ntohl(s->elem.size); + fprintf(F.f,"# %-4.4s %08x, 0x%04x bytes\r\n", + PrintID(&s->elem.magic,4,0), s->elem.magic, size ); + } + } + + enumError max_err = ERR_OK; + + uint i; + for ( i = 0; i < lex->item_used; i++ ) + { + lex_item_t *s = lex->item[i]; + const uint size = ntohl(s->elem.size); + const u32 magic = ntohl(s->elem.magic); + enumError err = ERR_OK; + switch(magic) + { + case LEXS_FEA0: err = SaveTextLEX_FEA0(F.f,lex,s); break; + case LEXS_SET1: err = SaveTextLEX_SET1(F.f,lex,s); break; + case LEXS_CANN: err = SaveTextLEX_CANN(F.f,lex,s); break; + case LEXS_HIPT: err = SaveTextLEX_HIPT(F.f,lex,s); break; + case LEXS_TEST: err = SaveTextLEX_TEST(F.f,lex,s); break; + + default: + hexdump_eol = "\r\n"; + fprintf(F.f,text_lex_hexdump_cr, + s->sort_order, magic, PrintID(&s->elem.magic,4,0) ); + HexDump(F.f,0,0,5,16,s->elem.data,size); + break; + } + + if ( max_err < err ) + max_err = err; + } + + fputs(section_end,F.f); + ResetFile(&F,set_time); + return max_err; +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// LEX options /////////////// +/////////////////////////////////////////////////////////////////////////////// + +bool opt_lex_features = false; +bool opt_lex_rm_features = false; +bool opt_lex_purge = false; +bool force_lex_test = false; +bool opt_lt_clear = false; +int opt_lt_online = -9; +int opt_lt_n_offline = -9; +int opt_lt_n_online = -9; +int opt_lt_cond_bit = -9; +int opt_lt_game_mode = -9; +int opt_lt_engine = -9; +int opt_lt_random = -9; + +//----------------------------------------------------------------------------- + +int ScanOptLtOnline ( ccp arg ) +{ + if ( !arg || !*arg ) + opt_lt_online = -9; + else + { + int abbrev; + const KeywordTab_t *key = ScanKeyword(&abbrev,arg,lex_offline_online); + if (!key) + { + PrintKeywordError(lex_offline_online,arg,abbrev,0, + "keyword for option --lt-online"); + return 1; + } + opt_lt_online = key->id; + } + return 0; +} + +//----------------------------------------------------------------------------- + +int ScanOptLtNPlayers ( ccp arg ) +{ + if ( !arg || !*arg ) + opt_lt_n_offline = opt_lt_n_online = -9; + else + { + ccp comma = strchr(arg,','); + if (comma) + { + opt_lt_n_offline = str2l(arg,0,10); + opt_lt_n_online = str2l(comma+1,0,10); + } + else + { + int n = str2l(arg,0,10); + if ( n > 4 ) + { + opt_lt_n_offline = -9; + opt_lt_n_online = n; + } + else + { + opt_lt_n_offline = n; + opt_lt_n_online = -9; + } + } + + if ( opt_lt_n_offline < 0 ) + opt_lt_n_offline = -9; + else if ( opt_lt_n_offline > 4 ) + opt_lt_n_offline = 4; + + if ( opt_lt_n_online < 0 ) + opt_lt_n_online = -9; + else if ( opt_lt_n_online > 99 ) + opt_lt_n_online = 99; + } + + return 0; +} + +//----------------------------------------------------------------------------- + +int ScanOptLtCondBit ( ccp arg ) +{ + if ( !arg || !*arg ) + opt_lt_cond_bit = -9; + else + { + int n = str2l(arg,0,10); + opt_lt_cond_bit = n < -1 || n >= 16 ? -9 : n; + } + return 0; +} + +//----------------------------------------------------------------------------- + +int ScanOptLtGameMode ( ccp arg ) +{ + if ( !arg || !*arg ) + opt_lt_game_mode = -1; + else + { + int abbrev; + const KeywordTab_t *key = ScanKeyword(&abbrev,arg,lex_game_mode); + if (!key) + { + PrintKeywordError(lex_game_mode,arg,abbrev,0, + "keyword for option --lt-game-mode"); + return 1; + } + opt_lt_game_mode = key->id; + } + return 0; +} + +//----------------------------------------------------------------------------- + +int ScanOptLtEngine ( ccp arg ) +{ + if ( !arg || !*arg ) + opt_lt_engine = -1; + else + { + int abbrev; + const KeywordTab_t *key = ScanKeyword(&abbrev,arg,lex_engine); + if (!key) + { + PrintKeywordError(lex_engine,arg,abbrev,0, + "keyword for option --lt-engine"); + return 1; + } + opt_lt_engine = key->id; + } + return 0; +} + +//----------------------------------------------------------------------------- + +int ScanOptLtRandom ( ccp arg ) +{ + if ( !arg || !*arg ) + opt_lt_random = -1; + else + { + int n = str2l(arg,0,10); + opt_lt_random = n < 0 || n > 6 ? -9 : n; + } + return 0; +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// lex_info_t /////////////// +/////////////////////////////////////////////////////////////////////////////// + +void SetupLexInfo ( lex_info_t *info, const lex_t *lex ) +{ + DASSERT(info); + InitializeLexInfo(info); + + if (lex) + { + info->lex_found = true; + info->have_sect = lex->have_sect; + info->have_feat = lex->have_feat; + + lex_item_t *item; + item = FindElementLEX(lex,LEXS_SET1); + if (item) + { + info->set1_found = true; + memcpy(&info->set1,item->elem.data,sizeof(info->set1)); + bef4n(info->set1.item_factor.v,info->set1.item_factor.v,3); + } + + item = FindElementLEX(lex,LEXS_TEST); + if (item) + { + info->test_found = true; + memcpy(&info->test,item->elem.data,sizeof(info->test)); + } + } +} + +/////////////////////////////////////////////////////////////////////////////// + +enumError SetupLexInfoByData ( lex_info_t *info, cvp data, uint data_size ) +{ + lex_t lex; + const enumError err = ScanLEX(&lex,true,data,data_size); + if (!err) + SetupLexInfo(info,&lex); + else + InitializeLexInfo(info); + ResetLEX(&lex); + return err; +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// LEX patching /////////////// +/////////////////////////////////////////////////////////////////////////////// + +// return TRUE if any option set +bool HavePatchTestLEX() +{ + return force_lex_test + || opt_lt_clear + || opt_lt_online >= 0 + || opt_lt_n_offline >= 0 + || opt_lt_n_online >= 0 + || opt_lt_game_mode >= 0 + || opt_lt_engine >= 0 + || opt_lt_random >= 0; +} + + +//----------------------------------------------------------------------------- + +// return TRUE if any option set and not default +bool HaveActivePatchTestLEX() +{ + return force_lex_test + || opt_lt_online > 0 + || opt_lt_n_offline > 0 + || opt_lt_n_online > 0 + || opt_lt_game_mode > LEX_GMODE_AUTO + || opt_lt_engine > LEX_ENGINE_AUTO + || opt_lt_random >= 0; +} + +//----------------------------------------------------------------------------- + +// return TRUE if modified / set optional 'empty' to true, if test section is empty +bool PatchTestLEX ( lex_test_t *lt, bool *empty ) +{ + DASSERT(lt); + PRINT0("--lt-*: clear=%d, online=%d, n=%d,%d, gm=%d, en=%d, rnd=%d\n", + opt_lt_clear, opt_lt_online, opt_lt_n_offline, opt_lt_n_online, + opt_lt_game_mode, opt_lt_engine, opt_lt_random ); + + lex_test_t temp; + memcpy( &temp, opt_lt_clear ? (lex_test_t*)&TestDataLEX : lt, sizeof(temp) ); + + if ( opt_lt_online >= LEX_OO_AUTO && opt_lt_online <= LEX_OO_ONLINE ) + temp.offline_online = opt_lt_online; + + if ( opt_lt_n_offline >= 0 ) + temp.n_offline = opt_lt_n_offline > 4 ? 4 : opt_lt_n_offline; + + if ( opt_lt_n_online >= 0 ) + temp.n_online = opt_lt_n_online > 99 ? 99 : opt_lt_n_online; + + if ( opt_lt_cond_bit >= -1 && opt_lt_cond_bit < 16 ) + temp.cond_bit = opt_lt_cond_bit; + + if ( opt_lt_game_mode >= 0 ) + temp.game_mode = opt_lt_game_mode; + + if ( opt_lt_engine >= 0 ) + temp.engine = opt_lt_engine; + + if ( opt_lt_random >= 0 ) + temp.random = opt_lt_random; + + if (empty) + *empty = !memcmp(&temp,&TestDataLEX,sizeof(temp)); + if (memcmp(lt,&temp,sizeof(*lt))) + { + memcpy(lt,&temp,sizeof(*lt)); + return true; + } + + return false; +} + +//----------------------------------------------------------------------------- +// return TRUE if modified / set optional 'empty' to true, if test section is empty + +bool PatchFeaturesLEX ( lex_t * lex, const szs_have_t *have, bool *empty ) +{ + DASSERT(lex); + DASSERT(have); + DASSERT(have->valid); + + features_szs_t fs; + SetupFeaturesSZS(&fs,have,true); + const bool need_features = GetFeaturesStatusSZS(&fs) > 1; + + lex_item_t *li = FindElementLEX(lex,LEXS_FEA0); + const bool have_features = li != 0; + + PRINT("--lex-features = %d, --lex-rm-features = %d : have=%d, need=%d\n", + opt_lex_features, opt_lex_rm_features, have_features, need_features ); + + bool modified = false; + if ( opt_lex_rm_features && RemoveElementByMagicLEX(lex,LEXS_FEAT) ) + modified = true; // FEA0 + + if ( have_features && !need_features ) + { + if (RemoveElementLEX(lex,li)) + modified = true; + } + else if ( opt_lex_features + && need_features + && ( !have_features || memcmp(&fs,li->elem.data,sizeof(fs)) )) + { + AppendFea0LEX(lex,true,&fs); + modified = true; + } + + ResetFeaturesSZS(&fs); + + if (empty) + *empty = !need_features; + if (modified) + lex->modified = true; + return modified; +} + +//----------------------------------------------------------------------------- + +bool PatchLEX ( lex_t * lex, const szs_have_t *have ) +{ + DASSERT(lex); + + bool modified = false; + + //--- section TEST + + if (HavePatchTestLEX()) + { + lex_item_t *li = FindElementLEX(lex,LEXS_TEST); + const bool had_test = li != 0; + if (!had_test) + { + if (!HaveActivePatchTestLEX()) + return 0; + li = AppendTestLEX(lex,false); + } + DASSERT(li); + lex_test_t orig; + memcpy(&orig,li->elem.data,sizeof(orig)); + + bool empty; + modified = PatchTestLEX((lex_test_t*)li->elem.data,&empty); + PRINT("PATCH+ LEX/TEST: had=%d, empty=%d, modified=%d => have_lex:%x,%x\n", + had_test, empty, modified, lex->have_sect, lex->have_feat ); + if ( empty && !force_lex_test ) + { + if ( RemoveElementLEX(lex,li) && had_test ) + modified = true; + } + else if (!had_test) + modified = true; + + PRINT("PATCH- LEX/TEST: had=%d, empty=%d, modified=%d => have_lex:%x,%x\n", + had_test, empty, modified, lex->have_sect, lex->have_feat ); + + } + + + //--- section FEA0 + + if ( HavePatchFeaturesLEX() && have && have->valid ) + { + szs_have_t temp = *have; + temp.lex_sect = lex->have_sect; + temp.lex_feat = lex->have_feat; + + if (PatchFeaturesLEX(lex,&temp,0)) + modified = true; + } + + + //--- terminate + + if (opt_lex_purge) + modified |= PurgeLEX(lex); + + if (modified) + lex->modified = true; + + return modified; +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// LEX purging /////////////// +/////////////////////////////////////////////////////////////////////////////// + +bool PurgeLEX ( lex_t * lex ) +{ + DASSERT(lex); + + bool modified = false; + + uint i = 0; + while ( i < lex->item_used ) + { + lex_item_t **ss = lex->item+i; + const uint size = ntohl((*ss)->elem.size); + const u8 *data = (*ss)->elem.data; + + bool remove = false; + switch(ntohl((*ss)->elem.magic)) + { + case LEXS_FEA0: + remove = GetFeaturesStatusSZS((features_szs_t*)data) < 2; + break; + + case LEXS_SET1: + remove = !IsActiveLEXElement_SET1((lex_set1_t*)data); + break; + + case LEXS_CANN: + remove = size <= sizeof(CannonDataLEX) + && !memcmp(data,&CannonDataLEX,size); + break; + + case LEXS_HIPT: + remove = size < sizeof(lex_hipt_rule_t); + break; + + case LEXS_TEST: + remove = !IsActiveLEXElement_TEST((lex_test_t*)data); + break; + + default: + remove = true; + break; + } + + if (remove) + modified |= RemoveElementLEX(lex,*ss); + else + i++; + } + + if (modified) + UpdateHaveLex(lex); + + return modified; +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// END /////////////// +/////////////////////////////////////////////////////////////////////////////// + diff --git a/project/src/lib-lex.h b/project/src/lib-lex.h new file mode 100644 index 0000000..3667703 --- /dev/null +++ b/project/src/lib-lex.h @@ -0,0 +1,569 @@ + +/*************************************************************************** + * _______ _______ _______ * + * | ___ |____ | ___ | * + * | | |_| / /| | |_| * + * | |_____ / / | |_____ * + * |_____ | / / |_____ | * + * _ | | / / _ | | * + * | |___| |/ /____| |___| | * + * |_______|_______|_______| * + * * + * Wiimms SZS Tools * + * https://szs.wiimm.de/ * + * * + *************************************************************************** + * * + * This file is part of the SZS project. * + * Visit https://szs.wiimm.de/ for project details and sources. * + * * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * + * * + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program 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 General Public License for more details. * + * * + * See file gpl-2.0.txt or http://www.gnu.org/licenses/gpl-2.0.txt * + * * + ***************************************************************************/ + +#ifndef SZS_LIB_LEX_H +#define SZS_LIB_LEX_H 1 + +#include "lib-std.h" +#include "lib-mkw.h" + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// definitions /////////////// +/////////////////////////////////////////////////////////////////////////////// + +struct raw_data_t; +struct szs_have_t; + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// features_szs_t /////////////// +/////////////////////////////////////////////////////////////////////////////// +// [[features_szs_t]] + +#define FIRST_FEATURE_SZS_OFFSET 2 + +typedef struct features_szs_t +{ + u16 size_be; // size of features_szs_t in big endian + // == version number + + //--- SZS files (initial list) + + u8 f_lex; // HAVESZS_COURSE_LEX + u8 f_item_slot_table; // HAVESZS_ITEM_SLOT_TABLE + u8 f_objflow; // HAVESZS_OBJFLOW + u8 f_ght_item; // HAVESZS_GHT_ITEM + u8 f_ght_item_obj; // HAVESZS_GHT_ITEM_OBJ + u8 f_ght_kart; // HAVESZS_GHT_KART + u8 f_ght_kart_obj; // HAVESZS_GHT_KART_OBJ + u8 f_minigame; // HAVESZS_MINIGAME + + //--- KMP features (initial list) + + u8 kmp_woodbox_ht; // HAVEKMP_WOODBOX_HT + u8 kmp_mushroom_car; // HAVEKMP_MUSHROOM_CAR + u8 kmp_penguin_pos; // HAVEKMP_PENGUIN_POS + u8 kmp_second_ktpt; // HAVEKMP_SECOND_KTPT + u8 kmp_extended_pflags; // HAVEKMP_X_PFLAGS + u8 kmp_xpf_cond_obj; // HAVEKMP_X_COND + u8 kmp_xpf_def_obj; // HAVEKMP_X_DEFOBJ + u8 kmp_xpf_random; // HAVEKMP_X_RANDOM + u8 kmp_eprop_speed; // HAVEKMP_EPROP_SPEED + u8 kmp_coob_riidefii; // HAVEKMP_COOB_R + u8 kmp_coob_khacker; // HAVEKMP_COOB_K + u8 kmp_uncond_oob; // HAVEKMP_UOOB + + //--- LEX sections (initial list) + + u8 lex_sect_fea0; // HAVELEXS_FEA0 + u8 lex_sect_test; // HAVELEXS_TEST + u8 lex_sect_set1; // HAVELEXS_SET1 + u8 lex_sect_cann; // HAVELEXS_CANN + u8 lex_sect_hipt; // HAVELEXS_HIPT + + //--- LEX features (initial list) + + u8 lex_test_active; // HAVELEXF_TEST_ACTIVE + u8 lex_item_range; // HAVELEXF_ITEM_RANGE + u8 lex_cannon; // HAVELEXF_CANNON + u8 lex_hide_pos; // HAVELEXF_HIDE_POS + + //--- new files and features will be appended here +} +__attribute__ ((packed)) features_szs_t; + +//----------------------------------------------------------------------------- + +void InitializeFeaturesSZS ( features_szs_t * fs ); +static inline void ResetFeaturesSZS ( features_szs_t * fs ) {} + +void SetupFeaturesSZS + ( features_szs_t *fs, const struct szs_have_t *have, bool is_lex ); +void SetIsLexFeaturesSZS ( features_szs_t *fs ); + +int GetFeaturesStatusSZS ( const features_szs_t *fs ); + // returns + // 0: all features set to null + // 1: all features except f_lex + lex_sect_fea0 are set to null + // 2: any features except f_lex + lex_sect_fea0 is not NULL + +void PrintFeaturesSZS +( + PrintScript_t *ps, // valid output definition + const features_szs_t *fs, // valid source + bool is_lex, // TRUE: Create output for a LEX file + int comments, // >0: add extended comments + int print_modes, // >0: append ",MODES" + u8 include, // print only if all bits match + u8 exclude // exclude if any bit match +); + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// features_szs_mode_t /////////////// +/////////////////////////////////////////////////////////////////////////////// +// [[features_szs_mode_t]] + +typedef enum features_szs_mode_t +{ + FZM_SECTION = 0x01, // S: is a section + FZM_VISUAL = 0x02, // V: visual impact + FZM_GAMEPLAY = 0x04, // G: gameplay impact + + FZM_BATTLE = 0x08, // B: impact on coin runners and balloon battle + FZM_RACING = 0x10, // R: impact on racings + + FZM_TIMETRIAL = 0x20, // T: impact on time trial + FZM_OFFLINE = 0x40, // L: impact on offline battles/races + FZM_ONLINE = 0x80, // O: impact on online battles/races + + FZM_M_KIND = FZM_VISUAL | FZM_GAMEPLAY, + FZM_M_TYPE = FZM_BATTLE | FZM_RACING, + FZM_M_WHERE = FZM_TIMETRIAL | FZM_OFFLINE | FZM_ONLINE, + FZM__MASK = FZM_SECTION | FZM_M_KIND | FZM_M_TYPE | FZM_M_WHERE, + +} +features_szs_mode_t; + +//----------------------------------------------------------------------------- + +ccp GetFeaturesMode ( features_szs_mode_t mode ); +ccp GetFeaturesEffects ( features_szs_mode_t mode ); +ccp GetFeaturesEffectsByOffset ( uint offset ); + +const features_szs_t * GetFeaturesModes(); + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// lecode extension LEX /////////////// +/////////////////////////////////////////////////////////////////////////////// + +#define LEX_MAJOR_VERSION 1 +#define LEX_MINOR_VERSION 0 + +#define LEX_BIN_MAGIC "LE-X" +#define LEX_BIN_MAGIC_NUM 0x4c452d58 +#define LEX_TEXT_MAGIC "#LEX" +#define LEX_TEXT_MAGIC_NUM 0x234c4558 + +/////////////////////////////////////////////////////////////////////////////// +// [[have_lex_sect_t]] +// order is important, compare have_lex_sect_info[] and ct.wiimm.de + +typedef enum have_lex_sect_t +{ + HAVELEXS_SET1, + HAVELEXS_CANN, + HAVELEXS_TEST, + HAVELEXS_HIPT, + HAVELEXS_FEA0, + //--- add new elements here (order is important) + HAVELEXS__N +} +have_lex_sect_t; + +/////////////////////////////////////////////////////////////////////////////// +// [[have_lex_feat_t]] +// order is important, compare have_lex_feat_info[] and ct.wiimm.de + +typedef enum have_lex_feat_t +{ + HAVELEXF_TEST_ACTIVE, + HAVELEXF_ITEM_RANGE, + HAVELEXF_CANNON, + HAVELEXF_HIDE_POS, + //--- add new elements here (order is important) + HAVELEXF__N +} +have_lex_feat_t; + +//----------------------------------------------------------------------------- +// [[lex_stream_id]] + +typedef enum lex_stream_id +{ + LEXS_TERMINATE = 0, // terminate stream + LEXS_IGNORE = 0x2d2d2d2d, // "----" ignore and remove + + LEXS_FEA0 = 0x46454130, // "FEA0" features + LEXS_FEAT = 0x46454154, // "FEAT" features + LEXS_SET1 = 0x53455431, // "SET1" primary settings + LEXS_CANN = 0x43414e4e, // "CANN" cannon settings + LEXS_HIPT = 0x48495054, // "HIPT" hide position tracker + LEXS_TEST = 0x54455354, // "TEST" settings for tests +} +lex_stream_id; + +//----------------------------------------------------------------------------- +// [[have_lex_info_t]] + +typedef struct have_lex_info_t +{ + u32 magic; // section magic + ccp name; // info name + uint min_size; // minimal size for 'is available' +} +have_lex_info_t; + +extern const have_lex_info_t have_lex_sect_info[HAVELEXS__N]; +extern const have_lex_info_t have_lex_feat_info[HAVELEXF__N]; + +//----------------------------------------------------------------------------- +// [[lex_header_t]] + +typedef struct lex_header_t +{ + char magic[4]; // always LEX_BIN_MAGIC + u16 major_version; // usually LEX_MAJOR_VERSION + u16 minor_version; // usually LEX_MINOR_VERSION + u32 size; // size of this file (header+streams) + u32 element_off; // offset of first lex_element_t, 32-bit aligned +} +__attribute__ ((packed)) lex_header_t; + +//----------------------------------------------------------------------------- +// [[lex_element_t]] + +typedef struct lex_element_t +{ + u32 magic; // identification of section + u32 size; // size of 'data' (this header excluded) + u8 data[]; // section data, 32-bit aligned +} +__attribute__ ((packed)) lex_element_t; + +//----------------------------------------------------------------------------- +// [[lex_set1_t]] + +typedef struct lex_set1_t +{ + float3 item_factor; // factor for item positions, always >=1.0 + u8 test[4]; // 4 test values (TEST1..TEST4) +} +__attribute__ ((packed,aligned(4))) lex_set1_t; + +//----------------------------------------------------------------------------- +// [[lex_hipt_rule_t]] + +typedef struct lex_hipt_rule_t +{ + u8 cond; // condition bits: 1:offline, 2:online + s8 lap; // compare lap index with this. 99=all laps + u8 from; // compare CHKT >= from + u8 to; // && CHKT <= to + u8 mode; // result: 0=hide, 1:show +} +__attribute__ ((packed)) lex_hipt_rule_t; + +//----------------------------------------------------------------------------- +// [[lex_test_t]] + +typedef struct lex_test_t +{ + u8 offline_online; // 1: assume offline / 2: assume online + u8 n_offline; // >0: assume # offline humans at Wii + u8 n_online; // >0: assume # players total if playing online + s8 cond_bit; // >=0: use bit # for CONDITIONS + u8 game_mode; // one of LEX_GMODE_* + u8 random; // 1..8: force random scenario + u8 engine; // >=0: force engine := kmp_engine_t+1 + u8 padding; +} +__attribute__ ((packed,aligned(4))) lex_test_t; + +/////////////////////////////////////////////////////////////////////////////// + +typedef enumError (*lex_stream_func) + ( u32 magic, const u8 *data, uint size, cvp user_ptr, int user_int ); + +enumError ScanLexFile + ( cvp data, uint data_size, lex_stream_func func, cvp user_ptr, int user_int ); +enumError ScanLexElements + ( cvp data, uint data_size, lex_stream_func func, cvp user_ptr, int user_int ); + +lex_element_t * FindLexElement ( lex_header_t *head, uint data_size, u32 magic ); + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// lex_t /////////////// +/////////////////////////////////////////////////////////////////////////////// +// [[lex_item_t]] + +typedef struct lex_item_t +{ + uint sort_order; // sort priority, lesser comes first + uint insert_order; // second sort priority + + // always last element because of various size!! + lex_element_t elem; // raw element data, big endian +} +lex_item_t; + +/////////////////////////////////////////////////////////////////////////////// +// [[lex_t]] + +typedef struct lex_t +{ + //--- base info + + ccp fname; // alloced filename of loaded file + FileAttrib_t fatt; // file attribute + file_format_t fform; // FF_LEX | FF_LEX_TXT + bool develop; // true: enable developer mode + bool modified; // true: modified after loading + + + //--- sections + + uint item_used; // number of used items + uint item_size; // number of alloced items + lex_item_t **item; // NULL or item list (alloced) + uint have_sect; // bit field for found lex sections + uint have_feat; // bit field for found lex features + + + //--- parser helpers + + int revision; // tool revision + bool is_pass2; // true: LEX compiler runs pass2 + + + //--- raw data, created by CreateRawLEX() + + u8 * raw_data; // NULL or data + uint raw_data_size; // size of 'raw_data' +} +lex_t; + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// LEX interface /////////////// +/////////////////////////////////////////////////////////////////////////////// + +void InitializeLEX ( lex_t * lex ); +void ResetLEX ( lex_t * lex ); +void UpdateLEX ( lex_t * lex, bool add_missing, bool add_test ); + +lex_item_t * AppendFea0LEX ( lex_t * lex, bool overwrite, const features_szs_t *src_fs ); +lex_item_t * AppendSet1LEX ( lex_t * lex, bool overwrite ); +lex_item_t * AppendCannLEX ( lex_t * lex, bool overwrite ); +lex_item_t * AppendHiptLEX ( lex_t * lex, bool overwrite ); +lex_item_t * AppendTestLEX ( lex_t * lex, bool overwrite ); + +const VarMap_t * SetupVarsLEX(); + +void DumpElementsLEX ( FILE *f, lex_t *lex, bool hexdump ); + +ccp CreateSectionInfoLEX + ( have_lex_sect_t special, bool add_value, ccp return_if_empty ); +ccp CreateFeatureInfoLEX + ( have_lex_feat_t special, bool add_value, ccp return_if_empty ); + +uint GetLexFeatures ( const lex_element_t *elem ); + +static inline bool IsLexFF ( file_format_t fform ) + { return fform == FF_LEX || fform == FF_LEX_TXT; } + +/////////////////////////////////////////////////////////////////////////////// + +enumError ScanRawLEX +( + lex_t * lex, // LEX data structure + bool init_lex, // true: initialize 'lex' first + const void * data, // data to scan + uint data_size, // size of 'data' + uint dump_mode // 0: add element to lex->sect + // 1: dump scanned elements + // >=0x10: add hexdump of max # bytes +); + +//----------------------------------------------------------------------------- + +enumError ScanTextLEX +( + lex_t * lex, // LEX data structure + bool init_lex, // true: initialize 'lex' first + const void * data, // data to scan + uint data_size // size of 'data' +); + +//----------------------------------------------------------------------------- + +enumError ScanLEX +( + lex_t * lex, // LEX data structure + bool init_lex, // true: initialize 'lex' first + const void * data, // data to scan + uint data_size // size of 'data' +); + +//----------------------------------------------------------------------------- + +enumError ScanRawDataLEX +( + lex_t * lex, // LEX data structure + bool init_lex, // true: initialize 'lex' first + struct raw_data_t * raw // valid raw data +); + +/////////////////////////////////////////////////////////////////////////////// + +enumError LoadLEX +( + lex_t * lex, // LEX data structure + bool init_lex, // true: initialize 'lex' first + ccp fname, // valid pointer to filenname + bool ignore_no_file // ignore if file does not exists + // and return warning ERR_NOT_EXISTS +); + +//----------------------------------------------------------------------------- + +enumError CreateRawLEX +( + lex_t * lex // pointer to valid LEX +); + +//----------------------------------------------------------------------------- + +enumError SaveRawLEX +( + lex_t * lex, // pointer to valid LEX + ccp fname, // filename of destination + bool set_time // true: set time stamps +); + +//----------------------------------------------------------------------------- + +enumError SaveTextLEX +( + const lex_t * lex, // pointer to valid LEX + ccp fname, // filename of destination + bool set_time // true: set time stamps +); + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// lex_info_t /////////////// +/////////////////////////////////////////////////////////////////////////////// +// [[lex_info_t]] + +typedef struct lex_info_t +{ + uint have_sect; // bit field for found lex sections + uint have_feat; // bit field for found lex features + + bool lex_found; // true: LEX file found + + bool set1_found; // true: section SET1 found + lex_set1_t set1; // data of section SET1 + + bool test_found; // true: section TEST found + lex_set1_t test; // data of section TEST +} +lex_info_t; + +/////////////////////////////////////////////////////////////////////////////// + +static inline void InitializeLexInfo ( lex_info_t *info ) + { DASSERT(info); memset(info,0,sizeof(*info)); } + +static inline void ResetLexInfo ( lex_info_t *info ) + { if (info) memset(info,0,sizeof(*info)); } + +void SetupLexInfo ( lex_info_t *info, const lex_t *lex ); +enumError SetupLexInfoByData ( lex_info_t *info, cvp data, uint data_size ); + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// LEX patching /////////////// +/////////////////////////////////////////////////////////////////////////////// + +extern bool opt_lex_features; +extern bool opt_lex_rm_features; +extern bool opt_lex_purge; +extern bool force_lex_test; +extern bool opt_lt_clear; +extern int opt_lt_online; +extern int opt_lt_n_offline; +extern int opt_lt_n_online; +extern int opt_lt_itemrain; + +int ScanOptLtOnline ( ccp arg ); +int ScanOptLtNPlayers ( ccp arg ); +int ScanOptLtCondBit ( ccp arg ); +int ScanOptLtGameMode ( ccp arg ); +int ScanOptLtEngine ( ccp arg ); +int ScanOptLtRandom ( ccp arg ); + +// return TRUE if any option set +bool HavePatchTestLEX(); +bool HaveActivePatchTestLEX(); + +static inline bool HavePatchFeaturesLEX() + { return opt_lex_features || opt_lex_rm_features; } + +static inline bool HavePatchLEX() + { return opt_lex_purge || HavePatchFeaturesLEX() || HavePatchTestLEX(); } + +static inline bool HaveActivePatchLEX() + { return opt_lex_purge || HavePatchFeaturesLEX() || HaveActivePatchTestLEX(); } + +static inline bool HaveAddSectionsLEX() + { return HavePatchFeaturesLEX() || HaveActivePatchTestLEX(); } + +// return TRUE if modified / set optional 'empty' to true, if test section is empty +bool PatchTestLEX ( lex_test_t *lt, bool *empty ); +bool PatchFeaturesLEX ( lex_t * lex, const struct szs_have_t *have, bool *empty ); +bool PatchLEX ( lex_t * lex, const struct szs_have_t *have ); +bool PurgeLEX ( lex_t *lex ); + +struct szs_norm_t; +void AddSectionsLEX ( struct szs_file_t *szs, struct szs_norm_t *norm, + const struct szs_have_t * have ); + +bool LEX_ACTION_LOG ( bool is_patch, const char * format, ... ) + __attribute__ ((__format__(__printf__,2,3))); + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// END /////////////// +/////////////////////////////////////////////////////////////////////////////// + +#endif // SZS_LIB_LECODE_H + diff --git a/project/src/lib-mdl.c b/project/src/lib-mdl.c index 72c055b..88bd7cd 100644 --- a/project/src/lib-mdl.c +++ b/project/src/lib-mdl.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-mdl.h b/project/src/lib-mdl.h index 35316d9..bf0142f 100644 --- a/project/src/lib-mdl.h +++ b/project/src/lib-mdl.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-minigame.c b/project/src/lib-minigame.c index 59eead7..2c4b53f 100644 --- a/project/src/lib-minigame.c +++ b/project/src/lib-minigame.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-numeric.c b/project/src/lib-numeric.c index 08c88af..b868f84 100644 --- a/project/src/lib-numeric.c +++ b/project/src/lib-numeric.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-numeric.h b/project/src/lib-numeric.h index 2239a0f..a7c741a 100644 --- a/project/src/lib-numeric.h +++ b/project/src/lib-numeric.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -196,6 +196,8 @@ typedef enum lex_gmode_t LEX_GMODE_COIN = LEX_GMODE__BASE + KMP_GMODE_COIN, LEX_GMODE_VERSUS = LEX_GMODE__BASE + KMP_GMODE_VERSUS, LEX_GMODE_ITEMRAIN = LEX_GMODE__BASE + KMP_GMODE_ITEMRAIN, + + LEX_GMODE__N } lex_gmode_t; @@ -300,6 +302,8 @@ int ScanOptMaxMipmaps ( ccp arg ); int ScanOptMipmapSize ( ccp arg ); int ScanOptPtDir ( ccp arg ); int ScanOptRecurse ( ccp arg ); +int ScanOptCase ( ccp arg ); +int ScanOptFModes ( ccp arg ); // /////////////////////////////////////////////////////////////////////////////// @@ -920,7 +924,7 @@ static inline bool isScalarVM ( VarMode_t mode ) { return mode <= VAR_DOUBLE; } static inline bool isNumericVM ( VarMode_t mode ) - { return mode >= VAR_INT || mode <= VAR_VECTOR; } + { return mode >= VAR_INT && mode <= VAR_VECTOR; } /////////////////////////////////////////////////////////////////////////////// // [[Var_t]] diff --git a/project/src/lib-object.c b/project/src/lib-object.c index bc84479..9e93781 100644 --- a/project/src/lib-object.c +++ b/project/src/lib-object.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-object.h b/project/src/lib-object.h index 360c573..ff96b32 100644 --- a/project/src/lib-object.h +++ b/project/src/lib-object.h @@ -18,7 +18,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-objflow.c b/project/src/lib-objflow.c index 773b0dc..5cda47a 100644 --- a/project/src/lib-objflow.c +++ b/project/src/lib-objflow.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-pack.c b/project/src/lib-pack.c index 3edaafb..ecc57d9 100644 --- a/project/src/lib-pack.c +++ b/project/src/lib-pack.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-pack.h b/project/src/lib-pack.h index ab343ec..dc01a00 100644 --- a/project/src/lib-pack.h +++ b/project/src/lib-pack.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-parser-func.c b/project/src/lib-parser-func.c index 55e7c61..d8e1e48 100644 --- a/project/src/lib-parser-func.c +++ b/project/src/lib-parser-func.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-parser.c b/project/src/lib-parser.c index 3224c12..5285d4d 100644 --- a/project/src/lib-parser.c +++ b/project/src/lib-parser.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-pat.c b/project/src/lib-pat.c index f1cbf6a..632a2d3 100644 --- a/project/src/lib-pat.c +++ b/project/src/lib-pat.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-pat.h b/project/src/lib-pat.h index 319c777..7157544 100644 --- a/project/src/lib-pat.h +++ b/project/src/lib-pat.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-rarc.c b/project/src/lib-rarc.c index e6dc911..3088ddf 100644 --- a/project/src/lib-rarc.c +++ b/project/src/lib-rarc.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-rarc.h b/project/src/lib-rarc.h index 329bf66..3514668 100644 --- a/project/src/lib-rarc.h +++ b/project/src/lib-rarc.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-rkc.c b/project/src/lib-rkc.c index c3deb92..c1e4afb 100644 --- a/project/src/lib-rkc.c +++ b/project/src/lib-rkc.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-rkc.h b/project/src/lib-rkc.h index 414141a..53be8ec 100644 --- a/project/src/lib-rkc.h +++ b/project/src/lib-rkc.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-rkg.c b/project/src/lib-rkg.c index a120228..d89dd7c 100644 --- a/project/src/lib-rkg.c +++ b/project/src/lib-rkg.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-rkg.h b/project/src/lib-rkg.h index 0f4de23..d82245c 100644 --- a/project/src/lib-rkg.h +++ b/project/src/lib-rkg.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-staticr.c b/project/src/lib-staticr.c index 9e6a576..8919309 100644 --- a/project/src/lib-staticr.c +++ b/project/src/lib-staticr.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-staticr.h b/project/src/lib-staticr.h index afa62f6..48e07d1 100644 --- a/project/src/lib-staticr.h +++ b/project/src/lib-staticr.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-std.c b/project/src/lib-std.c index 74d7cf8..f23d3c6 100644 --- a/project/src/lib-std.c +++ b/project/src/lib-std.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -63,6 +63,7 @@ #include "dclib-ui.h" #include "lib-mkw.h" #include "db-mkw.h" +#include "crypt.h" #include "logo.inc" #ifdef WIN_SZS_LIB @@ -81,7 +82,7 @@ ccp tool_name = "?"; ccp share_path = 0; ccp search_path[6] = {0}; -ccp auto_add_path[6] = {0}; // same size as search path +ccp auto_add_path[6] = {0}; // same size as search path volatile int SIGINT_level = 0; volatile int verbose = 0; volatile int logging = 0; @@ -120,6 +121,10 @@ file_format_t fform_compr_force = 0; file_format_t script_fform = FF_TXT; ccp script_varname = "res"; int script_array = 0; +LowerUpper_t opt_case = LOUP_AUTO; +int opt_pmodes = 0; +uint opt_fmodes_include = 0; +uint opt_fmodes_exclude = 0; int opt_pt_dir = 0; bool opt_links = false; bool opt_rm_aiparam = false; @@ -309,6 +314,26 @@ const char is_arena_name[ARENA__N][9] = // /////////////////////////////////////////////////////////////////////////////// +/////////////// debugging helper /////////////// +/////////////////////////////////////////////////////////////////////////////// + +void LogSHA1 ( ccp func, ccp file, uint line, cvp data, uint size, ccp info ) +{ + if (data) + { + sha1_hash_t hash; + SHA1(data,size,hash); + + sha1_hex_t hex; + Sha1Bin2Hex(hex,hash); + + fprintf(stderr,"%s %s(), %s @%u : [%u] %s\n", + hex, func, file, line, size, info ? info : "" ); + } +} + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// Setup /////////////// /////////////////////////////////////////////////////////////////////////////// @@ -3228,6 +3253,66 @@ int ScanOptRecurse ( ccp arg ) } /////////////////////////////////////////////////////////////////////////////// + +int ScanOptCase ( ccp arg ) +{ + const int stat = ScanKeywordLowerAutoUpper(arg,LOUP_AUTO,0,"Option --case"); + if ( stat == LOUP_ERROR ) + return 1; + + opt_case = stat; + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +int ScanOptFModes ( ccp arg ) +{ + opt_fmodes_include = 0; + opt_fmodes_exclude = 0; + + if (!arg) + return 0; + + const int NO = 0x1000; + const int BOTH = 0x1001; + static const KeywordTab_t keytab[] = + { + { FZM_SECTION, "SECTION", 0, BOTH*FZM_SECTION }, + { FZM_VISUAL, "VISUAL", 0, BOTH*FZM_VISUAL }, + { FZM_GAMEPLAY, "GAMEPLAY", 0, BOTH*FZM_GAMEPLAY }, + { FZM_BATTLE, "BATTLE", 0, BOTH*FZM_BATTLE }, + { FZM_RACING, "RACING", 0, BOTH*FZM_RACING }, + { FZM_TIMETRIAL, "TIMETRIAL", 0, BOTH*FZM_TIMETRIAL }, + { FZM_OFFLINE, "OFFLINE", "LOCAL", BOTH*FZM_OFFLINE }, + { FZM_ONLINE, "ONLINE", 0, BOTH*FZM_ONLINE }, + + { NO*FZM_SECTION, "-SECTION", 0, BOTH*FZM_SECTION }, + { NO*FZM_VISUAL, "-VISUAL", 0, BOTH*FZM_VISUAL }, + { NO*FZM_GAMEPLAY, "-GAMEPLAY", 0, BOTH*FZM_GAMEPLAY }, + { NO*FZM_BATTLE, "-BATTLE", 0, BOTH*FZM_BATTLE }, + { NO*FZM_RACING, "-RACING", 0, BOTH*FZM_RACING }, + { NO*FZM_TIMETRIAL, "-TIMETRIAL", 0, BOTH*FZM_TIMETRIAL }, + { NO*FZM_OFFLINE, "-OFFLINE", "-LOCAL", BOTH*FZM_OFFLINE }, + { NO*FZM_ONLINE, "-ONLINE", 0, BOTH*FZM_ONLINE }, + + {0,0,0,0} + }; + + const s64 stat = ScanKeywordList(arg,keytab,0,true,0,0, + "Option --filter",ERR_SYNTAX); + if ( stat == -1 ) + return 1; + + opt_fmodes_include = stat & FZM__MASK; + opt_fmodes_exclude = stat/NO & FZM__MASK; + + PRINT("--filter: %02x %02x\n",opt_fmodes_include,opt_fmodes_exclude); + + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// SlotMode_t opt_slot = SLOTMD_NONE; @@ -5176,33 +5261,7 @@ uint GetMkwMusicSlot ( uint tid ) #ifdef __APPLE__ /////////////////////////////////////////////////////////////////////////////// -void * memmem ( const void *l, size_t l_len, const void *s, size_t s_len ) -{ - register char *cur, *last; - const char *cl = (const char *)l; - const char *cs = (const char *)s; - - /* we need something to compare */ - if (l_len == 0 || s_len == 0) - return NULL; - - /* "s" must be smaller or equal to "l" */ - if (l_len < s_len) - return NULL; - - /* special case where s_len == 1 */ - if (s_len == 1) - return memchr(l, (int)*cs, l_len); - - /* the last position where its possible to find "s" in "l" */ - last = (char *)cl + l_len - s_len; - - for (cur = (char *)cl; cur <= last; cur++) - if (cur[0] == cs[0] && memcmp(cur, cs, s_len) == 0) - return cur; - - return NULL; -} +int ____chkstk_darwin() { return 0; } /////////////////////////////////////////////////////////////////////////////// #endif // __APPLE__ diff --git a/project/src/lib-std.h b/project/src/lib-std.h index 2230199..2fcb06b 100644 --- a/project/src/lib-std.h +++ b/project/src/lib-std.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -70,6 +70,30 @@ // /////////////////////////////////////////////////////////////////////////////// +/////////////// debugging helper /////////////// +/////////////////////////////////////////////////////////////////////////////// + +#undef LOG_SHA1_ENABLED +#undef LOG_SHA1 + +#if defined(TEST) || defined(DEBUG) + #define LOG_SHA1_ENABLED 1 +#elif HAVE_WIIMM_EXT + #define LOG_SHA1_ENABLED 0 +#else + #define LOG_SHA1_ENABLED 0 +#endif + +#if LOG_SHA1_ENABLED + #define LOG_SHA1(d,s,i) LogSHA1(__FUNCTION__,__FILE__,__LINE__,d,s,i) +#else + #define LOG_SHA1(d,s,i) +#endif + +void LogSHA1 ( ccp func, ccp file, uint line, cvp data, uint size, ccp info ); + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// defines /////////////// /////////////////////////////////////////////////////////////////////////////// // also used by UI @@ -2149,7 +2173,7 @@ extern bool use_utf8; extern bool use_de; extern bool ctcode_enabled; extern bool lecode_enabled; -extern uint opt_ct_mode; // calculated by ctcode_enabled & lecode_enabled +extern uint opt_ct_mode; // calculated by ctcode_enabled & lecode_enabled extern int testmode; extern int force_count; extern uint opt_tiny; @@ -2178,6 +2202,10 @@ extern file_format_t fform_compr_force; extern file_format_t script_fform; extern ccp script_varname; extern int script_array; +extern LowerUpper_t opt_case; +extern int opt_pmodes; +extern uint opt_fmodes_include; +extern uint opt_fmodes_exclude; extern int opt_pt_dir; extern bool opt_links; extern bool opt_rm_aiparam; diff --git a/project/src/lib-szs-create.c b/project/src/lib-szs-create.c index a766c7f..e622e17 100644 --- a/project/src/lib-szs-create.c +++ b/project/src/lib-szs-create.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -57,6 +57,8 @@ #include "lib-image.h" #include "lib-object.h" #include "lib-checksum.h" +#include "lib-common.h" +#include "lib-bzip2.h" #include "crypt.h" #include "setup.inc" @@ -106,6 +108,7 @@ static const alter_file_t * ShallRemoveFile ( ccp fname ) static bool AddSlotFiles ( szs_file_t *szs, struct szs_norm_t * norm ) { +// [[norm]] DASSERT(szs); bool dirty = false; if ( szs->fform_arch == FF_U8 || szs->fform_arch == FF_WU8 ) @@ -1103,8 +1106,6 @@ enumError LoadObjFileListSZS } } - //DetectSpecialKMP(&kmp,szs->kmp_special); - //--- slot analysis: 31+71, 62 @@ -1252,6 +1253,7 @@ void FindSpecialFilesSZS { szs->course_kcl_data = szs->data + file->offset; szs->course_kcl_size = file->size; + LOG_SHA1(szs->course_kcl_data,szs->course_kcl_size,"course.kcl"); } else if ( !szs->course_kmp_data && !strcasecmp(fname,"course.kmp") ) { @@ -1262,7 +1264,7 @@ void FindSpecialFilesSZS { szs->course_lex_data = szs->data + file->offset; szs->course_lex_size = file->size; - szs->szs_special[HAVESZS_COURSE_LEX] = true; + szs->have.szs[HAVESZS_COURSE_LEX] = HFM_MODIFIED; } else if ( !szs->course_model_data && !strcasecmp(fname,"course_model.brres") ) { @@ -1310,9 +1312,17 @@ void FindSpecialFilesSZS { uint i; for ( i = 0; i < HAVESZS__N; i++ ) - if ( !szs->szs_special[i] && !strcasecmp(fname,have_szs_file[i]) ) + if ( !strcasecmp(fname,have_szs_file[i]) ) { - szs->szs_special[i] = true; + const BZ2Manager_t *bm = GetCommonBZ2Manager(have_szs_fform[i]); + const have_file_mode_t hfm = + bm + && file->size == bm->size + && !memcmp( file->data ? file->data : szs->data + file->offset, + bm->data, bm->size ) + ? HFM_ORIGINAL : HFM_MODIFIED; + if ( szs->have.szs[i] < hfm ) + szs->have.szs[i] = hfm; break; } } @@ -1325,7 +1335,7 @@ void FindSpecialFilesSZS /////////////////////////////////////////////////////////////////////////////// ccp CreateSpecialFileInfo - ( szs_file_t * szs, bool add_value, ccp return_if_empty ) + ( szs_file_t * szs, uint select, bool add_value, ccp return_if_empty ) { DASSERT(szs); @@ -1336,7 +1346,7 @@ ccp CreateSpecialFileInfo { uint i, val = 0; for ( i = 0; i < HAVESZS__N; i++ ) - if ( szs->szs_special[i] ) + if ( 1 << szs->have.szs[i] & select ) val |= 1 << i; dest = snprintfE( dest, buf+sizeof(buf), "%u=" , val ); } @@ -1344,7 +1354,7 @@ ccp CreateSpecialFileInfo uint i; ccp sep = ""; for ( i = 0; i < HAVESZS__N; i++ ) - if ( szs->szs_special[i] ) + if ( 1 << szs->have.szs[i] & select ) { dest = StringCat2E(dest,buf+sizeof(buf),sep,have_szs_name[i]); sep = ","; @@ -1369,6 +1379,7 @@ static int norm_collect_func if (term) return 0; +// [[norm]] szs_norm_t * norm = it->param; DASSERT(norm); @@ -1400,9 +1411,9 @@ static int norm_collect_func lex_t lex; u8 *data = it->szs->data + it->off; enumError err = ScanRawLEX(&lex,true,data,it->size,0); - if ( !err && PatchLEX(&lex) && CreateRawLEX(&lex) == ERR_OK ) + if ( !err && PatchLEX(&lex,&it->szs->have) && CreateRawLEX(&lex) == ERR_OK ) { - if (!lex.have_lex) + if (!lex.have_sect) { PATCH_ACTION_LOG("Remove","SZS","%s\n","course.lex"); return 0; @@ -1515,6 +1526,7 @@ bool NormalizeExSZS ResetFileSZS(szs,false); +// [[norm]] szs_norm_t norm; memset(&norm,0,sizeof(norm)); norm.rm_aiparam = rm_aiparam; @@ -1524,7 +1536,7 @@ bool NormalizeExSZS if (autoadd) AddMissingFiles(szs,0,0,&norm,2); AddSlotFiles(szs,&norm); - AddTestLEX(szs,&norm); + AddSectionsLEX(szs,&norm,&szs->have); SortSubFilesSZS(szs,SORT_AUTO); uint old_size = szs->size; @@ -1711,7 +1723,7 @@ static int add_missing_file if ( is_course_lex ) { InitializeLEX(&lex); - if ( PatchLEX(&lex) && CreateRawLEX(&lex) == ERR_OK ) + if ( PatchLEX(&lex,&am->szs->have) && CreateRawLEX(&lex) == ERR_OK ) size = lex.raw_data_size; } @@ -1778,6 +1790,7 @@ int AddMissingFileSZS int log_indent // >-1: print log with indention ) { +// [[norm]] DASSERT(szs); DASSERT(fname); DASSERT(fform); @@ -1801,6 +1814,7 @@ enumError AddMissingFiles int log_indent // >-1: print log with indention ) { +// [[norm]] DASSERT(szs); DASSERT( sd || norm ); @@ -1855,9 +1869,12 @@ enumError AddMissingFiles /////////////////////////////////////////////////////////////////////////////// -void AddTestLEX ( szs_file_t *szs, szs_norm_t *norm ) +void AddSectionsLEX ( szs_file_t *szs, szs_norm_t *norm, const szs_have_t * have ) { +// [[norm]] DASSERT(szs); + bool add_course_lex = false; + if (HaveActivePatchTestLEX()) { lex_test_t temp; @@ -1865,8 +1882,20 @@ void AddTestLEX ( szs_file_t *szs, szs_norm_t *norm ) bool empty; PatchTestLEX(&temp,&empty); if ( !empty || force_lex_test ) - AddMissingFileSZS(szs,"course.lex",FF_LEX,norm,verbose<1?-1:0); + add_course_lex = true; } + + if ( HavePatchFeaturesLEX() && have && have->valid ) + { + features_szs_t fs; + SetupFeaturesSZS(&fs,have,true); + if ( GetFeaturesStatusSZS(&fs) > 1 ) + add_course_lex = true; + ResetFeaturesSZS(&fs); + } + + if (add_course_lex) + AddMissingFileSZS(szs,"course.lex",FF_LEX,norm,verbose<1?-1:0); } // @@ -2528,9 +2557,9 @@ static int transform_collect_func { lex_t lex; enumError err = ScanRawLEX(&lex,true,data,it->size,0); - if ( !err && PatchLEX(&lex) && CreateRawLEX(&lex) == ERR_OK ) + if ( !err && PatchLEX(&lex,&szs->have) && CreateRawLEX(&lex) == ERR_OK ) { - if (!lex.have_lex) + if (!lex.have_sect) { LEX_ACTION_LOG(false,"Remove LEX, old_size %u.\n",it->size); @@ -2562,8 +2591,8 @@ static int transform_collect_func } *dirty = 1; } - PRINT("PATCH/LEX: modified=%d, have_lex:%x\n", - lex.modified, lex.have_lex ); + PRINT("PATCH/LEX: modified=%d, have_lex:%x,%x\n", + lex.modified, lex.have_sect, lex.have_feat ); ResetLEX(&lex); } break; @@ -2618,6 +2647,8 @@ static int transform_collect_func bool PatchSZS ( szs_file_t * szs ) { DASSERT(szs); + CalcHaveSZS(szs); + const bool patch_lex = HaveActivePatchLEX(); #ifdef TEST static int done = 0; @@ -2652,6 +2683,30 @@ bool PatchSZS ( szs_file_t * szs ) return dirty != 0; } +/////////////////////////////////////////////////////////////////////////////// + +bool CanBeATrackSZS ( szs_file_t * szs ) +{ + FindSpecialFilesSZS(szs,false); + return szs->course_kcl_data + && szs->course_kmp_data + && ( szs->course_model_data || szs->course_d_model_data ); +} + +/////////////////////////////////////////////////////////////////////////////// + +void CalcHaveSZS ( szs_file_t * szs ) +{ + DASSERT(szs); + if ( szs->data && !szs->have.valid && CanBeATrackSZS(szs) ) + { + szs_file_t temp; + CopySZS(&temp,true,szs); + szs->have = temp.have; + ResetSZS(&temp); + } +} + // /////////////////////////////////////////////////////////////////////////////// /////////////// SetupExtendedSZS /////////////// @@ -3288,9 +3343,14 @@ int CheckSZS int i; for ( i = 0; i < HAVESZS__N; i++ ) - if (szs->szs_special[i]) + { + if ( szs->have.szs[i] >= HFM_MODIFIED ) print_check_error( &chk, CMOD_HINT, "Special file: ./%s\n",have_szs_file[i]); + else if ( szs->have.szs[i] >= HFM_ORIGINAL ) + print_check_error( &chk, CMOD_HINT, + "Original file: ./%s\n",have_szs_file[i]); + } //--- test optional files @@ -3308,7 +3368,7 @@ int CheckSZS const DbFileFILE_t *ptr = DbFileFILE + i; #ifdef TEST0 print_check_error( &chk, CMOD_HINT, - "Optional file [%02x]: ./%s\n", + "Optional file [%02x]: ./%s\n", szs->used_file->d[i], ptr->file ); #else print_check_error( &chk, CMOD_HINT, @@ -3347,7 +3407,7 @@ int CheckSZS if ( !(found_flags & DBF_REQUIRED2) ) print_check_error( &chk, CMOD_WARNING, - "Missing file: ./course_model.brres (or '_d' variant)\n" ); + "Missing file: ./course_model.brres (or '_d' variant)\n" ); int i; const DbFileFILE_t *ptr = DbFileFILE; @@ -3360,7 +3420,7 @@ int CheckSZS { if (!IsFileOptionalSZS(szs,ptr)) print_check_error( &chk, CMOD_WARNING, - "Missing file: ./%s\n", ptr->file ); + "Missing file: ./%s\n", ptr->file ); } } @@ -4803,6 +4863,11 @@ void InitializeAnalyseSZS ( analyse_szs_t * as ) TRACE_SIZEOF(slot_info_t); TRACE_SIZEOF(kmp_finish_t); TRACE_SIZEOF(kmp_usedpos_t); + TRACE_SIZEOF(szs_have_t); + TRACE_SIZEOF(szs_have_t); + TRACE_SIZEOF(have_file_mode_t); + TRACE_SIZEOF(szs_special_t); + TRACE_SIZEOF(kmp_special_t); TRACE("-\n"); } #endif @@ -4844,6 +4909,13 @@ void AnalyseSZS const u_usec_t start_usec = GetTimerUSec(); + analyse_szs_t as0; + if (!as) + { + as = &as0; + init_sa = true; + } + DASSERT(as); if (init_sa) InitializeAnalyseSZS(as); @@ -4878,7 +4950,8 @@ void AnalyseSZS lex_t lex; InitializeLEX(&lex); ScanLEX(&lex,false,szs->course_lex_data,szs->course_lex_size); - szs->have_lex = lex.have_lex; + szs->have.lex_sect = lex.have_sect; + szs->have.lex_feat = lex.have_feat; SetupLexInfo(&as->lexinfo,&lex); ResetLEX(&lex); } @@ -4992,30 +5065,30 @@ void AnalyseSZS ResetPFlagScenarios(&ap); } - DetectSpecialKMP(&kmp,szs->kmp_special); - if ( szs->kmp_special[HAVEKMP_WOODBOX_HT] - || szs->kmp_special[HAVEKMP_MUSHROOM_CAR] - || szs->kmp_special[HAVEKMP_PENGUIN_POS] - || szs->kmp_special[HAVEKMP_EPROP_SPEED] + DetectSpecialKMP(&kmp,szs->have.kmp); + if ( szs->have.kmp[HAVEKMP_WOODBOX_HT] + || szs->have.kmp[HAVEKMP_MUSHROOM_CAR] + || szs->have.kmp[HAVEKMP_PENGUIN_POS] + || szs->have.kmp[HAVEKMP_EPROP_SPEED] ) { ct_dest = StringCopyE(ct_dest,ct_end,",gobj"); } - if ( szs->kmp_special[HAVEKMP_X_PFLAGS] - || szs->kmp_special[HAVEKMP_X_COND] - || szs->kmp_special[HAVEKMP_X_DEFOBJ] - || szs->kmp_special[HAVEKMP_X_RANDOM] + if ( szs->have.kmp[HAVEKMP_X_PFLAGS] + || szs->have.kmp[HAVEKMP_X_COND] + || szs->have.kmp[HAVEKMP_X_DEFOBJ] + || szs->have.kmp[HAVEKMP_X_RANDOM] ) { ct_dest = StringCopyE(ct_dest,ct_end,",xpf"); } - if (szs->kmp_special[HAVEKMP_COOB_R]) + if (szs->have.kmp[HAVEKMP_COOB_R]) ct_dest = StringCopyE(ct_dest,ct_end,",coob-r"); - if (szs->kmp_special[HAVEKMP_COOB_K]) + if (szs->have.kmp[HAVEKMP_COOB_K]) ct_dest = StringCopyE(ct_dest,ct_end,",coob-k"); - if (szs->kmp_special[HAVEKMP_UOOB]) + if (szs->have.kmp[HAVEKMP_UOOB]) ct_dest = StringCopyE(ct_dest,ct_end,",uoob"); ResetKMP(&kmp); @@ -5024,22 +5097,22 @@ void AnalyseSZS valid_track = false; - if ( szs->szs_special[HAVESZS_ITEM_SLOT_TABLE] ) + if ( szs->have.szs[HAVESZS_ITEM_SLOT_TABLE] >= HFM_MODIFIED ) ct_dest = StringCopyE(ct_dest,ct_end,",itemslot"); - if ( szs->szs_special[HAVESZS_OBJFLOW] ) + if ( szs->have.szs[HAVESZS_OBJFLOW] >= HFM_MODIFIED ) ct_dest = StringCopyE(ct_dest,ct_end,",objflow"); - if ( szs->szs_special[HAVESZS_GHT_ITEM] - || szs->szs_special[HAVESZS_GHT_ITEM_OBJ] - || szs->szs_special[HAVESZS_GHT_KART] - || szs->szs_special[HAVESZS_GHT_KART_OBJ] + if ( szs->have.szs[HAVESZS_GHT_ITEM] >= HFM_MODIFIED + || szs->have.szs[HAVESZS_GHT_ITEM_OBJ] >= HFM_MODIFIED + || szs->have.szs[HAVESZS_GHT_KART] >= HFM_MODIFIED + || szs->have.szs[HAVESZS_GHT_KART_OBJ] >= HFM_MODIFIED ) { ct_dest = StringCopyE(ct_dest,ct_end,",geohit"); } - if ( szs->szs_special[HAVESZS_MINIGAME] ) + if ( szs->have.szs[HAVESZS_MINIGAME] >= HFM_MODIFIED ) ct_dest = StringCopyE(ct_dest,ct_end,",minigame"); @@ -5100,8 +5173,10 @@ void AnalyseSZS if (szs->warn_bits) ct_dest = StringCat2E(ct_dest,ct_end,",warn=",GetWarnSZSNames(szs->warn_bits,'+')); - as->valid_track = valid_track; - as->duration_usec = GetTimerUSec() - start_usec; + szs->have.valid = true; + as->have = szs->have; + as->valid_track = valid_track; + as->duration_usec = GetTimerUSec() - start_usec; } // diff --git a/project/src/lib-szs.c b/project/src/lib-szs.c index bea7884..e359f26 100644 --- a/project/src/lib-szs.c +++ b/project/src/lib-szs.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -81,6 +81,18 @@ const ccp have_szs_file[HAVESZS__N] = "common/minigame.kmg", // HAVESZS_MINIGAME }; +const file_format_t have_szs_fform[HAVESZS__N] = +{ + FF_LEX, // HAVESZS_COURSE_LEX + FF_OBJFLOW, // HAVESZS_OBJFLOW + FF_GH_ITEM, // HAVESZS_GHT_ITEM + FF_GH_IOBJ, // HAVESZS_GHT_ITEM_OBJ + FF_GH_KART, // HAVESZS_GHT_KART + FF_GH_KOBJ, // HAVESZS_GHT_KART_OBJ + FF_ITEMSLT, // HAVESZS_ITEM_SLOT_TABLE + FF_KMG, // HAVESZS_MINIGAME +}; + // /////////////////////////////////////////////////////////////////////////////// /////////////// szs_file_t /////////////// @@ -90,12 +102,12 @@ void InitializeSZS ( szs_file_t * szs ) { DASSERT(szs); memset(szs,0,sizeof(*szs)); - szs->fname = EmptyString; - InitializeStringPool(&szs->string_pool); - szs->endian = &be_func; - szs->n_cannon = -1; - szs->ff_version = -1; + szs->fname = EmptyString; + szs->endian = &be_func; + szs->n_cannon = -1; + szs->ff_version = -1; + InitializeStringPool(&szs->string_pool); InitializeSubfileList(&szs->subfile); } @@ -166,7 +178,7 @@ void AssignSZS uint size, // size of 'data' bool move_data, // true: free 'data' on reset file_format_t fform, // not FF_UNKNOWN: use this type - ccp fname // NULL or file names + ccp fname // NULL or file name ) { DASSERT(szs); @@ -207,6 +219,30 @@ void AssignSZS /////////////////////////////////////////////////////////////////////////////// +void CopySZS +( + szs_file_t *szs, // SZS to initialize + bool init_szs, // true: InitializeSZS(), false: ResetSZS() + const szs_file_t *source // source SZS +) +{ + DASSERT(szs); + + + if ( source && source->data ) + AssignSZS( szs, init_szs, + MEMDUP(source->data,source->size), source->size, true, + source->fform_current, source->fname ); + else + { + if (!init_szs) + ResetSZS(szs); + InitializeSZS(szs); + } +} + +/////////////////////////////////////////////////////////////////////////////// + void ResetSZS ( szs_file_t * szs ) { if (szs) @@ -455,11 +491,12 @@ enumError LoadSZS if (decompress) { - enumError err = DecompressSZS(szs,true,0); - return err ? err : DecodeWU8(szs); + err = DecompressSZS(szs,true,0); + if (!err) + err = DecodeWU8(szs); } - return ERR_OK; + return err; } /////////////////////////////////////////////////////////////////////////////// diff --git a/project/src/lib-szs.h b/project/src/lib-szs.h index fda2010..4d09f00 100644 --- a/project/src/lib-szs.h +++ b/project/src/lib-szs.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -250,6 +250,7 @@ CmpFuncSubFile GetCmpFunc /////////////////////////////////////////////////////////////////////////////// /////////////// enum mark /////////////// /////////////////////////////////////////////////////////////////////////////// +// [[szs_marker_t]] // Flags: // _U : object used @@ -293,6 +294,36 @@ __attribute__ ((packed)) have_szs_file_t; extern const ccp have_szs_name[HAVESZS__N]; extern const ccp have_szs_file[HAVESZS__N]; +extern const file_format_t have_szs_fform[HAVESZS__N]; + +//----------------------------------------------------------------------------- +// [[have_file_mode_t]] [[szs_special_t]] + +typedef enum have_file_mode_t +{ + HFM_NONE, // file not found/exist + HFM_ORIGINAL, // file found, but original data + HFM_MODIFIED, // file found, modified data +} +__attribute__ ((packed)) have_file_mode_t; + +typedef have_file_mode_t szs_special_t[HAVESZS__N]; + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// szs_have_t /////////////// +/////////////////////////////////////////////////////////////////////////////// +// [[szs_have_t]] + +typedef struct szs_have_t +{ + bool valid; // TRUE: SZS analyzed + szs_special_t szs; // u8-list: one of have_file_mode_t (H_*) + kmp_special_t kmp; // u8-list: elem>0: number of special KMP objects found + uint lex_sect; // bit field for found lex sections + uint lex_feat; // bit field for found lex features +} +szs_have_t; // /////////////////////////////////////////////////////////////////////////////// @@ -409,26 +440,65 @@ typedef struct szs_file_t // 3: all materials found & content ok warn_bits_t warn_bits; // warning summary - bool szs_special[HAVESZS__N]; // true: special file found - kmp_special_t kmp_special; // list: >0: number of special KMP objects found - uint have_lex; // bit field for found lex eleemnts + szs_have_t have; // complete have status ParamField_t *special_file; // list with files of directory /common/ } szs_file_t; //----------------------------------------------------------------------------- +// [[szs_norm_info_t]] +// [[norm]] + +typedef enum szs_norm_info_t +{ + SZI_NORM, // N: file is normed + SZI_PT_DIR, // P: have pt_dir + SZI_AI_PARAM, // A: have AI param + SZI_SPEED, // S: have speed KMP/STGI factoe + SZI_LAPS, // #: (1-9) KMP/STGI number of laps + SZI_RM_LEX_FEA0, // F: have LEX section FEA0 + SZI_RM_LEX_TEST, // T: have LEX section TEST + + SZI__N // number of flags +} +szs_norm_info_t; + +//----------------------------------------------------------------------------- // [[szs_norm_t]] +// [[norm]] typedef struct szs_norm_t { + //--- status + u32 namepool_size; u32 total_size; bool have_pt_dir; - bool rm_aiparam; - bool clean_lex; -} szs_norm_t; + //--- jobs + + bool force_pt_dir; // force './' as prefix for each subfile + bool rm_aiparam; // remove subfiles with name 'aiparam*' + bool clean_lex; // [[obsolete]] when following params become active + + //--- not implemented yet + + bool auto_add; // autoadd files + bool norm_speed; // normalize speed (KMP/STGI) + u8 max_laps; // >0: limit number of laps (KMP/STGI) + u8 set_laps; // >0: set number of laps (KMP/STGI) + bool rm_lex_test; // remove LEX section TEST + bool manage_lex_fea0; // manage LEX section FEA0: 0:off, 1:remove, 2:auto + bool purge_lex; // purge lex section and remove course.bin if empty + + //--- for output via PrintNorm() + + FILE *f; // NULL or output file + int indent; // indention + char modified[SZI__N+1]; // info vector about modification -> szs_norm_info_t +} +szs_norm_t; //----------------------------------------------------------------------------- @@ -468,7 +538,14 @@ void AssignSZS uint size, // size of 'data' bool move_data, // true: free 'data' on reset file_format_t fform, // not FF_UNKNOWN: use this type - ccp fname // NULL or file names + ccp fname // NULL or file name +); + +void CopySZS +( + szs_file_t *szs, // SZS to initialize + bool init_szs, // true: InitializeSZS(), false: ResetSZS() + const szs_file_t *source // source SZS ); enumError LoadSZS @@ -518,6 +595,8 @@ enumError CompressSZS ( szs_file_t * szs, bool remove_uncompressed ); bool NormalizeSZS ( szs_file_t *szs ); bool NormalizeExSZS ( szs_file_t *szs, bool rm_aiparam, bool clean_lex, bool autoadd ); bool PatchSZS ( szs_file_t * szs ); +bool CanBeATrackSZS ( szs_file_t * szs ); +void CalcHaveSZS ( szs_file_t * szs ); enumError DecompressSZS ( @@ -758,7 +837,7 @@ void FindSpecialFilesSZS ); ccp CreateSpecialFileInfo - ( szs_file_t * szs, bool add_value, ccp return_if_empty ); + ( szs_file_t * szs, uint select, bool add_value, ccp return_if_empty ); // /////////////////////////////////////////////////////////////////////////////// @@ -1310,7 +1389,6 @@ enumError CompressBZ ( szs_file_t * szs, bool remove_uncompressed ); typedef struct analyse_szs_t { - //--- db+sha1 check sums char db64[CHECKSUM_DB_SIZE+1]; @@ -1332,6 +1410,7 @@ typedef struct analyse_szs_t slot_info_t slotinfo; // slot data kmp_finish_t kmp_finish; // finish line kmp_usedpos_t used_pos; // used positions + szs_have_t have; // complete have status, copy of szs_file_t::have //--- more stats diff --git a/project/src/lib-transform.c b/project/src/lib-transform.c index e463621..2f0c912 100644 --- a/project/src/lib-transform.c +++ b/project/src/lib-transform.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-xbmg.c b/project/src/lib-xbmg.c index 8eb09ce..1aee2ef 100644 --- a/project/src/lib-xbmg.c +++ b/project/src/lib-xbmg.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/lib-xbmg.h b/project/src/lib-xbmg.h index cdc40fa..69fcf1e 100644 --- a/project/src/lib-xbmg.h +++ b/project/src/lib-xbmg.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/types.h b/project/src/types.h index 74b43b9..ba1c230 100644 --- a/project/src/types.h +++ b/project/src/types.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/ui/gen-ui.c b/project/src/ui/gen-ui.c index 823595c..d8518ce 100644 --- a/project/src/ui/gen-ui.c +++ b/project/src/ui/gen-ui.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/ui/tab-wbmgt.inc b/project/src/ui/tab-wbmgt.inc index f16a615..7f63fde 100644 --- a/project/src/ui/tab-wbmgt.inc +++ b/project/src/ui/tab-wbmgt.inc @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -201,6 +201,10 @@ "WIDTH", "width", 0, 0 /* copy of wszst */ }, + { T_OPT_GP|F_IGNORE, + "MAX_WIDTH", "max-width|maxwidth", + 0, 0 /* copy of wszst */ }, + { T_OPT_GM, "QUIET", "q|quiet", 0, 0 /* copy of wszst */ }, @@ -443,6 +447,7 @@ { T_CMD_BEG, "HELP", 0,0,0 }, { T_COPT, "WIDTH", 0,0,0 }, + { T_COPT, "MAX_WIDTH", 0,0,0 }, { T_ALL_OPT, 0, 0,0,0 }, //---------- COMMAND wbmgt ARGTEST ---------- @@ -524,6 +529,7 @@ { T_CMD_BEG, "LIST", 0,0,0 }, { T_COPT, "IGNORE", 0,0,0 }, { T_COPT, "WIDTH", 0,0,0 }, + { T_COPT, "MAX_WIDTH", 0,0,0 }, { T_COPT, "PATCH_BMG", 0,0,0 }, { T_COPT, "MACRO_BMG", 0,0,0 }, { T_COPT, "FILTER_BMG", 0,0,0 }, @@ -533,6 +539,7 @@ { T_CMD_BEG, "SLOTS", 0,0,0 }, { T_COPT, "IGNORE", 0,0,0 }, { T_COPT, "WIDTH", 0,0,0 }, + { T_COPT, "MAX_WIDTH", 0,0,0 }, { T_COPT, "PATCH_BMG", 0,0,0 }, { T_COPT, "MACRO_BMG", 0,0,0 }, { T_COPT, "FILTER_BMG", 0,0,0 }, @@ -541,6 +548,7 @@ { T_CMD_BEG, "DIFF", 0,0,0 }, { T_COPT, "WIDTH", 0,0,0 }, + { T_COPT, "MAX_WIDTH", 0,0,0 }, { T_COPT, "PATCH_BMG", 0,0,0 }, { T_COPT, "MACRO_BMG", 0,0,0 }, { T_COPT, "FILTER_BMG", 0,0,0 }, diff --git a/project/src/ui/tab-wctct.inc b/project/src/ui/tab-wctct.inc index af35de7..9d4bbdf 100644 --- a/project/src/ui/tab-wctct.inc +++ b/project/src/ui/tab-wctct.inc @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -188,6 +188,10 @@ "WIDTH", "width", 0, 0 /* copy of wszst */ }, + { T_OPT_GP|F_IGNORE, + "MAX_WIDTH", "max-width|maxwidth", + 0, 0 /* copy of wszst */ }, + { T_OPT_GM, "QUIET", "q|quiet", 0, 0 /* copy of wszst */ }, @@ -561,6 +565,7 @@ { T_CMD_BEG, "HELP", 0,0,0 }, { T_COPT, "WIDTH", 0,0,0 }, + { T_COPT, "MAX_WIDTH", 0,0,0 }, { T_ALL_OPT, 0, 0,0,0 }, //---------- COMMAND wctct ARGTEST ---------- diff --git a/project/src/ui/tab-wimgt.inc b/project/src/ui/tab-wimgt.inc index 2d6286a..6198c13 100644 --- a/project/src/ui/tab-wimgt.inc +++ b/project/src/ui/tab-wimgt.inc @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -158,6 +158,10 @@ "WIDTH", "width", 0, 0 /* copy of wszst */ }, + { T_OPT_GP|F_IGNORE, + "MAX_WIDTH", "max-width|maxwidth", + 0, 0 /* copy of wszst */ }, + { T_OPT_GM, "QUIET", "q|quiet", 0, 0 /* copy of wszst */ }, @@ -391,6 +395,7 @@ { T_CMD_BEG, "HELP", 0,0,0 }, { T_COPT, "WIDTH", 0,0,0 }, + { T_COPT, "MAX_WIDTH", 0,0,0 }, { T_ALL_OPT, 0, 0,0,0 }, //---------- COMMAND wimgt ARGTEST ---------- diff --git a/project/src/ui/tab-wkclt.inc b/project/src/ui/tab-wkclt.inc index 04476f2..931b061 100644 --- a/project/src/ui/tab-wkclt.inc +++ b/project/src/ui/tab-wkclt.inc @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -255,6 +255,10 @@ "WIDTH", "width", 0, 0 /* copy of wszst */ }, + { T_OPT_GP|F_IGNORE, + "MAX_WIDTH", "max-width|maxwidth", + 0, 0 /* copy of wszst */ }, + { T_OPT_GM, "QUIET", "q|quiet", 0, 0 /* copy of wszst */ }, @@ -532,6 +536,7 @@ { T_CMD_BEG, "HELP", 0,0,0 }, { T_COPT, "WIDTH", 0,0,0 }, + { T_COPT, "MAX_WIDTH", 0,0,0 }, { T_ALL_OPT, 0, 0,0,0 }, //---------- COMMAND wkclt ARGTEST ---------- diff --git a/project/src/ui/tab-wkmpt.inc b/project/src/ui/tab-wkmpt.inc index 97070b7..686b547 100644 --- a/project/src/ui/tab-wkmpt.inc +++ b/project/src/ui/tab-wkmpt.inc @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -255,6 +255,10 @@ "WIDTH", "width", 0, 0 /* copy of wszst */ }, + { T_OPT_GP|F_IGNORE, + "MAX_WIDTH", "max-width|maxwidth", + 0, 0 /* copy of wszst */ }, + { T_OPT_GM, "QUIET", "q|quiet", 0, 0 /* copy of wszst */ }, @@ -657,6 +661,7 @@ { T_CMD_BEG, "HELP", 0,0,0 }, { T_COPT, "WIDTH", 0,0,0 }, + { T_COPT, "MAX_WIDTH", 0,0,0 }, { T_ALL_OPT, 0, 0,0,0 }, //---------- COMMAND wkmpt ARGTEST ---------- @@ -767,6 +772,7 @@ { T_CMD_BEG, "OBJECTS", 0,0,0 }, { T_COPT, "WIDTH", 0,0,0 }, + { T_COPT, "MAX_WIDTH", 0,0,0 }, { T_COPT, "NO_HEADER", 0,0,0 }, { T_COPT, "BRIEF", 0,0, "Don't print the file list and the info line(s)." diff --git a/project/src/ui/tab-wlect.inc b/project/src/ui/tab-wlect.inc index e4b4772..e107ced 100644 --- a/project/src/ui/tab-wlect.inc +++ b/project/src/ui/tab-wlect.inc @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -207,6 +207,10 @@ "WIDTH", "width", 0, 0 /* copy of wszst */ }, + { T_OPT_GP|F_IGNORE, + "MAX_WIDTH", "max-width|maxwidth", + 0, 0 /* copy of wszst */ }, + { T_OPT_GM, "QUIET", "q|quiet", 0, 0 /* copy of wszst */ }, @@ -372,6 +376,12 @@ "Delete LEX sections without any impact." " This option is executed after all --lt-* options." }, + { H_OPT_G, "LEX_RM_FEAT", "rm-features|rmfeatures|lex-rm-features|lexrmfeatures", + 0, + "Remove LEX setion FEA0 (features) if exists." + " It is executed after --lex-purge." + " {--lex-rm-features} is an alternative name." }, + { T_SEP_OPT, 0,0,0,0 }, //----- separator ----- { T_OPT_GM, "TEST", "t|test", @@ -643,6 +653,7 @@ // { T_COPT, "LT_ENGINE", 0,0,0 }, // { T_COPT, "LT_RANDOM", 0,0,0 }, // { T_COPT, "LEX_PURGE", 0,0,0 }, +// { H_COPT, "LEX_RM_FEAT", 0,0,0 }, //---------- wlect GROUP TRACK_COPY ---------- @@ -687,6 +698,7 @@ { T_CMD_BEG, "HELP", 0,0,0 }, { T_COPT, "WIDTH", 0,0,0 }, + { T_COPT, "MAX_WIDTH", 0,0,0 }, { T_ALL_OPT, 0, 0,0,0 }, //---------- COMMAND wlect ARGTEST ---------- @@ -843,6 +855,7 @@ { T_COPT, "LT_ENGINE", 0,0,0 }, { T_COPT, "LT_RANDOM", 0,0,0 }, { T_COPT, "LEX_PURGE", 0,0,0 }, + { H_COPT, "LEX_RM_FEAT", 0,0,0 }, { T_SEP_OPT, 0,0,0,0 }, { T_COPY_GRP, "PARAM", 0,0,0 }, diff --git a/project/src/ui/tab-wmdlt.inc b/project/src/ui/tab-wmdlt.inc index c4a8e1c..d68652a 100644 --- a/project/src/ui/tab-wmdlt.inc +++ b/project/src/ui/tab-wmdlt.inc @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -181,6 +181,10 @@ "WIDTH", "width", 0, 0 /* copy of wszst */ }, + { T_OPT_GP|F_IGNORE, + "MAX_WIDTH", "max-width|maxwidth", + 0, 0 /* copy of wszst */ }, + { T_OPT_GM, "QUIET", "q|quiet", 0, 0 /* copy of wszst */ }, @@ -429,6 +433,7 @@ { T_CMD_BEG, "HELP", 0,0,0 }, { T_COPT, "WIDTH", 0,0,0 }, + { T_COPT, "MAX_WIDTH", 0,0,0 }, { T_ALL_OPT, 0, 0,0,0 }, //---------- COMMAND wmdlt ARGTEST ---------- diff --git a/project/src/ui/tab-wpatt.inc b/project/src/ui/tab-wpatt.inc index a55b2bf..fc86f58 100644 --- a/project/src/ui/tab-wpatt.inc +++ b/project/src/ui/tab-wpatt.inc @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -149,6 +149,10 @@ "WIDTH", "width", 0, 0 /* copy of wszst */ }, + { T_OPT_GP|F_IGNORE, + "MAX_WIDTH", "max-width|maxwidth", + 0, 0 /* copy of wszst */ }, + { T_OPT_GM, "QUIET", "q|quiet", 0, 0 /* copy of wszst */ }, @@ -327,6 +331,7 @@ { T_CMD_BEG, "HELP", 0,0,0 }, { T_COPT, "WIDTH", 0,0,0 }, + { T_COPT, "MAX_WIDTH", 0,0,0 }, { T_ALL_OPT, 0, 0,0,0 }, //---------- COMMAND wpatt ARGTEST ---------- diff --git a/project/src/ui/tab-wstrt.inc b/project/src/ui/tab-wstrt.inc index fcdc3aa..19ecfa3 100644 --- a/project/src/ui/tab-wstrt.inc +++ b/project/src/ui/tab-wstrt.inc @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -191,6 +191,10 @@ "WIDTH", "width", 0, 0 /* copy of wszst */ }, + { T_OPT_GP|F_IGNORE, + "MAX_WIDTH", "max-width|maxwidth", + 0, 0 /* copy of wszst */ }, + { T_OPT_GM, "QUIET", "q|quiet", 0, 0 /* copy of wszst */ }, @@ -853,6 +857,7 @@ { T_CMD_BEG, "HELP", 0,0,0 }, { T_COPT, "WIDTH", 0,0,0 }, + { T_COPT, "MAX_WIDTH", 0,0,0 }, { T_ALL_OPT, 0, 0,0,0 }, //---------- COMMAND wstrt ARGTEST ---------- diff --git a/project/src/ui/tab-wszst.inc b/project/src/ui/tab-wszst.inc index e84695d..e9e511c 100644 --- a/project/src/ui/tab-wszst.inc +++ b/project/src/ui/tab-wszst.inc @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -229,6 +229,10 @@ "wszst _SUBFILE [files]", "Test sub-file system." }, + { H_DEF_CMD, "TESTNORM", "_NORM", + "wszst _NORM key...", + "This hidden command tests the iteration of norming." }, + { T_SEP_CMD, 0,0,0,0 }, //----- separator ----- { T_DEF_CMD, "LIST", "LIST|LS", @@ -330,6 +334,10 @@ "wszst ANALYZE [source]...", "Analyse track files and print results in machine readable format." }, + { H_DEF_CMD, "FEATURES", "FEATURES", + "wszst FEATURES [source]...", + "Analyse track files and a feature list in machine readable format." }, + { T_DEF_CMD, "DISTRIBUTION", "DISTRIBUTION|DIST", "wszst DISTRIBUTION result source...\n" "wszst DISTRIBUTION directory [source]...", @@ -640,6 +648,14 @@ " for help and some other messages" " and disable the automatic detection of the terminal width." }, + { T_OPT_GP|F_IGNORE, + "MAX_WIDTH", "max-width|maxwidth", + "maxwidth", + "Define the maximum terminal width (number of columns)" + " for help and some other messages" + " and disable the automatic detection of the terminal width." + " This option is ignored if {--width} is set." }, + { T_OPT_GM, "QUIET", "q|quiet", 0, "Be quiet and print only error messages." @@ -1060,7 +1076,7 @@ " @FAST, NEW, CENTER, ROUND, NORMALS, MTL," " WIIMM, TRIANGLES, OUT-SWAP, G, USEMTL, CLIP, IN-SWAP, AUTO, HEX4," " HEX23, HEX, DROP-UNUSED, DROP-FIXED, DROP-INVALID, DROP," - " RM-FACEDOWN, RM-FACEUP, FIX-ALL," + " RM-FACEDOWN, RM-FACEUP, FIX-ALL, TINY-0 ... TINY-7," " CONV-FACEUP, WEAK-WALLS, SORT, INPLACE, SILENT@ and @LOG@." "\1 See https://szs.wiimm.de/opt/kcl for details." }, @@ -1154,7 +1170,7 @@ " MASK-PFLAGS, RM-LECODE, PURGE-GOBJ, FULL-DEFOBJ," " DUMP-CLASS, DUMP-ONEWAY, DUMP-ALL," " 1LAP ... 9LAPS, MAX-LAPS, RM-EMPTY," - " INPLACE, SILENT@ and @LOG@." + " TINY-0 ... TINY-7, INPLACE, SILENT@ and @LOG@." "\1 See https://szs.wiimm.de/opt/kmp for details." }, { T_OPT_GP, "SPEED_MOD", "speed-mod|speedmod", @@ -1375,7 +1391,22 @@ 0, "Delete LEX sections without any impact." " Delete sub-file course.lex if it no longer contains a section." - " This option is executed after all --lt-* options." }, + " This option is executed after all --lt-* and --lex-* options." }, + + { H_OPT_G, "LEX_FEATURES", "lex-features|lexfeatures", + 0, + "Calculate LEX setion FEA0 (features) by analysing the track file." + " If no features found, delete the section and the possibly empty sub-file" + " course.lex. If features found, then insert the section or update" + " an existing section. If necessary, the sub-file course.lex is created." + " This option is executed after all --lt-* options and after --lex-purge." }, + + { H_OPT_G, "LEX_RM_FEAT", "lex-rm-features|lexrmfeatures", + 0, + "Remove LEX setion FEA0 (features) if exists" + " and the possibly empty sub-file course.lex." + " This option is ignored if --lex-features is set." + " It is executed after all --lt-* options and after --lex-purge." }, { T_OPT_CMP, "LOAD_BMG", "load-bmg|loadbmg", "file", @@ -1818,6 +1849,31 @@ "varname", "Shortcut for: {--array --var name}" }, + { T_OPT_GP, "CASE", "case", + "case", + "@CASE@ is one of @LOWER@, @AUTO@ (default) or @UPPER@." + "If @LOWER@ or @UPPER@ are set, then the lower/upper case" + " of the variable names is adjusted accordingly." }, + + { H_OPT_C, "PMODES", "pmodes|print-modes|printmodes", + 0, + "--pmodes is an abbreviation for --print-mode." + " If set, a comma-separated list of letters is added to the end of each feature." + " The letters used are:" + " @S@ (section), @V@ (visual), @B@ (battle), @R@ (racing)," + " @T@ (time trial), @L@ (local=offline) and @O@ (online)." }, + + { H_OPT_CP, "FMODES", "fmodes|feature-modes|featuremodes", + "list", + "--fmodes is an abbreviation for --feature-modes and declares an output filter." + " @LIST@ is a keyword list. The keywords are:" + " @SECTION, VISUAL, GAMEPLAY, BATTLE, RACING, TIMETRIAL, OFFLINE@ and @ONLINE@." + " A feature is only printed if *all* set keywords match." + "\n " + " Each keyword can also be used with a minus as prefix to define" + " a second condition. In this case the feature is excluded" + " from printing if *any* set keywords match." }, + { T_SEP_OPT, 0,0,0,0 }, //----- separator ----- { H_OPT_CP, "ANALYZE", "analyze|analyse", @@ -2318,6 +2374,8 @@ { T_COPT, "LT_ENGINE", 0,0,0 }, { T_COPT, "LT_RANDOM", 0,0,0 }, { T_COPT, "LEX_PURGE", 0,0,0 }, + { H_COPT, "LEX_FEATURES", 0,0,0 }, + { H_COPT, "LEX_RM_FEAT", 0,0,0 }, { T_COPT, "PATCH_BMG", 0,0,0 }, { T_COPT, "MACRO_BMG", 0,0,0 }, { T_COPT, "FILTER_BMG", 0,0,0 }, @@ -2381,6 +2439,7 @@ { T_COPT, "VAR", 0,0,0 }, { T_COPT, "ARRAY", 0,0,0 }, { T_COPT, "AVAR", 0,0,0 }, + { T_COPT, "CASE", 0,0,0 }, //---------- wszst GROUP ALIGN ---------- @@ -2515,6 +2574,7 @@ { T_CMD_BEG, "HELP", 0,0,0 }, { T_COPT, "WIDTH", 0,0,0 }, + { T_COPT, "MAX_WIDTH", 0,0,0 }, { T_ALL_OPT, 0, 0,0,0 }, //---------- COMMAND wszst ARGTEST ---------- @@ -2876,6 +2936,26 @@ { T_COPT, "DEST", 0,0,0 }, { T_COPT, "DEST2", 0,0,0 }, + //---------- COMMAND wszst FEATURES ---------- + + { T_CMD_BEG, "FEATURES", 0,0,0 }, + { T_COPT, "BRIEF", 0,0, + "Suppres any comments at all." + " If set twice, suppress empty lines (for grouping) too." + " If set three times, omit inactive features (=0) too." }, + { T_COPT, "LONG", 0,0, + "Print additnal comments." }, + { T_COPT, "IGNORE", 0,0,0 }, + { T_COPT, "QUIET", 0,0, + "Suppress logging of input and output files." }, + { T_SEP_OPT, 0,0,0,0 }, + { T_COPY_GRP, "SCRIPT", 0,0,0 }, + { T_COPT, "PMODES", 0,0,0 }, + { T_COPT, "FMODES", 0,0,0 }, + { T_SEP_OPT, 0,0,0,0 }, + { T_COPT, "DEST", 0,0,0 }, + { T_COPT, "DEST2", 0,0,0 }, + //---------- COMMAND wszst DISTRIBUTION ---------- { T_CMD_BEG, "DISTRIBUTION", 0,0,0 }, diff --git a/project/src/ui/ui-wbmgt.c b/project/src/ui/ui-wbmgt.c index 1a6c522..598864e 100644 --- a/project/src/ui/ui-wbmgt.c +++ b/project/src/ui/ui-wbmgt.c @@ -16,7 +16,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -337,6 +337,13 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " messages and disable the automatic detection of the terminal width." }, + { OPT_MAX_WIDTH, false, false, false, true, false, 0, "max-width", + "maxwidth", + "Define the maximum terminal width (number of columns) for help and" + " some other messages and disable the automatic detection of the" + " terminal width. This option is ignored if --width is set." + }, + { OPT_QUIET, false, false, false, false, false, 'q', "quiet", 0, "Be quiet and print only error messages. Multiple usage is possible." @@ -515,7 +522,7 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " helper option." }, - {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 61 + {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 62 }; @@ -641,6 +648,8 @@ static const struct option OptionLong[] = { "allowall", 0, 0, GO_ALLOW_ALL }, { "compatible", 1, 0, GO_COMPATIBLE }, { "width", 1, 0, GO_WIDTH }, + { "max-width", 1, 0, GO_MAX_WIDTH }, + { "maxwidth", 1, 0, GO_MAX_WIDTH }, { "quiet", 0, 0, 'q' }, { "verbose", 0, 0, 'v' }, { "logging", 0, 0, 'L' }, @@ -794,39 +803,40 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x081 */ OPT_ALLOW_ALL, /* 0x082 */ OPT_COMPATIBLE, /* 0x083 */ OPT_WIDTH, - /* 0x084 */ OPT_DE, - /* 0x085 */ OPT_COLORS, - /* 0x086 */ OPT_NO_COLORS, - /* 0x087 */ OPT_CT_CODE, - /* 0x088 */ OPT_LE_CODE, - /* 0x089 */ OPT_CHDIR, - /* 0x08a */ OPT_POINTS, - /* 0x08b */ OPT_UTF_8, - /* 0x08c */ OPT_NO_UTF_8, - /* 0x08d */ OPT_FORCE, - /* 0x08e */ OPT_REPAIR_MAGICS, - /* 0x08f */ OPT_OLD, - /* 0x090 */ OPT_STD, - /* 0x091 */ OPT_NEW, - /* 0x092 */ OPT_EXTRACT, - /* 0x093 */ OPT_NUMBER, - /* 0x094 */ OPT_ALIGN, - /* 0x095 */ OPT_MACRO_BMG, - /* 0x096 */ OPT_FILTER_BMG, - /* 0x097 */ OPT_BMG_ENDIAN, - /* 0x098 */ OPT_BMG_ENCODING, - /* 0x099 */ OPT_BMG_INF_SIZE, - /* 0x09a */ OPT_BMG_MID, - /* 0x09b */ OPT_FORCE_ATTRIB, - /* 0x09c */ OPT_DEF_ATTRIB, - /* 0x09d */ OPT_NO_ATTRIB, - /* 0x09e */ OPT_X_ESCAPES, - /* 0x09f */ OPT_OLD_ESCAPES, - /* 0x0a0 */ OPT_NO_BMG_COLORS, - /* 0x0a1 */ OPT_BMG_COLORS, - /* 0x0a2 */ OPT_NO_BMG_INLINE, - /* 0x0a3 */ OPT_SECTIONS, - /* 0x0a4 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, + /* 0x084 */ OPT_MAX_WIDTH, + /* 0x085 */ OPT_DE, + /* 0x086 */ OPT_COLORS, + /* 0x087 */ OPT_NO_COLORS, + /* 0x088 */ OPT_CT_CODE, + /* 0x089 */ OPT_LE_CODE, + /* 0x08a */ OPT_CHDIR, + /* 0x08b */ OPT_POINTS, + /* 0x08c */ OPT_UTF_8, + /* 0x08d */ OPT_NO_UTF_8, + /* 0x08e */ OPT_FORCE, + /* 0x08f */ OPT_REPAIR_MAGICS, + /* 0x090 */ OPT_OLD, + /* 0x091 */ OPT_STD, + /* 0x092 */ OPT_NEW, + /* 0x093 */ OPT_EXTRACT, + /* 0x094 */ OPT_NUMBER, + /* 0x095 */ OPT_ALIGN, + /* 0x096 */ OPT_MACRO_BMG, + /* 0x097 */ OPT_FILTER_BMG, + /* 0x098 */ OPT_BMG_ENDIAN, + /* 0x099 */ OPT_BMG_ENCODING, + /* 0x09a */ OPT_BMG_INF_SIZE, + /* 0x09b */ OPT_BMG_MID, + /* 0x09c */ OPT_FORCE_ATTRIB, + /* 0x09d */ OPT_DEF_ATTRIB, + /* 0x09e */ OPT_NO_ATTRIB, + /* 0x09f */ OPT_X_ESCAPES, + /* 0x0a0 */ OPT_OLD_ESCAPES, + /* 0x0a1 */ OPT_NO_BMG_COLORS, + /* 0x0a2 */ OPT_BMG_COLORS, + /* 0x0a3 */ OPT_NO_BMG_INLINE, + /* 0x0a4 */ OPT_SECTIONS, + /* 0x0a5 */ 0,0,0,0, 0,0,0,0, 0,0,0, /* 0x0b0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x0c0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x0d0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, @@ -834,7 +844,8 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x0f0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x100 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x110 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, - /* 0x120 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, + /* 0x120 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, + /* 0x130 */ 0,0,0,0, 0,0, }; // @@ -982,6 +993,7 @@ static const InfoOption_t * option_tab_tool[] = OptionInfo + OPT_ALLOW_ALL, OptionInfo + OPT_COMPATIBLE, OptionInfo + OPT_WIDTH, + OptionInfo + OPT_MAX_WIDTH, OptionInfo + OPT_QUIET, OptionInfo + OPT_VERBOSE, OptionInfo + OPT_LOGGING, @@ -1018,6 +1030,7 @@ static const InfoOption_t * option_tab_cmd_VERSION[] = static const InfoOption_t * option_tab_cmd_HELP[] = { OptionInfo + OPT_WIDTH, + OptionInfo + OPT_MAX_WIDTH, 0 }; @@ -1102,6 +1115,7 @@ static const InfoOption_t * option_tab_cmd_LIST[] = { OptionInfo + OPT_IGNORE, OptionInfo + OPT_WIDTH, + OptionInfo + OPT_MAX_WIDTH, OptionInfo + OPT_PATCH_BMG, OptionInfo + OPT_MACRO_BMG, OptionInfo + OPT_FILTER_BMG, @@ -1113,6 +1127,7 @@ static const InfoOption_t * option_tab_cmd_SLOTS[] = { OptionInfo + OPT_IGNORE, OptionInfo + OPT_WIDTH, + OptionInfo + OPT_MAX_WIDTH, OptionInfo + OPT_PATCH_BMG, OptionInfo + OPT_MACRO_BMG, OptionInfo + OPT_FILTER_BMG, @@ -1123,6 +1138,7 @@ static const InfoOption_t * option_tab_cmd_SLOTS[] = static const InfoOption_t * option_tab_cmd_DIFF[] = { OptionInfo + OPT_WIDTH, + OptionInfo + OPT_MAX_WIDTH, OptionInfo + OPT_PATCH_BMG, OptionInfo + OPT_MACRO_BMG, OptionInfo + OPT_FILTER_BMG, @@ -1353,7 +1369,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "wbmgt [option]... command [option|parameter|file]...", "Wiimms BMG Tool : Convert and patch raw and text BMG (message) files.", 0, - 23, + 24, option_tab_tool, 0 }, @@ -1391,7 +1407,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " The third variant (with a valid command name) prints details about" " the declared command. The fourth variant prints an overview about" " all commands and all global options.", - 1, + 2, option_tab_cmd_HELP, option_allowed_cmd_HELP }, @@ -1561,7 +1577,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "List messages to proof the content. Patches are applied before" " listing. The lines are cut to fit the terminal width.", 0, - 5, + 6, option_tab_cmd_LIST, option_allowed_cmd_LIST }, @@ -1576,7 +1592,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "Print a slot ordered list with slot number, message id, delta and" " attributes. Patches are applied before listing.", 0, - 5, + 6, option_tab_cmd_SLOTS, option_allowed_cmd_SLOTS }, @@ -1594,7 +1610,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " each source file is compared with a file in the destination. Patches" " are applied to all sources before comparing.", 0, - 6, + 7, option_tab_cmd_DIFF, option_allowed_cmd_DIFF }, diff --git a/project/src/ui/ui-wbmgt.h b/project/src/ui/ui-wbmgt.h index 75625de..722ed02 100644 --- a/project/src/ui/ui-wbmgt.h +++ b/project/src/ui/ui-wbmgt.h @@ -16,7 +16,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -98,6 +98,7 @@ typedef enum enumOptions OPT_ALLOW_ALL, OPT_COMPATIBLE, OPT_WIDTH, + OPT_MAX_WIDTH, OPT_QUIET, OPT_VERBOSE, OPT_LOGGING, @@ -122,7 +123,7 @@ typedef enum enumOptions OPT_NEW, OPT_EXTRACT, - OPT__N_TOTAL // == 61 + OPT__N_TOTAL // == 62 } enumOptions; @@ -363,6 +364,7 @@ typedef enum enumGetOpt GO_ALLOW_ALL, GO_COMPATIBLE, GO_WIDTH, + GO_MAX_WIDTH, GO_DE, GO_COLORS, GO_NO_COLORS, @@ -409,7 +411,7 @@ typedef enum enumGetOpt //extern const struct option OptionLong[]; //extern u8 OptionUsed[OPT__N_TOTAL+1]; //extern const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE]; -//UIOPT_INDEX_SIZE := 0x12c = 300 +//UIOPT_INDEX_SIZE := 0x136 = 310 //extern const InfoCommand_t CommandInfo[CMD__N+1]; extern const InfoUI_t InfoUI_wbmgt; diff --git a/project/src/ui/ui-wctct.c b/project/src/ui/ui-wctct.c index d106ed3..8569f2c 100644 --- a/project/src/ui/ui-wctct.c +++ b/project/src/ui/ui-wctct.c @@ -16,7 +16,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -437,6 +437,13 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " messages and disable the automatic detection of the terminal width." }, + { OPT_MAX_WIDTH, false, false, false, true, false, 0, "max-width", + "maxwidth", + "Define the maximum terminal width (number of columns) for help and" + " some other messages and disable the automatic detection of the" + " terminal width. This option is ignored if --width is set." + }, + { OPT_QUIET, false, false, false, false, false, 'q', "quiet", 0, "Be quiet and print only error messages. Multiple usage is possible." @@ -646,7 +653,7 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " 0x3b:0x41 and 0x44:0xfe." }, - {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 80 + {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 81 }; @@ -832,6 +839,8 @@ static const struct option OptionLong[] = { "allowall", 0, 0, GO_ALLOW_ALL }, { "compatible", 1, 0, GO_COMPATIBLE }, { "width", 1, 0, GO_WIDTH }, + { "max-width", 1, 0, GO_MAX_WIDTH }, + { "maxwidth", 1, 0, GO_MAX_WIDTH }, { "quiet", 0, 0, 'q' }, { "verbose", 0, 0, 'v' }, { "logging", 0, 0, 'L' }, @@ -1012,64 +1021,66 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x081 */ OPT_ALLOW_ALL, /* 0x082 */ OPT_COMPATIBLE, /* 0x083 */ OPT_WIDTH, - /* 0x084 */ OPT_DE, - /* 0x085 */ OPT_COLORS, - /* 0x086 */ OPT_NO_COLORS, - /* 0x087 */ OPT_CT_CODE, - /* 0x088 */ OPT_LE_CODE, - /* 0x089 */ OPT_OLD_SPINY, - /* 0x08a */ OPT_CRS1, - /* 0x08b */ OPT_CHDIR, - /* 0x08c */ OPT_ROUND, - /* 0x08d */ OPT_RAW, - /* 0x08e */ OPT_BMG_ENDIAN, - /* 0x08f */ OPT_BMG_ENCODING, - /* 0x090 */ OPT_BMG_INF_SIZE, - /* 0x091 */ OPT_BMG_MID, - /* 0x092 */ OPT_FORCE_ATTRIB, - /* 0x093 */ OPT_DEF_ATTRIB, - /* 0x094 */ OPT_NO_ATTRIB, - /* 0x095 */ OPT_X_ESCAPES, - /* 0x096 */ OPT_OLD_ESCAPES, - /* 0x097 */ OPT_NO_BMG_COLORS, - /* 0x098 */ OPT_BMG_COLORS, - /* 0x099 */ OPT_NO_BMG_INLINE, - /* 0x09a */ OPT_NO_ECHO, - /* 0x09b */ OPT_UTF_8, - /* 0x09c */ OPT_NO_UTF_8, - /* 0x09d */ OPT_FORCE, - /* 0x09e */ OPT_REPAIR_MAGICS, - /* 0x09f */ OPT_OLD, - /* 0x0a0 */ OPT_STD, - /* 0x0a1 */ OPT_NEW, - /* 0x0a2 */ OPT_EXTRACT, - /* 0x0a3 */ OPT_LIST, - /* 0x0a4 */ OPT_REF, - /* 0x0a5 */ OPT_FULL, - /* 0x0a6 */ OPT_HEX, - /* 0x0a7 */ OPT_CT_DIR, - /* 0x0a8 */ OPT_CT_LOG, - /* 0x0a9 */ OPT_ALLOW_SLOTS, - /* 0x0aa */ OPT_IMAGES, - /* 0x0ab */ OPT_LOAD_BMG, - /* 0x0ac */ OPT_PATCH_BMG, - /* 0x0ad */ OPT_MACRO_BMG, - /* 0x0ae */ OPT_FILTER_BMG, - /* 0x0af */ OPT_PATCH_NAMES, - /* 0x0b0 */ OPT_ORDER_BY, - /* 0x0b1 */ OPT_ORDER_ALL, - /* 0x0b2 */ OPT_DYNAMIC, - /* 0x0b3 */ OPT_WRITE_TRACKS, - /* 0x0b4 */ OPT_NUMBER, - /* 0x0b5 */ OPT_SECTIONS, - /* 0x0b6 */ 0,0,0,0, 0,0,0,0, 0,0, + /* 0x084 */ OPT_MAX_WIDTH, + /* 0x085 */ OPT_DE, + /* 0x086 */ OPT_COLORS, + /* 0x087 */ OPT_NO_COLORS, + /* 0x088 */ OPT_CT_CODE, + /* 0x089 */ OPT_LE_CODE, + /* 0x08a */ OPT_OLD_SPINY, + /* 0x08b */ OPT_CRS1, + /* 0x08c */ OPT_CHDIR, + /* 0x08d */ OPT_ROUND, + /* 0x08e */ OPT_RAW, + /* 0x08f */ OPT_BMG_ENDIAN, + /* 0x090 */ OPT_BMG_ENCODING, + /* 0x091 */ OPT_BMG_INF_SIZE, + /* 0x092 */ OPT_BMG_MID, + /* 0x093 */ OPT_FORCE_ATTRIB, + /* 0x094 */ OPT_DEF_ATTRIB, + /* 0x095 */ OPT_NO_ATTRIB, + /* 0x096 */ OPT_X_ESCAPES, + /* 0x097 */ OPT_OLD_ESCAPES, + /* 0x098 */ OPT_NO_BMG_COLORS, + /* 0x099 */ OPT_BMG_COLORS, + /* 0x09a */ OPT_NO_BMG_INLINE, + /* 0x09b */ OPT_NO_ECHO, + /* 0x09c */ OPT_UTF_8, + /* 0x09d */ OPT_NO_UTF_8, + /* 0x09e */ OPT_FORCE, + /* 0x09f */ OPT_REPAIR_MAGICS, + /* 0x0a0 */ OPT_OLD, + /* 0x0a1 */ OPT_STD, + /* 0x0a2 */ OPT_NEW, + /* 0x0a3 */ OPT_EXTRACT, + /* 0x0a4 */ OPT_LIST, + /* 0x0a5 */ OPT_REF, + /* 0x0a6 */ OPT_FULL, + /* 0x0a7 */ OPT_HEX, + /* 0x0a8 */ OPT_CT_DIR, + /* 0x0a9 */ OPT_CT_LOG, + /* 0x0aa */ OPT_ALLOW_SLOTS, + /* 0x0ab */ OPT_IMAGES, + /* 0x0ac */ OPT_LOAD_BMG, + /* 0x0ad */ OPT_PATCH_BMG, + /* 0x0ae */ OPT_MACRO_BMG, + /* 0x0af */ OPT_FILTER_BMG, + /* 0x0b0 */ OPT_PATCH_NAMES, + /* 0x0b1 */ OPT_ORDER_BY, + /* 0x0b2 */ OPT_ORDER_ALL, + /* 0x0b3 */ OPT_DYNAMIC, + /* 0x0b4 */ OPT_WRITE_TRACKS, + /* 0x0b5 */ OPT_NUMBER, + /* 0x0b6 */ OPT_SECTIONS, + /* 0x0b7 */ 0,0,0,0, 0,0,0,0, 0, /* 0x0c0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x0d0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x0e0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x0f0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x100 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x110 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, - /* 0x120 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, + /* 0x120 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, + /* 0x130 */ 0,0,0,0, 0,0, }; // @@ -1217,6 +1228,7 @@ static const InfoOption_t * option_tab_tool[] = OptionInfo + OPT_ALLOW_ALL, OptionInfo + OPT_COMPATIBLE, OptionInfo + OPT_WIDTH, + OptionInfo + OPT_MAX_WIDTH, OptionInfo + OPT_QUIET, OptionInfo + OPT_VERBOSE, OptionInfo + OPT_LOGGING, @@ -1258,6 +1270,7 @@ static const InfoOption_t * option_tab_cmd_VERSION[] = static const InfoOption_t * option_tab_cmd_HELP[] = { OptionInfo + OPT_WIDTH, + OptionInfo + OPT_MAX_WIDTH, 0 }; @@ -1588,7 +1601,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "Wiimms CT-CODE Tool : Manage the CT-CODE extension. BRRES, TEX0," " CT-CODE, CT-TEXT and LE-BIN files are accepted as input.", 0, - 25, + 26, option_tab_tool, 0 }, @@ -1626,7 +1639,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " The third variant (with a valid command name) prints details about" " the declared command. The fourth variant prints an overview about" " all commands and all global options.", - 1, + 2, option_tab_cmd_HELP, option_allowed_cmd_HELP }, diff --git a/project/src/ui/ui-wctct.h b/project/src/ui/ui-wctct.h index 184515b..cfe351a 100644 --- a/project/src/ui/ui-wctct.h +++ b/project/src/ui/ui-wctct.h @@ -16,7 +16,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -113,6 +113,7 @@ typedef enum enumOptions OPT_ALLOW_ALL, OPT_COMPATIBLE, OPT_WIDTH, + OPT_MAX_WIDTH, OPT_QUIET, OPT_VERBOSE, OPT_LOGGING, @@ -141,7 +142,7 @@ typedef enum enumOptions OPT_CT_LOG, OPT_ALLOW_SLOTS, - OPT__N_TOTAL // == 80 + OPT__N_TOTAL // == 81 } enumOptions; @@ -433,6 +434,7 @@ typedef enum enumGetOpt GO_ALLOW_ALL, GO_COMPATIBLE, GO_WIDTH, + GO_MAX_WIDTH, GO_DE, GO_COLORS, GO_NO_COLORS, @@ -497,7 +499,7 @@ typedef enum enumGetOpt //extern const struct option OptionLong[]; //extern u8 OptionUsed[OPT__N_TOTAL+1]; //extern const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE]; -//UIOPT_INDEX_SIZE := 0x12c = 300 +//UIOPT_INDEX_SIZE := 0x136 = 310 //extern const InfoCommand_t CommandInfo[CMD__N+1]; extern const InfoUI_t InfoUI_wctct; diff --git a/project/src/ui/ui-wimgt.c b/project/src/ui/ui-wimgt.c index 0788b7f..0fae748 100644 --- a/project/src/ui/ui-wimgt.c +++ b/project/src/ui/ui-wimgt.c @@ -16,7 +16,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -300,6 +300,13 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " messages and disable the automatic detection of the terminal width." }, + { OPT_MAX_WIDTH, false, false, false, true, false, 0, "max-width", + "maxwidth", + "Define the maximum terminal width (number of columns) for help and" + " some other messages and disable the automatic detection of the" + " terminal width. This option is ignored if --width is set." + }, + { OPT_QUIET, false, false, false, false, false, 'q', "quiet", 0, "Be quiet and print only error messages. Multiple usage is possible." @@ -466,7 +473,7 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " helper option." }, - {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 54 + {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 55 }; @@ -582,6 +589,8 @@ static const struct option OptionLong[] = { "allowall", 0, 0, GO_ALLOW_ALL }, { "compatible", 1, 0, GO_COMPATIBLE }, { "width", 1, 0, GO_WIDTH }, + { "max-width", 1, 0, GO_MAX_WIDTH }, + { "maxwidth", 1, 0, GO_MAX_WIDTH }, { "quiet", 0, 0, 'q' }, { "verbose", 0, 0, 'v' }, { "logging", 0, 0, 'L' }, @@ -719,32 +728,33 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x081 */ OPT_ALLOW_ALL, /* 0x082 */ OPT_COMPATIBLE, /* 0x083 */ OPT_WIDTH, - /* 0x084 */ OPT_DE, - /* 0x085 */ OPT_COLORS, - /* 0x086 */ OPT_NO_COLORS, - /* 0x087 */ OPT_CT_CODE, - /* 0x088 */ OPT_LE_CODE, - /* 0x089 */ OPT_CHDIR, - /* 0x08a */ OPT_UTF_8, - /* 0x08b */ OPT_NO_UTF_8, - /* 0x08c */ OPT_FORCE, - /* 0x08d */ OPT_REPAIR_MAGICS, - /* 0x08e */ OPT_OLD, - /* 0x08f */ OPT_STD, - /* 0x090 */ OPT_NEW, - /* 0x091 */ OPT_EXTRACT, - /* 0x092 */ OPT_NUMBER, - /* 0x093 */ OPT_MIPMAPS, - /* 0x094 */ OPT_NO_MIPMAPS, - /* 0x095 */ OPT_N_MIPMAPS, - /* 0x096 */ OPT_MAX_MIPMAPS, - /* 0x097 */ OPT_MIPMAP_SIZE, - /* 0x098 */ OPT_FAST_MIPMAPS, - /* 0x099 */ OPT_CMPR_DEFAULT, - /* 0x09a */ OPT_PRE_CONVERT, - /* 0x09b */ OPT_STRIP, - /* 0x09c */ OPT_SECTIONS, - /* 0x09d */ 0,0,0, + /* 0x084 */ OPT_MAX_WIDTH, + /* 0x085 */ OPT_DE, + /* 0x086 */ OPT_COLORS, + /* 0x087 */ OPT_NO_COLORS, + /* 0x088 */ OPT_CT_CODE, + /* 0x089 */ OPT_LE_CODE, + /* 0x08a */ OPT_CHDIR, + /* 0x08b */ OPT_UTF_8, + /* 0x08c */ OPT_NO_UTF_8, + /* 0x08d */ OPT_FORCE, + /* 0x08e */ OPT_REPAIR_MAGICS, + /* 0x08f */ OPT_OLD, + /* 0x090 */ OPT_STD, + /* 0x091 */ OPT_NEW, + /* 0x092 */ OPT_EXTRACT, + /* 0x093 */ OPT_NUMBER, + /* 0x094 */ OPT_MIPMAPS, + /* 0x095 */ OPT_NO_MIPMAPS, + /* 0x096 */ OPT_N_MIPMAPS, + /* 0x097 */ OPT_MAX_MIPMAPS, + /* 0x098 */ OPT_MIPMAP_SIZE, + /* 0x099 */ OPT_FAST_MIPMAPS, + /* 0x09a */ OPT_CMPR_DEFAULT, + /* 0x09b */ OPT_PRE_CONVERT, + /* 0x09c */ OPT_STRIP, + /* 0x09d */ OPT_SECTIONS, + /* 0x09e */ 0,0, /* 0x0a0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x0b0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x0c0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, @@ -753,7 +763,8 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x0f0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x100 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x110 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, - /* 0x120 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, + /* 0x120 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, + /* 0x130 */ 0,0,0,0, 0,0, }; // @@ -850,6 +861,7 @@ static const InfoOption_t * option_tab_tool[] = OptionInfo + OPT_ALLOW_ALL, OptionInfo + OPT_COMPATIBLE, OptionInfo + OPT_WIDTH, + OptionInfo + OPT_MAX_WIDTH, OptionInfo + OPT_QUIET, OptionInfo + OPT_VERBOSE, OptionInfo + OPT_LOGGING, @@ -883,6 +895,7 @@ static const InfoOption_t * option_tab_cmd_VERSION[] = static const InfoOption_t * option_tab_cmd_HELP[] = { OptionInfo + OPT_WIDTH, + OptionInfo + OPT_MAX_WIDTH, 0 }; @@ -1122,7 +1135,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "Wiimms Image Tool : Extract and convert graphic images. The file" " formats TPL, TEX, BTI, BREFT and PNG are supported.", 0, - 20, + 21, option_tab_tool, 0 }, @@ -1160,7 +1173,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " The third variant (with a valid command name) prints details about" " the declared command. The fourth variant prints an overview about" " all commands and all global options.", - 1, + 2, option_tab_cmd_HELP, option_allowed_cmd_HELP }, diff --git a/project/src/ui/ui-wimgt.h b/project/src/ui/ui-wimgt.h index 5cb93b9..42d5994 100644 --- a/project/src/ui/ui-wimgt.h +++ b/project/src/ui/ui-wimgt.h @@ -16,7 +16,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -92,6 +92,7 @@ typedef enum enumOptions OPT_ALLOW_ALL, OPT_COMPATIBLE, OPT_WIDTH, + OPT_MAX_WIDTH, OPT_QUIET, OPT_VERBOSE, OPT_LOGGING, @@ -115,7 +116,7 @@ typedef enum enumOptions OPT_NEW, OPT_EXTRACT, - OPT__N_TOTAL // == 54 + OPT__N_TOTAL // == 55 } enumOptions; @@ -296,6 +297,7 @@ typedef enum enumGetOpt GO_ALLOW_ALL, GO_COMPATIBLE, GO_WIDTH, + GO_MAX_WIDTH, GO_DE, GO_COLORS, GO_NO_COLORS, @@ -335,7 +337,7 @@ typedef enum enumGetOpt //extern const struct option OptionLong[]; //extern u8 OptionUsed[OPT__N_TOTAL+1]; //extern const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE]; -//UIOPT_INDEX_SIZE := 0x12c = 300 +//UIOPT_INDEX_SIZE := 0x136 = 310 //extern const InfoCommand_t CommandInfo[CMD__N+1]; extern const InfoUI_t InfoUI_wimgt; diff --git a/project/src/ui/ui-wkclt.c b/project/src/ui/ui-wkclt.c index 6678074..2102123 100644 --- a/project/src/ui/ui-wkclt.c +++ b/project/src/ui/ui-wkclt.c @@ -16,7 +16,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -409,6 +409,13 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " messages and disable the automatic detection of the terminal width." }, + { OPT_MAX_WIDTH, false, false, false, true, false, 0, "max-width", + "maxwidth", + "Define the maximum terminal width (number of columns) for help and" + " some other messages and disable the automatic detection of the" + " terminal width. This option is ignored if --width is set." + }, + { OPT_QUIET, false, false, false, false, false, 'q', "quiet", 0, "Be quiet and print only error messages. Multiple usage is possible." @@ -494,8 +501,8 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " the octree creation. The other allowed keywords are: FAST, NEW," " CENTER, ROUND, NORMALS, MTL, WIIMM, TRIANGLES, OUT-SWAP, G, USEMTL," " CLIP, IN-SWAP, AUTO, HEX4, HEX23, HEX, DROP-UNUSED, DROP-FIXED," - " DROP-INVALID, DROP, RM-FACEDOWN, RM-FACEUP, FIX-ALL, CONV-FACEUP," - " WEAK-WALLS, SORT, INPLACE, SILENT and LOG. See" + " DROP-INVALID, DROP, RM-FACEDOWN, RM-FACEUP, FIX-ALL, TINY-0 ..." + " TINY-7, CONV-FACEUP, WEAK-WALLS, SORT, INPLACE, SILENT and LOG. See" " https://szs.wiimm.de/opt/kcl for details." }, @@ -626,7 +633,7 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " helper option." }, - {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 70 + {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 71 }; @@ -880,6 +887,8 @@ static const struct option OptionLong[] = { "allowall", 0, 0, GO_ALLOW_ALL }, { "compatible", 1, 0, GO_COMPATIBLE }, { "width", 1, 0, GO_WIDTH }, + { "max-width", 1, 0, GO_MAX_WIDTH }, + { "maxwidth", 1, 0, GO_MAX_WIDTH }, { "quiet", 0, 0, 'q' }, { "verbose", 0, 0, 'v' }, { "logging", 0, 0, 'L' }, @@ -1029,49 +1038,50 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x081 */ OPT_ALLOW_ALL, /* 0x082 */ OPT_COMPATIBLE, /* 0x083 */ OPT_WIDTH, - /* 0x084 */ OPT_DE, - /* 0x085 */ OPT_COLORS, - /* 0x086 */ OPT_NO_COLORS, - /* 0x087 */ OPT_CT_CODE, - /* 0x088 */ OPT_LE_CODE, - /* 0x089 */ OPT_CHDIR, - /* 0x08a */ OPT_SCALE, - /* 0x08b */ OPT_SHIFT, - /* 0x08c */ OPT_XSS, - /* 0x08d */ OPT_YSS, - /* 0x08e */ OPT_ZSS, - /* 0x08f */ OPT_ROT, - /* 0x090 */ OPT_XROT, - /* 0x091 */ OPT_YROT, - /* 0x092 */ OPT_ZROT, - /* 0x093 */ OPT_TRANSLATE, - /* 0x094 */ OPT_NULL, - /* 0x095 */ OPT_NEXT, - /* 0x096 */ OPT_ASCALE, - /* 0x097 */ OPT_AROT, - /* 0x098 */ OPT_TFORM_SCRIPT, - /* 0x099 */ OPT_KCL, - /* 0x09a */ OPT_KCL_FLAG, - /* 0x09b */ OPT_KCL_SCRIPT, - /* 0x09c */ OPT_TRI_AREA, - /* 0x09d */ OPT_TRI_HEIGHT, - /* 0x09e */ OPT_FLAG_FILE, - /* 0x09f */ OPT_XTRIDATA, - /* 0x0a0 */ OPT_SLOT, - /* 0x0a1 */ OPT_ROUND, - /* 0x0a2 */ OPT_NO_ECHO, - /* 0x0a3 */ OPT_UTF_8, - /* 0x0a4 */ OPT_NO_UTF_8, - /* 0x0a5 */ OPT_FORCE, - /* 0x0a6 */ OPT_REPAIR_MAGICS, - /* 0x0a7 */ OPT_TINY, - /* 0x0a8 */ OPT_OLD, - /* 0x0a9 */ OPT_STD, - /* 0x0aa */ OPT_NEW, - /* 0x0ab */ OPT_EXTRACT, - /* 0x0ac */ OPT_NUMBER, - /* 0x0ad */ OPT_SECTIONS, - /* 0x0ae */ 0,0, + /* 0x084 */ OPT_MAX_WIDTH, + /* 0x085 */ OPT_DE, + /* 0x086 */ OPT_COLORS, + /* 0x087 */ OPT_NO_COLORS, + /* 0x088 */ OPT_CT_CODE, + /* 0x089 */ OPT_LE_CODE, + /* 0x08a */ OPT_CHDIR, + /* 0x08b */ OPT_SCALE, + /* 0x08c */ OPT_SHIFT, + /* 0x08d */ OPT_XSS, + /* 0x08e */ OPT_YSS, + /* 0x08f */ OPT_ZSS, + /* 0x090 */ OPT_ROT, + /* 0x091 */ OPT_XROT, + /* 0x092 */ OPT_YROT, + /* 0x093 */ OPT_ZROT, + /* 0x094 */ OPT_TRANSLATE, + /* 0x095 */ OPT_NULL, + /* 0x096 */ OPT_NEXT, + /* 0x097 */ OPT_ASCALE, + /* 0x098 */ OPT_AROT, + /* 0x099 */ OPT_TFORM_SCRIPT, + /* 0x09a */ OPT_KCL, + /* 0x09b */ OPT_KCL_FLAG, + /* 0x09c */ OPT_KCL_SCRIPT, + /* 0x09d */ OPT_TRI_AREA, + /* 0x09e */ OPT_TRI_HEIGHT, + /* 0x09f */ OPT_FLAG_FILE, + /* 0x0a0 */ OPT_XTRIDATA, + /* 0x0a1 */ OPT_SLOT, + /* 0x0a2 */ OPT_ROUND, + /* 0x0a3 */ OPT_NO_ECHO, + /* 0x0a4 */ OPT_UTF_8, + /* 0x0a5 */ OPT_NO_UTF_8, + /* 0x0a6 */ OPT_FORCE, + /* 0x0a7 */ OPT_REPAIR_MAGICS, + /* 0x0a8 */ OPT_TINY, + /* 0x0a9 */ OPT_OLD, + /* 0x0aa */ OPT_STD, + /* 0x0ab */ OPT_NEW, + /* 0x0ac */ OPT_EXTRACT, + /* 0x0ad */ OPT_NUMBER, + /* 0x0ae */ OPT_SECTIONS, + /* 0x0af */ 0, /* 0x0b0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x0c0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x0d0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, @@ -1079,7 +1089,8 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x0f0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x100 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x110 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, - /* 0x120 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, + /* 0x120 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, + /* 0x130 */ 0,0,0,0, 0,0, }; // @@ -1275,6 +1286,7 @@ static const InfoOption_t * option_tab_tool[] = OptionInfo + OPT_ALLOW_ALL, OptionInfo + OPT_COMPATIBLE, OptionInfo + OPT_WIDTH, + OptionInfo + OPT_MAX_WIDTH, OptionInfo + OPT_QUIET, OptionInfo + OPT_VERBOSE, OptionInfo + OPT_LOGGING, @@ -1312,6 +1324,7 @@ static const InfoOption_t * option_tab_cmd_VERSION[] = static const InfoOption_t * option_tab_cmd_HELP[] = { OptionInfo + OPT_WIDTH, + OptionInfo + OPT_MAX_WIDTH, 0 }; @@ -1957,7 +1970,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "Wiimms KCL Tool : Analyze, modify, export and create KCL and OBJ" " files.", 0, - 24, + 25, option_tab_tool, 0 }, @@ -1995,7 +2008,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " The third variant (with a valid command name) prints details about" " the declared command. The fourth variant prints an overview about" " all commands and all global options.", - 1, + 2, option_tab_cmd_HELP, option_allowed_cmd_HELP }, diff --git a/project/src/ui/ui-wkclt.h b/project/src/ui/ui-wkclt.h index a55da8b..41097b5 100644 --- a/project/src/ui/ui-wkclt.h +++ b/project/src/ui/ui-wkclt.h @@ -16,7 +16,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -103,6 +103,7 @@ typedef enum enumOptions OPT_ALLOW_ALL, OPT_COMPATIBLE, OPT_WIDTH, + OPT_MAX_WIDTH, OPT_QUIET, OPT_VERBOSE, OPT_LOGGING, @@ -131,7 +132,7 @@ typedef enum enumOptions OPT_NEW, OPT_EXTRACT, - OPT__N_TOTAL // == 70 + OPT__N_TOTAL // == 71 } enumOptions; @@ -412,6 +413,7 @@ typedef enum enumGetOpt GO_ALLOW_ALL, GO_COMPATIBLE, GO_WIDTH, + GO_MAX_WIDTH, GO_DE, GO_COLORS, GO_NO_COLORS, @@ -468,7 +470,7 @@ typedef enum enumGetOpt //extern const struct option OptionLong[]; //extern u8 OptionUsed[OPT__N_TOTAL+1]; //extern const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE]; -//UIOPT_INDEX_SIZE := 0x12c = 300 +//UIOPT_INDEX_SIZE := 0x136 = 310 //extern const InfoCommand_t CommandInfo[CMD__N+1]; extern const InfoUI_t InfoUI_wkclt; diff --git a/project/src/ui/ui-wkmpt.c b/project/src/ui/ui-wkmpt.c index 1ce32eb..5a47964 100644 --- a/project/src/ui/ui-wkmpt.c +++ b/project/src/ui/ui-wkmpt.c @@ -16,7 +16,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -529,6 +529,13 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " messages and disable the automatic detection of the terminal width." }, + { OPT_MAX_WIDTH, false, false, false, true, false, 0, "max-width", + "maxwidth", + "Define the maximum terminal width (number of columns) for help and" + " some other messages and disable the automatic detection of the" + " terminal width. This option is ignored if --width is set." + }, + { OPT_QUIET, false, false, false, false, false, 'q', "quiet", 0, "Be quiet and print only error messages. Multiple usage is possible." @@ -661,8 +668,8 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " the octree creation. The other allowed keywords are: FAST, NEW," " CENTER, ROUND, NORMALS, MTL, WIIMM, TRIANGLES, OUT-SWAP, G, USEMTL," " CLIP, IN-SWAP, AUTO, HEX4, HEX23, HEX, DROP-UNUSED, DROP-FIXED," - " DROP-INVALID, DROP, RM-FACEDOWN, RM-FACEUP, FIX-ALL, CONV-FACEUP," - " WEAK-WALLS, SORT, INPLACE, SILENT and LOG. See" + " DROP-INVALID, DROP, RM-FACEDOWN, RM-FACEUP, FIX-ALL, TINY-0 ..." + " TINY-7, CONV-FACEUP, WEAK-WALLS, SORT, INPLACE, SILENT and LOG. See" " https://szs.wiimm.de/opt/kcl for details." }, @@ -706,7 +713,7 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " WIDE, NARROW, FIX-CKPH, FIX-ENPH, FIX-ITPH, FIX-PH, FIX-CKNEXT," " FIX-CKJGPT, FIX-CK, FIX-ALL, MASK-PFLAGS, RM-LECODE, PURGE-GOBJ," " FULL-DEFOBJ, DUMP-CLASS, DUMP-ONEWAY, DUMP-ALL, 1LAP ... 9LAPS," - " MAX-LAPS, RM-EMPTY, INPLACE, SILENT and LOG. See" + " MAX-LAPS, RM-EMPTY, TINY-0 ... TINY-7, INPLACE, SILENT and LOG. See" " https://szs.wiimm.de/opt/kmp for details." }, @@ -851,7 +858,7 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " helper option." }, - {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 91 + {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 92 }; @@ -1132,6 +1139,8 @@ static const struct option OptionLong[] = { "allowall", 0, 0, GO_ALLOW_ALL }, { "compatible", 1, 0, GO_COMPATIBLE }, { "width", 1, 0, GO_WIDTH }, + { "max-width", 1, 0, GO_MAX_WIDTH }, + { "maxwidth", 1, 0, GO_MAX_WIDTH }, { "quiet", 0, 0, 'q' }, { "verbose", 0, 0, 'v' }, { "logging", 0, 0, 'L' }, @@ -1320,73 +1329,75 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x081 */ OPT_ALLOW_ALL, /* 0x082 */ OPT_COMPATIBLE, /* 0x083 */ OPT_WIDTH, - /* 0x084 */ OPT_DE, - /* 0x085 */ OPT_COLORS, - /* 0x086 */ OPT_NO_COLORS, - /* 0x087 */ OPT_CT_CODE, - /* 0x088 */ OPT_LE_CODE, - /* 0x089 */ OPT_CHDIR, - /* 0x08a */ OPT_SCALE, - /* 0x08b */ OPT_SHIFT, - /* 0x08c */ OPT_XSS, - /* 0x08d */ OPT_YSS, - /* 0x08e */ OPT_ZSS, - /* 0x08f */ OPT_ROT, - /* 0x090 */ OPT_XROT, - /* 0x091 */ OPT_YROT, - /* 0x092 */ OPT_ZROT, - /* 0x093 */ OPT_YPOS, - /* 0x094 */ OPT_TRANSLATE, - /* 0x095 */ OPT_NULL, - /* 0x096 */ OPT_NEXT, - /* 0x097 */ OPT_ASCALE, - /* 0x098 */ OPT_AROT, - /* 0x099 */ OPT_TFORM_SCRIPT, - /* 0x09a */ OPT_RM_GOBJ, - /* 0x09b */ OPT_BATTLE, - /* 0x09c */ OPT_EXPORT_FLAGS, - /* 0x09d */ OPT_ROUTE_OPTIONS, - /* 0x09e */ OPT_WIM0, - /* 0x09f */ OPT_SLOT, - /* 0x0a0 */ OPT_POS_MODE, - /* 0x0a1 */ OPT_POS_FILE, - /* 0x0a2 */ OPT_PNG, - /* 0x0a3 */ OPT_LOAD_KCL, - /* 0x0a4 */ OPT_KCL, - /* 0x0a5 */ OPT_KCL_FLAG, - /* 0x0a6 */ OPT_KCL_SCRIPT, - /* 0x0a7 */ OPT_TRI_AREA, - /* 0x0a8 */ OPT_TRI_HEIGHT, - /* 0x0a9 */ OPT_FLAG_FILE, - /* 0x0aa */ OPT_XTRIDATA, - /* 0x0ab */ OPT_KMP, - /* 0x0ac */ OPT_SPEED_MOD, - /* 0x0ad */ OPT_KTPT2, - /* 0x0ae */ OPT_TFORM_KMP, - /* 0x0af */ OPT_REPAIR_XPF, - /* 0x0b0 */ OPT_GAMEMODES, - /* 0x0b1 */ OPT_ROUND, - /* 0x0b2 */ OPT_EPSILON, - /* 0x0b3 */ OPT_DIFF, - /* 0x0b4 */ OPT_NO_ECHO, - /* 0x0b5 */ OPT_UTF_8, - /* 0x0b6 */ OPT_NO_UTF_8, - /* 0x0b7 */ OPT_FORCE, - /* 0x0b8 */ OPT_REPAIR_MAGICS, - /* 0x0b9 */ OPT_TINY, - /* 0x0ba */ OPT_OLD, - /* 0x0bb */ OPT_STD, - /* 0x0bc */ OPT_NEW, - /* 0x0bd */ OPT_EXTRACT, - /* 0x0be */ OPT_NUMBER, - /* 0x0bf */ OPT_SECTIONS, - /* 0x0c0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, + /* 0x084 */ OPT_MAX_WIDTH, + /* 0x085 */ OPT_DE, + /* 0x086 */ OPT_COLORS, + /* 0x087 */ OPT_NO_COLORS, + /* 0x088 */ OPT_CT_CODE, + /* 0x089 */ OPT_LE_CODE, + /* 0x08a */ OPT_CHDIR, + /* 0x08b */ OPT_SCALE, + /* 0x08c */ OPT_SHIFT, + /* 0x08d */ OPT_XSS, + /* 0x08e */ OPT_YSS, + /* 0x08f */ OPT_ZSS, + /* 0x090 */ OPT_ROT, + /* 0x091 */ OPT_XROT, + /* 0x092 */ OPT_YROT, + /* 0x093 */ OPT_ZROT, + /* 0x094 */ OPT_YPOS, + /* 0x095 */ OPT_TRANSLATE, + /* 0x096 */ OPT_NULL, + /* 0x097 */ OPT_NEXT, + /* 0x098 */ OPT_ASCALE, + /* 0x099 */ OPT_AROT, + /* 0x09a */ OPT_TFORM_SCRIPT, + /* 0x09b */ OPT_RM_GOBJ, + /* 0x09c */ OPT_BATTLE, + /* 0x09d */ OPT_EXPORT_FLAGS, + /* 0x09e */ OPT_ROUTE_OPTIONS, + /* 0x09f */ OPT_WIM0, + /* 0x0a0 */ OPT_SLOT, + /* 0x0a1 */ OPT_POS_MODE, + /* 0x0a2 */ OPT_POS_FILE, + /* 0x0a3 */ OPT_PNG, + /* 0x0a4 */ OPT_LOAD_KCL, + /* 0x0a5 */ OPT_KCL, + /* 0x0a6 */ OPT_KCL_FLAG, + /* 0x0a7 */ OPT_KCL_SCRIPT, + /* 0x0a8 */ OPT_TRI_AREA, + /* 0x0a9 */ OPT_TRI_HEIGHT, + /* 0x0aa */ OPT_FLAG_FILE, + /* 0x0ab */ OPT_XTRIDATA, + /* 0x0ac */ OPT_KMP, + /* 0x0ad */ OPT_SPEED_MOD, + /* 0x0ae */ OPT_KTPT2, + /* 0x0af */ OPT_TFORM_KMP, + /* 0x0b0 */ OPT_REPAIR_XPF, + /* 0x0b1 */ OPT_GAMEMODES, + /* 0x0b2 */ OPT_ROUND, + /* 0x0b3 */ OPT_EPSILON, + /* 0x0b4 */ OPT_DIFF, + /* 0x0b5 */ OPT_NO_ECHO, + /* 0x0b6 */ OPT_UTF_8, + /* 0x0b7 */ OPT_NO_UTF_8, + /* 0x0b8 */ OPT_FORCE, + /* 0x0b9 */ OPT_REPAIR_MAGICS, + /* 0x0ba */ OPT_TINY, + /* 0x0bb */ OPT_OLD, + /* 0x0bc */ OPT_STD, + /* 0x0bd */ OPT_NEW, + /* 0x0be */ OPT_EXTRACT, + /* 0x0bf */ OPT_NUMBER, + /* 0x0c0 */ OPT_SECTIONS, + /* 0x0c1 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0, /* 0x0d0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x0e0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x0f0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x100 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x110 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, - /* 0x120 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, + /* 0x120 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, + /* 0x130 */ 0,0,0,0, 0,0, }; // @@ -1582,6 +1593,7 @@ static const InfoOption_t * option_tab_tool[] = OptionInfo + OPT_ALLOW_ALL, OptionInfo + OPT_COMPATIBLE, OptionInfo + OPT_WIDTH, + OptionInfo + OPT_MAX_WIDTH, OptionInfo + OPT_QUIET, OptionInfo + OPT_VERBOSE, OptionInfo + OPT_LOGGING, @@ -1628,6 +1640,7 @@ static const InfoOption_t * option_tab_cmd_VERSION[] = static const InfoOption_t * option_tab_cmd_HELP[] = { OptionInfo + OPT_WIDTH, + OptionInfo + OPT_MAX_WIDTH, 0 }; @@ -1789,6 +1802,7 @@ static const InfoOption_t * option_tab_cmd_STARTPOS[] = static const InfoOption_t * option_tab_cmd_OBJECTS[] = { OptionInfo + OPT_WIDTH, + OptionInfo + OPT_MAX_WIDTH, OptionInfo + OPT_NO_HEADER, &option_cmd_OBJECTS_BRIEF, &option_cmd_OBJECTS_LONG, @@ -2129,7 +2143,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "Wiimms KMP Tool : Analyze, modify, export and create (compile) KMP" " files.", 0, - 33, + 34, option_tab_tool, 0 }, @@ -2167,7 +2181,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " The third variant (with a valid command name) prints details about" " the declared command. The fourth variant prints an overview about" " all commands and all global options.", - 1, + 2, option_tab_cmd_HELP, option_allowed_cmd_HELP }, @@ -2395,7 +2409,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " object and file database. An online query is also available:" " https://szs.wiimm.de/cgi/mkw/object", 0, - 4, + 5, option_tab_cmd_OBJECTS, option_allowed_cmd_OBJECTS }, diff --git a/project/src/ui/ui-wkmpt.h b/project/src/ui/ui-wkmpt.h index 34468b7..2b8541d 100644 --- a/project/src/ui/ui-wkmpt.h +++ b/project/src/ui/ui-wkmpt.h @@ -16,7 +16,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -115,6 +115,7 @@ typedef enum enumOptions OPT_ALLOW_ALL, OPT_COMPATIBLE, OPT_WIDTH, + OPT_MAX_WIDTH, OPT_QUIET, OPT_VERBOSE, OPT_LOGGING, @@ -152,7 +153,7 @@ typedef enum enumOptions OPT_NEW, OPT_EXTRACT, - OPT__N_TOTAL // == 91 + OPT__N_TOTAL // == 92 } enumOptions; @@ -449,6 +450,7 @@ typedef enum enumGetOpt GO_ALLOW_ALL, GO_COMPATIBLE, GO_WIDTH, + GO_MAX_WIDTH, GO_DE, GO_COLORS, GO_NO_COLORS, @@ -523,7 +525,7 @@ typedef enum enumGetOpt //extern const struct option OptionLong[]; //extern u8 OptionUsed[OPT__N_TOTAL+1]; //extern const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE]; -//UIOPT_INDEX_SIZE := 0x12c = 300 +//UIOPT_INDEX_SIZE := 0x136 = 310 //extern const InfoCommand_t CommandInfo[CMD__N+1]; extern const InfoUI_t InfoUI_wkmpt; diff --git a/project/src/ui/ui-wlect.c b/project/src/ui/ui-wlect.c index e74581c..309da13 100644 --- a/project/src/ui/ui-wlect.c +++ b/project/src/ui/ui-wlect.c @@ -16,7 +16,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -407,6 +407,13 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " messages and disable the automatic detection of the terminal width." }, + { OPT_MAX_WIDTH, false, false, false, true, false, 0, "max-width", + "maxwidth", + "Define the maximum terminal width (number of columns) for help and" + " some other messages and disable the automatic detection of the" + " terminal width. This option is ignored if --width is set." + }, + { OPT_QUIET, false, false, false, false, false, 'q', "quiet", 0, "Be quiet and print only error messages. Multiple usage is possible." @@ -533,6 +540,12 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " all --lt-* options." }, + { OPT_LEX_RM_FEAT, false, true, false, false, false, 0, "rm-features", + 0, + "Remove LEX setion FEA0 (features) if exists. It is executed after" + " --lex-purge. --lex-rm-features is an alternative name." + }, + { OPT_TEST, false, false, false, false, true, 't', "test", 0, "Run in test mode, modify nothing.\n" @@ -585,7 +598,7 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " helper option." }, - {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 76 + {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 78 }; @@ -742,6 +755,8 @@ static const struct option OptionLong[] = { "allowall", 0, 0, GO_ALLOW_ALL }, { "compatible", 1, 0, GO_COMPATIBLE }, { "width", 1, 0, GO_WIDTH }, + { "max-width", 1, 0, GO_MAX_WIDTH }, + { "maxwidth", 1, 0, GO_MAX_WIDTH }, { "quiet", 0, 0, 'q' }, { "verbose", 0, 0, 'v' }, { "logging", 0, 0, 'L' }, @@ -791,6 +806,10 @@ static const struct option OptionLong[] = { "ltrandom", 1, 0, GO_LT_RANDOM }, { "lex-purge", 0, 0, GO_LEX_PURGE }, { "lexpurge", 0, 0, GO_LEX_PURGE }, + { "rm-features", 0, 0, GO_LEX_RM_FEAT }, + { "rmfeatures", 0, 0, GO_LEX_RM_FEAT }, + { "lex-rm-features", 0, 0, GO_LEX_RM_FEAT }, + { "lexrmfeatures", 0, 0, GO_LEX_RM_FEAT }, { "test", 0, 0, 't' }, { "force", 0, 0, GO_FORCE }, { "repair-magics", 2, 0, GO_REPAIR_MAGICS }, @@ -913,63 +932,66 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x081 */ OPT_ALLOW_ALL, /* 0x082 */ OPT_COMPATIBLE, /* 0x083 */ OPT_WIDTH, - /* 0x084 */ OPT_DE, - /* 0x085 */ OPT_COLORS, - /* 0x086 */ OPT_NO_COLORS, - /* 0x087 */ OPT_CT_CODE, - /* 0x088 */ OPT_LE_CODE, - /* 0x089 */ OPT_CHDIR, - /* 0x08a */ OPT_ROUND, - /* 0x08b */ OPT_NO_ECHO, - /* 0x08c */ OPT_UTF_8, - /* 0x08d */ OPT_NO_UTF_8, - /* 0x08e */ OPT_LT_CLEAR, - /* 0x08f */ OPT_LT_ONLINE, - /* 0x090 */ OPT_LT_N_PLAYERS, - /* 0x091 */ OPT_LT_COND_BIT, - /* 0x092 */ OPT_LT_GAME_MODE, - /* 0x093 */ OPT_LT_ENGINE, - /* 0x094 */ OPT_LT_RANDOM, - /* 0x095 */ OPT_LEX_PURGE, - /* 0x096 */ OPT_FORCE, - /* 0x097 */ OPT_REPAIR_MAGICS, - /* 0x098 */ OPT_OLD, - /* 0x099 */ OPT_STD, - /* 0x09a */ OPT_NEW, - /* 0x09b */ OPT_EXTRACT, - /* 0x09c */ OPT_LE_DEFINE, - /* 0x09d */ OPT_LPAR, - /* 0x09e */ OPT_ALIAS, - /* 0x09f */ OPT_ENGINE, - /* 0x0a0 */ OPT_200CC, - /* 0x0a1 */ OPT_PERFMON, - /* 0x0a2 */ OPT_CUSTOM_TT, - /* 0x0a3 */ OPT_XPFLAGS, - /* 0x0a4 */ OPT_SPEEDOMETER, - /* 0x0a5 */ OPT_RESERVED_1B9, - /* 0x0a6 */ OPT_RESERVED_1BA, - /* 0x0a7 */ OPT_RESERVED_1BB, - /* 0x0a8 */ OPT_TRACK_DIR, - /* 0x0a9 */ OPT_COPY_TRACKS, - /* 0x0aa */ OPT_MOVE_TRACKS, - /* 0x0ab */ OPT_MOVE1_TRACKS, - /* 0x0ac */ OPT_LINK_TRACKS, - /* 0x0ad */ OPT_LOAD_BMG, - /* 0x0ae */ OPT_PATCH_BMG, - /* 0x0af */ OPT_MACRO_BMG, - /* 0x0b0 */ OPT_PATCH_NAMES, - /* 0x0b1 */ OPT_ORDER_BY, - /* 0x0b2 */ OPT_ORDER_ALL, - /* 0x0b3 */ OPT_NUMBER, - /* 0x0b4 */ OPT_SECTIONS, - /* 0x0b5 */ 0,0,0,0, 0,0,0,0, 0,0,0, + /* 0x084 */ OPT_MAX_WIDTH, + /* 0x085 */ OPT_DE, + /* 0x086 */ OPT_COLORS, + /* 0x087 */ OPT_NO_COLORS, + /* 0x088 */ OPT_CT_CODE, + /* 0x089 */ OPT_LE_CODE, + /* 0x08a */ OPT_CHDIR, + /* 0x08b */ OPT_ROUND, + /* 0x08c */ OPT_NO_ECHO, + /* 0x08d */ OPT_UTF_8, + /* 0x08e */ OPT_NO_UTF_8, + /* 0x08f */ OPT_LT_CLEAR, + /* 0x090 */ OPT_LT_ONLINE, + /* 0x091 */ OPT_LT_N_PLAYERS, + /* 0x092 */ OPT_LT_COND_BIT, + /* 0x093 */ OPT_LT_GAME_MODE, + /* 0x094 */ OPT_LT_ENGINE, + /* 0x095 */ OPT_LT_RANDOM, + /* 0x096 */ OPT_LEX_PURGE, + /* 0x097 */ OPT_LEX_RM_FEAT, + /* 0x098 */ OPT_FORCE, + /* 0x099 */ OPT_REPAIR_MAGICS, + /* 0x09a */ OPT_OLD, + /* 0x09b */ OPT_STD, + /* 0x09c */ OPT_NEW, + /* 0x09d */ OPT_EXTRACT, + /* 0x09e */ OPT_LE_DEFINE, + /* 0x09f */ OPT_LPAR, + /* 0x0a0 */ OPT_ALIAS, + /* 0x0a1 */ OPT_ENGINE, + /* 0x0a2 */ OPT_200CC, + /* 0x0a3 */ OPT_PERFMON, + /* 0x0a4 */ OPT_CUSTOM_TT, + /* 0x0a5 */ OPT_XPFLAGS, + /* 0x0a6 */ OPT_SPEEDOMETER, + /* 0x0a7 */ OPT_RESERVED_1B9, + /* 0x0a8 */ OPT_RESERVED_1BA, + /* 0x0a9 */ OPT_RESERVED_1BB, + /* 0x0aa */ OPT_TRACK_DIR, + /* 0x0ab */ OPT_COPY_TRACKS, + /* 0x0ac */ OPT_MOVE_TRACKS, + /* 0x0ad */ OPT_MOVE1_TRACKS, + /* 0x0ae */ OPT_LINK_TRACKS, + /* 0x0af */ OPT_LOAD_BMG, + /* 0x0b0 */ OPT_PATCH_BMG, + /* 0x0b1 */ OPT_MACRO_BMG, + /* 0x0b2 */ OPT_PATCH_NAMES, + /* 0x0b3 */ OPT_ORDER_BY, + /* 0x0b4 */ OPT_ORDER_ALL, + /* 0x0b5 */ OPT_NUMBER, + /* 0x0b6 */ OPT_SECTIONS, + /* 0x0b7 */ 0,0,0,0, 0,0,0,0, 0, /* 0x0c0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x0d0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x0e0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x0f0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x100 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x110 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, - /* 0x120 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, + /* 0x120 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, + /* 0x130 */ 0,0,0,0, 0,0, }; // @@ -1129,6 +1151,7 @@ static const InfoOption_t * option_tab_tool[] = OptionInfo + OPT_ALLOW_ALL, OptionInfo + OPT_COMPATIBLE, OptionInfo + OPT_WIDTH, + OptionInfo + OPT_MAX_WIDTH, OptionInfo + OPT_QUIET, OptionInfo + OPT_VERBOSE, OptionInfo + OPT_LOGGING, @@ -1170,6 +1193,7 @@ static const InfoOption_t * option_tab_cmd_VERSION[] = static const InfoOption_t * option_tab_cmd_HELP[] = { OptionInfo + OPT_WIDTH, + OptionInfo + OPT_MAX_WIDTH, 0 }; @@ -1508,7 +1532,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "wlect [option]... command [option|parameter|file]...", "Wiimms LE-CODE Tool : Manage the LE-CODE and LEX extensions.", 0, - 25, + 26, option_tab_tool, 0 }, @@ -1546,7 +1570,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " The third variant (with a valid command name) prints details about" " the declared command. The fourth variant prints an overview about" " all commands and all global options.", - 1, + 2, option_tab_cmd_HELP, option_allowed_cmd_HELP }, diff --git a/project/src/ui/ui-wlect.h b/project/src/ui/ui-wlect.h index a170a51..f6a6d1e 100644 --- a/project/src/ui/ui-wlect.h +++ b/project/src/ui/ui-wlect.h @@ -16,7 +16,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -111,6 +111,7 @@ typedef enum enumOptions OPT_ALLOW_ALL, OPT_COMPATIBLE, OPT_WIDTH, + OPT_MAX_WIDTH, OPT_QUIET, OPT_VERBOSE, OPT_LOGGING, @@ -129,6 +130,7 @@ typedef enum enumOptions OPT_LT_ENGINE, OPT_LT_RANDOM, OPT_LEX_PURGE, + OPT_LEX_RM_FEAT, OPT_TEST, OPT_FORCE, OPT_REPAIR_MAGICS, @@ -137,7 +139,7 @@ typedef enum enumOptions OPT_NEW, OPT_EXTRACT, - OPT__N_TOTAL // == 76 + OPT__N_TOTAL // == 78 } enumOptions; @@ -394,6 +396,7 @@ typedef enum enumGetOpt GO_ALLOW_ALL, GO_COMPATIBLE, GO_WIDTH, + GO_MAX_WIDTH, GO_DE, GO_COLORS, GO_NO_COLORS, @@ -412,6 +415,7 @@ typedef enum enumGetOpt GO_LT_ENGINE, GO_LT_RANDOM, GO_LEX_PURGE, + GO_LEX_RM_FEAT, GO_FORCE, GO_REPAIR_MAGICS, GO_OLD, @@ -457,7 +461,7 @@ typedef enum enumGetOpt //extern const struct option OptionLong[]; //extern u8 OptionUsed[OPT__N_TOTAL+1]; //extern const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE]; -//UIOPT_INDEX_SIZE := 0x12c = 300 +//UIOPT_INDEX_SIZE := 0x136 = 310 //extern const InfoCommand_t CommandInfo[CMD__N+1]; extern const InfoUI_t InfoUI_wlect; diff --git a/project/src/ui/ui-wmdlt.c b/project/src/ui/ui-wmdlt.c index 15be6fc..ed922c2 100644 --- a/project/src/ui/ui-wmdlt.c +++ b/project/src/ui/ui-wmdlt.c @@ -16,7 +16,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -359,6 +359,13 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " messages and disable the automatic detection of the terminal width." }, + { OPT_MAX_WIDTH, false, false, false, true, false, 0, "max-width", + "maxwidth", + "Define the maximum terminal width (number of columns) for help and" + " some other messages and disable the automatic detection of the" + " terminal width. This option is ignored if --width is set." + }, + { OPT_QUIET, false, false, false, false, false, 'q', "quiet", 0, "Be quiet and print only error messages. Multiple usage is possible." @@ -546,7 +553,7 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " helper option." }, - {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 63 + {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 64 }; @@ -700,6 +707,8 @@ static const struct option OptionLong[] = { "allowall", 0, 0, GO_ALLOW_ALL }, { "compatible", 1, 0, GO_COMPATIBLE }, { "width", 1, 0, GO_WIDTH }, + { "max-width", 1, 0, GO_MAX_WIDTH }, + { "maxwidth", 1, 0, GO_MAX_WIDTH }, { "quiet", 0, 0, 'q' }, { "verbose", 0, 0, 'v' }, { "logging", 0, 0, 'L' }, @@ -832,42 +841,43 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x081 */ OPT_ALLOW_ALL, /* 0x082 */ OPT_COMPATIBLE, /* 0x083 */ OPT_WIDTH, - /* 0x084 */ OPT_DE, - /* 0x085 */ OPT_COLORS, - /* 0x086 */ OPT_NO_COLORS, - /* 0x087 */ OPT_CT_CODE, - /* 0x088 */ OPT_LE_CODE, - /* 0x089 */ OPT_CHDIR, - /* 0x08a */ OPT_MDL, - /* 0x08b */ OPT_SCALE, - /* 0x08c */ OPT_SHIFT, - /* 0x08d */ OPT_XSS, - /* 0x08e */ OPT_YSS, - /* 0x08f */ OPT_ZSS, - /* 0x090 */ OPT_ROT, - /* 0x091 */ OPT_XROT, - /* 0x092 */ OPT_YROT, - /* 0x093 */ OPT_ZROT, - /* 0x094 */ OPT_TRANSLATE, - /* 0x095 */ OPT_NULL, - /* 0x096 */ OPT_NEXT, - /* 0x097 */ OPT_ASCALE, - /* 0x098 */ OPT_AROT, - /* 0x099 */ OPT_TFORM_SCRIPT, - /* 0x09a */ OPT_ROUND, - /* 0x09b */ OPT_NO_ECHO, - /* 0x09c */ OPT_UTF_8, - /* 0x09d */ OPT_NO_UTF_8, - /* 0x09e */ OPT_FORCE, - /* 0x09f */ OPT_REPAIR_MAGICS, - /* 0x0a0 */ OPT_TINY, - /* 0x0a1 */ OPT_OLD, - /* 0x0a2 */ OPT_STD, - /* 0x0a3 */ OPT_NEW, - /* 0x0a4 */ OPT_EXTRACT, - /* 0x0a5 */ OPT_NUMBER, - /* 0x0a6 */ OPT_SECTIONS, - /* 0x0a7 */ 0,0,0,0, 0,0,0,0, 0, + /* 0x084 */ OPT_MAX_WIDTH, + /* 0x085 */ OPT_DE, + /* 0x086 */ OPT_COLORS, + /* 0x087 */ OPT_NO_COLORS, + /* 0x088 */ OPT_CT_CODE, + /* 0x089 */ OPT_LE_CODE, + /* 0x08a */ OPT_CHDIR, + /* 0x08b */ OPT_MDL, + /* 0x08c */ OPT_SCALE, + /* 0x08d */ OPT_SHIFT, + /* 0x08e */ OPT_XSS, + /* 0x08f */ OPT_YSS, + /* 0x090 */ OPT_ZSS, + /* 0x091 */ OPT_ROT, + /* 0x092 */ OPT_XROT, + /* 0x093 */ OPT_YROT, + /* 0x094 */ OPT_ZROT, + /* 0x095 */ OPT_TRANSLATE, + /* 0x096 */ OPT_NULL, + /* 0x097 */ OPT_NEXT, + /* 0x098 */ OPT_ASCALE, + /* 0x099 */ OPT_AROT, + /* 0x09a */ OPT_TFORM_SCRIPT, + /* 0x09b */ OPT_ROUND, + /* 0x09c */ OPT_NO_ECHO, + /* 0x09d */ OPT_UTF_8, + /* 0x09e */ OPT_NO_UTF_8, + /* 0x09f */ OPT_FORCE, + /* 0x0a0 */ OPT_REPAIR_MAGICS, + /* 0x0a1 */ OPT_TINY, + /* 0x0a2 */ OPT_OLD, + /* 0x0a3 */ OPT_STD, + /* 0x0a4 */ OPT_NEW, + /* 0x0a5 */ OPT_EXTRACT, + /* 0x0a6 */ OPT_NUMBER, + /* 0x0a7 */ OPT_SECTIONS, + /* 0x0a8 */ 0,0,0,0, 0,0,0,0, /* 0x0b0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x0c0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x0d0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, @@ -875,7 +885,8 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x0f0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x100 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x110 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, - /* 0x120 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, + /* 0x120 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, + /* 0x130 */ 0,0,0,0, 0,0, }; // @@ -1017,6 +1028,7 @@ static const InfoOption_t * option_tab_tool[] = OptionInfo + OPT_ALLOW_ALL, OptionInfo + OPT_COMPATIBLE, OptionInfo + OPT_WIDTH, + OptionInfo + OPT_MAX_WIDTH, OptionInfo + OPT_QUIET, OptionInfo + OPT_VERBOSE, OptionInfo + OPT_LOGGING, @@ -1052,6 +1064,7 @@ static const InfoOption_t * option_tab_cmd_VERSION[] = static const InfoOption_t * option_tab_cmd_HELP[] = { OptionInfo + OPT_WIDTH, + OptionInfo + OPT_MAX_WIDTH, 0 }; @@ -1385,7 +1398,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "wmdlt [option]... command [option|parameter|file]...", "Wiimms MDL Tool : Decode raw MDL and encode text MDL files.", 0, - 22, + 23, option_tab_tool, 0 }, @@ -1423,7 +1436,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " The third variant (with a valid command name) prints details about" " the declared command. The fourth variant prints an overview about" " all commands and all global options.", - 1, + 2, option_tab_cmd_HELP, option_allowed_cmd_HELP }, diff --git a/project/src/ui/ui-wmdlt.h b/project/src/ui/ui-wmdlt.h index 7bca204..5eda1ff 100644 --- a/project/src/ui/ui-wmdlt.h +++ b/project/src/ui/ui-wmdlt.h @@ -16,7 +16,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -99,6 +99,7 @@ typedef enum enumOptions OPT_ALLOW_ALL, OPT_COMPATIBLE, OPT_WIDTH, + OPT_MAX_WIDTH, OPT_QUIET, OPT_VERBOSE, OPT_LOGGING, @@ -124,7 +125,7 @@ typedef enum enumOptions OPT_NEW, OPT_EXTRACT, - OPT__N_TOTAL // == 63 + OPT__N_TOTAL // == 64 } enumOptions; @@ -355,6 +356,7 @@ typedef enum enumGetOpt GO_ALLOW_ALL, GO_COMPATIBLE, GO_WIDTH, + GO_MAX_WIDTH, GO_DE, GO_COLORS, GO_NO_COLORS, @@ -404,7 +406,7 @@ typedef enum enumGetOpt //extern const struct option OptionLong[]; //extern u8 OptionUsed[OPT__N_TOTAL+1]; //extern const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE]; -//UIOPT_INDEX_SIZE := 0x12c = 300 +//UIOPT_INDEX_SIZE := 0x136 = 310 //extern const InfoCommand_t CommandInfo[CMD__N+1]; extern const InfoUI_t InfoUI_wmdlt; diff --git a/project/src/ui/ui-wpatt.c b/project/src/ui/ui-wpatt.c index 4d27f28..8078f4e 100644 --- a/project/src/ui/ui-wpatt.c +++ b/project/src/ui/ui-wpatt.c @@ -16,7 +16,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -201,6 +201,13 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " messages and disable the automatic detection of the terminal width." }, + { OPT_MAX_WIDTH, false, false, false, true, false, 0, "max-width", + "maxwidth", + "Define the maximum terminal width (number of columns) for help and" + " some other messages and disable the automatic detection of the" + " terminal width. This option is ignored if --width is set." + }, + { OPT_QUIET, false, false, false, false, false, 'q', "quiet", 0, "Be quiet and print only error messages. Multiple usage is possible." @@ -377,7 +384,7 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " helper option." }, - {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 47 + {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 48 }; @@ -497,6 +504,8 @@ static const struct option OptionLong[] = { "allowall", 0, 0, GO_ALLOW_ALL }, { "compatible", 1, 0, GO_COMPATIBLE }, { "width", 1, 0, GO_WIDTH }, + { "max-width", 1, 0, GO_MAX_WIDTH }, + { "maxwidth", 1, 0, GO_MAX_WIDTH }, { "quiet", 0, 0, 'q' }, { "verbose", 0, 0, 'v' }, { "logging", 0, 0, 'L' }, @@ -611,26 +620,27 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x081 */ OPT_ALLOW_ALL, /* 0x082 */ OPT_COMPATIBLE, /* 0x083 */ OPT_WIDTH, - /* 0x084 */ OPT_DE, - /* 0x085 */ OPT_COLORS, - /* 0x086 */ OPT_NO_COLORS, - /* 0x087 */ OPT_CT_CODE, - /* 0x088 */ OPT_LE_CODE, - /* 0x089 */ OPT_CHDIR, - /* 0x08a */ OPT_ROUND, - /* 0x08b */ OPT_NO_ECHO, - /* 0x08c */ OPT_PAT, - /* 0x08d */ OPT_UTF_8, - /* 0x08e */ OPT_NO_UTF_8, - /* 0x08f */ OPT_FORCE, - /* 0x090 */ OPT_REPAIR_MAGICS, - /* 0x091 */ OPT_OLD, - /* 0x092 */ OPT_STD, - /* 0x093 */ OPT_NEW, - /* 0x094 */ OPT_EXTRACT, - /* 0x095 */ OPT_NUMBER, - /* 0x096 */ OPT_SECTIONS, - /* 0x097 */ 0,0,0,0, 0,0,0,0, 0, + /* 0x084 */ OPT_MAX_WIDTH, + /* 0x085 */ OPT_DE, + /* 0x086 */ OPT_COLORS, + /* 0x087 */ OPT_NO_COLORS, + /* 0x088 */ OPT_CT_CODE, + /* 0x089 */ OPT_LE_CODE, + /* 0x08a */ OPT_CHDIR, + /* 0x08b */ OPT_ROUND, + /* 0x08c */ OPT_NO_ECHO, + /* 0x08d */ OPT_PAT, + /* 0x08e */ OPT_UTF_8, + /* 0x08f */ OPT_NO_UTF_8, + /* 0x090 */ OPT_FORCE, + /* 0x091 */ OPT_REPAIR_MAGICS, + /* 0x092 */ OPT_OLD, + /* 0x093 */ OPT_STD, + /* 0x094 */ OPT_NEW, + /* 0x095 */ OPT_EXTRACT, + /* 0x096 */ OPT_NUMBER, + /* 0x097 */ OPT_SECTIONS, + /* 0x098 */ 0,0,0,0, 0,0,0,0, /* 0x0a0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x0b0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x0c0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, @@ -639,7 +649,8 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x0f0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x100 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x110 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, - /* 0x120 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, + /* 0x120 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, + /* 0x130 */ 0,0,0,0, 0,0, }; // @@ -741,6 +752,7 @@ static const InfoOption_t * option_tab_tool[] = OptionInfo + OPT_ALLOW_ALL, OptionInfo + OPT_COMPATIBLE, OptionInfo + OPT_WIDTH, + OptionInfo + OPT_MAX_WIDTH, OptionInfo + OPT_QUIET, OptionInfo + OPT_VERBOSE, OptionInfo + OPT_LOGGING, @@ -775,6 +787,7 @@ static const InfoOption_t * option_tab_cmd_VERSION[] = static const InfoOption_t * option_tab_cmd_HELP[] = { OptionInfo + OPT_WIDTH, + OptionInfo + OPT_MAX_WIDTH, 0 }; @@ -934,7 +947,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "wpatt [option]... command [option|parameter|file]...", "Wiimms PAT Tool : Decode raw PAT and encode text PAT files.", 0, - 21, + 22, option_tab_tool, 0 }, @@ -972,7 +985,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " The third variant (with a valid command name) prints details about" " the declared command. The fourth variant prints an overview about" " all commands and all global options.", - 1, + 2, option_tab_cmd_HELP, option_allowed_cmd_HELP }, diff --git a/project/src/ui/ui-wpatt.h b/project/src/ui/ui-wpatt.h index 89befd5..59b7c5f 100644 --- a/project/src/ui/ui-wpatt.h +++ b/project/src/ui/ui-wpatt.h @@ -16,7 +16,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -84,6 +84,7 @@ typedef enum enumOptions OPT_ALLOW_ALL, OPT_COMPATIBLE, OPT_WIDTH, + OPT_MAX_WIDTH, OPT_QUIET, OPT_VERBOSE, OPT_LOGGING, @@ -108,7 +109,7 @@ typedef enum enumOptions OPT_NEW, OPT_EXTRACT, - OPT__N_TOTAL // == 47 + OPT__N_TOTAL // == 48 } enumOptions; @@ -278,6 +279,7 @@ typedef enum enumGetOpt GO_ALLOW_ALL, GO_COMPATIBLE, GO_WIDTH, + GO_MAX_WIDTH, GO_DE, GO_COLORS, GO_NO_COLORS, @@ -311,7 +313,7 @@ typedef enum enumGetOpt //extern const struct option OptionLong[]; //extern u8 OptionUsed[OPT__N_TOTAL+1]; //extern const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE]; -//UIOPT_INDEX_SIZE := 0x12c = 300 +//UIOPT_INDEX_SIZE := 0x136 = 310 //extern const InfoCommand_t CommandInfo[CMD__N+1]; extern const InfoUI_t InfoUI_wpatt; diff --git a/project/src/ui/ui-wstrt.c b/project/src/ui/ui-wstrt.c index 1f4f80b..3796b3b 100644 --- a/project/src/ui/ui-wstrt.c +++ b/project/src/ui/ui-wstrt.c @@ -16,7 +16,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -508,6 +508,13 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " messages and disable the automatic detection of the terminal width." }, + { OPT_MAX_WIDTH, false, false, false, true, false, 0, "max-width", + "maxwidth", + "Define the maximum terminal width (number of columns) for help and" + " some other messages and disable the automatic detection of the" + " terminal width. This option is ignored if --width is set." + }, + { OPT_QUIET, false, false, false, false, false, 'q', "quiet", 0, "Be quiet and print only error messages. Multiple usage is possible." @@ -833,7 +840,7 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " directory." }, - {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 111 + {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 112 }; @@ -1001,6 +1008,8 @@ static const struct option OptionLong[] = { "allowall", 0, 0, GO_ALLOW_ALL }, { "compatible", 1, 0, GO_COMPATIBLE }, { "width", 1, 0, GO_WIDTH }, + { "max-width", 1, 0, GO_MAX_WIDTH }, + { "maxwidth", 1, 0, GO_MAX_WIDTH }, { "quiet", 0, 0, 'q' }, { "verbose", 0, 0, 'v' }, { "logging", 0, 0, 'L' }, @@ -1206,96 +1215,98 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x081 */ OPT_ALLOW_ALL, /* 0x082 */ OPT_COMPATIBLE, /* 0x083 */ OPT_WIDTH, - /* 0x084 */ OPT_DE, - /* 0x085 */ OPT_COLORS, - /* 0x086 */ OPT_NO_COLORS, - /* 0x087 */ OPT_CT_CODE, - /* 0x088 */ OPT_LE_CODE, - /* 0x089 */ OPT_CHDIR, - /* 0x08a */ OPT_VS_REGION, - /* 0x08b */ OPT_BT_REGION, - /* 0x08c */ OPT_ALL_RANKS, - /* 0x08d */ OPT_POINTS, - /* 0x08e */ OPT_CHEAT, - /* 0x08f */ OPT_HTTPS, - /* 0x090 */ OPT_DOMAIN, - /* 0x091 */ OPT_WIIMMFI, - /* 0x092 */ OPT_TWIIMMFI, - /* 0x093 */ OPT_WC24, - /* 0x094 */ OPT_WCODE, - /* 0x095 */ OPT_ADD_WCODE, - /* 0x096 */ OPT_PB_MODE, - /* 0x097 */ OPT_PATCHED_BY, - /* 0x098 */ OPT_VS, - /* 0x099 */ OPT_VS2, - /* 0x09a */ OPT_BT, - /* 0x09b */ OPT_BT2, - /* 0x09c */ OPT_CANNON, - /* 0x09d */ OPT_MENO, - /* 0x09e */ OPT_UTF_8, - /* 0x09f */ OPT_NO_UTF_8, - /* 0x0a0 */ OPT_FORCE, - /* 0x0a1 */ OPT_REPAIR_MAGICS, - /* 0x0a2 */ OPT_OLD, - /* 0x0a3 */ OPT_STD, - /* 0x0a4 */ OPT_NEW, - /* 0x0a5 */ OPT_EXTRACT, - /* 0x0a6 */ OPT_NUMBER, - /* 0x0a7 */ OPT_CLEAN_DOL, - /* 0x0a8 */ OPT_ADD_LECODE, - /* 0x0a9 */ OPT_ADD_CTCODE, - /* 0x0aa */ OPT_CT_DIR, - /* 0x0ab */ OPT_MOVE_D8, - /* 0x0ac */ OPT_ADD_SECTION, - /* 0x0ad */ OPT_FULL_GCH, - /* 0x0ae */ OPT_GCT_NO_SEP, - /* 0x0af */ OPT_GCT_SEP, - /* 0x0b0 */ OPT_GCT_ASM_SEP, - /* 0x0b1 */ OPT_GCT_LIST, - /* 0x0b2 */ OPT_GCT_MOVE, - /* 0x0b3 */ OPT_GCT_ADDR, - /* 0x0b4 */ OPT_GCT_SPACE, - /* 0x0b5 */ OPT_ALLOW_USER_GCH, - /* 0x0b6 */ OPT_CREATE_SECT, - /* 0x0b7 */ OPT_WPF, - /* 0x0b8 */ OPT_SECTIONS, - /* 0x0b9 */ OPT_VADDR, - /* 0x0ba */ OPT_FADDR, - /* 0x0bb */ OPT_SNAME, - /* 0x0bc */ OPT_INT1, - /* 0x0bd */ OPT_INT2, - /* 0x0be */ OPT_INT3, - /* 0x0bf */ OPT_INT4, - /* 0x0c0 */ OPT_INT5, - /* 0x0c1 */ OPT_INT6, - /* 0x0c2 */ OPT_INT7, - /* 0x0c3 */ OPT_INT8, - /* 0x0c4 */ OPT_FLOAT, - /* 0x0c5 */ OPT_DOUBLE, - /* 0x0c6 */ OPT_LE, - /* 0x0c7 */ OPT_BE, - /* 0x0c8 */ OPT_ZEROS, - /* 0x0c9 */ OPT_HEX, - /* 0x0ca */ OPT_DEC, - /* 0x0cb */ OPT_C_SYNTAX, - /* 0x0cc */ OPT_ADDR, - /* 0x0cd */ OPT_ALIGN, - /* 0x0ce */ OPT_TRIGGER, - /* 0x0cf */ OPT_NO_ADDR, - /* 0x0d0 */ OPT_NO_NUMBERS, - /* 0x0d1 */ OPT_NO_TEXT, - /* 0x0d2 */ OPT_FORMAT, - /* 0x0d3 */ OPT_NO_NULL, - /* 0x0d4 */ OPT_NARROW, - /* 0x0d5 */ OPT_SMALL, - /* 0x0d6 */ OPT_WIDE, - /* 0x0d7 */ OPT_BYTES, - /* 0x0d8 */ 0,0,0,0, 0,0,0,0, + /* 0x084 */ OPT_MAX_WIDTH, + /* 0x085 */ OPT_DE, + /* 0x086 */ OPT_COLORS, + /* 0x087 */ OPT_NO_COLORS, + /* 0x088 */ OPT_CT_CODE, + /* 0x089 */ OPT_LE_CODE, + /* 0x08a */ OPT_CHDIR, + /* 0x08b */ OPT_VS_REGION, + /* 0x08c */ OPT_BT_REGION, + /* 0x08d */ OPT_ALL_RANKS, + /* 0x08e */ OPT_POINTS, + /* 0x08f */ OPT_CHEAT, + /* 0x090 */ OPT_HTTPS, + /* 0x091 */ OPT_DOMAIN, + /* 0x092 */ OPT_WIIMMFI, + /* 0x093 */ OPT_TWIIMMFI, + /* 0x094 */ OPT_WC24, + /* 0x095 */ OPT_WCODE, + /* 0x096 */ OPT_ADD_WCODE, + /* 0x097 */ OPT_PB_MODE, + /* 0x098 */ OPT_PATCHED_BY, + /* 0x099 */ OPT_VS, + /* 0x09a */ OPT_VS2, + /* 0x09b */ OPT_BT, + /* 0x09c */ OPT_BT2, + /* 0x09d */ OPT_CANNON, + /* 0x09e */ OPT_MENO, + /* 0x09f */ OPT_UTF_8, + /* 0x0a0 */ OPT_NO_UTF_8, + /* 0x0a1 */ OPT_FORCE, + /* 0x0a2 */ OPT_REPAIR_MAGICS, + /* 0x0a3 */ OPT_OLD, + /* 0x0a4 */ OPT_STD, + /* 0x0a5 */ OPT_NEW, + /* 0x0a6 */ OPT_EXTRACT, + /* 0x0a7 */ OPT_NUMBER, + /* 0x0a8 */ OPT_CLEAN_DOL, + /* 0x0a9 */ OPT_ADD_LECODE, + /* 0x0aa */ OPT_ADD_CTCODE, + /* 0x0ab */ OPT_CT_DIR, + /* 0x0ac */ OPT_MOVE_D8, + /* 0x0ad */ OPT_ADD_SECTION, + /* 0x0ae */ OPT_FULL_GCH, + /* 0x0af */ OPT_GCT_NO_SEP, + /* 0x0b0 */ OPT_GCT_SEP, + /* 0x0b1 */ OPT_GCT_ASM_SEP, + /* 0x0b2 */ OPT_GCT_LIST, + /* 0x0b3 */ OPT_GCT_MOVE, + /* 0x0b4 */ OPT_GCT_ADDR, + /* 0x0b5 */ OPT_GCT_SPACE, + /* 0x0b6 */ OPT_ALLOW_USER_GCH, + /* 0x0b7 */ OPT_CREATE_SECT, + /* 0x0b8 */ OPT_WPF, + /* 0x0b9 */ OPT_SECTIONS, + /* 0x0ba */ OPT_VADDR, + /* 0x0bb */ OPT_FADDR, + /* 0x0bc */ OPT_SNAME, + /* 0x0bd */ OPT_INT1, + /* 0x0be */ OPT_INT2, + /* 0x0bf */ OPT_INT3, + /* 0x0c0 */ OPT_INT4, + /* 0x0c1 */ OPT_INT5, + /* 0x0c2 */ OPT_INT6, + /* 0x0c3 */ OPT_INT7, + /* 0x0c4 */ OPT_INT8, + /* 0x0c5 */ OPT_FLOAT, + /* 0x0c6 */ OPT_DOUBLE, + /* 0x0c7 */ OPT_LE, + /* 0x0c8 */ OPT_BE, + /* 0x0c9 */ OPT_ZEROS, + /* 0x0ca */ OPT_HEX, + /* 0x0cb */ OPT_DEC, + /* 0x0cc */ OPT_C_SYNTAX, + /* 0x0cd */ OPT_ADDR, + /* 0x0ce */ OPT_ALIGN, + /* 0x0cf */ OPT_TRIGGER, + /* 0x0d0 */ OPT_NO_ADDR, + /* 0x0d1 */ OPT_NO_NUMBERS, + /* 0x0d2 */ OPT_NO_TEXT, + /* 0x0d3 */ OPT_FORMAT, + /* 0x0d4 */ OPT_NO_NULL, + /* 0x0d5 */ OPT_NARROW, + /* 0x0d6 */ OPT_SMALL, + /* 0x0d7 */ OPT_WIDE, + /* 0x0d8 */ OPT_BYTES, + /* 0x0d9 */ 0,0,0,0, 0,0,0, /* 0x0e0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x0f0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x100 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x110 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, - /* 0x120 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, + /* 0x120 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, + /* 0x130 */ 0,0,0,0, 0,0, }; // @@ -1464,6 +1475,7 @@ static const InfoOption_t * option_tab_tool[] = OptionInfo + OPT_ALLOW_ALL, OptionInfo + OPT_COMPATIBLE, OptionInfo + OPT_WIDTH, + OptionInfo + OPT_MAX_WIDTH, OptionInfo + OPT_QUIET, OptionInfo + OPT_VERBOSE, OptionInfo + OPT_LOGGING, @@ -1517,6 +1529,7 @@ static const InfoOption_t * option_tab_cmd_VERSION[] = static const InfoOption_t * option_tab_cmd_HELP[] = { OptionInfo + OPT_WIDTH, + OptionInfo + OPT_MAX_WIDTH, 0 }; @@ -1837,7 +1850,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "Wiimms StaticR Tool : Manipulate the 'main.dol' and 'StaticR.rel'" " files of Mario Kart Wii.", 0, - 37, + 38, option_tab_tool, 0 }, @@ -1875,7 +1888,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " The third variant (with a valid command name) prints details about" " the declared command. The fourth variant prints an overview about" " all commands and all global options.", - 1, + 2, option_tab_cmd_HELP, option_allowed_cmd_HELP }, diff --git a/project/src/ui/ui-wstrt.h b/project/src/ui/ui-wstrt.h index e1a2f2b..21a3b74 100644 --- a/project/src/ui/ui-wstrt.h +++ b/project/src/ui/ui-wstrt.h @@ -16,7 +16,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -129,6 +129,7 @@ typedef enum enumOptions OPT_ALLOW_ALL, OPT_COMPATIBLE, OPT_WIDTH, + OPT_MAX_WIDTH, OPT_QUIET, OPT_VERBOSE, OPT_LOGGING, @@ -172,7 +173,7 @@ typedef enum enumOptions OPT_CLEAN_DOL, OPT_CT_DIR, - OPT__N_TOTAL // == 111 + OPT__N_TOTAL // == 112 } enumOptions; @@ -449,6 +450,7 @@ typedef enum enumGetOpt GO_ALLOW_ALL, GO_COMPATIBLE, GO_WIDTH, + GO_MAX_WIDTH, GO_DE, GO_COLORS, GO_NO_COLORS, @@ -547,7 +549,7 @@ typedef enum enumGetOpt //extern const struct option OptionLong[]; //extern u8 OptionUsed[OPT__N_TOTAL+1]; //extern const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE]; -//UIOPT_INDEX_SIZE := 0x12c = 300 +//UIOPT_INDEX_SIZE := 0x136 = 310 //extern const InfoCommand_t CommandInfo[CMD__N+1]; extern const InfoUI_t InfoUI_wstrt; diff --git a/project/src/ui/ui-wszst.c b/project/src/ui/ui-wszst.c index d5f36b5..b35a60c 100644 --- a/project/src/ui/ui-wszst.c +++ b/project/src/ui/ui-wszst.c @@ -16,7 +16,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -670,6 +670,25 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " formats." }, + { OPT_PMODES, false, true, false, false, false, 0, "pmodes", + 0, + "--pmodes is an abbreviation for --print-mode. If set, a" + " comma-separated list of letters is added to the end of each feature." + " The letters used are: S (section), V (visual), B (battle), R" + " (racing), T (time trial), L (local=offline) and O (online)." + }, + + { OPT_FMODES, false, true, false, false, false, 0, "fmodes", + "list", + "--fmodes is an abbreviation for --feature-modes and declares an" + " output filter. LIST is a keyword list. The keywords are: SECTION," + " VISUAL, GAMEPLAY, BATTLE, RACING, TIMETRIAL, OFFLINE and ONLINE. A" + " feature is only printed if *all* set keywords match.\n" + " Each keyword can also be used with a minus as prefix to define a" + " second condition. In this case the feature is excluded from printing" + " if *any* set keywords match." + }, + { OPT_ANALYZE, false, true, false, false, true, 0, "analyze", "outfile", "Run in analyze mode and write results to the entered file." @@ -1103,7 +1122,7 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = "Print in machine readable sections and parameter lines." }, - {0,0,0,0,0,0,0,0,0,0}, // OPT__N_SPECIFIC == 131 + {0,0,0,0,0,0,0,0,0,0}, // OPT__N_SPECIFIC == 133 //----- global options ----- @@ -1147,6 +1166,13 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " messages and disable the automatic detection of the terminal width." }, + { OPT_MAX_WIDTH, false, false, false, true, false, 0, "max-width", + "maxwidth", + "Define the maximum terminal width (number of columns) for help and" + " some other messages and disable the automatic detection of the" + " terminal width. This option is ignored if --width is set." + }, + { OPT_QUIET, false, false, false, false, false, 'q', "quiet", 0, "Be quiet and print only error messages. Multiple usage is possible." @@ -1279,8 +1305,8 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " the octree creation. The other allowed keywords are: FAST, NEW," " CENTER, ROUND, NORMALS, MTL, WIIMM, TRIANGLES, OUT-SWAP, G, USEMTL," " CLIP, IN-SWAP, AUTO, HEX4, HEX23, HEX, DROP-UNUSED, DROP-FIXED," - " DROP-INVALID, DROP, RM-FACEDOWN, RM-FACEUP, FIX-ALL, CONV-FACEUP," - " WEAK-WALLS, SORT, INPLACE, SILENT and LOG. See" + " DROP-INVALID, DROP, RM-FACEDOWN, RM-FACEUP, FIX-ALL, TINY-0 ..." + " TINY-7, CONV-FACEUP, WEAK-WALLS, SORT, INPLACE, SILENT and LOG. See" " https://szs.wiimm.de/opt/kcl for details." }, @@ -1324,7 +1350,7 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " WIDE, NARROW, FIX-CKPH, FIX-ENPH, FIX-ITPH, FIX-PH, FIX-CKNEXT," " FIX-CKJGPT, FIX-CK, FIX-ALL, MASK-PFLAGS, RM-LECODE, PURGE-GOBJ," " FULL-DEFOBJ, DUMP-CLASS, DUMP-ONEWAY, DUMP-ALL, 1LAP ... 9LAPS," - " MAX-LAPS, RM-EMPTY, INPLACE, SILENT and LOG. See" + " MAX-LAPS, RM-EMPTY, TINY-0 ... TINY-7, INPLACE, SILENT and LOG. See" " https://szs.wiimm.de/opt/kmp for details." }, @@ -1488,7 +1514,24 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = 0, "Delete LEX sections without any impact. Delete sub-file course.lex if" " it no longer contains a section. This option is executed after all" - " --lt-* options." + " --lt-* and --lex-* options." + }, + + { OPT_LEX_FEATURES, false, true, false, false, false, 0, "lex-features", + 0, + "Calculate LEX setion FEA0 (features) by analysing the track file. If" + " no features found, delete the section and the possibly empty" + " sub-file course.lex. If features found, then insert the section or" + " update an existing section. If necessary, the sub-file course.lex is" + " created. This option is executed after all --lt-* options and after" + " --lex-purge." + }, + + { OPT_LEX_RM_FEAT, false, true, false, false, false, 0, "lex-rm-features", + 0, + "Remove LEX setion FEA0 (features) if exists and the possibly empty" + " sub-file course.lex. This option is ignored if --lex-features is" + " set. It is executed after all --lt-* options and after --lex-purge." }, { OPT_CACHE, false, false, false, false, false, 0, "cache", @@ -1664,6 +1707,13 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = "Shortcut for: '--array --var name'" }, + { OPT_CASE, false, false, false, false, false, 0, "case", + "case", + "CASE is one of LOWER, AUTO (default) or UPPER.If LOWER or UPPER are" + " set, then the lower/upper case of the variable names is adjusted" + " accordingly." + }, + { OPT_OLD, false, true, false, false, false, 0, "OLD", 0, "Developer option: Cancel --NEW and use old implementation if" @@ -1689,7 +1739,7 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " helper option." }, - {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 201 + {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 207 }; @@ -1972,6 +2022,25 @@ static const InfoOption_t option_cmd_ANALYZE_QUIET = "Suppress logging of input and output files." }; +static const InfoOption_t option_cmd_FEATURES_BRIEF = + { OPT_BRIEF, false, false, false, false, false, 'B', "brief", + 0, + "Suppres any comments at all. If set twice, suppress empty lines (for" + " grouping) too. If set three times, omit inactive features (=0) too." + }; + +static const InfoOption_t option_cmd_FEATURES_LONG = + { OPT_LONG, false, false, false, false, false, 'l', "long", + 0, + "Print additnal comments." + }; + +static const InfoOption_t option_cmd_FEATURES_QUIET = + { OPT_QUIET, false, false, false, false, false, 'q', "quiet", + 0, + "Suppress logging of input and output files." + }; + static const InfoOption_t option_cmd_DISTRIBUTION_SOURCE = { OPT_SOURCE, false, false, false, false, false, 's', "source", "path", @@ -2154,6 +2223,7 @@ static const KeywordTab_t CommandTab[] = { CMD_CODE, "_CODE", 0, 0 }, { CMD_RECODE, "_RECODE", 0, 0 }, { CMD_SUBFILE, "_SUBFILE", 0, 0 }, + { CMD_TESTNORM, "_NORM", 0, 0 }, { CMD_LIST, "LIST", "LS", 0 }, { CMD_LIST_L, "LIST-L", "LL", 0 }, { CMD_LIST_L, "LISTL", 0, 0 }, @@ -2180,6 +2250,7 @@ static const KeywordTab_t CommandTab[] = { CMD_SHA1, "SHA1", 0, 0 }, { CMD_ANALYZE, "ANALYZE", "ANA", 0 }, { CMD_ANALYZE, "ANALYSE", 0, 0 }, + { CMD_FEATURES, "FEATURES", 0, 0 }, { CMD_DISTRIBUTION, "DISTRIBUTION", "DIST", 0 }, { CMD_DIFF, "DIFF", "CMP", 0 }, { CMD_CHECK, "CHECK", 0, 0 }, @@ -2232,6 +2303,8 @@ static const struct option OptionLong[] = { "allowall", 0, 0, GO_ALLOW_ALL }, { "compatible", 1, 0, GO_COMPATIBLE }, { "width", 1, 0, GO_WIDTH }, + { "max-width", 1, 0, GO_MAX_WIDTH }, + { "maxwidth", 1, 0, GO_MAX_WIDTH }, { "quiet", 0, 0, 'q' }, { "verbose", 0, 0, 'v' }, { "logging", 0, 0, 'L' }, @@ -2351,6 +2424,10 @@ static const struct option OptionLong[] = { "ltrandom", 1, 0, GO_LT_RANDOM }, { "lex-purge", 0, 0, GO_LEX_PURGE }, { "lexpurge", 0, 0, GO_LEX_PURGE }, + { "lex-features", 0, 0, GO_LEX_FEATURES }, + { "lexfeatures", 0, 0, GO_LEX_FEATURES }, + { "lex-rm-features", 0, 0, GO_LEX_RM_FEAT }, + { "lexrmfeatures", 0, 0, GO_LEX_RM_FEAT }, { "load-bmg", 1, 0, GO_LOAD_BMG }, { "loadbmg", 1, 0, GO_LOAD_BMG }, { "patch-bmg", 1, 0, GO_PATCH_BMG }, @@ -2439,6 +2516,13 @@ static const struct option OptionLong[] = { "var", 1, 0, GO_VAR }, { "array", 0, 0, GO_ARRAY }, { "avar", 1, 0, GO_AVAR }, + { "case", 1, 0, GO_CASE }, + { "pmodes", 0, 0, GO_PMODES }, + { "print-modes", 0, 0, GO_PMODES }, + { "printmodes", 0, 0, GO_PMODES }, + { "fmodes", 1, 0, GO_FMODES }, + { "feature-modes", 1, 0, GO_FMODES }, + { "featuremodes", 1, 0, GO_FMODES }, { "analyze", 1, 0, GO_ANALYZE }, { "analyse", 1, 0, GO_ANALYZE }, { "analyze-mode", 1, 0, GO_ANALYZE_MODE }, @@ -2627,170 +2711,176 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x081 */ OPT_ALLOW_ALL, /* 0x082 */ OPT_COMPATIBLE, /* 0x083 */ OPT_WIDTH, - /* 0x084 */ OPT_DE, - /* 0x085 */ OPT_COLORS, - /* 0x086 */ OPT_NO_COLORS, - /* 0x087 */ OPT_CT_CODE, - /* 0x088 */ OPT_LE_CODE, - /* 0x089 */ OPT_CHDIR, - /* 0x08a */ OPT_TOUCH, - /* 0x08b */ OPT_AUTO, - /* 0x08c */ OPT_SET_FLAGS, - /* 0x08d */ OPT_SET_SCALE, - /* 0x08e */ OPT_SET_ROT, - /* 0x08f */ OPT_SET_X, - /* 0x090 */ OPT_SET_Y, - /* 0x091 */ OPT_SET_Z, - /* 0x092 */ OPT_XCENTER, - /* 0x093 */ OPT_YCENTER, - /* 0x094 */ OPT_ZCENTER, - /* 0x095 */ OPT_CENTER, - /* 0x096 */ OPT_SCALE, - /* 0x097 */ OPT_SHIFT, - /* 0x098 */ OPT_XSS, - /* 0x099 */ OPT_YSS, - /* 0x09a */ OPT_ZSS, - /* 0x09b */ OPT_ROT, - /* 0x09c */ OPT_XROT, - /* 0x09d */ OPT_YROT, - /* 0x09e */ OPT_ZROT, - /* 0x09f */ OPT_YPOS, - /* 0x0a0 */ OPT_TRANSLATE, - /* 0x0a1 */ OPT_NULL, - /* 0x0a2 */ OPT_NEXT, - /* 0x0a3 */ OPT_ASCALE, - /* 0x0a4 */ OPT_AROT, - /* 0x0a5 */ OPT_TFORM_SCRIPT, - /* 0x0a6 */ OPT_MINIMAP, - /* 0x0a7 */ OPT_RM_GOBJ, - /* 0x0a8 */ OPT_BATTLE, - /* 0x0a9 */ OPT_EXPORT_FLAGS, - /* 0x0aa */ OPT_ROUTE_OPTIONS, - /* 0x0ab */ OPT_WIM0, - /* 0x0ac */ OPT_SLOT, - /* 0x0ad */ OPT_LOAD_KCL, - /* 0x0ae */ OPT_KCL, - /* 0x0af */ OPT_KCL_FLAG, - /* 0x0b0 */ OPT_KCL_SCRIPT, - /* 0x0b1 */ OPT_TRI_AREA, - /* 0x0b2 */ OPT_TRI_HEIGHT, - /* 0x0b3 */ OPT_FLAG_FILE, - /* 0x0b4 */ OPT_XTRIDATA, - /* 0x0b5 */ OPT_KMP, - /* 0x0b6 */ OPT_SPEED_MOD, - /* 0x0b7 */ OPT_KTPT2, - /* 0x0b8 */ OPT_TFORM_KMP, - /* 0x0b9 */ OPT_REPAIR_XPF, - /* 0x0ba */ OPT_GAMEMODES, - /* 0x0bb */ OPT_MDL, - /* 0x0bc */ OPT_PAT, - /* 0x0bd */ OPT_PATCH_FILE, - /* 0x0be */ OPT_KMG_LIMIT, - /* 0x0bf */ OPT_KMG_COPY, - /* 0x0c0 */ OPT_LT_CLEAR, - /* 0x0c1 */ OPT_LT_ONLINE, - /* 0x0c2 */ OPT_LT_N_PLAYERS, - /* 0x0c3 */ OPT_LT_COND_BIT, - /* 0x0c4 */ OPT_LT_GAME_MODE, - /* 0x0c5 */ OPT_LT_ENGINE, - /* 0x0c6 */ OPT_LT_RANDOM, - /* 0x0c7 */ OPT_LEX_PURGE, - /* 0x0c8 */ OPT_LOAD_BMG, - /* 0x0c9 */ OPT_PATCH_BMG, - /* 0x0ca */ OPT_MACRO_BMG, - /* 0x0cb */ OPT_FILTER_BMG, - /* 0x0cc */ OPT_CACHE, - /* 0x0cd */ OPT_CNAME, - /* 0x0ce */ OPT_ID, - /* 0x0cf */ OPT_BASE64, - /* 0x0d0 */ OPT_DB64, - /* 0x0d1 */ OPT_CODING, - /* 0x0d2 */ OPT_VERIFY, - /* 0x0d3 */ OPT_ROUND, - /* 0x0d4 */ OPT_PIPE, - /* 0x0d5 */ OPT_DELTA, - /* 0x0d6 */ OPT_DIFF, - /* 0x0d7 */ OPT_EPSILON, - /* 0x0d8 */ OPT_BMG_ENDIAN, - /* 0x0d9 */ OPT_BMG_ENCODING, - /* 0x0da */ OPT_BMG_INF_SIZE, - /* 0x0db */ OPT_BMG_MID, - /* 0x0dc */ OPT_FORCE_ATTRIB, - /* 0x0dd */ OPT_DEF_ATTRIB, - /* 0x0de */ OPT_NO_ATTRIB, - /* 0x0df */ OPT_X_ESCAPES, - /* 0x0e0 */ OPT_OLD_ESCAPES, - /* 0x0e1 */ OPT_NO_BMG_COLORS, - /* 0x0e2 */ OPT_BMG_COLORS, - /* 0x0e3 */ OPT_NO_BMG_INLINE, - /* 0x0e4 */ OPT_AUTOADD_PATH, - /* 0x0e5 */ OPT_STRIP, - /* 0x0e6 */ OPT_UTF_8, - /* 0x0e7 */ OPT_NO_UTF_8, - /* 0x0e8 */ OPT_FORCE, - /* 0x0e9 */ OPT_REPAIR_MAGICS, - /* 0x0ea */ OPT_TINY, - /* 0x0eb */ OPT_YAZ0, - /* 0x0ec */ OPT_YAZ1, - /* 0x0ed */ OPT_XYZ, - /* 0x0ee */ OPT_BZ, - /* 0x0ef */ OPT_SH, - /* 0x0f0 */ OPT_BASH, - /* 0x0f1 */ OPT_JSON, - /* 0x0f2 */ OPT_PHP, - /* 0x0f3 */ OPT_MAKEDOC, - /* 0x0f4 */ OPT_VAR, - /* 0x0f5 */ OPT_ARRAY, - /* 0x0f6 */ OPT_AVAR, - /* 0x0f7 */ OPT_ANALYZE, - /* 0x0f8 */ OPT_ANALYZE_MODE, - /* 0x0f9 */ OPT_OLD, - /* 0x0fa */ OPT_STD, - /* 0x0fb */ OPT_NEW, - /* 0x0fc */ OPT_EXTRACT, - /* 0x0fd */ OPT_NUMBER, - /* 0x0fe */ OPT_REMOVE_SRC, - /* 0x0ff */ OPT_IGNORE_SETUP, - /* 0x100 */ OPT_PURGE, - /* 0x101 */ OPT_ALIGN_U8, - /* 0x102 */ OPT_ALIGN_PACK, - /* 0x103 */ OPT_ALIGN_BRRES, - /* 0x104 */ OPT_ALIGN_BREFF, - /* 0x105 */ OPT_ALIGN_BREFT, - /* 0x106 */ OPT_ALIGN, - /* 0x107 */ OPT_ENCODE_ALL, - /* 0x108 */ OPT_ENCODE_IMG, - /* 0x109 */ OPT_NO_ENCODE, - /* 0x10a */ OPT_NO_RECURSE, - /* 0x10b */ OPT_AUTO_ADD, - /* 0x10c */ OPT_NO_ECHO, - /* 0x10d */ OPT_PT_DIR, - /* 0x10e */ OPT_RM_AIPARAM, - /* 0x10f */ OPT_U8, - /* 0x110 */ OPT_SZS, - /* 0x111 */ OPT_WU8, - /* 0x112 */ OPT_XWU8, - /* 0x113 */ OPT_WBZ, - /* 0x114 */ OPT_PACK, - /* 0x115 */ OPT_BRRES, - /* 0x116 */ OPT_BREFF, - /* 0x117 */ OPT_BREFT, - /* 0x118 */ OPT_NO_COMPRESS, - /* 0x119 */ OPT_FAST, - /* 0x11a */ OPT_LINKS, - /* 0x11b */ OPT_BASEDIR, - /* 0x11c */ OPT_DECODE, - /* 0x11d */ OPT_MIPMAPS, - /* 0x11e */ OPT_NO_MIPMAPS, - /* 0x11f */ OPT_N_MIPMAPS, - /* 0x120 */ OPT_MAX_MIPMAPS, - /* 0x121 */ OPT_MIPMAP_SIZE, - /* 0x122 */ OPT_FAST_MIPMAPS, - /* 0x123 */ OPT_CMPR_DEFAULT, - /* 0x124 */ OPT_CUT, - /* 0x125 */ OPT_RAW, - /* 0x126 */ OPT_SECTIONS, - /* 0x127 */ 0,0,0,0, 0, + /* 0x084 */ OPT_MAX_WIDTH, + /* 0x085 */ OPT_DE, + /* 0x086 */ OPT_COLORS, + /* 0x087 */ OPT_NO_COLORS, + /* 0x088 */ OPT_CT_CODE, + /* 0x089 */ OPT_LE_CODE, + /* 0x08a */ OPT_CHDIR, + /* 0x08b */ OPT_TOUCH, + /* 0x08c */ OPT_AUTO, + /* 0x08d */ OPT_SET_FLAGS, + /* 0x08e */ OPT_SET_SCALE, + /* 0x08f */ OPT_SET_ROT, + /* 0x090 */ OPT_SET_X, + /* 0x091 */ OPT_SET_Y, + /* 0x092 */ OPT_SET_Z, + /* 0x093 */ OPT_XCENTER, + /* 0x094 */ OPT_YCENTER, + /* 0x095 */ OPT_ZCENTER, + /* 0x096 */ OPT_CENTER, + /* 0x097 */ OPT_SCALE, + /* 0x098 */ OPT_SHIFT, + /* 0x099 */ OPT_XSS, + /* 0x09a */ OPT_YSS, + /* 0x09b */ OPT_ZSS, + /* 0x09c */ OPT_ROT, + /* 0x09d */ OPT_XROT, + /* 0x09e */ OPT_YROT, + /* 0x09f */ OPT_ZROT, + /* 0x0a0 */ OPT_YPOS, + /* 0x0a1 */ OPT_TRANSLATE, + /* 0x0a2 */ OPT_NULL, + /* 0x0a3 */ OPT_NEXT, + /* 0x0a4 */ OPT_ASCALE, + /* 0x0a5 */ OPT_AROT, + /* 0x0a6 */ OPT_TFORM_SCRIPT, + /* 0x0a7 */ OPT_MINIMAP, + /* 0x0a8 */ OPT_RM_GOBJ, + /* 0x0a9 */ OPT_BATTLE, + /* 0x0aa */ OPT_EXPORT_FLAGS, + /* 0x0ab */ OPT_ROUTE_OPTIONS, + /* 0x0ac */ OPT_WIM0, + /* 0x0ad */ OPT_SLOT, + /* 0x0ae */ OPT_LOAD_KCL, + /* 0x0af */ OPT_KCL, + /* 0x0b0 */ OPT_KCL_FLAG, + /* 0x0b1 */ OPT_KCL_SCRIPT, + /* 0x0b2 */ OPT_TRI_AREA, + /* 0x0b3 */ OPT_TRI_HEIGHT, + /* 0x0b4 */ OPT_FLAG_FILE, + /* 0x0b5 */ OPT_XTRIDATA, + /* 0x0b6 */ OPT_KMP, + /* 0x0b7 */ OPT_SPEED_MOD, + /* 0x0b8 */ OPT_KTPT2, + /* 0x0b9 */ OPT_TFORM_KMP, + /* 0x0ba */ OPT_REPAIR_XPF, + /* 0x0bb */ OPT_GAMEMODES, + /* 0x0bc */ OPT_MDL, + /* 0x0bd */ OPT_PAT, + /* 0x0be */ OPT_PATCH_FILE, + /* 0x0bf */ OPT_KMG_LIMIT, + /* 0x0c0 */ OPT_KMG_COPY, + /* 0x0c1 */ OPT_LT_CLEAR, + /* 0x0c2 */ OPT_LT_ONLINE, + /* 0x0c3 */ OPT_LT_N_PLAYERS, + /* 0x0c4 */ OPT_LT_COND_BIT, + /* 0x0c5 */ OPT_LT_GAME_MODE, + /* 0x0c6 */ OPT_LT_ENGINE, + /* 0x0c7 */ OPT_LT_RANDOM, + /* 0x0c8 */ OPT_LEX_PURGE, + /* 0x0c9 */ OPT_LEX_FEATURES, + /* 0x0ca */ OPT_LEX_RM_FEAT, + /* 0x0cb */ OPT_LOAD_BMG, + /* 0x0cc */ OPT_PATCH_BMG, + /* 0x0cd */ OPT_MACRO_BMG, + /* 0x0ce */ OPT_FILTER_BMG, + /* 0x0cf */ OPT_CACHE, + /* 0x0d0 */ OPT_CNAME, + /* 0x0d1 */ OPT_ID, + /* 0x0d2 */ OPT_BASE64, + /* 0x0d3 */ OPT_DB64, + /* 0x0d4 */ OPT_CODING, + /* 0x0d5 */ OPT_VERIFY, + /* 0x0d6 */ OPT_ROUND, + /* 0x0d7 */ OPT_PIPE, + /* 0x0d8 */ OPT_DELTA, + /* 0x0d9 */ OPT_DIFF, + /* 0x0da */ OPT_EPSILON, + /* 0x0db */ OPT_BMG_ENDIAN, + /* 0x0dc */ OPT_BMG_ENCODING, + /* 0x0dd */ OPT_BMG_INF_SIZE, + /* 0x0de */ OPT_BMG_MID, + /* 0x0df */ OPT_FORCE_ATTRIB, + /* 0x0e0 */ OPT_DEF_ATTRIB, + /* 0x0e1 */ OPT_NO_ATTRIB, + /* 0x0e2 */ OPT_X_ESCAPES, + /* 0x0e3 */ OPT_OLD_ESCAPES, + /* 0x0e4 */ OPT_NO_BMG_COLORS, + /* 0x0e5 */ OPT_BMG_COLORS, + /* 0x0e6 */ OPT_NO_BMG_INLINE, + /* 0x0e7 */ OPT_AUTOADD_PATH, + /* 0x0e8 */ OPT_STRIP, + /* 0x0e9 */ OPT_UTF_8, + /* 0x0ea */ OPT_NO_UTF_8, + /* 0x0eb */ OPT_FORCE, + /* 0x0ec */ OPT_REPAIR_MAGICS, + /* 0x0ed */ OPT_TINY, + /* 0x0ee */ OPT_YAZ0, + /* 0x0ef */ OPT_YAZ1, + /* 0x0f0 */ OPT_XYZ, + /* 0x0f1 */ OPT_BZ, + /* 0x0f2 */ OPT_SH, + /* 0x0f3 */ OPT_BASH, + /* 0x0f4 */ OPT_JSON, + /* 0x0f5 */ OPT_PHP, + /* 0x0f6 */ OPT_MAKEDOC, + /* 0x0f7 */ OPT_VAR, + /* 0x0f8 */ OPT_ARRAY, + /* 0x0f9 */ OPT_AVAR, + /* 0x0fa */ OPT_CASE, + /* 0x0fb */ OPT_PMODES, + /* 0x0fc */ OPT_FMODES, + /* 0x0fd */ OPT_ANALYZE, + /* 0x0fe */ OPT_ANALYZE_MODE, + /* 0x0ff */ OPT_OLD, + /* 0x100 */ OPT_STD, + /* 0x101 */ OPT_NEW, + /* 0x102 */ OPT_EXTRACT, + /* 0x103 */ OPT_NUMBER, + /* 0x104 */ OPT_REMOVE_SRC, + /* 0x105 */ OPT_IGNORE_SETUP, + /* 0x106 */ OPT_PURGE, + /* 0x107 */ OPT_ALIGN_U8, + /* 0x108 */ OPT_ALIGN_PACK, + /* 0x109 */ OPT_ALIGN_BRRES, + /* 0x10a */ OPT_ALIGN_BREFF, + /* 0x10b */ OPT_ALIGN_BREFT, + /* 0x10c */ OPT_ALIGN, + /* 0x10d */ OPT_ENCODE_ALL, + /* 0x10e */ OPT_ENCODE_IMG, + /* 0x10f */ OPT_NO_ENCODE, + /* 0x110 */ OPT_NO_RECURSE, + /* 0x111 */ OPT_AUTO_ADD, + /* 0x112 */ OPT_NO_ECHO, + /* 0x113 */ OPT_PT_DIR, + /* 0x114 */ OPT_RM_AIPARAM, + /* 0x115 */ OPT_U8, + /* 0x116 */ OPT_SZS, + /* 0x117 */ OPT_WU8, + /* 0x118 */ OPT_XWU8, + /* 0x119 */ OPT_WBZ, + /* 0x11a */ OPT_PACK, + /* 0x11b */ OPT_BRRES, + /* 0x11c */ OPT_BREFF, + /* 0x11d */ OPT_BREFT, + /* 0x11e */ OPT_NO_COMPRESS, + /* 0x11f */ OPT_FAST, + /* 0x120 */ OPT_LINKS, + /* 0x121 */ OPT_BASEDIR, + /* 0x122 */ OPT_DECODE, + /* 0x123 */ OPT_MIPMAPS, + /* 0x124 */ OPT_NO_MIPMAPS, + /* 0x125 */ OPT_N_MIPMAPS, + /* 0x126 */ OPT_MAX_MIPMAPS, + /* 0x127 */ OPT_MIPMAP_SIZE, + /* 0x128 */ OPT_FAST_MIPMAPS, + /* 0x129 */ OPT_CMPR_DEFAULT, + /* 0x12a */ OPT_CUT, + /* 0x12b */ OPT_RAW, + /* 0x12c */ OPT_SECTIONS, + /* 0x12d */ 0,0,0,0, 0,0,0,0, 0, }; // @@ -2798,652 +2888,670 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /////////////// opt_allowed_cmd_* /////////////// /////////////////////////////////////////////////////////////////////////////// -static u8 option_allowed_cmd_VERSION[131] = // cmd #1 +static u8 option_allowed_cmd_VERSION[133] = // cmd #1 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 1 + 0,0,0,0,0, 0,0,0,0,0, 0,0,1 }; -static u8 option_allowed_cmd_HELP[131] = // cmd #2 +static u8 option_allowed_cmd_HELP[133] = // cmd #2 { 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1 + 1,1,1,1,1, 1,1,1,1,1, 1,1,1 }; -static u8 option_allowed_cmd_ARGTEST[131] = // cmd #3 +static u8 option_allowed_cmd_ARGTEST[133] = // cmd #3 { 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1 + 1,1,1,1,1, 1,1,1,1,1, 1,1,1 }; -static u8 option_allowed_cmd_TEST[131] = // cmd #4 +static u8 option_allowed_cmd_TEST[133] = // cmd #4 { 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1 + 1,1,1,1,1, 1,1,1,1,1, 1,1,1 }; -static u8 option_allowed_cmd_COLORS[131] = // cmd #5 +static u8 option_allowed_cmd_COLORS[133] = // cmd #5 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_ERROR[131] = // cmd #6 +static u8 option_allowed_cmd_ERROR[133] = // cmd #6 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 1 + 0,0,0,0,0, 0,0,0,0,0, 0,0,1 }; -static u8 option_allowed_cmd_FILETYPE[131] = // cmd #7 +static u8 option_allowed_cmd_FILETYPE[133] = // cmd #7 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_FILEATTRIB[131] = // cmd #8 +static u8 option_allowed_cmd_FILEATTRIB[133] = // cmd #8 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_BRSUB[131] = // cmd #9 +static u8 option_allowed_cmd_BRSUB[133] = // cmd #9 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_SYMBOLS[131] = // cmd #10 +static u8 option_allowed_cmd_SYMBOLS[133] = // cmd #10 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_FUNCTIONS[131] = // cmd #11 +static u8 option_allowed_cmd_FUNCTIONS[133] = // cmd #11 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_CALCULATE[131] = // cmd #12 +static u8 option_allowed_cmd_CALCULATE[133] = // cmd #12 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_MATRIX[131] = // cmd #13 +static u8 option_allowed_cmd_MATRIX[133] = // cmd #13 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_FLOAT[131] = // cmd #14 +static u8 option_allowed_cmd_FLOAT[133] = // cmd #14 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_VR_CALC[131] = // cmd #15 +static u8 option_allowed_cmd_VR_CALC[133] = // cmd #15 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_VR_RACE[131] = // cmd #16 +static u8 option_allowed_cmd_VR_RACE[133] = // cmd #16 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_AUTOADD[131] = // cmd #17 +static u8 option_allowed_cmd_AUTOADD[133] = // cmd #17 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,1,0,1,0, 0,1,0,1,1, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,0, 1,0,0,1,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_TRACKS[131] = // cmd #18 +static u8 option_allowed_cmd_TRACKS[133] = // cmd #18 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0,0, 0,0,0,0,0, 0,0,1,0,0, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,1,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 1,0,0 }; -static u8 option_allowed_cmd_SCANCACHE[131] = // cmd #19 +static u8 option_allowed_cmd_SCANCACHE[133] = // cmd #19 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_EXPORT[131] = // cmd #20 +static u8 option_allowed_cmd_EXPORT[133] = // cmd #20 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_CODE[131] = // cmd #21 +static u8 option_allowed_cmd_CODE[133] = // cmd #21 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_RECODE[131] = // cmd #22 +static u8 option_allowed_cmd_RECODE[133] = // cmd #22 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_SUBFILE[131] = // cmd #23 +static u8 option_allowed_cmd_SUBFILE[133] = // cmd #23 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,1,1,1,1, 0,1,1,1,0, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, 1,1,0,1,1, 1,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 +}; + +static u8 option_allowed_cmd_TESTNORM[133] = // cmd #24 +{ + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_LIST[131] = // cmd #24 +static u8 option_allowed_cmd_LIST[133] = // cmd #25 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 1,0,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,0,1, 1,0,1,1,0, - 1,1,1,1,1, 1,1,1,1,0, 0 + 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,1,0,1, + 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,0,0, 0,1,1,0,1, + 1,0,1,1,1, 1,1,1,1,1, 1,0,0 }; -static u8 option_allowed_cmd_LIST_L[131] = // cmd #25 +static u8 option_allowed_cmd_LIST_L[133] = // cmd #26 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 1,0,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,0,1, 1,0,1,1,0, - 1,1,1,1,1, 1,1,1,1,0, 0 + 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,1,0,1, + 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,0,0, 0,1,1,0,1, + 1,0,1,1,1, 1,1,1,1,1, 1,0,0 }; -static u8 option_allowed_cmd_LIST_LL[131] = // cmd #26 +static u8 option_allowed_cmd_LIST_LL[133] = // cmd #27 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 1,0,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,0,1, 1,0,1,1,0, - 1,1,1,1,1, 1,1,1,1,0, 0 + 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,1,0,1, + 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,0,0, 0,1,1,0,1, + 1,0,1,1,1, 1,1,1,1,1, 1,0,0 }; -static u8 option_allowed_cmd_LIST_LLL[131] = // cmd #27 +static u8 option_allowed_cmd_LIST_LLL[133] = // cmd #28 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 1,0,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,0,1, 1,0,1,1,0, - 1,1,1,1,1, 1,1,1,1,0, 0 + 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,1,0,1, + 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,0,0, 0,1,1,0,1, + 1,0,1,1,1, 1,1,1,1,1, 1,0,0 }; -static u8 option_allowed_cmd_LIST_A[131] = // cmd #28 +static u8 option_allowed_cmd_LIST_A[133] = // cmd #29 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 1,0,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,0,1, 1,0,1,1,0, - 1,1,1,1,1, 1,1,1,1,0, 0 + 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,1,0,1, + 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,0,0, 0,1,1,0,1, + 1,0,1,1,1, 1,1,1,1,1, 1,0,0 }; -static u8 option_allowed_cmd_LIST_LA[131] = // cmd #29 +static u8 option_allowed_cmd_LIST_LA[133] = // cmd #30 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 1,0,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,0,1, 1,0,1,1,0, - 1,1,1,1,1, 1,1,1,1,0, 0 + 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,1,0,1, + 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,0,0, 0,1,1,0,1, + 1,0,1,1,1, 1,1,1,1,1, 1,0,0 }; -static u8 option_allowed_cmd_NAME_REF[131] = // cmd #30 +static u8 option_allowed_cmd_NAME_REF[133] = // cmd #31 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_ILIST[131] = // cmd #31 +static u8 option_allowed_cmd_ILIST[133] = // cmd #32 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 1,0,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,0,1, 1,0,1,0,0, - 1,1,1,1,1, 1,1,0,1,0, 0 + 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,1,0,1, + 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,0,0, 0,1,1,0,1, + 0,0,1,1,1, 1,1,1,1,0, 1,0,0 }; -static u8 option_allowed_cmd_ILIST_L[131] = // cmd #32 +static u8 option_allowed_cmd_ILIST_L[133] = // cmd #33 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 1,0,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,0,1, 1,0,1,0,0, - 1,1,1,1,1, 1,1,0,1,0, 0 + 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,1,0,1, + 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,0,0, 0,1,1,0,1, + 0,0,1,1,1, 1,1,1,1,0, 1,0,0 }; -static u8 option_allowed_cmd_ILIST_LL[131] = // cmd #33 +static u8 option_allowed_cmd_ILIST_LL[133] = // cmd #34 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 1,0,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,0,1, 1,0,1,0,0, - 1,1,1,1,1, 1,1,0,1,0, 0 + 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,1,0,1, + 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,0,0, 0,1,1,0,1, + 0,0,1,1,1, 1,1,1,1,0, 1,0,0 }; -static u8 option_allowed_cmd_ILIST_A[131] = // cmd #34 +static u8 option_allowed_cmd_ILIST_A[133] = // cmd #35 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 1,0,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,0,1, 1,0,1,0,0, - 1,1,1,1,1, 1,1,0,1,0, 0 + 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,1,0,1, + 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,0,0, 0,1,1,0,1, + 0,0,1,1,1, 1,1,1,1,0, 1,0,0 }; -static u8 option_allowed_cmd_ILIST_LA[131] = // cmd #35 +static u8 option_allowed_cmd_ILIST_LA[133] = // cmd #36 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 1,0,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,0,1, 1,0,1,0,0, - 1,1,1,1,1, 1,1,0,1,0, 0 + 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,1,0,1, + 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,0,0, 0,1,1,0,1, + 0,0,1,1,1, 1,1,1,1,0, 1,0,0 }; -static u8 option_allowed_cmd_MEMORY[131] = // cmd #36 +static u8 option_allowed_cmd_MEMORY[133] = // cmd #37 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 1,0,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,0,1, 1,0,1,1,1, - 1,1,1,1,1, 1,1,1,1,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,1,0,1, + 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,0,0, 0,1,1,0,1, + 1,1,1,1,1, 1,1,1,1,1, 1,0,0 }; -static u8 option_allowed_cmd_MEMORY_A[131] = // cmd #37 +static u8 option_allowed_cmd_MEMORY_A[133] = // cmd #38 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 1,0,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,0,1, 1,0,1,1,1, - 1,1,1,1,1, 1,1,1,1,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,1,0,1, + 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,0,0, 0,1,1,0,1, + 1,1,1,1,1, 1,1,1,1,1, 1,0,0 }; -static u8 option_allowed_cmd_DUMP[131] = // cmd #38 +static u8 option_allowed_cmd_DUMP[133] = // cmd #39 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 1,0,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,0,1, 1,0,0,0,0, - 1,1,1,1,1, 1,1,0,1,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,1,0,1, + 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,0,0, 0,1,1,0,0, + 0,0,1,1,1, 1,1,1,1,0, 1,0,0 }; -static u8 option_allowed_cmd_SHA1[131] = // cmd #39 +static u8 option_allowed_cmd_SHA1[133] = // cmd #40 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,1,1,1, 1,0,1,0,1, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 1,0,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,0,1, 1,0,0,0,0, - 1,1,1,1,1, 1,1,0,1,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,1,0,1, + 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,0,0, 0,1,1,0,0, + 0,0,1,1,1, 1,1,1,1,0, 1,0,0 }; -static u8 option_allowed_cmd_ANALYZE[131] = // cmd #40 +static u8 option_allowed_cmd_ANALYZE[133] = // cmd #41 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,0,1, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_DISTRIBUTION[131] = // cmd #41 +static u8 option_allowed_cmd_FEATURES[133] = // cmd #42 +{ + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0,1, 0,0,0,0,0, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,0, 0,0,1,1,0, 0,0,0,0,0, 0,1,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 +}; + +static u8 option_allowed_cmd_DISTRIBUTION[133] = // cmd #43 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,1, 0,0,0,0,0, 0,0,0,0,1, 1,0,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,0,1, 1,0,0,0,0, - 1,1,1,1,1, 1,1,0,1,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,1,1,0,1, + 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,0,0, 0,1,1,0,0, + 0,0,1,1,1, 1,1,1,1,0, 1,0,0 }; -static u8 option_allowed_cmd_DIFF[131] = // cmd #42 +static u8 option_allowed_cmd_DIFF[133] = // cmd #44 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,0,1,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0,0, - 0,0,0,0,0, 0,0,1,1,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0,1, 0,0,0,0,0, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, + 0,0,0,0,0, 0,0,0,0,1, 1,0,0 }; -static u8 option_allowed_cmd_CHECK[131] = // cmd #43 +static u8 option_allowed_cmd_CHECK[133] = // cmd #45 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 1,0,0,1,1, 1,0,0,0,0, 0,0,1,0,1, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 1,0,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,0,0, 1,0,0,0,0, - 1,1,1,1,1, 1,1,0,1,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,1,0,1, + 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,0,0, 0,0,1,0,0, + 0,0,1,1,1, 1,1,1,1,0, 1,0,0 }; -static u8 option_allowed_cmd_SLOTS[131] = // cmd #44 +static u8 option_allowed_cmd_SLOTS[133] = // cmd #46 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 1,0,0,1,1, 1,0,0,0,0, 0,0,0,0,1, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 1,0,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,0,0, 1,0,0,0,0, - 1,1,1,1,1, 1,1,0,1,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,1,0,1, + 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,0,0, 0,0,1,0,0, + 0,0,1,1,1, 1,1,1,1,0, 1,0,0 }; -static u8 option_allowed_cmd_STGI[131] = // cmd #45 +static u8 option_allowed_cmd_STGI[133] = // cmd #47 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_ISARENA[131] = // cmd #46 +static u8 option_allowed_cmd_ISARENA[133] = // cmd #48 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_NORMALIZE[131] = // cmd #47 +static u8 option_allowed_cmd_NORMALIZE[133] = // cmd #49 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 1,0,0,1,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,1,1,1,1, 1,1,1,1,1, 0,0,1,1,1, - 1,1,1,0,0, 0,0,1,0,0, 1,1,1,1,1, 1,1,0,0,0, 0,0,0,1,1, 1,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, 1,1,1,1,1, 1,1,0,0,1, + 1,1,1,1,1, 0,0,0,0,1, 0,0,1,1,1, 1,1,1,1,0, 0,0,0,0,0, 1,1,1,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_PATCH[131] = // cmd #48 +static u8 option_allowed_cmd_PATCH[133] = // cmd #50 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 1,0,0,1,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,1,1,1,1, 1,1,1,1,1, 0,0,1,1,1, - 1,1,1,0,0, 0,0,1,0,0, 1,1,1,1,1, 1,1,0,0,0, 0,0,1,1,1, 1,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, 1,1,1,1,1, 1,1,0,0,1, + 1,1,1,1,1, 0,0,0,0,1, 0,0,1,1,1, 1,1,1,1,0, 0,0,0,0,1, 1,1,1,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_COPY[131] = // cmd #49 +static u8 option_allowed_cmd_COPY[133] = // cmd #51 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 1,0,0,1,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,1,1,1,1, 1,1,1,1,1, 0,0,1,1,1, - 1,1,1,0,0, 0,0,1,0,0, 1,1,1,1,1, 1,1,0,0,0, 0,0,1,1,1, 1,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, 1,1,1,1,1, 1,1,0,0,1, + 1,1,1,1,1, 0,0,0,0,1, 0,0,1,1,1, 1,1,1,1,0, 0,0,0,0,1, 1,1,1,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_DUPLICATE[131] = // cmd #50 +static u8 option_allowed_cmd_DUPLICATE[133] = // cmd #52 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 1,1,0,1,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,1,1,1,1, 1,1,1,1,1, 0,0,1,1,1, - 1,1,1,0,0, 0,0,1,0,0, 1,1,1,1,1, 1,1,0,0,0, 0,0,1,1,1, 1,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, 1,1,1,1,1, 1,1,0,0,1, + 1,1,1,1,1, 0,0,0,0,1, 0,0,1,1,1, 1,1,1,1,0, 0,0,0,0,1, 1,1,1,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_MINIMAP[131] = // cmd #51 +static u8 option_allowed_cmd_MINIMAP[133] = // cmd #53 { 0,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0,1,1, 0,0,1,1,1, - 1,1,1,0,0, 0,0,1,0,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,1,1,1, 1,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,0, 1,1,0,0,1, + 1,1,1,1,1, 0,0,0,0,1, 0,0,1,1,0, 0,0,0,0,0, 0,0,0,0,1, 1,1,1,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_COMPRESS[131] = // cmd #52 +static u8 option_allowed_cmd_COMPRESS[133] = // cmd #54 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 1,0,0,1,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,1,1,1,1, 1,1,1,1,1, 0,0,1,1,1, - 1,1,1,0,0, 0,0,1,0,0, 1,1,1,1,1, 1,1,0,0,0, 0,0,1,1,1, 1,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, 1,1,1,1,1, 1,1,0,0,1, + 1,1,1,1,1, 0,0,0,0,1, 0,0,1,1,1, 1,1,1,1,0, 0,0,0,0,1, 1,1,1,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_DECOMPRESS[131] = // cmd #53 +static u8 option_allowed_cmd_DECOMPRESS[133] = // cmd #55 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 1,0,0,1,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,1,1,1,1, 1,1,1,1,1, 0,0,1,1,1, - 1,1,1,0,0, 0,0,1,0,0, 1,1,1,0,1, 0,0,0,0,0, 0,0,0,0,1, 1,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, 1,1,1,1,1, 1,1,0,0,1, + 1,1,1,1,1, 0,0,0,0,1, 0,0,1,1,1, 0,1,0,0,0, 0,0,0,0,0, 0,1,1,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_ENCODE[131] = // cmd #54 +static u8 option_allowed_cmd_ENCODE[133] = // cmd #56 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 1,0,0,1,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,0,1,1,1, - 1,1,1,1,1, 1,1,0,1,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 1,1,1,1,1, 1,1,0,1,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0,1, + 1,1,1,1,1, 1,1,1,1,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, + 0,0,1,1,1, 1,1,1,1,0, 1,0,0 }; -static u8 option_allowed_cmd_CREATE[131] = // cmd #55 +static u8 option_allowed_cmd_CREATE[133] = // cmd #57 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 1,0,0,1,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 1,1,1,1,1, 0,1,1,1,0, 1,0,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 1,0,0,0,0, - 1,1,1,1,1, 1,1,0,1,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,0,1,1,1, 1,1,0,1,1, 1,0,1,0,1, + 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,1,0,0, + 0,0,1,1,1, 1,1,1,1,0, 1,0,0 }; -static u8 option_allowed_cmd_UPDATE[131] = // cmd #56 +static u8 option_allowed_cmd_UPDATE[133] = // cmd #58 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 1,0,0,1,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,1, 1,1,1,1,1, 0,1,1,1,1, 0,0,0,0,0, - 0,0,0,1,1, 1,1,0,1,1, 0,0,0,0,0, 0,0,0,0,0, 0,1,1,1,0, 0,0,1,0,0, - 0,0,0,0,0, 0,0,0,1,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,1,1,1,1, 1,1,0,1,1, 1,1,0,0,0, + 0,0,0,0,0, 1,1,1,1,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 1,0,0,0,1, + 0,0,0,0,0, 0,0,0,0,0, 1,0,0 }; -static u8 option_allowed_cmd_EXTRACT[131] = // cmd #57 +static u8 option_allowed_cmd_EXTRACT[133] = // cmd #59 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 1,0,0,1,1, 1,0,0,0,0, 0,0,0,1,1, 0,1,1,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,1,1,0, 0,0,1,1,0, 1,1,1,1,1, 0,1,1,1,1, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,1,1,1,1, - 1,1,0,0,0, 1,1,1,1,1, 0 + 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,1, 1,0,1,1,1, 1,1,0,1,1, 1,1,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, + 1,1,1,1,0, 0,0,1,1,1, 1,1,0 }; -static u8 option_allowed_cmd_XDECODE[131] = // cmd #58 +static u8 option_allowed_cmd_XDECODE[133] = // cmd #60 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 1,0,0,1,1, 1,0,0,0,0, 0,0,0,1,1, 0,1,1,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,1,1,0, 0,0,1,1,0, 1,1,1,1,1, 0,1,1,1,1, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,1,1,1,1, - 1,1,0,0,0, 1,1,1,1,1, 0 + 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,1, 1,0,1,1,1, 1,1,0,1,1, 1,1,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, + 1,1,1,1,0, 0,0,1,1,1, 1,1,0 }; -static u8 option_allowed_cmd_XEXPORT[131] = // cmd #59 +static u8 option_allowed_cmd_XEXPORT[133] = // cmd #61 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 1,0,0,1,1, 1,0,0,0,0, 0,0,0,1,1, 0,1,1,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,1,1,0, 0,0,1,1,0, 1,1,1,1,1, 0,1,1,1,1, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,1,1,1,1, - 1,1,0,0,0, 1,1,1,1,1, 0 + 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,1, 1,0,1,1,1, 1,1,0,1,1, 1,1,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, + 1,1,1,1,0, 0,0,1,1,1, 1,1,0 }; -static u8 option_allowed_cmd_XALL[131] = // cmd #60 +static u8 option_allowed_cmd_XALL[133] = // cmd #62 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 1,0,0,1,1, 1,0,0,0,0, 0,0,0,1,1, 0,1,1,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,1,1,0, 0,0,1,1,0, 1,1,1,1,1, 0,1,1,1,1, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,1,1,1,1, - 1,1,0,0,0, 1,1,1,1,1, 0 + 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,1, 1,0,1,1,1, 1,1,0,1,1, 1,1,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, + 1,1,1,1,0, 0,0,1,1,1, 1,1,0 }; -static u8 option_allowed_cmd_XCOMMON[131] = // cmd #61 +static u8 option_allowed_cmd_XCOMMON[133] = // cmd #63 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,1,1,1,1, 0,1,1,1,1, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, 1,1,0,1,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_BINARY[131] = // cmd #62 +static u8 option_allowed_cmd_BINARY[133] = // cmd #64 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,1,1,1,1, 0,1,1,1,1, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, 1,1,0,1,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_TEXT[131] = // cmd #63 +static u8 option_allowed_cmd_TEXT[133] = // cmd #65 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, 0,1,1,0,1, 1,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,0, 0,0,0,0,0, 1,1,1,1,1, 0,1,1,1,1, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, - 0,0,0,0,0, 0,0,0,0,0, 0 + 1,1,1,1,1, 1,1,1,1,0, 0,0,0,0,0, 0,0,1,1,1, 1,1,0,1,1, 1,1,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, + 0,1,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_CAT[131] = // cmd #64 +static u8 option_allowed_cmd_CAT[133] = // cmd #66 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, 0,1,1,0,1, 1,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, - 0,0,0,0,0, 0,0,0,0,0, 0 + 1,1,1,1,1, 1,1,1,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, + 0,1,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_BMG[131] = // cmd #65 +static u8 option_allowed_cmd_BMG[133] = // cmd #67 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, 0,0,0,0,1, 1,1,1,1,1, - 1,1,1,1,1, 1,1,1,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 0,0,0,0,0, + 1,1,1,1,1, 1,1,1,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_KCL[131] = // cmd #66 +static u8 option_allowed_cmd_KCL[133] = // cmd #68 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 1,0,0,1,1, 1,0,0,0,0, 0,0,0,1,1, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_KMP[131] = // cmd #67 +static u8 option_allowed_cmd_KMP[133] = // cmd #69 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 1,0,0,1,1, 1,0,0,0,0, 0,0,0,1,1, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_LEX[131] = // cmd #68 +static u8 option_allowed_cmd_LEX[133] = // cmd #70 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,1,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 0,0,0,0,0, + 0,0,0,0,0, 0,0,1,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_INFO[131] = // cmd #69 +static u8 option_allowed_cmd_INFO[133] = // cmd #71 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_GHOST[131] = // cmd #70 +static u8 option_allowed_cmd_GHOST[133] = // cmd #72 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,0,1, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_YAZDUMP[131] = // cmd #71 +static u8 option_allowed_cmd_YAZDUMP[133] = // cmd #73 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,1,1,1,1, 0,1,1,1,0, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, 1,1,0,1,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_VEHICLE[131] = // cmd #72 +static u8 option_allowed_cmd_VEHICLE[133] = // cmd #74 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 1,1,0,1,0, 0,0,0,0,0, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,1,1,0, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; @@ -3460,6 +3568,7 @@ static const InfoOption_t * option_tab_tool[] = OptionInfo + OPT_ALLOW_ALL, OptionInfo + OPT_COMPATIBLE, OptionInfo + OPT_WIDTH, + OptionInfo + OPT_MAX_WIDTH, OptionInfo + OPT_QUIET, OptionInfo + OPT_VERBOSE, OptionInfo + OPT_LOGGING, @@ -3523,6 +3632,7 @@ static const InfoOption_t * option_tab_tool[] = OptionInfo + OPT_VAR, OptionInfo + OPT_ARRAY, OptionInfo + OPT_AVAR, + OptionInfo + OPT_CASE, 0 }; @@ -3539,6 +3649,7 @@ static const InfoOption_t * option_tab_cmd_VERSION[] = static const InfoOption_t * option_tab_cmd_HELP[] = { OptionInfo + OPT_WIDTH, + OptionInfo + OPT_MAX_WIDTH, 0 }; @@ -3743,6 +3854,12 @@ static const InfoOption_t * option_tab_cmd_SUBFILE[] = 0 }; +static const InfoOption_t * option_tab_cmd_TESTNORM[] = +{ + + 0 +}; + static const InfoOption_t * option_tab_cmd_LIST[] = { OptionInfo + OPT_RECURSE, @@ -4695,6 +4812,36 @@ static const InfoOption_t * option_tab_cmd_ANALYZE[] = OptionInfo + OPT_VAR, OptionInfo + OPT_ARRAY, OptionInfo + OPT_AVAR, + OptionInfo + OPT_CASE, + + OptionInfo + OPT_NONE, // separator + + OptionInfo + OPT_DEST, + OptionInfo + OPT_DEST2, + + 0 +}; + +static const InfoOption_t * option_tab_cmd_FEATURES[] = +{ + &option_cmd_FEATURES_BRIEF, + &option_cmd_FEATURES_LONG, + OptionInfo + OPT_IGNORE, + &option_cmd_FEATURES_QUIET, + + OptionInfo + OPT_NONE, // separator + + OptionInfo + OPT_SH, + OptionInfo + OPT_BASH, + OptionInfo + OPT_JSON, + OptionInfo + OPT_PHP, + OptionInfo + OPT_MAKEDOC, + OptionInfo + OPT_VAR, + OptionInfo + OPT_ARRAY, + OptionInfo + OPT_AVAR, + OptionInfo + OPT_CASE, + OptionInfo + OPT_PMODES, + OptionInfo + OPT_FMODES, OptionInfo + OPT_NONE, // separator @@ -6525,6 +6672,7 @@ static const InfoOption_t * option_tab_cmd_GHOST[] = OptionInfo + OPT_VAR, OptionInfo + OPT_ARRAY, OptionInfo + OPT_AVAR, + OptionInfo + OPT_CASE, OptionInfo + OPT_NONE, // separator @@ -6583,7 +6731,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " SZS, U8, PACK, BRRES, BREFF, BREFT and RARC archives. It is also a" " wrapper to all other tools.", 0, - 63, + 65, option_tab_tool, 0 }, @@ -6621,7 +6769,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " The third variant (with a valid command name) prints details about" " the declared command. The fourth variant prints an overview about" " all commands and all global options.", - 1, + 2, option_tab_cmd_HELP, option_allowed_cmd_HELP }, @@ -6976,6 +7124,20 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = option_allowed_cmd_SUBFILE }, + { CMD_TESTNORM, + true, + false, + false, + "_NORM", + 0, + "wszst _NORM key...", + "This hidden command tests the iteration of norming.", + 0, + 0, + option_tab_cmd_TESTNORM, + option_allowed_cmd_TESTNORM + }, + { CMD_LIST, false, false, @@ -7232,11 +7394,25 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "wszst ANALYZE [source]...", "Analyse track files and print results in machine readable format.", 0, - 13, + 14, option_tab_cmd_ANALYZE, option_allowed_cmd_ANALYZE }, + { CMD_FEATURES, + true, + false, + false, + "FEATURES", + 0, + "wszst FEATURES [source]...", + "Analyse track files and a feature list in machine readable format.", + 0, + 17, + option_tab_cmd_FEATURES, + option_allowed_cmd_FEATURES + }, + { CMD_DISTRIBUTION, false, false, @@ -7757,7 +7933,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "wszst GHOST [source]...", "Analyse each file and print a summary about the ghost data.", 0, - 12, + 13, option_tab_cmd_GHOST, option_allowed_cmd_GHOST }, diff --git a/project/src/ui/ui-wszst.h b/project/src/ui/ui-wszst.h index bdeeeae..fabeee1 100644 --- a/project/src/ui/ui-wszst.h +++ b/project/src/ui/ui-wszst.h @@ -16,7 +16,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -127,6 +127,8 @@ typedef enum enumOptions OPT_SORT, OPT_TRANSFORM, OPT_STRIP, + OPT_PMODES, + OPT_FMODES, OPT_ANALYZE, OPT_ANALYZE_MODE, OPT_SOURCE, @@ -187,7 +189,7 @@ typedef enum enumOptions OPT_RAW, OPT_SECTIONS, - OPT__N_SPECIFIC, // == 131 + OPT__N_SPECIFIC, // == 133 //----- global options ----- @@ -197,6 +199,7 @@ typedef enum enumOptions OPT_ALLOW_ALL, OPT_COMPATIBLE, OPT_WIDTH, + OPT_MAX_WIDTH, OPT_QUIET, OPT_VERBOSE, OPT_LOGGING, @@ -233,6 +236,8 @@ typedef enum enumOptions OPT_LT_ENGINE, OPT_LT_RANDOM, OPT_LEX_PURGE, + OPT_LEX_FEATURES, + OPT_LEX_RM_FEAT, OPT_CACHE, OPT_CNAME, OPT_MAX_FILE_SIZE, @@ -257,12 +262,13 @@ typedef enum enumOptions OPT_VAR, OPT_ARRAY, OPT_AVAR, + OPT_CASE, OPT_OLD, OPT_STD, OPT_NEW, OPT_EXTRACT, - OPT__N_TOTAL // == 201 + OPT__N_TOTAL // == 207 } enumOptions; @@ -348,6 +354,8 @@ typedef enum enumOptions // OB_SORT = 1llu << OPT_SORT, // OB_TRANSFORM = 1llu << OPT_TRANSFORM, // OB_STRIP = 1llu << OPT_STRIP, +// OB_PMODES = 1llu << OPT_PMODES, +// OB_FMODES = 1llu << OPT_FMODES, // OB_ANALYZE = 1llu << OPT_ANALYZE, // OB_ANALYZE_MODE = 1llu << OPT_ANALYZE_MODE, // OB_SOURCE = 1llu << OPT_SOURCE, @@ -698,6 +706,15 @@ typedef enum enumOptions // | OB_DEST // | OB_DEST2, // +// OB_CMD_FEATURES = OB_BRIEF +// | OB_LONG +// | OB_IGNORE +// | OB_GRP_SCRIPT +// | OB_PMODES +// | OB_FMODES +// | OB_DEST +// | OB_DEST2, +// // OB_CMD_DISTRIBUTION = OB_IGNORE // | OB_NORM // | OB_LINKS @@ -929,6 +946,7 @@ typedef enum enumCommands CMD_CODE, CMD_RECODE, CMD_SUBFILE, + CMD_TESTNORM, CMD_LIST, CMD_LIST_L, @@ -950,6 +968,7 @@ typedef enum enumCommands CMD_SHA1, CMD_ANALYZE, + CMD_FEATURES, CMD_DISTRIBUTION, CMD_DIFF, @@ -987,7 +1006,7 @@ typedef enum enumCommands CMD_VEHICLE, - CMD__N // == 73 + CMD__N // == 75 } enumCommands; @@ -1040,6 +1059,7 @@ typedef enum enumGetOpt GO_ALLOW_ALL, GO_COMPATIBLE, GO_WIDTH, + GO_MAX_WIDTH, GO_DE, GO_COLORS, GO_NO_COLORS, @@ -1108,6 +1128,8 @@ typedef enum enumGetOpt GO_LT_ENGINE, GO_LT_RANDOM, GO_LEX_PURGE, + GO_LEX_FEATURES, + GO_LEX_RM_FEAT, GO_LOAD_BMG, GO_PATCH_BMG, GO_MACRO_BMG, @@ -1155,6 +1177,9 @@ typedef enum enumGetOpt GO_VAR, GO_ARRAY, GO_AVAR, + GO_CASE, + GO_PMODES, + GO_FMODES, GO_ANALYZE, GO_ANALYZE_MODE, GO_OLD, @@ -1217,7 +1242,7 @@ typedef enum enumGetOpt //extern const struct option OptionLong[]; //extern u8 OptionUsed[OPT__N_TOTAL+1]; //extern const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE]; -//UIOPT_INDEX_SIZE := 0x12c = 300 +//UIOPT_INDEX_SIZE := 0x136 = 310 //extern const InfoCommand_t CommandInfo[CMD__N+1]; extern const InfoUI_t InfoUI_wszst; diff --git a/project/src/ui/ui.def b/project/src/ui/ui.def index bf829ab..722bdb5 100644 --- a/project/src/ui/ui.def +++ b/project/src/ui/ui.def @@ -503,6 +503,12 @@ "Define the terminal width (number of columns) for help and some other" \ " messages and disable the automatic detection of the terminal width." ) +#:def_opt( "MAX_WIDTH", "max-width|maxwidth", "GP", \ + "maxwidth", \ + "Define the maximum terminal width (number of columns) for help and" \ + " some other messages and disable the automatic detection of the" \ + " terminal width. This option is ignored if {--width} is set." ) + #:def_opt( "QUIET", "q|quiet", "GM", \ "", \ "Be quiet and print only error messages. Multiple usage is possible." \ @@ -865,7 +871,8 @@ " @FAST, NEW, CENTER, ROUND, NORMALS, MTL, WIIMM, TRIANGLES, OUT-SWAP," \ " G, USEMTL, CLIP, IN-SWAP, AUTO, HEX4, HEX23, HEX, DROP-UNUSED," \ " DROP-FIXED, DROP-INVALID, DROP, RM-FACEDOWN, RM-FACEUP, FIX-ALL," \ - " CONV-FACEUP, WEAK-WALLS, SORT, INPLACE, SILENT@ and @LOG@." ) + " TINY-0 ... TINY-7, CONV-FACEUP, WEAK-WALLS, SORT, INPLACE, SILENT@" \ + " and @LOG@." ) #:def_opt( "KCL_FLAG", "kcl-flag|kclflag", "CP", \ "joblist", \ @@ -935,7 +942,8 @@ " RIGHT, WIDE, NARROW, FIX-CKPH, FIX-ENPH, FIX-ITPH, FIX-PH," \ " FIX-CKNEXT, FIX-CKJGPT, FIX-CK, FIX-ALL, MASK-PFLAGS, RM-LECODE," \ " PURGE-GOBJ, FULL-DEFOBJ, DUMP-CLASS, DUMP-ONEWAY, DUMP-ALL, 1LAP ..." \ - " 9LAPS, MAX-LAPS, RM-EMPTY, INPLACE, SILENT@ and @LOG@." ) + " 9LAPS, MAX-LAPS, RM-EMPTY, TINY-0 ... TINY-7, INPLACE, SILENT@ and" \ + " @LOG@." ) #:def_opt( "SPEED_MOD", "speed-mod|speedmod", "GP", \ "factor", \ @@ -1106,7 +1114,7 @@ "", \ "Delete LEX sections without any impact. Delete sub-file course.lex if" \ " it no longer contains a section. This option is executed after all" \ - " --lt-* options." ) + " --lt-* and --lex-* options." ) #:def_opt( "LOAD_BMG", "load-bmg|loadbmg", "CMP", \ "file", \ @@ -1490,6 +1498,12 @@ "varname", \ "Shortcut for: {--array --var name}" ) +#:def_opt( "CASE", "case", "GP", \ + "case", \ + "@CASE@ is one of @LOWER@, @AUTO@ (default) or @UPPER@.If @LOWER@ or" \ + " @UPPER@ are set, then the lower/upper case of the variable names is" \ + " adjusted accordingly." ) + #:def_opt( "SOURCE", "s|source|src", "CP", \ "path", \ "Define a secondary source path (directory/file).\n" \ @@ -1865,6 +1879,10 @@ "", \ "" ) +#:def_cmd_opt( "HELP", "MAX_WIDTH", \ + "", \ + "" ) + #:def_cmd_opt( "TEST", "VERBOSE", \ "", \ "Print the matrices of transformations." ) @@ -5025,6 +5043,10 @@ "", \ "" ) +#:def_cmd_opt( "ANALYZE", "CASE", \ + "", \ + "" ) + #:def_cmd_opt( "ANALYZE", "DEST", \ "", \ "" ) @@ -5033,6 +5055,75 @@ "", \ "" ) +#:def_cmd_opt( "FEATURES", "BRIEF", \ + "", \ + "Suppres any comments at all. If set twice, suppress empty lines (for" \ + " grouping) too. If set three times, omit inactive features (=0) too." ) + +#:def_cmd_opt( "FEATURES", "LONG", \ + "", \ + "Print additnal comments." ) + +#:def_cmd_opt( "FEATURES", "IGNORE", \ + "", \ + "" ) + +#:def_cmd_opt( "FEATURES", "QUIET", \ + "", \ + "Suppress logging of input and output files." ) + +#:def_cmd_opt( "FEATURES", "SH", \ + "", \ + "" ) + +#:def_cmd_opt( "FEATURES", "BASH", \ + "", \ + "" ) + +#:def_cmd_opt( "FEATURES", "JSON", \ + "", \ + "" ) + +#:def_cmd_opt( "FEATURES", "PHP", \ + "", \ + "" ) + +#:def_cmd_opt( "FEATURES", "MAKEDOC", \ + "", \ + "" ) + +#:def_cmd_opt( "FEATURES", "VAR", \ + "", \ + "" ) + +#:def_cmd_opt( "FEATURES", "ARRAY", \ + "", \ + "" ) + +#:def_cmd_opt( "FEATURES", "AVAR", \ + "", \ + "" ) + +#:def_cmd_opt( "FEATURES", "CASE", \ + "", \ + "" ) + +#:def_cmd_opt( "FEATURES", "PMODES", \ + "", \ + "" ) + +#:def_cmd_opt( "FEATURES", "FMODES", \ + "", \ + "" ) + +#:def_cmd_opt( "FEATURES", "DEST", \ + "", \ + "" ) + +#:def_cmd_opt( "FEATURES", "DEST2", \ + "", \ + "" ) + #:def_cmd_opt( "DISTRIBUTION", "IGNORE", \ "", \ "" ) @@ -10888,6 +10979,10 @@ "", \ "" ) +#:def_cmd_opt( "GHOST", "CASE", \ + "", \ + "" ) + #:def_cmd_opt( "GHOST", "DEST", \ "", \ "" ) @@ -11137,6 +11232,12 @@ "Define the terminal width (number of columns) for help and some other" \ " messages and disable the automatic detection of the terminal width." ) +#:def_opt( "MAX_WIDTH", "max-width|maxwidth", "GP", \ + "maxwidth", \ + "Define the maximum terminal width (number of columns) for help and" \ + " some other messages and disable the automatic detection of the" \ + " terminal width. This option is ignored if {--width} is set." ) + #:def_opt( "QUIET", "q|quiet", "GM", \ "", \ "Be quiet and print only error messages. Multiple usage is possible." \ @@ -11486,6 +11587,10 @@ "", \ "" ) +#:def_cmd_opt( "HELP", "MAX_WIDTH", \ + "", \ + "" ) + #:def_cmd_opt( "COLORS", "COLORS", \ "", \ "" ) @@ -11562,6 +11667,10 @@ "", \ "" ) +#:def_cmd_opt( "LIST", "MAX_WIDTH", \ + "", \ + "" ) + #:def_cmd_opt( "LIST", "PATCH_BMG", \ "", \ "" ) @@ -11582,6 +11691,10 @@ "", \ "" ) +#:def_cmd_opt( "SLOTS", "MAX_WIDTH", \ + "", \ + "" ) + #:def_cmd_opt( "SLOTS", "PATCH_BMG", \ "", \ "" ) @@ -11598,6 +11711,10 @@ "", \ "" ) +#:def_cmd_opt( "DIFF", "MAX_WIDTH", \ + "", \ + "" ) + #:def_cmd_opt( "DIFF", "PATCH_BMG", \ "", \ "" ) @@ -12341,6 +12458,12 @@ "Define the terminal width (number of columns) for help and some other" \ " messages and disable the automatic detection of the terminal width." ) +#:def_opt( "MAX_WIDTH", "max-width|maxwidth", "GP", \ + "maxwidth", \ + "Define the maximum terminal width (number of columns) for help and" \ + " some other messages and disable the automatic detection of the" \ + " terminal width. This option is ignored if {--width} is set." ) + #:def_opt( "QUIET", "q|quiet", "GM", \ "", \ "Be quiet and print only error messages. Multiple usage is possible." \ @@ -12775,6 +12898,10 @@ "", \ "" ) +#:def_cmd_opt( "HELP", "MAX_WIDTH", \ + "", \ + "" ) + #:def_cmd_opt( "COLORS", "COLORS", \ "", \ "" ) @@ -13658,6 +13785,12 @@ "Define the terminal width (number of columns) for help and some other" \ " messages and disable the automatic detection of the terminal width." ) +#:def_opt( "MAX_WIDTH", "max-width|maxwidth", "GP", \ + "maxwidth", \ + "Define the maximum terminal width (number of columns) for help and" \ + " some other messages and disable the automatic detection of the" \ + " terminal width. This option is ignored if {--width} is set." ) + #:def_opt( "QUIET", "q|quiet", "GM", \ "", \ "Be quiet and print only error messages. Multiple usage is possible." \ @@ -13950,6 +14083,10 @@ "", \ "" ) +#:def_cmd_opt( "HELP", "MAX_WIDTH", \ + "", \ + "" ) + #:def_cmd_opt( "COLORS", "COLORS", \ "", \ "" ) @@ -14613,6 +14750,12 @@ "Define the terminal width (number of columns) for help and some other" \ " messages and disable the automatic detection of the terminal width." ) +#:def_opt( "MAX_WIDTH", "max-width|maxwidth", "GP", \ + "maxwidth", \ + "Define the maximum terminal width (number of columns) for help and" \ + " some other messages and disable the automatic detection of the" \ + " terminal width. This option is ignored if {--width} is set." ) + #:def_opt( "QUIET", "q|quiet", "GM", \ "", \ "Be quiet and print only error messages. Multiple usage is possible." \ @@ -14833,7 +14976,8 @@ " @FAST, NEW, CENTER, ROUND, NORMALS, MTL, WIIMM, TRIANGLES, OUT-SWAP," \ " G, USEMTL, CLIP, IN-SWAP, AUTO, HEX4, HEX23, HEX, DROP-UNUSED," \ " DROP-FIXED, DROP-INVALID, DROP, RM-FACEDOWN, RM-FACEUP, FIX-ALL," \ - " CONV-FACEUP, WEAK-WALLS, SORT, INPLACE, SILENT@ and @LOG@." ) + " TINY-0 ... TINY-7, CONV-FACEUP, WEAK-WALLS, SORT, INPLACE, SILENT@" \ + " and @LOG@." ) #:def_opt( "KCL_FLAG", "kcl-flag|kclflag", "CP", \ "joblist", \ @@ -15039,6 +15183,10 @@ "", \ "" ) +#:def_cmd_opt( "HELP", "MAX_WIDTH", \ + "", \ + "" ) + #:def_cmd_opt( "TEST", "VERBOSE", \ "", \ "Print the matrices of transformations." ) @@ -16926,6 +17074,12 @@ "Define the terminal width (number of columns) for help and some other" \ " messages and disable the automatic detection of the terminal width." ) +#:def_opt( "MAX_WIDTH", "max-width|maxwidth", "GP", \ + "maxwidth", \ + "Define the maximum terminal width (number of columns) for help and" \ + " some other messages and disable the automatic detection of the" \ + " terminal width. This option is ignored if {--width} is set." ) + #:def_opt( "QUIET", "q|quiet", "GM", \ "", \ "Be quiet and print only error messages. Multiple usage is possible." \ @@ -17259,7 +17413,8 @@ " @FAST, NEW, CENTER, ROUND, NORMALS, MTL, WIIMM, TRIANGLES, OUT-SWAP," \ " G, USEMTL, CLIP, IN-SWAP, AUTO, HEX4, HEX23, HEX, DROP-UNUSED," \ " DROP-FIXED, DROP-INVALID, DROP, RM-FACEDOWN, RM-FACEUP, FIX-ALL," \ - " CONV-FACEUP, WEAK-WALLS, SORT, INPLACE, SILENT@ and @LOG@." ) + " TINY-0 ... TINY-7, CONV-FACEUP, WEAK-WALLS, SORT, INPLACE, SILENT@" \ + " and @LOG@." ) #:def_opt( "KCL_FLAG", "kcl-flag|kclflag", "CP", \ "joblist", \ @@ -17329,7 +17484,8 @@ " RIGHT, WIDE, NARROW, FIX-CKPH, FIX-ENPH, FIX-ITPH, FIX-PH," \ " FIX-CKNEXT, FIX-CKJGPT, FIX-CK, FIX-ALL, MASK-PFLAGS, RM-LECODE," \ " PURGE-GOBJ, FULL-DEFOBJ, DUMP-CLASS, DUMP-ONEWAY, DUMP-ALL, 1LAP ..." \ - " 9LAPS, MAX-LAPS, RM-EMPTY, INPLACE, SILENT@ and @LOG@." ) + " 9LAPS, MAX-LAPS, RM-EMPTY, TINY-0 ... TINY-7, INPLACE, SILENT@ and" \ + " @LOG@." ) #:def_opt( "SPEED_MOD", "speed-mod|speedmod", "GP", \ "factor", \ @@ -17560,6 +17716,10 @@ "", \ "" ) +#:def_cmd_opt( "HELP", "MAX_WIDTH", \ + "", \ + "" ) + #:def_cmd_opt( "TEST", "VERBOSE", \ "", \ "Print the matrices of transformations." ) @@ -17891,6 +18051,10 @@ "", \ "" ) +#:def_cmd_opt( "OBJECTS", "MAX_WIDTH", \ + "", \ + "" ) + #:def_cmd_opt( "OBJECTS", "NO_HEADER", \ "", \ "" ) @@ -18945,6 +19109,12 @@ "Define the terminal width (number of columns) for help and some other" \ " messages and disable the automatic detection of the terminal width." ) +#:def_opt( "MAX_WIDTH", "max-width|maxwidth", "GP", \ + "maxwidth", \ + "Define the maximum terminal width (number of columns) for help and" \ + " some other messages and disable the automatic detection of the" \ + " terminal width. This option is ignored if {--width} is set." ) + #:def_opt( "QUIET", "q|quiet", "GM", \ "", \ "Be quiet and print only error messages. Multiple usage is possible." \ @@ -19338,6 +19508,10 @@ "", \ "" ) +#:def_cmd_opt( "HELP", "MAX_WIDTH", \ + "", \ + "" ) + #:def_cmd_opt( "COLORS", "COLORS", \ "", \ "" ) @@ -20141,6 +20315,12 @@ "Define the terminal width (number of columns) for help and some other" \ " messages and disable the automatic detection of the terminal width." ) +#:def_opt( "MAX_WIDTH", "max-width|maxwidth", "GP", \ + "maxwidth", \ + "Define the maximum terminal width (number of columns) for help and" \ + " some other messages and disable the automatic detection of the" \ + " terminal width. This option is ignored if {--width} is set." ) + #:def_opt( "QUIET", "q|quiet", "GM", \ "", \ "Be quiet and print only error messages. Multiple usage is possible." \ @@ -20502,6 +20682,10 @@ "", \ "" ) +#:def_cmd_opt( "HELP", "MAX_WIDTH", \ + "", \ + "" ) + #:def_cmd_opt( "TEST", "VERBOSE", \ "", \ "Print the matrices of transformations." ) @@ -21361,6 +21545,12 @@ "Define the terminal width (number of columns) for help and some other" \ " messages and disable the automatic detection of the terminal width." ) +#:def_opt( "MAX_WIDTH", "max-width|maxwidth", "GP", \ + "maxwidth", \ + "Define the maximum terminal width (number of columns) for help and" \ + " some other messages and disable the automatic detection of the" \ + " terminal width. This option is ignored if {--width} is set." ) + #:def_opt( "QUIET", "q|quiet", "GM", \ "", \ "Be quiet and print only error messages. Multiple usage is possible." \ @@ -21569,6 +21759,10 @@ "", \ "" ) +#:def_cmd_opt( "HELP", "MAX_WIDTH", \ + "", \ + "" ) + #:def_cmd_opt( "COLORS", "COLORS", \ "", \ "" ) @@ -21923,6 +22117,12 @@ "Define the terminal width (number of columns) for help and some other" \ " messages and disable the automatic detection of the terminal width." ) +#:def_opt( "MAX_WIDTH", "max-width|maxwidth", "GP", \ + "maxwidth", \ + "Define the maximum terminal width (number of columns) for help and" \ + " some other messages and disable the automatic detection of the" \ + " terminal width. This option is ignored if {--width} is set." ) + #:def_opt( "QUIET", "q|quiet", "GM", \ "", \ "Be quiet and print only error messages. Multiple usage is possible." \ @@ -22440,6 +22640,10 @@ "", \ "" ) +#:def_cmd_opt( "HELP", "MAX_WIDTH", \ + "", \ + "" ) + #:def_cmd_opt( "COLORS", "COLORS", \ "", \ "" ) diff --git a/project/src/ui/ui.h b/project/src/ui/ui.h index 8f43684..72b5a90 100644 --- a/project/src/ui/ui.h +++ b/project/src/ui/ui.h @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/src/wbmgt.c b/project/src/wbmgt.c index 23ffec3..a7f1cfc 100644 --- a/project/src/wbmgt.c +++ b/project/src/wbmgt.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -767,6 +767,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_ALLOW_ALL: allow_all = true; break; case GO_COMPATIBLE: err += ScanOptCompatible(optarg); break; case GO_WIDTH: err += ScanOptWidth(optarg); break; + case GO_MAX_WIDTH: err += ScanOptMaxWidth(optarg); break; case GO_QUIET: verbose = verbose > -1 ? -1 : verbose - 1; break; case GO_VERBOSE: verbose = verbose < 0 ? 0 : verbose + 1; break; case GO_LOGGING: logging++; break; diff --git a/project/src/wctct.c b/project/src/wctct.c index 6220f09..adc80c9 100644 --- a/project/src/wctct.c +++ b/project/src/wctct.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -744,6 +744,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_ALLOW_ALL: allow_all = true; break; case GO_COMPATIBLE: err += ScanOptCompatible(optarg); break; case GO_WIDTH: err += ScanOptWidth(optarg); break; + case GO_MAX_WIDTH: err += ScanOptMaxWidth(optarg); break; case GO_QUIET: verbose = verbose > -1 ? -1 : verbose - 1; break; case GO_VERBOSE: verbose = verbose < 0 ? 0 : verbose + 1; break; case GO_LOGGING: logging++; break; diff --git a/project/src/wimgt.c b/project/src/wimgt.c index 674b1ac..820a812 100644 --- a/project/src/wimgt.c +++ b/project/src/wimgt.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -580,6 +580,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_ALLOW_ALL: allow_all = true; break; case GO_COMPATIBLE: err += ScanOptCompatible(optarg); break; case GO_WIDTH: err += ScanOptWidth(optarg); break; + case GO_MAX_WIDTH: err += ScanOptMaxWidth(optarg); break; case GO_QUIET: verbose = verbose > -1 ? -1 : verbose - 1; break; case GO_VERBOSE: verbose = verbose < 0 ? 0 : verbose + 1; break; case GO_LOGGING: logging++; break; diff --git a/project/src/wkclt.c b/project/src/wkclt.c index 8be86b4..c85b0d1 100644 --- a/project/src/wkclt.c +++ b/project/src/wkclt.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -986,7 +986,7 @@ static void analyze_kcl ( kcl_t *kcl ) } float *f = td->normal->v; - uint nf = sizeof(td->normal)/sizeof(float); + uint nf = sizeof(td->normal->v)/sizeof(*f); for ( ; nf > 0; nf--, f++ ) { if ( n_min > *f ) n_min = *f; @@ -1120,6 +1120,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_ALLOW_ALL: allow_all = true; break; case GO_COMPATIBLE: err += ScanOptCompatible(optarg); break; case GO_WIDTH: err += ScanOptWidth(optarg); break; + case GO_MAX_WIDTH: err += ScanOptMaxWidth(optarg); break; case GO_QUIET: verbose = verbose > -1 ? -1 : verbose - 1; break; case GO_VERBOSE: verbose = verbose < 0 ? 0 : verbose + 1; break; case GO_LOGGING: logging++; break; diff --git a/project/src/wkmpt.c b/project/src/wkmpt.c index 29e1c83..1a4040b 100644 --- a/project/src/wkmpt.c +++ b/project/src/wkmpt.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -1576,6 +1576,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_ALLOW_ALL: allow_all = true; break; case GO_COMPATIBLE: err += ScanOptCompatible(optarg); break; case GO_WIDTH: err += ScanOptWidth(optarg); break; + case GO_MAX_WIDTH: err += ScanOptMaxWidth(optarg); break; case GO_QUIET: verbose = verbose > -1 ? -1 : verbose - 1; break; case GO_VERBOSE: verbose = verbose < 0 ? 0 : verbose + 1; break; case GO_LOGGING: logging++; break; diff --git a/project/src/wlect.c b/project/src/wlect.c index 7a02f5e..6e38f3b 100644 --- a/project/src/wlect.c +++ b/project/src/wlect.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -709,14 +709,15 @@ static enumError cmd_create() "Possible keywords:\n" " LEX : Create a with all sections except »TEST«.\n" " LEX+ : Create a complete LEX text file.\n" - " SET1 : Create a LEX text files with section »SET1« only.\n" - " CANNON : Create a LEX text files with section »CANN« only.\n" - " TEST : Create a LEX text files with section »TEST« only.\n" + " SET1 : Create a LEX text file with section »SET1« only.\n" + " CANNON : Create a LEX text file with section »CANN« only.\n" + " TEST : Create a LEX text file with section »TEST« only.\n" " LPAR : Create a LPAR text file as template.\n" #if HAVE_WIIMM_EXT "\n" "Hidden keyword:\n" - " DEVELOP : Like LEX+, but include all devoloper sections.\n" + " FEATURES : Create a LEX text file with section »FEA0« only.\n" + " DEVELOP : Like LEX+, but include all devoloper sections.\n" #endif "\n",stderr); @@ -726,12 +727,13 @@ static enumError cmd_create() //--- data - enum { C_LEX, C_SET1, C_CANNON, C_HIDE_PT, C_TEST, C_LPAR }; + enum { C_LEX, C_FEATURES, C_SET1, C_CANNON, C_HIDE_PT, C_TEST, C_LPAR }; static const KeywordTab_t tab[] = { { C_LEX, "LEX", 0, 0 }, { C_LEX, "LEX+", 0, 1 }, { C_LEX, "DEVELOP", 0, 2 }, + { C_FEATURES, "FEATURES", 0, 0 }, { C_SET1, "SET1", 0, 0 }, { C_CANNON, "CANNON", 0, 0 }, { C_HIDE_PT, "HIPT", 0, 0 }, @@ -763,7 +765,17 @@ static enumError cmd_create() InitializeLEX(&lex); lex.develop = cmd->opt > 1; UpdateLEX(&lex,true,cmd->opt>0); - PatchLEX(&lex); + PatchLEX(&lex,0); + err = SaveTextLEX(&lex,"-",false); + ResetLEX(&lex); + } + break; + + case C_FEATURES: + { + lex_t lex; + InitializeLEX(&lex); + AppendFea0LEX(&lex,false,0); err = SaveTextLEX(&lex,"-",false); ResetLEX(&lex); } @@ -1044,6 +1056,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_ALLOW_ALL: allow_all = true; break; case GO_COMPATIBLE: err += ScanOptCompatible(optarg); break; case GO_WIDTH: err += ScanOptWidth(optarg); break; + case GO_MAX_WIDTH: err += ScanOptMaxWidth(optarg); break; case GO_QUIET: verbose = verbose > -1 ? -1 : verbose - 1; break; case GO_VERBOSE: verbose = verbose < 0 ? 0 : verbose + 1; break; case GO_LOGGING: logging++; break; @@ -1124,6 +1137,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_LT_GAME_MODE: err += ScanOptLtGameMode(optarg); break; case GO_LT_ENGINE: err += ScanOptLtEngine(optarg); break; case GO_LT_RANDOM: err += ScanOptLtRandom(optarg); break; + case GO_LEX_RM_FEAT: opt_lex_rm_features = true; break; case GO_LEX_PURGE: opt_lex_purge = true; break; #if 0 // BMG disabled for wlect diff --git a/project/src/wmdlt.c b/project/src/wmdlt.c index 9109f5c..d35799c 100644 --- a/project/src/wmdlt.c +++ b/project/src/wmdlt.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -537,6 +537,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_ALLOW_ALL: allow_all = true; break; case GO_COMPATIBLE: err += ScanOptCompatible(optarg); break; case GO_WIDTH: err += ScanOptWidth(optarg); break; + case GO_MAX_WIDTH: err += ScanOptMaxWidth(optarg); break; case GO_QUIET: verbose = verbose > -1 ? -1 : verbose - 1; break; case GO_VERBOSE: verbose = verbose < 0 ? 0 : verbose + 1; break; case GO_LOGGING: logging++; break; diff --git a/project/src/wpatt.c b/project/src/wpatt.c index a5b9905..f551399 100644 --- a/project/src/wpatt.c +++ b/project/src/wpatt.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -346,6 +346,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_ALLOW_ALL: allow_all = true; break; case GO_COMPATIBLE: err += ScanOptCompatible(optarg); break; case GO_WIDTH: err += ScanOptWidth(optarg); break; + case GO_MAX_WIDTH: err += ScanOptMaxWidth(optarg); break; case GO_QUIET: verbose = verbose > -1 ? -1 : verbose - 1; break; case GO_VERBOSE: verbose = verbose < 0 ? 0 : verbose + 1; break; case GO_LOGGING: logging++; break; diff --git a/project/src/wstrt.c b/project/src/wstrt.c index 442249e..fddb894 100644 --- a/project/src/wstrt.c +++ b/project/src/wstrt.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -1175,6 +1175,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_ALLOW_ALL: allow_all = true; break; case GO_COMPATIBLE: err += ScanOptCompatible(optarg); break; case GO_WIDTH: err += ScanOptWidth(optarg); break; + case GO_MAX_WIDTH: err += ScanOptMaxWidth(optarg); break; case GO_QUIET: verbose = verbose > -1 ? -1 : verbose - 1; break; case GO_VERBOSE: verbose = verbose < 0 ? 0 : verbose + 1; break; case GO_LOGGING: logging++; break; diff --git a/project/src/wszst.c b/project/src/wszst.c index b7836d5..8bc93ea 100644 --- a/project/src/wszst.c +++ b/project/src/wszst.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -976,6 +976,37 @@ enumError cmd_subfile() // /////////////////////////////////////////////////////////////////////////////// +/////////////// command _TESTNORM /////////////// +/////////////////////////////////////////////////////////////////////////////// + +void PrintNorm ( const szs_norm_t *norm ) +{ + if ( !norm || !norm->f ) + return; + + +} + +/////////////////////////////////////////////////////////////////////////////// + +void SetupNormByOptions ( szs_norm_t *norm ) +{ + DASSERT(norm); + memset(norm,0,sizeof(*norm)); + memset(norm->modified,'-',SZI__N); +} + +/////////////////////////////////////////////////////////////////////////////// + +enumError cmd_testnorm() +{ + if (!first_param) + return ERR_OK; + + return ERR_OK; +} + +/////////////////////////////////////////////////////////////////////////////// /////////////// command BRSUB /////////////// /////////////////////////////////////////////////////////////////////////////// // [[check_brsub_t]] @@ -1860,7 +1891,10 @@ static void SetupPrintScript ( PrintScript_t *ps ) InitializePrintScript(ps); ps->varname = script_varname; + ps->force_case = opt_case; ps->create_array = script_array > 0; + ps->ena_empty = brief_count < 2 ; + ps->ena_comments = brief_count < 1 ; switch(script_fform) { @@ -2000,9 +2034,12 @@ static enumError cmd_analyze() "used_pos_suggest=\"%s\"\n" "ktpt2=\"%s %4.2f %4.2f\"\n" "gobj=\"%s\"\n" - "special_kmp=\"%s\"\n" "special_files=\"%s\"\n" + "original_files=\"%s\"\n" + "modified_files=\"%s\"\n" + "special_kmp=\"%s\"\n" "lex_sections=\"%s\"\n" + "lex_features=\"%s\"\n" "warn=\"%u=%s\"\n" "ct_attributes=\"%s\"\n" "name_attributes=\"%.*s\"\n" @@ -2047,9 +2084,12 @@ static enumError cmd_analyze() ,as.kmp_finish.distance ,as.kmp_finish.dir_delta ,as.gobj_info - ,CreateSpecialInfoKMP(szs.kmp_special,true,"") - ,CreateSpecialFileInfo(&szs,true,"") - ,CreateSectionInfoLEX(szs.have_lex,true,"") + ,CreateSpecialFileInfo(&szs,~(1<<HFM_NONE),true,"") + ,CreateSpecialFileInfo(&szs,1<<HFM_ORIGINAL,true,"") + ,CreateSpecialFileInfo(&szs,1<<HFM_MODIFIED,true,"") + ,CreateSpecialInfoKMP(szs.have.kmp,true,"") + ,CreateSectionInfoLEX(szs.have.lex_sect,true,"") + ,CreateFeatureInfoLEX(szs.have.lex_feat,true,"") ,szs.warn_bits,GetWarnSZSNames(szs.warn_bits,' ') ,as.ct_attrib+1 ,name_attrib_len,name_attrib @@ -2092,6 +2132,125 @@ static enumError cmd_analyze() // /////////////////////////////////////////////////////////////////////////////// +/////////////// command features /////////////// +/////////////////////////////////////////////////////////////////////////////// + +static enumError cmd_features() +{ + static ccp def_path = "\1P/\1F\1?T"; + CheckOptDest("-",false); + char dest[PATH_MAX]; + enumError max_err = ERR_OK; + if (!strcmp(opt_dest,"-")) + fputc('\n',stdout); + + szs_file_t szs; + InitializeSZS(&szs); + + analyse_szs_t as; + InitializeAnalyseSZS(&as); + + features_szs_t fs; + InitializeFeaturesSZS(&fs); + const int comments = brief_count > 0 ? -brief_count : long_count; + + File_t fo; + InitializeFile(&fo); + + PrintScript_t ps; + SetupPrintScript(&ps); + if ( ps.fform == PSFF_UNKNOWN && comments >= 0 ) + ps.fform = PSFF_ASSIGN; + + ParamList_t *param; + for ( param = first_param; param; param = param->next ) + { + NORMALIZE_FILENAME_PARAM(param); + + ResetSZS(&szs); + enumError err = LoadCreateSZS(&szs,param->arg,true,opt_ignore>0,true); + if ( err == ERR_NOT_EXISTS || err > ERR_WARNING && opt_ignore ) + continue; + if ( err > ERR_WARNING ) + { + if ( max_err < err ) + max_err = err; + continue; + } + + if (!fo.f) + SubstDest(dest,sizeof(dest),param->arg,opt_dest,def_path, + GetExtFF(script_fform,0),false); + + if ( verbose > 0 ) + { + fprintf(stdlog,"%sANALYZE %s:%s => %s:%s\n", + verbose > 0 ? "\n" : "", + GetNameFF(szs.fform_file,szs.fform_arch), szs.fname, + GetNameFF(script_fform,0), dest ); + fflush(stdlog); + } + + + //--- analyse szs + + AnalyseSZS(&as,false,&szs,param->arg); + SetupFeaturesSZS(&fs,&as.have,false); + + + //--- status + + if ( err >= ERR_WARNING ) + { + if ( max_err < err ) + max_err = err; + continue; + } + + if (!fo.f) + { + enumError err = CreateFile(&fo,false,dest,FM_STDIO|FM_OVERWRITE); + if (err) + { + max_err = err; + break; + } + ps.f = fo.f; + PrintScriptHeader(&ps); + } + + + //--- name attributes ('dest' can be used now) + + PrintEscapedString(dest,sizeof(dest),param->arg,-1,CHMD_UTF8,'"',0); + + + //--- print result + + PrintScriptVars(&ps,1,"file=\"%s\"\n",dest); + PrintFeaturesSZS( &ps, &fs, false, comments, + opt_pmodes, opt_fmodes_include, opt_fmodes_exclude ); + PutScriptVars(&ps,2,0); + + if (!script_array) + { + PrintScriptFooter(&ps); + ps.f = 0; + ResetFile(&fo,0); + } + } + + PrintScriptFooter(&ps); + ResetPrintScript(&ps); + ResetFile(&fo,0); + ResetFeaturesSZS(&fs); + ResetAnalyseSZS(&as); + ResetSZS(&szs); + return max_err; +} + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// command distribution /////////////// /////////////////////////////////////////////////////////////////////////////// @@ -4945,6 +5104,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_ALLOW_ALL: allow_all = true; break; case GO_COMPATIBLE: err += ScanOptCompatible(optarg); break; case GO_WIDTH: err += ScanOptWidth(optarg); break; + case GO_MAX_WIDTH: err += ScanOptMaxWidth(optarg); break; case GO_QUIET: verbose = verbose > -1 ? -1 : verbose - 1; break; case GO_VERBOSE: verbose = verbose < 0 ? 0 : verbose + 1; break; case GO_LOGGING: logging++; break; @@ -5020,6 +5180,8 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_LT_GAME_MODE: err += ScanOptLtGameMode(optarg); break; case GO_LT_ENGINE: err += ScanOptLtEngine(optarg); break; case GO_LT_RANDOM: err += ScanOptLtRandom(optarg); break; + case GO_LEX_FEATURES: opt_lex_features = true; break; + case GO_LEX_RM_FEAT: opt_lex_rm_features = true; break; case GO_LEX_PURGE: opt_lex_purge = true; break; case GO_UTF_8: use_utf8 = true; break; @@ -5078,6 +5240,9 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_VAR: script_varname = optarg; break; case GO_ARRAY: script_array++; break; case GO_AVAR: script_array++; script_varname = optarg; break; + case GO_CASE: err += ScanOptCase(optarg); break; + case GO_PMODES: opt_pmodes++; break; + case GO_FMODES: err += ScanOptFModes(optarg); break; case GO_PT_DIR: err += ScanOptPtDir(optarg); break; case GO_LINKS: opt_links = true; break; @@ -5262,6 +5427,7 @@ static enumError CheckCommand ( int argc, char ** argv ) case CMD_CODE: err = cmd_code(); break; case CMD_RECODE: err = cmd_recode(); break; case CMD_SUBFILE: err = cmd_subfile(); break; + case CMD_TESTNORM: err = cmd_testnorm(); break; case CMD_LIST: err = cmd_list(0); break; case CMD_LIST_L: err = cmd_list(1); break; @@ -5283,6 +5449,7 @@ static enumError CheckCommand ( int argc, char ** argv ) case CMD_MEMORY_A: set_all(1); err = cmd_memory(); break; case CMD_SHA1: err = cmd_sha1(); break; case CMD_ANALYZE: err = cmd_analyze(); break; + case CMD_FEATURES: err = cmd_features(); break; case CMD_DISTRIBUTION: err = cmd_distribution(); break; case CMD_DIFF: err = cmd_diff(); break; diff --git a/project/src/wtest.c b/project/src/wtest.c index 8aadaab..361e08b 100644 --- a/project/src/wtest.c +++ b/project/src/wtest.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit https://szs.wiimm.de/ for project details and sources. * * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2021 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * @@ -4138,6 +4138,17 @@ int main ( int argc, char ** argv ) if (0) { + double3 d3; + double *d = d3.v; + printf("%zu/%zu=%zu\n",sizeof(d3.v),sizeof(*d),sizeof(d3.v)/sizeof(*d)); + + float3 f3; + float *f = f3.v; + printf("%zu/%zu=%zu\n",sizeof(f3.v),sizeof(*f),sizeof(f3.v)/sizeof(*f)); + } + + if (0) + { double34 x; x.m[0][0] = 10.0; x.m[1][1] = 20.0; |
