diff options
Diffstat (limited to '')
82 files changed, 6881 insertions, 2182 deletions
diff --git a/project/Makefile b/project/Makefile index 054688a..9071202 100644 --- a/project/Makefile +++ b/project/Makefile @@ -30,7 +30,6 @@ MYMAKE := $(lastword $(MAKEFILE_LIST)) -#SHELL = /bin/bash SHELL = /usr/bin/env bash AUTHOR = Dirk Clemens @@ -58,7 +57,7 @@ WPATT_LONG = Wiimms PAT Tool WSTRT_SHORT = wstrt WSTRT_LONG = Wiimms StaticR Tool -VERSION_NUM = 2.23a +VERSION_NUM = 2.24a BETA_VERSION = 0 # 0:off -1:"beta" >0:"beta#" @@ -106,6 +105,7 @@ VERSION_INT := $(shell sed 's/\.//g; s/[^0-9]/ /g; s/ .*//' <<< "$(VERSION_NUM)" DUMMY := $(shell $(SHELL) ./setup.sh $(VERSION) $(VERSION_NUM) $(VERSION_INT) ) include Makefile.setup +#DUMMY := $(shell echo "|$(SYSTEM)|$(SYSTEM2)|" >&2) #------------------------------------------------------------------------------ # include source library definitions @@ -118,7 +118,6 @@ include ./dclib/Makefile.inc PRE ?= CC = $(PRE)gcc -CPP = $(PRE)g++ STRIP = $(PRE)strip #------------------------------------------------------------------------------- @@ -145,7 +144,7 @@ DEFINES1 += -DDEBUG_ASSERT # enable ASSERTions in release version too DEFINES1 += -DEXTENDED_ERRORS=1 # enable extended error messages (function,line,file) DEFINES1 += -DUIOPT_INDEX_SIZE=310 # define max number of options (default 0x100) -CFLAGS += -fomit-frame-pointer -fno-strict-aliasing -funroll-loops +CFLAGS += -std=gnu99 -fomit-frame-pointer -fno-strict-aliasing -funroll-loops CFLAGS += -Wall -Wno-parentheses -Wno-unused-function CFLAGS += -Wno-deprecated-declarations CFLAGS += -O3 -Isrc -I$(UI) -I. @@ -215,6 +214,8 @@ else OPT_STATIC := endif +#DUMMY := $(shell echo "|$(SYSTEM)|$(SYSTEM2)|$(OPT_STATIC)" >&2) + #--------------- TOPT_wszst := $(OPT_STATIC) @@ -746,12 +747,16 @@ doc+: doc info .PHONY : flags flags: @echo "" + @echo "SYSTEM: |$(SYSTEM)|$(SYSTEM2)|" + @echo "" @echo "DEFINES: $(DEFINES)" @echo "" @echo "CFLAGS: $(CFLAGS)" @echo "" @echo "LDFLAGS: $(LDFLAGS)" @echo "" + @echo "OPT_STATIC: $(OPT_STATIC)" + @echo "" @echo "LIBS: $(LIBS)" @echo "" @echo "C_OBJECTS: $(C_OBJECTS)" diff --git a/project/dclib/dclib-basics.c b/project/dclib/dclib-basics.c index 7504951..bf0496c 100644 --- a/project/dclib/dclib-basics.c +++ b/project/dclib/dclib-basics.c @@ -34,11 +34,6 @@ #define _GNU_SOURCE 1 -#ifndef WIN_SZS_LIB - // needed for GetTermWidthFD() - #include <sys/ioctl.h> -#endif - #include <string.h> #include <unistd.h> #include <time.h> @@ -47,6 +42,7 @@ #include <errno.h> #include <sys/time.h> #include <fcntl.h> +#include <sys/ioctl.h> #include "dclib-basics.h" #include "dclib-debug.h" @@ -302,6 +298,21 @@ int GetProgramPath { char path[PATH_MAX], path2[PATH_MAX]; +#ifdef __APPLE__ + + //--- read apple path of executable + + extern int _NSGetExecutablePath( char* buf, uint32_t * bufsize ); + + uint32_t size = sizeof(path); + if (!_NSGetExecutablePath(path,&size)) + { + if ( realpath(path,path2) && *path2 ) + return StringCopyS(buf,buf_size,path2) - buf; + return StringCopyS(buf,buf_size,path) - buf; + } + +#else // !__APPLE__ //--- read files of /proc/... @@ -321,6 +332,8 @@ int GetProgramPath return StringCopyS(buf,buf_size,path) - buf; } +#endif // !__APPLE__ + //--- analyze argv0 @@ -377,9 +390,9 @@ int GetProgramPath void FreeString ( ccp str ) { - noTRACE("FreeString(%p) EmptyString=%p MinusString=%p\n", - str, EmptyString, MinusString ); - if ( str != EmptyString && str != EmptyQuote && str != MinusString ) + noTRACE("FreeString(%p) EmptyString=%p MinusString=%p, IsCircBuf=%d\n", + str, EmptyString, MinusString, IsCircBuf(str) ); + if ( str != EmptyString && str != EmptyQuote && str != MinusString && !IsCircBuf(str) ) FREE((char*)str); } @@ -506,19 +519,18 @@ char * StringCat3S ( char * buf, size_t buf_size, ccp src1, ccp src2, ccp src3 ) } /////////////////////////////////////////////////////////////////////////////// -// [[?]] -char * StringCat2A ( ccp src1, ccp src2 ) +char * StringCat2A ( ccp src1, ccp src2 ) { - mem_t mem = MemCat2A( MemByString(src1), MemByString(src2) ); + mem_t mem = MemCat2A( MemByString0(src1), MemByString0(src2) ); return (char*)mem.ptr; } //----------------------------------------------------------------------------- -char * StringCat3A ( ccp src1, ccp src2, ccp src3 ) +char * StringCat3A ( ccp src1, ccp src2, ccp src3 ) { - mem_t mem = MemCat3A( MemByString(src1), MemByString(src2), MemByString(src3) ); + mem_t mem = MemCat3A( MemByString0(src1), MemByString0(src2), MemByString0(src3) ); return (char*)mem.ptr; } @@ -1554,9 +1566,16 @@ static char *circ_ptr = circ_buf; /////////////////////////////////////////////////////////////////////////////// +bool IsCircBuf ( cvp ptr ) +{ + return ptr && (ccp)ptr >= circ_buf && (ccp)ptr < circ_buf + sizeof(circ_buf); +} + +/////////////////////////////////////////////////////////////////////////////// + char * GetCircBuf ( - // never returns NULL, but always ALIGN(4) + // Never returns NULL, but always ALIGN(4) u32 buf_size // wanted buffer size, caller must add 1 for NULL-term // if buf_size > CIRC_BUF_MAX_ALLOC: @@ -1591,7 +1610,7 @@ char * GetCircBuf char * CopyCircBuf ( - // never returns NULL, but always ALIGN(4) + // Never returns NULL, but always ALIGN(4) cvp data, // source to copy u32 data_size // see GetCircBuf() @@ -1606,8 +1625,8 @@ char * CopyCircBuf char * CopyCircBuf0 ( - // never returns NULL, but always ALIGN(4) - // an additional char is alloced and set to NULL + // Like CopyCircBuf(), but an additional char is alloced and set to NULL + // Never returns NULL, but always ALIGN(4). cvp data, // source to copy u32 data_size // see GetCircBuf() @@ -1623,6 +1642,8 @@ char * CopyCircBuf0 char * PrintCircBuf ( + // returns CopyCircBuf0() or EmptyString. + ccp format, // format string for vsnprintf() ... // arguments for 'format' ) @@ -1638,6 +1659,51 @@ char * PrintCircBuf /////////////////////////////////////////////////////////////////////////////// +char * AllocCircBuf +( + // Never returns NULL. Call FreeString(RESULT) to free possible alloced memory. + + cvp src, // NULL or source + int src_len, // len of 'src'; if -1: use strlen(source) + bool try_circ // use circ-buffer, if result is small enough +) +{ + if (!src) + return (char*)EmptyString; + + if ( src_len < 0 ) + src_len = strlen(src); + + return try_circ && src_len <= CIRC_BUF_MAX_ALLOC + ? CopyCircBuf(src,src_len) + : MEMDUP(src,src_len); +} + +/////////////////////////////////////////////////////////////////////////////// + +char * AllocCircBuf0 +( + // Never returns NULL. Call FreeString(RESULT) to free possible alloced memory. + // Like AllocCircBuf(), but an additional char is alloced and set to NULL + + cvp src, // NULL or source + int src_len, // len of 'src'; if -1: use strlen(source) + bool try_circ // use circ-buffer, if result is small enough +) +{ + if (!src) + return (char*)EmptyString; + + if ( src_len < 0 ) + src_len = strlen(src); + + return try_circ && src_len < CIRC_BUF_MAX_ALLOC + ? CopyCircBuf0(src,src_len) + : MEMDUP(src,src_len); // MEMDUP() always add 0-term +} + +/////////////////////////////////////////////////////////////////////////////// + void ReleaseCircBuf ( ccp end_buf, // pointer to end of previous alloced buffer @@ -2408,26 +2474,186 @@ mem_t MemCat3A ( const mem_t m1, const mem_t m2, const mem_t m3 ) // /////////////////////////////////////////////////////////////////////////////// -/////////////// struct mem_list_t /////////////// +/////////////// struct exmem_t /////////////// + +exmem_t EmptyExMem = {{EmptyString,0},0,false,false,false,false}; +exmem_t NullExMem = {{0,0},0,false,false,false,false}; + /////////////////////////////////////////////////////////////////////////////// -void InitializeMemList ( mem_list_t *ml ) +void FreeExMem ( const exmem_t *em ) { - DASSERT(ml); - memset(ml,0,sizeof(*ml)); + if (em) + { + if (em->is_alloced) + FreeString(em->data.ptr); + memset((exmem_t*)em,0,sizeof(*em)); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +void FreeExMemCM ( const exmem_t *em, CopyMode_t copy_mode ) +{ + if ( em && copy_mode == CPM_MOVE ) + { + if (em->is_alloced) + FreeString(em->data.ptr); + memset((exmem_t*)em,0,sizeof(*em)); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +exmem_t AllocExMemS +( + cvp src, // NULL or source + int src_len, // len of 'src'; if -1: use strlen(source) + bool try_circ, // use circ-buffer, if result is small enough + cvp orig, // NULL or data to compare + int orig_len // len of 'orig'; if -1: use strlen(source) +) +{ + exmem_t em = {{0}}; + if (src) + { + if ( src_len < 0 ) + src_len = strlen(src); + if (!src_len) + em.data.ptr = EmptyString; + else + { + em.data.len = src_len; + if ( orig + && src_len == ( orig_len < 0 ? strlen(orig) : orig_len ) + && !memcmp(src,orig,src_len) + ) + { + em.data.ptr = orig; + em.is_original = true; + } + else if ( try_circ && src_len <= CIRC_BUF_MAX_ALLOC ) + { + em.data.ptr = CopyCircBuf(src,src_len); + em.is_circ_buf = true; + } + else + { + em.data.ptr = MEMDUP(src,src_len); + em.is_alloced = true; + } + } + } + + return em; } /////////////////////////////////////////////////////////////////////////////// +void AssignExMem ( exmem_t *dest, const exmem_t *source, CopyMode_t copy_mode ) +{ + if ( dest && dest != source ) + { + if (dest->is_alloced) + FreeString(dest->data.ptr); + const bool dest_key_alloced = dest->is_key_alloced; + if (source) + { + switch (copy_mode) + { + case CPM_COPY: + memset(dest,0,sizeof(*dest)); + dest->data.len = source->data.len; + dest->data.ptr = MEMDUP(source->data.ptr,source->data.len); + dest->is_alloced = true; + dest->attrib = source->attrib; + break; + + case CPM_MOVE: + *dest = *source; + memset((exmem_t*)source,0,sizeof(*source)); + break; + + case CPM_LINK: + *dest = *source; + dest->is_original = false; + dest->is_alloced = false; + break; + } + } + else + memset(dest,0,sizeof(*dest)); + dest->is_key_alloced = dest_key_alloced; + } +} + +/////////////////////////////////////////////////////////////////////////////// + +exmem_t CopyExMemS ( ccp string, int slen, CopyMode_t copy_mode ) +{ + exmem_t em = {{0}}; + + if (string) + { + em.data.len = slen < 0 ? strlen(string) : slen; + + switch (copy_mode) + { + case CPM_COPY: + em.data.ptr = MEMDUP(string,em.data.len); + em.is_alloced = true; + break; + + case CPM_MOVE: + em.is_alloced = true; + // fall through + case CPM_LINK: + em.data.ptr = string; + break; + } + } + + return em; +} + +/////////////////////////////////////////////////////////////////////////////// + +ccp PrintExMem ( const exmem_t * em ) // print to circ-buf +{ + if (!em) + return MinusString; + + char ebuf[60]; + uint len; + PrintEscapedString(ebuf,sizeof(ebuf),em->data.ptr,em->data.len,CHMD__MODERN,'"',&len); + + return PrintCircBuf( + "[%c%c%c%c:%x] %u/%u %s", + em->is_key_alloced ? 'a' : '-', // flags: same as in DumpEML() + em->is_alloced ? 'A' : '-', + em->is_circ_buf ? 'C' : '-', + em->is_original ? 'O' : '-', + em->attrib, + len, em->data.len, ebuf ); +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// struct mem_list_t /////////////// +/////////////////////////////////////////////////////////////////////////////// + void ResetMemList ( mem_list_t *ml ) { - DASSERT(ml); - FREE(ml->list); - FREE(ml->buf); - memset(ml,0,sizeof(*ml)); + if (ml) + { + FREE(ml->list); + FREE(ml->buf); + memset(ml,0,sizeof(*ml)); + } } /////////////////////////////////////////////////////////////////////////////// +// [[?]] void MoveMemList ( mem_list_t *dest, mem_list_t *src ) { @@ -2448,6 +2674,7 @@ void MoveMemList ( mem_list_t *dest, mem_list_t *src ) } /////////////////////////////////////////////////////////////////////////////// +// [[?]] void NeedBufMemList ( mem_list_t *ml, uint need_size, uint extra_size ) { @@ -2480,6 +2707,7 @@ void NeedBufMemList ( mem_list_t *ml, uint need_size, uint extra_size ) } /////////////////////////////////////////////////////////////////////////////// +// [[?]] void NeedElemMemList ( mem_list_t *ml, uint need_elem, uint need_size ) { @@ -2497,6 +2725,7 @@ void NeedElemMemList ( mem_list_t *ml, uint need_elem, uint need_size ) /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// +// [[?]] void InsertMemListN ( @@ -2643,6 +2872,7 @@ void InsertMemListN /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// +// [[?]] void CatMemListN ( @@ -2705,7 +2935,6 @@ void CatMemListN ? MALLOC(sizeof(*new_list)*need_elem) : dest->list; - //--- assign values char *bufptr = new_buf; @@ -2772,6 +3001,7 @@ void CatMemListN /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// +// [[?]] uint LeftMemList ( mem_list_t *ml, int count ) { @@ -2780,6 +3010,7 @@ uint LeftMemList ( mem_list_t *ml, int count ) } /////////////////////////////////////////////////////////////////////////////// +// [[?]] uint RightMemList ( mem_list_t *ml, int count ) { @@ -2795,6 +3026,7 @@ uint RightMemList ( mem_list_t *ml, int count ) } /////////////////////////////////////////////////////////////////////////////// +// [[?]] uint MidMemList ( mem_list_t *ml, int begin, int count ) { @@ -2820,6 +3052,7 @@ uint MidMemList ( mem_list_t *ml, int begin, int count ) } /////////////////////////////////////////////////////////////////////////////// +// [[?]] uint ExtractMemList ( mem_list_t *ml, int begin, int end ) { @@ -2830,6 +3063,7 @@ uint ExtractMemList ( mem_list_t *ml, int begin, int end ) } /////////////////////////////////////////////////////////////////////////////// +// [[?]] uint ExtractEndMemList ( mem_list_t *ml, int begin, int end ) { @@ -2840,6 +3074,7 @@ uint ExtractEndMemList ( mem_list_t *ml, int begin, int end ) } /////////////////////////////////////////////////////////////////////////////// +// [[?]] uint RemoveMemList ( mem_list_t *ml, int begin, int end ) { @@ -2850,6 +3085,7 @@ uint RemoveMemList ( mem_list_t *ml, int begin, int end ) } /////////////////////////////////////////////////////////////////////////////// +// [[?]] uint RemoveEndMemList ( mem_list_t *ml, int begin, int end ) { @@ -4797,10 +5033,11 @@ const KeywordTab_t KeyTab_OFF_AUTO_ON[] = //----------------------------------------------------------------------------- -int ScanKeywordOffAutoOn +int ScanKeywordOffAutoOnEx ( // returns one of OFFON_* + const KeywordTab_t *keytab, // Keyword table. If NULL, then use KeyTab_OFF_AUTO_ON[] ccp arg, // argument to scan int on_empty, // return this value on empty uint max_num, // >0: additionally accept+return number <= max_num @@ -4810,8 +5047,11 @@ int ScanKeywordOffAutoOn if ( !arg || !*arg ) return on_empty; + if (!keytab) + keytab = KeyTab_OFF_AUTO_ON; + int status; - const KeywordTab_t *key = ScanKeyword(&status,arg,KeyTab_OFF_AUTO_ON); + const KeywordTab_t *key = ScanKeyword(&status,arg,keytab); if (key) return key->id; @@ -4824,7 +5064,7 @@ int ScanKeywordOffAutoOn } if (object) - PrintKeywordError(KeyTab_OFF_AUTO_ON,arg,status,0,object); + PrintKeywordError(keytab,arg,status,0,object); return OFFON_ERROR; } @@ -5465,6 +5705,27 @@ void AppendStringField ( StringField_t * sf, ccp key, bool move_key ) /////////////////////////////////////////////////////////////////////////////// +void AppendUniqueStringField ( StringField_t * sf, ccp key, bool move_key ) +{ + DASSERT(sf); + if (!key) + return; + + ccp * src = sf->field; + ccp * end = sf->field + sf->used; + while ( src < end ) + if (!strcmp(*src++,key)) + { + if (move_key) + FreeString(key); + return; + } + + AppendStringField(sf,key,move_key); +} + +/////////////////////////////////////////////////////////////////////////////// + void SortStringField ( StringField_t * sf ) { DASSERT(sf); @@ -5719,11 +5980,8 @@ void RestoreStateStringField /////////////// ParamField_t /////////////// /////////////////////////////////////////////////////////////////////////////// -void InitializeParamField ( ParamField_t * pf ) -{ - DASSERT(pf); - memset(pf,0,sizeof(*pf)); -} +#undef PARAM_FIELD_GROW +#define PARAM_FIELD_GROW(s) (s)/4+100 /////////////////////////////////////////////////////////////////////////////// @@ -5812,7 +6070,7 @@ static ParamFieldItem_t * InsertParamFieldHelper ( ParamField_t * pf, int idx ) noPRINT("+SF: %u/%u/%u\n",idx,pf->used,pf->size); if ( pf->used == pf->size ) { - pf->size += 0x100; + pf->size += PARAM_FIELD_GROW(pf->size); pf->field = REALLOC(pf->field,pf->size*sizeof(*pf->field)); } DASSERT( idx <= pf->used ); @@ -5825,13 +6083,11 @@ static ParamFieldItem_t * InsertParamFieldHelper ( ParamField_t * pf, int idx ) /////////////////////////////////////////////////////////////////////////////// ParamFieldItem_t * FindInsertParamField - ( ParamField_t * pf, ccp key, bool move_key, bool *old_found ) + ( ParamField_t * pf, ccp key, bool move_key, uint num, bool *old_found ) { if (!key) return 0; - noTRACE("InsertParamField(%s,%x)\n",key,num); - bool found; int idx = FindParamFieldHelper(pf,&found,key); ParamFieldItem_t *item; @@ -5843,9 +6099,9 @@ ParamFieldItem_t * FindInsertParamField } else { - item = InsertParamFieldHelper(pf,idx); + item = InsertParamFieldHelper(pf,idx); item->key = move_key ? key : STRDUP(key); - item->num = 0; + item->num = num; item->data = 0; } @@ -5856,9 +6112,9 @@ ParamFieldItem_t * FindInsertParamField /////////////////////////////////////////////////////////////////////////////// -ParamFieldItem_t * CountParamField ( ParamField_t * pf, ccp key, bool move_key ) +ParamFieldItem_t * IncrementParamField ( ParamField_t * pf, ccp key, bool move_key ) { - ParamFieldItem_t *item = FindInsertParamField(pf,key,move_key,0); + ParamFieldItem_t *item = FindInsertParamField(pf,key,move_key,0,0); if (item) item->num++; return item; @@ -5896,35 +6152,6 @@ bool InsertParamField /////////////////////////////////////////////////////////////////////////////// -ParamFieldItem_t * InsertParamFieldEx - ( ParamField_t * pf, ccp key, bool move_key, uint num, bool *p_found ) -{ - if (!key) - return 0; - - noTRACE("InsertParamField(%s,%x)\n",key,num); - - bool found; - int idx = FindParamFieldHelper(pf,&found,key); - if (p_found) - *p_found = found; - - if (found) - { - if (move_key) - FreeString(key); - return pf->field + idx; - } - - ParamFieldItem_t * dest = InsertParamFieldHelper(pf,idx); - dest->key = move_key ? key : STRDUP(key); - dest->num = num; - dest->data = 0; - return dest; -} - -/////////////////////////////////////////////////////////////////////////////// - bool ReplaceParamField ( ParamField_t * pf, ccp key, bool move_key, uint num, cvp data ) { @@ -5987,7 +6214,7 @@ ParamFieldItem_t * AppendParamField noPRINT(">SF: %u/%u\n",pf->used,pf->size); if ( pf->used == pf->size ) { - pf->size += 0x100; + pf->size += PARAM_FIELD_GROW(pf->size); pf->field = REALLOC(pf->field,pf->size*sizeof(*pf->field)); } TRACE("AppendParamField(%s,%d) %d/%d\n",key,move_key,pf->used,pf->size); @@ -6044,6 +6271,569 @@ uint FindParamFieldHelper ( const ParamField_t * pf, bool * p_found, ccp key ) // /////////////////////////////////////////////////////////////////////////////// +/////////////// exmem_list_t /////////////// +/////////////////////////////////////////////////////////////////////////////// + +#undef EXMEM_LIST_GROW +#define EXMEM_LIST_GROW(s) (s)/2+50 + +//----------------------------------------------------------------------------- + +void ResetEML ( exmem_list_t * eml ) +{ + if (eml) + { + if ( eml->used > 0 ) + { + DASSERT(eml->list); + exmem_key_t *ptr = eml->list, *end; + for ( end = ptr + eml->used; ptr < end; ptr++ ) + { + if (ptr->data.is_key_alloced) + FreeString(ptr->key); + if (ptr->data.is_alloced) + FreeString(ptr->data.data.ptr); + } + } + FREE(eml->list); + + int (*func_cmp)( ccp s1, ccp s2 ) = eml->func_cmp; + InitializeEML(eml); + eml->func_cmp = func_cmp; + } +} + +/////////////////////////////////////////////////////////////////////////////// + +void MoveEML ( exmem_list_t * dest, exmem_list_t * src ) +{ + DASSERT(dest); + if ( src != dest ) + { + ResetEML(dest); + if (src) + { + *dest = *src; + InitializeEML(src); + } + } +} + +/////////////////////////////////////////////////////////////////////////////// + +uint FindHelperEML ( const exmem_list_t * eml, ccp key, bool * p_found ) +{ + DASSERT(eml); + + int (*cmp)( ccp s1, ccp s2 ) = eml->func_cmp ? eml->func_cmp : strcmp; + + if ( eml->is_unsorted ) + { + uint i; + exmem_key_t *ptr = eml->list; + for ( i = 0; i < eml->used; i++, ptr++ ) + if (!cmp(key,ptr->key)) + { + if (p_found) + *p_found = true; + return i; + } + + if (p_found) + *p_found = false; + return eml->used; + } + + int beg = 0; + if (key) + { + int end = eml->used - 1; + while ( beg <= end ) + { + const uint idx = (beg+end)/2; + const int stat = cmp(key,eml->list[idx].key); + if ( stat < 0 ) + end = idx - 1 ; + else if ( stat > 0 ) + beg = idx + 1; + else + { + noTRACE("FindHelperEML(%s) FOUND=%d/%d/%d\n", + key, idx, eml->used, eml->size ); + if (p_found) + *p_found = true; + return idx; + } + } + } + + noTRACE("FindHelperEML(%s) failed=%d/%d/%d\n", + key, beg, eml->used, eml->size ); + + if (p_found) + *p_found = false; + return beg; +} + +/////////////////////////////////////////////////////////////////////////////// + +int FindIndexEML ( const exmem_list_t * eml, ccp key, int not_found_value ) +{ + bool found; + const int idx = FindHelperEML(eml,key,&found); + return found ? idx : not_found_value; +} + +/////////////////////////////////////////////////////////////////////////////// + +exmem_key_t * FindEML ( const exmem_list_t * eml, ccp key ) +{ + bool found; + const int idx = FindHelperEML(eml,key,&found); + return found ? eml->list + idx : 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +exmem_key_t * FindAttribEML ( const exmem_list_t * eml, u32 attrib ) +{ + DASSERT(eml); + noTRACE("FindAttribEML(%x)\n",attrib); + + exmem_key_t *ptr = eml->list, *end; + for ( end = ptr + eml->used; ptr < end; ptr++ ) + if ( ptr->data.attrib == attrib ) + return ptr; + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +static exmem_key_t * InsertHelperEML + ( exmem_list_t * eml, int idx, + ccp key, CopyMode_t cm_key, + const exmem_t *data, CopyMode_t cm_data ) +{ + DASSERT(eml); + DASSERT( eml->used <= eml->size ); + noPRINT("+SF: %u/%u/%u\n",idx,eml->used,eml->size); + if ( eml->used == eml->size ) + { + eml->size += EXMEM_LIST_GROW(eml->size); + eml->list = REALLOC(eml->list,eml->size*sizeof(*eml->list)); + } + + DASSERT( idx <= eml->used ); + exmem_key_t * dest = eml->list + idx; + memmove(dest+1,dest,(eml->used-idx)*sizeof(*dest)); + eml->used++; + + dest->data = CopyExMem(data,cm_data); + dest->key = cm_key == CPM_COPY ? STRDUP(key) : key; + dest->data.is_key_alloced = cm_key != CPM_LINK; + + return dest; +} + +/////////////////////////////////////////////////////////////////////////////// + +exmem_key_t * FindInsertEML + ( exmem_list_t * eml, ccp key, CopyMode_t cm_key, bool *old_found ) +{ + if (!key) + return 0; + + bool found; + int idx = FindHelperEML(eml,key,&found); + exmem_key_t *item; + if (found) + { + if ( cm_key == CPM_MOVE ) + FreeString(key); + item = eml->list + idx; + } + else + item = InsertHelperEML(eml,idx,key,cm_key,0,0); + + if (old_found) + *old_found = found; + return item; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool InsertEML ( exmem_list_t * eml, ccp key, CopyMode_t cm_key, + const exmem_t *data, CopyMode_t cm_data ) +{ + DASSERT(eml); + + if (!key) + { + FreeExMemCM(data,cm_data); + return 0; + } + + bool found; + int idx = FindHelperEML(eml,key,&found); + if (found) + { + if ( cm_key == CPM_MOVE ) + FreeString(key); + FreeExMemCM(data,cm_data); + } + else + InsertHelperEML(eml,idx,key,cm_key,data,cm_data); + + return !found; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool ReplaceEML ( exmem_list_t * eml, ccp key, CopyMode_t cm_key, + const exmem_t *data, CopyMode_t cm_data ) +{ + DASSERT(eml); + + if (!key) + { + FreeExMemCM(data,cm_data); + return 0; + } + + bool found; + int idx = FindHelperEML(eml,key,&found); + if (found) + { + if ( cm_key == CPM_MOVE ) + FreeString(key); + + exmem_key_t * dest = eml->list + idx; + AssignExMem(&dest->data,data,cm_data); + } + else + InsertHelperEML(eml,idx,key,cm_key,data,cm_data); + + return !found; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool OverwriteEML ( exmem_list_t * eml, ccp key, CopyMode_t cm_key, + const exmem_t *data, CopyMode_t cm_data ) +{ + DASSERT(eml); + + if (!key) + { + FreeExMemCM(data,cm_data); + return 0; + } + + bool found; + int idx = FindHelperEML(eml,key,&found); + if (found) + { + if ( cm_key == CPM_MOVE ) + FreeString(key); + + exmem_key_t * dest = eml->list + idx; + AssignExMem(&dest->data,data,cm_data); + } + + return found; +} + +/////////////////////////////////////////////////////////////////////////////// + +exmem_key_t * AppendEML ( exmem_list_t * eml, ccp key, CopyMode_t cm_key, + const exmem_t *data, CopyMode_t cm_data ) +{ + DASSERT(eml); + + if (!key) + { + FreeExMemCM(data,cm_data); + return 0; + } + + if ( eml->used == eml->size ) + { + eml->size += EXMEM_LIST_GROW(eml->size); + eml->list = REALLOC(eml->list,eml->size*sizeof(*eml->list)); + } + TRACE("AppendEML(%s,%d) %d/%d\n",key,cm_key,eml->used,eml->size); + + exmem_key_t * dest = eml->list + eml->used++; + dest->data = CopyExMem(data,cm_data); + dest->key = cm_key == CPM_COPY ? STRDUP(key) : key; + dest->data.is_key_alloced = cm_key != CPM_LINK; + + eml->is_unsorted = true; + return dest; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool RemoveEML ( exmem_list_t * eml, ccp key ) +{ + bool found; + uint idx = FindHelperEML(eml,key,&found); + if (found) + { + DASSERT(eml->used); + eml->used--; + DASSERT( idx <= eml->used ); + exmem_key_t * dest = eml->list + idx; + if (dest->data.is_key_alloced) + FreeString(dest->key); + FreeExMem(&dest->data); + if (eml->used) + memmove(dest,dest+1,(eml->used-idx)*sizeof(*dest)); + else + eml->is_unsorted = false; + } + return found; +} + +/////////////////////////////////////////////////////////////////////////////// + +exmem_key_t * MatchEML ( const exmem_list_t * eml, ccp key ) +{ + DASSERT(eml); + if (key) + { + exmem_key_t *ptr = eml->list, *end; + for ( end = ptr + eml->used; ptr < end; ptr++ ) + if (MatchPattern(ptr->key,key,'/')) + return ptr; + } + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +void DumpEML ( FILE *f, int indent, const exmem_list_t * eml, ccp info ) +{ + if ( f && eml && eml->used ) + { + indent = NormalizeIndent(indent); + fprintf(f,"%*s%s%s" "exmem list %p, N=%u/%u%s\n", + indent,"", info ? info : "", info ? " : " : "", + eml, eml->used, eml->size, eml->is_unsorted ? ", not sorted" : "" ); + + char buf[20]; + const int fw_idx = indent + snprintf(buf,sizeof(buf),"%d",eml->used-1) + 1; + + exmem_key_t *ptr, *end = eml->list + eml->used; + int fw_key = 0; + for ( ptr = eml->list; ptr < end; ptr++ ) + { + if (ptr->key) + { + const int klen = strlen(ptr->key); + if ( fw_key < klen ) + fw_key = klen; + } + } + if ( fw_key > 30 ) + fw_key = 30; + + uint idx = 0; + for ( ptr = eml->list; ptr < end; ptr++, idx++ ) + fprintf(f,"%*d [%c%c%c%c] %-*s = [%x] %s\n", + fw_idx, idx, + ptr->data.is_key_alloced? 'a' : '-', // flags: same as in PrintExMem() + ptr->data.is_alloced ? 'A' : '-', + ptr->data.is_circ_buf ? 'C' : '-', + ptr->data.is_original ? 'O' : '-', + fw_key, ptr->key ? ptr->key : "", + ptr->data.attrib, ptr->data.data.ptr ); + } +} + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +exmem_t ResolveSymbolsEML ( const exmem_list_t * eml, ccp source ) +{ + exmem_t em = {{0}}; + + if (source) + { + char name[100]; + + int try; + for ( try = 0; try < 50; try++ ) + { + ccp p1 = strstr(source,"$("); + if (!p1) + continue; + ccp p2 = strchr(p1,')'); + if (!p2) + break; + + const int plen = p2 - p1 - 2; + DASSERT(plen>=0); + + StringCopySM(name,sizeof(name),p1+2,plen); + const exmem_key_t *ref = FindEML(eml,name); + mem_t replace = ref ? ref->data.data : NullMem; + + char *temp = MEMDUP3(source, p1-source, + replace.ptr, replace.len, + p2+1, strlen(p2+1) ); + if (em.is_alloced) + FreeString(source); + source = temp; + em.is_alloced = true; + } + } + + em.data.ptr = source; + em.data.len = strlen(source); + em.is_original = !em.is_alloced; + return em; +} + +/////////////////////////////////////////////////////////////////////////////// + +uint ResolveAllSymbolsEML ( exmem_list_t * eml ) +{ + ASSERT(eml); + int try, count = 0; + char name[100]; + exmem_key_t *ptr, *end = eml->list + eml->used; + + for ( try = 0; try < 20; try++ ) + { + int try_again = 0; + + for ( ptr = eml->list; ptr < end; ptr++ ) + { + for( int try2 = 0; try2 < 10; try2++ ) + { + ccp str = ptr->data.data.ptr; + if (!str) + break; + + ccp p1 = strstr(str,"$("); + if (!p1) + break; + ccp p2 = strchr(p1,')'); + if (!p2) + break; + const int plen = p2 - p1 - 2; + ASSERT(plen>=0); + + StringCopySM(name,sizeof(name),p1+2,plen); + const exmem_key_t *ref = FindEML(eml,name); + mem_t replace = ref && ref != ptr ? ref->data.data : NullMem; + + char *temp = MEMDUP3( str, p1-str, + replace.ptr, replace.len, + p2+1, strlen(p2+1) ); + if (ptr->data.is_alloced) + FreeString(str); + ASSERT(temp); + ptr->data.data.ptr = temp; + ptr->data.data.len = strlen(temp); + ptr->data.is_alloced = true; + ptr->data.is_original = ptr->data.is_circ_buf = false; + try_again++; + count++; + } + } + + if (!try_again) + break; + } + return count; +} + +/////////////////////////////////////////////////////////////////////////////// + +// add symbols 'home', 'etc', 'install' = 'prog' and 'cwd' +void AddStandardSymbolsEML ( exmem_list_t * eml, bool overwrite ) +{ + DASSERT(eml); + + char buf[PATH_MAX]; + bool (*func)(exmem_list_t*,ccp,CopyMode_t,const exmem_t*,CopyMode_t) + = overwrite ? ReplaceEML : InsertEML; + PRINT0("overwrite=%d, func=%p, ins=%p, repl=%p\n",overwrite,func,InsertEML,ReplaceEML); + + exmem_t temp = ExMemByString("/etc"); + func(eml,"etc",CPM_LINK,&temp,CPM_LINK); + + ccp home = getenv("HOME"); + temp = ExMemByString0(home); + func(eml,"home",CPM_LINK,&temp,CPM_COPY); + + // https://wiki.archlinux.org/index.php/XDG_Base_Directory + ccp xdg = getenv("XDG_CONFIG_HOME"); + if ( xdg && *xdg ) + { + temp = ExMemByString0(xdg); + ccp colon = strchr(xdg,':'); + if (colon) + { + if ( colon == xdg ) + goto xdg_home; + temp.data.len = colon - xdg; + } + func(eml,"xdg_home",CPM_LINK,&temp,CPM_COPY); + } + else if (home) + { + xdg_home:; + xdg = PathCatPP(buf,sizeof(buf),home,".config"); + temp = ExMemByString0(xdg); + func(eml,"xdg_home",CPM_LINK,&temp,CPM_COPY); + } + + xdg = getenv("XDG_CONFIG_DIRS"); + if ( xdg && *xdg ) + { + temp = ExMemByString0(xdg); + ccp colon = strchr(xdg,':'); + if (colon) + { + if ( colon == xdg ) + goto xdg_etc; + temp.data.len = colon - xdg; + } + func(eml,"xdg_etc",CPM_LINK,&temp,CPM_COPY); + } + else + { + xdg_etc:; + temp = ExMemByString("/etc/xdg"); + func(eml,"xdg_etc",CPM_LINK,&temp,CPM_LINK); + } + + ccp install = ProgramDirectory(); + temp = ExMemByString0(install); + func(eml,"install",CPM_LINK,&temp,CPM_COPY); + func(eml,"prog",CPM_LINK,&temp,CPM_COPY); + + if (getcwd(buf,sizeof(buf))) + { + temp = ExMemByString0(buf); + func(eml,"cwd",CPM_LINK,&temp,CPM_COPY); + } + + #ifdef __CYGWIN__ + ccp prog_files = getenv("PROGRAMFILES"); + if ( !prog_files || !*prog_files ) + prog_files = "C:/Program Files"; + temp = GetNormalizeFilenameCygwin(prog_files,true); + func(eml,"programfiles",CPM_LINK,&temp,CPM_COPY); + FreeExMem(&temp); + #endif +} + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// Memory Maps /////////////// /////////////////////////////////////////////////////////////////////////////// diff --git a/project/dclib/dclib-basics.h b/project/dclib/dclib-basics.h index c5395f6..5412d52 100644 --- a/project/dclib/dclib-basics.h +++ b/project/dclib/dclib-basics.h @@ -629,6 +629,40 @@ uint GetTextBOMLen ( const void * data, uint data_size ); // /////////////////////////////////////////////////////////////////////////////// +/////////////// CopyMode_t /////////////// +/////////////////////////////////////////////////////////////////////////////// +// [[CopyMode_t]] + +typedef enum CopyMode_t +{ + CPM_COPY, // make a copy of the data, alloced + CPM_MOVE, // move the alloced data + CPM_LINK, // link the data + +} CopyMode_t; + +/////////////////////////////////////////////////////////////////////////////// + +void * CopyData +( + const void *data, // data to copy/move/link + uint size, // size of 'data' + CopyMode_t mode, // copy mode + bool *res_alloced // not NULL: + // store true, if data must be freed + // otherwise store false +); + +/////////////////////////////////////////////////////////////////////////////// + +void FreeData +( + const void *data, // data to free + CopyMode_t mode // copy mode +); + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// struct mem_t /////////////// /////////////////////////////////////////////////////////////////////////////// // [[mem_t]] @@ -640,8 +674,8 @@ typedef struct mem_t } mem_t; -extern mem_t EmptyMem; // mem_t(EmptyString,0) -extern mem_t NullMem; // mem_t(0,0) +extern mem_t EmptyMem; // mem_t(EmptyString,0) +extern mem_t NullMem; // mem_t(0,0) //----------------------------------------------------------------------------- @@ -651,6 +685,7 @@ static inline mem_t MemByChar ( char ch ) return mem; } +// NULL allowed static inline mem_t MemByString0 ( ccp str ) { if (!str) @@ -660,18 +695,21 @@ static inline mem_t MemByString0 ( ccp str ) return mem; } +// NULL forbidden static inline mem_t MemByString ( ccp str ) { mem_t mem = { str, strlen(str) }; return mem; } +// NULL forbidden if len<0 static inline mem_t MemByStringS ( ccp str, int len ) { mem_t mem = { str, len < 0 ? strlen(str) : len }; return mem; } +// NULL forbidden if end=0 static inline mem_t MemByStringE ( ccp str, ccp end ) { mem_t mem = { str, end ? end-str : strlen(str) }; @@ -792,6 +830,103 @@ static inline char * DupStrMem ( const mem_t src ) // /////////////////////////////////////////////////////////////////////////////// +/////////////// struct exmem_t /////////////// +/////////////////////////////////////////////////////////////////////////////// +// [[exmem_t]] + +typedef struct exmem_t +{ + mem_t data; // pointer and size of data + u32 attrib; // user defined attribute + bool is_original; // true: 'data' is a copy of source + bool is_circ_buf; // true: 'data' is part of circ-buf + bool is_alloced; // true: 'data' is alloced (not circ-buf) + bool is_key_alloced; // true: external key is alloced +} +exmem_t; + +extern exmem_t EmptyExMem; // mem_t(EmptyString,0),false,false +extern exmem_t NullExMem; // mem_t(0,0),false,false + +//----------------------------------------------------------------------------- +// constructors + +static inline exmem_t ExMemByChar ( char ch ) +{ + exmem_t em = { .data={ &ch, 1 }, .is_original=true }; + return em; +} + +static inline exmem_t ExMemByString0 ( ccp str ) +{ + if (!str) + return NullExMem; + + exmem_t em = { .data={ str, strlen(str) }, .is_original=true }; + return em; +} + +static inline exmem_t ExMemByString ( ccp str ) +{ + exmem_t em = { .data={ str, str ? strlen(str) : 0 }, .is_original=true }; + return em; +} + +static inline exmem_t ExMemByStringS ( ccp str, int len ) +{ + exmem_t em = { .data={ str, !str ? 0 : len < 0 ? strlen(str) : len }, .is_original=true }; + return em; +} + +static inline exmem_t ExMemByStringE ( ccp str, ccp end ) +{ + exmem_t em = { .data={ str, !str ? 0 : end ? end-str : strlen(str) }, .is_original=true }; + return em; +} + +static inline exmem_t ExMemByS ( ccp str, int len ) +{ + exmem_t em = { .data={ str, len }, .is_original=true }; + return em; +} + +static inline exmem_t ExMemByE ( ccp str, ccp end ) +{ + exmem_t em = { .data={ str, end-str }, .is_original=true }; + return em; +} + +//----------------------------------------------------------------------------- +// interface + +// 'em' maybe modified ignoring 'const' +void FreeExMem ( const exmem_t *em ); +void FreeExMemCM ( const exmem_t *em, CopyMode_t copy_mode ); // free if CPM_MOVE + +exmem_t AllocExMemS +( + cvp src, // NULL or source + int src_len, // len of 'src'; if -1: use strlen(source) + bool try_circ, // use circ-buffer, if result is small enough + cvp orig, // NULL or data to compare + int orig_len // len of 'orig'; if -1: use strlen(source) +); + +static inline exmem_t AllocExMemM ( mem_t src, bool try_circ, mem_t orig ) + { return AllocExMemS(src.ptr,src.len,try_circ,orig.ptr,orig.len); } + +void AssignExMem ( exmem_t *dest, const exmem_t *source, CopyMode_t copy_mode ); +static inline exmem_t CopyExMem ( const exmem_t *source, CopyMode_t copy_mode ) + { exmem_t em = {{0}}; AssignExMem(&em,source,copy_mode); return em; } + +exmem_t CopyExMemS ( ccp string, int slen, CopyMode_t copy_mode ); +static inline exmem_t CopyExMemM ( const mem_t source, CopyMode_t copy_mode ) + { return CopyExMemS(source.ptr,source.len,copy_mode); } + +ccp PrintExMem ( const exmem_t * em ); // print to circ-buf + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// struct mem_list_t /////////////// /////////////////////////////////////////////////////////////////////////////// // [[mem_list_t]] @@ -825,7 +960,9 @@ mem_list_mode_t; //----------------------------------------------------------------------------- -void InitializeMemList ( mem_list_t *ml ); +static inline void InitializeMemList ( mem_list_t *ml ) + { DASSERT(ml); memset(ml,0,sizeof(*ml)); } + void ResetMemList ( mem_list_t *ml ); void MoveMemList ( mem_list_t *dest, mem_list_t *src ); @@ -1037,39 +1174,6 @@ uint PurgeCircBuf ( CircBuf_t *cb ); // /////////////////////////////////////////////////////////////////////////////// -/////////////// CopyMode_t /////////////// -/////////////////////////////////////////////////////////////////////////////// - -typedef enum CopyMode_t -{ - CPM_COPY, // make a copy of the data, alloced - CPM_MOVE, // move the alloced data - CPM_LINK, // link the data - -} CopyMode_t; - -/////////////////////////////////////////////////////////////////////////////// - -void * CopyData -( - const void *data, // data to copy/move/link - uint size, // size of 'data' - CopyMode_t mode, // copy mode - bool *res_alloced // not NULL: - // store true, if data must be freed - // otherwise store false -); - -/////////////////////////////////////////////////////////////////////////////// - -void FreeData -( - const void *data, // data to free - CopyMode_t mode // copy mode -); - -// -/////////////////////////////////////////////////////////////////////////////// /////////////// split strings /////////////// /////////////////////////////////////////////////////////////////////////////// @@ -1192,7 +1296,7 @@ ccp ProgramDirectory(void); void DefineLogDirectory ( ccp path0, bool force ); // get 'ProgInfo.logdir' without tailing '/' ("." as fall back) -ccp GetLogDirectory(); +ccp GetLogDirectory(void); #ifdef __CYGWIN__ ccp ProgramPathNoExt(void); @@ -1264,7 +1368,7 @@ ccp PathAllocPPE ( ccp path1, ccp path2, ccp ext ); static inline ccp PathCatPPE ( char *buf, size_t bufsize, ccp path1, ccp path2, ccp ext ) { return PathCatBufPPE(buf,bufsize,path1,path2,ext); } -// Same as PathCatPP*(), but use 'base' as prefix for relative pathes. +// Same as PathCatPP*(), but use 'base' as prefix for relative paths. // If 'base' is NULL (but not empty), use getcwd() instead. // PathCatBufBP() and PathCatBP() are special: path can be part of buf char *PathCatBufBP ( char *buf, size_t bufsize, ccp base, ccp path ); @@ -1389,9 +1493,12 @@ char * PrintID #define CIRC_BUF_MAX_ALLOC 0x0400 // request limit #define CIRC_BUF_SIZE 0x4000 // internal buffer size +// returns true if 'ptr' points into circ buffer => ignored by FreeString() +bool IsCircBuf ( cvp ptr ); + char * GetCircBuf ( - // never returns NULL, but always ALIGN(4) + // Never returns NULL, but always ALIGN(4) u32 buf_size // wanted buffer size, caller must add 1 for NULL-term // if buf_size > CIRC_BUF_MAX_ALLOC: @@ -1400,7 +1507,7 @@ char * GetCircBuf char * CopyCircBuf ( - // never returns NULL, but always ALIGN(4) + // Never returns NULL, but always ALIGN(4) cvp data, // source to copy u32 data_size // see GetCircBuf() @@ -1408,8 +1515,8 @@ char * CopyCircBuf char * CopyCircBuf0 ( - // never returns NULL, but always ALIGN(4) - // an additional char is alloced and set to NULL + // Like CopyCircBuf(), but an additional char is alloced and set to NULL + // Never returns NULL, but always ALIGN(4). cvp data, // source to copy u32 data_size // see GetCircBuf() @@ -1417,11 +1524,32 @@ char * CopyCircBuf0 char * PrintCircBuf ( + // returns CopyCircBuf0() or EmptyString. + ccp format, // format string for vsnprintf() ... // arguments for 'format' ) __attribute__ ((__format__(__printf__,1,2))); +char * AllocCircBuf +( + // Never returns NULL. Call FreeString(RESULT) to free possible alloced memory. + + cvp src, // NULL or source + int src_len, // len of 'src'; if -1: use strlen(source) + bool try_circ // use circ-buffer, if result is small enough +); + +char * AllocCircBuf0 +( + // Never returns NULL. Call FreeString(RESULT) to free possible alloced memory. + // Like AllocCircBuf(), but an additional char is alloced and set to NULL + + cvp src, // NULL or source + int src_len, // len of 'src'; if -1: use strlen(source) + bool try_circ // use circ-buffer, if result is small enough +); + void ReleaseCircBuf ( ccp end_buf, // pointer to end of previous alloced buffer @@ -2171,6 +2299,7 @@ typedef enum CharMode_t // select encodig/decoding method CHMD_UTF8 = 0x01, // UTF8 support enabled (compatible with legacy bool) CHMD_ESC = 0x02, // escape ESC by \e + CHMD__MODERN = CHMD_UTF8 | CHMD_ESC, CHMD__ALL = CHMD_UTF8 | CHMD_ESC, } __attribute__ ((packed)) CharMode_t; @@ -2233,13 +2362,25 @@ extern ccp TableDecode64default, TableEncode64default; /////////////////////////////////////////////////////////////////////////////// +uint GetEscapedSize +( + // returns the needed buffer size for PrintEscapedString() + + ccp source, // NULL or string to print + int src_len, // length of string. if -1, str is null terminated + CharMode_t char_mode, // modes, bit field (CHMD_*) + char quote // NULL or quotation char, that must be quoted +); + +//----------------------------------------------------------------------------- + char * PrintEscapedString ( // returns 'buf' char *buf, // valid destination buffer uint buf_size, // size of 'buf', >= 10 - ccp source, // NULL string to print + ccp source, // NULL or string to print int len, // length of string. if -1, str is null terminated CharMode_t char_mode, // modes, bit field (CHMD_*) char quote, // NULL or quotation char, that must be quoted @@ -2250,7 +2391,7 @@ char * PrintEscapedString uint ScanEscapedString ( - // returns the number of valid bytes in 'buf' (NULL term not counted) + // returns the number of valid bytes in 'buf' (NULL term added but not counted) char *buf, // valid destination buffer, maybe source uint buf_size, // size of 'buf' @@ -2540,6 +2681,71 @@ ccp GetShiftJISStatistics(void); // /////////////////////////////////////////////////////////////////////////////// +/////////////// escape/quote strings, alloc space /////////////// +/////////////////////////////////////////////////////////////////////////////// + +char * EscapeString +( + // Returns a pointer. + // Use FreeString(result) to free possible alloced result. + // circ-buffer is ignored by FreeString(). + + cvp src, // NULL or source + int src_len, // size of 'src'. If -1: Use strlen(src) + cvp return_if_null, // return this, if 'src==NULL' + cvp return_if_empty, // return this, if src is empty (have no chars) + CharMode_t char_mode, // how to escape + char quote, // quoting character: " or ' or $ (for $'...') + bool try_circ, // use circ-buffer, if result is small enough + uint *dest_len // not NULL: Store length of result here +); + +//----------------------------------------------------------------------------- + +static inline char * EscapeStringM ( mem_t src, cvp if_null, CharMode_t cm ) + { return EscapeString(src.ptr,src.len,if_null,EmptyString,cm,0,false,0); } + +static char * EscapeStringS ( ccp src, cvp if_null, CharMode_t cm ) + { return EscapeString(src,-1,if_null,EmptyString,cm,0,false,0); } + +//----------------------------------------------------------------------------- + +static inline char * EscapeStringCircM ( mem_t src, cvp if_null, CharMode_t cm ) + { return EscapeString(src.ptr,src.len,if_null,EmptyString,cm,0,true,0); } + +static char * EscapeStringCircS ( ccp src, cvp if_null, CharMode_t cm ) + { return EscapeString(src,-1,if_null,EmptyString,cm,0,true,0); } + +//----------------------------------------------------------------------------- + +static inline char * QuoteStringM ( mem_t src, cvp if_null, CharMode_t cm ) + { return EscapeString(src.ptr,src.len,if_null,EmptyQuote,cm,true,false,0); } + +static char * QuoteStringS ( ccp src, cvp if_null, CharMode_t cm ) + { return EscapeString(src,-1,if_null,EmptyQuote,cm,'"',false,0); } + +static inline char * QuoteBashM ( mem_t src, cvp if_null, CharMode_t cm ) + { return EscapeString(src.ptr,src.len,if_null,EmptyQuote,cm,'$',false,0); } + +static char * QuoteBashS ( ccp src, cvp if_null, CharMode_t cm ) + { return EscapeString(src,-1,if_null,EmptyQuote,cm,'$',false,0); } + +//----------------------------------------------------------------------------- + +static inline char * QuoteStringCircM ( mem_t src, cvp if_null, CharMode_t cm ) + { return EscapeString(src.ptr,src.len,if_null,EmptyQuote,cm,'"',true,0); } + +static char * QuoteStringCircS ( ccp src, cvp if_null, CharMode_t cm ) + { return EscapeString(src,-1,if_null,EmptyQuote,cm,'"',true,0); } + +static inline char * QuoteBashCircM ( mem_t src, cvp if_null, CharMode_t cm ) + { return EscapeString(src.ptr,src.len,if_null,EmptyQuote,cm,'$',true,0); } + +static char * QuoteBashCircS ( ccp src, cvp if_null, CharMode_t cm ) + { return EscapeString(src,-1,if_null,EmptyQuote,cm,'$',true,0); } + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// scan keywords /////////////// /////////////////////////////////////////////////////////////////////////////// @@ -2748,16 +2954,20 @@ OffOn_t; extern const KeywordTab_t KeyTab_OFF_AUTO_ON[]; -int ScanKeywordOffAutoOn +int ScanKeywordOffAutoOnEx ( // returns one of OFFON_* + const KeywordTab_t *keytab, // Keyword table. If NULL, then use KeyTab_OFF_AUTO_ON[] ccp arg, // argument to scan int on_empty, // return this value on empty uint max_num, // >0: additionally accept+return number <= max_num ccp object // NULL (silent) or object for error messages ); +static inline int ScanKeywordOffAutoOn( ccp arg, int on_empty, uint max_num, ccp object ) + { return ScanKeywordOffAutoOnEx(0,arg,on_empty,max_num,object); } + ccp GetKeywordOffAutoOn ( OffOn_t value ); // @@ -4393,9 +4603,12 @@ uint RemoveStringFieldByIndex ( StringField_t * sf, int index, int n ); // helper function ccp * InsertStringFieldHelper ( StringField_t * sf, int idx ); -// append at the end an do not sort +// append at the end and do not sort void AppendStringField ( StringField_t * sf, ccp key, bool move_key ); +// append at the end if nor already exists, do not sort +void AppendUniqueStringField ( StringField_t * sf, ccp key, bool move_key ); + // re-sort field using sf->func_cmp() void SortStringField ( StringField_t * sf ); @@ -4484,7 +4697,9 @@ typedef struct ParamField_t //----------------------------------------------------------------------------- -void InitializeParamField ( ParamField_t * pf ); +static inline void InitializeParamField ( ParamField_t * pf ) + { DASSERT(pf); memset(pf,0,sizeof(*pf)); } + void ResetParamField ( ParamField_t * pf ); void MoveParamField ( ParamField_t * dest, ParamField_t * src ); @@ -4492,18 +4707,16 @@ int FindParamFieldIndex ( const ParamField_t * pf, ccp key, int not_found_value ParamFieldItem_t * FindParamField ( const ParamField_t * pf, ccp key ); ParamFieldItem_t * FindParamFieldByNum ( const ParamField_t * pf, uint num ); ParamFieldItem_t * FindInsertParamField - ( ParamField_t * pf, ccp key, bool move_key, bool *old_found ); -ParamFieldItem_t * CountParamField ( ParamField_t * pf, ccp key, bool move_key ); + ( ParamField_t * pf, ccp key, bool move_key, uint num, bool *old_found ); +ParamFieldItem_t * IncrementParamField ( ParamField_t * pf, ccp key, bool move_key ); +// Insert: Insert only if not found, Replace: Insert or replace data // return: true if item inserted/deleted bool InsertParamField ( ParamField_t * pf, ccp key, bool move_key, uint num, cvp data ); bool ReplaceParamField( ParamField_t * pf, ccp key, bool move_key, uint num, cvp data ); bool RemoveParamField ( ParamField_t * pf, ccp key ); -ParamFieldItem_t * InsertParamFieldEx - ( ParamField_t * pf, ccp key, bool move_key, uint num, bool *found ); - -// append at the end an do not sort +// append at the end and do not sort ParamFieldItem_t * AppendParamField ( ParamField_t * pf, ccp key, bool move_key, uint num, cvp data ); @@ -4515,6 +4728,81 @@ ParamFieldItem_t * MatchParamField ( const ParamField_t * pf, ccp key ); // /////////////////////////////////////////////////////////////////////////////// +/////////////// struct exmem_list_t /////////////// +/////////////////////////////////////////////////////////////////////////////// +// [[exmem_key_t]] + +typedef struct exmem_key_t +{ + ccp key; // string as main key => data.is_key_alloced + exmem_t data; // data +} +exmem_key_t; + +//----------------------------------------------------------------------------- +// [[exmem_list_t]] + +typedef struct exmem_list_t +{ + exmem_key_t *list; // data list + uint used; // number of used titles in the title field + uint size; // number of allocated pointers in 'field' + bool is_unsorted; // true: list is not sorted (Append() was used) + int (*func_cmp)( ccp s1, ccp s2 ); // compare function, default is strcmp() +} +exmem_list_t; + +//----------------------------------------------------------------------------- + +static inline void InitializeEML ( exmem_list_t * eml ) + { DASSERT(eml); memset(eml,0,sizeof(*eml)); } + +void ResetEML ( exmem_list_t * eml ); +void MoveEML ( exmem_list_t * dest, exmem_list_t * src ); + +// return the index of the (next) item +uint FindHelperEML ( const exmem_list_t * eml, ccp key, bool *found ); + +int FindIndexEML ( const exmem_list_t * eml, ccp key, int not_found_value ); +exmem_key_t * FindEML ( const exmem_list_t * eml, ccp key ); +exmem_key_t * FindAttribEML ( const exmem_list_t * eml, u32 attrib ); +exmem_key_t * FindInsertEML ( exmem_list_t * eml, ccp key, CopyMode_t cm_key, bool *old_found ); + +// Insert if not found, ignore othwerwise. Return true if item inserted +bool InsertEML ( exmem_list_t * eml, ccp key, CopyMode_t cm_key, + const exmem_t *data, CopyMode_t cm_data ); + +// Insert or replace content. Return true if item inserted +bool ReplaceEML ( exmem_list_t * eml, ccp key, CopyMode_t cm_key, + const exmem_t *data, CopyMode_t cm_data ); + +// Replace content if found. Return true if item found +bool OverwriteEML ( exmem_list_t * eml, ccp key, CopyMode_t cm_key, + const exmem_t *data, CopyMode_t cm_data ); + +// Append at the end and do not sort +exmem_key_t * AppendEML ( exmem_list_t * eml, ccp key, CopyMode_t cm_key, + const exmem_t *data, CopyMode_t cm_data ); + +// Return true if item found and removed +bool RemoveEML ( exmem_list_t * eml, ccp key ); + + +// find first pattern that matches +exmem_key_t * MatchEML ( const exmem_list_t * eml, ccp key ); + +void DumpEML ( FILE *f, int indent, const exmem_list_t * eml, ccp info ); + +//----------------------------------------------------------------------------- + +exmem_t ResolveSymbolsEML ( const exmem_list_t * eml, ccp source ); +uint ResolveAllSymbolsEML ( exmem_list_t * eml ); + +// add symbols 'home', 'etc', 'install' = 'prog' and 'cwd' +void AddStandardSymbolsEML ( exmem_list_t * eml, bool overwrite ); + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// Memory Map /////////////// /////////////////////////////////////////////////////////////////////////////// // [[MemMapItem_t]] diff --git a/project/dclib/dclib-cli.c b/project/dclib/dclib-cli.c index d2b16f3..b49ba99 100644 --- a/project/dclib/dclib-cli.c +++ b/project/dclib/dclib-cli.c @@ -315,13 +315,16 @@ enumError Command_COLORS if ( level < 0 ) { + ccp term = getenv("TERM"); + if (!term) + term = "?"; printf("%s--color=%d [%s], colorize=%d [%s]\n" "term=%s\n" "stdout: tty=%d, mode=%d [%s], have-color=%d, n-colors=%u%s\n", colout->status, opt_colorize, GetColorModeName(opt_colorize,"?"), colorize_stdout, GetColorModeName(colorize_stdout,"?"), - getenv("TERM"), isatty(fileno(stdout)), + term, isatty(fileno(stdout)), colout->col_mode, GetColorModeName(colout->col_mode,"?"), colout->colorize, colout->n_colors, colout->reset ); return ERR_OK; diff --git a/project/dclib/dclib-color.c b/project/dclib/dclib-color.c index 601a920..07e8625 100644 --- a/project/dclib/dclib-color.c +++ b/project/dclib/dclib-color.c @@ -3316,19 +3316,29 @@ const ColorSet_t * GetColorSetAuto ( bool force_on ) if ( auto_mode == COLMD_AUTO ) { + char *term = getenv("TERM"); + + #ifdef __CYGWIN__ + if (!term) + term = "cygwin"; + #else + if (!term) + term = "vt100"; + #endif + int error; - setupterm(getenv("TERM"),1,&error); + setupterm(term,1,&error); const int ncol = tigetnum("colors"); auto_mode = ncol >= 256 ? COLMD_256_COLORS : ncol >= 8 ? COLMD_8_COLORS : COLMD_OFF; - if ( auto_mode == COLMD_OFF && !strcmp(getenv("TERM"),"cygwin") ) + if ( auto_mode == COLMD_OFF && !strcmp(term,"cygwin") ) auto_mode = COLMD_8_COLORS; #ifdef TEST fprintf(stderr,">>> GetColorSetAuto(%d) => \"%s\" n=%d => %d [%s]\n", - force_on, getenv("TERM"), ncol, + force_on, term, ncol, auto_mode, GetColorModeName(auto_mode,0) ); #endif } diff --git a/project/dclib/dclib-debug.c b/project/dclib/dclib-debug.c index 9dfbd5e..7017608 100644 --- a/project/dclib/dclib-debug.c +++ b/project/dclib/dclib-debug.c @@ -1019,6 +1019,52 @@ void * dclib_memdup ( MPARAM const void * src, size_t copylen ) /////////////////////////////////////////////////////////////////////////////// +void * dclib_memdup2 ( MPARAM cvp src1, size_t len1, cvp src2, size_t len2 ) +{ + char *res = dclib_malloc( MCALL len1+len2+1); + char *dest = res; + if (len1) + { + memcpy(dest,src1,len1); + dest += len1; + } + if (len2) + { + memcpy(dest,src2,len2); + dest += len2; + } + *dest = 0; + return res; +} + +/////////////////////////////////////////////////////////////////////////////// + +void * dclib_memdup3 + ( MPARAM cvp src1, size_t len1, cvp src2, size_t len2, cvp src3, size_t len3 ) +{ + char *res = dclib_malloc( MCALL len1+len2+len3+1); + char *dest = res; + if (len1) + { + memcpy(dest,src1,len1); + dest += len1; + } + if (len2) + { + memcpy(dest,src2,len2); + dest += len2; + } + if (len3) + { + memcpy(dest,src3,len3); + dest += len3; + } + *dest = 0; + return res; +} + +/////////////////////////////////////////////////////////////////////////////// + void * dclib_allocdup ( MPARAM const void * src, size_t copylen ) { char * dest = dclib_malloc( MCALL copylen); @@ -1026,6 +1072,29 @@ void * dclib_allocdup ( MPARAM const void * src, size_t copylen ) return dest; } +/////////////////////////////////////////////////////////////////////////////// + +char * dclib_printdup ( MPARAM ccp format, ... ) +{ + char buf[2000]; + + va_list arg; + va_start(arg,format); + const int stat = vsnprintf(buf,sizeof(buf),format,arg) + 1; + va_end(arg); + + char * dest = dclib_malloc( MCALL stat ); + if ( stat <= sizeof(buf) ) + memcpy(dest,buf,stat); + else + { + va_start(arg,format); + vsnprintf(dest,stat,format,arg); + va_end(arg); + } + return dest; +} + // /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// @@ -1511,6 +1580,54 @@ void * trace_memdup /////////////////////////////////////////////////////////////////////////////// +void * trace_memdup2 ( ccp func, ccp file, uint line, + cvp src1, size_t len1, cvp src2, size_t len2 ) +{ + char *res = trace_malloc(func,file,line,len1+len2+1); + char *dest = res; + + if (len1) + { + memcpy(dest,src1,len1); + dest += len1; + } + if (len2) + { + memcpy(dest,src2,len2); + dest += len2; + } + *dest = 0; + return res; +} + +/////////////////////////////////////////////////////////////////////////////// + +void * trace_memdup3 ( ccp func, ccp file, uint line, + cvp src1, size_t len1, cvp src2, size_t len2, cvp src3, size_t len3 ) +{ + char *res = trace_malloc(func,file,line,len1+len2+len3+1); + char *dest = res; + if (len1) + { + memcpy(dest,src1,len1); + dest += len1; + } + if (len2) + { + memcpy(dest,src2,len2); + dest += len2; + } + if (len3) + { + memcpy(dest,src3,len3); + dest += len3; + } + *dest = 0; + return res; +} + +/////////////////////////////////////////////////////////////////////////////// + void * trace_allocdup ( ccp func, ccp file, uint line, const void * src, size_t copylen ) { @@ -1519,6 +1636,30 @@ void * trace_allocdup return dest; } +/////////////////////////////////////////////////////////////////////////////// + +char * trace_printdup + ( ccp func, ccp file, uint line, ccp format, ... ) +{ + char buf[2000]; + + va_list arg; + va_start(arg,format); + const int stat = vsnprintf(buf,sizeof(buf),format,arg) + 1; + va_end(arg); + + char * dest = trace_malloc(func,file,line,stat); + if ( stat <= sizeof(buf) ) + memcpy(dest,buf,stat); + else + { + va_start(arg,format); + vsnprintf(dest,stat,format,arg); + va_end(arg); + } + return dest; +} + // /////////////////////////////////////////////////////////////////////////////// /////////////// mem check /////////////// diff --git a/project/dclib/dclib-debug.h b/project/dclib/dclib-debug.h index 2fc6e77..5851141 100644 --- a/project/dclib/dclib-debug.h +++ b/project/dclib/dclib-debug.h @@ -607,6 +607,9 @@ void * dclib_xmalloc ( size_t size ); void * dclib_xrealloc ( void * ptr, size_t size ); char * dclib_xstrdup ( ccp src ); +// HINT: the *memdup* functions always alloc 1 additonal byte and set it to NULL. + + #if TRACE_ALLOC_MODE > 1 void * dclib_calloc ( ccp,ccp,uint, size_t nmemb, size_t size ); void * dclib_malloc ( ccp,ccp,uint, size_t size ); @@ -614,8 +617,11 @@ char * dclib_xstrdup ( ccp src ); char * dclib_strdup ( ccp,ccp,uint, ccp src ); char * dclib_strdup2 ( ccp,ccp,uint, ccp src1, ccp src2 ); char * dclib_strdup3 ( ccp,ccp,uint, ccp src1, ccp src2, ccp src3 ); - void * dclib_memdup ( ccp,ccp,uint, const void * src, size_t copylen ); - void * dclib_allocdup( ccp,ccp,uint, const void * src, size_t copylen ); + void * dclib_memdup ( ccp,ccp,uint, cvp src, size_t copylen ); + void * dclib_memdup2 ( ccp,ccp,uint, cvp s1, size_t l1, cvp s2, size_t l2 ); + void * dclib_memdup3 ( ccp,ccp,uint, cvp s1, size_t l1, cvp s2, size_t l2, cvp s3, size_t l3 ); + void * dclib_allocdup( ccp,ccp,uint, cvp src, size_t copylen ); + char * dclib_printdup( ccp,ccp,uint, ccp format, ... ) __attribute__ ((__format__(__printf__,4,5))); #else void * dclib_calloc ( size_t nmemb, size_t size ); void * dclib_malloc ( size_t size ); @@ -623,8 +629,11 @@ char * dclib_xstrdup ( ccp src ); char * dclib_strdup ( ccp src ); char * dclib_strdup2 ( ccp src1, ccp src2 ); char * dclib_strdup3 ( ccp src1, ccp src2, ccp src3 ); - void * dclib_memdup ( const void * src, size_t copylen ); - void * dclib_allocdup( const void * src, size_t copylen ); + void * dclib_memdup ( cvp src, size_t copylen ); + void * dclib_memdup2 ( cvp s1, size_t l1, cvp s2, size_t l2 ); + void * dclib_memdup3 ( cvp s1, size_t l1, cvp s2, size_t l2, cvp s3, size_t l3 ); + void * dclib_allocdup( cvp src, size_t copylen ); + char * dclib_printdup( ccp format, ... ) __attribute__ ((__format__(__printf__,1,2))); #endif uint trace_test_alloc ( ccp,ccp,uint, const void * ptr, bool hexdump ); @@ -635,8 +644,11 @@ void * trace_realloc ( ccp,ccp,uint, void *ptr, size_t size ); char * trace_strdup ( ccp,ccp,uint, ccp src ); char * trace_strdup2 ( ccp,ccp,uint, ccp src1, ccp src2 ); char * trace_strdup3 ( ccp,ccp,uint, ccp src1, ccp src2, ccp src3 ); -void * trace_memdup ( ccp,ccp,uint, const void * src, size_t copylen ); -void * trace_allocdup ( ccp,ccp,uint, const void * src, size_t copylen ); +void * trace_memdup ( ccp,ccp,uint, cvp src, size_t copylen ); +void * trace_memdup2 ( ccp,ccp,uint, cvp s1, size_t l1, cvp s2, size_t l2 ); +void * trace_memdup3 ( ccp,ccp,uint, cvp s1, size_t l1, cvp s2, size_t l2, cvp s3, size_t l3 ); +void * trace_allocdup ( ccp,ccp,uint, cvp src, size_t copylen ); +char * trace_printdup ( ccp,ccp,uint, ccp format, ... ) __attribute__ ((__format__(__printf__,4,5))); #if TRACE_ALLOC_MODE > 2 void InitializeTraceAlloc(void); @@ -658,7 +670,10 @@ void * trace_allocdup ( ccp,ccp,uint, const void * src, size_t copylen ); #define STRDUP2(src1,src2) trace_strdup2(__FUNCTION__,__FILE__,__LINE__,src1,src2) #define STRDUP3(src1,src2,src3) trace_strdup3(__FUNCTION__,__FILE__,__LINE__,src1,src2,src3) #define MEMDUP(src,size) trace_memdup(__FUNCTION__,__FILE__,__LINE__,src,size) + #define MEMDUP2(s1,l1,s2,l2) trace_memdup2(__FUNCTION__,__FILE__,__LINE__,s1,l1,s2,l2) + #define MEMDUP3(s1,l1,s2,l2,s3,l3) trace_memdup3(__FUNCTION__,__FILE__,__LINE__,s1,l1,s2,l2,s3,l3) #define ALLOCDUP(src,size) trace_allocdup(__FUNCTION__,__FILE__,__LINE__,src,size) + #define PRINTDUP(...) trace_printdup(__FUNCTION__,__FILE__,__LINE__,__VA_ARGS__) #define INIT_TRACE_ALLOC InitializeTraceAlloc() #define CHECK_TRACE_ALLOC CheckTraceAlloc(__FUNCTION__,__FILE__,__LINE__) #define DUMP_TRACE_ALLOC(f) DumpTraceAlloc(__FUNCTION__,__FILE__,__LINE__,f) @@ -672,7 +687,10 @@ void * trace_allocdup ( ccp,ccp,uint, const void * src, size_t copylen ); #define STRDUP2(src1,src2) dclib_strdup2(__FUNCTION__,__FILE__,__LINE__,src1,src2) #define STRDUP3(src1,src2,src3) dclib_strdup3(__FUNCTION__,__FILE__,__LINE__,src1,src2,src3) #define MEMDUP(src,size) dclib_memdup(__FUNCTION__,__FILE__,__LINE__,src,size) + #define MEMDUP2(s1,l1,s2,l2) dclib_memdup2(__FUNCTION__,__FILE__,__LINE__,s1,l1,s2,l2) + #define MEMDUP3(s1,l1,s2,l2,s3,l3) dclib_memdup3(__FUNCTION__,__FILE__,__LINE__,s1,l1,s2,l2,s3,l3) #define ALLOCDUP(src,size) dclib_allocdup(__FUNCTION__,__FILE__,__LINE__,src,size) + #define PRINTDUP(...) dclib_printdup(__FUNCTION__,__FILE__,__LINE__,__VA_ARGS__) #define INIT_TRACE_ALLOC #define CHECK_TRACE_ALLOC #define DUMP_TRACE_ALLOC(f) @@ -686,7 +704,10 @@ void * trace_allocdup ( ccp,ccp,uint, const void * src, size_t copylen ); #define STRDUP2(src1,src2) dclib_strdup2(src1,src2) #define STRDUP3(src1,src2,src3) dclib_strdup3(src1,src2,src3) #define MEMDUP(src,size) dclib_memdup(src,size) + #define MEMDUP2(s1,l1,s2,l2) dclib_memdup2(s1,l1,s2,l2) + #define MEMDUP3(s1,l1,s2,l2,s3,l3) dclib_memdup3(s1,l1,s2,l2,s3,l3) #define ALLOCDUP(src,size) dclib_allocdup(src,size) + #define PRINTDUP(...) dclib_printdup(__VA_ARGS__) #define INIT_TRACE_ALLOC #define CHECK_TRACE_ALLOC #define DUMP_TRACE_ALLOC(f) diff --git a/project/dclib/dclib-file.c b/project/dclib/dclib-file.c index 333ec3a..1356d32 100644 --- a/project/dclib/dclib-file.c +++ b/project/dclib/dclib-file.c @@ -246,7 +246,7 @@ FileAttrib_t * SetFileAttrib ZeroFileAttrib(dest); if (S_ISREG(src_stat->st_mode)) { - #if HAVE_STATTIME_NSEC + #if HAVE_STATTIME_NSEC dest->atime = src_stat->st_atim; dest->mtime = src_stat->st_mtim; dest->ctime = src_stat->st_ctim; @@ -2690,6 +2690,47 @@ uint PrintLineBuffer /////////////// file helpers /////////////// /////////////////////////////////////////////////////////////////////////////// +const char inode_type_char[INTY__N+1] = "?-+SLFBCDR"; + +//----------------------------------------------------------------------------- + +inode_type_t GetInodeType ( int ret_status, mode_t md ) +{ + return ret_status ? INTY_NOTFOUND + : S_ISREG(md) ? INTY_REG + : S_ISDIR(md) ? INTY_DIR + : S_ISCHR(md) ? INTY_CHAR + : S_ISBLK(md) ? INTY_BLOCK + : S_ISFIFO(md) ? INTY_FIFO + : S_ISLNK(md) ? INTY_LINK + : S_ISSOCK(md) ? INTY_SOCK + : INTY_AVAIL; +} + +//----------------------------------------------------------------------------- + +inode_type_t GetInodeTypeByPath ( ccp path, mode_t *mode ) +{ + struct stat st; + const int ret_status = stat(path,&st); + if (mode) + *mode = ret_status ? 0 : st.st_mode; + return GetInodeType(ret_status,st.st_mode); +} + +//----------------------------------------------------------------------------- + +inode_type_t GetInodeTypeByFD ( int fd, mode_t *mode ) +{ + struct stat st; + const int ret_status = fstat(fd,&st); + if (mode) + *mode = ret_status ? 0 : st.st_mode; + return GetInodeType(ret_status,st.st_mode); +} + +/////////////////////////////////////////////////////////////////////////////// + int IsDirectory ( // analyse filename (last char == '/') and stat(fname) @@ -2990,7 +3031,7 @@ enumError RemoveSource ( ccp fname, // file to remove ccp dest_fname, // NULL or dest file name - // If real pathes are same: don't remove + // If real paths are same: don't remove bool print_log, // true: print a log message bool testmode // true: don't remove, log only ) @@ -3218,14 +3259,15 @@ char * NormalizeFileName uint buf_size, // size of buf ccp source, // NULL or source bool allow_slash, // true: allow '/' in source - bool is_utf8 // true: enter UTF-8 mode + bool is_utf8, // true: enter UTF-8 mode + trailing_slash slash_mode // manipulate trailing slash ) { DASSERT(buf); DASSERT(buf_size>1); char *dest = buf, *end = buf + buf_size - 1; - TRACE("NormalizeFileName(%s,%d)\n",source,allow_slash); + TRACE("NormalizeFileName(%s,%d,%d,%d)\n",source,allow_slash,is_utf8,slash_mode); if (source) { @@ -3271,19 +3313,22 @@ char * NormalizeFileName || ch == 0xd6 // Ö || ch == 0xdc // Ü ) - || strchr("_+-=%'\"$%&,.!()[]{}<>",ch) - || ch == '/' && allow_slash ) + || strchr("_+-=%'\"$%&#,.!()[]{}<>",ch) + ) { *dest++ = ch; skip_space = false; } #ifdef __CYGWIN__ - else if ( ch == '\\' && allow_slash ) + else if ( ( ch == '/' || ch == '\\' ) && allow_slash ) + #else + else if ( ch == '/' && allow_slash ) + #endif { - *dest++ = '/'; + if ( dest == buf || dest[-1] != '/' ) + *dest++ = '/'; skip_space = false; } - #endif else if (!skip_space) { *dest++ = ' '; @@ -3295,6 +3340,35 @@ char * NormalizeFileName if ( dest > buf && dest[-1] == ' ' ) dest--; + switch (slash_mode) + { + case TRSL_NONE: // do nothing special + break; + + case TRSL_AUTO: // add trailing slash if it is a directory, remove otherwise + *dest = 0; + if (IsDirectory(buf,false)) + goto add_slash; + // fall through + + case TRSL_REMOVE: // remove trailing slash always + if ( dest > buf && dest[-1] == '/' ) + dest--; + break; + + case TRSL_ADD_AUTO: // add trailing slash if it is a directory + *dest = 0; + if (!IsDirectory(buf,false)) + break; + // fall through + + case TRSL_ADD_ALWAYS: // add trailing slash always + add_slash: + if ( dest > buf && dest < end && dest[-1] != '/' ) + *dest++ = '/'; + break; + } + DASSERT( dest <= end ); *dest = 0; return dest; @@ -3303,19 +3377,16 @@ char * NormalizeFileName /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -#ifdef __CYGWIN__ - - uint IsWindowsDriveSpec - ( +uint IsWindowsDriveSpec +( // returns the length of the found windows drive specification (0|2|3) - ccp src // valid string - ) - { - DASSERT(src); - - if ( ( *src >= 'a' && *src <= 'z' || *src >= 'A' && *src <= 'Z' ) - && src[1] == ':' ) + ccp src // NULL or valid string +) +{ + if ( src + && src[1] == ':' + && ( *src >= 'a' && *src <= 'z' || *src >= 'A' && *src <= 'Z' ) ) { if (!src[2]) return 2; @@ -3324,41 +3395,40 @@ char * NormalizeFileName return 3; } return 0; - } - -#endif // __CYGWIN__ +} /////////////////////////////////////////////////////////////////////////////// -#ifdef __CYGWIN__ - - uint NormalizeFilenameCygwin - ( +uint NormalizeFilenameCygwin +( // returns a pointer to the NULL terminator within 'buf' char * buf, // valid destination buffer uint buf_size, // size of buf ccp src // NULL or source - ) - { +) +{ static char prefix[] = "/cygdrive/"; if ( buf_size < sizeof(prefix) + 5 || !src ) { - *buf = 0; + if ( buf && buf_size ) + *buf = 0; return 0; } char * end = buf + buf_size - 1; char * dest = buf; - if ( ( *src >= 'a' && *src <= 'z' || *src >= 'A' && *src <= 'Z' ) + if ( ( *src >= 'a' && *src <= 'z' || *src >= 'A' && *src <= 'Z' ) && src[1] == ':' && ( src[2] == 0 || src[2] == '/' || src[2] == '\\' )) { memcpy(buf,prefix,sizeof(prefix)); dest = buf + sizeof(prefix)-1; *dest++ = tolower((int)*src); // cygwin needs the '(int)' + #ifdef __CYGWIN__ + // this can only be checked with real Cygwin. *dest = 0; if (IsDirectory(buf,false)) { @@ -3369,8 +3439,15 @@ char * NormalizeFileName } else dest = buf; + #else // + *dest++ = '/'; + src += 2; + if (*src) + src++; + #endif + } - ASSERT( dest < buf + buf_size ); + DASSERT( dest < buf + buf_size ); while ( dest < end && *src ) if ( *src == '\\' ) @@ -3384,29 +3461,367 @@ char * NormalizeFileName *dest = 0; ASSERT( dest < buf + buf_size ); return dest - buf; - } - -#endif // __CYGWIN__ +} /////////////////////////////////////////////////////////////////////////////// -#ifdef __CYGWIN__ +exmem_t GetNormalizeFilenameCygwin +( + // returns an object. Call FreeExMem(RESULT) to possible alloced memory. + + ccp source, // NULL or source + bool try_circ // use circ-buffer, if result is small enough +) +{ + char buf[PATH_MAX]; + const uint len = NormalizeFilenameCygwin(buf,sizeof(buf),source); + return AllocExMemS(buf,len,try_circ,source,-1); +} + +/////////////////////////////////////////////////////////////////////////////// - char * AllocNormalizedFilenameCygwin - ( +char * AllocNormalizedFilenameCygwin +( // returns an alloced buffer with the normalized filename - ccp source // NULL or string - ) - { + ccp source, // NULL or source + bool try_circ // use circ-buffer, if result is small enough +) +{ char buf[PATH_MAX]; const uint len = NormalizeFilenameCygwin(buf,sizeof(buf),source); - char * result = MEMDUP(buf,len); // MEMDUP allocs +1 byte and set it to NULL - DASSERT(buf[len]==0); - return result; - } + return AllocCircBuf(buf,len,try_circ); +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// search file & config /////////////// +/////////////////////////////////////////////////////////////////////////////// + +void ResetSearchFile ( search_file_list_t *sfl ) +{ + if (sfl) + { + if (sfl->list) + { + uint i; + search_file_t *sf = sfl->list; + for ( i = 0; i < sfl->used; i++, sf++ ) + if (sf->alloced) + FreeString(sf->fname); + FREE(sfl->list); + } + + ResetEML(&sfl->symbols); + InitializeSearchFile(sfl); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +search_file_t * AppendSearchFile +( + search_file_list_t *sfl, // valid search list, new files will be appended + ccp fname, // path+fname to add + CopyMode_t copy_mode, // copy mode for 'fname' + ccp append_if_dir // append this if 'fname' is a directory +) +{ + search_file_t *res = 0; + if ( fname && *fname ) + { + #if 0 + ccp rpath = realpath(fname,0); + if (rpath) + { + if ( copy_mode == CPM_MOVE ) + FreeString(fname); + fname = rpath; + copy_mode = CPM_MOVE; + } + #endif + + uint i; + search_file_t *sf = sfl->list; + for ( i = 0; i < sfl->used; i++, sf++ ) + { + if (!strcmp(sf->fname,fname)) + { + res = sf; + goto end; + } + } + DASSERT( i == sfl->used ); + + + //-- check for directory + + const inode_type_t itype = GetInodeTypeByPath(fname,0); + if ( itype == INTY_DIR && append_if_dir ) + { + char buf[PATH_MAX]; + ccp fname2 = PathCatPP(buf,sizeof(buf),fname,append_if_dir); + res = AppendSearchFile(sfl,fname2,CPM_COPY,0); + } + else + { + if ( sfl->used == sfl->size ) + { + sfl->size += sfl->size/8 + 20; + sfl->list = REALLOC(sfl->list,sfl->size*sizeof(*sfl->list)); + } + + res = sfl->list + sfl->used++; + memset(res,0,sizeof(*res)); + res->itype = itype; + res->fname = CopyData(fname,strlen(fname)+1,copy_mode,&res->alloced); + fname = 0; + } + } + + end: + if ( fname && copy_mode == CPM_MOVE ) + FreeString(fname); + return res; +} + +/////////////////////////////////////////////////////////////////////////////// + +void DumpSearchFile ( FILE *f, int indent, + const search_file_list_t *sfl, bool show_symbols, ccp info ) +{ + if ( f && sfl && ( sfl->used || show_symbols && sfl->symbols.used )) + { + indent = NormalizeIndent(indent); + fprintf(f,"%*s%s%s" "SearchList %p, N=%u/%u\n", + indent,"", info ? info : "", info ? " : " : "", + sfl, sfl->used, sfl->size ); + + char buf[20]; + const int fw_idx = indent + + snprintf(buf,sizeof(buf),"%d",sfl->used) + + ( show_symbols ? 3 : 1 ); + + uint idx = 0; + search_file_t *ptr, *end = sfl->list + sfl->used; + for ( ptr = sfl->list; ptr < end; ptr++, idx++ ) + fprintf(f,"%*d [%c,%c:%02x] %s\n", + fw_idx, idx, + ptr->alloced ? 'A' : '-', + inode_type_char[ptr->itype], ptr->hint, ptr->fname ); + + if (show_symbols) + DumpEML(f,indent+2,&sfl->symbols,"Symbols"); + } +} + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +uint SearchConfig1 +( + search_file_list_t *sfl, + // valid search list, new file will be appended + ccp config_fname, // default filename (without path) of config file + + ccp option, // NULL or filename by option => CONF_HINT_OPT + ccp home_path, // NULL or home path for config file => CONF_HINT_HOME + ccp etc_path, // NULL or etc path for config file => CONF_HINT_ETC + ccp share_path, // NULL or share path for config file => CONF_HINT_MISC + + int stop_mode // >0: stop if found, >1: stop on option + + // hints (by source, values=prio): 8:option, 4:home, 2:etc, 1:prog-path +) +{ + DASSERT(sfl); + char buf[PATH_MAX]; + + uint count = 0; + search_file_t *sf; + if ( option && *option ) + { + sf = AppendSearchFile(sfl,option,CPM_COPY,config_fname); + if (sf) + { + sf->hint |= CONF_HINT_OPT; + if ( sf->itype == INTY_REG && ++count && stop_mode > 0 ) + return 1; + if ( stop_mode > 1 ) + return 0; + } + } + + if (home_path) + { + ccp home = getenv("HOME"); + if (home) + home_path = PathCatPP(buf,sizeof(buf),home,home_path); + sf = AppendSearchFile(sfl,home_path,CPM_COPY,config_fname); + if (sf) + { + sf->hint |= CONF_HINT_HOME; + if ( sf->itype == INTY_REG && ++count && stop_mode > 0 ) + return 1; + } + } + + if (etc_path) + { + sf = AppendSearchFile(sfl,etc_path,CPM_COPY,config_fname); + if (sf) + { + sf->hint |= CONF_HINT_ETC; + if ( sf->itype == INTY_REG && ++count && stop_mode > 0 ) + return 1; + } + } + + if (share_path) + { + sf = AppendSearchFile(sfl,share_path,CPM_COPY,config_fname); + if (sf) + { + sf->hint |= CONF_HINT_MISC; + if ( sf->itype == INTY_REG && ++count && stop_mode > 0 ) + return 1; + } + } + + ccp progpath = ProgramDirectory(); + if (progpath) + { + sf = AppendSearchFile(sfl,progpath,CPM_COPY,config_fname); + if (sf) + { + sf->hint |= CONF_HINT_INST; + if ( sf->itype == INTY_REG && ++count && stop_mode > 0 ) + return 1; + } + } + + return count; +} + +/////////////////////////////////////////////////////////////////////////////// + +static int add_search +( + // returns 0 if !stop_if_found, 2 if added+found, 1 if added, 0 else + + search_file_list_t *sfl, // valid data + ccp config_fname, // default filename (without path) of config file + ccp *list, // NULL or list of filenames + int n_list, // num of 'list' elements, -1:null terminated list + ccp prefix, // prefix for relative filenames + uint hint, // attributes + int stop_if_found // >0: stop if file found +) +{ + DASSERT(sfl); + if (!list) + return 0; + + if ( n_list < 0 ) + { + ccp *ptr; + for ( ptr = list; *ptr; ptr++ ) + ; + n_list = ptr - list; + } + if (!n_list) + return 0; + + int ret_val = 0; + char buf[PATH_MAX]; + for ( ; n_list > 0; n_list--, list++ ) + { + if (!*list) + continue; + + ccp path = **list == '/' || !prefix || !*prefix + ? *list + : PathCatPP(buf,sizeof(buf),prefix,*list); + exmem_t res = ResolveSymbolsEML(&sfl->symbols,path); + search_file_t *sf = AppendSearchFile( sfl, res.data.ptr, + res.is_alloced ? CPM_MOVE : CPM_COPY, config_fname ); + if (sf) + { + sf->hint |= hint; + if ( sf->itype == INTY_REG && stop_if_found > 0 ) + return 2; + ret_val = 1; + } + } + + return stop_if_found > 0 ? ret_val : 0; +} + +//----------------------------------------------------------------------------- + +bool SearchConfig +( + // for all paths: + // /... is an absolute path + // $(home)/... path relative to getenv("HOME") + // $(xdg_home)/... path relative to first path of getenv("XDG_CONFIG_HOME") + // $(xdg_etc)/... path relative to first path of getenv("XDG_CONFIG_DIRS") + // $(etc)/... path relative to /etc directory + // $(install)/... path relative to installation directory = ProgramDirectory() + // $(NAME)/... path relative to symbol in sfl->symbols + // xx relative paths otherwise + + search_file_list_t *sfl, + // valid search list, new paths will be appended + // sfl->symbols: home, etc and install are added (not replaced) + // It is used to resolve all $(NAME) references. + + ccp config_fname, // default filename (without path) of config file + + ccp *option, // NULL or filenames by option => CONF_HINT_OPT + int n_option, // num of 'option' elements, -1:null terminated list + ccp *xdg_home, // NULL or $(xdg_home) based paths => CONF_HINT_HOME + int n_xdg_home, // num of 'home' elements, -1:null terminated list + ccp *home, // NULL or $(home) based paths => CONF_HINT_HOME + int n_home, // num of 'home' elements, -1:null terminated list + ccp *etc, // NULL or $(etc) based paths => CONF_HINT_ETC + int n_etc, // num of 'etc' elements, -1:null terminated list + ccp *install, // NULL or $(install) based paths => CONF_HINT_INST + int n_install, // num of 'install' elements, -1:null terminated list + ccp *misc, // NULL or absolute paths => CONF_HINT_MISC + int n_misc, // num of 'misc' elements, -1:null terminated list + + int stop_mode // >0: stop if found, >1: stop on option +) +{ + // ==> see: https://wiki.archlinux.org/index.php/XDG_Base_Directory -#endif // __CYGWIN__ + DASSERT(sfl); + AddStandardSymbolsEML(&sfl->symbols,false); + + int stat = add_search(sfl,config_fname,option,n_option,0,CONF_HINT_OPT,stop_mode); + if ( stat > 1 ) + return true; + if ( stop_mode > 1 && stat ) + return false; + + if (add_search(sfl,config_fname,xdg_home,n_xdg_home,"$(xdg_home)",CONF_HINT_HOME,stop_mode)>1) + return true; + + if (add_search(sfl,config_fname,home,n_home,"$(home)",CONF_HINT_HOME,stop_mode)>1) + return true; + + if (add_search(sfl,config_fname,etc,n_etc,"$(xdg_etc)",CONF_HINT_ETC,stop_mode)>1) + return true; + + if (add_search(sfl,config_fname,etc,n_etc,"$(etc)",CONF_HINT_ETC,stop_mode)>1) + return true; + + if (add_search(sfl,config_fname,install,n_install,"$(install)",CONF_HINT_INST,stop_mode)>1) + return true; + + return add_search(sfl,config_fname,misc,n_misc,0,CONF_HINT_MISC,stop_mode)>1; +} // /////////////////////////////////////////////////////////////////////////////// @@ -4902,68 +5317,50 @@ void SaveCurrentStateByTable break; case SRT_FLOAT: - switch(srt->size) + if ( srt->size == sizeof(float) ) { - case sizeof(float): - { - const u8 *d = data + srt->offset; - for ( i = 0; i < n_elem; i++, d += elem_off ) - fprintf(f, "%s%.8g", i ? "," : "", *(float*)d ); - } - break; - - case sizeof(double): - { - const u8 *d = data + srt->offset; - for ( i = 0; i < n_elem; i++, d += elem_off ) - fprintf(f, "%s%.16g", i ? "," : "", *(double*)d ); - } - break; - - case sizeof(long double): - { - const u8 *d = data + srt->offset; - for ( i = 0; i < n_elem; i++, d += elem_off ) - fprintf(f, "%s%.20Lg", i ? "," : "", *(long double*)d ); - } - break; - - default: - fputs("0.0",f); + const u8 *d = data + srt->offset; + for ( i = 0; i < n_elem; i++, d += elem_off ) + fprintf(f, "%s%.8g", i ? "," : "", *(float*)d ); + } + else if ( srt->size == sizeof(double) ) + { + const u8 *d = data + srt->offset; + for ( i = 0; i < n_elem; i++, d += elem_off ) + fprintf(f, "%s%.16g", i ? "," : "", *(double*)d ); + } + else if ( srt->size == sizeof(long double) ) + { + const u8 *d = data + srt->offset; + for ( i = 0; i < n_elem; i++, d += elem_off ) + fprintf(f, "%s%.20Lg", i ? "," : "", *(long double*)d ); } + else + fputs("0.0",f); fputc('\n',f); break; case SRT_XFLOAT: - switch(srt->size) + if ( srt->size == sizeof(float) ) { - case sizeof(float): - { - const u8 *d = data + srt->offset; - for ( i = 0; i < n_elem; i++, d += elem_off ) - fprintf(f, "%s%a", i ? "," : "", *(float*)d ); - } - break; - - case sizeof(double): - { - const u8 *d = data + srt->offset; - for ( i = 0; i < n_elem; i++, d += elem_off ) - fprintf(f, "%s%a", i ? "," : "", *(double*)d ); - } - break; - - case sizeof(long double): - { - const u8 *d = data + srt->offset; - for ( i = 0; i < n_elem; i++, d += elem_off ) - fprintf(f, "%s%La", i ? "," : "", *(long double*)d ); - } - break; - - default: - fputs("0.0",f); + const u8 *d = data + srt->offset; + for ( i = 0; i < n_elem; i++, d += elem_off ) + fprintf(f, "%s%a", i ? "," : "", *(float*)d ); + } + else if ( srt->size == sizeof(double) ) + { + const u8 *d = data + srt->offset; + for ( i = 0; i < n_elem; i++, d += elem_off ) + fprintf(f, "%s%a", i ? "," : "", *(double*)d ); + } + else if ( srt->size == sizeof(long double) ) + { + const u8 *d = data + srt->offset; + for ( i = 0; i < n_elem; i++, d += elem_off ) + fprintf(f, "%s%La", i ? "," : "", *(long double*)d ); } + else + fputs("0.0",f); fputc('\n',f); break; @@ -5204,12 +5601,12 @@ void RestoreStateByTable uint i = 0; while (*src) { - switch(srt->size) - { - case sizeof(float): *(float*)val = strtof(src,&src); break; - case sizeof(double): *(double*)val = strtod(src,&src); break; - case sizeof(long double): *(long double*)val = strtold(src,&src); break; - } + if ( srt->size == sizeof(float) ) + *(float*)val = strtof(src,&src); + else if ( srt->size == sizeof(double) ) + *(double*)val = strtod(src,&src); + else if ( srt->size == sizeof(long double) ) + *(long double*)val = strtold(src,&src); if ( ++i == n_elem ) break; val += elem_off; @@ -5703,6 +6100,7 @@ ccp GetNamePSFF ( PrintScriptFF fform ) { case PSFF_UNKNOWN: return "TEXT"; case PSFF_ASSIGN: return "ASSIGN"; + case PSFF_CONFIG: return "CONFIG"; case PSFF_JSON: return "JSON"; case PSFF_BASH: return "BASH"; case PSFF_SH: return "SH"; @@ -5723,6 +6121,11 @@ void PrintScriptHeader ( PrintScript_t *ps ) ps->add_index = false; ps->sep[0] = ps->sep[1] = 0; + if ( !ps->var_name || !*ps->var_name ) + ps->var_name = "res"; + if ( !ps->var_prefix ) + ps->var_prefix = ""; + if ( ps->f ) { switch (ps->fform) @@ -5740,19 +6143,19 @@ void PrintScriptHeader ( PrintScript_t *ps ) case PSFF_PHP: if (ps->create_array) - fprintf(ps->f,"$%s = array();\n\n",ps->varname); + fprintf(ps->f,"$%s = array();\n\n",ps->var_name); ps->boc = "#"; break; case PSFF_MAKEDOC: if (ps->create_array) - fprintf(ps->f,"%s = @LIST\n\n",ps->varname); + fprintf(ps->f,"%s = @LIST\n\n",ps->var_name); ps->boc = "#!"; break; case PSFF_C: if (ps->create_array) - fprintf(ps->f,"%s = @LIST\n\n",ps->varname); + fprintf(ps->f,"%s = @LIST\n\n",ps->var_name); ps->boc = "//"; break; @@ -5781,7 +6184,7 @@ void PrintScriptFooter ( PrintScript_t *ps ) case PSFF_SH: if (ps->create_array) - fprintf(ps->f,"%s_N=%u\n\n",ps->varname,ps->index); + fprintf(ps->f,"%sN=%u\n\n",ps->var_prefix,ps->index); break; case PSFF_PHP: @@ -5817,9 +6220,9 @@ int PutScriptVars if ( ps->add_index ) snprintf( ps->prefix, sizeof(ps->prefix), - "%s_%u", ps->varname, ps->index ); + "%s%u", ps->var_prefix, ps->index ); else - StringCopyS( ps->prefix, sizeof(ps->prefix), ps->varname ); + StringCopyS( ps->prefix, sizeof(ps->prefix), ps->var_prefix ); switch (ps->fform) { @@ -5891,65 +6294,107 @@ int PutScriptVars varname = MemUpperS(varbuf,sizeof(varbuf),MemByS(varname,varlen)); varname = varbuf; } - - ccp param = ptr++; - while ( (uchar)*ptr >= ' ' ) + + ccp quote, param; + uint plen, free_param = 0; + if ( *++ptr == '"' ) + { ptr++; + param = ptr; + if (ps->auto_quote) + { + quote = EmptyString; + while ( *ptr && *ptr != '"' ) + { + if ( *ptr == '\\' && ptr[1] ) + ptr++; + ptr++; + } + param = EscapeString(param,ptr-param,EmptyString,EmptyString,CHMD__MODERN, + ps->fform == PSFF_BASH ? '$' : '"', true, &plen ); + free_param++; + } + else + { + quote = "\""; + while ( *ptr && !( ptr[0] == '"' && ptr[1] == '\n' )) + ptr++; + plen = ptr - param; + } + if ( *ptr == '"' ) + ptr++; + } + else + { + param = ptr; + quote = EmptyString; + while ( *ptr && *ptr != '\n' ) + ptr++; + plen = ptr - param; + } switch (ps->fform) { case PSFF_ASSIGN: - fprintf(f, "%.*s = %.*s\n", - varlen, varname, - (int)( ptr - param - 1 ), param+1 ); + fprintf(f, "%.*s = %s%.*s%s\n", + varlen, varname, quote, plen, param, quote ); + break; + + case PSFF_CONFIG: + if ( ps->eq_tabstop > 0 ) + { + int tabs = ps->eq_tabstop - varlen/8; + if ( tabs < 0 ) + tabs = 0; + fprintf(f, "%.*s%.*s= %.*s\n", + varlen, varname, tabs, Tabs20, plen, param ); + } + else + fprintf(f, "%.*s = %.*s\n", + varlen, varname, plen, param ); break; case PSFF_JSON: - fprintf(f, "%s\"%.*s\":%.*s", + fprintf(f, "%s\"%.*s\":%s%.*s%s", ps->count ? "," : "", - varlen, varname, - (int)( ptr - param - 1 ), param+1 ); + varlen, varname, quote, plen, param, quote ); break; case PSFF_BASH: if (ps->create_array) { - fprintf(f, "%s_%.*s%s=(%.*s)\n", + fprintf(f, "%s%.*s%s=(%s%.*s%s)\n", ps->prefix, - varlen, varname, - ps->index ? "+" : "", - (int)( ptr - param - 1 ), param+1 ); + varlen, varname, ps->index ? "+" : "", quote, plen, param, quote ); break; } // fall through case PSFF_SH: - fprintf(f, "%s_%.*s=%.*s\n", - ps->prefix, - varlen, varname, - (int)( ptr - param - 1 ), param+1 ); + fprintf(f, "%s%.*s=%s%.*s%s\n", + ps->prefix, varlen, varname, quote, plen, param, quote ); break; case PSFF_PHP: case PSFF_C: - fprintf(f, "$d->%.*s = %.*s;\n", - varlen, varname, - (int)( ptr - param - 1 ), param+1 ); + fprintf(f, "$d->%.*s = %s%.*s%s;\n", + varlen, varname, quote, plen, param, quote ); break; case PSFF_MAKEDOC: - fprintf(f, "d[\"%.*s\"] = %.*s\n", - varlen, varname, - (int)( ptr - param - 1 ), param+1 ); + fprintf(f, "d[\"%.*s\"] = %s%.*s%s\n", + varlen, varname, quote, plen, param, quote ); break; default: - fprintf(f, "%20.*s = %.*s\n", - varlen, varname, - (int)( ptr - param - 1 ), param+1 ); + fprintf(f, "%*.*s = %s%.*s%s\n", + ps->var_size > 0 ? ps->var_size : 20, + varlen, varname, quote, plen, param, quote ); break; } ps->count++; + if (free_param) + FreeString(param); //-- skip to next line next_line: @@ -5972,12 +6417,12 @@ int PutScriptVars case PSFF_PHP: fprintf(f, "$%s%s = $d;\n\n", - ps->prefix, ps->create_array ? "[]" : "" ); + ps->var_name, ps->create_array ? "[]" : "" ); break; case PSFF_MAKEDOC: fprintf(f, "%s %s= move(d);\n\n", - ps->prefix, ps->create_array ? "#" : "" ); + ps->var_name, ps->create_array ? "#" : "" ); break; default: diff --git a/project/dclib/dclib-file.h b/project/dclib/dclib-file.h index 1974475..e6f51f3 100644 --- a/project/dclib/dclib-file.h +++ b/project/dclib/dclib-file.h @@ -519,7 +519,7 @@ uint CloseAllExcept /////////////// CopyFile*(), TransferFile() /////////////// /////////////////////////////////////////////////////////////////////////////// -// compare pathes and by stat() +// compare paths and by stat() bool IsSameFile ( ccp path1, ccp path2 ); /////////////////////////////////////////////////////////////////////////////// @@ -845,6 +845,33 @@ uint PrintLineBuffer /////////////////////////////////////////////////////////////////////////////// /////////////// file helpers /////////////// /////////////////////////////////////////////////////////////////////////////// +// [[inode_type_t]] + +typedef enum inode_type_t +{ + INTY_UNKNOWN, // never tested + INTY_NOTFOUND, // file not found or error + INTY_AVAIL, // file is available + INTY_SOCK, // S_ISSOCK + INTY_LINK, // S_ISLNK + INTY_FIFO, // S_ISFIFO + INTY_BLOCK, // S_ISBLK + INTY_CHAR, // S_ISCHR + INTY_DIR, // S_ISDIR + INTY_REG, // S_ISREG + INTY__N +} +__attribute__ ((packed)) inode_type_t; + +extern const char inode_type_char[INTY__N+1]; + +//----------------------------------------------------------------------------- + +inode_type_t GetInodeType ( int ret_status, mode_t mode ); +inode_type_t GetInodeTypeByPath ( ccp path, mode_t *mode ); +inode_type_t GetInodeTypeByFD ( int fd, mode_t *mode ); + +/////////////////////////////////////////////////////////////////////////////// int IsDirectory ( @@ -935,7 +962,7 @@ enumError RemoveSource ( ccp fname, // file to remove ccp dest_fname, // NULL or dest file name - // If real pathes are same: don't remove + // If real paths are same: don't remove bool print_log, // true: print a log message bool testmode // true: don't remove, log only ); @@ -985,6 +1012,19 @@ uint NumberedFilename /////////////////////////////////////////////////////////////////////////////// /////////////// normalize filenames /////////////// /////////////////////////////////////////////////////////////////////////////// +// [[trailing_slash]] + +typedef enum trailing_slash +{ + TRSL_NONE, // do nothing special + TRSL_REMOVE, // remove trailing slash always + TRSL_ADD_ALWAYS, // add trailing slash always + TRSL_ADD_AUTO, // add trailing slash if it is a directory + TRSL_AUTO, // add trailing slash if it is a directory, remove otherwise +} +trailing_slash; + +/////////////////////////////////////////////////////////////////////////////// char * NormalizeFileName ( @@ -994,36 +1034,157 @@ char * NormalizeFileName uint buf_size, // size of buf ccp source, // NULL or source bool allow_slash, // true: allow '/' in source - bool is_utf8 // true: enter UTF-8 mode + bool is_utf8, // true: enter UTF-8 mode + trailing_slash slash_mode // manipulate trailing slash ); /////////////////////////////////////////////////////////////////////////////// -#ifdef __CYGWIN__ - uint IsWindowsDriveSpec - ( +uint IsWindowsDriveSpec +( // returns the length of the found windows drive specification (0|2|3) - ccp src // valid string - ); + ccp src // NULL or valid string +); - uint NormalizeFilenameCygwin - ( - // returns a pointer to the NULL terminator within 'buf' +uint NormalizeFilenameCygwin +( + // returns the used length (without 0-term) of buf. - char * buf, // valid destination buffer - uint buf_size, // size of buf - ccp src // NULL or source - ); + char * buf, // valid destination buffer + uint buf_size, // size of buf + ccp src // NULL or source +); - char * AllocNormalizedFilenameCygwin - ( +exmem_t GetNormalizeFilenameCygwin +( + // returns an object. Call FreeExMem(RESULT) to free possible alloced memory. + + ccp source, // NULL or source + bool try_circ // use circ-buffer, if result is small enough +); + +char * AllocNormalizedFilenameCygwin +( // returns an alloced buffer with the normalized filename + // Call FreeString(RESULT) to free possible alloced memory. - ccp source // NULL or string - ); + ccp source, // NULL or source + bool try_circ // use circ-buffer, if result is small enough +); + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// search file & config /////////////// +/////////////////////////////////////////////////////////////////////////////// +// [[search_file_t]]} -#endif // __CYGWIN__ +typedef struct search_file_t +{ + ccp fname; // filename + bool alloced; // is 'fname' alloced + inode_type_t itype; // one of INTY_* + u16 hint; // any hint +} +search_file_t; + +//----------------------------------------------------------------------------- +// [[search_file_list_t]]} + +typedef struct search_file_list_t +{ + search_file_t *list; // list of files + uint used; // number of used elements in 'list' + uint size; // number of alloced elements for 'list' + exmem_list_t symbols; // list to resolve $(SYMBOL) +} +search_file_list_t; + +//----------------------------------------------------------------------------- + +static inline void InitializeSearchFile ( search_file_list_t *sfl ) + { DASSERT(sfl); memset(sfl,0,sizeof(*sfl)); } + +void ResetSearchFile ( search_file_list_t *sfl ); + +search_file_t * AppendSearchFile +( + search_file_list_t *sfl, // valid search list, new files will be appended + ccp fname, // path+fname to add + CopyMode_t copy_mode, // copy mode for 'fname' + ccp append_if_dir // append this if 'fname' is a directory +); + +void DumpSearchFile ( FILE *f, int indent, + const search_file_list_t *sfl, bool show_symbols, ccp info ); + +/////////////////////////////////////////////////////////////////////////////// +// [[config_hint_t]] + +typedef enum config_hint_t +{ + CONF_HINT_MISC = 0x01, + CONF_HINT_INST = 0x02, + CONF_HINT_ETC = 0x04, + CONF_HINT_HOME = 0x08, + CONF_HINT_OPT = 0x10, +} +config_hint_t; + +//----------------------------------------------------------------------------- + +uint SearchConfig1 +( + search_file_list_t *sfl, + // valid search list, new file will be appended + ccp config_fname, // default filename (without path) of config file + + ccp option, // NULL or filename by option => CONF_HINT_OPT + ccp home_path, // NULL or home path for config file => CONF_HINT_HOME + ccp etc_path, // NULL or etc path for config file => CONF_HINT_ETC + ccp share_path, // NULL or share path for config file => CONF_HINT_MISC + + int stop_mode // >0: stop if found, >1: stop on option + + // hints (by source, values=prio): 8:option, 4:home, 2:etc, 1:prog-path +); + +//----------------------------------------------------------------------------- + +bool SearchConfig +( + // for all paths: + // /... is an absolute path + // $(home)/... path relative to getenv("HOME") + // $(xdg_home)/... path relative to first path of getenv("XDG_CONFIG_HOME") + // $(xdg_etc)/... path relative to first path of getenv("XDG_CONFIG_DIRS") + // $(etc)/... path relative to /etc directory + // $(install)/... path relative to installation directory = ProgramDirectory() + // $(NAME)/... path relative to symbol in sfl->symbols + // xx relative paths otherwise + + search_file_list_t *sfl, + // valid search list, new paths will be appended + // sfl->symbols: home, etc and install are added (not replaced) + // It is used to resolve all $(NAME) references. + + ccp config_fname, // default filename (without path) of config file + + ccp *option, // NULL or filenames by option => CONF_HINT_OPT + int n_option, // num of 'option' elements, -1:null terminated list + ccp *xdg_home, // NULL or $(xdg_home) based paths => CONF_HINT_HOME + int n_xdg_home, // num of 'home' elements, -1:null terminated list + ccp *home, // NULL or $(home) based paths => CONF_HINT_HOME + int n_home, // num of 'home' elements, -1:null terminated list + ccp *etc, // NULL or $(etc) based paths => CONF_HINT_ETC + int n_etc, // num of 'etc' elements, -1:null terminated list + ccp *install, // NULL or $(install) based paths => CONF_HINT_INST + int n_install, // num of 'install' elements, -1:null terminated list + ccp *misc, // NULL or absolute paths => CONF_HINT_MISC + int n_misc, // num of 'misc' elements, -1:null terminated list + + int stop_mode // >0: stop if found, >1: stop on option +); // /////////////////////////////////////////////////////////////////////////////// @@ -1341,6 +1502,7 @@ typedef enum PrintScriptFF { PSFF_UNKNOWN, // always 0 PSFF_ASSIGN, + PSFF_CONFIG, PSFF_JSON, PSFF_BASH, PSFF_SH, @@ -1359,9 +1521,13 @@ typedef struct PrintScript_t { FILE *f; // valid output file PrintScriptFF fform; // output: file format - ccp varname; // valid ponter to var name + ccp var_name; // NULL or variable name for result + ccp var_prefix; // NULL or prefix for member names + int var_size; // if > 0: print size of var name (some 'fform' only) + int eq_tabstop; // if > 0: indent '=' to set tabstop (some 'fform' only) LowerUpper_t force_case; // change case of var names if not LOUP_AUTO bool create_array; // true: create ar arrays + bool auto_quote; // true: detect quotes and use EscapeString() bool add_index; // true: add index to varname bool ena_empty; // true: enable empty lines bool ena_comments; // true: enable comments diff --git a/project/dclib/dclib-numeric.c b/project/dclib/dclib-numeric.c index 0f7a444..01fd734 100644 --- a/project/dclib/dclib-numeric.c +++ b/project/dclib/dclib-numeric.c @@ -968,19 +968,82 @@ ccp GetEncodingName ( EncodeMode_t em ) /////////////////////////////////////////////////////////////////////////////// +uint GetEscapedSize +( + // returns the needed buffer size for PrintEscapedString() + + ccp source, // NULL or string to print + int src_len, // length of string. if -1, str is null terminated + CharMode_t char_mode, // modes, bit field (CHMD_*) + char quote // NULL or quotation char, that must be quoted +) +{ + const CharMode_t utf8 = char_mode & CHMD_UTF8; + const CharMode_t allow_e = char_mode & CHMD_ESC; + + if ( !source || !*source ) + return 1; + ccp str = source; + ccp end = src_len < 0 ? 0 : str + src_len; + + uint size = 4; // +4 for escapes at end; +1 for NULL terminator + while ( !end || str < end ) + { + const u8 ch = (u8)*str++; + switch (ch) + { + case 0: + if (!end) + return size; + size += 4; + break; + + case '\\': + case '\a': + case '\b': + case '\f': + case '\n': + case '\r': + case '\t': + case '\v': + size += 2; + break; + + case '\033': + size += allow_e ? 2 : 4; + break; + + default: + if ( ch == quote ) + size += 2; + else if ( ch < ' ' || !utf8 && (ch&0x7f) < ' ' || (ch&0x7f) == 0x7f ) + size += 4; + else + size++; + } + } + return size; +} + +/////////////////////////////////////////////////////////////////////////////// + char * PrintEscapedString ( // returns 'buf' char *buf, // valid destination buffer uint buf_size, // size of 'buf', >= 10 - ccp source, // NULL string to print + ccp source, // NULL or string to print int len, // length of string. if -1, str is null terminated CharMode_t char_mode, // modes, bit field (CHMD_*) char quote, // NULL or quotation char, that must be quoted uint *dest_len // not NULL: Store length of result here ) { + ///////////////////////////////////////////////////////// + ///// Update GetEscapedSize() on modifications!! ///// + ///////////////////////////////////////////////////////// + DASSERT(buf); DASSERT(buf_size>=10); @@ -1061,7 +1124,7 @@ char * PrintEscapedString uint ScanEscapedString ( - // returns the number of valid bytes in 'buf' (NULL term not counted) + // returns the number of valid bytes in 'buf' (NULL term added but not counted) char *buf, // valid destination buffer, maybe source uint buf_size, // size of 'buf' @@ -2035,6 +2098,78 @@ mem_t EncodeByModeMem // /////////////////////////////////////////////////////////////////////////////// +/////////////// escape/quote strings, alloc space /////////////// +/////////////////////////////////////////////////////////////////////////////// + +char * EscapeString +( + // Returns a pointer. + // Use FreeString(result) to free possible alloced result. + // circ-buffer is ignored by FreeString(). + + cvp src, // NULL or source + int src_len, // size of 'src'. If -1: Use strlen(src) + cvp return_if_null, // return this, if 'src==NULL' + cvp return_if_empty, // return this, if src is empty (have no chars) + CharMode_t char_mode, // how to escape + char quote, // quoting character: " or ' or $ (for $'...') + bool try_circ, // use circ-buffer, if result is small enough + uint *dest_len // not NULL: Store length of result here +) +{ + if (!src) + return (char*)return_if_null; + if ( src_len < 0 ) + src_len = strlen(src); + if (!src_len) + return (char*)return_if_empty; + + char quote_char; + uint quote_mode; + if ( quote == '$' ) + { + quote_mode = 3; + quote_char = '\''; + } + else if (quote) + { + quote_mode = 2; + quote_char = quote; + } + else + { + quote_mode = 0; + quote_char = '"'; + } + + uint size = GetEscapedSize(src,src_len,char_mode,quote_char) + quote_mode; + char *buf = try_circ && size <= CIRC_BUF_MAX_ALLOC ? GetCircBuf(size) : MALLOC(size); + + uint len; + if ( quote_mode == 3 ) + { + PrintEscapedString(buf+2,size-3,src,src_len,char_mode,quote_char,&len); + buf[0] = '$'; + buf[1] = buf[len+2] = quote_char; + buf[len+3] = 0; + + } + else if ( quote_mode == 2 ) + { + PrintEscapedString(buf+1,size-2,src,src_len,char_mode,quote_char,&len); + buf[0] = buf[len+1] = quote_char; + buf[len+2] = 0; + } + else + PrintEscapedString(buf,size,src,src_len,char_mode,quote_char,&len); + + if (dest_len) + *dest_len = len + quote_mode; + return buf; +}; + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// time /////////////// /////////////////////////////////////////////////////////////////////////////// diff --git a/project/dclib/dclib-system.h b/project/dclib/dclib-system.h index 9a3dc5f..6829cb3 100644 --- a/project/dclib/dclib-system.h +++ b/project/dclib/dclib-system.h @@ -35,9 +35,12 @@ #ifndef DCLIB_SYSTEM_H #define DCLIB_SYSTEM_H 1 -#include <stdio.h> +#ifndef PRINT_SYSTEM_SETTINGS + #include <stdio.h> +#endif /////////////////////////////////////////////////////////////////////////////// +#ifndef PRINT_SYSTEM_SETTINGS typedef enum enumSystemID { @@ -46,17 +49,22 @@ typedef enum enumSystemID SYSID_X86_64 = 0x02000000, SYSID_CYGWIN32 = 0x03000000, SYSID_CYGWIN64 = 0x04000000, - SYSID_APPLE = 0x05000000, - SYSID_LINUX = 0x06000000, - SYSID_UNIX = 0x07000000, + SYSID_MAC_I386 = 0x05000000, + SYSID_MAC_X64 = 0x06000000, + SYSID_MAC_ARM = 0x07000000, + SYSID_LINUX = 0x08000000, + SYSID_UNIX = 0x09000000, } enumSystemID; +#endif + /////////////////////////////////////////////////////////////////////////////// #undef SYSTEM_LINUX #ifdef __CYGWIN__ + #define SYSTEM_LINUX 0 #define SYSTEM "cygwin" #ifdef __x86_64 #define SYSTEM2 "cygwin64" @@ -66,8 +74,18 @@ typedef enum enumSystemID #define SYSTEMID SYSID_CYGWIN32 #endif #elif __APPLE__ + #define SYSTEM_LINUX 0 #define SYSTEM "mac" - #define SYSTEMID SYSID_APPLE + #ifdef __aarch64__ + #define SYSTEM2 "mac/arm" + #define SYSTEMID SYSID_MAC_ARM + #elif __x86_64__ + #define SYSTEM2 "mac/x64" + #define SYSTEMID SYSID_MAC_X64 + #else + #define SYSTEM2 "mac/i386" + #define SYSTEMID SYSID_MAC_I386 + #endif #elif __linux__ #define SYSTEM_LINUX 1 #ifdef __i386__ @@ -81,6 +99,7 @@ typedef enum enumSystemID #define SYSTEMID SYSID_LINUX #endif #elif __unix__ + #define SYSTEM_LINUX 0 #define SYSTEM "unix" #define SYSTEMID SYSID_UNIX #else @@ -93,6 +112,7 @@ typedef enum enumSystemID #endif /////////////////////////////////////////////////////////////////////////////// +#ifndef PRINT_SYSTEM_SETTINGS static inline void dclibPrintSystem ( FILE * f ) { @@ -109,7 +129,14 @@ static inline void dclibPrintSystem ( FILE * f ) ); } +#endif /////////////////////////////////////////////////////////////////////////////// +#ifdef PRINT_SYSTEM_SETTINGS +result_SYSTEM=SYSTEM +result_SYSTEM2=SYSTEM2 +result_SYSTEM_LINUX=SYSTEM_LINUX +#endif + #endif // DCLIB_SYSTEM_H 1 diff --git a/project/revision.sh b/project/revision.sh index 20348a9..17aadd1 100644 --- a/project/revision.sh +++ b/project/revision.sh @@ -1 +1 @@ -revision=8357 +revision=8414 diff --git a/project/setup.sh b/project/setup.sh index 5e0fa24..a5dc451 100644 --- a/project/setup.sh +++ b/project/setup.sh @@ -51,7 +51,11 @@ fi && grep -qw posix_fallocate /usr/include/fcntl.h \ && defines="$defines -DHAVE_POSIX_FALLOCATE=1" -gcc $xflags system.c -o system.tmp && ./system.tmp >Makefile.setup +#gcc $xflags system.c -o system.tmp && ./system.tmp >Makefile.setup +gcc $xflags -E -DPRINT_SYSTEM_SETTINGS system.c \ + | awk -F= '/^result_/ {printf("%s := %s\n",substr($1,8),gensub(/"/,"","g",$2))}' \ + > Makefile.setup + #rm -f system.tmp SYSTEM=$(awk '$1=="SYSTEM" {print $3}' Makefile.setup) #echo "SYSTEM=|$SYSTEM|" >&2 diff --git a/project/src/lib-bzip2.h b/project/src/lib-bzip2.h index b3662f2..4e2ea8c 100644 --- a/project/src/lib-bzip2.h +++ b/project/src/lib-bzip2.h @@ -297,7 +297,7 @@ typedef struct BZ2Source_t //--- search files ccp search; // Semicolon separated list of filenames - // or sub-pathes to search. + // or sub-paths to search. // NULL terminate source lists. //--- internal fall back data diff --git a/project/src/lib-checksum.c b/project/src/lib-checksum.c index a96cd79..ed45e7a 100644 --- a/project/src/lib-checksum.c +++ b/project/src/lib-checksum.c @@ -942,7 +942,7 @@ ParamFieldItem_t * StoreSZSCache } bool found; - ParamFieldItem_t *it = InsertParamFieldEx(&szs_cache,checksum,false,0,&found); + ParamFieldItem_t *it = FindInsertParamField(&szs_cache,checksum,false,0,&found); if (found) { DASSERT(it); diff --git a/project/src/lib-ctcode.c b/project/src/lib-ctcode.c index a24ecb2..c89dd38 100644 --- a/project/src/lib-ctcode.c +++ b/project/src/lib-ctcode.c @@ -1745,7 +1745,9 @@ static enumError ScanRTL_Slot n1 = 0; if ( ++n2 > ctcode->max_tracks ) n2 = ctcode->max_tracks; - noPRINT("SLOT: %02lx:%02lx = %lu:%lu%s\n",n1,n2,n1,n2,force ? " /FORCE" : ""); + PRINT0("SLOT: %02lx:%02lx = %lu:%lu%s%s\n",n1,n2,n1,n2, + mark_reserved ? " /X" : "", + force ? " /FORCE" : ""); if ( n1 >= n2 ) continue; @@ -1773,8 +1775,10 @@ static enumError ScanRTL_Slot ctcode->n_next_slot = ctcode->max_tracks - idx; if (ctcode->n_next_slot) { - memmove(ctcode->next_slot,ctcode->next_slot+idx,ctcode->n_next_slot); - memmove(ctcode->force_slot,ctcode->force_slot+idx,ctcode->n_next_slot); + memmove( ctcode->next_slot, ctcode->next_slot + idx, + ctcode->n_next_slot * sizeof(*ctcode->next_slot) ); + memmove( ctcode->force_slot, ctcode->force_slot + idx, + ctcode->n_next_slot * sizeof(*ctcode->force_slot) ); } } diff --git a/project/src/lib-file.c b/project/src/lib-file.c index 3d6b65a..c4cce3d 100644 --- a/project/src/lib-file.c +++ b/project/src/lib-file.c @@ -44,6 +44,7 @@ #include <time.h> #include <utime.h> #include <dirent.h> +#include <stddef.h> #include "lib-std.h" #include "lib-szs.h" @@ -63,6 +64,7 @@ #include "lib-common.h" #include "lib-bzip2.h" #include "lib-checksum.h" +#include "config.inc" // /////////////////////////////////////////////////////////////////////////////// @@ -75,7 +77,7 @@ { if ( param->arg && *param->arg ) { - char *res = AllocNormalizedFilenameCygwin(param->arg); + char *res = AllocNormalizedFilenameCygwin(param->arg,false); FREE(param->arg); param->arg = res; } @@ -89,7 +91,7 @@ void SetSource ( ccp source ) { #ifdef __CYGWIN__ opt_source = IsWindowsDriveSpec(source) - ? AllocNormalizedFilenameCygwin(source) + ? AllocNormalizedFilenameCygwin(source,false) : source; #else opt_source = source; @@ -106,7 +108,7 @@ void SetDest ( ccp dest, bool mkdir ) { #ifdef __CYGWIN__ opt_dest = IsWindowsDriveSpec(dest) - ? AllocNormalizedFilenameCygwin(dest) + ? AllocNormalizedFilenameCygwin(dest,false) : dest; #else opt_dest = dest; @@ -1821,53 +1823,382 @@ bool PATCH_ACTION_LOG ( ccp action, ccp object, ccp format, ... ) // /////////////////////////////////////////////////////////////////////////////// -/////////////// auto add support /////////////// +/////////////// scan configuration /////////////// +/////////////////////////////////////////////////////////////////////////////// + +void ResetConfig ( config_t *config ) +{ + DASSERT(config); + FreeString(config->config_file); + FreeString(config->base_path); + FreeString(config->install_path); + FreeString(config->install_config); + FreeString(config->share_path); + FreeString(config->autoadd_path); + InitializeConfig(config); +} + /////////////////////////////////////////////////////////////////////////////// -bool SetupAutoAdd() +enumError ScanConfig +( + config_t *config, // store configuration here + ccp path, // NULL or path + bool silent // true: suppress printing of error messages +) { + ASSERT(config); + ResetConfig(config); + config->config_file = path ? STRDUP(path) : 0; + + + //--- setup paths + + exmem_list_t paths; + InitializeEML(&paths); + + #ifdef __CYGWIN__ + ccp base_path = "$(programfiles)"; + ccp install_path = opt_install ? "$(base)/Wiimm/SZS" : ProgramDirectory(); + ccp share_path = opt_install ? "$(install)" : std_share_path; + #else + ccp base_path = "/usr/local"; + ccp install_path = opt_install ? "$(base)/bin" : ProgramDirectory(); + ccp share_path = opt_install ? "$(base)/share/szs" : std_share_path; + #endif + + ccp install_config = opt_install ? "" : config->config_file; + + struct assign_t { ccp name; ccp init; ccp *var; }; + const struct assign_t assign_tab[] = + { + { "base", base_path, &config->base_path }, + { "install", install_path, &config->install_path }, + { "config", install_config, &config->install_config }, + { "share", share_path, &config->share_path }, + { "autoadd", "$(share)/auto-add", &config->autoadd_path }, + {0,0,0} + }; + + const struct assign_t *assign; + for ( assign = assign_tab; assign->name; assign++ ) + if (assign->init) + { + exmem_t data = ExMemByString(assign->init); + InsertEML(&paths,assign->name,CPM_LINK,&data,CPM_COPY); + } + + AddStandardSymbolsEML(&paths,false); + //DumpEML(stdout,2,&paths,0); + + + //--- scan file + + const ListDef_t list_def[] = + { + { "paths", 0, 0, &paths }, + {0,0,0,0} + }; + + const enumError err = path && *path + ? ScanSetupFile(0,list_def,path,0,0,silent) + : ERR_OK; + + ResolveAllSymbolsEML(&paths); + //DumpEML(stdout,2,&paths,0); + + + //--- assign known values + + char buf[1000]; + for ( assign = assign_tab; assign->name; assign++ ) + { + if (assign->var) + { + exmem_key_t *ref = FindEML(&paths,assign->name); + if (ref) + { + FreeString(*assign->var); + NormalizeFileName(buf,sizeof(buf),ref->data.data.ptr,true,true,TRSL_REMOVE); + *assign->var = STRDUP(buf); + } + else + *assign->var = EmptyString; + } + } + + ResetEML(&paths); + return err; +} + +/////////////////////////////////////////////////////////////////////////////// + +void SearchConfigHelper ( search_file_list_t *sfl, int stop_mode ) +{ + DASSERT(sfl); + InitializeSearchFile(sfl); + + ccp opt[] = { opt_config, opt_install ? "$(prog)/install.conf" : 0, 0, }; + ccp xdg_home = "szs"; + ccp home = ".szs"; + ccp etc[] = { "wiimm", "" }; + + SearchConfig(sfl,CONFIG_FILE, opt,2, &xdg_home,1, &home,1, etc,2, etc+1,1, 0,0, stop_mode ); + if (logging>3) + DumpSearchFile(stdout,2,sfl,logging>4,"Config search list"); +} + +//----------------------------------------------------------------------------- + +const config_t * GetConfig() +{ + static config_t config; static bool done = false; if (!done) { done = true; - ccp *spath = search_path; - ccp *apath = auto_add_path; - while (*spath) + search_file_list_t sfl; + SearchConfigHelper(&sfl,2); + + uint i; + ccp found = 0; + search_file_t *sf = sfl.list; + for ( i = 0; i < sfl.used; i++, sf++ ) + if ( sf->itype >= INTY_REG ) + { + found = sf->fname; + break; + } + + InitializeConfig(&config); + ScanConfig(&config,found,false); + ResetSearchFile(&sfl); + + if ( verbose >= 3 ) + PrintConfig(stderr,&config,true); + } + + return &config; +} + +//----------------------------------------------------------------------------- + +void PrintConfig ( FILE *f, const config_t *config, bool verbose ) +{ + if ( f && config ) + { + fprintf(f, + "\nConfiguration:\n" + " config file: %s\n" + ,config->config_file ? config->config_file : "" + ); + if (verbose) + fprintf(f, + " base path: %s\n" + " install path: %s\n" + " install config: %s\n" + ,config->base_path + ,config->install_path + ,config->install_config + ); + fprintf(f, + " share path: %s\n" + " auto-add path: %s\n" + ,config->share_path + ,config->autoadd_path + ); + } +} + +//----------------------------------------------------------------------------- + +struct config_offset_t { uint mode; ccp name; uint offset; }; +static const struct config_offset_t config_offset_tab[] = +{ + { 0,"config", offsetof(config_t,config_file) }, + { 1,"base", offsetof(config_t,base_path) }, + { 1,"install", offsetof(config_t,install_path) }, + { 1,"config", offsetof(config_t,install_config) }, + { 1,"share", offsetof(config_t,share_path) }, + { 1,"autoadd", offsetof(config_t,autoadd_path) }, + {0,0} +}; + +//----------------------------------------------------------------------------- + +void PrintConfigScript ( FILE *f, const config_t *config ) +{ + if ( f && config ) + { + PrintScript_t ps; + SetupPrintScriptByOptions(&ps); + ps.f = f; + ps.eq_tabstop = 1; + ps.auto_quote = true; + + PrintScriptVars(&ps,3, + "base=\"%s\"\n" + "install=\"%s\"\n" + "config=\"%s\"\n" + "share=\"%s\"\n" + "autoadd=\"%s\"\n" + ,config->base_path + ,config->install_path + ,config->install_config ? config->install_config : "" + ,config->share_path + ,config->autoadd_path + ); + } +} + +//----------------------------------------------------------------------------- + +void PrintConfigFile ( FILE *f, const config_t *config ) +{ + if ( f && config ) + { + config_t dest; + InitializeConfig(&dest); + + const struct config_offset_t *ptr; + for ( ptr = config_offset_tab; ptr->name; ptr++ ) { - char path_buf[PATH_MAX]; - ccp path = PathCatPP(path_buf,sizeof(path_buf),*spath++,"auto-add"); - if (IsDirectory(path,0)) + if (!ptr->mode) + continue; + + ccp *destval = (ccp*)((char*)&dest + ptr->offset); + + bool done = false; + ccp val = *(ccp*)((char*)config + ptr->offset); + if (val) { - PRINT("AUTO-PATH[%u] = %s\n",(int)(apath-auto_add_path),path); - *apath++ = STRDUP(path); - DASSERT( apath - auto_add_path - < sizeof(auto_add_path)/sizeof(*auto_add_path) ); + const int len = strlen(val); + const struct config_offset_t *ptr2; + for ( ptr2 = ptr-1; ptr2 >= config_offset_tab; ptr2-- ) + { + ccp val2 = *(ccp*)((char*)config + ptr2->offset); + if ( ptr2->mode && val2 ) + { + const int len2 = strlen(val2); + if ( len2 > 1 && ( len2 == len || len2 < len && val[len2] == '/' ) + && !memcmp(val,val2,len2) ) + { + ccp res = PRINTDUP("$(%s)%s",ptr2->name,val+len2); + *destval = QuoteStringCircS(res,EmptyQuote,CHMD__MODERN); + FreeString(res); + done = true; + break; + } + } + } } + + if (!done) + *destval = QuoteStringCircS(val,EmptyQuote,CHMD__MODERN); } - *apath = 0; + + if ( brief_count > 0 ) + fprintf(f,"[PATHS]\n" + "base\t= %s\n" + "install\t= %s\n" + "config\t= %s\n" + "share\t= %s\n" + "autoadd\t= %s\n" + ,dest.base_path + ,dest.install_path + ,dest.install_config + ,dest.share_path + ,dest.autoadd_path + ); + else + fprintf(f,text_config_paths_cr + ,dest.base_path + ,dest.install_path + ,dest.install_config + ,dest.share_path + ,dest.autoadd_path + ); + + ResetConfig(&dest); } +} + +/////////////////////////////////////////////////////////////////////////////// - return auto_add_path[0] != 0; +const StringField_t * GetSearchList() +{ + static StringField_t search_list = {0}; + if (!search_list.field) + { + InitializeStringField(&search_list); + const config_t *config = GetConfig(); + AppendUniqueStringField(&search_list,config->share_path,false); + AppendUniqueStringField(&search_list,std_share_path,false); + AppendUniqueStringField(&search_list,ProgramDirectory(),false); + } + return &search_list; } /////////////////////////////////////////////////////////////////////////////// -bool DefineAutoAddPath ( ccp path ) +ccp autoadd_destination = 0; +static StringField_t opt_autoadd = {0}; + +//----------------------------------------------------------------------------- + +const StringField_t * GetAutoaddList() { - SetupAutoAdd(); - if (path) + static StringField_t autoadd_list = {0}; + if (!autoadd_list.field) { - uint i; - for ( i = 0; i < sizeof(auto_add_path)/sizeof(*auto_add_path); i++ ) + InitializeStringField(&autoadd_list); + + if (autoadd_destination) + AppendUniqueStringField(&autoadd_list,autoadd_destination,false); + + int i; + ccp *str = opt_autoadd.field; + for ( i = 0; i < opt_autoadd.used; i++, str++ ) + AppendUniqueStringField(&autoadd_list,*str,false); + + const config_t *config = GetConfig(); + if (IsDirectory(config->autoadd_path,0)) + AppendUniqueStringField(&autoadd_list,config->autoadd_path,false); + + if (IsDirectory("auto-add",false)) + AppendUniqueStringField(&autoadd_list,"auto-add",false); + + char buf[PATH_MAX]; + const StringField_t *sf = GetSearchList(); + str = sf->field; + for ( i = 0; i < sf->used; i++, str++ ) { - FreeString(auto_add_path[i]); - auto_add_path[i] = 0; + PathCatPP(buf,sizeof(buf),*str,"auto-add"); + if (IsDirectory(buf,false)) + AppendUniqueStringField(&autoadd_list,buf,false); } - auto_add_path[0] = STRDUP(path); } + return &autoadd_list; +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// auto add support /////////////// +/////////////////////////////////////////////////////////////////////////////// - return auto_add_path[0] != 0; +bool IsAutoAddAvailable() +{ + const StringField_t *al = GetAutoaddList(); + return al->used > 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +void DefineAutoAddPath ( ccp path ) +{ + if (IsDirectory(path,false)) + AppendUniqueStringField(&opt_autoadd,path,false); } /////////////////////////////////////////////////////////////////////////////// @@ -1878,22 +2209,17 @@ s64 FindAutoAdd ( ccp fname, ccp ext, char *buf, uint buf_size ) DASSERT(buf); DASSERT( buf_size > 100 ); - if (!SetupAutoAdd()) - return -1; - - ccp *apath = auto_add_path; - while (*apath) + int i; + const StringField_t *al = GetAutoaddList(); + ccp *str = al->field; + for ( i = 0; i < al->used; i++, str++ ) { - PathCatBufPPE(buf,buf_size,*apath++,fname,ext); + PathCatBufPPE(buf,buf_size,*str,fname,ext); struct stat st; if ( !stat(buf,&st) && S_ISREG(st.st_mode) ) - { - noPRINT("FindAutoAdd(%s) -> %llu %s\n",fname,(u64)st.st_size,buf); return st.st_size; - } } - noPRINT("FindAutoAdd(%s) FAILED\n",fname); *buf = 0; return -1; } @@ -2183,24 +2509,37 @@ size_t ResetSetup /////////////////////////////////////////////////////////////////////////////// -static char * trim_line ( char * ptr, char ** begin ) +static char * trim_line ( char * ptr, bool allow_quote, char ** begin ) { DASSERT(ptr); while ( *ptr > 0 && *ptr <= ' ' ) ptr++; - char *start = ptr; - if (begin) - *begin = ptr; + if ( allow_quote && (*ptr == '"' || *ptr == '\'') ) + { + const int slen = strlen(ptr); + uint scanned_len; + int elen = ScanEscapedString(ptr,slen,ptr,slen,true,-1,&scanned_len); + if (begin) + *begin = ptr; + ptr[elen] = 0; + ptr += scanned_len; + } + else + { + char *start = ptr; + if (begin) + *begin = ptr; - while (*ptr) - ptr++; + while ( *ptr) + ptr++; - ptr--; - while ( *ptr > 0 && *ptr <= ' ' && ptr > start ) ptr--; - *++ptr = 0; + while ( *ptr > 0 && *ptr <= ' ' && ptr > start ) + ptr--; + *++ptr = 0; + } return ptr; } @@ -2208,19 +2547,19 @@ static char * trim_line ( char * ptr, char ** begin ) enumError ScanSetupFile ( - SetupDef_t * sdef, // object list terminated with an element 'name=NULL' - ListDef_t * ldef, // NULL or object list terminated - // with an element 'name=NULL' - ccp path1, // filename of text file, part 1 - ccp path2, // filename of text file, part 2 - SubDir_t * sdir, // not NULL: use it and ignore 'path1' - bool silent // true: suppress error message if file not found + SetupDef_t * sdef, // object list terminated with an element 'name=NULL' + const ListDef_t * ldef, // NULL or object list terminated + // with an element 'name=NULL' + ccp path1, // filename of text file, part 1 + ccp path2, // filename of text file, part 2 + SubDir_t * sdir, // not NULL: use it and ignore 'path1' + bool silent // true: suppress error message if file not found ) { - DASSERT(sdef); DASSERT(path1||path2); - ResetSetup(sdef); + if (sdef) + ResetSetup(sdef); char pathbuf[PATH_MAX]; ccp path; @@ -2265,7 +2604,7 @@ enumError ScanSetupFile if ( *ptr == '[' ) { - ptr = trim_line(ptr,0); + ptr = trim_line(ptr,false,0); if ( ptr[-1] == ']' ) { section_found = true; @@ -2274,6 +2613,10 @@ enumError ScanSetupFile continue; } + if (!sdef) + continue; + + //----- find end of name char * name = ptr; @@ -2284,6 +2627,7 @@ enumError ScanSetupFile char * name_end = ptr; + //----- skip spaces and check for '=' while ( *ptr > 0 && *ptr <= ' ' ) @@ -2303,11 +2647,11 @@ enumError ScanSetupFile if (!item->name) continue; + //----- trim parameter - ptr++; // skip '=' char * param; - ptr = trim_line(ptr,¶m); + trim_line(ptr+1,true,¶m); item->param = STRDUP(param); if (item->factor) @@ -2321,7 +2665,7 @@ enumError ScanSetupFile while ( section_found && ldef ) { char * beg; - char * ptr = trim_line(iobuf,&beg) - 1; + char * ptr = trim_line(iobuf,false,&beg) - 1; if ( *beg != '[' || *ptr != ']' ) break; @@ -2329,19 +2673,22 @@ enumError ScanSetupFile beg++; TRACE("SECTION |%s|\n",beg); StringField_t *sf = 0; + exmem_list_t *eml = 0; bool append = false; - ListDef_t * ld; + const ListDef_t * ld; for ( ld = ldef; ld->name; ld++ ) - if (!strcmp(beg,ld->name)) + if (!strcasecmp(beg,ld->name)) { - sf = ld->sf; + sf = ld->sf; + eml = ld->eml; append = ld->append; break; } + int index = 0; while (fgets(iobuf,sizeof(iobuf)-1,f)) { - char * ptr = trim_line(iobuf,&beg); + char * ptr = trim_line(iobuf,false,&beg); if ( *beg == '[' ) { if ( ptr[-1] == ']' ) @@ -2349,15 +2696,40 @@ enumError ScanSetupFile continue; } - if ( *beg == '.' && beg[1] == '/' ) - beg += 2; - if ( !sf || !*beg || *beg == '#' ) + if ( !*beg || *beg == '#' ) continue; - TRACE("INSERT |%s|\n",beg); - if (append) - AppendStringField(sf,beg,false); - else - InsertStringField(sf,beg,false); + + if (sf) + { + ccp path = beg; + if ( *path == '.' && path[1] == '/' ) + path += 2; + PRINT("INSERT SP |%s|\n",path); + if (append) + AppendStringField(sf,path,false); + else + InsertStringField(sf,path,false); + } + + if (eml) + { + char *eq = strchr(beg,'='); + if (eq) + { + *eq++ = 0; + char *name, *val; + trim_line(beg,false,&name); + trim_line(eq,true,&val); + + StringLowerS(pathbuf,sizeof(pathbuf),name); + exmem_t data = ExMemByString(val); + data.attrib = index++; + if (append) + AppendEML(eml,pathbuf,CPM_COPY,&data,CPM_MOVE); + else + ReplaceEML(eml,pathbuf,CPM_COPY,&data,CPM_MOVE); + } + } } } @@ -2462,7 +2834,7 @@ enumError ScanSetupParam InitializeStringField(&encode_helper); InitializeStringField(&order_helper); - ListDef_t list_def[] = + const ListDef_t list_def[] = { { "include-pattern", 0, &sp->include_pattern }, { "include", 0, &sp->include_name }, @@ -3254,13 +3626,15 @@ void AnalyzeSlotAttrib ( slot_info_t *si, bool reset_si, mem_t attrib ) if ( src[0]=='r' && src[1]>='1' && src[1]<='8' && src[2]>='1' && src[2]<='4' ) { const u16 slot = strtoul(src+1,0,10); - if (!si->have_31_71) + if ( !si->have_31_71 && !si->have_31_42_71 && !si->have_31_62_71 ) { si->race_mode = SIT_RECOMMEND; si->race_slot = slot; StringCopySM(si->race_info,sizeof(si->race_info),src,3); } - else if ( slot == 31 || slot == 71 ) + else if ( slot == 31 || slot == 71 + || slot == 42 && si->have_31_42_71 + || slot == 62 && si->have_31_62_71 ) { si->race_mode = SIT_MANDATORY; si->race_slot = slot; @@ -3326,6 +3700,41 @@ void AnalyzeSlotAttrib ( slot_info_t *si, bool reset_si, mem_t attrib ) StringCopySM(si->arena_info,sizeof(si->arena_info),src,5); } break; + + case 8: + if (!memcmp(src,"31+42+71",8)) + { + si->have_31_42_71 = true; + if ( si->race_mode != SIT_MANDATORY3 + && (si->race_slot == 31 || si->race_slot == 42 || si->race_slot == 71 )) + { + si->race_mode = SIT_MANDATORY; + snprintf(si->race_info,sizeof(si->race_info),"%u",si->race_slot); + } + else + { + si->race_mode = SIT_MANDATORY3; + si->race_slot = 31; + StringCopySM(si->race_info,sizeof(si->race_info),src,8); + } + } + else if (!memcmp(src,"31+62+71",8)) + { + si->have_31_62_71 = true; + if ( si->race_mode != SIT_MANDATORY3 + && (si->race_slot == 31 || si->race_slot == 62 || si->race_slot == 71 )) + { + si->race_mode = SIT_MANDATORY; + snprintf(si->race_info,sizeof(si->race_info),"%u",si->race_slot); + } + else + { + si->race_mode = SIT_MANDATORY3; + si->race_slot = 31; + StringCopySM(si->race_info,sizeof(si->race_info),src,8); + } + } + break; } } } @@ -3386,7 +3795,7 @@ void FinalizeSlotInfo ( slot_info_t *si, bool minus_for_empty ) //--- create slot info - char slot_attrib[20], *dest = slot_attrib, *end = slot_attrib + sizeof(slot_attrib); + char slot_attrib[24], *dest = slot_attrib, *end = slot_attrib + sizeof(slot_attrib); if (si->race_info[0]) dest = StringCat2E(dest,end,",",si->race_info); if (si->arena_info[0]) diff --git a/project/src/lib-kcl.c b/project/src/lib-kcl.c index 1257ef0..6c4de32 100644 --- a/project/src/lib-kcl.c +++ b/project/src/lib-kcl.c @@ -3697,7 +3697,7 @@ enumError ScanTextKCL && !k && (KCL_MODE & KCLMD_AUTO) ) { - PRINT1("NORMAL FOUND: %u\n",idx-1); + PRINT("NORMAL FOUND: %u\n",idx-1); norm = idx - 1; } } diff --git a/project/src/lib-kmp-draw.c b/project/src/lib-kmp-draw.c index 11d6293..23f573b 100644 --- a/project/src/lib-kmp-draw.c +++ b/project/src/lib-kmp-draw.c @@ -2466,7 +2466,7 @@ enumError DrawPosFile ( DrawKCL_t *draw, pos_file_t *pf ) bool old; ParamFieldItem_t *it - = FindInsertParamField(&pos_autocolor,cols[pp->autocolor],false,&old); + = FindInsertParamField(&pos_autocolor,cols[pp->autocolor],false,0,&old); if (it) { if (!old) diff --git a/project/src/lib-kmp-pflags.c b/project/src/lib-kmp-pflags.c index f62b246..9e3e674 100644 --- a/project/src/lib-kmp-pflags.c +++ b/project/src/lib-kmp-pflags.c @@ -320,10 +320,10 @@ uint CountDefObjUsage ( const kmp_t *kmp, u16 obj_id ) ccp GetDefObjConditionName ( u16 cond ) { - const gobj_cond_ref_t *rc; - for ( rc = cond_ref_tab; rc->ref_id; rc++ ) - if ( rc->cond_mask == cond && !(rc->option & 4) ) - return PrintCircBuf("C$%s",rc->name); + const gobj_cond_ref_t *gcr; + for ( gcr = cond_ref_tab; gcr->ref_id; gcr++ ) + if ( gcr->cond_mask == cond && !(gcr->option & 4) ) + return PrintCircBuf("C$%s",gcr->name); return PrintCircBuf("0x%04x",cond); } diff --git a/project/src/lib-kmp.c b/project/src/lib-kmp.c index 5ffe9f0..7c39d97 100644 --- a/project/src/lib-kmp.c +++ b/project/src/lib-kmp.c @@ -1257,7 +1257,7 @@ void SetupClassNamePH const struct inttab_t *ptr; for ( ptr = inttab; ptr->name; ptr++ ) { - ParamFieldItem_t *it = FindInsertParamField(&ph->class_name,ptr->name,false,0); + ParamFieldItem_t *it = FindInsertParamField(&ph->class_name,ptr->name,false,0,0); DASSERT(it); it->num = ptr->val; } @@ -1285,7 +1285,7 @@ int InsertClassNamePH SetupClassNamePH(ph); bool old_found; - ParamFieldItem_t *it = FindInsertParamField(&ph->class_name,cname,false,&old_found); + ParamFieldItem_t *it = FindInsertParamField(&ph->class_name,cname,false,0,&old_found); DASSERT(it); if (!old_found) { @@ -1489,7 +1489,7 @@ void RenameGroupKMP // /////////////////////////////////////////////////////////////////////////////// -/////////////// KMP pathes /////////////// +/////////////// KMP paths /////////////// /////////////////////////////////////////////////////////////////////////////// typedef struct kmp_link_t @@ -5755,12 +5755,14 @@ void EvaluateUsedPosObj ( kmp_usedpos_obj_t *obj ) value = temp; const float fail = obj->allowed.v[i]; + const float err = fail - 2500.0; const float warn = fail - 5000.0; const float hint = fail - 10000.0; - if ( rating < WLEVEL_FAIL && value > fail ) rating = WLEVEL_FAIL; - else if ( rating < WLEVEL_WARN && value > warn ) rating = WLEVEL_WARN; - else if ( rating < WLEVEL_HINT && value > hint ) rating = WLEVEL_HINT; + if ( rating < WLEVEL_FAIL && value > fail ) rating = WLEVEL_FAIL; + else if ( rating < WLEVEL_ERROR && value > err ) rating = WLEVEL_ERROR; + else if ( rating < WLEVEL_WARN && value > warn ) rating = WLEVEL_WARN; + else if ( rating < WLEVEL_HINT && value > hint ) rating = WLEVEL_HINT; if ( i == 1 ) { @@ -6050,7 +6052,14 @@ void CheckWarnKMP ( kmp_t *kmp, kmp_usedpos_t *up ) } CheckUsedPos(kmp,up); - if ( up->suggest->max_rating >= WLEVEL_WARN ) + #if 0 + PRINT1("O: "); PrintUsedPosObj(stderr,0,&up->orig); + PRINT1("OL: "); PrintUsedPosObj(stderr,0,&up->orig_lex); + PRINT1("C: "); PrintUsedPosObj(stderr,0,&up->center); + PRINT1("CL: "); PrintUsedPosObj(stderr,0,&up->center_lex); + PRINT1("S: "); PrintUsedPosObj(stderr,0,up->suggest); + #endif + if ( up->orig_lex.max_rating >= WLEVEL_ERROR ) kmp->warn_bits |= 1 << WARNSZS_ITEMPOS; //------------------------------------------------------------------------- diff --git a/project/src/lib-lecode.c b/project/src/lib-lecode.c index 0222315..05d3c00 100644 --- a/project/src/lib-lecode.c +++ b/project/src/lib-lecode.c @@ -61,11 +61,8 @@ OffOn_t opt_200cc = OFFON_AUTO; OffOn_t opt_perfmon = OFFON_AUTO; OffOn_t opt_custom_tt = OFFON_AUTO; OffOn_t opt_xpflags = OFFON_AUTO; -OffOn_t opt_speedo = OFFON_AUTO; - -int opt_reserved_1b9 = -1; -int opt_reserved_1ba = -1; -int opt_reserved_1bb = -1; +int opt_speedo = OFFON_AUTO; +int opt_lecode_debug = OFFON_AUTO; bool opt_complete = false; @@ -154,11 +151,39 @@ int ScanOptXPFlags ( ccp arg ) } /////////////////////////////////////////////////////////////////////////////// +// [[speedo_mode_t]] [[copy-lecode]] copy changes to LE-CODE + +typedef enum speedo_mode_t +{ + SPEEDO_OFF = 0, + SPEEDO_ON, + SPEEDO_FRACTION1, + SPEEDO_FRACTION2, + SPEEDO_FRACTION3, + SPEEDO_MAX = SPEEDO_FRACTION3, // max allowed value +} +speedo_mode_t; + +//----------------------------------------------------------------------------- int ScanOptSpeedometer ( ccp arg ) { + const KeywordTab_t keytab[] = + { + { OFFON_OFF, "OFF", "-1", 0 }, + { OFFON_AUTO, "AUTO", 0, 0 }, + { SPEEDO_ON, "ON", 0, 0 }, + { SPEEDO_ON, "FORCE", 0, 0 }, // legacy, [[obsolete]], remove in 2022 + { SPEEDO_ON, "0DIGITS", "0", 0 }, + { SPEEDO_FRACTION1,"FRACTION", 0, 0 }, + { SPEEDO_FRACTION1,"1DIGITS", "1", 0 }, + { SPEEDO_FRACTION2,"2DIGITS", "2", 0 }, + { SPEEDO_FRACTION3,"3DIGITS", "3", 0 }, + { 0,0,0,0 } + }; + const int stat - = ScanKeywordOffAutoOn(arg,OFFON_ON,OFFON_ON,"Option --speedo"); + = ScanKeywordOffAutoOnEx(keytab,arg,OFFON_ON,0,"Option --speedo"); if ( stat == OFFON_ERROR ) return 1; @@ -167,28 +192,94 @@ int ScanOptSpeedometer ( ccp arg ) return 0; } +//----------------------------------------------------------------------------- + +ccp GetLecodeSpeedoName ( speedo_mode_t mode ) +{ + switch (mode) + { + case SPEEDO_OFF: break; + case SPEEDO_ON: return "0"; + case SPEEDO_FRACTION1: return "1"; + case SPEEDO_FRACTION2: return "2"; + case SPEEDO_FRACTION3: return "3"; + // no default! => compiler warnings for missed values + } + return "OFF"; +} + /////////////////////////////////////////////////////////////////////////////// -int ScanOptReserved_1b9 ( ccp arg ) +ccp GetLecodeDebugName ( le_debug_mode_t mode ) { - opt_reserved_1b9 = str2l(arg,0,10); - PRINT("RESERVED_1B9=%d\n",opt_reserved_1b9); - return 0; + switch (mode) + { + case DEBUGMD_OFF: + case DEBUGMD__N: break; + case DEBUGMD_ENABLED: return "ENABLED"; + case DEBUGMD_DEBUG1: + case DEBUGMD_DEBUG2: + case DEBUGMD_DEBUG3: + case DEBUGMD_DEBUG4: return PrintCircBuf("%u",mode-DEBUGMD_DEBUG1+1); + // no default! => compiler warnings for missed values + } + return "OFF"; } -int ScanOptReserved_1ba ( ccp arg ) +//----------------------------------------------------------------------------- + +ccp GetLecodeDebugInfo ( le_debug_mode_t mode ) { - opt_reserved_1ba = str2l(arg,0,10); - PRINT("RESERVED_1BA=%d\n",opt_reserved_1ba); + switch (mode) + { + case DEBUGMD_OFF: return "disabled"; + case DEBUGMD_ENABLED: return "enabled but hidden"; + case DEBUGMD_DEBUG1: + case DEBUGMD_DEBUG2: + case DEBUGMD_DEBUG3: + case DEBUGMD_DEBUG4: return PrintCircBuf("view DEBUG-%u",mode-DEBUGMD_DEBUG1+1); + case DEBUGMD__N: break; + // no default! => compiler warnings for missed values + } + return "?"; +} + +//----------------------------------------------------------------------------- + +int ScanOptDebug ( ccp arg ) +{ + const KeywordTab_t keytab[] = + { + { OFFON_OFF, "OFF", "-1", 0 }, + { OFFON_AUTO, "AUTO", "0", 0 }, + { DEBUGMD_ENABLED,"USER", "1", 0 }, + { DEBUGMD_DEBUG1, "DEBUG1", "D1", 0 }, + { DEBUGMD_DEBUG2, "DEBUG2", "D2", 0 }, + { DEBUGMD_DEBUG3, "DEBUG3", "D3", 0 }, + { DEBUGMD_DEBUG4, "DEBUG4", "D4", 0 }, + { 0,0,0,0 } + }; + + const int stat + = ScanKeywordOffAutoOnEx(keytab,arg,OFFON_ON,DEBUGMD__N-1,"Option --debug"); + if ( stat == OFFON_ERROR ) + return 1; + + opt_lecode_debug = stat; + PRINT("LE-DEBUG=%d (%s)\n",opt_lecode_debug,GetLecodeDebugInfo(opt_lecode_debug)); return 0; } +/////////////////////////////////////////////////////////////////////////////// + +#if 0 int ScanOptReserved_1bb ( ccp arg ) { opt_reserved_1bb = str2l(arg,0,10); - PRINT("RESERVED_1BB=%d\n",opt_reserved_1b9); + PRINT("RESERVED_1BB=%d\n",opt_reserved_1bb); return 0; } +#endif /////////////////////////////////////////////////////////////////////////////// @@ -287,12 +378,273 @@ const VarMap_t * SetupVarsLECODE() { static VarMap_t vm = {0}; if (!vm.used) + { DefineMkwVars(&vm); + //DefineParserFuncTab(lex_func_tab,FF_LPAR); + DefineParserVars(&vm); + + //--- setup integer variables + + struct inttab_t { ccp name; int val; }; + static const struct inttab_t inttab[] = + { + { "DEBUG$OFF", PREDEBUG_OFF }, + { "DEBUG$CLEAR", PREDEBUG_CLEAR }, + { "DEBUG$STANDARD", PREDEBUG_STANDARD }, + { "DEBUG$OPPONENT", PREDEBUG_OPPONENT }, + { "DEBUG$VERTICAL", PREDEBUG_VERTICAL }, + + { "DEBUG$ENABLED", DEBUGMD_ENABLED }, + { "DEBUG$0", DEBUGMD_ENABLED }, + { "DEBUG$1", DEBUGMD_DEBUG1 }, + { "DEBUG$2", DEBUGMD_DEBUG2 }, + { "DEBUG$3", DEBUGMD_DEBUG3 }, + { "DEBUG$4", DEBUGMD_DEBUG4 }, + + { "SPEEDO$OFF", SPEEDO_OFF }, + { "SPEEDO$0", SPEEDO_ON }, + { "SPEEDO$1", SPEEDO_FRACTION1 }, + { "SPEEDO$2", SPEEDO_FRACTION2 }, + { "SPEEDO$3", SPEEDO_FRACTION3 }, + + {0,0} + }; + + const struct inttab_t * ip; + for ( ip = inttab; ip->name; ip++ ) + DefineIntVar(&vm,ip->name,ip->val); + } return &vm; } // /////////////////////////////////////////////////////////////////////////////// +/////////////// LE-CODE Debug /////////////// +/////////////////////////////////////////////////////////////////////////////// + +ccp GetDebugModeSummary ( const lecode_debug_info_t *ldi ) +{ + DASSERT(ldi); + return PrintCircBuf("I=%d,%d, M:%02x,%02x, %s=%u", + ldi->index, ldi->filter_active, ldi->mode, ldi->relevant, + ldi->name ? ldi->name : "-", ldi->value ); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool GetFirstDebugMode + ( lecode_debug_info_t *ldi, lecode_debug_t mode, bool filter_active ) +{ + DASSERT(ldi); + memset(ldi,0,sizeof(*ldi)); + ldi->mode = mode & LEDEB__ALL; + ldi->filter_active = filter_active; + + return GetNextDebugMode(ldi); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool GetNextDebugMode ( lecode_debug_info_t *ldi ) +{ + struct tab_t + { + lecode_debug_t mode; + int shift; + const char name[12]; + }; + + static const struct tab_t tab[] = + { + { LEDEB_ENABLED, 0, "ENABLED" }, + { LEDEB_OPPONENT, 0, "OPPONENT" }, + { LEDEB_SPACE, 0, "SPACE" }, + { LEDEB_POSITION, 0, "POSITION" }, + { LEDEB_CHECK_POINT, LEDEB_S_CHECK_POINT, "CHECK-POINT" }, + { LEDEB_RESPAWN, 0, "RESPAWN" }, + { LEDEB_LAP_POS, 0, "LAP-POS" }, + }; + + while ( ldi->index >= 0 && ldi->index < sizeof(tab)/sizeof(*tab) ) + { + const struct tab_t *ptr = tab + ldi->index++; + if ( ldi->filter_active && !(ptr->mode&ldi->mode) ) + continue; + + ldi->relevant = ptr->mode; + ldi->name = ptr->name; + ldi->value = ldi->mode & ptr->mode; + if (ptr->shift) + ldi->value >>= ptr->shift; + else + ldi->value = ldi->value != 0; + return true; + } + + ldi->index = -1; + ldi->relevant = 0; + ldi->name = 0; + ldi->value = 0; + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +lecode_debug_t DecodeLecodeDebug ( lecode_debug_ex_t *lde, lecode_debug_t mode ) +{ + DASSERT(lde); + memset(lde,0,sizeof(*lde)); + + mode &= LEDEB__ALL; + lde->mode = mode; + lde->enabled = ( mode & LEDEB_ENABLED ) > 0; + lde->opponent = ( mode & LEDEB_OPPONENT ) > 0; + lde->space = ( mode & LEDEB_SPACE ) > 0; + lde->position = ( mode & LEDEB_POSITION ) > 0; + lde->check_point = mode >> LEDEB_S_CHECK_POINT & LEDEB_M_CHECK_POINT; + lde->respawn = ( mode & LEDEB_RESPAWN ) > 0; + lde->lap_pos = ( mode & LEDEB_LAP_POS ) > 0; + + lde->have_output = isDebugModeOutput(mode); + lde->is_active = isDebugModeActive(mode); + + return mode; +} + +/////////////////////////////////////////////////////////////////////////////// + +lecode_debug_t EncodeLecodeDebug ( lecode_debug_ex_t *lde ) +{ + DASSERT(lde); + + lecode_debug_t mode = ( lde->check_point & LEDEB_M_CHECK_POINT ) << LEDEB_S_CHECK_POINT; + if ( lde->enabled ) mode |= LEDEB_ENABLED; + if ( lde->opponent ) mode |= LEDEB_OPPONENT; + if ( lde->space ) mode |= LEDEB_SPACE; + if ( lde->position ) mode |= LEDEB_POSITION; + if ( lde->respawn ) mode |= LEDEB_RESPAWN; + if ( lde->lap_pos ) mode |= LEDEB_LAP_POS; + + return DecodeLecodeDebug(lde,mode); // normalize all settings +} + +/////////////////////////////////////////////////////////////////////////////// + +ccp GetPredefDebugName ( predef_debug_t pd_mode ) +{ + switch ( pd_mode ) + { + case PREDEBUG_OFF: break; + case PREDEBUG_CLEAR: return "CLEAR"; + case PREDEBUG_STANDARD: return "STANDARD"; + case PREDEBUG_OPPONENT: return "OPPONENT"; + case PREDEBUG_VERTICAL: return "VERTICAL"; + // no default! => compiler warnings for missed values + } + return "OFF"; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool SetupLecodeDebugLPAR +( + le_lpar_t *lpar, // LE-CODE parameters + uint config, // configuration index 0.. + uint setup_mode, // setup mode, one of PREDEBUG_* + int *hide_speedo // if not NULL: store new mode here +) +{ + DASSERT(lpar); + DASSERT( config >= 0 && config < DEBUGMD__N-DEBUGMD_DEBUG1 ); + + + //--- setup data table + + struct setup_t + { + u16 predef; + s16 line; + u32 mode; + }; + + static const struct setup_t setup_tab[] = + { + { PREDEBUG_CLEAR, 0, 0 }, + + { PREDEBUG_STANDARD, 1, LEDEB__STD }, + + { PREDEBUG_OPPONENT, 1, LEDEB__STD }, + { PREDEBUG_OPPONENT, 2, LEDEB__STD|LEDEB_OPPONENT }, + + { PREDEBUG_VERTICAL,-1, 0 }, // hide speedo + { PREDEBUG_VERTICAL, 1, LEDEB_CHECK_POINT }, + { PREDEBUG_VERTICAL, 2, LEDEB_RESPAWN }, + { PREDEBUG_VERTICAL, 3, LEDEB_LAP_POS }, + { PREDEBUG_VERTICAL, 4, LEDEB_POSITION }, + + {0,0,0} + }; + + const struct setup_t *ptr; + for ( ptr = setup_tab; ptr->predef; ptr++ ) + { + if ( ptr->predef == setup_mode ) + { + lpar->debug_predef[config] = setup_mode; + int my_hide_speedo = 0; + + u32 *debug_list = lpar->debug[config]; + for ( int line = 0; line < LEDEB__N_LINE; line++ ) + debug_list[line] = LEDEB_ENABLED; + + for ( ; ptr->predef == setup_mode; ptr++ ) + { + if ( ptr->line < 0 ) + my_hide_speedo++; + else + debug_list[ptr->line] = ptr->mode | LEDEB_ENABLED; + } + + if (hide_speedo) + *hide_speedo = my_hide_speedo; + + const u8 hide_mask = 1 << config; + if ( my_hide_speedo > 0 ) + lpar->no_speedo_if_debug |= hide_mask; + else + lpar->no_speedo_if_debug &= ~hide_mask; + + return true; + } + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool SetupLecodeDebugIfEmptyLPAR ( le_lpar_t *lpar ) +{ + DASSERT(lpar); + + for ( int config = 0; config < LEDEB__N_CONFIG; config++ ) + for ( int line = 0; line < LEDEB__N_LINE; line++ ) + if ( isDebugModeOutput(lpar->debug[config][line]) ) + return false; + + for ( int config = 0; config < LEDEB__N_CONFIG; config++ ) + for ( int line = 0; line < LEDEB__N_LINE; line++ ) + lpar->debug[config][line] = LEDEB_ENABLED; + + SetupLecodeDebugLPAR(lpar,0,PREDEBUG_STANDARD,0); + SetupLecodeDebugLPAR(lpar,1,PREDEBUG_OPPONENT,0); + SetupLecodeDebugLPAR(lpar,2,PREDEBUG_VERTICAL,0); + + return true; +} + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// LPAR support /////////////// /////////////////////////////////////////////////////////////////////////////// @@ -306,11 +658,13 @@ lpar_mode_t CalcCurrentLparMode ( const le_lpar_t * lp, bool use_limit_param ) return temp > lp->limit_mode ? temp : lp->limit_mode; } - if ( lp->enable_perfmon > 1 || lp->enable_speedo > 1 ) + if ( lp->enable_perfmon > 1 ) return LPM_EXPERIMENTAL; - return lp->enable_perfmon || !lp->enable_xpflags - ? LPM_TESTING : LPM_PRODUCTIVE; + return lp->enable_perfmon + || !lp->enable_xpflags + || lp->enable_speedo > SPEEDO_FRACTION1 + ? LPM_TESTING : LPM_PRODUCTIVE; } //----------------------------------------------------------------------------- @@ -343,15 +697,13 @@ bool LimitToLparMode ( le_lpar_t * lp, lpar_mode_t lpmode ) { lp->enable_perfmon = 0; modified = true; } if (!lp->enable_xpflags) { lp->enable_xpflags = 1; modified = true; } - if ( lp->enable_speedo > 1 ) - { lp->enable_speedo = 1; modified = true; } + if ( lp->enable_speedo > SPEEDO_MAX ) + { lp->enable_speedo = SPEEDO_MAX; modified = true; } } else if ( lpmode == LPM_TESTING ) { if ( lp->enable_perfmon > 1 ) { lp->enable_perfmon = 1; modified = true; } - if ( lp->enable_speedo > 1 ) - { lp->enable_speedo = 1; modified = true; } } return modified; @@ -546,6 +898,8 @@ static void NormalizeLPAR ( le_lpar_t * lp ) { DASSERT(lp); + SetupLecodeDebugIfEmptyLPAR(lp); + int sum = lp->engine[0] + lp->engine[1] + lp->engine[2]; if ( sum != 0 && sum != 100 ) { @@ -562,9 +916,13 @@ static void NormalizeLPAR ( le_lpar_t * lp ) lp->enable_perfmon = lp->enable_perfmon < 2 ? lp->enable_perfmon : 2; lp->enable_custom_tt = lp->enable_custom_tt > 0; lp->enable_xpflags = lp->enable_xpflags > 0; - lp->enable_speedo = lp->enable_speedo < 2 ? lp->enable_speedo : 2; + lp->enable_speedo = lp->enable_speedo < SPEEDO_MAX ? lp->enable_speedo : SPEEDO_MAX; lp->block_track = lp->block_track < LE_MAX_BLOCK_TRACK ? lp->block_track : LE_MAX_BLOCK_TRACK; + + for ( int c = 0; c < LEDEB__N_CONFIG; c++ ) + for ( int l = 0; l < LEDEB__N_LINE; l++ ) + lp->debug[c][l] &= LEDEB__ALL; } /////////////////////////////////////////////////////////////////////////////// @@ -595,6 +953,21 @@ static void CopyLPAR2Data ( le_analyse_t * ana ) if ( offsetof(le_binpar_v1_t,enable_speedo) < ana->param_size ) h->enable_speedo = lp->enable_speedo; + if ( offsetof(le_binpar_v1_t,enable_speedo) < ana->param_size ) + h->no_speedo_if_debug = lp->no_speedo_if_debug; + + if ( offsetof(le_binpar_v1_t,debug_mode) < ana->param_size ) + h->debug_mode = lp->debug_mode; + + if ( offsetof(le_binpar_v1_t,item_cheat) < ana->param_size ) + h->item_cheat = lp->item_cheat; + + if ( offsetof(le_binpar_v1_t,debug_predef[LEDEB__N_CONFIG]) <= ana->param_size ) + memcpy( h->debug_predef,lp->debug_predef,sizeof(h->debug_predef)); + + if ( offsetof(le_binpar_v1_t,debug[LEDEB__N_CONFIG][0]) <= ana->param_size ) + write_be32n( h->debug[0], lp->debug[0], LEDEB__N_CONFIG*LEDEB__N_LINE ); + if ( offsetof(le_binpar_v1_t,block_track) < ana->param_size ) h->block_track = lp->block_track; @@ -603,15 +976,6 @@ static void CopyLPAR2Data ( le_analyse_t * ana ) if ( offsetof(le_binpar_v1_t,chat_mode_2) + sizeof(h->chat_mode_2) <= ana->param_size ) write_be16n(h->chat_mode_2,lp->chat_mode_2,BMG_N_CHAT); - - // reserved (for future extensions) - - if ( offsetof(le_binpar_v1_t,reserved_1b9) < ana->param_size ) - h->reserved_1b9 = lp->reserved_1b9; - if ( offsetof(le_binpar_v1_t,reserved_1ba) < ana->param_size ) - h->reserved_1ba = lp->reserved_1ba; - if ( offsetof(le_binpar_v1_t,reserved_1bb) < ana->param_size ) - h->reserved_1bb = lp->reserved_1bb; } // @@ -620,7 +984,7 @@ static void CopyLPAR2Data ( le_analyse_t * ana ) enumError SaveTextLPAR ( - const le_lpar_t *lpar, // LE-CODE parameters + le_lpar_t *lpar, // LE-CODE parameters ccp fname, // filename of destination bool set_time // true: set time stamps ) @@ -648,6 +1012,7 @@ enumError SaveTextLPAR //--- print section + SetupLecodeDebugIfEmptyLPAR(lpar); err = WriteSectionLPAR(F.f,lpar); @@ -703,9 +1068,6 @@ enumError WriteSectionLPAR fprintf(f,"\r\n#\f\r\n%.79s\r\n\r\n[LECODE-PARAMETERS]\r\n",Hash200); const bool verbose = print_header && !brief_count && !export_count; - const bool have_reserved = lpar->reserved_1b9 - || lpar->reserved_1ba - || lpar->reserved_1bb; if (verbose) { @@ -716,13 +1078,11 @@ enumError WriteSectionLPAR ,lpar->enable_perfmon ,lpar->enable_custom_tt ,lpar->enable_xpflags - ,lpar->enable_speedo - ,LE_MAX_BLOCK_TRACK - ,lpar->block_track + ,LE_MAX_BLOCK_TRACK,lpar->block_track + ,GetLecodeSpeedoName(lpar->enable_speedo) + ,GetLecodeDebugName(lpar->debug_mode) + ,lpar->item_cheat ); - - if (have_reserved) - fputs(text_lpar_sect_reserved_cr,f); } else { @@ -734,25 +1094,23 @@ enumError WriteSectionLPAR "PERF-MONITOR = %u\r\n" "CUSTOM-TT = %u\r\n" "XPFLAGS = %u\r\n" - "SPEEDOMETER = %u\r\n" "BLOCK-TRACK = %u\r\n" + "SPEEDOMETER = SPEEDO$%s\r\n" + "DEBUG = DEBUG$%s\r\n" + "ITEM-CHEATS = %u\r\n" ,GetLparModeName(CalcCurrentLparMode(lpar,true),export_count>0) ,lpar->engine[0],lpar->engine[1],lpar->engine[2] ,lpar->enable_200cc ,lpar->enable_perfmon ,lpar->enable_custom_tt ,lpar->enable_xpflags - ,lpar->enable_speedo ,lpar->block_track + ,GetLecodeSpeedoName(lpar->enable_speedo) + ,GetLecodeDebugName(lpar->debug_mode) + ,lpar->item_cheat ); - - if (have_reserved) - fputs("\r\n",f); } - if ( lpar->reserved_1b9 > 0 ) fprintf(f,"RESERVED-1B9\t= %u\r\n",lpar->reserved_1b9); - if ( lpar->reserved_1ba > 0 ) fprintf(f,"RESERVED-1BA\t= %u\r\n",lpar->reserved_1ba); - if ( lpar->reserved_1bb > 0 ) fprintf(f,"RESERVED-1BB\t= %u\r\n",lpar->reserved_1bb); //--- chat modes @@ -770,8 +1128,8 @@ enumError WriteSectionLPAR fputs(text_lpar_sect_chat_example_cr,f); } - int i, last_group = -1; - for ( i = 0; i < BMG_N_CHAT; i++ ) + int last_group = -1; + for ( int i = 0; i < BMG_N_CHAT; i++ ) { const u16 mode1 = lpar->chat_mode_1[i]; const u16 mode2 = lpar->chat_mode_2[i]; @@ -786,6 +1144,65 @@ enumError WriteSectionLPAR fprintf(f,"%s\n",PrintChatMode(i,mode1,mode2,export_count)); } } + + + //--- debug modes + + if (verbose) + fprintf(f,text_lpar_sect_debug_docu_cr, + LEDEB__N_LINE, LEDEB__N_LINE-1, LEDEB__N_LINE-1 ); + + for ( int conf = 0; conf < LEDEB__N_CONFIG; conf++ ) + { + fprintf(f,"\r\n#\f\r\n%.79s\r\n\r\n[DEBUG-%u]\r\n",Hash200,conf+1); + if (verbose) + fputs("# See section [DEBUG-DOCU] for details.\n",f); + + fprintf(f,"\r\n" + "SETUP\t\t= DEBUG$%s\n" + "HIDE-SPEEDO\t= %u\n", + GetPredefDebugName(lpar->debug_predef[conf]), + ( 1<<conf & lpar->no_speedo_if_debug ) != 0 ); + + int done = 0; + for ( int line = 0; line <= LEDEB__N_LINE; line++ ) + { + int idx; + lecode_debug_t mode; + + if ( line < LEDEB__N_LINE ) + { + mode = lpar->debug[conf][line]; + if (!isDebugModeOutput(mode)) + continue; + idx = line; + } + else + { + if (done) + break; + mode = 0; + idx = 1; + } + done++; + + bool line_printed = false; + lecode_debug_info_t ldi; + for ( GetFirstDebugMode(&ldi,mode,!verbose); ldi.name; GetNextDebugMode(&ldi) ) + { + if (!line_printed) + { + fprintf(f,"\nLINE\t\t= %u\r\n",idx); + line_printed = true; + } + fprintf(f,"%s%.*s= %u\r\n", + ldi.name, + (23-(int)strlen(ldi.name))/8, Tabs20, + ldi.value ); + } + } + } + return ERR_OK; } @@ -983,13 +1400,21 @@ enumError AnalyseLEBinary le_binpar_v1_1b8_t *p = (le_binpar_v1_1b8_t*)(data+off_param); be16n(ana->lpar.chat_mode_2,p->chat_mode_2,BMG_N_CHAT); } + if ( param_size >= sizeof(le_binpar_v1_1bc_t) ) { le_binpar_v1_1bc_t *p = (le_binpar_v1_1bc_t*)(data+off_param); ana->lpar.enable_speedo = p->enable_speedo; - ana->lpar.reserved_1b9 = p->reserved_1b9; - ana->lpar.reserved_1ba = p->reserved_1ba; - ana->lpar.reserved_1bb = p->reserved_1bb; + ana->lpar.no_speedo_if_debug= p->no_speedo_if_debug; + ana->lpar.debug_mode = p->debug_mode; + } + + if ( param_size >= sizeof(le_binpar_v1_260_t) ) + { + le_binpar_v1_260_t *p = (le_binpar_v1_260_t*)(data+off_param); + memcpy(ana->lpar.debug_predef,p->debug_predef,sizeof(ana->lpar.debug_predef)); + be32n(ana->lpar.debug[0],p->debug[0],LEDEB__N_CONFIG*LEDEB__N_LINE); + ana->lpar.item_cheat = p->item_cheat; } break; @@ -1834,23 +2259,42 @@ void DumpLEAnalyse ( FILE *f, uint indent, const le_analyse_t *ana ) if ( ana->param_size >= sizeof(le_binpar_v1_1bc_t) ) { + ccp comment; + char buf[50]; + if ( h->enable_speedo < SPEEDO_ON ) + comment = " = disabled"; + else if ( h->enable_speedo <= SPEEDO_MAX ) + { + snprintf(buf,sizeof(buf)," = format \"%.*f km/h\"", + h->enable_speedo - SPEEDO_ON, 123.12345 ); + comment = buf; + } + else + comment = ""; + fprintf(f, - "%*s" "Speedometer: %u = %s\n" - ,indent,"", h->enable_speedo, - h->enable_speedo > 1 ? "Wii(U)+Dolphin" - : h->enable_speedo ? "Wii(U) only" :"disabled" + "%*s" "Speedometer: %u%s\n", + indent,"", h->enable_speedo, comment ); + } + + if ( ana->param_size >= sizeof(le_binpar_v1_260_t) ) + { + fprintf(f, + "%*s" "Debug mode: %u = %s\n" + "%*s" "Item cheat: %u = %s\n" + ,indent,"", h->debug_mode, GetLecodeDebugInfo(h->debug_mode) + ,indent,"", h->item_cheat, h->item_cheat ? "enabled" : "disabled" ); + } - if (h->reserved_1b9) - fprintf(f,"%*s" "Reserved 1B9: %u\n", - indent,"", h->reserved_1b9 ); - if (h->reserved_1ba) - fprintf(f,"%*s" "Reserved 1BA: %u\n", - indent,"", h->reserved_1ba ); + #if 0 // for later use + if ( ana->param_size >= sizeof(le_binpar_v1_1bc_t) ) + { if (h->reserved_1bb) fprintf(f,"%*s" "Reserved 1BB: %u\n", indent,"", h->reserved_1bb ); } + #endif #if defined(DEBUG) && defined(TEST) && 0 const uint po = ana->param_offset; @@ -1870,7 +2314,6 @@ void DumpLEAnalyse ( FILE *f, uint indent, const le_analyse_t *ana ) ); #endif - const bool hard_coded = ana->param_size < sizeof(le_binpar_v1_f8_t); const u16 *chat_mode_1 = hard_coded ? chat_mode_legacy : ana->lpar.chat_mode_1; const u16 *chat_mode_2 = hard_coded ? chat_mode_legacy : ana->lpar.chat_mode_2; @@ -2328,11 +2771,11 @@ void PatchLPAR ( le_lpar_t * lp ) if ( opt_xpflags != OFFON_AUTO ) lp->enable_xpflags = opt_xpflags >= OFFON_ON; if ( opt_speedo != OFFON_AUTO ) - lp->enable_speedo = opt_speedo >= OFFON_FORCE ? 2 : opt_speedo >= OFFON_ON; - - if ( opt_reserved_1b9 >= 0 ) lp->reserved_1b9 = opt_reserved_1b9; - if ( opt_reserved_1ba >= 0 ) lp->reserved_1ba = opt_reserved_1ba; - if ( opt_reserved_1bb >= 0 ) lp->reserved_1bb = opt_reserved_1bb; + lp->enable_speedo = opt_speedo >= SPEEDO_MAX ? SPEEDO_MAX + : opt_speedo >= SPEEDO_ON ? opt_speedo : 0; + if ( opt_lecode_debug != OFFON_AUTO ) + lp->debug_mode = opt_lecode_debug >= DEBUGMD_ENABLED && opt_lecode_debug < DEBUGMD__N + ? opt_lecode_debug : DEBUGMD_OFF; } /////////////////////////////////////////////////////////////////////////////// @@ -2340,7 +2783,7 @@ void PatchLPAR ( le_lpar_t * lp ) void PatchLECODE ( le_analyse_t * ana ) { DASSERT(ana); - PRINT("PatchLECODE() opt_lpar=%s)\n",opt_lpar); + PRINT("PatchLECODE() opt_lpar=%s\n",opt_lpar); if (opt_lpar) LoadLPAR(&ana->lpar,false,0,false); @@ -2359,6 +2802,246 @@ void PatchLECODE ( le_analyse_t * ana ) // /////////////////////////////////////////////////////////////////////////////// +/////////////// ScanTextLPAR() helpers /////////////// +/////////////////////////////////////////////////////////////////////////////// + +static enumError ScanTextLPAR_PARAM +( + le_lpar_t *lpar, // LE-CODE parameters + ScanInfo_t *si, // valid data + bool is_pass2 // false: pass1; true: pass2 +) +{ + DASSERT(lpar); + DASSERT(si); + PRINT(">> ScanTextLPAR_PARAM(pass=%u)\n",is_pass2+1); + + + //--- setup data + + int limit_mode = -1; + const ScanParam_t ptab[] = + { + { "LIMIT-MODE", SPM_INT, &limit_mode }, + { "ENGINE", SPM_U8, lpar->engine, 3,3 }, + { "ENABLE-200CC", SPM_U8, &lpar->enable_200cc }, + { "PERF-MONITOR", SPM_U8, &lpar->enable_perfmon }, + { "CUSTOM-TT", SPM_S8, &lpar->enable_custom_tt }, + { "XPFLAGS", SPM_U8, &lpar->enable_xpflags }, + { "BLOCK-TRACK", SPM_U8, &lpar->block_track }, + { "SPEEDOMETER", SPM_U8, &lpar->enable_speedo }, + { "DEBUG", SPM_U8, &lpar->debug_mode }, + { "ITEM-CHEAT", SPM_U8, &lpar->item_cheat }, + {0} + }; + + + //--- main loop + + for(;;) + { + char ch = NextCharSI(si,true); + if ( !ch || ch == '[' ) + break; + + ScanParamSI(si,ptab); + } + CheckLevelSI(si); + + if ( limit_mode >= 0 ) + LimitToLparMode(lpar,limit_mode); + + return ERR_OK; +} + +/////////////////////////////////////////////////////////////////////////////// + +static enumError ScanTextLPAR_CHAT +( + le_lpar_t *lpar, // LE-CODE parameters + ScanInfo_t * si, // valid data + bool is_pass2 // false: pass1; true: pass2 +) +{ + PRINT(">> ScanTextLPAR_CHAT(pass=%u)\n",is_pass2+1); + // [[2do]] ??? + + + //--- setup data + + bool reset = true, legacy = false, mkwfun = false; + const ScanParam_t ptab[] = + { + { "RESET", SPM_BOOL, &reset }, + { "LEGACY", SPM_BOOL, &legacy }, + { "MKW-FUN", SPM_BOOL, &mkwfun }, + {0} + }; + + + //--- main loop + + for(;;) + { + char ch = NextCharSI(si,true); + if ( !ch || ch == '[' ) + break; + + if ( ch == '@' ) + { + ScanParamSI(si,ptab); + if (reset) + { + reset = false; + ClearLparChat(lpar); + } + + if ( legacy || mkwfun ) + { + const u16 *chat_mode = legacy ? chat_mode_legacy : chat_mode_mkwfun; + uint i; + for ( i = 0; i < BMG_N_CHAT; i++ ) + if (!lpar->chat_mode_1[i]) + lpar->chat_mode_1[i] = chat_mode[i]; + legacy = mkwfun = false; + } + continue; + } + + if (reset) + { + reset = false; + ClearLparChat(lpar); + } + + char name[20]; + ScanNameSI(si,name,sizeof(name),true,true,0); + if ( name[0] != 'M' ) + { + wrong_name:; + ScanFile_t *sf = si->cur_file; + sf->ptr = sf->prev_ptr; + WarnIgnoreSI(si,"Message name (M01..M96) expected: %s\n",name); + continue; + } + + char *end; + long num = strtol(name+1,&end,10); + if ( *end || num < 1 || num > BMG_N_CHAT ) + goto wrong_name; + + CheckWarnSI(si,'=',ERR_OK); + + DEFINE_VAR(var); + if (ScanExprSI(si,&var)) + continue; + lpar->chat_mode_1[num-1] = GetIntV(&var); + + if ( NextCharSI(si,false) == ',' ) + { + si->cur_file->ptr++; + if (!ScanExprSI(si,&var)) + lpar->chat_mode_2[num-1] = GetIntV(&var); + } + + FreeV(&var); + CheckEolSI(si); + } + CheckLevelSI(si); + + if (reset) + ClearLparChat(lpar); + + //HEXDUMP16(0,0,fb->buf,fb->ptr-fb->buf); + return ERR_OK; +} + +/////////////////////////////////////////////////////////////////////////////// + +static enumError ScanTextLPAR_DEBUG +( + le_lpar_t *lpar, // LE-CODE parameters + ScanInfo_t *si, // valid data + bool is_pass2, // false: pass1; true: pass2 + uint config // configuration index 0.. +) +{ + DASSERT(lpar); + DASSERT(si); + DASSERT( config < LEDEB__N_CONFIG ); + PRINT(">> ScanTextLPAR_PARAM(pass=%u)\n",is_pass2+1); + u32 *debug_list = lpar->debug[config]; + + + //--- setup data + + const int hide_mask = 1 << config; + int hide_speedo = hide_mask & lpar->no_speedo_if_debug; + int line = -1, next_line = -1, setup = PREDEBUG_OFF; + lecode_debug_ex_t debug; + DecodeLecodeDebug(&debug,0); + + const ScanParam_t ptab[] = + { + { "SETUP", SPM_INT, &setup }, + { "HIDE-SPEEDO", SPM_INT, &hide_speedo }, + { "LINE", SPM_INT, &next_line }, + { "ENABLED", SPM_U8, &debug.enabled }, + { "OPPONENT", SPM_U8, &debug.opponent }, + { "SPACE", SPM_U8, &debug.space }, + { "POSITION", SPM_U8, &debug.position }, + { "CHECK-POINT", SPM_U8, &debug.check_point }, + { "RESPAWN", SPM_U8, &debug.respawn }, + { "LAP-POS", SPM_U8, &debug.lap_pos }, + {0} + }; + + + //--- main loop + + for(;;) + { + char ch = NextCharSI(si,true); + if ( !ch || ch == '[' ) + break; + + ScanParamSI(si,ptab); + + if ( setup != PREDEBUG_OFF ) + { + if ( SetupLecodeDebugLPAR(lpar,config,setup,&hide_speedo) && line >= 0 ) + DecodeLecodeDebug(&debug,debug_list[line]); + setup = PREDEBUG_OFF; + } + + if ( line != next_line ) + { + if ( line >= 0 ) + debug_list[line] = EncodeLecodeDebug(&debug); + + if ( next_line < 0 || next_line >= LEDEB__N_LINE ) + next_line = -1; + else + DecodeLecodeDebug(&debug,debug_list[next_line]); + line = next_line; + } + } + + if ( line >= 0 ) + debug_list[line] = EncodeLecodeDebug(&debug); + + if ( hide_speedo > 0 ) + lpar->no_speedo_if_debug |= hide_mask; + else + lpar->no_speedo_if_debug &= ~hide_mask; + + CheckLevelSI(si); + + return ERR_OK; +} + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// ScanTextLPAR() /////////////// /////////////////////////////////////////////////////////////////////////////// @@ -2420,18 +3103,23 @@ enumError ScanTextLPAR if (init_lpar) InitializeLPAR(lpar,false); - enum { C_PARAM, C_CHAT, C_END }; + enum { C_PARAM, C_CHAT, C_DEBUG1, C_DEBUG2, C_DEBUG3, C_DEBUG4, C_END }; static const KeywordTab_t section_name[] = { { C_PARAM, "LECODE-PARAMETERS", 0, 0 }, { C_CHAT, "CHAT-MESSAGE-MODES", 0, 0 }, + { C_END, "DEBUG-DOCU", 0, 0 }, + { C_DEBUG1, "DEBUG-1", 0, 0 }, + { C_DEBUG2, "DEBUG-2", 0, 0 }, + { C_DEBUG3, "DEBUG-3", 0, 0 }, + { C_DEBUG4, "DEBUG-4", 0, 0 }, { C_END, "END", 0, 0 }, {0,0,0,0} }; ScanInfo_t si; InitializeSI(&si,data,data_size,fname,0); - si.predef = SetupVarsLEX(); + si.predef = SetupVarsLECODE(); bool is_pass2 = false; enumError max_err = ERR_OK; @@ -2481,6 +3169,13 @@ enumError ScanTextLPAR err = ScanTextLPAR_CHAT(lpar,&si,is_pass2); break; + case C_DEBUG1: + case C_DEBUG2: + case C_DEBUG3: + case C_DEBUG4: + err = ScanTextLPAR_DEBUG(lpar,&si,is_pass2,cmd->id-C_DEBUG1); + break; + default: // ignore all other section without any warnings break; @@ -2511,161 +3206,6 @@ enumError ScanTextLPAR return max_err; } -/////////////////////////////////////////////////////////////////////////////// - -enumError ScanTextLPAR_PARAM -( - le_lpar_t *lpar, // LE-CODE parameters - ScanInfo_t *si, // valid data - bool is_pass2 // false: pass1; true: pass2 -) -{ - DASSERT(lpar); - DASSERT(si); - PRINT(">> ScanTextLPAR_PARAM(pass=%u)\n",is_pass2+1); - - - //--- setup data - - int limit_mode = -1; - const ScanParam_t ptab[] = - { - { "LIMIT-MODE", SPM_INT, &limit_mode }, - { "ENGINE", SPM_U8, lpar->engine, 3,3 }, - { "ENABLE-200CC", SPM_U8, &lpar->enable_200cc }, - { "PERF-MONITOR", SPM_U8, &lpar->enable_perfmon }, - { "CUSTOM-TT", SPM_S8, &lpar->enable_custom_tt }, - { "XPFLAGS", SPM_U8, &lpar->enable_xpflags }, - { "SPEEDOMETER", SPM_U8, &lpar->enable_speedo }, - { "BLOCK-TRACK", SPM_U8, &lpar->block_track }, - - { "RESERVED-1B9", SPM_U8, &lpar->reserved_1b9 }, - { "RESERVED-1BA", SPM_U8, &lpar->reserved_1ba }, - { "RESERVED-1BB", SPM_U8, &lpar->reserved_1bb }, - {0} - }; - - - //--- main loop - - for(;;) - { - char ch = NextCharSI(si,true); - if ( !ch || ch == '[' ) - break; - - ScanParamSI(si,ptab); - } - CheckLevelSI(si); - - if ( limit_mode >= 0 ) - LimitToLparMode(lpar,limit_mode); - - return ERR_OK; -} - -/////////////////////////////////////////////////////////////////////////////// - -enumError ScanTextLPAR_CHAT -( - le_lpar_t *lpar, // LE-CODE parameters - ScanInfo_t * si, // valid data - bool is_pass2 // false: pass1; true: pass2 -) -{ - PRINT(">> ScanTextLPAR_CHAT(pass=%u)\n",is_pass2+1); - // [[2do]] ??? - - - //--- setup data - - bool reset = true, legacy = false, mkwfun = false; - const ScanParam_t ptab[] = - { - { "RESET", SPM_BOOL, &reset }, - { "LEGACY", SPM_BOOL, &legacy }, - { "MKW-FUN", SPM_BOOL, &mkwfun }, - {0} - }; - - - //--- main loop - - for(;;) - { - char ch = NextCharSI(si,true); - if ( !ch || ch == '[' ) - break; - - if ( ch == '@' ) - { - ScanParamSI(si,ptab); - if (reset) - { - reset = false; - ClearLparChat(lpar); - } - - if ( legacy || mkwfun ) - { - const u16 *chat_mode = legacy ? chat_mode_legacy : chat_mode_mkwfun; - uint i; - for ( i = 0; i < BMG_N_CHAT; i++ ) - if (!lpar->chat_mode_1[i]) - lpar->chat_mode_1[i] = chat_mode[i]; - legacy = mkwfun = false; - } - continue; - } - - if (reset) - { - reset = false; - ClearLparChat(lpar); - } - - char name[20]; - ScanNameSI(si,name,sizeof(name),true,true,0); - if ( name[0] != 'M' ) - { - wrong_name:; - ScanFile_t *sf = si->cur_file; - sf->ptr = sf->prev_ptr; - WarnIgnoreSI(si,"Message name (M01..M96) expected: %s\n",name); - continue; - } - - char *end; - long num = strtol(name+1,&end,10); - if ( *end || num < 1 || num > BMG_N_CHAT ) - goto wrong_name; - - CheckWarnSI(si,'=',ERR_OK); - - DEFINE_VAR(var); - if (ScanExprSI(si,&var)) - continue; - lpar->chat_mode_1[num-1] = GetIntV(&var); - - if ( NextCharSI(si,false) == ',' ) - { - si->cur_file->ptr++; - if (!ScanExprSI(si,&var)) - lpar->chat_mode_2[num-1] = GetIntV(&var); - } - - FreeV(&var); - CheckEolSI(si); - } - CheckLevelSI(si); - - if (reset) - ClearLparChat(lpar); - - //HEXDUMP16(0,0,fb->buf,fb->ptr-fb->buf); - return ERR_OK; -} - // /////////////////////////////////////////////////////////////////////////////// /////////////// END /////////////// diff --git a/project/src/lib-lecode.h b/project/src/lib-lecode.h index edb1630..2f2acc2 100644 --- a/project/src/lib-lecode.h +++ b/project/src/lib-lecode.h @@ -102,6 +102,132 @@ __attribute__ ((packed)) le_usage_t; // /////////////////////////////////////////////////////////////////////////////// +/////////////// lecode debug /////////////// +/////////////////////////////////////////////////////////////////////////////// +// [[lecode_debug_t]] [[copy-lecode]] copy changes to LE-CODE + +typedef enum lecode_debug_t +{ + LEDEB_ENABLED = 0x0001, + LEDEB_OPPONENT = 0x0002, + LEDEB_SPACE = 0x0004, + + LEDEB_POSITION = 0x0008, + LEDEB_CHECK_POINT = 0x0030, // 2 bits! + LEDEB_RESPAWN = 0x0040, + LEDEB_LAP_POS = 0x0080, + + //--- derived values + + LEDEB__STD = 0x00f9, // standard output + LEDEB__OUTPUT = 0x00f8, // flags that produce output + LEDEB__ALL = 0x00ff, // all flags + + LEDEB_S_CHECK_POINT = 4, // shift for LEDEB_CHECKPOINT + LEDEB_M_CHECK_POINT = 3, // mask after shift + + //--- special values + + LEDEB__N_CONFIG = 4, // number of debug configurations + LEDEB__N_LINE = 10, // number of debug lines of each configuration +} +lecode_debug_t; + +//----------------------------------------------------------------------------- +// [[lecode_debug_info_t]] + +typedef struct lecode_debug_info_t +{ + lecode_debug_t mode; // mode to iterate + bool filter_active; // true: iterate only values >0 + + int index; // internal index + lecode_debug_t relevant; // relevant bits for name=value + ccp name; // NULL or name of parameter + uint value; // related value +} +lecode_debug_info_t; + +//----------------------------------------------------------------------------- + +ccp GetDebugModeSummary ( const lecode_debug_info_t *ldi ); + +bool GetFirstDebugMode + ( lecode_debug_info_t *ldi, lecode_debug_t mode, bool filter_active ); +bool GetNextDebugMode ( lecode_debug_info_t *ldi ); + + +static inline bool isDebugModeOutput ( lecode_debug_t mode ) + { return mode & LEDEB__OUTPUT; } + +static inline bool isDebugModeActive ( lecode_debug_t mode ) + { return mode & LEDEB_ENABLED && mode & LEDEB__OUTPUT; } + +//----------------------------------------------------------------------------- +// [[lecode_debug_ex_t]] + +typedef struct lecode_debug_ex_t +{ + // encoded data + lecode_debug_t mode; + + // decoded data + u8 enabled; + u8 opponent; + u8 space; + u8 position; + u8 check_point; + u8 respawn; + u8 lap_pos; + + // status + bool have_output; // would produce output if ENABLED + bool is_active; // will produce output +} +lecode_debug_ex_t; + +//----------------------------------------------------------------------------- + +lecode_debug_t DecodeLecodeDebug ( lecode_debug_ex_t *lde, lecode_debug_t mode ); +lecode_debug_t EncodeLecodeDebug ( lecode_debug_ex_t *lde ); + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +// [[le_debug_mode_t]] [[copy-lecode]] copy changes to LE-CODE + +typedef enum le_debug_mode_t +{ + DEBUGMD_OFF, // debug disabled at all + DEBUGMD_ENABLED, // debug enabled, but hidden + DEBUGMD_DEBUG1, // debug enabled, start with config #0 [DEBUG-1] + DEBUGMD_DEBUG2, // debug enabled, start with config #1 [DEBUG-2] + DEBUGMD_DEBUG3, // debug enabled, start with config #2 [DEBUG-3] + DEBUGMD_DEBUG4, // debug enabled, start with config #3 [DEBUG-4] + + DEBUGMD__N // number of debug modes +} +le_debug_mode_t; + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +// [[predef_debug_t]] + +typedef enum predef_debug_t +{ + PREDEBUG_OFF, // no predefinition + PREDEBUG_CLEAR, // clear all + PREDEBUG_STANDARD, // 1 line: standard setup + PREDEBUG_OPPONENT, // 2 lines: standard for player + opponent + PREDEBUG_VERTICAL, // vertical output +} +predef_debug_t; + +//----------------------------------------------------------------------------- + +ccp GetPredefDebugName ( predef_debug_t pd_mode ); + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// le_lpar_t /////////////// /////////////////////////////////////////////////////////////////////////////// // [[le_lpar_t]] @@ -112,16 +238,19 @@ typedef struct le_lpar_t u8 engine[3]; // 100cc, 150cc, mirror (sum always 100) u8 enable_200cc; // TRUE: 200C enabled => 150cc, 200cc, mirror - u8 enable_perfmon; // TRUE: performance monitor enabled + u8 enable_perfmon; // >0: performance monitor enabled; >1: for dolphin too u8 enable_custom_tt; // TRUE: time trial for cusotm tracks enabled u8 enable_xpflags; // TRUE: extended presence flags enabled - u8 enable_speedo; // TRUE: speedometer is enabled + u8 enable_speedo; // speedometer selection (0..3), see SPEEDO_* u8 block_track; // block used tracks for 0..20 races + u8 no_speedo_if_debug; // 1 bit for each debug configuration + u8 item_cheat; // 0:disabled, 1:enabled - // reserved for future extensions - u8 reserved_1b9; - u8 reserved_1ba; - u8 reserved_1bb; + u8 debug_mode; // debug mode + u8 debug_predef[LEDEB__N_CONFIG]; + // information about used predefined mode + u32 debug[LEDEB__N_CONFIG][LEDEB__N_LINE]; + // debug line settings, see LEDEB_* u16 chat_mode_1[BMG_N_CHAT]; // first set of modes for each chat message u16 chat_mode_2[BMG_N_CHAT]; // second set of modes for each chat message @@ -163,36 +292,31 @@ enumError ScanTextLPAR uint data_size // size of 'data' ); -enumError ScanTextLPAR_PARAM -( - le_lpar_t *lpar, // LE-CODE parameters - ScanInfo_t *si, // valid data - bool is_pass2 // false: pass1; true: pass2 -); - -enumError ScanTextLPAR_CHAT -( - le_lpar_t *lpar, // LE-CODE parameters - ScanInfo_t *si, // valid data - bool is_pass2 // false: pass1; true: pass2 -); - //----------------------------------------------------------------------------- enumError SaveTextLPAR ( - const le_lpar_t *lpar, // LE-CODE parameters + le_lpar_t *lpar, // LE-CODE parameters ccp fname, // filename of destination bool set_time // true: set time stamps ); - enumError WriteSectionLPAR ( FILE *f, // output files const le_lpar_t *lpar // LE-CODE parameters ); +//----------------------------------------------------------------------------- + +bool SetupLecodeDebugLPAR +( + le_lpar_t *lpar, // LE-CODE parameters + uint config, // configuration index 0.. + uint setup_mode, // setup mode, one of PREDEBUG_* + int *hide_speedo // if not NULL: store new mode here +); + // /////////////////////////////////////////////////////////////////////////////// /////////////// binary headers /////////////// @@ -274,6 +398,8 @@ typedef struct le_binpar_v1_35_t } __attribute__ ((packed)) le_binpar_v1_35_t; +_Static_assert(sizeof(le_binpar_v1_35_t)==0x35,"le_binpar_v1_35_t"); + //----------------------------------------------------------------------------- // [[le_binpar_v1_37_t]] @@ -301,6 +427,8 @@ typedef struct le_binpar_v1_37_t } __attribute__ ((packed)) le_binpar_v1_37_t; +_Static_assert(sizeof(le_binpar_v1_37_t)==0x37,"le_binpar_v1_37_t"); + //----------------------------------------------------------------------------- // [[le_binpar_v1_f8_t]] @@ -330,6 +458,8 @@ typedef struct le_binpar_v1_f8_t } __attribute__ ((packed)) le_binpar_v1_f8_t; +_Static_assert(sizeof(le_binpar_v1_f8_t)==0xf8,"le_binpar_v1_f8_t"); + //----------------------------------------------------------------------------- // [[le_binpar_v1_1b8_t]] @@ -360,46 +490,92 @@ typedef struct le_binpar_v1_1b8_t } __attribute__ ((packed)) le_binpar_v1_1b8_t; +_Static_assert(sizeof(le_binpar_v1_1b8_t)==0x1b8,"le_binpar_v1_1b8_t"); + //----------------------------------------------------------------------------- // [[le_binpar_v1_1bc_t]] typedef struct le_binpar_v1_1bc_t { - /*000*/ char magic[8]; // LE_PARAM_MAGIC - /*008*/ u32 version; // always 1 for v1 - /*00c*/ u32 size; // size (and minor version) - /*010*/ u32 off_eod; // offset of end-of-data + /*000*/ char magic[8]; // LE_PARAM_MAGIC + /*008*/ u32 version; // always 1 for v1 + /*00c*/ u32 size; // size (and minor version) + /*010*/ u32 off_eod; // offset of end-of-data - /*014*/ u32 off_cup_par; // offset to cup param - /*018*/ u32 off_cup_track; // offset of cup-track list - /*01c*/ u32 off_cup_arena; // offset of cup-arena list - /*020*/ u32 off_course_par; // offset of course param - /*024*/ u32 off_property; // offset of property list - /*028*/ u32 off_music; // offset of music list - /*02c*/ u32 off_flags; // offset of music list + /*014*/ u32 off_cup_par; // offset to cup param + /*018*/ u32 off_cup_track; // offset of cup-track list + /*01c*/ u32 off_cup_arena; // offset of cup-arena list + /*020*/ u32 off_course_par; // offset of course param + /*024*/ u32 off_property; // offset of property list + /*028*/ u32 off_music; // offset of music list + /*02c*/ u32 off_flags; // offset of music list - /*030*/ u8 engine[3]; // 100cc, 150cc, mirror (sum always 100) - /*033*/ u8 enable_200cc; // TRUE: 200C enabled => 150cc, 200cc, mirror - /*034*/ u8 enable_perfmon; // TRUE: performance monitor enabled - /*035*/ u8 enable_custom_tt;// TRUE: time trial for cusotm tracks enabled - /*036*/ u8 enable_xpflags; // TRUE: extended presence flags enabled - /*037*/ u8 block_track; // block used track for 0.. tracks - /*038*/ u16 chat_mode_1[BMG_N_CHAT]; // mode for each chat message - /*0f8*/ u16 chat_mode_2[BMG_N_CHAT]; // mode for each chat message - /*1b8*/ u8 enable_speedo; // TRUE: speedometer is enabled + /*030*/ u8 engine[3]; // 100cc, 150cc, mirror (sum always 100) + /*033*/ u8 enable_200cc; // TRUE: 200C enabled => 150cc, 200cc, mirror + /*034*/ u8 enable_perfmon; // >0: performance monitor enabled; >1: for dolphin too + /*035*/ u8 enable_custom_tt; // TRUE: time trial for cusotm tracks enabled + /*036*/ u8 enable_xpflags; // TRUE: extended presence flags enabled + /*037*/ u8 block_track; // block used track for 0.. tracks + /*038*/ u16 chat_mode_1[BMG_N_CHAT]; // mode for each chat message + /*0f8*/ u16 chat_mode_2[BMG_N_CHAT]; // mode for each chat message + /*1b8*/ u8 enable_speedo; // speedometer mode (0..2), see SPEEDO_* + /*1b9*/ u8 no_speedo_if_debug; // if bit is set: suppress speedometer + /*1ba*/ u8 debug_mode; // debug mode (0..), see DEBUGMD_* //--- reserved for future extensions - /*1b9*/ u8 reserved_1b9; - /*1ba*/ u8 reserved_1ba; /*1bb*/ u8 reserved_1bb; + /*1bc*/ } __attribute__ ((packed)) le_binpar_v1_1bc_t; +_Static_assert(sizeof(le_binpar_v1_1bc_t)==0x1bc,"le_binpar_v1_1bc_t"); + +//----------------------------------------------------------------------------- +// [[le_binpar_v1_260_t]] + +typedef struct le_binpar_v1_260_t +{ + /*000*/ char magic[8]; // LE_PARAM_MAGIC + /*008*/ u32 version; // always 1 for v1 + /*00c*/ u32 size; // size (and minor version) + /*010*/ u32 off_eod; // offset of end-of-data + + /*014*/ u32 off_cup_par; // offset to cup param + /*018*/ u32 off_cup_track; // offset of cup-track list + /*01c*/ u32 off_cup_arena; // offset of cup-arena list + /*020*/ u32 off_course_par; // offset of course param + /*024*/ u32 off_property; // offset of property list + /*028*/ u32 off_music; // offset of music list + /*02c*/ u32 off_flags; // offset of music list + + /*030*/ u8 engine[3]; // 100cc, 150cc, mirror (sum always 100) + /*033*/ u8 enable_200cc; // TRUE: 200C enabled => 150cc, 200cc, mirror + /*034*/ u8 enable_perfmon; // >0: performance monitor enabled; >1: for dolphin too + /*035*/ u8 enable_custom_tt; // TRUE: time trial for cusotm tracks enabled + /*036*/ u8 enable_xpflags; // TRUE: extended presence flags enabled + /*037*/ u8 block_track; // block used track for 0.. tracks + /*038*/ u16 chat_mode_1[BMG_N_CHAT]; // mode for each chat message + /*0f8*/ u16 chat_mode_2[BMG_N_CHAT]; // mode for each chat message + /*1b8*/ u8 enable_speedo; // speedometer selection (0..2), see SPEEDO_* + /*1b9*/ u8 no_speedo_if_debug; // if bit is set: suppress speedometer + /*1ba*/ u8 debug_mode; // debug mode (0..), see DEBUGMD_* + /*1bb*/ u8 item_cheat; // 0:disabled, 1:enabled + + /*1bc*/ u8 debug_predef[LEDEB__N_CONFIG]; + // information about used predefined mode + /*1c0*/ u32 debug[LEDEB__N_CONFIG][LEDEB__N_LINE]; + // debug line settings, see LEDEB_* + /*260*/ +} +__attribute__ ((packed)) le_binpar_v1_260_t; + +_Static_assert(sizeof(le_binpar_v1_260_t)==0x260,"le_binpar_v1_260_t"); + //----------------------------------------------------------------------------- // [[le_binpar_v1_t]] -typedef struct le_binpar_v1_1bc_t le_binpar_v1_t; +typedef struct le_binpar_v1_260_t le_binpar_v1_t; // /////////////////////////////////////////////////////////////////////////////// @@ -568,11 +744,8 @@ extern OffOn_t opt_200cc; extern OffOn_t opt_perfmon; extern OffOn_t opt_custom_tt; extern OffOn_t opt_xpflags; -extern OffOn_t opt_speedo; - -extern int opt_reserved_1b9; -extern int opt_reserved_1ba; -extern int opt_reserved_1bb; +extern int opt_speedo; +extern int opt_lecode_debug; extern bool opt_complete; @@ -584,10 +757,7 @@ int ScanOptPerfMon ( ccp arg ); int ScanOptCustomTT ( ccp arg ); int ScanOptXPFlags ( ccp arg ); int ScanOptSpeedometer ( ccp arg ); - -int ScanOptReserved_1b9 ( ccp arg ); -int ScanOptReserved_1ba ( ccp arg ); -int ScanOptReserved_1bb ( ccp arg ); +int ScanOptDebug ( ccp arg ); // /////////////////////////////////////////////////////////////////////////////// diff --git a/project/src/lib-lex.c b/project/src/lib-lex.c index 357e062..6ad3e00 100644 --- a/project/src/lib-lex.c +++ b/project/src/lib-lex.c @@ -125,6 +125,8 @@ static const feature_var_t szs_feature_list[] = 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" ), + DEF_VAR( 0,HAVESZS_AIPARAM_BAA, f_aiparam_baa, "File AIParam/AIParam.baa" ), + DEF_VAR( 0,HAVESZS_AIPARAM_BAS, f_aiparam_bas, "File AIParam/AIParam.bas" ), {0,0,0,0,0} }; @@ -507,6 +509,8 @@ const features_szs_t * GetFeaturesModes() 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.f_aiparam_baa = FZM_GAMEPLAY | FZM_M_TYPE | FZM_OFFLINE; + m.f_aiparam_bas = FZM_GAMEPLAY | FZM_M_TYPE | FZM_OFFLINE; 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; @@ -1661,7 +1665,8 @@ static enumError ScanLEXElement_SET1 //--- setup data - lex_set1_t set1 = {0}; + lex_set1_t set1; + memset(&set1,0,sizeof(set1)); const ScanParam_t ptab[] = { @@ -2654,6 +2659,17 @@ int ScanOptLtRandom ( ccp arg ) /////////////// lex_info_t /////////////// /////////////////////////////////////////////////////////////////////////////// +void InitializeLexInfo ( lex_info_t *info ) +{ + DASSERT(info); + memset(info,0,sizeof(*info)); + info->item_factor.x = 1.0; + info->item_factor.y = 1.0; + info->item_factor.z = 1.0; +} + +/////////////////////////////////////////////////////////////////////////////// + void SetupLexInfo ( lex_info_t *info, const lex_t *lex ) { DASSERT(info); @@ -2672,6 +2688,7 @@ void SetupLexInfo ( lex_info_t *info, const lex_t *lex ) 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); + memcpy(&info->item_factor,&info->set1.item_factor,sizeof(info->item_factor)); } item = FindElementLEX(lex,LEXS_TEST); diff --git a/project/src/lib-lex.h b/project/src/lib-lex.h index 3667703..96c2d4f 100644 --- a/project/src/lib-lex.h +++ b/project/src/lib-lex.h @@ -72,6 +72,8 @@ typedef struct features_szs_t u8 f_ght_kart; // HAVESZS_GHT_KART u8 f_ght_kart_obj; // HAVESZS_GHT_KART_OBJ u8 f_minigame; // HAVESZS_MINIGAME + u8 f_aiparam_baa; // HAVESZS_AIPARAM_BAA + u8 f_aiparam_bas; // HAVESZS_AIPARAM_BAS //--- KMP features (initial list) @@ -495,14 +497,16 @@ typedef struct lex_info_t bool test_found; // true: section TEST found lex_set1_t test; // data of section TEST + + + // data + float3 item_factor; // 1.0 or copy of set1.item_factor } lex_info_t; /////////////////////////////////////////////////////////////////////////////// -static inline void InitializeLexInfo ( lex_info_t *info ) - { DASSERT(info); memset(info,0,sizeof(*info)); } - +void InitializeLexInfo ( lex_info_t *info ); static inline void ResetLexInfo ( lex_info_t *info ) { if (info) memset(info,0,sizeof(*info)); } diff --git a/project/src/lib-pat.c b/project/src/lib-pat.c index 632a2d3..0a37c90 100644 --- a/project/src/lib-pat.c +++ b/project/src/lib-pat.c @@ -921,7 +921,7 @@ static enumError ScanText_SIMPLE continue; ParamFieldItem_t *it - = FindInsertParamField( &pat->s1_str, str, true, 0 ); + = FindInsertParamField( &pat->s1_str, str, true, 0, 0 ); const uint sidx = it ? it - pat->s1_str.field : 0; if ( elem.selem_used == elem.selem_size ) diff --git a/project/src/lib-std.c b/project/src/lib-std.c index f23d3c6..6e5ea84 100644 --- a/project/src/lib-std.c +++ b/project/src/lib-std.c @@ -36,9 +36,7 @@ ***************************************************************************/ #include <sys/types.h> -#ifndef WIN_SZS_LIB - #include <sys/ioctl.h> -#endif +#include <sys/ioctl.h> #include <fcntl.h> #include "lib-std.h" @@ -66,10 +64,6 @@ #include "crypt.h" #include "logo.inc" -#ifdef WIN_SZS_LIB - #include <direct.h> -#endif - #if defined(TEST) && !defined(__APPLE__) && !defined(__CYGWIN__) #include <mcheck.h> #endif @@ -79,10 +73,10 @@ /////////////// vars /////////////// /////////////////////////////////////////////////////////////////////////////// +ccp opt_config = 0; ccp tool_name = "?"; +ccp std_share_path = 0; ccp share_path = 0; -ccp search_path[6] = {0}; -ccp auto_add_path[6] = {0}; // same size as search path volatile int SIGINT_level = 0; volatile int verbose = 0; volatile int logging = 0; @@ -119,12 +113,13 @@ file_format_t opt_fform = FF_UNKNOWN; file_format_t fform_compr = FF_YAZ0; file_format_t fform_compr_force = 0; file_format_t script_fform = FF_TXT; -ccp script_varname = "res"; +ccp script_varname = 0; 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_install = 0; int opt_pt_dir = 0; bool opt_links = false; bool opt_rm_aiparam = false; @@ -361,10 +356,8 @@ void SetupColors() // [[2do]] #if defined(TEST) || defined(DEBUG) - #define USE_PROGINFO 2 // 0:off, 1:both, 2:new proginfo only #define LOG_PROGINFO 1 // 0:off, 1:on #else - #define USE_PROGINFO 2 // 0:off, 1:both, 2:new proginfo only #define LOG_PROGINFO 0 // 0:off, 1:on #endif @@ -372,12 +365,7 @@ void SetupColors() void SetupLib ( int argc, char ** argv, ccp tname, ccp tvers, ccp ttitle ) { - #if USE_PROGINFO SetupProgname(argc,argv,tname,tvers,ttitle); - #else - if ( tname && *tname ) - ProgInfo.progname = tname; - #endif #if LOG_PROGINFO PRINT1("PROG1: %s | %s | %s\n",ProgInfo.progname,ProgInfo.progdir,ProgInfo.progpath); @@ -430,7 +418,6 @@ void SetupLib ( int argc, char ** argv, ccp tname, ccp tvers, ccp ttitle ) TRACE_SIZEOF(size_t); TRACE_SIZEOF(off_t); - #ifndef WIN_SZS_LIB TRACE_SIZEOF(int8_t); TRACE_SIZEOF(int16_t); TRACE_SIZEOF(int32_t); @@ -439,7 +426,6 @@ void SetupLib ( int argc, char ** argv, ccp tname, ccp tvers, ccp ttitle ) TRACE_SIZEOF(uint16_t); TRACE_SIZEOF(uint32_t); TRACE_SIZEOF(uint64_t); - #endif TRACE_SIZEOF(u8); TRACE_SIZEOF(u16); @@ -453,6 +439,7 @@ void SetupLib ( int argc, char ** argv, ccp tname, ccp tvers, ccp ttitle ) TRACE_SIZEOF(be32_t); TRACE_SIZEOF(be64_t); + TRACE("- numeric vectors\n"); TRACE_SIZEOF(float); TRACE_SIZEOF(float32); TRACE_SIZEOF(float3); @@ -466,6 +453,12 @@ void SetupLib ( int argc, char ** argv, ccp tname, ccp tvers, ccp ttitle ) TRACE_SIZEOF(double34); TRACE_SIZEOF(MatrixD_t); + TRACE("- mem\n"); + TRACE_SIZEOF(mem_t); + TRACE_SIZEOF(exmem_t); + TRACE_SIZEOF(exmem_key_t); + TRACE_SIZEOF(exmem_list_t); + TRACE("- arch\n"); TRACE_SIZEOF(yaz0_header_t); TRACE_SIZEOF(wbz_header_t); @@ -714,7 +707,7 @@ void SetupLib ( int argc, char ** argv, ccp tname, ccp tvers, ccp ttitle ) //----- some assertion - #if HAVE_ASSERT && !defined(WIN_SZS_LIB) // ??? [[mvc]] + #if HAVE_ASSERT { double3 d3; ASSERT( (double*)&d3 == d3.v ); @@ -744,115 +737,27 @@ void SetupLib ( int argc, char ** argv, ccp tname, ccp tvers, ccp ttitle ) MySeedByTime(); - //----- setup progname - - #if USE_PROGINFO < 2 - - tool_name = tname; - if ( argc > 0 && *argv && **argv ) - tname = *argv; - ProgInfo.progname = strrchr(tname,'/'); - ProgInfo.progname = ProgInfo.progname ? ProgInfo.progname+1 : tname; - //argv[0] = (char*)ProgInfo.progname; - if ( !tool_name || !*tool_name ) - tool_name = ProgInfo.progname; - - TRACE("##PROG## PROG-NAME=%s\n",ProgInfo.progname); - - #endif - - - //----- setup search_path + //----- setup std_share_path - char path[PATH_MAX]; - ccp *sp = search_path, *sp2; - DASSERT( sizeof(search_path)/sizeof(*search_path) > 5 ); - - #ifndef WIN_SZS_LIB - // determine program path - #if !USE_PROGINFO - char proc_path[30]; - snprintf(proc_path,sizeof(proc_path),"/proc/%u/exe",getpid()); - TRACE("PROC-PATH: %s\n",proc_path); - #endif - static char share[] = "/share/szs/"; - static char local_share[] = "/usr/local/share/szs/"; #ifndef __CYGWIN__ - share_path = local_share; + static const char share[] = "/share/szs"; + std_share_path = "/usr/local/share/szs"; #endif - #if USE_PROGINFO - if (GetProgramPath(path,sizeof(path),true,argv[0])) - #else - if (readlink(proc_path,path,sizeof(path))) - #endif + ccp progdir = ProgramDirectory(); + PRINT0("progdir=%s\n",progdir); + if (progdir) { - // program path found! - TRACE("PROG-PATH: %s\n",path); - - char * file_ptr = strrchr(path,'/'); - if ( file_ptr ) - { - // seems to be a real path -> terminate string behind '/' - *++file_ptr = 0; - - #ifdef TEST - // for development: append 'share' dir - StringCopyE(file_ptr,path+sizeof(path),"share/"); - *sp = STRDUP(path); - TRACE("SEARCH_PATH[%zd] = %s\n",sp-search_path,*sp); - sp++; - *file_ptr = 0; - #endif - - *sp = STRDUP(path); - TRACE("SEARCH_PATH[%zd] = %s\n",sp-search_path,*sp); - #ifdef __CYGWIN__ - share_path = *sp; - #endif - sp++; - - if ( file_ptr-5 >= path && !memcmp(file_ptr-4,"/bin/",5) ) - { - StringCopyS(file_ptr-5,sizeof(path),share); - *sp = STRDUP(path); - TRACE("SEARCH_PATH[%zd] = %s\n",sp-search_path,*sp); - sp++; - } - } - } - - // insert 'local_share' if not already done - - for ( sp2 = search_path; sp2 < sp && strcmp(*sp2,local_share); sp2++ ) - ; - if ( sp2 == sp ) - { - *sp = STRDUP(local_share); - TRACE("SEARCH_PATH[%zd] = %s\n",sp-search_path,*sp); - sp++; - } - #endif - - // insert CWD if not already done - getcwd(path,sizeof(path)-1); - strcat(path,"/"); - for ( sp2 = search_path; sp2 < sp && strcmp(*sp2,path); sp2++ ) - ; - if ( sp2 == sp ) - { - *sp = STRDUP("./"); - TRACE("SEARCH_PATH[%zd] = %s\n",sp-search_path,*sp); - sp++; + #ifdef __CYGWIN__ + std_share_path = progdir; + #else + uint plen = strlen(progdir); + if ( plen >= 4 && !strcmp(progdir+plen-4,"/bin") ) + std_share_path = MEMDUP2(progdir,plen-4,share,strlen(share)); + #endif } - *sp = 0; - ASSERT( sp - search_path < sizeof(search_path)/sizeof(*search_path) ); - - #ifdef TEST0 - CHECK_TRACE_ALLOC; - MEM_CHECK_SETUP(search_path[1]-0x20,0x40); - #endif + //--- misc SetupStandardSZS(); @@ -874,8 +779,14 @@ void NormalizeOptions { SetupColors(); + //--- load configuration + + const config_t *config = GetConfig(); + if (config) + share_path = config->share_path; + - //--- diff, delta and minimze + //--- diff, delta and minimize minimize_level = delta_count < 9 ? delta_count : 9; if ( diff_count > 0 ) @@ -928,21 +839,24 @@ void NormalizeOptions fprintf(stdlog,"PROGRAM_NAME = %s\n",ProgInfo.progname); if ( compatible != COMPAT_CURRENT ) fprintf(stdlog,"COMPATIBILITY = %s\n",PrintOptCompatible()); + fprintf(stdlog,"CONFIG_FILE = %s\n",config->config_file); - if ( log_level > 2 ) { - fprintf(stdlog,"SHARE_PATH = %s\n",share_path); + const config_t *config = GetConfig(); + fprintf(stdlog,"CONFIG_FILE = %s\n",config->config_file); + fprintf(stdlog,"STD_SHARE_PATH = %s\n",std_share_path); + fprintf(stdlog,"SHARE_PATH = %s\n",config->share_path); - ccp * sp; - for ( sp = search_path; *sp; sp++ ) - fprintf(stdlog,"SEARCH_PATH[%td] = %s\n",sp-search_path,*sp); + int i; + const StringField_t *sf = GetSearchList(); + ccp *str = sf->field; + for ( i = 0; i < sf->used; i++, str++ ) + fprintf(stdlog,"SEARCH_PATH[%d] = %s\n",i,*str); - if ( log_level > 1 ) - { - SetupAutoAdd(); - for ( sp = auto_add_path; *sp; sp++ ) - fprintf(stdlog,"AUTOADD_PATH[%td] = %s\n",sp-auto_add_path,*sp); - } + sf = GetAutoaddList(); + str = sf->field; + for ( i = 0; i < sf->used; i++, str++ ) + fprintf(stdlog,"AUTOADD_PATH[%d] = %s\n",i,*str); } fprintf(stdlog,"\n"); } @@ -1143,6 +1057,7 @@ const ccp warn_szs_name[WARNSZS__N] = { "itempos", // WARNSZS_ITEMPOS "self-it", // WARNSZS_SELF_ITPH + "no-minimap", // WARNSZS_NO_MINIMAP }; /////////////////////////////////////////////////////////////////////////////// @@ -1153,9 +1068,10 @@ ccp GetWarnSZSNames ( warn_bits_t ws, char sep ) { WARNSZS_ITEMPOS, WARNSZS_SELF_ITPH, + WARNSZS_NO_MINIMAP, -1 }; - + char buf[100], *dest = buf; const int *op; @@ -1859,7 +1775,7 @@ char * SubstString tempbuf[count] = 0; } char * new_dest - = NormalizeFileName(dest,end-dest,tempbuf,ptr->allow_slash,use_utf8); + = NormalizeFileName(dest,end-dest,tempbuf,ptr->allow_slash,use_utf8,TRSL_NONE); if ( check_prev && *dest == '.' ) { int len = new_dest - dest; @@ -1980,6 +1896,11 @@ int SubstDest /////////////// FormatField_t /////////////// /////////////////////////////////////////////////////////////////////////////// +#undef FORMAT_FIELD_GROW +#define FORMAT_FIELD_GROW(s) (s)/4+100 + +/////////////////////////////////////////////////////////////////////////////// + void InitializeFormatField ( FormatField_t * ff ) { DASSERT(ff); @@ -2110,7 +2031,7 @@ static FormatFieldItem_t * InsertFormatFieldHelper ( FormatField_t * ff, int idx noPRINT("+FF: %u/%u/%u\n",idx,ff->used,ff->size); if ( ff->used == ff->size ) { - ff->size += 0x100; + ff->size += FORMAT_FIELD_GROW(ff->size); ff->list = REALLOC(ff->list,ff->size*sizeof(*ff->list)); } DASSERT( idx <= ff->used ); @@ -2329,7 +2250,7 @@ FormatFieldItem_t * AppendFormatField noPRINT(">FF: %u/%u\n",ff->used,ff->size); if ( ff->used == ff->size ) { - ff->size += 0x100; + ff->size += FORMAT_FIELD_GROW(ff->size); ff->list = REALLOC(ff->list,ff->size*sizeof(*ff->list)); } TRACE("AppendFormatField(%s,%d) %d/%d\n",key,move_key,ff->used,ff->size); @@ -3910,6 +3831,98 @@ void cmd_version_section // /////////////////////////////////////////////////////////////////////////////// +/////////////// command config & support /////////////// +/////////////////////////////////////////////////////////////////////////////// + +enumError cmd_config() +{ + uint i; + search_file_list_t sfl; + SearchConfigHelper(&sfl,0); + + PrintScript_t ps; + SetupPrintScriptByOptions(&ps); + const bool print_info = ps.fform == PSFF_UNKNOWN; + + if (print_info) + printf("\nList of %u searched configuration file%s (*=relevant, +=found):\n", + sfl.used, sfl.used == 1 ? "" : "s" ); + + search_file_t *found = 0, *sf = sfl.list; + for ( i = 0; i < sfl.used; i++, sf++ ) + { + char ch; + if ( sf->itype < INTY_REG ) + ch = '-'; + else if ( !found && ( !opt_config || sf->hint & CONF_HINT_OPT )) + { + found = sf; + ch = '*'; + } + else + ch = '+'; + + if (print_info) + printf(" %c %s\n",ch,sf->fname); + } + + if (print_info) + { + if (found) + printf("\nRelevant configuration file: %s\n",found->fname); + else + fputs("\nNo valid configuration file found!\n",stdout); + } + + config_t config; + InitializeConfig(&config); + if (found) + ScanConfig(&config,found->fname,!opt_config); + #ifdef TEST + else if (opt_config) + ScanConfig(&config,opt_config,false); + #endif + else + ScanConfig(&config,0,true); + + if (print_sections) + PrintConfigFile(stdout,&config); + else if (print_info) + PrintConfig( stdout, &config, verbose>0 || opt_install ); + else + PrintConfigScript(stdout,&config); + + ResetConfig(&config); + ResetSearchFile(&sfl); + + if (print_info) + { + if ( long_count > 0 ) + { + const StringField_t *sf = GetSearchList(); + fputs("\nSearch list:\n",stdout); + ccp *str = sf->field; + for ( i = 0; i < sf->used; i++, str++ ) + printf(" %s\n",*str); + + if ( long_count > 1 ) + { + const StringField_t *sf = GetAutoaddList(); + fputs("\nAuto-add search list:\n",stdout); + ccp *str = sf->field; + for ( i = 0; i < sf->used; i++, str++ ) + printf(" %s\n",*str); + } + } + putchar('\n'); + } + + ResetPrintScript(&ps); + return ERR_OK; +} + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// command argtest /////////////// /////////////////////////////////////////////////////////////////////////////// @@ -5105,6 +5118,32 @@ file_format_t RepairMagicByOpt /////////////// misc /////////////// /////////////////////////////////////////////////////////////////////////////// +void SetupPrintScriptByOptions ( PrintScript_t *ps ) +{ + DASSERT(ps); + + InitializePrintScript(ps); + ps->force_case = opt_case; + ps->create_array = script_array > 0; + ps->var_name = script_varname ? script_varname : "res"; + ps->var_prefix = script_varname ? script_varname : "res_"; + ps->eq_tabstop = 2; + ps->ena_empty = brief_count < 2; + ps->ena_comments = brief_count < 1; + + switch(script_fform) + { + case FF_JSON: ps->fform = PSFF_JSON; break; + case FF_BASH: ps->fform = PSFF_BASH; break; + case FF_SH: ps->fform = PSFF_SH; break; + case FF_PHP: ps->fform = PSFF_PHP; break; + case FF_MAKEDOC: ps->fform = PSFF_MAKEDOC; break; + default: ps->fform = print_sections ? PSFF_CONFIG : PSFF_UNKNOWN; break; + } +} + +/////////////////////////////////////////////////////////////////////////////// + void SHA1_to_ID ( sha1_id_t id, const sha1_hash_t hash ) { //--- create a smaller hash value (20->5 bytes with 3 bytes padding) @@ -6453,7 +6492,7 @@ valid_t IsValidKMP "KMP header declares file size as %u bytes, but it has only %u bytes: %s", hi.file_size, file_size, fname ); hi.file_size = file_size; - + kmp_file_gen_t *kfile = (kmp_file_gen_t*)data; write_be32(&kfile->file_size,hi.file_size); } diff --git a/project/src/lib-std.h b/project/src/lib-std.h index 2fcb06b..2d68f85 100644 --- a/project/src/lib-std.h +++ b/project/src/lib-std.h @@ -49,12 +49,9 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> - -#ifndef WIN_SZS_LIB - #include <sys/time.h> - #include <unistd.h> - #include <arpa/inet.h> -#endif +#include <sys/time.h> +#include <unistd.h> +#include <arpa/inet.h> #include "dclib-system.h" #include "dclib-basics.h" @@ -98,6 +95,7 @@ void LogSHA1 ( ccp func, ccp file, uint line, cvp data, uint size, ccp info ); /////////////////////////////////////////////////////////////////////////////// // also used by UI +#define CONFIG_FILE "wiimms-szs-tools.conf" #define SZS_SETUP_FILE "wszst-setup.txt" #define CHECK_FILE_SIZE 0x800 #define OPT_PNG_TYPE_CLASS 0x7fef0bff @@ -233,6 +231,7 @@ typedef enum warn_enum_t { WARNSZS_ITEMPOS, // item-pos bug WARNSZS_SELF_ITPH, // self linked ITPT route + WARNSZS_NO_MINIMAP, // no minimap found WARNSZS__N } warn_enum_t; @@ -824,8 +823,8 @@ uint IsolateFilename /////////////////////////////////////////////////////////////////////////////// -bool SetupAutoAdd(); -bool DefineAutoAddPath ( ccp path ); +bool IsAutoAddAvailable(); +void DefineAutoAddPath ( ccp path ); s64 FindAutoAdd ( ccp fname, ccp ext, char *buf, uint buf_size ); // @@ -1287,6 +1286,7 @@ typedef enum slot_info_type_t SIT_NOT, // not defined SIT_GENERIC, // generic slot: "arena" or music by race/arena slot SIT_RECOMMEND, // recommended slot: "r##" | "a##" | "m*" + SIT_MANDATORY3, // mandatory alternative: "31+42+71" | "31+62+71" SIT_MANDATORY2, // mandatory alternative: "31+71" SIT_MANDATORY, // mandatory slot: "##" } @@ -1308,11 +1308,13 @@ typedef struct slot_info_t slot_info_type_t arena_mode; // 0:not, 1:"arena", 2:"a##" slot_info_type_t music_mode; // 0:not, 1:generic, 2:"m*" bool have_31_71; // true: "31+71" found! + bool have_31_42_71; // true: "31+42+71" found! + bool have_31_62_71; // true: "31+62+71" found! - char race_info[6]; // race slot as text: "##" | "r##" | "31+71" + char race_info[9]; // race slot as text: "##" | "r##" | "31+71" | "31+41+71" char arena_info[6]; // arena slot as text: "arena" | "a##" char music_info[5]; // music slot as text: "m##" | "ma##" - char slot_attrib[17];// normalized slot atribute, combi of race+arena+music + char slot_attrib[20];// normalized slot atribute, combi of race+arena+music } slot_info_t; @@ -1355,6 +1357,7 @@ typedef struct FormatFieldItem_t } FormatFieldItem_t; //----------------------------------------------------------------------------- +// [[FormatField_t]] typedef struct FormatField_t { @@ -1650,6 +1653,7 @@ void DumpTrackFileList /////////////////////////////////////////////////////////////////////////////// /////////////// scan setup files /////////////// /////////////////////////////////////////////////////////////////////////////// +// [[SetupDef_t]] typedef struct SetupDef_t { @@ -1661,12 +1665,14 @@ typedef struct SetupDef_t } SetupDef_t; //----------------------------------------------------------------------------- +// [[ListDef_t]] typedef struct ListDef_t { ccp name; // section name bool append; // true: append string instead of insert - StringField_t *sf; // valid pointer to string field + StringField_t *sf; // NULL or valid pointer to string field + exmem_list_t *eml; // NULL or valid pointer to exmem list } ListDef_t; @@ -1679,13 +1685,13 @@ size_t ResetSetup enumError ScanSetupFile ( - SetupDef_t * sdef, // object list terminated with an element 'name=NULL' - ListDef_t * ldef, // NULL or object list terminated - // with an element 'name=NULL' - ccp path1, // filename of text file, part 1 - ccp path2, // filename of text file, part 2 - SubDir_t * sdir, // not NULL: use it and ignore 'path1' - bool silent // true: suppress error message if file not found + SetupDef_t * sdef, // object list terminated with an element 'name=NULL' + const ListDef_t * ldef, // NULL or object list terminated + // with an element 'name=NULL' + ccp path1, // filename of text file, part 1 + ccp path2, // filename of text file, part 2 + SubDir_t * sdir, // not NULL: use it and ignore 'path1' + bool silent // true: suppress error message if file not found ); /////////////////////////////////////////////////////////////////////////////// @@ -1961,7 +1967,48 @@ valid_t IsValidCTCODE ccp fname // not NULL: print warnings with file ref ); -// +//// +/////////////////////////////////////////////////////////////////////////////// +/////////////// scan configuration /////////////// +/////////////////////////////////////////////////////////////////////////////// +// [[config_t]] + +typedef struct config_t +{ + ccp config_file; + ccp base_path; + ccp install_path; + ccp install_config; + ccp share_path; + ccp autoadd_path; +} +config_t; + +//----------------------------------------------------------------------------- + +static inline void InitializeConfig ( config_t *config ) + { DASSERT(config); memset(config,0,sizeof(*config)); } + +void ResetConfig ( config_t *config ); + +enumError ScanConfig +( + config_t *config, // store configuration here + ccp path, // NULL or path + bool silent // true: suppress printing of error messages +); + +void SearchConfigHelper ( search_file_list_t *sfl, int stop_mode ); +const config_t * GetConfig(void); +void PrintConfig ( FILE *f, const config_t *config, bool verbose ); +void PrintConfigScript ( FILE *f, const config_t *config ); +void PrintConfigFile ( FILE *f, const config_t *config ); + +const StringField_t * GetSearchList(void); +const StringField_t * GetAutoaddList(void); + +extern ccp autoadd_destination; + /////////////////////////////////////////////////////////////////////////////// /////////////// misc /////////////// /////////////////////////////////////////////////////////////////////////////// @@ -2001,6 +2048,7 @@ data_tab_t; void cmd_version_section ( bool sect_header, ccp name_short, ccp name_long, int verbose ); +enumError cmd_config(); enumError cmd_argtest ( int argc, char ** argv ); enumError cmd_error(); enumError cmd_filetype(); @@ -2102,6 +2150,8 @@ extern const char *TableEncode64BySetup; int ScanOptCoding64 ( ccp arg ); EncodeMode_t SetupCoding64 ( EncodeMode_t mode, EncodeMode_t fallback ); +void SetupPrintScriptByOptions ( PrintScript_t *ps ); + /////////////////////////////////////////////////////////////////////////////// uint GetMkwMusicSlot ( uint tid ); @@ -2160,10 +2210,11 @@ extern const u8 TestDataLEX[8*1]; /////////////// vars /////////////// /////////////////////////////////////////////////////////////////////////////// +extern ccp opt_config; +extern ccp config_path; extern ccp tool_name; +extern ccp std_share_path; extern ccp share_path; -extern ccp search_path[]; -extern ccp auto_add_path[6]; extern volatile int SIGINT_level; extern volatile int verbose; extern volatile int logging; @@ -2206,6 +2257,7 @@ extern LowerUpper_t opt_case; extern int opt_pmodes; extern uint opt_fmodes_include; extern uint opt_fmodes_exclude; +extern int opt_install; 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 e622e17..1523d2e 100644 --- a/project/src/lib-szs-create.c +++ b/project/src/lib-szs-create.c @@ -1107,12 +1107,14 @@ enumError LoadObjFileListSZS } - //--- slot analysis: 31+71, 62 + //--- slot analysis: 31+71, 31+x+71, 62 szs->slot_analyzed = true; - szs->slot_31_71 = ( used_obj.d[GOBJ_SUN_DS] ? SLOT_31_71_SUNDS : 0 ) - | ( used_obj.d[GOBJ_PYLON01] ? SLOT_31_71_PYLON01 : 0 ); +// [[31+42+71+]] + szs->slot_31_xx_71 + = ( used_obj.d[GOBJ_SUN_DS] ? SLOT_31_71_SUNDS : 0 ) + | ( used_obj.d[GOBJ_PYLON01] ? SLOT_31_71_PYLON01 : 0 ); szs->slot_62 = used_obj.d[GOBJ_HEYHO_SHIP] != 0; @@ -1199,7 +1201,7 @@ static void AddSpecialFile snprintf(buf,sizeof(buf),"%s %s",GetNameFF(fform,0),fname); ParamFieldItem_t *it - = InsertParamFieldEx(szs->special_file,buf,false,size,0); + = FindInsertParamField(szs->special_file,buf,false,size,0); if (!it->data) { sha1_hash_t *hash = MALLOC(sizeof(sha1_hash_t)); @@ -1818,7 +1820,7 @@ enumError AddMissingFiles DASSERT(szs); DASSERT( sd || norm ); - if (!SetupAutoAdd()) + if (!IsAutoAddAvailable()) return ERR_OK; char path_buf[PATH_MAX]; @@ -3518,19 +3520,19 @@ int CheckSZS } - //--- slot 3.1 and 7.1 + //--- slot 3.1, 4.2 and 7.1 - if (szs->slot_31_71) + if (szs->slot_31_xx_71) { - if ( szs->slot_31_71 == (SLOT_31_71_SUNDS|SLOT_31_71_PYLON01) ) + if ( szs->slot_31_xx_71 == (SLOT_31_71_SUNDS|SLOT_31_71_PYLON01) ) print_check_error( &chk, CMOD_SLOT, - "Track will only run at slots 3.1 and 7.1," + "Track will only run at slots 3.1, 4.2, 6.2 and 7.1," " because objects 'sunDS' and 'pylon01' are used.\n" ); else print_check_error( &chk, CMOD_SLOT, - "Track will only run at slots 3.1 and 7.1," + "Track will only run at slots 3.1, 4.2, 6.2 and 7.1," " because object '%s' is used.\n", - szs->slot_31_71 & SLOT_31_71_SUNDS ? "sunDS" : "pylon01" ); + szs->slot_31_xx_71 & SLOT_31_71_SUNDS ? "sunDS" : "pylon01" ); } @@ -3757,12 +3759,14 @@ static void set_required_slot ( int slot[MKW_N_TRACKS], // status vector uint slot1, // first required slot index - uint slot2 // second required slot index + uint slot2, // second required slot index + uint slot3, // third required slot index + uint slot4 // fourth required slot index ) { uint i; for ( i = 0; i < MKW_N_TRACKS; i++ ) - if ( i != slot1 && i != slot2 ) + if ( i != slot1 && i != slot2 && i != slot3 && i != slot4 ) slot[i] = -1; else if (!slot[i]) slot[i] = 1; @@ -3792,7 +3796,7 @@ int FindSlotsSZS // 0: unknown // +1: slot possible int *required_slot // if not NULL: return 0|31|61|62 - // 31 is an alias for "31+71" + // 31 is an alias for "31+71" or "31+41+71" ) { DASSERT(szs); @@ -3854,11 +3858,11 @@ int FindSlotsSZS int stat = 1; - //--- analyze slots 3.1 & 7.1 + //--- analyze slots 3.1 & 4.2 & 7.1 - if (szs->slot_31_71) + if (szs->slot_31_xx_71) { - set_required_slot(slot,ISLOT(3,1),ISLOT(7,1)); + set_required_slot(slot,ISLOT(3,1),ISLOT(4,2),ISLOT(6,2),ISLOT(7,1)); stat = -1; if (required_slot) *required_slot = 31; @@ -3876,7 +3880,7 @@ int FindSlotsSZS if (need_ice_brres) { - set_required_slot(slot,ISLOT(6,1),ISLOT(6,1)); + set_required_slot(slot,ISLOT(6,1),ISLOT(6,1),ISLOT(6,1),ISLOT(6,1)); if (!szs->have_ice_brres) SLOT(6,1) = -1; else @@ -3895,7 +3899,7 @@ int FindSlotsSZS if (szs->slot_62) { stat = -1; - set_required_slot(slot,ISLOT(6,2),ISLOT(6,2)); + set_required_slot(slot,ISLOT(6,2),ISLOT(6,2),ISLOT(6,2),ISLOT(6,2)); if (required_slot) *required_slot = 62; } @@ -3912,9 +3916,6 @@ int FindSlotsSZS return stat; } -#undef SLOT -#undef ISLOT - /////////////////////////////////////////////////////////////////////////////// void AnalyzeSlot ( slot_ana_t *sa, szs_file_t *szs ) @@ -3960,50 +3961,29 @@ void AnalyzeSlot ( slot_ana_t *sa, szs_file_t *szs ) StringCopyS(sa->slot_info,sizeof(sa->slot_info),buf); if ( sa->required_slot == 31 ) - StringCopyS(sa->mandatory_slot,sizeof(sa->mandatory_slot),"31+71"); + { + if ( sa->slot[ISLOT(6,2)] > 0 ) + StringCopyS(sa->mandatory_slot,sizeof(sa->mandatory_slot),"31+62+71"); + else if ( sa->slot[ISLOT(4,2)] > 0 ) + StringCopyS(sa->mandatory_slot,sizeof(sa->mandatory_slot),"31+42+71"); + else + StringCopyS(sa->mandatory_slot,sizeof(sa->mandatory_slot),"31+71"); + } else if ( sa->required_slot ) snprintf(sa->mandatory_slot,sizeof(sa->mandatory_slot),"%u",sa->required_slot); } +#undef SLOT +#undef ISLOT + /////////////////////////////////////////////////////////////////////////////// ccp CreateSlotInfo ( szs_file_t *szs ) { DASSERT(szs); - #if 1 slot_ana_t sa; AnalyzeSlot(&sa,szs); return CopyCircBuf(sa.slot_info,strlen(sa.slot_info)+1); - #else - int slot[MKW_N_TRACKS]; - int required_slot; - const int stat = FindSlotsSZS(szs,slot,&required_slot); - - if ( szs->is_arena >= ARENA_FOUND ) - return "arena"; - - static char buf[500]; - char *dest = buf; - - uint i; - for ( i = 0; i < MKW_N_TRACKS; i++ ) - if ( slot[i] != stat ) - { - if ( dest > buf ) - *dest++ = ','; - dest = snprintfE(dest,buf+sizeof(buf),"%c%u.%u", - slot[i] < 0 ? '-' : slot[i] > 0 ? '+' : '?' , - i/4+1, i%4+1 ); - } - - if ( dest == buf ) - *dest++ = '%'; - *dest++ = 0; - const uint size = dest - buf; - char *res = GetCircBuf(size); - memcpy(res,buf,size); - return res; - #endif } // @@ -5115,6 +5095,12 @@ void AnalyseSZS if ( szs->have.szs[HAVESZS_MINIGAME] >= HFM_MODIFIED ) ct_dest = StringCopyE(ct_dest,ct_end,",minigame"); + if ( szs->have.szs[HAVESZS_AIPARAM_BAA] >= HFM_ORIGINAL + || szs->have.szs[HAVESZS_AIPARAM_BAS] >= HFM_ORIGINAL + ) + { + ct_dest = StringCopyE(ct_dest,ct_end,",aiparam"); + } //--- scan KCL @@ -5162,7 +5148,7 @@ void AnalyseSZS Sha1Bin2Hex(as->sha1_minimap,sha1_data.hash); } else - valid_track = false; + szs->warn_bits |= 1 << WARNSZS_NO_MINIMAP; //--- finalize ct_attrib by "lex" and "warn" diff --git a/project/src/lib-szs.c b/project/src/lib-szs.c index e359f26..f541186 100644 --- a/project/src/lib-szs.c +++ b/project/src/lib-szs.c @@ -67,6 +67,8 @@ const ccp have_szs_name[HAVESZS__N] = "ght_kartobj", // HAVESZS_GHT_KART_OBJ "itemslot", // HAVESZS_ITEM_SLOT_TABLE "minigame", // HAVESZS_MINIGAME + "aiparam_baa", // HAVESZS_AIPARAM_BAA + "aiparam_bas", // HAVESZS_AIPARAM_BAS }; const ccp have_szs_file[HAVESZS__N] = @@ -79,6 +81,8 @@ const ccp have_szs_file[HAVESZS__N] = "common/GeoHitTableKartObj.bin", // HAVESZS_GHT_KART_OBJ "ItemSlotTable/ItemSlotTable.slt", // HAVESZS_ITEM_SLOT_TABLE "common/minigame.kmg", // HAVESZS_MINIGAME + "AIParam/AIParam.baa", // HAVESZS_AIPARAM_BAA + "AIParam/AIParam.bas", // HAVESZS_AIPARAM_BAS }; const file_format_t have_szs_fform[HAVESZS__N] = @@ -91,6 +95,8 @@ const file_format_t have_szs_fform[HAVESZS__N] = FF_GH_KOBJ, // HAVESZS_GHT_KART_OBJ FF_ITEMSLT, // HAVESZS_ITEM_SLOT_TABLE FF_KMG, // HAVESZS_MINIGAME + FF_UNKNOWN, // HAVESZS_AIPARAM_BAA + FF_UNKNOWN, // HAVESZS_AIPARAM_BAS }; // @@ -1707,7 +1713,7 @@ static enumError SetupWU8Info ( wu8_info_t *wu8, szs_file_t *szs, bool encode ) memset(wu8,0,sizeof(*wu8)); - if (!SetupAutoAdd()) + if (!IsAutoAddAvailable()) return ERROR0(ERR_CANT_OPEN, "WU8-%sCODE: Can't find autoadd library.\n", encode ? "EN" : "DE" ); @@ -3265,7 +3271,7 @@ static int iterate_sub_files if ( it->off > it->szs->size || it->off + it->size > it->szs->size ) { ERROR0(ERR_WARNING, - "Illegal offset [%x..%x, size=%zx] for subfile.\n" + "Invalid offset [%x..%x, size=%zx] for subfile.\n" "=> File ignored: %s%s%s\n", it->off, it->off+it->size, it->szs->size, it->szs->fname, *it->szs->fname ? "/" : "", @@ -4620,7 +4626,7 @@ u32 InsertStringPool if (!sp->data) { ParamFieldItem_t *pi - = InsertParamFieldEx(&sp->pf,string,move_string,sp->pf.used+1,0); + = FindInsertParamField(&sp->pf,string,move_string,sp->pf.used+1,0); if (pi) { if (data) diff --git a/project/src/lib-szs.h b/project/src/lib-szs.h index 4d09f00..eea6912 100644 --- a/project/src/lib-szs.h +++ b/project/src/lib-szs.h @@ -258,8 +258,8 @@ CmpFuncSubFile GetCmpFunc enum szs_marker_t { - SLOT_31_71_SUNDS = 0x01, // bit for 'szs_file_t:slot_31_71' - SLOT_31_71_PYLON01 = 0x02, // bit for 'szs_file_t:slot_31_71' + SLOT_31_71_SUNDS = 0x01, // bit for 'szs_file_t:slot_31_xx_71' + SLOT_31_71_PYLON01 = 0x02, // bit for 'szs_file_t:slot_31_xx_71' SLOT_42_KART_TRUCK_U = 0x01, // bit for 'szs_file_t:slot_42' SLOT_42_CAR_BODY_U = 0x02, // bit for 'szs_file_t:slot_42' @@ -288,6 +288,8 @@ typedef enum have_szs_file_t HAVESZS_GHT_KART_OBJ, // common/GeoHitTableKartObj.bin HAVESZS_ITEM_SLOT_TABLE, // ItemSlotTable/ItemSlotTable.slt HAVESZS_MINIGAME, // common/minigame.kmg + HAVESZS_AIPARAM_BAA, // AIParam/AIParam.baa + HAVESZS_AIPARAM_BAS, // AIParam/AIParam.bas HAVESZS__N } __attribute__ ((packed)) have_szs_file_t; @@ -391,7 +393,7 @@ typedef struct szs_file_t IsArena_t is_arena; // one of ARENA_* bool slot_analyzed; // true: slot values are valid - uint slot_31_71; // slot required because of objects + uint slot_31_xx_71; // slot required because of objects uint slot_42; // slot possible because of objects uint slot_62; // slot required because of objects @@ -798,8 +800,8 @@ typedef struct slot_ana_t int slot[MKW_N_TRACKS]; // set by FindSlotsSZS() int required_slot; // set by FindSlotsSZS() - char mandatory_slot[6]; // empty | "arena" | "31+71" | "61" | "62" - char slot_info[30]; // slot info text + char mandatory_slot[9]; // empty | "arena" | "31+71" | "31+41+71" | "61" | "62" + char slot_info[31]; // slot info text } slot_ana_t; @@ -815,7 +817,7 @@ int FindSlotsSZS // 0: unknown // +1: slot possible int *required_slot // if not NULL: return 0|31|61|62 - // 31 is an alias for "31+71" + // 31 is an alias for "31+71" or "31+41+71" ); void AnalyzeSlot ( slot_ana_t *sa, szs_file_t *szs ); diff --git a/project/src/ui/gen-ui.c b/project/src/ui/gen-ui.c index d8518ce..3e072cf 100644 --- a/project/src/ui/gen-ui.c +++ b/project/src/ui/gen-ui.c @@ -75,6 +75,11 @@ bool DefineIntVar ( VarMap_t * vm, ccp varname, int value ) { return false; } #define ARCHIVES_AND "SZS, U8, PACK, BRRES, BREFF, BREFT and RARC" #define ARCHIVES_COMMA "SZS, U8, PACK, BRRES, BREFF, BREFT, RARC" +// create archives +#define CARCHIVES_OR "SZS, U8, PACK, BRRES, BREFF or BREFT" +#define CARCHIVES_AND "SZS, U8, PACK, BRRES, BREFF and BREFT" +#define CARCHIVES_COMMA "SZS, U8, PACK, BRRES, BREFT" + #define MAX_GAMEMODES "1573" #define NO_HEAD_SYNTAX "Suppress the syntax information section in decoded text files." @@ -145,6 +150,10 @@ bool DefineIntVar ( VarMap_t * vm, ccp varname, int value ) { return false; } #define DEPRECATED "[DEPRECATED] " +#define CONFIG_CMD \ + "Show all information about the search" \ + " for the configuration file and its content." + // /////////////////////////////////////////////////////////////////////////////// /////////////// the info table /////////////// diff --git a/project/src/ui/tab-wbmgt.inc b/project/src/ui/tab-wbmgt.inc index 7f63fde..86cb2c7 100644 --- a/project/src/ui/tab-wbmgt.inc +++ b/project/src/ui/tab-wbmgt.inc @@ -59,6 +59,10 @@ "wbmgt HELP [--width=wd] [ignored]...", 0 /* copy of wszst */ }, + { T_DEF_CMD, "CONFIG", "CONFIG", + "wbmgt CONFIG [options]...", + CONFIG_CMD }, + { T_DEF_CMD, "ARGTEST", "ARGTEST", "wbmgt ARGTEST ...", 0 /* copy of wszst */ }, @@ -191,6 +195,9 @@ { T_OPT_S, "XHELP", "xhelp", 0, 0 /* copy of wszst */ }, + { T_OPT_GP, "CONFIG", "config", + 0, 0 /* copy of wszst */ }, + { T_OPT_G, "ALLOW_ALL", "allow-all|allowall", 0, 0 /* copy of wszst */ }, @@ -450,6 +457,14 @@ { T_COPT, "MAX_WIDTH", 0,0,0 }, { T_ALL_OPT, 0, 0,0,0 }, + //---------- COMMAND wbmgt CONFIG ---------- + + { T_CMD_BEG, "CONFIG", 0,0,0 }, + + { T_COPT, "CONFIG", 0,0,0 }, + { T_COPT, "LONG", 0,0, + "If set, print the search list too." }, + //---------- COMMAND wbmgt ARGTEST ---------- { T_CMD_BEG, "ARGTEST", 0,0,0 }, diff --git a/project/src/ui/tab-wctct.inc b/project/src/ui/tab-wctct.inc index 9d4bbdf..b4f72bc 100644 --- a/project/src/ui/tab-wctct.inc +++ b/project/src/ui/tab-wctct.inc @@ -60,6 +60,10 @@ "wctct HELP [--width=wd] [ignored]...", 0 /* copy of wszst */ }, + { T_DEF_CMD, "CONFIG", "CONFIG", + "wctct CONFIG [options]...", + CONFIG_CMD }, + { T_DEF_CMD, "ARGTEST", "ARGTEST", "wctct ARGTEST ...", 0 /* copy of wszst */ }, @@ -178,6 +182,9 @@ { T_OPT_S, "XHELP", "xhelp", 0, 0 /* copy of wszst */ }, + { T_OPT_GP, "CONFIG", "config", + 0, 0 /* copy of wszst */ }, + { T_OPT_G, "ALLOW_ALL", "allow-all|allowall", 0, 0 /* copy of wszst */ }, @@ -568,6 +575,14 @@ { T_COPT, "MAX_WIDTH", 0,0,0 }, { T_ALL_OPT, 0, 0,0,0 }, + //---------- COMMAND wctct CONFIG ---------- + + { T_CMD_BEG, "CONFIG", 0,0,0 }, + + { T_COPT, "CONFIG", 0,0,0 }, + { T_COPT, "LONG", 0,0, + "If set, print the search list too." }, + //---------- COMMAND wctct ARGTEST ---------- { T_CMD_BEG, "ARGTEST", 0,0,0 }, diff --git a/project/src/ui/tab-wimgt.inc b/project/src/ui/tab-wimgt.inc index 6198c13..c41c210 100644 --- a/project/src/ui/tab-wimgt.inc +++ b/project/src/ui/tab-wimgt.inc @@ -60,6 +60,10 @@ "wimgt HELP [--width=wd] [ignored]...", 0 /* copy of wszst */ }, + { T_DEF_CMD, "CONFIG", "CONFIG", + "wimgt CONFIG [options]...", + CONFIG_CMD }, + { T_DEF_CMD, "ARGTEST", "ARGTEST", "wimgt ARGTEST ...", 0 /* copy of wszst */ }, @@ -148,6 +152,9 @@ { T_OPT_S, "XHELP", "xhelp", 0, 0 /* copy of wszst */ }, + { T_OPT_GP, "CONFIG", "config", + 0, 0 /* copy of wszst */ }, + { T_OPT_G, "ALLOW_ALL", "allow-all|allowall", 0, 0 /* copy of wszst */ }, @@ -398,6 +405,14 @@ { T_COPT, "MAX_WIDTH", 0,0,0 }, { T_ALL_OPT, 0, 0,0,0 }, + //---------- COMMAND wimgt CONFIG ---------- + + { T_CMD_BEG, "CONFIG", 0,0,0 }, + + { T_COPT, "CONFIG", 0,0,0 }, + { T_COPT, "LONG", 0,0, + "If set, print the search list too." }, + //---------- COMMAND wimgt ARGTEST ---------- { T_CMD_BEG, "ARGTEST", 0,0,0 }, diff --git a/project/src/ui/tab-wkclt.inc b/project/src/ui/tab-wkclt.inc index 931b061..9842709 100644 --- a/project/src/ui/tab-wkclt.inc +++ b/project/src/ui/tab-wkclt.inc @@ -59,6 +59,10 @@ "wkclt HELP [--width=wd] [ignored]...", 0 /* copy of wszst */ }, + { T_DEF_CMD, "CONFIG", "CONFIG", + "wkclt CONFIG [options]...", + CONFIG_CMD }, + { T_DEF_CMD, "ARGTEST", "ARGTEST", "wkclt ARGTEST ...", 0 /* copy of wszst */ }, @@ -245,6 +249,9 @@ { T_OPT_S, "XHELP", "xhelp", 0, 0 /* copy of wszst */ }, + { T_OPT_GP, "CONFIG", "config", + 0, 0 /* copy of wszst */ }, + { T_OPT_G, "ALLOW_ALL", "allow-all|allowall", 0, 0 /* copy of wszst */ }, @@ -539,6 +546,14 @@ { T_COPT, "MAX_WIDTH", 0,0,0 }, { T_ALL_OPT, 0, 0,0,0 }, + //---------- COMMAND wkclt CONFIG ---------- + + { T_CMD_BEG, "CONFIG", 0,0,0 }, + + { T_COPT, "CONFIG", 0,0,0 }, + { T_COPT, "LONG", 0,0, + "If set, print the search list too." }, + //---------- COMMAND wkclt ARGTEST ---------- { T_CMD_BEG, "ARGTEST", 0,0,0 }, diff --git a/project/src/ui/tab-wkmpt.inc b/project/src/ui/tab-wkmpt.inc index 686b547..8fce206 100644 --- a/project/src/ui/tab-wkmpt.inc +++ b/project/src/ui/tab-wkmpt.inc @@ -59,6 +59,10 @@ "wkmpt HELP [--width=wd] [ignored]...", 0 /* copy of wszst */ }, + { T_DEF_CMD, "CONFIG", "CONFIG", + "wkmpt CONFIG [options]...", + CONFIG_CMD }, + { T_DEF_CMD, "ARGTEST", "ARGTEST", "wkmpt ARGTEST ...", 0 /* copy of wszst */ }, @@ -245,6 +249,9 @@ { T_OPT_S, "XHELP", "xhelp", 0, 0 /* copy of wszst */ }, + { T_OPT_GP, "CONFIG", "config", + 0, 0 /* copy of wszst */ }, + { T_OPT_G, "ALLOW_ALL", "allow-all|allowall", 0, 0 /* copy of wszst */ }, @@ -664,6 +671,14 @@ { T_COPT, "MAX_WIDTH", 0,0,0 }, { T_ALL_OPT, 0, 0,0,0 }, + //---------- COMMAND wkmpt CONFIG ---------- + + { T_CMD_BEG, "CONFIG", 0,0,0 }, + + { T_COPT, "CONFIG", 0,0,0 }, + { T_COPT, "LONG", 0,0, + "If set, print the search list too." }, + //---------- COMMAND wkmpt ARGTEST ---------- { T_CMD_BEG, "ARGTEST", 0,0,0 }, diff --git a/project/src/ui/tab-wlect.inc b/project/src/ui/tab-wlect.inc index e107ced..ae427ea 100644 --- a/project/src/ui/tab-wlect.inc +++ b/project/src/ui/tab-wlect.inc @@ -59,6 +59,10 @@ "wlect HELP [--width=wd] [ignored]...", 0 /* copy of wszst */ }, + { T_DEF_CMD, "CONFIG", "CONFIG", + "wlect CONFIG [options]...", + CONFIG_CMD }, + { T_DEF_CMD, "ARGTEST", "ARGTEST", "wlect ARGTEST ...", 0 /* copy of wszst */ }, @@ -108,6 +112,10 @@ "This hidden command exports some definitions to standard output." " Use keyword @HELP@ to get a list of possible keywords." }, + { H_DEF_CMD, "DPAD", "_DPAD", + "wszst DPAD number_or_code...", + "This hidden command decodes and encodes D-Pad suquences for LE-CODE." }, + { T_SEP_CMD, 0,0,0,0 }, //----- separator ----- { T_DEF_CMD, "DUMP", "DUMP|D", @@ -197,6 +205,9 @@ { T_OPT_S, "XHELP", "xhelp", 0, 0 /* copy of wszst */ }, + { T_OPT_GP, "CONFIG", "config", + 0, 0 /* copy of wszst */ }, + { T_OPT_G, "ALLOW_ALL", "allow-all|allowall", 0, 0 /* copy of wszst */ }, @@ -470,24 +481,14 @@ "[=mode]", "Enable or disable the speedometer." " Mode is one of @OFF@, @AUTO@ (default, don't change setting)," - " @ON@ (enable it for Wii and WiiU only;" - " default, if option is used without parameter)" - " or @FORCE@ (enable it for Wii, Wii U and for Dolphin)." }, - - { H_OPT_CP, "RESERVED_1B9", "reserved-1b9|reserved1b9", - "[=mode]", - "Set LPAR byte at offset 0x1b9 to this value." - " Value -1 disables this option." }, - - { H_OPT_CP, "RESERVED_1BA", "reserved-1ba|reserved1ba", - "[=mode]", - "Set LPAR byte at offset 0x1ba to this value." - " Value -1 disables this option." }, + " @ON@ (default, if option is used without parameter)" + " or @FRACTION@ (=@1DIGIT@), @2DIGITS@ and @3DIGITS@." }, - { H_OPT_CP, "RESERVED_1BB", "reserved-1bb|reserved1bb", - "[=mode]", - "Set LPAR byte at offset 0x1bb to this value." - " Value -1 disables this option." }, + { T_OPT_CP, "DEBUG", "debug", + "mode", + "Enable or disable the debug output while racing." + " Mode is one of @OFF@, @AUTO@ (default, don't change setting)," + " @USER@ or @100@ to @199@ for predefined setups." }, { T_SEP_OPT, 0,0,0,0 }, //----- separator ----- @@ -629,9 +630,7 @@ { T_COPT, "CUSTOM_TT", 0,0,0 }, { T_COPT, "XPFLAGS", 0,0,0 }, { T_COPT, "SPEEDOMETER", 0,0,0 }, - { H_COPT, "RESERVED_1B9", 0,0,0 }, - { H_COPT, "RESERVED_1BA", 0,0,0 }, - { H_COPT, "RESERVED_1BB", 0,0,0 }, + { T_COPT, "DEBUG", 0,0,0 }, //---------- wlect GROUP PATCH ---------- @@ -701,6 +700,14 @@ { T_COPT, "MAX_WIDTH", 0,0,0 }, { T_ALL_OPT, 0, 0,0,0 }, + //---------- COMMAND wlect CONFIG ---------- + + { T_CMD_BEG, "CONFIG", 0,0,0 }, + + { T_COPT, "CONFIG", 0,0,0 }, + { T_COPT, "LONG", 0,0, + "If set, print the search list too." }, + //---------- COMMAND wlect ARGTEST ---------- { T_CMD_BEG, "ARGTEST", 0,0,0 }, @@ -781,6 +788,10 @@ { T_CMD_BEG, "EXPORT", 0,0,0 }, + //---------- COMMAND wlect _DPAD ---------- + + { T_CMD_BEG, "DPAD", 0,0,0 }, + //---------- COMMAND wlect DUMP ---------- { T_CMD_BEG, "DUMP", 0,0,0 }, diff --git a/project/src/ui/tab-wmdlt.inc b/project/src/ui/tab-wmdlt.inc index d68652a..d95afd1 100644 --- a/project/src/ui/tab-wmdlt.inc +++ b/project/src/ui/tab-wmdlt.inc @@ -59,6 +59,10 @@ "wmdlt HELP [--width=wd] [ignored]...", 0 /* copy of wszst */ }, + { T_DEF_CMD, "CONFIG", "CONFIG", + "wmdlt CONFIG [options]...", + CONFIG_CMD }, + { T_DEF_CMD, "ARGTEST", "ARGTEST", "wmdlt ARGTEST ...", 0 /* copy of wszst */ }, @@ -171,6 +175,9 @@ { T_OPT_S, "XHELP", "xhelp", 0, 0 /* copy of wszst */ }, + { T_OPT_GP, "CONFIG", "config", + 0, 0 /* copy of wszst */ }, + { T_OPT_G, "ALLOW_ALL", "allow-all|allowall", 0, 0 /* copy of wszst */ }, @@ -436,6 +443,14 @@ { T_COPT, "MAX_WIDTH", 0,0,0 }, { T_ALL_OPT, 0, 0,0,0 }, + //---------- COMMAND wmdlt CONFIG ---------- + + { T_CMD_BEG, "CONFIG", 0,0,0 }, + + { T_COPT, "CONFIG", 0,0,0 }, + { T_COPT, "LONG", 0,0, + "If set, print the search list too." }, + //---------- COMMAND wmdlt ARGTEST ---------- { T_CMD_BEG, "ARGTEST", 0,0,0 }, diff --git a/project/src/ui/tab-wpatt.inc b/project/src/ui/tab-wpatt.inc index fc86f58..e8b2693 100644 --- a/project/src/ui/tab-wpatt.inc +++ b/project/src/ui/tab-wpatt.inc @@ -59,6 +59,10 @@ "wpatt HELP [--width=wd] [ignored]...", 0 /* copy of wszst */ }, + { T_DEF_CMD, "CONFIG", "CONFIG", + "wpatt CONFIG [options]...", + CONFIG_CMD }, + { T_DEF_CMD, "ARGTEST", "ARGTEST", "wpatt ARGTEST ...", 0 /* copy of wszst */ }, @@ -139,6 +143,9 @@ { T_OPT_S, "XHELP", "xhelp", 0, 0 /* copy of wszst */ }, + { T_OPT_GP, "CONFIG", "config", + 0, 0 /* copy of wszst */ }, + { T_OPT_G, "ALLOW_ALL", "allow-all|allowall", 0, 0 /* copy of wszst */ }, @@ -334,6 +341,14 @@ { T_COPT, "MAX_WIDTH", 0,0,0 }, { T_ALL_OPT, 0, 0,0,0 }, + //---------- COMMAND wpatt CONFIG ---------- + + { T_CMD_BEG, "CONFIG", 0,0,0 }, + + { T_COPT, "CONFIG", 0,0,0 }, + { T_COPT, "LONG", 0,0, + "If set, print the search list too." }, + //---------- COMMAND wpatt ARGTEST ---------- { T_CMD_BEG, "ARGTEST", 0,0,0 }, diff --git a/project/src/ui/tab-wstrt.inc b/project/src/ui/tab-wstrt.inc index 19ecfa3..291c635 100644 --- a/project/src/ui/tab-wstrt.inc +++ b/project/src/ui/tab-wstrt.inc @@ -60,6 +60,10 @@ "wstrt HELP [--width=wd] [ignored]...", 0 /* copy of wszst */ }, + { T_DEF_CMD, "CONFIG", "CONFIG", + "wstrt CONFIG [options]...", + CONFIG_CMD }, + { T_DEF_CMD, "ARGTEST", "ARGTEST", "wstrt ARGTEST ...", 0 /* copy of wszst */ }, @@ -179,6 +183,9 @@ { T_OPT_S, "XHELP", "xhelp", 0, 0 /* copy of wszst */ }, + { T_OPT_GP, "CONFIG", "config", + 0, 0 /* copy of wszst */ }, + { H_OPT_G, "AT_DUMMY", "@|@", 0, "" }, { T_OPT_G, "ALLOW_ALL", "allow-all|allowall", @@ -860,6 +867,14 @@ { T_COPT, "MAX_WIDTH", 0,0,0 }, { T_ALL_OPT, 0, 0,0,0 }, + //---------- COMMAND wstrt CONFIG ---------- + + { T_CMD_BEG, "CONFIG", 0,0,0 }, + + { T_COPT, "CONFIG", 0,0,0 }, + { T_COPT, "LONG", 0,0, + "If set, print the search list too." }, + //---------- COMMAND wstrt ARGTEST ---------- { T_CMD_BEG, "ARGTEST", 0,0,0 }, diff --git a/project/src/ui/tab-wszst.inc b/project/src/ui/tab-wszst.inc index e9e511c..c36da8c 100644 --- a/project/src/ui/tab-wszst.inc +++ b/project/src/ui/tab-wszst.inc @@ -44,7 +44,8 @@ "wszst [option]... command [option|parameter|@file]...", WSZST_LONG " :" " List, compare, (de-)compress, extract and create" - " " ARCHIVES_AND " archives." + " " CARCHIVES_AND " archives." + " Additonally, RARC archive can be extracted." " It is also a wrapper to all other tools." }, // @@ -74,6 +75,12 @@ " The fourth variant prints an overview about all commands" " and all global options." }, + { T_DEF_CMD, "CONFIG", "CONFIG", + "wszst CONFIG [options]...", + CONFIG_CMD + " The command can also export the settings for scripts" + " or can create or update configuration files." }, + { T_DEF_CMD, "ARGTEST", "ARGTEST", "wszst ARGTEST ...", "This debug command accepts all kinds of parameters" @@ -488,7 +495,7 @@ { T_DEF_CMD, "CREATE", "CREATE|C", "wszst CREATE [source_dir]...", - "Create " ARCHIVES_OR " archives by adding all not hidden files" + "Create " CARCHIVES_OR " archives by adding all not hidden files" " of the directory structure." " Create and/or encode sub files if necessary." " The default destination is @'%P/%N%T'@." }, @@ -598,7 +605,7 @@ { T_DEF_CMD, "YAZDUMP", "YAZDUMP|YD", "wszst YAZDUMP [szs]...", - "Analyze YAZ compression print a dump to stdout." + "Analyze YAZ compression and print a dump to stdout." " Ignore files without YAZ compression." }, { T_SEP_CMD, 0,0,0,0 }, //----- separator ----- @@ -623,6 +630,15 @@ "Stop parsing the command line and print a help message" " with all commands included. Exit after printing." }, + { T_OPT_GP, "CONFIG", "config", + "file", + "Define a configuration file or a directory as source." + " In later case, file @'" CONFIG_FILE "'@ is searched." + "\n " + " If option is not not set," + " then file @'" CONFIG_FILE "'@ is searched in different directories." + " Use command @'wszst CONFIG'@ to get more details." }, + { T_OPT_G, "ALLOW_ALL", "allow-all|allowall", 0, "Usually commands accept only options with impact to the command." @@ -1696,7 +1712,7 @@ "Define an alternative directory as autoadd library." " The default is, that the sub-directory called './auto-add/'" " of all search paths are used." - " Use {wszst test -vvvv} for tests." }, + " Use {wszst config -ll} for tests." }, { T_SEP_OPT, 0,0,0,0 }, //----- separator ----- @@ -1836,7 +1852,7 @@ { T_OPT_GP, "VAR", "var", "varname", "Use @VARNAME@ as variable name or prefix on script output." - " The default variabe name is 'res'." }, + " The default value is 'res' for variables and 'res_' as prefix." }, { T_OPT_G, "ARRAY", "array", 0, @@ -1874,6 +1890,10 @@ " a second condition. In this case the feature is excluded" " from printing if *any* set keywords match." }, + { T_OPT_C, "INSTALL", "install", + 0, + "Manage configuration for an installation." }, + { T_SEP_OPT, 0,0,0,0 }, //----- separator ----- { H_OPT_CP, "ANALYZE", "analyze|analyse", @@ -2431,6 +2451,9 @@ { T_GRP_BEG, "SCRIPT", 0,0,0 }, + { T_COPT, "SECTIONS", 0,0, + "Dump info using configuration or section syntax." + " Use {--var name} as prefix." }, { T_COPT, "SH", 0,0,0 }, { T_COPT, "BASH", 0,0,0 }, { T_COPT, "JSON", 0,0,0 }, @@ -2577,6 +2600,22 @@ { T_COPT, "MAX_WIDTH", 0,0,0 }, { T_ALL_OPT, 0, 0,0,0 }, + //---------- COMMAND wszst CONFIG ---------- + + { T_CMD_BEG, "CONFIG", 0,0,0 }, + + { T_COPT, "CONFIG", 0,0,0 }, + { T_COPT, "INSTALL", 0,0,0 }, + { T_COPT, "AUTOADD_PATH", 0,0,0 }, + { T_COPT, "LONG", 0,0, + "If set, print the search list too." + " If set twice, print the auto-add search list too." + " This option is ignored, if any script output is enabled." }, + { T_SEP_OPT, 0,0,0,0 }, + { T_COPY_GRP, "SCRIPT", 0,0,0 }, + { T_COPT, "BRIEF", 0,0, + "If printed as sections, exclude all comments." }, + //---------- COMMAND wszst ARGTEST ---------- { T_CMD_BEG, "ARGTEST", 0,0,0 }, diff --git a/project/src/ui/ui-wbmgt.c b/project/src/ui/ui-wbmgt.c index 598864e..1ab1049 100644 --- a/project/src/ui/ui-wbmgt.c +++ b/project/src/ui/ui-wbmgt.c @@ -313,6 +313,15 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " commands included. Exit after printing." }, + { OPT_CONFIG, false, false, false, false, false, 0, "config", + "file", + "Define a configuration file or a directory as source. In later case," + " file 'wiimms-szs-tools.conf' is searched.\n" + " If option is not not set, then file 'wiimms-szs-tools.conf' is" + " searched in different directories. Use command 'wszst CONFIG' to get" + " more details." + }, + { OPT_ALLOW_ALL, false, false, false, false, false, 0, "allow-all", 0, "Usually commands accept only options with impact to the command. All" @@ -522,7 +531,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 == 62 + {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 63 }; @@ -544,6 +553,12 @@ static const InfoOption_t option_cmd_VERSION_LONG = "Print in long format. Ignored if option --sections is set." }; +static const InfoOption_t option_cmd_CONFIG_LONG = + { OPT_LONG, false, false, false, false, false, 'l', "long", + 0, + "If set, print the search list too." + }; + static const InfoOption_t option_cmd_COLORS_LONG = { OPT_LONG, false, false, false, false, false, 'l', "long", 0, @@ -607,6 +622,7 @@ static const KeywordTab_t CommandTab[] = { CMD_VERSION, "VERSION", 0, 0 }, { CMD_HELP, "HELP", "H", 0 }, { CMD_HELP, "?", 0, 0 }, + { CMD_CONFIG, "CONFIG", 0, 0 }, { CMD_ARGTEST, "ARGTEST", 0, 0 }, { CMD_TEST, "TEST", 0, 0 }, { CMD_COLORS, "COLORS", 0, 0 }, @@ -644,6 +660,7 @@ static const struct option OptionLong[] = { "version", 0, 0, 'V' }, { "help", 0, 0, 'h' }, { "xhelp", 0, 0, GO_XHELP }, + { "config", 1, 0, GO_CONFIG }, { "allow-all", 0, 0, GO_ALLOW_ALL }, { "allowall", 0, 0, GO_ALLOW_ALL }, { "compatible", 1, 0, GO_COMPATIBLE }, @@ -800,43 +817,44 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x076 v */ OPT_VERBOSE, /* 0x077 */ 0,0,0,0, 0,0,0,0, 0, /* 0x080 */ OPT_XHELP, - /* 0x081 */ OPT_ALLOW_ALL, - /* 0x082 */ OPT_COMPATIBLE, - /* 0x083 */ OPT_WIDTH, - /* 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, + /* 0x081 */ OPT_CONFIG, + /* 0x082 */ OPT_ALLOW_ALL, + /* 0x083 */ OPT_COMPATIBLE, + /* 0x084 */ OPT_WIDTH, + /* 0x085 */ OPT_MAX_WIDTH, + /* 0x086 */ OPT_DE, + /* 0x087 */ OPT_COLORS, + /* 0x088 */ OPT_NO_COLORS, + /* 0x089 */ OPT_CT_CODE, + /* 0x08a */ OPT_LE_CODE, + /* 0x08b */ OPT_CHDIR, + /* 0x08c */ OPT_POINTS, + /* 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_ALIGN, + /* 0x097 */ OPT_MACRO_BMG, + /* 0x098 */ OPT_FILTER_BMG, + /* 0x099 */ OPT_BMG_ENDIAN, + /* 0x09a */ OPT_BMG_ENCODING, + /* 0x09b */ OPT_BMG_INF_SIZE, + /* 0x09c */ OPT_BMG_MID, + /* 0x09d */ OPT_FORCE_ATTRIB, + /* 0x09e */ OPT_DEF_ATTRIB, + /* 0x09f */ OPT_NO_ATTRIB, + /* 0x0a0 */ OPT_X_ESCAPES, + /* 0x0a1 */ OPT_OLD_ESCAPES, + /* 0x0a2 */ OPT_NO_BMG_COLORS, + /* 0x0a3 */ OPT_BMG_COLORS, + /* 0x0a4 */ OPT_NO_BMG_INLINE, + /* 0x0a5 */ OPT_SECTIONS, + /* 0x0a6 */ 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, @@ -865,115 +883,121 @@ static u8 option_allowed_cmd_HELP[32] = // cmd #2 1,1 }; -static u8 option_allowed_cmd_ARGTEST[32] = // cmd #3 +static u8 option_allowed_cmd_CONFIG[32] = // cmd #3 +{ + 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 +}; + +static u8 option_allowed_cmd_ARGTEST[32] = // 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 }; -static u8 option_allowed_cmd_TEST[32] = // cmd #4 +static u8 option_allowed_cmd_TEST[32] = // cmd #5 { 1,1,1,1,1, 1,1,1,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[32] = // cmd #5 +static u8 option_allowed_cmd_COLORS[32] = // cmd #6 { 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 }; -static u8 option_allowed_cmd_ERROR[32] = // cmd #6 +static u8 option_allowed_cmd_ERROR[32] = // cmd #7 { 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,1 }; -static u8 option_allowed_cmd_FILETYPE[32] = // cmd #7 +static u8 option_allowed_cmd_FILETYPE[32] = // cmd #8 { 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, 0,0,0,0,0, 0,0 }; -static u8 option_allowed_cmd_FILEATTRIB[32] = // cmd #8 +static u8 option_allowed_cmd_FILEATTRIB[32] = // cmd #9 { 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 }; -static u8 option_allowed_cmd_POINTS[32] = // cmd #9 +static u8 option_allowed_cmd_POINTS[32] = // cmd #10 { 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 }; -static u8 option_allowed_cmd_REGEXP[32] = // cmd #10 +static u8 option_allowed_cmd_REGEXP[32] = // 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 }; -static u8 option_allowed_cmd_EXTRACT[32] = // cmd #11 +static u8 option_allowed_cmd_EXTRACT[32] = // cmd #12 { 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 }; -static u8 option_allowed_cmd_SECTIONS[32] = // cmd #12 +static u8 option_allowed_cmd_SECTIONS[32] = // cmd #13 { 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 }; -static u8 option_allowed_cmd_LIST[32] = // cmd #13 +static u8 option_allowed_cmd_LIST[32] = // cmd #14 { 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0 }; -static u8 option_allowed_cmd_SLOTS[32] = // cmd #14 +static u8 option_allowed_cmd_SLOTS[32] = // cmd #15 { 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0 }; -static u8 option_allowed_cmd_DIFF[32] = // cmd #15 +static u8 option_allowed_cmd_DIFF[32] = // cmd #16 { 0,0,0,0,1, 0,1,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 }; -static u8 option_allowed_cmd_CAT[32] = // cmd #16 +static u8 option_allowed_cmd_CAT[32] = // cmd #17 { 0,1,1,1,0, 0,0,0,0,0, 0,0,1,0,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0 }; -static u8 option_allowed_cmd_MIX[32] = // cmd #17 +static u8 option_allowed_cmd_MIX[32] = // cmd #18 { 0,1,1,1,0, 0,0,0,0,0, 0,0,1,0,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0 }; -static u8 option_allowed_cmd_IDENTIFIER[32] = // cmd #18 +static u8 option_allowed_cmd_IDENTIFIER[32] = // cmd #19 { 0,1,1,1,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,0 }; -static u8 option_allowed_cmd_DECODE[32] = // cmd #19 +static u8 option_allowed_cmd_DECODE[32] = // cmd #20 { 0,1,1,1,1, 1,1,1,1,1, 1,1,1,0,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0 }; -static u8 option_allowed_cmd_ENCODE[32] = // cmd #20 +static u8 option_allowed_cmd_ENCODE[32] = // cmd #21 { 0,0,0,0,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 }; -static u8 option_allowed_cmd_PATCH[32] = // cmd #21 +static u8 option_allowed_cmd_PATCH[32] = // cmd #22 { 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,1, 1,0 @@ -990,6 +1014,7 @@ static const InfoOption_t * option_tab_tool[] = OptionInfo + OPT_VERSION, OptionInfo + OPT_HELP, OptionInfo + OPT_XHELP, + OptionInfo + OPT_CONFIG, OptionInfo + OPT_ALLOW_ALL, OptionInfo + OPT_COMPATIBLE, OptionInfo + OPT_WIDTH, @@ -1035,6 +1060,14 @@ static const InfoOption_t * option_tab_cmd_HELP[] = 0 }; +static const InfoOption_t * option_tab_cmd_CONFIG[] = +{ + OptionInfo + OPT_CONFIG, + &option_cmd_CONFIG_LONG, + + 0 +}; + static const InfoOption_t * option_tab_cmd_ARGTEST[] = { @@ -1369,7 +1402,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, - 24, + 25, option_tab_tool, 0 }, @@ -1412,6 +1445,21 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = option_allowed_cmd_HELP }, + { CMD_CONFIG, + false, + false, + false, + "CONFIG", + 0, + "wbmgt CONFIG [options]...", + "Show all information about the search for the configuration file and" + " its content.", + 0, + 2, + option_tab_cmd_CONFIG, + option_allowed_cmd_CONFIG + }, + { CMD_ARGTEST, false, false, diff --git a/project/src/ui/ui-wbmgt.h b/project/src/ui/ui-wbmgt.h index 722ed02..f828bab 100644 --- a/project/src/ui/ui-wbmgt.h +++ b/project/src/ui/ui-wbmgt.h @@ -95,6 +95,7 @@ typedef enum enumOptions OPT_VERSION, OPT_HELP, OPT_XHELP, + OPT_CONFIG, OPT_ALLOW_ALL, OPT_COMPATIBLE, OPT_WIDTH, @@ -123,7 +124,7 @@ typedef enum enumOptions OPT_NEW, OPT_EXTRACT, - OPT__N_TOTAL // == 62 + OPT__N_TOTAL // == 63 } enumOptions; @@ -205,6 +206,8 @@ typedef enum enumOptions // // OB_CMD_HELP = ~(u64)0, // +// OB_CMD_CONFIG = OB_LONG, +// // OB_CMD_ARGTEST = ~(u64)0, // // OB_CMD_TEST = ~(u64)0, @@ -297,6 +300,7 @@ typedef enum enumCommands CMD_VERSION, CMD_HELP, + CMD_CONFIG, CMD_ARGTEST, CMD_TEST, CMD_COLORS, @@ -320,7 +324,7 @@ typedef enum enumCommands CMD_PATCH, - CMD__N // == 22 + CMD__N // == 23 } enumCommands; @@ -361,6 +365,7 @@ typedef enum enumGetOpt GO_VERBOSE = 'v', GO_XHELP = 0x80, + GO_CONFIG, GO_ALLOW_ALL, GO_COMPATIBLE, GO_WIDTH, diff --git a/project/src/ui/ui-wctct.c b/project/src/ui/ui-wctct.c index 8569f2c..2edbaab 100644 --- a/project/src/ui/ui-wctct.c +++ b/project/src/ui/ui-wctct.c @@ -413,6 +413,15 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " commands included. Exit after printing." }, + { OPT_CONFIG, false, false, false, false, false, 0, "config", + "file", + "Define a configuration file or a directory as source. In later case," + " file 'wiimms-szs-tools.conf' is searched.\n" + " If option is not not set, then file 'wiimms-szs-tools.conf' is" + " searched in different directories. Use command 'wszst CONFIG' to get" + " more details." + }, + { OPT_ALLOW_ALL, false, false, false, false, false, 0, "allow-all", 0, "Usually commands accept only options with impact to the command. All" @@ -653,7 +662,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 == 81 + {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 82 }; @@ -681,6 +690,12 @@ static const InfoOption_t option_cmd_VERSION_LONG = "Print in long format. Ignored if option --sections is set." }; +static const InfoOption_t option_cmd_CONFIG_LONG = + { OPT_LONG, false, false, false, false, false, 'l', "long", + 0, + "If set, print the search list too." + }; + static const InfoOption_t option_cmd_COLORS_LONG = { OPT_LONG, false, false, false, false, false, 'l', "long", 0, @@ -800,6 +815,7 @@ static const KeywordTab_t CommandTab[] = { CMD_VERSION, "VERSION", 0, 0 }, { CMD_HELP, "HELP", "H", 0 }, { CMD_HELP, "?", 0, 0 }, + { CMD_CONFIG, "CONFIG", 0, 0 }, { CMD_ARGTEST, "ARGTEST", 0, 0 }, { CMD_TEST, "TEST", 0, 0 }, { CMD_COLORS, "COLORS", 0, 0 }, @@ -835,6 +851,7 @@ static const struct option OptionLong[] = { "version", 0, 0, 'V' }, { "help", 0, 0, 'h' }, { "xhelp", 0, 0, GO_XHELP }, + { "config", 1, 0, GO_CONFIG }, { "allow-all", 0, 0, GO_ALLOW_ALL }, { "allowall", 0, 0, GO_ALLOW_ALL }, { "compatible", 1, 0, GO_COMPATIBLE }, @@ -1018,61 +1035,62 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x076 v */ OPT_VERBOSE, /* 0x077 */ 0,0,0,0, 0,0,0,0, 0, /* 0x080 */ OPT_XHELP, - /* 0x081 */ OPT_ALLOW_ALL, - /* 0x082 */ OPT_COMPATIBLE, - /* 0x083 */ OPT_WIDTH, - /* 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, + /* 0x081 */ OPT_CONFIG, + /* 0x082 */ OPT_ALLOW_ALL, + /* 0x083 */ OPT_COMPATIBLE, + /* 0x084 */ OPT_WIDTH, + /* 0x085 */ OPT_MAX_WIDTH, + /* 0x086 */ OPT_DE, + /* 0x087 */ OPT_COLORS, + /* 0x088 */ OPT_NO_COLORS, + /* 0x089 */ OPT_CT_CODE, + /* 0x08a */ OPT_LE_CODE, + /* 0x08b */ OPT_OLD_SPINY, + /* 0x08c */ OPT_CRS1, + /* 0x08d */ OPT_CHDIR, + /* 0x08e */ OPT_ROUND, + /* 0x08f */ OPT_RAW, + /* 0x090 */ OPT_BMG_ENDIAN, + /* 0x091 */ OPT_BMG_ENCODING, + /* 0x092 */ OPT_BMG_INF_SIZE, + /* 0x093 */ OPT_BMG_MID, + /* 0x094 */ OPT_FORCE_ATTRIB, + /* 0x095 */ OPT_DEF_ATTRIB, + /* 0x096 */ OPT_NO_ATTRIB, + /* 0x097 */ OPT_X_ESCAPES, + /* 0x098 */ OPT_OLD_ESCAPES, + /* 0x099 */ OPT_NO_BMG_COLORS, + /* 0x09a */ OPT_BMG_COLORS, + /* 0x09b */ OPT_NO_BMG_INLINE, + /* 0x09c */ OPT_NO_ECHO, + /* 0x09d */ OPT_UTF_8, + /* 0x09e */ OPT_NO_UTF_8, + /* 0x09f */ OPT_FORCE, + /* 0x0a0 */ OPT_REPAIR_MAGICS, + /* 0x0a1 */ OPT_OLD, + /* 0x0a2 */ OPT_STD, + /* 0x0a3 */ OPT_NEW, + /* 0x0a4 */ OPT_EXTRACT, + /* 0x0a5 */ OPT_LIST, + /* 0x0a6 */ OPT_REF, + /* 0x0a7 */ OPT_FULL, + /* 0x0a8 */ OPT_HEX, + /* 0x0a9 */ OPT_CT_DIR, + /* 0x0aa */ OPT_CT_LOG, + /* 0x0ab */ OPT_ALLOW_SLOTS, + /* 0x0ac */ OPT_IMAGES, + /* 0x0ad */ OPT_LOAD_BMG, + /* 0x0ae */ OPT_PATCH_BMG, + /* 0x0af */ OPT_MACRO_BMG, + /* 0x0b0 */ OPT_FILTER_BMG, + /* 0x0b1 */ OPT_PATCH_NAMES, + /* 0x0b2 */ OPT_ORDER_BY, + /* 0x0b3 */ OPT_ORDER_ALL, + /* 0x0b4 */ OPT_DYNAMIC, + /* 0x0b5 */ OPT_WRITE_TRACKS, + /* 0x0b6 */ OPT_NUMBER, + /* 0x0b7 */ OPT_SECTIONS, + /* 0x0b8 */ 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, @@ -1100,115 +1118,121 @@ static u8 option_allowed_cmd_HELP[47] = // cmd #2 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1 }; -static u8 option_allowed_cmd_ARGTEST[47] = // cmd #3 +static u8 option_allowed_cmd_CONFIG[47] = // cmd #3 +{ + 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 +}; + +static u8 option_allowed_cmd_ARGTEST[47] = // 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 }; -static u8 option_allowed_cmd_TEST[47] = // cmd #4 +static u8 option_allowed_cmd_TEST[47] = // cmd #5 { 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,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[47] = // cmd #5 +static u8 option_allowed_cmd_COLORS[47] = // cmd #6 { 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 }; -static u8 option_allowed_cmd_ERROR[47] = // cmd #6 +static u8 option_allowed_cmd_ERROR[47] = // cmd #7 { 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,1 }; -static u8 option_allowed_cmd_FILETYPE[47] = // cmd #7 +static u8 option_allowed_cmd_FILETYPE[47] = // cmd #8 { 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, 1,0 }; -static u8 option_allowed_cmd_FILEATTRIB[47] = // cmd #8 +static u8 option_allowed_cmd_FILEATTRIB[47] = // cmd #9 { 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 }; -static u8 option_allowed_cmd_SYMBOLS[47] = // cmd #9 +static u8 option_allowed_cmd_SYMBOLS[47] = // cmd #10 { 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 }; -static u8 option_allowed_cmd_FUNCTIONS[47] = // cmd #10 +static u8 option_allowed_cmd_FUNCTIONS[47] = // cmd #11 { 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 }; -static u8 option_allowed_cmd_CALCULATE[47] = // cmd #11 +static u8 option_allowed_cmd_CALCULATE[47] = // 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 }; -static u8 option_allowed_cmd_FLOAT[47] = // cmd #12 +static u8 option_allowed_cmd_FLOAT[47] = // cmd #13 { 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 }; -static u8 option_allowed_cmd_EXPORT[47] = // cmd #13 +static u8 option_allowed_cmd_EXPORT[47] = // 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,0 }; -static u8 option_allowed_cmd_RAWDUMP[47] = // cmd #14 +static u8 option_allowed_cmd_RAWDUMP[47] = // 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,1,1,0, 0,0,0,0,0, 0,0 }; -static u8 option_allowed_cmd_DUMP[47] = // cmd #15 +static u8 option_allowed_cmd_DUMP[47] = // cmd #16 { 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,1,1, 1,1,1,1,1, 0,0,0,0,0, 0,0,0,0,0, 0,0 }; -static u8 option_allowed_cmd_CAT[47] = // cmd #16 +static u8 option_allowed_cmd_CAT[47] = // cmd #17 { 0,0,0,1,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 0,1,1,1,1, 1,1,0,1,1, 1,1,1,1,1, 0,1,0,0,0, 0,0,0,0,0, 1,0 }; -static u8 option_allowed_cmd_BMG[47] = // cmd #17 +static u8 option_allowed_cmd_BMG[47] = // cmd #18 { 0,0,1,1,1, 0,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,1,1,1,1, 1,1,0,1,1, 1,1,1,1,1, 0,1,0,0,0, 0,0,0,0,0, 1,0 }; -static u8 option_allowed_cmd_TRACKS[47] = // cmd #18 +static u8 option_allowed_cmd_TRACKS[47] = // cmd #19 { 0,0,1,1,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 0,1,1,1,1, 1,1,0,1,1, 1,1,1,1,1, 0,1,0,0,0, 0,0,0,0,0, 1,0 }; -static u8 option_allowed_cmd_DECODE[47] = // cmd #19 +static u8 option_allowed_cmd_DECODE[47] = // cmd #20 { 0,0,0,1,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 0,1,1,1,1, 1,1,0,1,1, 1,1,1,1,1, 0,1,1,1,1, 1,1,1,1,1, 1,0 }; -static u8 option_allowed_cmd_CREATE[47] = // cmd #20 +static u8 option_allowed_cmd_CREATE[47] = // cmd #21 { 0,0,1,1,1, 0,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,1,1,0,0, 0,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0 }; -static u8 option_allowed_cmd_PATCH[47] = // cmd #21 +static u8 option_allowed_cmd_PATCH[47] = // cmd #22 { 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,1,1, 1,1,1,1,1, 0,1,1,1,1, 1,1,1,1,1, 1,0 @@ -1225,6 +1249,7 @@ static const InfoOption_t * option_tab_tool[] = OptionInfo + OPT_VERSION, OptionInfo + OPT_HELP, OptionInfo + OPT_XHELP, + OptionInfo + OPT_CONFIG, OptionInfo + OPT_ALLOW_ALL, OptionInfo + OPT_COMPATIBLE, OptionInfo + OPT_WIDTH, @@ -1275,6 +1300,14 @@ static const InfoOption_t * option_tab_cmd_HELP[] = 0 }; +static const InfoOption_t * option_tab_cmd_CONFIG[] = +{ + OptionInfo + OPT_CONFIG, + &option_cmd_CONFIG_LONG, + + 0 +}; + static const InfoOption_t * option_tab_cmd_ARGTEST[] = { @@ -1601,7 +1634,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, - 26, + 27, option_tab_tool, 0 }, @@ -1644,6 +1677,21 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = option_allowed_cmd_HELP }, + { CMD_CONFIG, + false, + false, + false, + "CONFIG", + 0, + "wctct CONFIG [options]...", + "Show all information about the search for the configuration file and" + " its content.", + 0, + 2, + option_tab_cmd_CONFIG, + option_allowed_cmd_CONFIG + }, + { CMD_ARGTEST, false, false, diff --git a/project/src/ui/ui-wctct.h b/project/src/ui/ui-wctct.h index cfe351a..624b94a 100644 --- a/project/src/ui/ui-wctct.h +++ b/project/src/ui/ui-wctct.h @@ -110,6 +110,7 @@ typedef enum enumOptions OPT_VERSION, OPT_HELP, OPT_XHELP, + OPT_CONFIG, OPT_ALLOW_ALL, OPT_COMPATIBLE, OPT_WIDTH, @@ -142,7 +143,7 @@ typedef enum enumOptions OPT_CT_LOG, OPT_ALLOW_SLOTS, - OPT__N_TOTAL // == 81 + OPT__N_TOTAL // == 82 } enumOptions; @@ -241,6 +242,8 @@ typedef enum enumOptions // // OB_CMD_HELP = ~(u64)0, // +// OB_CMD_CONFIG = OB_LONG, +// // OB_CMD_ARGTEST = ~(u64)0, // // OB_CMD_TEST = ~(u64)0, @@ -367,6 +370,7 @@ typedef enum enumCommands CMD_VERSION, CMD_HELP, + CMD_CONFIG, CMD_ARGTEST, CMD_TEST, CMD_COLORS, @@ -389,7 +393,7 @@ typedef enum enumCommands CMD_PATCH, - CMD__N // == 22 + CMD__N // == 23 } enumCommands; @@ -431,6 +435,7 @@ typedef enum enumGetOpt GO_VERBOSE = 'v', GO_XHELP = 0x80, + GO_CONFIG, GO_ALLOW_ALL, GO_COMPATIBLE, GO_WIDTH, diff --git a/project/src/ui/ui-wimgt.c b/project/src/ui/ui-wimgt.c index 0fae748..b2742d6 100644 --- a/project/src/ui/ui-wimgt.c +++ b/project/src/ui/ui-wimgt.c @@ -276,6 +276,15 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " commands included. Exit after printing." }, + { OPT_CONFIG, false, false, false, false, false, 0, "config", + "file", + "Define a configuration file or a directory as source. In later case," + " file 'wiimms-szs-tools.conf' is searched.\n" + " If option is not not set, then file 'wiimms-szs-tools.conf' is" + " searched in different directories. Use command 'wszst CONFIG' to get" + " more details." + }, + { OPT_ALLOW_ALL, false, false, false, false, false, 0, "allow-all", 0, "Usually commands accept only options with impact to the command. All" @@ -473,7 +482,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 == 55 + {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 56 }; @@ -495,6 +504,12 @@ static const InfoOption_t option_cmd_VERSION_LONG = "Print in long format. Ignored if option --sections is set." }; +static const InfoOption_t option_cmd_CONFIG_LONG = + { OPT_LONG, false, false, false, false, false, 'l', "long", + 0, + "If set, print the search list too." + }; + static const InfoOption_t option_cmd_COLORS_LONG = { OPT_LONG, false, false, false, false, false, 'l', "long", 0, @@ -554,6 +569,7 @@ static const KeywordTab_t CommandTab[] = { CMD_VERSION, "VERSION", 0, 0 }, { CMD_HELP, "HELP", "H", 0 }, { CMD_HELP, "?", 0, 0 }, + { CMD_CONFIG, "CONFIG", 0, 0 }, { CMD_ARGTEST, "ARGTEST", 0, 0 }, { CMD_TEST, "TEST", 0, 0 }, { CMD_COLORS, "COLORS", 0, 0 }, @@ -585,6 +601,7 @@ static const struct option OptionLong[] = { "version", 0, 0, 'V' }, { "help", 0, 0, 'h' }, { "xhelp", 0, 0, GO_XHELP }, + { "config", 1, 0, GO_CONFIG }, { "allow-all", 0, 0, GO_ALLOW_ALL }, { "allowall", 0, 0, GO_ALLOW_ALL }, { "compatible", 1, 0, GO_COMPATIBLE }, @@ -725,36 +742,37 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x078 x */ OPT_TRANSFORM, /* 0x079 */ 0,0,0,0, 0,0,0, /* 0x080 */ OPT_XHELP, - /* 0x081 */ OPT_ALLOW_ALL, - /* 0x082 */ OPT_COMPATIBLE, - /* 0x083 */ OPT_WIDTH, - /* 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, + /* 0x081 */ OPT_CONFIG, + /* 0x082 */ OPT_ALLOW_ALL, + /* 0x083 */ OPT_COMPATIBLE, + /* 0x084 */ OPT_WIDTH, + /* 0x085 */ OPT_MAX_WIDTH, + /* 0x086 */ OPT_DE, + /* 0x087 */ OPT_COLORS, + /* 0x088 */ OPT_NO_COLORS, + /* 0x089 */ OPT_CT_CODE, + /* 0x08a */ OPT_LE_CODE, + /* 0x08b */ OPT_CHDIR, + /* 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_MIPMAPS, + /* 0x096 */ OPT_NO_MIPMAPS, + /* 0x097 */ OPT_N_MIPMAPS, + /* 0x098 */ OPT_MAX_MIPMAPS, + /* 0x099 */ OPT_MIPMAP_SIZE, + /* 0x09a */ OPT_FAST_MIPMAPS, + /* 0x09b */ OPT_CMPR_DEFAULT, + /* 0x09c */ OPT_PRE_CONVERT, + /* 0x09d */ OPT_STRIP, + /* 0x09e */ OPT_SECTIONS, + /* 0x09f */ 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, @@ -782,67 +800,72 @@ static u8 option_allowed_cmd_HELP[26] = // 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 }; -static u8 option_allowed_cmd_ARGTEST[26] = // cmd #3 +static u8 option_allowed_cmd_CONFIG[26] = // cmd #3 +{ + 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 +}; + +static u8 option_allowed_cmd_ARGTEST[26] = // 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 }; -static u8 option_allowed_cmd_TEST[26] = // cmd #4 +static u8 option_allowed_cmd_TEST[26] = // cmd #5 { 1,1,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[26] = // cmd #5 +static u8 option_allowed_cmd_COLORS[26] = // cmd #6 { 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 }; -static u8 option_allowed_cmd_ERROR[26] = // cmd #6 +static u8 option_allowed_cmd_ERROR[26] = // cmd #7 { 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, 1 }; -static u8 option_allowed_cmd_FILETYPE[26] = // cmd #7 +static u8 option_allowed_cmd_FILETYPE[26] = // cmd #8 { 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, 0 }; -static u8 option_allowed_cmd_FILEATTRIB[26] = // cmd #8 +static u8 option_allowed_cmd_FILEATTRIB[26] = // cmd #9 { 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 }; -static u8 option_allowed_cmd_LIST[26] = // cmd #9 +static u8 option_allowed_cmd_LIST[26] = // cmd #10 { 0,1,1,0,0, 0,0,0,0,0, 0,0,1,0,0, 0,0,0,0,0, 0,0,0,0,0, 0 }; -static u8 option_allowed_cmd_LIST_L[26] = // cmd #10 +static u8 option_allowed_cmd_LIST_L[26] = // cmd #11 { 0,1,1,0,0, 0,0,0,0,0, 0,0,1,0,0, 0,0,0,0,0, 0,0,0,0,0, 0 }; -static u8 option_allowed_cmd_LIST_LL[26] = // cmd #11 +static u8 option_allowed_cmd_LIST_LL[26] = // cmd #12 { 0,1,1,0,0, 0,0,0,0,0, 0,0,1,0,0, 0,0,0,0,0, 0,0,0,0,0, 0 }; -static u8 option_allowed_cmd_DECODE[26] = // cmd #12 +static u8 option_allowed_cmd_DECODE[26] = // cmd #13 { 0,0,0,0,1, 1,1,1,1,1, 1,1,1,0,1, 1,1,1,1,1, 1,1,1,1,1, 0 }; -static u8 option_allowed_cmd_ENCODE[26] = // cmd #13 +static u8 option_allowed_cmd_ENCODE[26] = // cmd #14 { 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 }; -static u8 option_allowed_cmd_CONVERT[26] = // cmd #14 +static u8 option_allowed_cmd_CONVERT[26] = // cmd #15 { 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 }; -static u8 option_allowed_cmd_COPY[26] = // cmd #15 +static u8 option_allowed_cmd_COPY[26] = // cmd #16 { 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 }; @@ -858,6 +881,7 @@ static const InfoOption_t * option_tab_tool[] = OptionInfo + OPT_VERSION, OptionInfo + OPT_HELP, OptionInfo + OPT_XHELP, + OptionInfo + OPT_CONFIG, OptionInfo + OPT_ALLOW_ALL, OptionInfo + OPT_COMPATIBLE, OptionInfo + OPT_WIDTH, @@ -900,6 +924,14 @@ static const InfoOption_t * option_tab_cmd_HELP[] = 0 }; +static const InfoOption_t * option_tab_cmd_CONFIG[] = +{ + OptionInfo + OPT_CONFIG, + &option_cmd_CONFIG_LONG, + + 0 +}; + static const InfoOption_t * option_tab_cmd_ARGTEST[] = { @@ -1135,7 +1167,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, - 21, + 22, option_tab_tool, 0 }, @@ -1178,6 +1210,21 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = option_allowed_cmd_HELP }, + { CMD_CONFIG, + false, + false, + false, + "CONFIG", + 0, + "wimgt CONFIG [options]...", + "Show all information about the search for the configuration file and" + " its content.", + 0, + 2, + option_tab_cmd_CONFIG, + option_allowed_cmd_CONFIG + }, + { CMD_ARGTEST, false, false, diff --git a/project/src/ui/ui-wimgt.h b/project/src/ui/ui-wimgt.h index 42d5994..e7cfe21 100644 --- a/project/src/ui/ui-wimgt.h +++ b/project/src/ui/ui-wimgt.h @@ -89,6 +89,7 @@ typedef enum enumOptions OPT_VERSION, OPT_HELP, OPT_XHELP, + OPT_CONFIG, OPT_ALLOW_ALL, OPT_COMPATIBLE, OPT_WIDTH, @@ -116,7 +117,7 @@ typedef enum enumOptions OPT_NEW, OPT_EXTRACT, - OPT__N_TOTAL // == 55 + OPT__N_TOTAL // == 56 } enumOptions; @@ -186,6 +187,8 @@ typedef enum enumOptions // // OB_CMD_HELP = ~(u64)0, // +// OB_CMD_CONFIG = OB_LONG, +// // OB_CMD_ARGTEST = ~(u64)0, // // OB_CMD_TEST = ~(u64)0, @@ -237,6 +240,7 @@ typedef enum enumCommands CMD_VERSION, CMD_HELP, + CMD_CONFIG, CMD_ARGTEST, CMD_TEST, CMD_COLORS, @@ -254,7 +258,7 @@ typedef enum enumCommands CMD_COPY, - CMD__N // == 16 + CMD__N // == 17 } enumCommands; @@ -294,6 +298,7 @@ typedef enum enumGetOpt GO_TRANSFORM = 'x', GO_XHELP = 0x80, + GO_CONFIG, GO_ALLOW_ALL, GO_COMPATIBLE, GO_WIDTH, diff --git a/project/src/ui/ui-wkclt.c b/project/src/ui/ui-wkclt.c index 2102123..5918bdc 100644 --- a/project/src/ui/ui-wkclt.c +++ b/project/src/ui/ui-wkclt.c @@ -385,6 +385,15 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " commands included. Exit after printing." }, + { OPT_CONFIG, false, false, false, false, false, 0, "config", + "file", + "Define a configuration file or a directory as source. In later case," + " file 'wiimms-szs-tools.conf' is searched.\n" + " If option is not not set, then file 'wiimms-szs-tools.conf' is" + " searched in different directories. Use command 'wszst CONFIG' to get" + " more details." + }, + { OPT_ALLOW_ALL, false, false, false, false, false, 0, "allow-all", 0, "Usually commands accept only options with impact to the command. All" @@ -633,7 +642,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 == 71 + {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 72 }; @@ -661,6 +670,12 @@ static const InfoOption_t option_cmd_VERSION_LONG = "Print in long format. Ignored if option --sections is set." }; +static const InfoOption_t option_cmd_CONFIG_LONG = + { OPT_LONG, false, false, false, false, false, 'l', "long", + 0, + "If set, print the search list too." + }; + static const InfoOption_t option_cmd_TEST_VERBOSE = { OPT_VERBOSE, false, false, false, false, false, 'v', "verbose", 0, @@ -840,6 +855,7 @@ static const KeywordTab_t CommandTab[] = { CMD_VERSION, "VERSION", 0, 0 }, { CMD_HELP, "HELP", "H", 0 }, { CMD_HELP, "?", 0, 0 }, + { CMD_CONFIG, "CONFIG", 0, 0 }, { CMD_ARGTEST, "ARGTEST", 0, 0 }, { CMD_TEST, "TEST", 0, 0 }, { CMD_COLORS, "COLORS", 0, 0 }, @@ -883,6 +899,7 @@ static const struct option OptionLong[] = { "version", 0, 0, 'V' }, { "help", 0, 0, 'h' }, { "xhelp", 0, 0, GO_XHELP }, + { "config", 1, 0, GO_CONFIG }, { "allow-all", 0, 0, GO_ALLOW_ALL }, { "allowall", 0, 0, GO_ALLOW_ALL }, { "compatible", 1, 0, GO_COMPATIBLE }, @@ -1035,53 +1052,53 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x076 v */ OPT_VERBOSE, /* 0x077 */ 0,0,0,0, 0,0,0,0, 0, /* 0x080 */ OPT_XHELP, - /* 0x081 */ OPT_ALLOW_ALL, - /* 0x082 */ OPT_COMPATIBLE, - /* 0x083 */ OPT_WIDTH, - /* 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, + /* 0x081 */ OPT_CONFIG, + /* 0x082 */ OPT_ALLOW_ALL, + /* 0x083 */ OPT_COMPATIBLE, + /* 0x084 */ OPT_WIDTH, + /* 0x085 */ OPT_MAX_WIDTH, + /* 0x086 */ OPT_DE, + /* 0x087 */ OPT_COLORS, + /* 0x088 */ OPT_NO_COLORS, + /* 0x089 */ OPT_CT_CODE, + /* 0x08a */ OPT_LE_CODE, + /* 0x08b */ OPT_CHDIR, + /* 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_KCL, + /* 0x09c */ OPT_KCL_FLAG, + /* 0x09d */ OPT_KCL_SCRIPT, + /* 0x09e */ OPT_TRI_AREA, + /* 0x09f */ OPT_TRI_HEIGHT, + /* 0x0a0 */ OPT_FLAG_FILE, + /* 0x0a1 */ OPT_XTRIDATA, + /* 0x0a2 */ OPT_SLOT, + /* 0x0a3 */ OPT_ROUND, + /* 0x0a4 */ OPT_NO_ECHO, + /* 0x0a5 */ OPT_UTF_8, + /* 0x0a6 */ OPT_NO_UTF_8, + /* 0x0a7 */ OPT_FORCE, + /* 0x0a8 */ OPT_REPAIR_MAGICS, + /* 0x0a9 */ OPT_TINY, + /* 0x0aa */ OPT_OLD, + /* 0x0ab */ OPT_STD, + /* 0x0ac */ OPT_NEW, + /* 0x0ad */ OPT_EXTRACT, + /* 0x0ae */ OPT_NUMBER, + /* 0x0af */ OPT_SECTIONS, /* 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, @@ -1110,163 +1127,169 @@ static u8 option_allowed_cmd_HELP[37] = // cmd #2 1,1,1,1,1, 1,1 }; -static u8 option_allowed_cmd_ARGTEST[37] = // cmd #3 +static u8 option_allowed_cmd_CONFIG[37] = // cmd #3 +{ + 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 +}; + +static u8 option_allowed_cmd_ARGTEST[37] = // 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 }; -static u8 option_allowed_cmd_TEST[37] = // cmd #4 +static u8 option_allowed_cmd_TEST[37] = // cmd #5 { 1,1,1,1,1, 1,1,1,1,1, 1,1,1,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[37] = // cmd #5 +static u8 option_allowed_cmd_COLORS[37] = // cmd #6 { 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 }; -static u8 option_allowed_cmd_ERROR[37] = // cmd #6 +static u8 option_allowed_cmd_ERROR[37] = // cmd #7 { 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,1 }; -static u8 option_allowed_cmd_FILETYPE[37] = // cmd #7 +static u8 option_allowed_cmd_FILETYPE[37] = // cmd #8 { 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, 1,0 }; -static u8 option_allowed_cmd_FILEATTRIB[37] = // cmd #8 +static u8 option_allowed_cmd_FILEATTRIB[37] = // cmd #9 { 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 }; -static u8 option_allowed_cmd_SYMBOLS[37] = // cmd #9 +static u8 option_allowed_cmd_SYMBOLS[37] = // cmd #10 { 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 }; -static u8 option_allowed_cmd_FUNCTIONS[37] = // cmd #10 +static u8 option_allowed_cmd_FUNCTIONS[37] = // cmd #11 { 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 }; -static u8 option_allowed_cmd_CALCULATE[37] = // cmd #11 +static u8 option_allowed_cmd_CALCULATE[37] = // 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 }; -static u8 option_allowed_cmd_MATRIX[37] = // cmd #12 +static u8 option_allowed_cmd_MATRIX[37] = // cmd #13 { 0,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,1,0,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0 }; -static u8 option_allowed_cmd_FLOAT[37] = // cmd #13 +static u8 option_allowed_cmd_FLOAT[37] = // cmd #14 { 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 }; -static u8 option_allowed_cmd_EXPORT[37] = // cmd #14 +static u8 option_allowed_cmd_EXPORT[37] = // 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 }; -static u8 option_allowed_cmd_CAT[37] = // cmd #15 +static u8 option_allowed_cmd_CAT[37] = // cmd #16 { 0,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,0,0, 1,0 }; -static u8 option_allowed_cmd_DECODE[37] = // cmd #16 +static u8 option_allowed_cmd_DECODE[37] = // cmd #17 { 0,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,0,0,0,0, 1,1,1,1,1, 1,1,1,1,1, 1,0 }; -static u8 option_allowed_cmd_ENCODE[37] = // cmd #17 +static u8 option_allowed_cmd_ENCODE[37] = // cmd #18 { 0,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,0,0,0,0, 1,1,1,1,1, 1,1,1,1,1, 1,0 }; -static u8 option_allowed_cmd_COPY[37] = // cmd #18 +static u8 option_allowed_cmd_COPY[37] = // cmd #19 { 0,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,0,0,0,0, 1,1,1,1,1, 1,1,1,1,1, 1,0 }; -static u8 option_allowed_cmd_CFF[37] = // cmd #19 +static u8 option_allowed_cmd_CFF[37] = // cmd #20 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,0, 0,1,0,1,0, 1,1,1,1,1, 1,1,1,1,1, 1,0 }; -static u8 option_allowed_cmd_FLAGS[37] = // cmd #20 +static u8 option_allowed_cmd_FLAGS[37] = // cmd #21 { 0,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,0,1,1,0, 0,1,0,0,0, 0,0,0,0,0, 1,0 }; -static u8 option_allowed_cmd_DUMP[37] = // cmd #21 +static u8 option_allowed_cmd_DUMP[37] = // cmd #22 { 0,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,1,0,1,0, 0,1,0,0,0, 0,0,0,0,0, 1,0 }; -static u8 option_allowed_cmd_DBRIEF[37] = // cmd #22 +static u8 option_allowed_cmd_DBRIEF[37] = // cmd #23 { 0,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,1,0,1,0, 0,1,0,0,0, 0,0,0,0,0, 1,0 }; -static u8 option_allowed_cmd_LIST[37] = // cmd #23 +static u8 option_allowed_cmd_LIST[37] = // cmd #24 { 0,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,1,0,0,0, 0,0,0,0,0, 1,0 }; -static u8 option_allowed_cmd_TRIANGLES[37] = // cmd #24 +static u8 option_allowed_cmd_TRIANGLES[37] = // cmd #25 { 0,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,1,0,1,0, 0,1,0,0,0, 0,0,0,0,0, 1,0 }; -static u8 option_allowed_cmd_TRAVERSE[37] = // cmd #25 +static u8 option_allowed_cmd_TRAVERSE[37] = // cmd #26 { 0,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,1,0,1,0, 0,1,0,0,0, 0,0,0,0,0, 1,0 }; -static u8 option_allowed_cmd_FALL[37] = // cmd #26 +static u8 option_allowed_cmd_FALL[37] = // cmd #27 { 0,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,1,0,1,0, 0,1,0,0,0, 0,0,0,0,0, 1,0 }; -static u8 option_allowed_cmd_CHECK[37] = // cmd #27 +static u8 option_allowed_cmd_CHECK[37] = // cmd #28 { 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, 1,1,0,0,0, 0,0,0,0,0, 1,0 }; -static u8 option_allowed_cmd_ANALYZE[37] = // cmd #28 +static u8 option_allowed_cmd_ANALYZE[37] = // cmd #29 { 0,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, 1,0 }; -static u8 option_allowed_cmd_BLOW[37] = // cmd #29 +static u8 option_allowed_cmd_BLOW[37] = // 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,0,0,0,0, 1,0 @@ -1283,6 +1306,7 @@ static const InfoOption_t * option_tab_tool[] = OptionInfo + OPT_VERSION, OptionInfo + OPT_HELP, OptionInfo + OPT_XHELP, + OptionInfo + OPT_CONFIG, OptionInfo + OPT_ALLOW_ALL, OptionInfo + OPT_COMPATIBLE, OptionInfo + OPT_WIDTH, @@ -1329,6 +1353,14 @@ static const InfoOption_t * option_tab_cmd_HELP[] = 0 }; +static const InfoOption_t * option_tab_cmd_CONFIG[] = +{ + OptionInfo + OPT_CONFIG, + &option_cmd_CONFIG_LONG, + + 0 +}; + static const InfoOption_t * option_tab_cmd_ARGTEST[] = { @@ -1970,7 +2002,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "Wiimms KCL Tool : Analyze, modify, export and create KCL and OBJ" " files.", 0, - 25, + 26, option_tab_tool, 0 }, @@ -2013,6 +2045,21 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = option_allowed_cmd_HELP }, + { CMD_CONFIG, + false, + false, + false, + "CONFIG", + 0, + "wkclt CONFIG [options]...", + "Show all information about the search for the configuration file and" + " its content.", + 0, + 2, + option_tab_cmd_CONFIG, + option_allowed_cmd_CONFIG + }, + { CMD_ARGTEST, false, false, diff --git a/project/src/ui/ui-wkclt.h b/project/src/ui/ui-wkclt.h index 41097b5..9d389d4 100644 --- a/project/src/ui/ui-wkclt.h +++ b/project/src/ui/ui-wkclt.h @@ -100,6 +100,7 @@ typedef enum enumOptions OPT_VERSION, OPT_HELP, OPT_XHELP, + OPT_CONFIG, OPT_ALLOW_ALL, OPT_COMPATIBLE, OPT_WIDTH, @@ -132,7 +133,7 @@ typedef enum enumOptions OPT_NEW, OPT_EXTRACT, - OPT__N_TOTAL // == 71 + OPT__N_TOTAL // == 72 } enumOptions; @@ -225,6 +226,8 @@ typedef enum enumOptions // // OB_CMD_HELP = ~(u64)0, // +// OB_CMD_CONFIG = OB_LONG, +// // OB_CMD_ARGTEST = ~(u64)0, // // OB_CMD_TEST = ~(u64)0, @@ -341,6 +344,7 @@ typedef enum enumCommands CMD_VERSION, CMD_HELP, + CMD_CONFIG, CMD_ARGTEST, CMD_TEST, CMD_COLORS, @@ -371,7 +375,7 @@ typedef enum enumCommands CMD_BLOW, - CMD__N // == 30 + CMD__N // == 31 } enumCommands; @@ -410,6 +414,7 @@ typedef enum enumGetOpt GO_VERBOSE = 'v', GO_XHELP = 0x80, + GO_CONFIG, GO_ALLOW_ALL, GO_COMPATIBLE, GO_WIDTH, diff --git a/project/src/ui/ui-wkmpt.c b/project/src/ui/ui-wkmpt.c index 5a47964..a8c041e 100644 --- a/project/src/ui/ui-wkmpt.c +++ b/project/src/ui/ui-wkmpt.c @@ -505,6 +505,15 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " commands included. Exit after printing." }, + { OPT_CONFIG, false, false, false, false, false, 0, "config", + "file", + "Define a configuration file or a directory as source. In later case," + " file 'wiimms-szs-tools.conf' is searched.\n" + " If option is not not set, then file 'wiimms-szs-tools.conf' is" + " searched in different directories. Use command 'wszst CONFIG' to get" + " more details." + }, + { OPT_ALLOW_ALL, false, false, false, false, false, 0, "allow-all", 0, "Usually commands accept only options with impact to the command. All" @@ -858,7 +867,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 == 92 + {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 93 }; @@ -886,6 +895,12 @@ static const InfoOption_t option_cmd_VERSION_LONG = "Print in long format. Ignored if option --sections is set." }; +static const InfoOption_t option_cmd_CONFIG_LONG = + { OPT_LONG, false, false, false, false, false, 'l', "long", + 0, + "If set, print the search list too." + }; + static const InfoOption_t option_cmd_TEST_VERBOSE = { OPT_VERBOSE, false, false, false, false, false, 'v', "verbose", 0, @@ -1091,6 +1106,7 @@ static const KeywordTab_t CommandTab[] = { CMD_VERSION, "VERSION", 0, 0 }, { CMD_HELP, "HELP", "H", 0 }, { CMD_HELP, "?", 0, 0 }, + { CMD_CONFIG, "CONFIG", 0, 0 }, { CMD_ARGTEST, "ARGTEST", 0, 0 }, { CMD_TEST, "TEST", 0, 0 }, { CMD_COLORS, "COLORS", 0, 0 }, @@ -1135,6 +1151,7 @@ static const struct option OptionLong[] = { "version", 0, 0, 'V' }, { "help", 0, 0, 'h' }, { "xhelp", 0, 0, GO_XHELP }, + { "config", 1, 0, GO_CONFIG }, { "allow-all", 0, 0, GO_ALLOW_ALL }, { "allowall", 0, 0, GO_ALLOW_ALL }, { "compatible", 1, 0, GO_COMPATIBLE }, @@ -1326,71 +1343,72 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x077 w */ OPT_DRAW, /* 0x078 */ 0,0,0,0, 0,0,0,0, /* 0x080 */ OPT_XHELP, - /* 0x081 */ OPT_ALLOW_ALL, - /* 0x082 */ OPT_COMPATIBLE, - /* 0x083 */ OPT_WIDTH, - /* 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, + /* 0x081 */ OPT_CONFIG, + /* 0x082 */ OPT_ALLOW_ALL, + /* 0x083 */ OPT_COMPATIBLE, + /* 0x084 */ OPT_WIDTH, + /* 0x085 */ OPT_MAX_WIDTH, + /* 0x086 */ OPT_DE, + /* 0x087 */ OPT_COLORS, + /* 0x088 */ OPT_NO_COLORS, + /* 0x089 */ OPT_CT_CODE, + /* 0x08a */ OPT_LE_CODE, + /* 0x08b */ OPT_CHDIR, + /* 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_YPOS, + /* 0x096 */ OPT_TRANSLATE, + /* 0x097 */ OPT_NULL, + /* 0x098 */ OPT_NEXT, + /* 0x099 */ OPT_ASCALE, + /* 0x09a */ OPT_AROT, + /* 0x09b */ OPT_TFORM_SCRIPT, + /* 0x09c */ OPT_RM_GOBJ, + /* 0x09d */ OPT_BATTLE, + /* 0x09e */ OPT_EXPORT_FLAGS, + /* 0x09f */ OPT_ROUTE_OPTIONS, + /* 0x0a0 */ OPT_WIM0, + /* 0x0a1 */ OPT_SLOT, + /* 0x0a2 */ OPT_POS_MODE, + /* 0x0a3 */ OPT_POS_FILE, + /* 0x0a4 */ OPT_PNG, + /* 0x0a5 */ OPT_LOAD_KCL, + /* 0x0a6 */ OPT_KCL, + /* 0x0a7 */ OPT_KCL_FLAG, + /* 0x0a8 */ OPT_KCL_SCRIPT, + /* 0x0a9 */ OPT_TRI_AREA, + /* 0x0aa */ OPT_TRI_HEIGHT, + /* 0x0ab */ OPT_FLAG_FILE, + /* 0x0ac */ OPT_XTRIDATA, + /* 0x0ad */ OPT_KMP, + /* 0x0ae */ OPT_SPEED_MOD, + /* 0x0af */ OPT_KTPT2, + /* 0x0b0 */ OPT_TFORM_KMP, + /* 0x0b1 */ OPT_REPAIR_XPF, + /* 0x0b2 */ OPT_GAMEMODES, + /* 0x0b3 */ OPT_ROUND, + /* 0x0b4 */ OPT_EPSILON, + /* 0x0b5 */ OPT_DIFF, + /* 0x0b6 */ OPT_NO_ECHO, + /* 0x0b7 */ OPT_UTF_8, + /* 0x0b8 */ OPT_NO_UTF_8, + /* 0x0b9 */ OPT_FORCE, + /* 0x0ba */ OPT_REPAIR_MAGICS, + /* 0x0bb */ OPT_TINY, + /* 0x0bc */ OPT_OLD, + /* 0x0bd */ OPT_STD, + /* 0x0be */ OPT_NEW, + /* 0x0bf */ OPT_EXTRACT, + /* 0x0c0 */ OPT_NUMBER, + /* 0x0c1 */ OPT_SECTIONS, + /* 0x0c2 */ 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, @@ -1417,163 +1435,169 @@ static u8 option_allowed_cmd_HELP[49] = // cmd #2 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[49] = // cmd #3 +static u8 option_allowed_cmd_CONFIG[49] = // cmd #3 +{ + 0,0,0,0,0, 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 +}; + +static u8 option_allowed_cmd_ARGTEST[49] = // 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 }; -static u8 option_allowed_cmd_TEST[49] = // cmd #4 +static u8 option_allowed_cmd_TEST[49] = // cmd #5 { 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 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[49] = // cmd #5 +static u8 option_allowed_cmd_COLORS[49] = // 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,1, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0 }; -static u8 option_allowed_cmd_ERROR[49] = // cmd #6 +static u8 option_allowed_cmd_ERROR[49] = // 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,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1 }; -static u8 option_allowed_cmd_FILETYPE[49] = // cmd #7 +static u8 option_allowed_cmd_FILETYPE[49] = // 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,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0 }; -static u8 option_allowed_cmd_FILEATTRIB[49] = // cmd #8 +static u8 option_allowed_cmd_FILEATTRIB[49] = // 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, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0 }; -static u8 option_allowed_cmd_SYMBOLS[49] = // cmd #9 +static u8 option_allowed_cmd_SYMBOLS[49] = // 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, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0 }; -static u8 option_allowed_cmd_FUNCTIONS[49] = // cmd #10 +static u8 option_allowed_cmd_FUNCTIONS[49] = // 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,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0 }; -static u8 option_allowed_cmd_CALCULATE[49] = // cmd #11 +static u8 option_allowed_cmd_CALCULATE[49] = // 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 }; -static u8 option_allowed_cmd_MATRIX[49] = // cmd #12 +static u8 option_allowed_cmd_MATRIX[49] = // cmd #13 { 0,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,1,0,0,1, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0 }; -static u8 option_allowed_cmd_FLOAT[49] = // cmd #13 +static u8 option_allowed_cmd_FLOAT[49] = // 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,1,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_STARTPOS[49] = // cmd #14 +static u8 option_allowed_cmd_STARTPOS[49] = // cmd #15 { 0,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,1,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_OBJECTS[49] = // cmd #15 +static u8 option_allowed_cmd_OBJECTS[49] = // 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,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0 }; -static u8 option_allowed_cmd_EXPORT[49] = // cmd #16 +static u8 option_allowed_cmd_EXPORT[49] = // 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 }; -static u8 option_allowed_cmd_XEXPORT[49] = // cmd #17 +static u8 option_allowed_cmd_XEXPORT[49] = // 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,0,0,0, 0,0,0,0,0, 0,0,0,0 }; -static u8 option_allowed_cmd_CAT[49] = // cmd #18 +static u8 option_allowed_cmd_CAT[49] = // cmd #19 { 0,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,1,0,0,0, 1,1,1,1,0, 0,1,1,1,0, 0,0,0,0,0, 0,0,1,0 }; -static u8 option_allowed_cmd_DECODE[49] = // cmd #19 +static u8 option_allowed_cmd_DECODE[49] = // cmd #20 { 0,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,1,0,0,0, 1,1,1,1,0, 0,1,1,1,1, 1,1,1,1,1, 1,1,1,0 }; -static u8 option_allowed_cmd_ENCODE[49] = // cmd #20 +static u8 option_allowed_cmd_ENCODE[49] = // cmd #21 { 0,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,1,0,0,0, 0,0,0,0,0, 0,0,1,1,1, 1,1,1,1,1, 1,1,1,0 }; -static u8 option_allowed_cmd_DIFF[49] = // cmd #21 +static u8 option_allowed_cmd_DIFF[49] = // 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,1, 1,0,0,0,1, 0,1,0,0,0, 0,0,0,0 }; -static u8 option_allowed_cmd_DRAW[49] = // cmd #22 +static u8 option_allowed_cmd_DRAW[49] = // cmd #23 { 0,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,1,0,0,0, 1,1,1,1,0, 0,1,1,1,1, 1,1,1,1,1, 1,1,1,0 }; -static u8 option_allowed_cmd_CHECK[49] = // cmd #23 +static u8 option_allowed_cmd_CHECK[49] = // 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,1, 0,1,0,0,0, 0,1,1,1,0, 0,0,0,0,0, 0,0,1,0 }; -static u8 option_allowed_cmd_STGI[49] = // cmd #24 +static u8 option_allowed_cmd_STGI[49] = // 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, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0 }; -static u8 option_allowed_cmd_KTPT[49] = // cmd #25 +static u8 option_allowed_cmd_KTPT[49] = // 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,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0 }; -static u8 option_allowed_cmd_ROUTES[49] = // cmd #26 +static u8 option_allowed_cmd_ROUTES[49] = // 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, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0 }; -static u8 option_allowed_cmd_GOBJ[49] = // cmd #27 +static u8 option_allowed_cmd_GOBJ[49] = // 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,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0 }; -static u8 option_allowed_cmd_GAMEMODES[49] = // cmd #28 +static u8 option_allowed_cmd_GAMEMODES[49] = // 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,1,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0 }; -static u8 option_allowed_cmd_WIM0[49] = // cmd #29 +static u8 option_allowed_cmd_WIM0[49] = // 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,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0 @@ -1590,6 +1614,7 @@ static const InfoOption_t * option_tab_tool[] = OptionInfo + OPT_VERSION, OptionInfo + OPT_HELP, OptionInfo + OPT_XHELP, + OptionInfo + OPT_CONFIG, OptionInfo + OPT_ALLOW_ALL, OptionInfo + OPT_COMPATIBLE, OptionInfo + OPT_WIDTH, @@ -1645,6 +1670,14 @@ static const InfoOption_t * option_tab_cmd_HELP[] = 0 }; +static const InfoOption_t * option_tab_cmd_CONFIG[] = +{ + OptionInfo + OPT_CONFIG, + &option_cmd_CONFIG_LONG, + + 0 +}; + static const InfoOption_t * option_tab_cmd_ARGTEST[] = { @@ -2143,7 +2176,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "Wiimms KMP Tool : Analyze, modify, export and create (compile) KMP" " files.", 0, - 34, + 35, option_tab_tool, 0 }, @@ -2186,6 +2219,21 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = option_allowed_cmd_HELP }, + { CMD_CONFIG, + false, + false, + false, + "CONFIG", + 0, + "wkmpt CONFIG [options]...", + "Show all information about the search for the configuration file and" + " its content.", + 0, + 2, + option_tab_cmd_CONFIG, + option_allowed_cmd_CONFIG + }, + { CMD_ARGTEST, false, false, diff --git a/project/src/ui/ui-wkmpt.h b/project/src/ui/ui-wkmpt.h index 2b8541d..af16b9e 100644 --- a/project/src/ui/ui-wkmpt.h +++ b/project/src/ui/ui-wkmpt.h @@ -112,6 +112,7 @@ typedef enum enumOptions OPT_VERSION, OPT_HELP, OPT_XHELP, + OPT_CONFIG, OPT_ALLOW_ALL, OPT_COMPATIBLE, OPT_WIDTH, @@ -153,7 +154,7 @@ typedef enum enumOptions OPT_NEW, OPT_EXTRACT, - OPT__N_TOTAL // == 92 + OPT__N_TOTAL // == 93 } enumOptions; @@ -260,6 +261,8 @@ typedef enum enumOptions // // OB_CMD_HELP = ~(u64)0, // +// OB_CMD_CONFIG = OB_LONG, +// // OB_CMD_ARGTEST = ~(u64)0, // // OB_CMD_TEST = ~(u64)0, @@ -375,6 +378,7 @@ typedef enum enumCommands CMD_VERSION, CMD_HELP, + CMD_CONFIG, CMD_ARGTEST, CMD_TEST, CMD_COLORS, @@ -405,7 +409,7 @@ typedef enum enumCommands CMD_WIM0, - CMD__N // == 30 + CMD__N // == 31 } enumCommands; @@ -447,6 +451,7 @@ typedef enum enumGetOpt GO_DRAW = 'w', GO_XHELP = 0x80, + GO_CONFIG, GO_ALLOW_ALL, GO_COMPATIBLE, GO_WIDTH, diff --git a/project/src/ui/ui-wlect.c b/project/src/ui/ui-wlect.c index 309da13..ea96afd 100644 --- a/project/src/ui/ui-wlect.c +++ b/project/src/ui/ui-wlect.c @@ -171,27 +171,15 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = { OPT_SPEEDOMETER, true, false, false, false, false, 0, "speedometer", "[=mode]", "Enable or disable the speedometer. Mode is one of OFF, AUTO (default," - " don't change setting), ON (enable it for Wii and WiiU only; default," - " if option is used without parameter) or FORCE (enable it for Wii," - " Wii U and for Dolphin)." + " don't change setting), ON (default, if option is used without" + " parameter) or FRACTION (=1DIGIT), 2DIGITS and 3DIGITS." }, - { OPT_RESERVED_1B9, false, true, false, false, false, 0, "reserved-1b9", - "[=mode]", - "Set LPAR byte at offset 0x1b9 to this value. Value -1 disables this" - " option." - }, - - { OPT_RESERVED_1BA, false, true, false, false, false, 0, "reserved-1ba", - "[=mode]", - "Set LPAR byte at offset 0x1ba to this value. Value -1 disables this" - " option." - }, - - { OPT_RESERVED_1BB, false, true, false, false, false, 0, "reserved-1bb", - "[=mode]", - "Set LPAR byte at offset 0x1bb to this value. Value -1 disables this" - " option." + { OPT_DEBUG, false, false, false, false, false, 0, "debug", + "mode", + "Enable or disable the debug output while racing. Mode is one of OFF," + " AUTO (default, don't change setting), USER or 100 to 199 for" + " predefined setups." }, { OPT_TRACK_DIR, false, false, false, false, true, 0, "track-dir", @@ -363,7 +351,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 == 45 + {0,0,0,0,0,0,0,0,0,0}, // OPT__N_SPECIFIC == 43 //----- global options ----- @@ -383,6 +371,15 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " commands included. Exit after printing." }, + { OPT_CONFIG, false, false, false, false, false, 0, "config", + "file", + "Define a configuration file or a directory as source. In later case," + " file 'wiimms-szs-tools.conf' is searched.\n" + " If option is not not set, then file 'wiimms-szs-tools.conf' is" + " searched in different directories. Use command 'wszst CONFIG' to get" + " more details." + }, + { OPT_ALLOW_ALL, false, false, false, false, false, 0, "allow-all", 0, "Usually commands accept only options with impact to the command. All" @@ -598,7 +595,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 == 78 + {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 77 }; @@ -626,6 +623,12 @@ static const InfoOption_t option_cmd_VERSION_LONG = "Print in long format. Ignored if option --sections is set." }; +static const InfoOption_t option_cmd_CONFIG_LONG = + { OPT_LONG, false, false, false, false, false, 'l', "long", + 0, + "If set, print the search list too." + }; + static const InfoOption_t option_cmd_COLORS_LONG = { OPT_LONG, false, false, false, false, false, 'l', "long", 0, @@ -713,6 +716,7 @@ static const KeywordTab_t CommandTab[] = { CMD_VERSION, "VERSION", 0, 0 }, { CMD_HELP, "HELP", "H", 0 }, { CMD_HELP, "?", 0, 0 }, + { CMD_CONFIG, "CONFIG", 0, 0 }, { CMD_ARGTEST, "ARGTEST", 0, 0 }, { CMD_TEST, "TEST", 0, 0 }, { CMD_COLORS, "COLORS", 0, 0 }, @@ -724,6 +728,7 @@ static const KeywordTab_t CommandTab[] = { CMD_CALCULATE, "CALCULATE", 0, 0 }, { CMD_FLOAT, "FLOAT", 0, 0 }, { CMD_EXPORT, "_EXPORT", 0, 0 }, + { CMD_DPAD, "_DPAD", 0, 0 }, { CMD_DUMP, "DUMP", "D", 0 }, { CMD_DL, "DL", 0, 0 }, { CMD_DLL, "DLL", 0, 0 }, @@ -751,6 +756,7 @@ static const struct option OptionLong[] = { "version", 0, 0, 'V' }, { "help", 0, 0, 'h' }, { "xhelp", 0, 0, GO_XHELP }, + { "config", 1, 0, GO_CONFIG }, { "allow-all", 0, 0, GO_ALLOW_ALL }, { "allowall", 0, 0, GO_ALLOW_ALL }, { "compatible", 1, 0, GO_COMPATIBLE }, @@ -830,12 +836,7 @@ static const struct option OptionLong[] = { "customtt", 2, 0, GO_CUSTOM_TT }, { "xpflags", 2, 0, GO_XPFLAGS }, { "speedometer", 2, 0, GO_SPEEDOMETER }, - { "reserved-1b9", 1, 0, GO_RESERVED_1B9 }, - { "reserved1b9", 1, 0, GO_RESERVED_1B9 }, - { "reserved-1ba", 1, 0, GO_RESERVED_1BA }, - { "reserved1ba", 1, 0, GO_RESERVED_1BA }, - { "reserved-1bb", 1, 0, GO_RESERVED_1BB }, - { "reserved1bb", 1, 0, GO_RESERVED_1BB }, + { "debug", 1, 0, GO_DEBUG }, { "track-dir", 1, 0, GO_TRACK_DIR }, { "trackdir", 1, 0, GO_TRACK_DIR }, { "copy-tracks", 1, 0, GO_COPY_TRACKS }, @@ -929,61 +930,60 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x076 v */ OPT_VERBOSE, /* 0x077 */ 0,0,0,0, 0,0,0,0, 0, /* 0x080 */ OPT_XHELP, - /* 0x081 */ OPT_ALLOW_ALL, - /* 0x082 */ OPT_COMPATIBLE, - /* 0x083 */ OPT_WIDTH, - /* 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, + /* 0x081 */ OPT_CONFIG, + /* 0x082 */ OPT_ALLOW_ALL, + /* 0x083 */ OPT_COMPATIBLE, + /* 0x084 */ OPT_WIDTH, + /* 0x085 */ OPT_MAX_WIDTH, + /* 0x086 */ OPT_DE, + /* 0x087 */ OPT_COLORS, + /* 0x088 */ OPT_NO_COLORS, + /* 0x089 */ OPT_CT_CODE, + /* 0x08a */ OPT_LE_CODE, + /* 0x08b */ OPT_CHDIR, + /* 0x08c */ OPT_ROUND, + /* 0x08d */ OPT_NO_ECHO, + /* 0x08e */ OPT_UTF_8, + /* 0x08f */ OPT_NO_UTF_8, + /* 0x090 */ OPT_LT_CLEAR, + /* 0x091 */ OPT_LT_ONLINE, + /* 0x092 */ OPT_LT_N_PLAYERS, + /* 0x093 */ OPT_LT_COND_BIT, + /* 0x094 */ OPT_LT_GAME_MODE, + /* 0x095 */ OPT_LT_ENGINE, + /* 0x096 */ OPT_LT_RANDOM, + /* 0x097 */ OPT_LEX_PURGE, + /* 0x098 */ OPT_LEX_RM_FEAT, + /* 0x099 */ OPT_FORCE, + /* 0x09a */ OPT_REPAIR_MAGICS, + /* 0x09b */ OPT_OLD, + /* 0x09c */ OPT_STD, + /* 0x09d */ OPT_NEW, + /* 0x09e */ OPT_EXTRACT, + /* 0x09f */ OPT_LE_DEFINE, + /* 0x0a0 */ OPT_LPAR, + /* 0x0a1 */ OPT_ALIAS, + /* 0x0a2 */ OPT_ENGINE, + /* 0x0a3 */ OPT_200CC, + /* 0x0a4 */ OPT_PERFMON, + /* 0x0a5 */ OPT_CUSTOM_TT, + /* 0x0a6 */ OPT_XPFLAGS, + /* 0x0a7 */ OPT_SPEEDOMETER, + /* 0x0a8 */ OPT_DEBUG, + /* 0x0a9 */ OPT_TRACK_DIR, + /* 0x0aa */ OPT_COPY_TRACKS, + /* 0x0ab */ OPT_MOVE_TRACKS, + /* 0x0ac */ OPT_MOVE1_TRACKS, + /* 0x0ad */ OPT_LINK_TRACKS, + /* 0x0ae */ OPT_LOAD_BMG, + /* 0x0af */ OPT_PATCH_BMG, + /* 0x0b0 */ OPT_MACRO_BMG, + /* 0x0b1 */ OPT_PATCH_NAMES, + /* 0x0b2 */ OPT_ORDER_BY, + /* 0x0b3 */ OPT_ORDER_ALL, + /* 0x0b4 */ OPT_NUMBER, + /* 0x0b5 */ OPT_SECTIONS, + /* 0x0b6 */ 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, /* 0x0e0 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, @@ -999,142 +999,154 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /////////////// opt_allowed_cmd_* /////////////// /////////////////////////////////////////////////////////////////////////////// -static u8 option_allowed_cmd_VERSION[45] = // cmd #1 +static u8 option_allowed_cmd_VERSION[43] = // cmd #1 { 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,0, 0,0,1 }; -static u8 option_allowed_cmd_HELP[45] = // cmd #2 +static u8 option_allowed_cmd_HELP[43] = // 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 }; -static u8 option_allowed_cmd_ARGTEST[45] = // cmd #3 +static u8 option_allowed_cmd_CONFIG[43] = // cmd #3 +{ + 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 +}; + +static u8 option_allowed_cmd_ARGTEST[43] = // 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 }; -static u8 option_allowed_cmd_TEST[45] = // cmd #4 +static u8 option_allowed_cmd_TEST[43] = // cmd #5 { 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, - 1,1,1,1,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[45] = // cmd #5 +static u8 option_allowed_cmd_COLORS[43] = // cmd #6 { 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 }; -static u8 option_allowed_cmd_ERROR[45] = // cmd #6 +static u8 option_allowed_cmd_ERROR[43] = // cmd #7 { 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,1 + 0,0,0,0,0, 0,0,0,0,0, 0,0,1 }; -static u8 option_allowed_cmd_FILETYPE[45] = // cmd #7 +static u8 option_allowed_cmd_FILETYPE[43] = // cmd #8 { 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,1,0 + 0,0,0,0,0, 0,0,0,0,0, 0,1,0 }; -static u8 option_allowed_cmd_FILEATTRIB[45] = // cmd #8 +static u8 option_allowed_cmd_FILEATTRIB[43] = // cmd #9 { 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 }; -static u8 option_allowed_cmd_SYMBOLS[45] = // cmd #9 +static u8 option_allowed_cmd_SYMBOLS[43] = // cmd #10 { 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 }; -static u8 option_allowed_cmd_FUNCTIONS[45] = // cmd #10 +static u8 option_allowed_cmd_FUNCTIONS[43] = // cmd #11 { 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 }; -static u8 option_allowed_cmd_CALCULATE[45] = // cmd #11 +static u8 option_allowed_cmd_CALCULATE[43] = // 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 }; -static u8 option_allowed_cmd_FLOAT[45] = // cmd #12 +static u8 option_allowed_cmd_FLOAT[43] = // cmd #13 { 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 }; -static u8 option_allowed_cmd_EXPORT[45] = // cmd #13 +static u8 option_allowed_cmd_EXPORT[43] = // 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,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_DUMP[45] = // cmd #14 +static u8 option_allowed_cmd_DPAD[43] = // cmd #15 { - 0,0,1,0,0, 0,0,0,0,0, 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, 0,0,0,0,0, 0,0,0,0,0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,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_DL[45] = // cmd #15 +static u8 option_allowed_cmd_DUMP[43] = // cmd #16 { - 0,0,1,0,0, 0,0,0,0,0, 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, 0,0,0,0,0, 0,0,0,0,0 + 0,0,1,0,0, 0,0,0,0,0, 0,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,0, 0,0,0 }; -static u8 option_allowed_cmd_DLL[45] = // cmd #16 +static u8 option_allowed_cmd_DL[43] = // cmd #17 { - 0,0,1,0,0, 0,0,0,0,0, 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, 0,0,0,0,0, 0,0,0,0,0 + 0,0,1,0,0, 0,0,0,0,0, 0,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,0, 0,0,0 }; -static u8 option_allowed_cmd_BIN_DIFF[45] = // cmd #17 +static u8 option_allowed_cmd_DLL[43] = // cmd #18 +{ + 0,0,1,0,0, 0,0,0,0,0, 0,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,0, 0,0,0 +}; + +static u8 option_allowed_cmd_BIN_DIFF[43] = // 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 }; -static u8 option_allowed_cmd_PATCH[45] = // cmd #18 +static u8 option_allowed_cmd_PATCH[43] = // cmd #20 { - 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,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,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,0,0, + 0,0,0,1,1, 1,1,1,1,1, 1,1,0 }; -static u8 option_allowed_cmd_LPAR[45] = // cmd #19 +static u8 option_allowed_cmd_LPAR[43] = // cmd #21 { - 0,0,0,1,1, 1,0,0,0,0, 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,1,1,1, 1,1,1,1,0 + 0,0,0,1,1, 1,0,0,0,0, 0,1,1,1,1, 1,1,1,1,1, 1,0,0,0,0, 0,0,0,0,0, + 0,0,0,1,1, 1,1,1,1,1, 1,1,0 }; -static u8 option_allowed_cmd_CREATE[45] = // cmd #20 +static u8 option_allowed_cmd_CREATE[43] = // cmd #22 { - 0,0,0,1,1, 1,0,1,1,1, 1,0,1,0,1, 1,1,1,1,1, 1,1,1,0,0, 0,0,0,0,0, - 0,0,0,0,0, 1,1,1,1,1, 1,1,1,1,0 + 0,0,0,1,1, 1,0,1,1,1, 1,0,1,0,1, 1,1,1,1,1, 1,0,0,0,0, 0,0,0,0,0, + 0,0,0,1,1, 1,1,1,1,1, 1,1,0 }; -static u8 option_allowed_cmd_CAT[45] = // cmd #21 +static u8 option_allowed_cmd_CAT[43] = // cmd #23 { - 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,1,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,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,1,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,1,0 }; -static u8 option_allowed_cmd_DECODE[45] = // cmd #22 +static u8 option_allowed_cmd_DECODE[43] = // cmd #24 { - 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,1,0, - 0,0,0,0,0, 1,1,1,1,1, 1,1,1,1,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,1,0,0,0, + 0,0,0,1,1, 1,1,1,1,1, 1,1,0 }; -static u8 option_allowed_cmd_ENCODE[45] = // cmd #23 +static u8 option_allowed_cmd_ENCODE[43] = // cmd #25 { - 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,0, - 0,0,0,0,0, 1,1,1,1,1, 1,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,1,0,0,0, + 0,0,0,1,1, 1,1,1,1,1, 1,1,0 }; @@ -1148,6 +1160,7 @@ static const InfoOption_t * option_tab_tool[] = OptionInfo + OPT_VERSION, OptionInfo + OPT_HELP, OptionInfo + OPT_XHELP, + OptionInfo + OPT_CONFIG, OptionInfo + OPT_ALLOW_ALL, OptionInfo + OPT_COMPATIBLE, OptionInfo + OPT_WIDTH, @@ -1198,6 +1211,14 @@ static const InfoOption_t * option_tab_cmd_HELP[] = 0 }; +static const InfoOption_t * option_tab_cmd_CONFIG[] = +{ + OptionInfo + OPT_CONFIG, + &option_cmd_CONFIG_LONG, + + 0 +}; + static const InfoOption_t * option_tab_cmd_ARGTEST[] = { @@ -1281,6 +1302,12 @@ static const InfoOption_t * option_tab_cmd_EXPORT[] = 0 }; +static const InfoOption_t * option_tab_cmd_DPAD[] = +{ + + 0 +}; + static const InfoOption_t * option_tab_cmd_DUMP[] = { OptionInfo + OPT_LE_DEFINE, @@ -1292,6 +1319,7 @@ static const InfoOption_t * option_tab_cmd_DUMP[] = OptionInfo + OPT_CUSTOM_TT, OptionInfo + OPT_XPFLAGS, OptionInfo + OPT_SPEEDOMETER, + OptionInfo + OPT_DEBUG, OptionInfo + OPT_NONE, // separator @@ -1312,6 +1340,7 @@ static const InfoOption_t * option_tab_cmd_DL[] = OptionInfo + OPT_CUSTOM_TT, OptionInfo + OPT_XPFLAGS, OptionInfo + OPT_SPEEDOMETER, + OptionInfo + OPT_DEBUG, OptionInfo + OPT_NONE, // separator @@ -1332,6 +1361,7 @@ static const InfoOption_t * option_tab_cmd_DLL[] = OptionInfo + OPT_CUSTOM_TT, OptionInfo + OPT_XPFLAGS, OptionInfo + OPT_SPEEDOMETER, + OptionInfo + OPT_DEBUG, OptionInfo + OPT_NONE, // separator @@ -1360,6 +1390,7 @@ static const InfoOption_t * option_tab_cmd_PATCH[] = OptionInfo + OPT_CUSTOM_TT, OptionInfo + OPT_XPFLAGS, OptionInfo + OPT_SPEEDOMETER, + OptionInfo + OPT_DEBUG, OptionInfo + OPT_TRACK_DIR, OptionInfo + OPT_COPY_TRACKS, OptionInfo + OPT_MOVE_TRACKS, @@ -1395,6 +1426,7 @@ static const InfoOption_t * option_tab_cmd_LPAR[] = OptionInfo + OPT_CUSTOM_TT, OptionInfo + OPT_XPFLAGS, OptionInfo + OPT_SPEEDOMETER, + OptionInfo + OPT_DEBUG, OptionInfo + OPT_NONE, // separator @@ -1456,6 +1488,7 @@ static const InfoOption_t * option_tab_cmd_CREATE[] = OptionInfo + OPT_CUSTOM_TT, OptionInfo + OPT_XPFLAGS, OptionInfo + OPT_SPEEDOMETER, + OptionInfo + OPT_DEBUG, 0 }; @@ -1532,7 +1565,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, - 26, + 27, option_tab_tool, 0 }, @@ -1575,6 +1608,21 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = option_allowed_cmd_HELP }, + { CMD_CONFIG, + false, + false, + false, + "CONFIG", + 0, + "wlect CONFIG [options]...", + "Show all information about the search for the configuration file and" + " its content.", + 0, + 2, + option_tab_cmd_CONFIG, + option_allowed_cmd_CONFIG + }, + { CMD_ARGTEST, false, false, @@ -1750,6 +1798,20 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = option_allowed_cmd_EXPORT }, + { CMD_DPAD, + true, + false, + false, + "_DPAD", + 0, + "wszst DPAD number_or_code...", + "This hidden command decodes and encodes D-Pad suquences for LE-CODE.", + 0, + 0, + option_tab_cmd_DPAD, + option_allowed_cmd_DPAD + }, + { CMD_DUMP, false, false, @@ -1760,7 +1822,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "Print an information dump for each source file. LE-CODE binaries and" " LEX binaries are accepted as input.", 0, - 11, + 12, option_tab_cmd_DUMP, option_allowed_cmd_DUMP }, @@ -1774,7 +1836,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "wlect DL [source]...", "Short cut for 'DUMP --long'.", 0, - 11, + 12, option_tab_cmd_DL, option_allowed_cmd_DL }, @@ -1788,7 +1850,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "wlect DLL [source]...", "Short cut for 'DUMP --long --long'.", 0, - 11, + 12, option_tab_cmd_DLL, option_allowed_cmd_DLL }, @@ -1825,7 +1887,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "Read each LE-BIN file and patch it. Use --le-define to setup cups and" " tracks.", 0, - 23, + 24, option_tab_cmd_PATCH, option_allowed_cmd_PATCH }, @@ -1841,7 +1903,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " parameters and store them as LPAR text file. Print the result to" " standard output if no other destination is defined.", 0, - 21, + 22, option_tab_cmd_LPAR, option_allowed_cmd_LPAR }, @@ -1862,7 +1924,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " names) for a LEX text file with 1 section only. LPAR for an example" " LE-CODE parameter file.", 0, - 28, + 29, option_tab_cmd_CREATE, option_allowed_cmd_CREATE }, diff --git a/project/src/ui/ui-wlect.h b/project/src/ui/ui-wlect.h index f6a6d1e..6298234 100644 --- a/project/src/ui/ui-wlect.h +++ b/project/src/ui/ui-wlect.h @@ -75,9 +75,7 @@ typedef enum enumOptions OPT_CUSTOM_TT, OPT_XPFLAGS, OPT_SPEEDOMETER, - OPT_RESERVED_1B9, - OPT_RESERVED_1BA, - OPT_RESERVED_1BB, + OPT_DEBUG, OPT_TRACK_DIR, OPT_COPY_TRACKS, OPT_MOVE_TRACKS, @@ -101,13 +99,14 @@ typedef enum enumOptions OPT_IGNORE, OPT_SECTIONS, - OPT__N_SPECIFIC, // == 45 + OPT__N_SPECIFIC, // == 43 //----- global options ----- OPT_VERSION, OPT_HELP, OPT_XHELP, + OPT_CONFIG, OPT_ALLOW_ALL, OPT_COMPATIBLE, OPT_WIDTH, @@ -139,7 +138,7 @@ typedef enum enumOptions OPT_NEW, OPT_EXTRACT, - OPT__N_TOTAL // == 78 + OPT__N_TOTAL // == 77 } enumOptions; @@ -173,9 +172,7 @@ typedef enum enumOptions // OB_CUSTOM_TT = 1llu << OPT_CUSTOM_TT, // OB_XPFLAGS = 1llu << OPT_XPFLAGS, // OB_SPEEDOMETER = 1llu << OPT_SPEEDOMETER, -// OB_RESERVED_1B9 = 1llu << OPT_RESERVED_1B9, -// OB_RESERVED_1BA = 1llu << OPT_RESERVED_1BA, -// OB_RESERVED_1BB = 1llu << OPT_RESERVED_1BB, +// OB_DEBUG = 1llu << OPT_DEBUG, // OB_TRACK_DIR = 1llu << OPT_TRACK_DIR, // OB_COPY_TRACKS = 1llu << OPT_COPY_TRACKS, // OB_MOVE_TRACKS = 1llu << OPT_MOVE_TRACKS, @@ -216,9 +213,7 @@ typedef enum enumOptions // | OB_CUSTOM_TT // | OB_XPFLAGS // | OB_SPEEDOMETER -// | OB_RESERVED_1B9 -// | OB_RESERVED_1BA -// | OB_RESERVED_1BB, +// | OB_DEBUG, // // OB_GRP_PATCH = OB_LE_DEFINE // | OB_LPAR @@ -244,6 +239,8 @@ typedef enum enumOptions // // OB_CMD_HELP = ~(u64)0, // +// OB_CMD_CONFIG = OB_LONG, +// // OB_CMD_ARGTEST = ~(u64)0, // // OB_CMD_TEST = ~(u64)0, @@ -273,6 +270,8 @@ typedef enum enumOptions // // OB_CMD_EXPORT = 0, // +// OB_CMD_DPAD = 0, +// // OB_CMD_DUMP = OB_GRP_PATCH // | OB_LONG // | OB_GRP_PATCH, @@ -330,6 +329,7 @@ typedef enum enumCommands CMD_VERSION, CMD_HELP, + CMD_CONFIG, CMD_ARGTEST, CMD_TEST, CMD_COLORS, @@ -341,6 +341,7 @@ typedef enum enumCommands CMD_CALCULATE, CMD_FLOAT, CMD_EXPORT, + CMD_DPAD, CMD_DUMP, CMD_DL, @@ -355,7 +356,7 @@ typedef enum enumCommands CMD_ENCODE, - CMD__N // == 24 + CMD__N // == 26 } enumCommands; @@ -393,6 +394,7 @@ typedef enum enumGetOpt GO_VERBOSE = 'v', GO_XHELP = 0x80, + GO_CONFIG, GO_ALLOW_ALL, GO_COMPATIBLE, GO_WIDTH, @@ -431,9 +433,7 @@ typedef enum enumGetOpt GO_CUSTOM_TT, GO_XPFLAGS, GO_SPEEDOMETER, - GO_RESERVED_1B9, - GO_RESERVED_1BA, - GO_RESERVED_1BB, + GO_DEBUG, GO_TRACK_DIR, GO_COPY_TRACKS, GO_MOVE_TRACKS, diff --git a/project/src/ui/ui-wmdlt.c b/project/src/ui/ui-wmdlt.c index ed922c2..d5822de 100644 --- a/project/src/ui/ui-wmdlt.c +++ b/project/src/ui/ui-wmdlt.c @@ -335,6 +335,15 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " commands included. Exit after printing." }, + { OPT_CONFIG, false, false, false, false, false, 0, "config", + "file", + "Define a configuration file or a directory as source. In later case," + " file 'wiimms-szs-tools.conf' is searched.\n" + " If option is not not set, then file 'wiimms-szs-tools.conf' is" + " searched in different directories. Use command 'wszst CONFIG' to get" + " more details." + }, + { OPT_ALLOW_ALL, false, false, false, false, false, 0, "allow-all", 0, "Usually commands accept only options with impact to the command. All" @@ -553,7 +562,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 == 64 + {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 65 }; @@ -581,6 +590,12 @@ static const InfoOption_t option_cmd_VERSION_LONG = "Print in long format. Ignored if option --sections is set." }; +static const InfoOption_t option_cmd_CONFIG_LONG = + { OPT_LONG, false, false, false, false, false, 'l', "long", + 0, + "If set, print the search list too." + }; + static const InfoOption_t option_cmd_TEST_VERBOSE = { OPT_VERBOSE, false, false, false, false, false, 'v', "verbose", 0, @@ -669,6 +684,7 @@ static const KeywordTab_t CommandTab[] = { CMD_VERSION, "VERSION", 0, 0 }, { CMD_HELP, "HELP", "H", 0 }, { CMD_HELP, "?", 0, 0 }, + { CMD_CONFIG, "CONFIG", 0, 0 }, { CMD_ARGTEST, "ARGTEST", 0, 0 }, { CMD_TEST, "TEST", 0, 0 }, { CMD_COLORS, "COLORS", 0, 0 }, @@ -703,6 +719,7 @@ static const struct option OptionLong[] = { "version", 0, 0, 'V' }, { "help", 0, 0, 'h' }, { "xhelp", 0, 0, GO_XHELP }, + { "config", 1, 0, GO_CONFIG }, { "allow-all", 0, 0, GO_ALLOW_ALL }, { "allowall", 0, 0, GO_ALLOW_ALL }, { "compatible", 1, 0, GO_COMPATIBLE }, @@ -838,46 +855,47 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x076 v */ OPT_VERBOSE, /* 0x077 */ 0,0,0,0, 0,0,0,0, 0, /* 0x080 */ OPT_XHELP, - /* 0x081 */ OPT_ALLOW_ALL, - /* 0x082 */ OPT_COMPATIBLE, - /* 0x083 */ OPT_WIDTH, - /* 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, + /* 0x081 */ OPT_CONFIG, + /* 0x082 */ OPT_ALLOW_ALL, + /* 0x083 */ OPT_COMPATIBLE, + /* 0x084 */ OPT_WIDTH, + /* 0x085 */ OPT_MAX_WIDTH, + /* 0x086 */ OPT_DE, + /* 0x087 */ OPT_COLORS, + /* 0x088 */ OPT_NO_COLORS, + /* 0x089 */ OPT_CT_CODE, + /* 0x08a */ OPT_LE_CODE, + /* 0x08b */ OPT_CHDIR, + /* 0x08c */ OPT_MDL, + /* 0x08d */ OPT_SCALE, + /* 0x08e */ OPT_SHIFT, + /* 0x08f */ OPT_XSS, + /* 0x090 */ OPT_YSS, + /* 0x091 */ OPT_ZSS, + /* 0x092 */ OPT_ROT, + /* 0x093 */ OPT_XROT, + /* 0x094 */ OPT_YROT, + /* 0x095 */ OPT_ZROT, + /* 0x096 */ OPT_TRANSLATE, + /* 0x097 */ OPT_NULL, + /* 0x098 */ OPT_NEXT, + /* 0x099 */ OPT_ASCALE, + /* 0x09a */ OPT_AROT, + /* 0x09b */ OPT_TFORM_SCRIPT, + /* 0x09c */ OPT_ROUND, + /* 0x09d */ OPT_NO_ECHO, + /* 0x09e */ OPT_UTF_8, + /* 0x09f */ OPT_NO_UTF_8, + /* 0x0a0 */ OPT_FORCE, + /* 0x0a1 */ OPT_REPAIR_MAGICS, + /* 0x0a2 */ OPT_TINY, + /* 0x0a3 */ OPT_OLD, + /* 0x0a4 */ OPT_STD, + /* 0x0a5 */ OPT_NEW, + /* 0x0a6 */ OPT_EXTRACT, + /* 0x0a7 */ OPT_NUMBER, + /* 0x0a8 */ OPT_SECTIONS, + /* 0x0a9 */ 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, @@ -906,109 +924,115 @@ static u8 option_allowed_cmd_HELP[33] = // cmd #2 1,1,1 }; -static u8 option_allowed_cmd_ARGTEST[33] = // cmd #3 +static u8 option_allowed_cmd_CONFIG[33] = // cmd #3 +{ + 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 +}; + +static u8 option_allowed_cmd_ARGTEST[33] = // 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 }; -static u8 option_allowed_cmd_TEST[33] = // cmd #4 +static u8 option_allowed_cmd_TEST[33] = // cmd #5 { 1,1,1,1,1, 1,1,1,1,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[33] = // cmd #5 +static u8 option_allowed_cmd_COLORS[33] = // cmd #6 { 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 }; -static u8 option_allowed_cmd_ERROR[33] = // cmd #6 +static u8 option_allowed_cmd_ERROR[33] = // cmd #7 { 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 }; -static u8 option_allowed_cmd_FILETYPE[33] = // cmd #7 +static u8 option_allowed_cmd_FILETYPE[33] = // cmd #8 { 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,1,0 }; -static u8 option_allowed_cmd_FILEATTRIB[33] = // cmd #8 +static u8 option_allowed_cmd_FILEATTRIB[33] = // cmd #9 { 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 }; -static u8 option_allowed_cmd_SYMBOLS[33] = // cmd #9 +static u8 option_allowed_cmd_SYMBOLS[33] = // cmd #10 { 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 }; -static u8 option_allowed_cmd_FUNCTIONS[33] = // cmd #10 +static u8 option_allowed_cmd_FUNCTIONS[33] = // cmd #11 { 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 }; -static u8 option_allowed_cmd_CALCULATE[33] = // cmd #11 +static u8 option_allowed_cmd_CALCULATE[33] = // 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 }; -static u8 option_allowed_cmd_MATRIX[33] = // cmd #12 +static u8 option_allowed_cmd_MATRIX[33] = // cmd #13 { 0,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,1,0,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_FLOAT[33] = // cmd #13 +static u8 option_allowed_cmd_FLOAT[33] = // cmd #14 { 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 }; -static u8 option_allowed_cmd_EXPORT[33] = // cmd #14 +static u8 option_allowed_cmd_EXPORT[33] = // 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 }; -static u8 option_allowed_cmd_CAT[33] = // cmd #15 +static u8 option_allowed_cmd_CAT[33] = // cmd #16 { 0,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,1,1, 0,1,1,0,0, 0,0,0,0,0, 0,1,0 }; -static u8 option_allowed_cmd_DECODE[33] = // cmd #16 +static u8 option_allowed_cmd_DECODE[33] = // cmd #17 { 0,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,1,1, 0,1,1,1,1, 1,1,1,1,1, 1,1,0 }; -static u8 option_allowed_cmd_ENCODE[33] = // cmd #17 +static u8 option_allowed_cmd_ENCODE[33] = // cmd #18 { 0,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,0,0, 0,1,1,1,1, 1,1,1,1,1, 1,1,0 }; -static u8 option_allowed_cmd_STRINGS[33] = // cmd #18 +static u8 option_allowed_cmd_STRINGS[33] = // cmd #19 { 0,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,1,1, 0,1,1,0,0, 0,0,0,0,0, 0,1,0 }; -static u8 option_allowed_cmd_GEOMETRY[33] = // cmd #19 +static u8 option_allowed_cmd_GEOMETRY[33] = // cmd #20 { 0,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,1,1, 0,1,1,0,0, 0,0,0,0,0, 0,1,0 }; -static u8 option_allowed_cmd_XTEST[33] = // cmd #20 +static u8 option_allowed_cmd_XTEST[33] = // cmd #21 { 0,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,0,0,1,1, 0,1,1,0,0, 0,0,0,0,0, 0,1,0 @@ -1025,6 +1049,7 @@ static const InfoOption_t * option_tab_tool[] = OptionInfo + OPT_VERSION, OptionInfo + OPT_HELP, OptionInfo + OPT_XHELP, + OptionInfo + OPT_CONFIG, OptionInfo + OPT_ALLOW_ALL, OptionInfo + OPT_COMPATIBLE, OptionInfo + OPT_WIDTH, @@ -1069,6 +1094,14 @@ static const InfoOption_t * option_tab_cmd_HELP[] = 0 }; +static const InfoOption_t * option_tab_cmd_CONFIG[] = +{ + OptionInfo + OPT_CONFIG, + &option_cmd_CONFIG_LONG, + + 0 +}; + static const InfoOption_t * option_tab_cmd_ARGTEST[] = { @@ -1398,7 +1431,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, - 23, + 24, option_tab_tool, 0 }, @@ -1441,6 +1474,21 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = option_allowed_cmd_HELP }, + { CMD_CONFIG, + false, + false, + false, + "CONFIG", + 0, + "wmdlt CONFIG [options]...", + "Show all information about the search for the configuration file and" + " its content.", + 0, + 2, + option_tab_cmd_CONFIG, + option_allowed_cmd_CONFIG + }, + { CMD_ARGTEST, false, false, diff --git a/project/src/ui/ui-wmdlt.h b/project/src/ui/ui-wmdlt.h index 5eda1ff..f3a6a45 100644 --- a/project/src/ui/ui-wmdlt.h +++ b/project/src/ui/ui-wmdlt.h @@ -96,6 +96,7 @@ typedef enum enumOptions OPT_VERSION, OPT_HELP, OPT_XHELP, + OPT_CONFIG, OPT_ALLOW_ALL, OPT_COMPATIBLE, OPT_WIDTH, @@ -125,7 +126,7 @@ typedef enum enumOptions OPT_NEW, OPT_EXTRACT, - OPT__N_TOTAL // == 64 + OPT__N_TOTAL // == 65 } enumOptions; @@ -210,6 +211,8 @@ typedef enum enumOptions // // OB_CMD_HELP = ~(u64)0, // +// OB_CMD_CONFIG = OB_LONG, +// // OB_CMD_ARGTEST = ~(u64)0, // // OB_CMD_TEST = ~(u64)0, @@ -293,6 +296,7 @@ typedef enum enumCommands CMD_VERSION, CMD_HELP, + CMD_CONFIG, CMD_ARGTEST, CMD_TEST, CMD_COLORS, @@ -314,7 +318,7 @@ typedef enum enumCommands CMD_GEOMETRY, CMD_XTEST, - CMD__N // == 21 + CMD__N // == 22 } enumCommands; @@ -353,6 +357,7 @@ typedef enum enumGetOpt GO_VERBOSE = 'v', GO_XHELP = 0x80, + GO_CONFIG, GO_ALLOW_ALL, GO_COMPATIBLE, GO_WIDTH, diff --git a/project/src/ui/ui-wpatt.c b/project/src/ui/ui-wpatt.c index 8078f4e..72d6cc8 100644 --- a/project/src/ui/ui-wpatt.c +++ b/project/src/ui/ui-wpatt.c @@ -177,6 +177,15 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " commands included. Exit after printing." }, + { OPT_CONFIG, false, false, false, false, false, 0, "config", + "file", + "Define a configuration file or a directory as source. In later case," + " file 'wiimms-szs-tools.conf' is searched.\n" + " If option is not not set, then file 'wiimms-szs-tools.conf' is" + " searched in different directories. Use command 'wszst CONFIG' to get" + " more details." + }, + { OPT_ALLOW_ALL, false, false, false, false, false, 0, "allow-all", 0, "Usually commands accept only options with impact to the command. All" @@ -384,7 +393,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 == 48 + {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 49 }; @@ -412,6 +421,12 @@ static const InfoOption_t option_cmd_VERSION_LONG = "Print in long format. Ignored if option --sections is set." }; +static const InfoOption_t option_cmd_CONFIG_LONG = + { OPT_LONG, false, false, false, false, false, 'l', "long", + 0, + "If set, print the search list too." + }; + static const InfoOption_t option_cmd_COLORS_LONG = { OPT_LONG, false, false, false, false, false, 'l', "long", 0, @@ -470,6 +485,7 @@ static const KeywordTab_t CommandTab[] = { CMD_VERSION, "VERSION", 0, 0 }, { CMD_HELP, "HELP", "H", 0 }, { CMD_HELP, "?", 0, 0 }, + { CMD_CONFIG, "CONFIG", 0, 0 }, { CMD_ARGTEST, "ARGTEST", 0, 0 }, { CMD_TEST, "TEST", 0, 0 }, { CMD_COLORS, "COLORS", 0, 0 }, @@ -500,6 +516,7 @@ static const struct option OptionLong[] = { "version", 0, 0, 'V' }, { "help", 0, 0, 'h' }, { "xhelp", 0, 0, GO_XHELP }, + { "config", 1, 0, GO_CONFIG }, { "allow-all", 0, 0, GO_ALLOW_ALL }, { "allowall", 0, 0, GO_ALLOW_ALL }, { "compatible", 1, 0, GO_COMPATIBLE }, @@ -617,30 +634,31 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x076 v */ OPT_VERBOSE, /* 0x077 */ 0,0,0,0, 0,0,0,0, 0, /* 0x080 */ OPT_XHELP, - /* 0x081 */ OPT_ALLOW_ALL, - /* 0x082 */ OPT_COMPATIBLE, - /* 0x083 */ OPT_WIDTH, - /* 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, + /* 0x081 */ OPT_CONFIG, + /* 0x082 */ OPT_ALLOW_ALL, + /* 0x083 */ OPT_COMPATIBLE, + /* 0x084 */ OPT_WIDTH, + /* 0x085 */ OPT_MAX_WIDTH, + /* 0x086 */ OPT_DE, + /* 0x087 */ OPT_COLORS, + /* 0x088 */ OPT_NO_COLORS, + /* 0x089 */ OPT_CT_CODE, + /* 0x08a */ OPT_LE_CODE, + /* 0x08b */ OPT_CHDIR, + /* 0x08c */ OPT_ROUND, + /* 0x08d */ OPT_NO_ECHO, + /* 0x08e */ OPT_PAT, + /* 0x08f */ OPT_UTF_8, + /* 0x090 */ OPT_NO_UTF_8, + /* 0x091 */ OPT_FORCE, + /* 0x092 */ OPT_REPAIR_MAGICS, + /* 0x093 */ OPT_OLD, + /* 0x094 */ OPT_STD, + /* 0x095 */ OPT_NEW, + /* 0x096 */ OPT_EXTRACT, + /* 0x097 */ OPT_NUMBER, + /* 0x098 */ OPT_SECTIONS, + /* 0x099 */ 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, @@ -668,72 +686,77 @@ static u8 option_allowed_cmd_HELP[18] = // cmd #2 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1 }; -static u8 option_allowed_cmd_ARGTEST[18] = // cmd #3 +static u8 option_allowed_cmd_CONFIG[18] = // cmd #3 +{ + 0,0,1,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0 +}; + +static u8 option_allowed_cmd_ARGTEST[18] = // cmd #4 { 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1 }; -static u8 option_allowed_cmd_TEST[18] = // cmd #4 +static u8 option_allowed_cmd_TEST[18] = // cmd #5 { 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1 }; -static u8 option_allowed_cmd_COLORS[18] = // cmd #5 +static u8 option_allowed_cmd_COLORS[18] = // cmd #6 { 0,0,1,0,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_ERROR[18] = // cmd #6 +static u8 option_allowed_cmd_ERROR[18] = // cmd #7 { 0,0,1,1,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,1 }; -static u8 option_allowed_cmd_FILETYPE[18] = // cmd #7 +static u8 option_allowed_cmd_FILETYPE[18] = // cmd #8 { 0,0,1,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0 }; -static u8 option_allowed_cmd_FILEATTRIB[18] = // cmd #8 +static u8 option_allowed_cmd_FILEATTRIB[18] = // cmd #9 { 0,0,0,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_SYMBOLS[18] = // cmd #9 +static u8 option_allowed_cmd_SYMBOLS[18] = // cmd #10 { 0,0,0,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_FUNCTIONS[18] = // cmd #10 +static u8 option_allowed_cmd_FUNCTIONS[18] = // cmd #11 { 0,0,1,1,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_CALCULATE[18] = // cmd #11 +static u8 option_allowed_cmd_CALCULATE[18] = // cmd #12 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_FLOAT[18] = // cmd #12 +static u8 option_allowed_cmd_FLOAT[18] = // cmd #13 { 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_EXPORT[18] = // cmd #13 +static u8 option_allowed_cmd_EXPORT[18] = // cmd #14 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0 }; -static u8 option_allowed_cmd_CAT[18] = // cmd #14 +static u8 option_allowed_cmd_CAT[18] = // cmd #15 { 0,0,0,1,1, 0,1,1,0,0, 0,0,0,0,0, 0,1,0 }; -static u8 option_allowed_cmd_DECODE[18] = // cmd #15 +static u8 option_allowed_cmd_DECODE[18] = // cmd #16 { 0,0,0,1,1, 0,1,1,1,1, 1,1,1,1,1, 1,1,0 }; -static u8 option_allowed_cmd_ENCODE[18] = // cmd #16 +static u8 option_allowed_cmd_ENCODE[18] = // cmd #17 { 0,0,0,0,0, 0,1,1,1,1, 1,1,1,1,1, 1,1,0 }; @@ -749,6 +772,7 @@ static const InfoOption_t * option_tab_tool[] = OptionInfo + OPT_VERSION, OptionInfo + OPT_HELP, OptionInfo + OPT_XHELP, + OptionInfo + OPT_CONFIG, OptionInfo + OPT_ALLOW_ALL, OptionInfo + OPT_COMPATIBLE, OptionInfo + OPT_WIDTH, @@ -792,6 +816,14 @@ static const InfoOption_t * option_tab_cmd_HELP[] = 0 }; +static const InfoOption_t * option_tab_cmd_CONFIG[] = +{ + OptionInfo + OPT_CONFIG, + &option_cmd_CONFIG_LONG, + + 0 +}; + static const InfoOption_t * option_tab_cmd_ARGTEST[] = { @@ -947,7 +979,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, - 22, + 23, option_tab_tool, 0 }, @@ -990,6 +1022,21 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = option_allowed_cmd_HELP }, + { CMD_CONFIG, + false, + false, + false, + "CONFIG", + 0, + "wpatt CONFIG [options]...", + "Show all information about the search for the configuration file and" + " its content.", + 0, + 2, + option_tab_cmd_CONFIG, + option_allowed_cmd_CONFIG + }, + { CMD_ARGTEST, false, false, diff --git a/project/src/ui/ui-wpatt.h b/project/src/ui/ui-wpatt.h index 59b7c5f..4f510dc 100644 --- a/project/src/ui/ui-wpatt.h +++ b/project/src/ui/ui-wpatt.h @@ -81,6 +81,7 @@ typedef enum enumOptions OPT_VERSION, OPT_HELP, OPT_XHELP, + OPT_CONFIG, OPT_ALLOW_ALL, OPT_COMPATIBLE, OPT_WIDTH, @@ -109,7 +110,7 @@ typedef enum enumOptions OPT_NEW, OPT_EXTRACT, - OPT__N_TOTAL // == 48 + OPT__N_TOTAL // == 49 } enumOptions; @@ -163,6 +164,8 @@ typedef enum enumOptions // // OB_CMD_HELP = ~(u64)0, // +// OB_CMD_CONFIG = OB_LONG, +// // OB_CMD_ARGTEST = ~(u64)0, // // OB_CMD_TEST = ~(u64)0, @@ -221,6 +224,7 @@ typedef enum enumCommands CMD_VERSION, CMD_HELP, + CMD_CONFIG, CMD_ARGTEST, CMD_TEST, CMD_COLORS, @@ -237,7 +241,7 @@ typedef enum enumCommands CMD_DECODE, CMD_ENCODE, - CMD__N // == 17 + CMD__N // == 18 } enumCommands; @@ -276,6 +280,7 @@ typedef enum enumGetOpt GO_VERBOSE = 'v', GO_XHELP = 0x80, + GO_CONFIG, GO_ALLOW_ALL, GO_COMPATIBLE, GO_WIDTH, diff --git a/project/src/ui/ui-wstrt.c b/project/src/ui/ui-wstrt.c index 3796b3b..8b83b7c 100644 --- a/project/src/ui/ui-wstrt.c +++ b/project/src/ui/ui-wstrt.c @@ -479,6 +479,15 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " commands included. Exit after printing." }, + { OPT_CONFIG, false, false, false, false, false, 0, "config", + "file", + "Define a configuration file or a directory as source. In later case," + " file 'wiimms-szs-tools.conf' is searched.\n" + " If option is not not set, then file 'wiimms-szs-tools.conf' is" + " searched in different directories. Use command 'wszst CONFIG' to get" + " more details." + }, + { OPT_AT_DUMMY, false, true, false, false, false, '@', "@", 0, "" @@ -840,7 +849,7 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " directory." }, - {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 112 + {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 113 }; @@ -862,6 +871,12 @@ static const InfoOption_t option_cmd_VERSION_LONG = "Print in long format. Ignored if option --sections is set." }; +static const InfoOption_t option_cmd_CONFIG_LONG = + { OPT_LONG, false, false, false, false, false, 'l', "long", + 0, + "If set, print the search list too." + }; + static const InfoOption_t option_cmd_COLORS_LONG = { OPT_LONG, false, false, false, false, false, 'l', "long", 0, @@ -967,6 +982,7 @@ static const KeywordTab_t CommandTab[] = { CMD_VERSION, "VERSION", 0, 0 }, { CMD_HELP, "HELP", "H", 0 }, { CMD_HELP, "?", 0, 0 }, + { CMD_CONFIG, "CONFIG", 0, 0 }, { CMD_ARGTEST, "ARGTEST", 0, 0 }, { CMD_TEST, "TEST", 0, 0 }, { CMD_COLORS, "COLORS", 0, 0 }, @@ -1003,6 +1019,7 @@ static const struct option OptionLong[] = { "version", 0, 0, 'V' }, { "help", 0, 0, 'h' }, { "xhelp", 0, 0, GO_XHELP }, + { "config", 1, 0, GO_CONFIG }, { "@", 0, 0, '@' }, { "allow-all", 0, 0, GO_ALLOW_ALL }, { "allowall", 0, 0, GO_ALLOW_ALL }, @@ -1212,95 +1229,96 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x076 v */ OPT_VERBOSE, /* 0x077 */ 0,0,0,0, 0,0,0,0, 0, /* 0x080 */ OPT_XHELP, - /* 0x081 */ OPT_ALLOW_ALL, - /* 0x082 */ OPT_COMPATIBLE, - /* 0x083 */ OPT_WIDTH, - /* 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, + /* 0x081 */ OPT_CONFIG, + /* 0x082 */ OPT_ALLOW_ALL, + /* 0x083 */ OPT_COMPATIBLE, + /* 0x084 */ OPT_WIDTH, + /* 0x085 */ OPT_MAX_WIDTH, + /* 0x086 */ OPT_DE, + /* 0x087 */ OPT_COLORS, + /* 0x088 */ OPT_NO_COLORS, + /* 0x089 */ OPT_CT_CODE, + /* 0x08a */ OPT_LE_CODE, + /* 0x08b */ OPT_CHDIR, + /* 0x08c */ OPT_VS_REGION, + /* 0x08d */ OPT_BT_REGION, + /* 0x08e */ OPT_ALL_RANKS, + /* 0x08f */ OPT_POINTS, + /* 0x090 */ OPT_CHEAT, + /* 0x091 */ OPT_HTTPS, + /* 0x092 */ OPT_DOMAIN, + /* 0x093 */ OPT_WIIMMFI, + /* 0x094 */ OPT_TWIIMMFI, + /* 0x095 */ OPT_WC24, + /* 0x096 */ OPT_WCODE, + /* 0x097 */ OPT_ADD_WCODE, + /* 0x098 */ OPT_PB_MODE, + /* 0x099 */ OPT_PATCHED_BY, + /* 0x09a */ OPT_VS, + /* 0x09b */ OPT_VS2, + /* 0x09c */ OPT_BT, + /* 0x09d */ OPT_BT2, + /* 0x09e */ OPT_CANNON, + /* 0x09f */ OPT_MENO, + /* 0x0a0 */ OPT_UTF_8, + /* 0x0a1 */ OPT_NO_UTF_8, + /* 0x0a2 */ OPT_FORCE, + /* 0x0a3 */ OPT_REPAIR_MAGICS, + /* 0x0a4 */ OPT_OLD, + /* 0x0a5 */ OPT_STD, + /* 0x0a6 */ OPT_NEW, + /* 0x0a7 */ OPT_EXTRACT, + /* 0x0a8 */ OPT_NUMBER, + /* 0x0a9 */ OPT_CLEAN_DOL, + /* 0x0aa */ OPT_ADD_LECODE, + /* 0x0ab */ OPT_ADD_CTCODE, + /* 0x0ac */ OPT_CT_DIR, + /* 0x0ad */ OPT_MOVE_D8, + /* 0x0ae */ OPT_ADD_SECTION, + /* 0x0af */ OPT_FULL_GCH, + /* 0x0b0 */ OPT_GCT_NO_SEP, + /* 0x0b1 */ OPT_GCT_SEP, + /* 0x0b2 */ OPT_GCT_ASM_SEP, + /* 0x0b3 */ OPT_GCT_LIST, + /* 0x0b4 */ OPT_GCT_MOVE, + /* 0x0b5 */ OPT_GCT_ADDR, + /* 0x0b6 */ OPT_GCT_SPACE, + /* 0x0b7 */ OPT_ALLOW_USER_GCH, + /* 0x0b8 */ OPT_CREATE_SECT, + /* 0x0b9 */ OPT_WPF, + /* 0x0ba */ OPT_SECTIONS, + /* 0x0bb */ OPT_VADDR, + /* 0x0bc */ OPT_FADDR, + /* 0x0bd */ OPT_SNAME, + /* 0x0be */ OPT_INT1, + /* 0x0bf */ OPT_INT2, + /* 0x0c0 */ OPT_INT3, + /* 0x0c1 */ OPT_INT4, + /* 0x0c2 */ OPT_INT5, + /* 0x0c3 */ OPT_INT6, + /* 0x0c4 */ OPT_INT7, + /* 0x0c5 */ OPT_INT8, + /* 0x0c6 */ OPT_FLOAT, + /* 0x0c7 */ OPT_DOUBLE, + /* 0x0c8 */ OPT_LE, + /* 0x0c9 */ OPT_BE, + /* 0x0ca */ OPT_ZEROS, + /* 0x0cb */ OPT_HEX, + /* 0x0cc */ OPT_DEC, + /* 0x0cd */ OPT_C_SYNTAX, + /* 0x0ce */ OPT_ADDR, + /* 0x0cf */ OPT_ALIGN, + /* 0x0d0 */ OPT_TRIGGER, + /* 0x0d1 */ OPT_NO_ADDR, + /* 0x0d2 */ OPT_NO_NUMBERS, + /* 0x0d3 */ OPT_NO_TEXT, + /* 0x0d4 */ OPT_FORMAT, + /* 0x0d5 */ OPT_NO_NULL, + /* 0x0d6 */ OPT_NARROW, + /* 0x0d7 */ OPT_SMALL, + /* 0x0d8 */ OPT_WIDE, + /* 0x0d9 */ OPT_BYTES, + /* 0x0da */ 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, @@ -1328,133 +1346,140 @@ static u8 option_allowed_cmd_HELP[62] = // cmd #2 1,1 }; -static u8 option_allowed_cmd_ARGTEST[62] = // cmd #3 +static u8 option_allowed_cmd_CONFIG[62] = // cmd #3 +{ + 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 +}; + +static u8 option_allowed_cmd_ARGTEST[62] = // 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 }; -static u8 option_allowed_cmd_TEST[62] = // cmd #4 +static u8 option_allowed_cmd_TEST[62] = // cmd #5 { 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,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[62] = // cmd #5 +static u8 option_allowed_cmd_COLORS[62] = // cmd #6 { 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 }; -static u8 option_allowed_cmd_ERROR[62] = // cmd #6 +static u8 option_allowed_cmd_ERROR[62] = // cmd #7 { 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, 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_FILETYPE[62] = // cmd #7 +static u8 option_allowed_cmd_FILETYPE[62] = // cmd #8 { 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,0,0, 0,0,0,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[62] = // cmd #8 +static u8 option_allowed_cmd_FILEATTRIB[62] = // cmd #9 { 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 }; -static u8 option_allowed_cmd_RAWDUMP[62] = // cmd #9 +static u8 option_allowed_cmd_RAWDUMP[62] = // cmd #10 { 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 }; -static u8 option_allowed_cmd_DUMP[62] = // cmd #10 +static u8 option_allowed_cmd_DUMP[62] = // cmd #11 { 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 }; -static u8 option_allowed_cmd_CDUMP[62] = // cmd #11 +static u8 option_allowed_cmd_CDUMP[62] = // 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 }; -static u8 option_allowed_cmd_HEXDUMP[62] = // cmd #12 +static u8 option_allowed_cmd_HEXDUMP[62] = // cmd #13 { 0,0,0,0,0, 0,0,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,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_HTTPS[62] = // cmd #13 +static u8 option_allowed_cmd_HTTPS[62] = // cmd #14 { 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 }; -static u8 option_allowed_cmd_EXTRACT[62] = // cmd #14 +static u8 option_allowed_cmd_EXTRACT[62] = // cmd #15 { 0,0,0,0,0, 0,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 }; -static u8 option_allowed_cmd_TRACKS[62] = // cmd #15 +static u8 option_allowed_cmd_TRACKS[62] = // cmd #16 { 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_ARENAS[62] = // cmd #16 +static u8 option_allowed_cmd_ARENAS[62] = // cmd #17 { 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_FILES[62] = // cmd #17 +static u8 option_allowed_cmd_FILES[62] = // 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,0,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_FIND[62] = // cmd #18 +static u8 option_allowed_cmd_FIND[62] = // cmd #19 { 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 }; -static u8 option_allowed_cmd_POINTS[62] = // cmd #19 +static u8 option_allowed_cmd_POINTS[62] = // cmd #20 { 0,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 }; -static u8 option_allowed_cmd_ANALYZE[62] = // cmd #20 +static u8 option_allowed_cmd_ANALYZE[62] = // cmd #21 { 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 }; -static u8 option_allowed_cmd_PATCH[62] = // cmd #21 +static u8 option_allowed_cmd_PATCH[62] = // cmd #22 { 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,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, @@ -1472,6 +1497,7 @@ static const InfoOption_t * option_tab_tool[] = OptionInfo + OPT_VERSION, OptionInfo + OPT_HELP, OptionInfo + OPT_XHELP, + OptionInfo + OPT_CONFIG, OptionInfo + OPT_ALLOW_ALL, OptionInfo + OPT_COMPATIBLE, OptionInfo + OPT_WIDTH, @@ -1534,6 +1560,14 @@ static const InfoOption_t * option_tab_cmd_HELP[] = 0 }; +static const InfoOption_t * option_tab_cmd_CONFIG[] = +{ + OptionInfo + OPT_CONFIG, + &option_cmd_CONFIG_LONG, + + 0 +}; + static const InfoOption_t * option_tab_cmd_ARGTEST[] = { @@ -1850,7 +1884,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, - 38, + 39, option_tab_tool, 0 }, @@ -1893,6 +1927,21 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = option_allowed_cmd_HELP }, + { CMD_CONFIG, + false, + false, + false, + "CONFIG", + 0, + "wstrt CONFIG [options]...", + "Show all information about the search for the configuration file and" + " its content.", + 0, + 2, + option_tab_cmd_CONFIG, + option_allowed_cmd_CONFIG + }, + { CMD_ARGTEST, false, false, diff --git a/project/src/ui/ui-wstrt.h b/project/src/ui/ui-wstrt.h index 21a3b74..9c23bd8 100644 --- a/project/src/ui/ui-wstrt.h +++ b/project/src/ui/ui-wstrt.h @@ -125,6 +125,7 @@ typedef enum enumOptions OPT_VERSION, OPT_HELP, OPT_XHELP, + OPT_CONFIG, OPT_AT_DUMMY, OPT_ALLOW_ALL, OPT_COMPATIBLE, @@ -173,7 +174,7 @@ typedef enum enumOptions OPT_CLEAN_DOL, OPT_CT_DIR, - OPT__N_TOTAL // == 112 + OPT__N_TOTAL // == 113 } enumOptions; @@ -298,6 +299,8 @@ typedef enum enumOptions // // OB_CMD_HELP = ~(u64)0, // +// OB_CMD_CONFIG = OB_LONG, +// // OB_CMD_ARGTEST = ~(u64)0, // // OB_CMD_TEST = ~(u64)0, @@ -385,6 +388,7 @@ typedef enum enumCommands CMD_VERSION, CMD_HELP, + CMD_CONFIG, CMD_ARGTEST, CMD_TEST, CMD_COLORS, @@ -408,7 +412,7 @@ typedef enum enumCommands CMD_ANALYZE, CMD_PATCH, - CMD__N // == 22 + CMD__N // == 23 } enumCommands; @@ -447,6 +451,7 @@ typedef enum enumGetOpt GO_VERBOSE = 'v', GO_XHELP = 0x80, + GO_CONFIG, GO_ALLOW_ALL, GO_COMPATIBLE, GO_WIDTH, diff --git a/project/src/ui/ui-wszst.c b/project/src/ui/ui-wszst.c index b35a60c..4504bc0 100644 --- a/project/src/ui/ui-wszst.c +++ b/project/src/ui/ui-wszst.c @@ -689,6 +689,11 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " if *any* set keywords match." }, + { OPT_INSTALL, false, false, false, false, false, 0, "install", + 0, + "Manage configuration for an installation." + }, + { OPT_ANALYZE, false, true, false, false, true, 0, "analyze", "outfile", "Run in analyze mode and write results to the entered file." @@ -1122,7 +1127,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 == 133 + {0,0,0,0,0,0,0,0,0,0}, // OPT__N_SPECIFIC == 134 //----- global options ----- @@ -1142,6 +1147,15 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " commands included. Exit after printing." }, + { OPT_CONFIG, false, false, false, false, false, 0, "config", + "file", + "Define a configuration file or a directory as source. In later case," + " file 'wiimms-szs-tools.conf' is searched.\n" + " If option is not not set, then file 'wiimms-szs-tools.conf' is" + " searched in different directories. Use command 'wszst CONFIG' to get" + " more details." + }, + { OPT_ALLOW_ALL, false, false, false, false, false, 0, "allow-all", 0, "Usually commands accept only options with impact to the command. All" @@ -1590,7 +1604,7 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = "directory", "Define an alternative directory as autoadd library. The default is," " that the sub-directory called './auto-add/' of all search paths are" - " used. Use 'wszst test -vvvv' for tests." + " used. Use 'wszst config -ll' for tests." }, { OPT_UTF_8, false, true, false, false, true, 0, "utf-8", @@ -1691,7 +1705,7 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = { OPT_VAR, false, false, false, false, false, 0, "var", "varname", "Use VARNAME as variable name or prefix on script output. The default" - " variabe name is 'res'." + " value is 'res' for variables and 'res_' as prefix." }, { OPT_ARRAY, false, false, false, false, false, 0, "array", @@ -1739,7 +1753,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 == 207 + {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 209 }; @@ -1748,6 +1762,13 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = /////////////// alternate option infos /////////////// /////////////////////////////////////////////////////////////////////////////// +static const InfoOption_t option_grp_SCRIPT_SECTIONS = + { OPT_SECTIONS, false, false, false, false, false, 0, "sections", + 0, + "Dump info using configuration or section syntax. Use '--var name' as" + " prefix." + }; + static const InfoOption_t option_grp_TEXTOUT_NO_HEADER = { OPT_NO_HEADER, false, false, false, false, false, 'H', "no-header", 0, @@ -1782,6 +1803,20 @@ static const InfoOption_t option_cmd_VERSION_LONG = " twice, append developing settings." }; +static const InfoOption_t option_cmd_CONFIG_LONG = + { OPT_LONG, false, false, false, false, false, 'l', "long", + 0, + "If set, print the search list too. If set twice, print the auto-add" + " search list too. This option is ignored, if any script output is" + " enabled." + }; + +static const InfoOption_t option_cmd_CONFIG_BRIEF = + { OPT_BRIEF, false, false, false, false, false, 'B', "brief", + 0, + "If printed as sections, exclude all comments." + }; + static const InfoOption_t option_cmd_TEST_VERBOSE = { OPT_VERBOSE, false, false, false, false, false, 'v', "verbose", 0, @@ -2202,6 +2237,7 @@ static const KeywordTab_t CommandTab[] = { CMD_VERSION, "VERSION", 0, 0 }, { CMD_HELP, "HELP", "H", 0 }, { CMD_HELP, "?", 0, 0 }, + { CMD_CONFIG, "CONFIG", 0, 0 }, { CMD_ARGTEST, "ARGTEST", 0, 0 }, { CMD_TEST, "TEST", 0, 0 }, { CMD_COLORS, "COLORS", 0, 0 }, @@ -2299,6 +2335,7 @@ static const struct option OptionLong[] = { "version", 0, 0, 'V' }, { "help", 0, 0, 'h' }, { "xhelp", 0, 0, GO_XHELP }, + { "config", 1, 0, GO_CONFIG }, { "allow-all", 0, 0, GO_ALLOW_ALL }, { "allowall", 0, 0, GO_ALLOW_ALL }, { "compatible", 1, 0, GO_COMPATIBLE }, @@ -2523,6 +2560,7 @@ static const struct option OptionLong[] = { "fmodes", 1, 0, GO_FMODES }, { "feature-modes", 1, 0, GO_FMODES }, { "featuremodes", 1, 0, GO_FMODES }, + { "install", 0, 0, GO_INSTALL }, { "analyze", 1, 0, GO_ANALYZE }, { "analyse", 1, 0, GO_ANALYZE }, { "analyze-mode", 1, 0, GO_ANALYZE_MODE }, @@ -2708,179 +2746,181 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x078 x */ OPT_TRANSFORM, /* 0x079 */ 0,0,0,0, 0,0,0, /* 0x080 */ OPT_XHELP, - /* 0x081 */ OPT_ALLOW_ALL, - /* 0x082 */ OPT_COMPATIBLE, - /* 0x083 */ OPT_WIDTH, - /* 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, + /* 0x081 */ OPT_CONFIG, + /* 0x082 */ OPT_ALLOW_ALL, + /* 0x083 */ OPT_COMPATIBLE, + /* 0x084 */ OPT_WIDTH, + /* 0x085 */ OPT_MAX_WIDTH, + /* 0x086 */ OPT_DE, + /* 0x087 */ OPT_COLORS, + /* 0x088 */ OPT_NO_COLORS, + /* 0x089 */ OPT_CT_CODE, + /* 0x08a */ OPT_LE_CODE, + /* 0x08b */ OPT_CHDIR, + /* 0x08c */ OPT_TOUCH, + /* 0x08d */ OPT_AUTO, + /* 0x08e */ OPT_SET_FLAGS, + /* 0x08f */ OPT_SET_SCALE, + /* 0x090 */ OPT_SET_ROT, + /* 0x091 */ OPT_SET_X, + /* 0x092 */ OPT_SET_Y, + /* 0x093 */ OPT_SET_Z, + /* 0x094 */ OPT_XCENTER, + /* 0x095 */ OPT_YCENTER, + /* 0x096 */ OPT_ZCENTER, + /* 0x097 */ OPT_CENTER, + /* 0x098 */ OPT_SCALE, + /* 0x099 */ OPT_SHIFT, + /* 0x09a */ OPT_XSS, + /* 0x09b */ OPT_YSS, + /* 0x09c */ OPT_ZSS, + /* 0x09d */ OPT_ROT, + /* 0x09e */ OPT_XROT, + /* 0x09f */ OPT_YROT, + /* 0x0a0 */ OPT_ZROT, + /* 0x0a1 */ OPT_YPOS, + /* 0x0a2 */ OPT_TRANSLATE, + /* 0x0a3 */ OPT_NULL, + /* 0x0a4 */ OPT_NEXT, + /* 0x0a5 */ OPT_ASCALE, + /* 0x0a6 */ OPT_AROT, + /* 0x0a7 */ OPT_TFORM_SCRIPT, + /* 0x0a8 */ OPT_MINIMAP, + /* 0x0a9 */ OPT_RM_GOBJ, + /* 0x0aa */ OPT_BATTLE, + /* 0x0ab */ OPT_EXPORT_FLAGS, + /* 0x0ac */ OPT_ROUTE_OPTIONS, + /* 0x0ad */ OPT_WIM0, + /* 0x0ae */ OPT_SLOT, + /* 0x0af */ OPT_LOAD_KCL, + /* 0x0b0 */ OPT_KCL, + /* 0x0b1 */ OPT_KCL_FLAG, + /* 0x0b2 */ OPT_KCL_SCRIPT, + /* 0x0b3 */ OPT_TRI_AREA, + /* 0x0b4 */ OPT_TRI_HEIGHT, + /* 0x0b5 */ OPT_FLAG_FILE, + /* 0x0b6 */ OPT_XTRIDATA, + /* 0x0b7 */ OPT_KMP, + /* 0x0b8 */ OPT_SPEED_MOD, + /* 0x0b9 */ OPT_KTPT2, + /* 0x0ba */ OPT_TFORM_KMP, + /* 0x0bb */ OPT_REPAIR_XPF, + /* 0x0bc */ OPT_GAMEMODES, + /* 0x0bd */ OPT_MDL, + /* 0x0be */ OPT_PAT, + /* 0x0bf */ OPT_PATCH_FILE, + /* 0x0c0 */ OPT_KMG_LIMIT, + /* 0x0c1 */ OPT_KMG_COPY, + /* 0x0c2 */ OPT_LT_CLEAR, + /* 0x0c3 */ OPT_LT_ONLINE, + /* 0x0c4 */ OPT_LT_N_PLAYERS, + /* 0x0c5 */ OPT_LT_COND_BIT, + /* 0x0c6 */ OPT_LT_GAME_MODE, + /* 0x0c7 */ OPT_LT_ENGINE, + /* 0x0c8 */ OPT_LT_RANDOM, + /* 0x0c9 */ OPT_LEX_PURGE, + /* 0x0ca */ OPT_LEX_FEATURES, + /* 0x0cb */ OPT_LEX_RM_FEAT, + /* 0x0cc */ OPT_LOAD_BMG, + /* 0x0cd */ OPT_PATCH_BMG, + /* 0x0ce */ OPT_MACRO_BMG, + /* 0x0cf */ OPT_FILTER_BMG, + /* 0x0d0 */ OPT_CACHE, + /* 0x0d1 */ OPT_CNAME, + /* 0x0d2 */ OPT_ID, + /* 0x0d3 */ OPT_BASE64, + /* 0x0d4 */ OPT_DB64, + /* 0x0d5 */ OPT_CODING, + /* 0x0d6 */ OPT_VERIFY, + /* 0x0d7 */ OPT_ROUND, + /* 0x0d8 */ OPT_PIPE, + /* 0x0d9 */ OPT_DELTA, + /* 0x0da */ OPT_DIFF, + /* 0x0db */ OPT_EPSILON, + /* 0x0dc */ OPT_BMG_ENDIAN, + /* 0x0dd */ OPT_BMG_ENCODING, + /* 0x0de */ OPT_BMG_INF_SIZE, + /* 0x0df */ OPT_BMG_MID, + /* 0x0e0 */ OPT_FORCE_ATTRIB, + /* 0x0e1 */ OPT_DEF_ATTRIB, + /* 0x0e2 */ OPT_NO_ATTRIB, + /* 0x0e3 */ OPT_X_ESCAPES, + /* 0x0e4 */ OPT_OLD_ESCAPES, + /* 0x0e5 */ OPT_NO_BMG_COLORS, + /* 0x0e6 */ OPT_BMG_COLORS, + /* 0x0e7 */ OPT_NO_BMG_INLINE, + /* 0x0e8 */ OPT_AUTOADD_PATH, + /* 0x0e9 */ OPT_STRIP, + /* 0x0ea */ OPT_UTF_8, + /* 0x0eb */ OPT_NO_UTF_8, + /* 0x0ec */ OPT_FORCE, + /* 0x0ed */ OPT_REPAIR_MAGICS, + /* 0x0ee */ OPT_TINY, + /* 0x0ef */ OPT_YAZ0, + /* 0x0f0 */ OPT_YAZ1, + /* 0x0f1 */ OPT_XYZ, + /* 0x0f2 */ OPT_BZ, + /* 0x0f3 */ OPT_SH, + /* 0x0f4 */ OPT_BASH, + /* 0x0f5 */ OPT_JSON, + /* 0x0f6 */ OPT_PHP, + /* 0x0f7 */ OPT_MAKEDOC, + /* 0x0f8 */ OPT_VAR, + /* 0x0f9 */ OPT_ARRAY, + /* 0x0fa */ OPT_AVAR, + /* 0x0fb */ OPT_CASE, + /* 0x0fc */ OPT_PMODES, + /* 0x0fd */ OPT_FMODES, + /* 0x0fe */ OPT_INSTALL, + /* 0x0ff */ OPT_ANALYZE, + /* 0x100 */ OPT_ANALYZE_MODE, + /* 0x101 */ OPT_OLD, + /* 0x102 */ OPT_STD, + /* 0x103 */ OPT_NEW, + /* 0x104 */ OPT_EXTRACT, + /* 0x105 */ OPT_NUMBER, + /* 0x106 */ OPT_REMOVE_SRC, + /* 0x107 */ OPT_IGNORE_SETUP, + /* 0x108 */ OPT_PURGE, + /* 0x109 */ OPT_ALIGN_U8, + /* 0x10a */ OPT_ALIGN_PACK, + /* 0x10b */ OPT_ALIGN_BRRES, + /* 0x10c */ OPT_ALIGN_BREFF, + /* 0x10d */ OPT_ALIGN_BREFT, + /* 0x10e */ OPT_ALIGN, + /* 0x10f */ OPT_ENCODE_ALL, + /* 0x110 */ OPT_ENCODE_IMG, + /* 0x111 */ OPT_NO_ENCODE, + /* 0x112 */ OPT_NO_RECURSE, + /* 0x113 */ OPT_AUTO_ADD, + /* 0x114 */ OPT_NO_ECHO, + /* 0x115 */ OPT_PT_DIR, + /* 0x116 */ OPT_RM_AIPARAM, + /* 0x117 */ OPT_U8, + /* 0x118 */ OPT_SZS, + /* 0x119 */ OPT_WU8, + /* 0x11a */ OPT_XWU8, + /* 0x11b */ OPT_WBZ, + /* 0x11c */ OPT_PACK, + /* 0x11d */ OPT_BRRES, + /* 0x11e */ OPT_BREFF, + /* 0x11f */ OPT_BREFT, + /* 0x120 */ OPT_NO_COMPRESS, + /* 0x121 */ OPT_FAST, + /* 0x122 */ OPT_LINKS, + /* 0x123 */ OPT_BASEDIR, + /* 0x124 */ OPT_DECODE, + /* 0x125 */ OPT_MIPMAPS, + /* 0x126 */ OPT_NO_MIPMAPS, + /* 0x127 */ OPT_N_MIPMAPS, + /* 0x128 */ OPT_MAX_MIPMAPS, + /* 0x129 */ OPT_MIPMAP_SIZE, + /* 0x12a */ OPT_FAST_MIPMAPS, + /* 0x12b */ OPT_CMPR_DEFAULT, + /* 0x12c */ OPT_CUT, + /* 0x12d */ OPT_RAW, + /* 0x12e */ OPT_SECTIONS, + /* 0x12f */ 0,0,0,0, 0,0,0, }; // @@ -2888,670 +2928,679 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /////////////// opt_allowed_cmd_* /////////////// /////////////////////////////////////////////////////////////////////////////// -static u8 option_allowed_cmd_VERSION[133] = // cmd #1 +static u8 option_allowed_cmd_VERSION[134] = // 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, 0,0,1 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1 }; -static u8 option_allowed_cmd_HELP[133] = // cmd #2 +static u8 option_allowed_cmd_HELP[134] = // 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,1,1,1 +}; + +static u8 option_allowed_cmd_CONFIG[134] = // cmd #3 +{ + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,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,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,1 }; -static u8 option_allowed_cmd_ARGTEST[133] = // cmd #3 +static u8 option_allowed_cmd_ARGTEST[134] = // 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,1,1,1 }; -static u8 option_allowed_cmd_TEST[133] = // cmd #4 +static u8 option_allowed_cmd_TEST[134] = // cmd #5 { 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, - 1,1,1,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[133] = // cmd #5 +static u8 option_allowed_cmd_COLORS[134] = // 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,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_ERROR[133] = // cmd #6 +static u8 option_allowed_cmd_ERROR[134] = // 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,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,1 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1 }; -static u8 option_allowed_cmd_FILETYPE[133] = // cmd #7 +static u8 option_allowed_cmd_FILETYPE[134] = // 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,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,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,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 }; -static u8 option_allowed_cmd_FILEATTRIB[133] = // cmd #8 +static u8 option_allowed_cmd_FILEATTRIB[134] = // 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,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,0 }; -static u8 option_allowed_cmd_BRSUB[133] = // cmd #9 +static u8 option_allowed_cmd_BRSUB[134] = // 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,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,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,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 }; -static u8 option_allowed_cmd_SYMBOLS[133] = // cmd #10 +static u8 option_allowed_cmd_SYMBOLS[134] = // 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,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,0 }; -static u8 option_allowed_cmd_FUNCTIONS[133] = // cmd #11 +static u8 option_allowed_cmd_FUNCTIONS[134] = // 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,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,0,0,0 }; -static u8 option_allowed_cmd_CALCULATE[133] = // cmd #12 +static u8 option_allowed_cmd_CALCULATE[134] = // cmd #13 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,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[133] = // cmd #13 +static u8 option_allowed_cmd_MATRIX[134] = // cmd #14 { 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,0,0,0 }; -static u8 option_allowed_cmd_FLOAT[133] = // cmd #14 +static u8 option_allowed_cmd_FLOAT[134] = // 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,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,0,0,0 }; -static u8 option_allowed_cmd_VR_CALC[133] = // cmd #15 +static u8 option_allowed_cmd_VR_CALC[134] = // 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,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,0,0,0 }; -static u8 option_allowed_cmd_VR_RACE[133] = // cmd #16 +static u8 option_allowed_cmd_VR_RACE[134] = // 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,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,0,0 }; -static u8 option_allowed_cmd_AUTOADD[133] = // cmd #17 +static u8 option_allowed_cmd_AUTOADD[134] = // 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,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,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,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,0,0 }; -static u8 option_allowed_cmd_TRACKS[133] = // cmd #18 +static u8 option_allowed_cmd_TRACKS[134] = // 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,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,0,0, 1,0,0 + 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0 }; -static u8 option_allowed_cmd_SCANCACHE[133] = // cmd #19 +static u8 option_allowed_cmd_SCANCACHE[134] = // 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,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,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_EXPORT[133] = // cmd #20 +static u8 option_allowed_cmd_EXPORT[134] = // 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,0,0,0 }; -static u8 option_allowed_cmd_CODE[133] = // cmd #21 +static u8 option_allowed_cmd_CODE[134] = // 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,0,0,0 }; -static u8 option_allowed_cmd_RECODE[133] = // cmd #22 +static u8 option_allowed_cmd_RECODE[134] = // 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, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,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[133] = // cmd #23 +static u8 option_allowed_cmd_SUBFILE[134] = // 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,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,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,0,0 }; -static u8 option_allowed_cmd_TESTNORM[133] = // cmd #24 +static u8 option_allowed_cmd_TESTNORM[134] = // 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,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,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[133] = // cmd #25 +static u8 option_allowed_cmd_LIST[134] = // 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,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,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[133] = // cmd #26 +static u8 option_allowed_cmd_LIST_L[134] = // 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,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,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[133] = // cmd #27 +static u8 option_allowed_cmd_LIST_LL[134] = // 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,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,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[133] = // cmd #28 +static u8 option_allowed_cmd_LIST_LLL[134] = // 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,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,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[133] = // cmd #29 +static u8 option_allowed_cmd_LIST_A[134] = // 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,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,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[133] = // cmd #30 +static u8 option_allowed_cmd_LIST_LA[134] = // 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,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,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,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[133] = // cmd #31 +static u8 option_allowed_cmd_NAME_REF[134] = // 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,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,0,0,0 }; -static u8 option_allowed_cmd_ILIST[133] = // cmd #32 +static u8 option_allowed_cmd_ILIST[134] = // 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,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,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[133] = // cmd #33 +static u8 option_allowed_cmd_ILIST_L[134] = // 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,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,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[133] = // cmd #34 +static u8 option_allowed_cmd_ILIST_LL[134] = // 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,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,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[133] = // cmd #35 +static u8 option_allowed_cmd_ILIST_A[134] = // 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,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,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[133] = // cmd #36 +static u8 option_allowed_cmd_ILIST_LA[134] = // 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,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,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,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[133] = // cmd #37 +static u8 option_allowed_cmd_MEMORY[134] = // 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,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,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[133] = // cmd #38 +static u8 option_allowed_cmd_MEMORY_A[134] = // 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,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,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,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[133] = // cmd #39 +static u8 option_allowed_cmd_DUMP[134] = // 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,0,0,0,0, 0,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,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,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[133] = // cmd #40 +static u8 option_allowed_cmd_SHA1[134] = // 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,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,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,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[133] = // cmd #41 +static u8 option_allowed_cmd_ANALYZE[134] = // 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,0, 0,0,0,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,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,0,1 }; -static u8 option_allowed_cmd_FEATURES[133] = // cmd #42 +static u8 option_allowed_cmd_FEATURES[134] = // 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,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,1,1,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,0,1 }; -static u8 option_allowed_cmd_DISTRIBUTION[133] = // cmd #43 +static u8 option_allowed_cmd_DISTRIBUTION[134] = // 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,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,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,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[133] = // cmd #44 +static u8 option_allowed_cmd_DIFF[134] = // cmd #45 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,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,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[133] = // cmd #45 +static u8 option_allowed_cmd_CHECK[134] = // 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,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,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,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[133] = // cmd #46 +static u8 option_allowed_cmd_SLOTS[134] = // cmd #47 { 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,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,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[133] = // cmd #47 +static u8 option_allowed_cmd_STGI[134] = // 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,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,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,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 }; -static u8 option_allowed_cmd_ISARENA[133] = // cmd #48 +static u8 option_allowed_cmd_ISARENA[134] = // cmd #49 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,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,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,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 }; -static u8 option_allowed_cmd_NORMALIZE[133] = // cmd #49 +static u8 option_allowed_cmd_NORMALIZE[134] = // 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, 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,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[133] = // cmd #50 +static u8 option_allowed_cmd_PATCH[134] = // 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, 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,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[133] = // cmd #51 +static u8 option_allowed_cmd_COPY[134] = // 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,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,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,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[133] = // cmd #52 +static u8 option_allowed_cmd_DUPLICATE[134] = // cmd #53 { 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, 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,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[133] = // cmd #53 +static u8 option_allowed_cmd_MINIMAP[134] = // cmd #54 { 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,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,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[133] = // cmd #54 +static u8 option_allowed_cmd_COMPRESS[134] = // 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, 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,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[133] = // cmd #55 +static u8 option_allowed_cmd_DECOMPRESS[134] = // 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, 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,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[133] = // cmd #56 +static u8 option_allowed_cmd_ENCODE[134] = // 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, 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,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[133] = // cmd #57 +static u8 option_allowed_cmd_CREATE[134] = // 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,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,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[133] = // cmd #58 +static u8 option_allowed_cmd_UPDATE[134] = // 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,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,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,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[133] = // cmd #59 +static u8 option_allowed_cmd_EXTRACT[134] = // 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,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,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[133] = // cmd #60 +static u8 option_allowed_cmd_XDECODE[134] = // 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,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,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[133] = // cmd #61 +static u8 option_allowed_cmd_XEXPORT[134] = // 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,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,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[133] = // cmd #62 +static u8 option_allowed_cmd_XALL[134] = // cmd #63 { 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,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,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[133] = // cmd #63 +static u8 option_allowed_cmd_XCOMMON[134] = // 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, 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,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,0,0 }; -static u8 option_allowed_cmd_BINARY[133] = // cmd #64 +static u8 option_allowed_cmd_BINARY[134] = // 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,0,0,0, 0,0,0,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,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,0,0 }; -static u8 option_allowed_cmd_TEXT[133] = // cmd #65 +static u8 option_allowed_cmd_TEXT[134] = // 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,1,1,1, 1,1,0,1,1, 1,1,0,0,0, + 1,1,1,1,1, 1,1,1,1,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,1,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[133] = // cmd #66 +static u8 option_allowed_cmd_CAT[134] = // 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,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,0, 0,1,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,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,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[133] = // cmd #67 +static u8 option_allowed_cmd_BMG[134] = // cmd #68 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,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,0, 0,1,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,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 }; -static u8 option_allowed_cmd_KCL[133] = // cmd #68 +static u8 option_allowed_cmd_KCL[134] = // 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,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 + 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,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[133] = // cmd #69 +static u8 option_allowed_cmd_KMP[134] = // cmd #70 { 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,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,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[133] = // cmd #70 +static u8 option_allowed_cmd_LEX[134] = // 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,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,1,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,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 }; -static u8 option_allowed_cmd_INFO[133] = // cmd #71 +static u8 option_allowed_cmd_INFO[134] = // 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, 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,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 }; -static u8 option_allowed_cmd_GHOST[133] = // cmd #72 +static u8 option_allowed_cmd_GHOST[134] = // 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,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,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,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,0,1 }; -static u8 option_allowed_cmd_YAZDUMP[133] = // cmd #73 +static u8 option_allowed_cmd_YAZDUMP[134] = // 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,0, 0,0,0,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,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,0,0 }; -static u8 option_allowed_cmd_VEHICLE[133] = // cmd #74 +static u8 option_allowed_cmd_VEHICLE[134] = // cmd #75 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 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,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,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,0,0 }; @@ -3565,6 +3614,7 @@ static const InfoOption_t * option_tab_tool[] = OptionInfo + OPT_VERSION, OptionInfo + OPT_HELP, OptionInfo + OPT_XHELP, + OptionInfo + OPT_CONFIG, OptionInfo + OPT_ALLOW_ALL, OptionInfo + OPT_COMPATIBLE, OptionInfo + OPT_WIDTH, @@ -3654,6 +3704,30 @@ static const InfoOption_t * option_tab_cmd_HELP[] = 0 }; +static const InfoOption_t * option_tab_cmd_CONFIG[] = +{ + OptionInfo + OPT_CONFIG, + OptionInfo + OPT_INSTALL, + OptionInfo + OPT_AUTOADD_PATH, + &option_cmd_CONFIG_LONG, + + OptionInfo + OPT_NONE, // separator + + &option_grp_SCRIPT_SECTIONS, + 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, + &option_cmd_CONFIG_BRIEF, + + 0 +}; + static const InfoOption_t * option_tab_cmd_ARGTEST[] = { @@ -4804,6 +4878,7 @@ static const InfoOption_t * option_tab_cmd_ANALYZE[] = OptionInfo + OPT_NONE, // separator + &option_grp_SCRIPT_SECTIONS, OptionInfo + OPT_SH, OptionInfo + OPT_BASH, OptionInfo + OPT_JSON, @@ -4831,6 +4906,7 @@ static const InfoOption_t * option_tab_cmd_FEATURES[] = OptionInfo + OPT_NONE, // separator + &option_grp_SCRIPT_SECTIONS, OptionInfo + OPT_SH, OptionInfo + OPT_BASH, OptionInfo + OPT_JSON, @@ -6664,6 +6740,7 @@ static const InfoOption_t * option_tab_cmd_GHOST[] = OptionInfo + OPT_NONE, // separator + &option_grp_SCRIPT_SECTIONS, OptionInfo + OPT_SH, OptionInfo + OPT_BASH, OptionInfo + OPT_JSON, @@ -6728,10 +6805,10 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = 0, "wszst [option]... command [option|parameter|file]...", "Wiimms SZS Tool : List, compare, (de-)compress, extract and create" - " SZS, U8, PACK, BRRES, BREFF, BREFT and RARC archives. It is also a" - " wrapper to all other tools.", + " SZS, U8, PACK, BRRES, BREFF and BREFT archives. Additonally, RARC" + " archive can be extracted. It is also a wrapper to all other tools.", 0, - 65, + 66, option_tab_tool, 0 }, @@ -6774,6 +6851,22 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = option_allowed_cmd_HELP }, + { CMD_CONFIG, + false, + false, + false, + "CONFIG", + 0, + "wszst CONFIG [options]...", + "Show all information about the search for the configuration file and" + " its content. The command can also export the settings for scripts or" + " can create or update configuration files.", + 0, + 15, + option_tab_cmd_CONFIG, + option_allowed_cmd_CONFIG + }, + { CMD_ARGTEST, false, false, @@ -7394,7 +7487,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "wszst ANALYZE [source]...", "Analyse track files and print results in machine readable format.", 0, - 14, + 15, option_tab_cmd_ANALYZE, option_allowed_cmd_ANALYZE }, @@ -7408,7 +7501,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "wszst FEATURES [source]...", "Analyse track files and a feature list in machine readable format.", 0, - 17, + 18, option_tab_cmd_FEATURES, option_allowed_cmd_FEATURES }, @@ -7683,9 +7776,9 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "CREATE", "C", "wszst CREATE [source_dir]...", - "Create SZS, U8, PACK, BRRES, BREFF, BREFT or RARC archives by adding" - " all not hidden files of the directory structure. Create and/or" - " encode sub files if necessary. The default destination is '%P/%N%T'.", + "Create SZS, U8, PACK, BRRES, BREFF or BREFT archives by adding all" + " not hidden files of the directory structure. Create and/or encode" + " sub files if necessary. The default destination is '%P/%N%T'.", 0, 95, option_tab_cmd_CREATE, @@ -7933,7 +8026,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "wszst GHOST [source]...", "Analyse each file and print a summary about the ghost data.", 0, - 13, + 14, option_tab_cmd_GHOST, option_allowed_cmd_GHOST }, @@ -7945,8 +8038,8 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "YAZDUMP", "YD", "wszst YAZDUMP [szs]...", - "Analyze YAZ compression print a dump to stdout. Ignore files without" - " YAZ compression.", + "Analyze YAZ compression and print a dump to stdout. Ignore files" + " without YAZ compression.", 0, 8, option_tab_cmd_YAZDUMP, diff --git a/project/src/ui/ui-wszst.h b/project/src/ui/ui-wszst.h index fabeee1..bcbc993 100644 --- a/project/src/ui/ui-wszst.h +++ b/project/src/ui/ui-wszst.h @@ -129,6 +129,7 @@ typedef enum enumOptions OPT_STRIP, OPT_PMODES, OPT_FMODES, + OPT_INSTALL, OPT_ANALYZE, OPT_ANALYZE_MODE, OPT_SOURCE, @@ -189,13 +190,14 @@ typedef enum enumOptions OPT_RAW, OPT_SECTIONS, - OPT__N_SPECIFIC, // == 133 + OPT__N_SPECIFIC, // == 134 //----- global options ----- OPT_VERSION, OPT_HELP, OPT_XHELP, + OPT_CONFIG, OPT_ALLOW_ALL, OPT_COMPATIBLE, OPT_WIDTH, @@ -268,7 +270,7 @@ typedef enum enumOptions OPT_NEW, OPT_EXTRACT, - OPT__N_TOTAL // == 207 + OPT__N_TOTAL // == 209 } enumOptions; @@ -356,6 +358,7 @@ typedef enum enumOptions // OB_STRIP = 1llu << OPT_STRIP, // OB_PMODES = 1llu << OPT_PMODES, // OB_FMODES = 1llu << OPT_FMODES, +// OB_INSTALL = 1llu << OPT_INSTALL, // OB_ANALYZE = 1llu << OPT_ANALYZE, // OB_ANALYZE_MODE = 1llu << OPT_ANALYZE_MODE, // OB_SOURCE = 1llu << OPT_SOURCE, @@ -471,7 +474,7 @@ typedef enum enumOptions // | OB_XWU8 // | OB_WBZ, // -// OB_GRP_SCRIPT = 0, +// OB_GRP_SCRIPT = OB_SECTIONS, // // OB_GRP_ALIGN = OB_ALIGN_U8 // | OB_ALIGN_PACK @@ -558,6 +561,11 @@ typedef enum enumOptions // // OB_CMD_HELP = ~(u64)0, // +// OB_CMD_CONFIG = OB_INSTALL +// | OB_LONG +// | OB_GRP_SCRIPT +// | OB_BRIEF, +// // OB_CMD_ARGTEST = ~(u64)0, // // OB_CMD_TEST = ~(u64)0, @@ -925,6 +933,7 @@ typedef enum enumCommands CMD_VERSION, CMD_HELP, + CMD_CONFIG, CMD_ARGTEST, CMD_TEST, CMD_COLORS, @@ -1006,7 +1015,7 @@ typedef enum enumCommands CMD_VEHICLE, - CMD__N // == 75 + CMD__N // == 76 } enumCommands; @@ -1056,6 +1065,7 @@ typedef enum enumGetOpt GO_TRANSFORM = 'x', GO_XHELP = 0x80, + GO_CONFIG, GO_ALLOW_ALL, GO_COMPATIBLE, GO_WIDTH, @@ -1180,6 +1190,7 @@ typedef enum enumGetOpt GO_CASE, GO_PMODES, GO_FMODES, + GO_INSTALL, GO_ANALYZE, GO_ANALYZE_MODE, GO_OLD, diff --git a/project/src/ui/ui.def b/project/src/ui/ui.def index 722bdb5..0c8671f 100644 --- a/project/src/ui/ui.def +++ b/project/src/ui/ui.def @@ -7,8 +7,8 @@ #:def_tool( "wszst", \ "wszst [option]... command [option|parameter|@file]...", \ "Wiimms SZS Tool : List, compare, (de-)compress, extract and create" \ - " SZS, U8, PACK, BRRES, BREFF, BREFT and RARC archives. It is also a" \ - " wrapper to all other tools." ) + " SZS, U8, PACK, BRRES, BREFF and BREFT archives. Additonally, RARC" \ + " archive can be extracted. It is also a wrapper to all other tools." ) #:def_cmd( "VERSION", "VERSION", \ "wszst VERSION [ignored]...", \ @@ -29,6 +29,12 @@ " details about the declared command. The fourth variant prints an" \ " overview about all commands and all global options." ) +#:def_cmd( "CONFIG", "CONFIG", \ + "wszst CONFIG [options]...", \ + "Show all information about the search for the configuration file and" \ + " its content. The command can also export the settings for scripts or" \ + " can create or update configuration files." ) + #:def_cmd( "ARGTEST", "ARGTEST", \ "wszst ARGTEST ...", \ "This debug command accepts all kinds of parameters and prints one" \ @@ -366,10 +372,9 @@ #:def_cmd( "CREATE", "CREATE|C", \ "wszst CREATE [source_dir]...", \ - "Create SZS, U8, PACK, BRRES, BREFF, BREFT or RARC archives by adding" \ - " all not hidden files of the directory structure. Create and/or" \ - " encode sub files if necessary. The default destination is" \ - " @'%P/%N%T'@." ) + "Create SZS, U8, PACK, BRRES, BREFF or BREFT archives by adding all" \ + " not hidden files of the directory structure. Create and/or encode" \ + " sub files if necessary. The default destination is @'%P/%N%T'@." ) #:def_cmd( "UPDATE", "UPDATE|U", \ "wszst UPDATE [source]... [--source=] [--dest=]", \ @@ -465,8 +470,8 @@ #:def_cmd( "YAZDUMP", "YAZDUMP|YD", \ "wszst YAZDUMP [szs]...", \ - "Analyze YAZ compression print a dump to stdout. Ignore files without" \ - " YAZ compression." ) + "Analyze YAZ compression and print a dump to stdout. Ignore files" \ + " without YAZ compression." ) #:def_opt( "VERSION", "V|version", "G", \ "", \ @@ -481,6 +486,14 @@ "Stop parsing the command line and print a help message with all" \ " commands included. Exit after printing." ) +#:def_opt( "CONFIG", "config", "GP", \ + "file", \ + "Define a configuration file or a directory as source. In later case," \ + " file @'wiimms-szs-tools.conf'@ is searched.\n" \ + " If option is not not set, then file @'wiimms-szs-tools.conf'@ is" \ + " searched in different directories. Use command @'wszst CONFIG'@ to" \ + " get more details." ) + #:def_opt( "ALLOW_ALL", "allow-all|allowall", "G", \ "", \ "Usually commands accept only options with impact to the command. All" \ @@ -1379,7 +1392,7 @@ "directory", \ "Define an alternative directory as autoadd library. The default is," \ " that the sub-directory called './auto-add/' of all search paths are" \ - " used. Use {wszst test -vvvv} for tests." ) + " used. Use {wszst config -ll} for tests." ) #:def_opt( "TRANSFORM", "x|transform", "CP", \ "list", \ @@ -1485,7 +1498,7 @@ #:def_opt( "VAR", "var", "GP", \ "varname", \ "Use @VARNAME@ as variable name or prefix on script output. The" \ - " default variabe name is 'res'." ) + " default value is 'res' for variables and 'res_' as prefix." ) #:def_opt( "ARRAY", "array", "G", \ "", \ @@ -1504,6 +1517,10 @@ " @UPPER@ are set, then the lower/upper case of the variable names is" \ " adjusted accordingly." ) +#:def_opt( "INSTALL", "install", "C", \ + "", \ + "Manage configuration for an installation." ) + #:def_opt( "SOURCE", "s|source|src", "CP", \ "path", \ "Define a secondary source path (directory/file).\n" \ @@ -1883,6 +1900,69 @@ "", \ "" ) +#:def_cmd_opt( "CONFIG", "CONFIG", \ + "", \ + "" ) + +#:def_cmd_opt( "CONFIG", "INSTALL", \ + "", \ + "" ) + +#:def_cmd_opt( "CONFIG", "AUTOADD_PATH", \ + "", \ + "" ) + +#:def_cmd_opt( "CONFIG", "LONG", \ + "", \ + "If set, print the search list too. If set twice, print the auto-add" \ + " search list too. This option is ignored, if any script output is" \ + " enabled." ) + +#:def_cmd_opt( "CONFIG", "SECTIONS", \ + "", \ + "Dump info using configuration or section syntax. Use {--var name} as" \ + " prefix." ) + +#:def_cmd_opt( "CONFIG", "SH", \ + "", \ + "" ) + +#:def_cmd_opt( "CONFIG", "BASH", \ + "", \ + "" ) + +#:def_cmd_opt( "CONFIG", "JSON", \ + "", \ + "" ) + +#:def_cmd_opt( "CONFIG", "PHP", \ + "", \ + "" ) + +#:def_cmd_opt( "CONFIG", "MAKEDOC", \ + "", \ + "" ) + +#:def_cmd_opt( "CONFIG", "VAR", \ + "", \ + "" ) + +#:def_cmd_opt( "CONFIG", "ARRAY", \ + "", \ + "" ) + +#:def_cmd_opt( "CONFIG", "AVAR", \ + "", \ + "" ) + +#:def_cmd_opt( "CONFIG", "CASE", \ + "", \ + "" ) + +#:def_cmd_opt( "CONFIG", "BRIEF", \ + "", \ + "If printed as sections, exclude all comments." ) + #:def_cmd_opt( "TEST", "VERBOSE", \ "", \ "Print the matrices of transformations." ) @@ -5011,6 +5091,11 @@ "", \ "Suppress logging of input and output files." ) +#:def_cmd_opt( "ANALYZE", "SECTIONS", \ + "", \ + "Dump info using configuration or section syntax. Use {--var name} as" \ + " prefix." ) + #:def_cmd_opt( "ANALYZE", "SH", \ "", \ "" ) @@ -5072,6 +5157,11 @@ "", \ "Suppress logging of input and output files." ) +#:def_cmd_opt( "FEATURES", "SECTIONS", \ + "", \ + "Dump info using configuration or section syntax. Use {--var name} as" \ + " prefix." ) + #:def_cmd_opt( "FEATURES", "SH", \ "", \ "" ) @@ -10947,6 +11037,11 @@ "", \ "Suppress output of the printed filename." ) +#:def_cmd_opt( "GHOST", "SECTIONS", \ + "", \ + "Dump info using configuration or section syntax. Use {--var name} as" \ + " prefix." ) + #:def_cmd_opt( "GHOST", "SH", \ "", \ "" ) @@ -11081,6 +11176,11 @@ " details about the declared command. The fourth variant prints an" \ " overview about all commands and all global options." ) +#:def_cmd( "CONFIG", "CONFIG", \ + "wbmgt CONFIG [options]...", \ + "Show all information about the search for the configuration file and" \ + " its content." ) + #:def_cmd( "ARGTEST", "ARGTEST", \ "wbmgt ARGTEST ...", \ "This debug command accepts all kinds of parameters and prints one" \ @@ -11210,6 +11310,14 @@ "Stop parsing the command line and print a help message with all" \ " commands included. Exit after printing." ) +#:def_opt( "CONFIG", "config", "GP", \ + "file", \ + "Define a configuration file or a directory as source. In later case," \ + " file @'wiimms-szs-tools.conf'@ is searched.\n" \ + " If option is not not set, then file @'wiimms-szs-tools.conf'@ is" \ + " searched in different directories. Use command @'wszst CONFIG'@ to" \ + " get more details." ) + #:def_opt( "ALLOW_ALL", "allow-all|allowall", "G", \ "", \ "Usually commands accept only options with impact to the command. All" \ @@ -11591,6 +11699,14 @@ "", \ "" ) +#:def_cmd_opt( "CONFIG", "CONFIG", \ + "", \ + "" ) + +#:def_cmd_opt( "CONFIG", "LONG", \ + "", \ + "If set, print the search list too." ) + #:def_cmd_opt( "COLORS", "COLORS", \ "", \ "" ) @@ -12317,6 +12433,11 @@ " details about the declared command. The fourth variant prints an" \ " overview about all commands and all global options." ) +#:def_cmd( "CONFIG", "CONFIG", \ + "wctct CONFIG [options]...", \ + "Show all information about the search for the configuration file and" \ + " its content." ) + #:def_cmd( "ARGTEST", "ARGTEST", \ "wctct ARGTEST ...", \ "This debug command accepts all kinds of parameters and prints one" \ @@ -12436,6 +12557,14 @@ "Stop parsing the command line and print a help message with all" \ " commands included. Exit after printing." ) +#:def_opt( "CONFIG", "config", "GP", \ + "file", \ + "Define a configuration file or a directory as source. In later case," \ + " file @'wiimms-szs-tools.conf'@ is searched.\n" \ + " If option is not not set, then file @'wiimms-szs-tools.conf'@ is" \ + " searched in different directories. Use command @'wszst CONFIG'@ to" \ + " get more details." ) + #:def_opt( "ALLOW_ALL", "allow-all|allowall", "G", \ "", \ "Usually commands accept only options with impact to the command. All" \ @@ -12902,6 +13031,14 @@ "", \ "" ) +#:def_cmd_opt( "CONFIG", "CONFIG", \ + "", \ + "" ) + +#:def_cmd_opt( "CONFIG", "LONG", \ + "", \ + "If set, print the search list too." ) + #:def_cmd_opt( "COLORS", "COLORS", \ "", \ "" ) @@ -13675,6 +13812,11 @@ " details about the declared command. The fourth variant prints an" \ " overview about all commands and all global options." ) +#:def_cmd( "CONFIG", "CONFIG", \ + "wimgt CONFIG [options]...", \ + "Show all information about the search for the configuration file and" \ + " its content." ) + #:def_cmd( "ARGTEST", "ARGTEST", \ "wimgt ARGTEST ...", \ "This debug command accepts all kinds of parameters and prints one" \ @@ -13763,6 +13905,14 @@ "Stop parsing the command line and print a help message with all" \ " commands included. Exit after printing." ) +#:def_opt( "CONFIG", "config", "GP", \ + "file", \ + "Define a configuration file or a directory as source. In later case," \ + " file @'wiimms-szs-tools.conf'@ is searched.\n" \ + " If option is not not set, then file @'wiimms-szs-tools.conf'@ is" \ + " searched in different directories. Use command @'wszst CONFIG'@ to" \ + " get more details." ) + #:def_opt( "ALLOW_ALL", "allow-all|allowall", "G", \ "", \ "Usually commands accept only options with impact to the command. All" \ @@ -14087,6 +14237,14 @@ "", \ "" ) +#:def_cmd_opt( "CONFIG", "CONFIG", \ + "", \ + "" ) + +#:def_cmd_opt( "CONFIG", "LONG", \ + "", \ + "If set, print the search list too." ) + #:def_cmd_opt( "COLORS", "COLORS", \ "", \ "" ) @@ -14541,6 +14699,11 @@ " details about the declared command. The fourth variant prints an" \ " overview about all commands and all global options." ) +#:def_cmd( "CONFIG", "CONFIG", \ + "wkclt CONFIG [options]...", \ + "Show all information about the search for the configuration file and" \ + " its content." ) + #:def_cmd( "ARGTEST", "ARGTEST", \ "wkclt ARGTEST ...", \ "This debug command accepts all kinds of parameters and prints one" \ @@ -14728,6 +14891,14 @@ "Stop parsing the command line and print a help message with all" \ " commands included. Exit after printing." ) +#:def_opt( "CONFIG", "config", "GP", \ + "file", \ + "Define a configuration file or a directory as source. In later case," \ + " file @'wiimms-szs-tools.conf'@ is searched.\n" \ + " If option is not not set, then file @'wiimms-szs-tools.conf'@ is" \ + " searched in different directories. Use command @'wszst CONFIG'@ to" \ + " get more details." ) + #:def_opt( "ALLOW_ALL", "allow-all|allowall", "G", \ "", \ "Usually commands accept only options with impact to the command. All" \ @@ -15187,6 +15358,14 @@ "", \ "" ) +#:def_cmd_opt( "CONFIG", "CONFIG", \ + "", \ + "" ) + +#:def_cmd_opt( "CONFIG", "LONG", \ + "", \ + "If set, print the search list too." ) + #:def_cmd_opt( "TEST", "VERBOSE", \ "", \ "Print the matrices of transformations." ) @@ -16865,6 +17044,11 @@ " details about the declared command. The fourth variant prints an" \ " overview about all commands and all global options." ) +#:def_cmd( "CONFIG", "CONFIG", \ + "wkmpt CONFIG [options]...", \ + "Show all information about the search for the configuration file and" \ + " its content." ) + #:def_cmd( "ARGTEST", "ARGTEST", \ "wkmpt ARGTEST ...", \ "This debug command accepts all kinds of parameters and prints one" \ @@ -17052,6 +17236,14 @@ "Stop parsing the command line and print a help message with all" \ " commands included. Exit after printing." ) +#:def_opt( "CONFIG", "config", "GP", \ + "file", \ + "Define a configuration file or a directory as source. In later case," \ + " file @'wiimms-szs-tools.conf'@ is searched.\n" \ + " If option is not not set, then file @'wiimms-szs-tools.conf'@ is" \ + " searched in different directories. Use command @'wszst CONFIG'@ to" \ + " get more details." ) + #:def_opt( "ALLOW_ALL", "allow-all|allowall", "G", \ "", \ "Usually commands accept only options with impact to the command. All" \ @@ -17720,6 +17912,14 @@ "", \ "" ) +#:def_cmd_opt( "CONFIG", "CONFIG", \ + "", \ + "" ) + +#:def_cmd_opt( "CONFIG", "LONG", \ + "", \ + "If set, print the search list too." ) + #:def_cmd_opt( "TEST", "VERBOSE", \ "", \ "Print the matrices of transformations." ) @@ -18951,6 +19151,11 @@ " details about the declared command. The fourth variant prints an" \ " overview about all commands and all global options." ) +#:def_cmd( "CONFIG", "CONFIG", \ + "wlect CONFIG [options]...", \ + "Show all information about the search for the configuration file and" \ + " its content." ) + #:def_cmd( "ARGTEST", "ARGTEST", \ "wlect ARGTEST ...", \ "This debug command accepts all kinds of parameters and prints one" \ @@ -19087,6 +19292,14 @@ "Stop parsing the command line and print a help message with all" \ " commands included. Exit after printing." ) +#:def_opt( "CONFIG", "config", "GP", \ + "file", \ + "Define a configuration file or a directory as source. In later case," \ + " file @'wiimms-szs-tools.conf'@ is searched.\n" \ + " If option is not not set, then file @'wiimms-szs-tools.conf'@ is" \ + " searched in different directories. Use command @'wszst CONFIG'@ to" \ + " get more details." ) + #:def_opt( "ALLOW_ALL", "allow-all|allowall", "G", \ "", \ "Usually commands accept only options with impact to the command. All" \ @@ -19341,9 +19554,15 @@ #:def_opt( "SPEEDOMETER", "speedometer", "CO", \ "[=mode]", \ "Enable or disable the speedometer. Mode is one of @OFF@, @AUTO@" \ - " (default, don't change setting), @ON@ (enable it for Wii and WiiU" \ - " only; default, if option is used without parameter) or @FORCE@" \ - " (enable it for Wii, Wii U and for Dolphin)." ) + " (default, don't change setting), @ON@ (default, if option is used" \ + " without parameter) or @FRACTION@ (=@1DIGIT@), @2DIGITS@ and" \ + " @3DIGITS@." ) + +#:def_opt( "DEBUG", "debug", "CP", \ + "mode", \ + "Enable or disable the debug output while racing. Mode is one of" \ + " @OFF@, @AUTO@ (default, don't change setting), @USER@ or @100@ to" \ + " @199@ for predefined setups." ) #:def_opt( "TRACK_DIR", "track-dir|trackdir", "CP", \ "directory", \ @@ -19512,6 +19731,14 @@ "", \ "" ) +#:def_cmd_opt( "CONFIG", "CONFIG", \ + "", \ + "" ) + +#:def_cmd_opt( "CONFIG", "LONG", \ + "", \ + "If set, print the search list too." ) + #:def_cmd_opt( "COLORS", "COLORS", \ "", \ "" ) @@ -19621,6 +19848,10 @@ "", \ "" ) +#:def_cmd_opt( "DUMP", "DEBUG", \ + "", \ + "" ) + #:def_cmd_opt( "DUMP", "LONG", \ "", \ "For LE-CODE binaries: If set, print cups with tracks or arenas. For" \ @@ -19670,6 +19901,10 @@ "", \ "" ) +#:def_cmd_opt( "DL", "DEBUG", \ + "", \ + "" ) + #:def_cmd_opt( "DL", "LONG", \ "", \ "For LE-CODE binaries: If set, print cups with tracks or arenas. For" \ @@ -19719,6 +19954,10 @@ "", \ "" ) +#:def_cmd_opt( "DLL", "DEBUG", \ + "", \ + "" ) + #:def_cmd_opt( "DLL", "LONG", \ "", \ "For LE-CODE binaries: If set, print cups with tracks or arenas. For" \ @@ -19776,6 +20015,10 @@ "", \ "" ) +#:def_cmd_opt( "PATCH", "DEBUG", \ + "", \ + "" ) + #:def_cmd_opt( "PATCH", "TRACK_DIR", \ "", \ "" ) @@ -19868,6 +20111,10 @@ "", \ "" ) +#:def_cmd_opt( "LPAR", "DEBUG", \ + "", \ + "" ) + #:def_cmd_opt( "LPAR", "DEST", \ "", \ "" ) @@ -20028,6 +20275,10 @@ "", \ "" ) +#:def_cmd_opt( "CREATE", "DEBUG", \ + "", \ + "" ) + #:def_cmd_opt( "CAT", "COMPLETE", \ "", \ "" ) @@ -20181,6 +20432,11 @@ " details about the declared command. The fourth variant prints an" \ " overview about all commands and all global options." ) +#:def_cmd( "CONFIG", "CONFIG", \ + "wmdlt CONFIG [options]...", \ + "Show all information about the search for the configuration file and" \ + " its content." ) + #:def_cmd( "ARGTEST", "ARGTEST", \ "wmdlt ARGTEST ...", \ "This debug command accepts all kinds of parameters and prints one" \ @@ -20293,6 +20549,14 @@ "Stop parsing the command line and print a help message with all" \ " commands included. Exit after printing." ) +#:def_opt( "CONFIG", "config", "GP", \ + "file", \ + "Define a configuration file or a directory as source. In later case," \ + " file @'wiimms-szs-tools.conf'@ is searched.\n" \ + " If option is not not set, then file @'wiimms-szs-tools.conf'@ is" \ + " searched in different directories. Use command @'wszst CONFIG'@ to" \ + " get more details." ) + #:def_opt( "ALLOW_ALL", "allow-all|allowall", "G", \ "", \ "Usually commands accept only options with impact to the command. All" \ @@ -20686,6 +20950,14 @@ "", \ "" ) +#:def_cmd_opt( "CONFIG", "CONFIG", \ + "", \ + "" ) + +#:def_cmd_opt( "CONFIG", "LONG", \ + "", \ + "If set, print the search list too." ) + #:def_cmd_opt( "TEST", "VERBOSE", \ "", \ "Print the matrices of transformations." ) @@ -21434,6 +21706,11 @@ " details about the declared command. The fourth variant prints an" \ " overview about all commands and all global options." ) +#:def_cmd( "CONFIG", "CONFIG", \ + "wpatt CONFIG [options]...", \ + "Show all information about the search for the configuration file and" \ + " its content." ) + #:def_cmd( "ARGTEST", "ARGTEST", \ "wpatt ARGTEST ...", \ "This debug command accepts all kinds of parameters and prints one" \ @@ -21523,6 +21800,14 @@ "Stop parsing the command line and print a help message with all" \ " commands included. Exit after printing." ) +#:def_opt( "CONFIG", "config", "GP", \ + "file", \ + "Define a configuration file or a directory as source. In later case," \ + " file @'wiimms-szs-tools.conf'@ is searched.\n" \ + " If option is not not set, then file @'wiimms-szs-tools.conf'@ is" \ + " searched in different directories. Use command @'wszst CONFIG'@ to" \ + " get more details." ) + #:def_opt( "ALLOW_ALL", "allow-all|allowall", "G", \ "", \ "Usually commands accept only options with impact to the command. All" \ @@ -21763,6 +22048,14 @@ "", \ "" ) +#:def_cmd_opt( "CONFIG", "CONFIG", \ + "", \ + "" ) + +#:def_cmd_opt( "CONFIG", "LONG", \ + "", \ + "If set, print the search list too." ) + #:def_cmd_opt( "COLORS", "COLORS", \ "", \ "" ) @@ -21990,6 +22283,11 @@ " details about the declared command. The fourth variant prints an" \ " overview about all commands and all global options." ) +#:def_cmd( "CONFIG", "CONFIG", \ + "wstrt CONFIG [options]...", \ + "Show all information about the search for the configuration file and" \ + " its content." ) + #:def_cmd( "ARGTEST", "ARGTEST", \ "wstrt ARGTEST ...", \ "This debug command accepts all kinds of parameters and prints one" \ @@ -22095,6 +22393,14 @@ "Stop parsing the command line and print a help message with all" \ " commands included. Exit after printing." ) +#:def_opt( "CONFIG", "config", "GP", \ + "file", \ + "Define a configuration file or a directory as source. In later case," \ + " file @'wiimms-szs-tools.conf'@ is searched.\n" \ + " If option is not not set, then file @'wiimms-szs-tools.conf'@ is" \ + " searched in different directories. Use command @'wszst CONFIG'@ to" \ + " get more details." ) + #:def_opt( "ALLOW_ALL", "allow-all|allowall", "G", \ "", \ "Usually commands accept only options with impact to the command. All" \ @@ -22644,6 +22950,14 @@ "", \ "" ) +#:def_cmd_opt( "CONFIG", "CONFIG", \ + "", \ + "" ) + +#:def_cmd_opt( "CONFIG", "LONG", \ + "", \ + "If set, print the search list too." ) + #:def_cmd_opt( "COLORS", "COLORS", \ "", \ "" ) diff --git a/project/src/wbmgt.c b/project/src/wbmgt.c index a7f1cfc..c5726b6 100644 --- a/project/src/wbmgt.c +++ b/project/src/wbmgt.c @@ -764,6 +764,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_VERSION: version_exit(); case GO_HELP: help_exit(false); case GO_XHELP: help_exit(true); + case GO_CONFIG: opt_config = optarg; case GO_ALLOW_ALL: allow_all = true; break; case GO_COMPATIBLE: err += ScanOptCompatible(optarg); break; case GO_WIDTH: err += ScanOptWidth(optarg); break; @@ -888,6 +889,7 @@ static enumError CheckCommand ( int argc, char ** argv ) case CMD_VERSION: version_exit(); case CMD_HELP: PrintHelp(&InfoUI_wbmgt,stdout,0,"HELP",0,URI_HOME, first_param ? first_param->arg : 0 ); break; + case CMD_CONFIG: err = cmd_config(); break; case CMD_ARGTEST: err = cmd_argtest(argc,argv); break; case CMD_TEST: err = cmd_test(); break; case CMD_COLORS: err = Command_COLORS(brief_count?-brief_count:long_count,0,0); break; diff --git a/project/src/wctct.c b/project/src/wctct.c index adc80c9..815126f 100644 --- a/project/src/wctct.c +++ b/project/src/wctct.c @@ -741,6 +741,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_VERSION: version_exit(); case GO_HELP: help_exit(false); case GO_XHELP: help_exit(true); + case GO_CONFIG: opt_config = optarg; case GO_ALLOW_ALL: allow_all = true; break; case GO_COMPATIBLE: err += ScanOptCompatible(optarg); break; case GO_WIDTH: err += ScanOptWidth(optarg); break; @@ -893,6 +894,7 @@ static enumError CheckCommand ( int argc, char ** argv ) case CMD_VERSION: version_exit(); case CMD_HELP: PrintHelp(&InfoUI_wctct,stdout,0,"HELP",0,URI_HOME, first_param ? first_param->arg : 0 ); break; + case CMD_CONFIG: err = cmd_config(); break; case CMD_ARGTEST: err = cmd_argtest(argc,argv); break; case CMD_TEST: err = cmd_test(); break; case CMD_COLORS: err = Command_COLORS(brief_count?-brief_count:long_count,0,0); break; diff --git a/project/src/wimgt.c b/project/src/wimgt.c index 820a812..8625693 100644 --- a/project/src/wimgt.c +++ b/project/src/wimgt.c @@ -577,6 +577,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_VERSION: version_exit(); case GO_HELP: help_exit(false); case GO_XHELP: help_exit(true); + case GO_CONFIG: opt_config = optarg; case GO_ALLOW_ALL: allow_all = true; break; case GO_COMPATIBLE: err += ScanOptCompatible(optarg); break; case GO_WIDTH: err += ScanOptWidth(optarg); break; @@ -693,6 +694,7 @@ static enumError CheckCommand ( int argc, char ** argv ) case CMD_VERSION: version_exit(); case CMD_HELP: PrintHelp(&InfoUI_wimgt,stdout,0,"HELP",0,URI_HOME, first_param ? first_param->arg : 0 ); break; + case CMD_CONFIG: err = cmd_config(); break; case CMD_ARGTEST: err = cmd_argtest(argc,argv); break; case CMD_TEST: err = cmd_test(); break; case CMD_COLORS: err = Command_COLORS(brief_count?-brief_count:long_count,0,0); break; diff --git a/project/src/wkclt.c b/project/src/wkclt.c index c85b0d1..10d7232 100644 --- a/project/src/wkclt.c +++ b/project/src/wkclt.c @@ -1117,6 +1117,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_VERSION: version_exit(); case GO_HELP: help_exit(false); case GO_XHELP: help_exit(true); + case GO_CONFIG: opt_config = optarg; case GO_ALLOW_ALL: allow_all = true; break; case GO_COMPATIBLE: err += ScanOptCompatible(optarg); break; case GO_WIDTH: err += ScanOptWidth(optarg); break; @@ -1250,6 +1251,7 @@ static enumError CheckCommand ( int argc, char ** argv ) case CMD_VERSION: version_exit(); case CMD_HELP: PrintHelp(&InfoUI_wkclt,stdout,0,"HELP",0,URI_HOME, first_param ? first_param->arg : 0 ); break; + case CMD_CONFIG: err = cmd_config(); break; case CMD_ARGTEST: err = cmd_argtest(argc,argv); break; case CMD_TEST: err = cmd_test(); break; case CMD_COLORS: err = Command_COLORS(brief_count?-brief_count:long_count,0,0); break; diff --git a/project/src/wkmpt.c b/project/src/wkmpt.c index 1a4040b..80d44c2 100644 --- a/project/src/wkmpt.c +++ b/project/src/wkmpt.c @@ -1573,6 +1573,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_VERSION: version_exit(); case GO_HELP: help_exit(false); case GO_XHELP: help_exit(true); + case GO_CONFIG: opt_config = optarg; case GO_ALLOW_ALL: allow_all = true; break; case GO_COMPATIBLE: err += ScanOptCompatible(optarg); break; case GO_WIDTH: err += ScanOptWidth(optarg); break; @@ -1729,6 +1730,7 @@ static enumError CheckCommand ( int argc, char ** argv ) case CMD_VERSION: version_exit(); case CMD_HELP: PrintHelp(&InfoUI_wkmpt,stdout,0,"HELP",0,URI_HOME, first_param ? first_param->arg : 0 ); break; + case CMD_CONFIG: err = cmd_config(); break; case CMD_ARGTEST: err = cmd_argtest(argc,argv); break; case CMD_TEST: err = cmd_test(); break; case CMD_COLORS: err = Command_COLORS(brief_count?-brief_count:long_count,0,0); break; diff --git a/project/src/wlect.c b/project/src/wlect.c index 6e38f3b..123a3a8 100644 --- a/project/src/wlect.c +++ b/project/src/wlect.c @@ -240,6 +240,53 @@ static enumError cmd_export() // /////////////////////////////////////////////////////////////////////////////// +/////////////// command dpad /////////////// +/////////////////////////////////////////////////////////////////////////////// + +static enumError cmd_dpad() +{ + ParamList_t *param; + for ( param = first_param; param; param = param->next ) + { + ccp arg = param->arg; + while ( *arg && (uint)*arg <= ' ' ) + arg++; + u32 num = 0; + if ( *arg >= '0' && *arg <= '9' || *arg >= 'a' && *arg <= 'f' || *arg >= 'A' && *arg <= 'F' ) + num = str2l(arg,0,16); + else + { + while (*arg) + { + switch (*arg++) + { + case 'U': case 'u': num = num << 2 | 0; break; + case 'L': case 'l': num = num << 2 | 1; break; + case 'R': case 'r': num = num << 2 | 2; break; + case 'D': case 'd': num = num << 2 | 3; break; + } + } + } + + char buf[20], *dest = buf + sizeof(buf) -1; + *dest = 0; + for ( u32 n = num; n && dest > buf; n >>= 2 ) + { + switch (n&3) + { + case 0: *--dest = '.'; break; + case 1: *--dest = 'L'; break; + case 2: *--dest = 'R'; break; + case 3: *--dest = 'D'; break; + } + } + printf(" case 0x%08x: // %s\n",num,dest); + } + return ERR_OK; +} + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// command dump /////////////// /////////////////////////////////////////////////////////////////////////////// @@ -1053,6 +1100,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_VERSION: version_exit(); case GO_HELP: help_exit(false); case GO_XHELP: help_exit(true); + case GO_CONFIG: opt_config = optarg; case GO_ALLOW_ALL: allow_all = true; break; case GO_COMPATIBLE: err += ScanOptCompatible(optarg); break; case GO_WIDTH: err += ScanOptWidth(optarg); break; @@ -1110,9 +1158,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_CUSTOM_TT: err += ScanOptCustomTT(optarg); break; case GO_XPFLAGS: err += ScanOptXPFlags(optarg); break; case GO_SPEEDOMETER: err += ScanOptSpeedometer(optarg); break; - case GO_RESERVED_1B9: err += ScanOptReserved_1b9(optarg); break; - case GO_RESERVED_1BA: err += ScanOptReserved_1ba(optarg); break; - case GO_RESERVED_1BB: err += ScanOptReserved_1bb(optarg); break; + case GO_DEBUG: err += ScanOptDebug(optarg); break; case GO_TRACK_DIR: opt_track_dest = optarg; break; case GO_COPY_TRACKS: err += ScanOptTrackSource(optarg,TFMD_COPY); break; @@ -1217,6 +1263,7 @@ static enumError CheckCommand ( int argc, char ** argv ) case CMD_VERSION: version_exit(); case CMD_HELP: PrintHelp(&InfoUI_wlect,stdout,0,"HELP",0,URI_HOME, first_param ? first_param->arg : 0 ); break; + case CMD_CONFIG: err = cmd_config(); break; case CMD_ARGTEST: err = cmd_argtest(argc,argv); break; case CMD_TEST: err = cmd_test(); break; case CMD_COLORS: err = Command_COLORS(brief_count?-brief_count:long_count,0,0); break; @@ -1224,6 +1271,7 @@ static enumError CheckCommand ( int argc, char ** argv ) case CMD_FILETYPE: err = cmd_filetype(); break; case CMD_FILEATTRIB: err = cmd_fileattrib(); break; case CMD_EXPORT: err = cmd_export(); break; + case CMD_DPAD: err = cmd_dpad(); break; case CMD_SYMBOLS: err = DumpSymbols(SetupVarsLECODE()); break; case CMD_FUNCTIONS: SetupVarsLECODE(); err = ListParserFunctions(); break; diff --git a/project/src/wmdlt.c b/project/src/wmdlt.c index d35799c..bb705cc 100644 --- a/project/src/wmdlt.c +++ b/project/src/wmdlt.c @@ -534,6 +534,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_VERSION: version_exit(); case GO_HELP: help_exit(false); case GO_XHELP: help_exit(true); + case GO_CONFIG: opt_config = optarg; case GO_ALLOW_ALL: allow_all = true; break; case GO_COMPATIBLE: err += ScanOptCompatible(optarg); break; case GO_WIDTH: err += ScanOptWidth(optarg); break; @@ -660,6 +661,7 @@ static enumError CheckCommand ( int argc, char ** argv ) case CMD_VERSION: version_exit(); case CMD_HELP: PrintHelp(&InfoUI_wmdlt,stdout,0,"HELP",0,URI_HOME, first_param ? first_param->arg : 0 ); break; + case CMD_CONFIG: err = cmd_config(); break; case CMD_ARGTEST: err = cmd_argtest(argc,argv); break; case CMD_TEST: err = cmd_test(); break; case CMD_COLORS: err = Command_COLORS(brief_count?-brief_count:long_count,0,0); break; diff --git a/project/src/wpatt.c b/project/src/wpatt.c index f551399..0f28c97 100644 --- a/project/src/wpatt.c +++ b/project/src/wpatt.c @@ -343,6 +343,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_VERSION: version_exit(); case GO_HELP: help_exit(false); case GO_XHELP: help_exit(true); + case GO_CONFIG: opt_config = optarg; case GO_ALLOW_ALL: allow_all = true; break; case GO_COMPATIBLE: err += ScanOptCompatible(optarg); break; case GO_WIDTH: err += ScanOptWidth(optarg); break; @@ -454,6 +455,7 @@ static enumError CheckCommand ( int argc, char ** argv ) case CMD_VERSION: version_exit(); case CMD_HELP: PrintHelp(&InfoUI_wpatt,stdout,0,"HELP",0,URI_HOME, first_param ? first_param->arg : 0 ); break; + case CMD_CONFIG: err = cmd_config(); break; case CMD_ARGTEST: err = cmd_argtest(argc,argv); break; case CMD_TEST: err = cmd_test(); break; case CMD_COLORS: err = Command_COLORS(brief_count?-brief_count:long_count,0,0); break; diff --git a/project/src/wstrt.c b/project/src/wstrt.c index fddb894..31265d7 100644 --- a/project/src/wstrt.c +++ b/project/src/wstrt.c @@ -1172,6 +1172,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_VERSION: version_exit(); case GO_HELP: help_exit(false); case GO_XHELP: help_exit(true); + case GO_CONFIG: opt_config = optarg; case GO_ALLOW_ALL: allow_all = true; break; case GO_COMPATIBLE: err += ScanOptCompatible(optarg); break; case GO_WIDTH: err += ScanOptWidth(optarg); break; @@ -1375,6 +1376,7 @@ static enumError CheckCommand ( int argc, char ** argv ) case CMD_VERSION: version_exit(); case CMD_HELP: PrintHelp(&InfoUI_wstrt,stdout,0,"HELP",0,URI_HOME, first_param ? first_param->arg : 0 ); break; + case CMD_CONFIG: err = cmd_config(); break; case CMD_ARGTEST: err = cmd_argtest(argc,argv); break; case CMD_TEST: err = cmd_test(); break; case CMD_COLORS: err = Command_COLORS(brief_count?-brief_count:long_count,0,0); diff --git a/project/src/wszst.c b/project/src/wszst.c index 8bc93ea..a169ccf 100644 --- a/project/src/wszst.c +++ b/project/src/wszst.c @@ -144,7 +144,7 @@ static void list_compressions_exit() "This {cmd|YAZ} compression uses a back tracking" " algorithm with recursion depth between {par|0 and 50} (last 2 digits)." " Depths 0 and 1 are similar to mode {par|9}." - " Each new depth doubles the number of calculated pathes." + " Each new depth doubles the number of calculated paths." " Because of some optimizations, a depth of +5 results" " in 10 to 15 times and not in 32 (2^5) times like expected." " This algorithm needs 4 times as much memory as the uncompressed file." @@ -562,14 +562,15 @@ static enumError cmd_autoadd() { SetPatchFileModeReadonly(); - char dest_path[PATH_MAX], path_buf[PATH_MAX]; - PathCatBufPP(dest_path,sizeof(dest_path),share_path,"auto-add/"); - CheckOptDest(dest_path,true); + char path_buf[PATH_MAX]; + const config_t *config = GetConfig(); + CheckOptDest(config->autoadd_path,true); if ( !opt_mkdir && !ExistDirectory(opt_dest,0) ) return ERROR0(ERR_CANT_CREATE_DIR, "Directory does not exist: %s\n",opt_dest); opt_mkdir = true; + autoadd_destination = opt_dest; if (!n_param) opt_overwrite = false; @@ -579,11 +580,11 @@ static enumError cmd_autoadd() if ( !n_param || verbose >= 1 ) { - SetupAutoAdd(); - ccp *aap; - for ( aap = auto_add_path; *aap; aap++ ) - fprintf(stdlog," SEARCH PATH[%td]: %s\n", - aap-auto_add_path,*aap); + const StringField_t *sf = GetAutoaddList(); + int i; + ccp *str = sf->field; + for ( i = 0; i < sf->used; i++, str++ ) + fprintf(stdlog," SEARCH PATH[%d]: %s\n",i,*str); } @@ -1885,30 +1886,6 @@ static enumError cmd_sha1() /////////////// command analyze /////////////// /////////////////////////////////////////////////////////////////////////////// -static void SetupPrintScript ( PrintScript_t *ps ) -{ - DASSERT(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) - { - case FF_JSON: ps->fform = PSFF_JSON; break; - case FF_BASH: ps->fform = PSFF_BASH; break; - case FF_SH: ps->fform = PSFF_SH; break; - case FF_PHP: ps->fform = PSFF_PHP; break; - case FF_MAKEDOC: ps->fform = PSFF_MAKEDOC; break; - default: ps->fform = PSFF_UNKNOWN; break; - } -} - -/////////////////////////////////////////////////////////////////////////////// - static enumError cmd_analyze() { static ccp def_path = "\1P/\1F\1?T"; @@ -1928,7 +1905,7 @@ static enumError cmd_analyze() InitializeFile(&fo); PrintScript_t ps; - SetupPrintScript(&ps); + SetupPrintScriptByOptions(&ps); ParamList_t *param; for ( param = first_param; param; param = param->next ) @@ -2028,6 +2005,7 @@ static enumError cmd_analyze() "race_slot=\"%u %s\"\n" "arena_slot=\"%u %s\"\n" "music_index=\"%u %s\"\n" + "itempos_factors=\"%5.3f %5.3f %5.3f\"\n" "used_x_pos=\"%u=%s %3.2f %3.2f %3.2f %3.2f\"\n" "used_y_pos=\"%u=%s %3.2f %3.2f %3.2f %3.2f\"\n" "used_z_pos=\"%u=%s %3.2f %3.2f %3.2f %3.2f\"\n" @@ -2066,6 +2044,7 @@ static enumError cmd_analyze() ,as.slotinfo.race_slot,as.slotinfo.race_info ,as.slotinfo.arena_slot,as.slotinfo.arena_info ,as.slotinfo.music_index,as.slotinfo.music_info + ,as.lexinfo.item_factor.x,as.lexinfo.item_factor.y,as.lexinfo.item_factor.z ,as.used_pos.orig.rating[0] ,WarnLevelNameLo[as.used_pos.orig.rating[0]] ,as.used_pos.orig.min.x,as.used_pos.orig.max.x @@ -2158,7 +2137,8 @@ static enumError cmd_features() InitializeFile(&fo); PrintScript_t ps; - SetupPrintScript(&ps); + SetupPrintScriptByOptions(&ps); + ps.eq_tabstop = 3; if ( ps.fform == PSFF_UNKNOWN && comments >= 0 ) ps.fform = PSFF_ASSIGN; @@ -4928,7 +4908,7 @@ static enumError cmd_ghost() InitializeFile(&fo); PrintScript_t ps; - SetupPrintScript(&ps); + SetupPrintScriptByOptions(&ps); ParamList_t *param; for ( param = first_param; param; param = param->next ) @@ -5101,6 +5081,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_VERSION: version_exit(); case GO_HELP: help_exit(false); case GO_XHELP: help_exit(true); + case GO_CONFIG: opt_config = optarg; break; case GO_ALLOW_ALL: allow_all = true; break; case GO_COMPATIBLE: err += ScanOptCompatible(optarg); break; case GO_WIDTH: err += ScanOptWidth(optarg); break; @@ -5243,6 +5224,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_CASE: err += ScanOptCase(optarg); break; case GO_PMODES: opt_pmodes++; break; case GO_FMODES: err += ScanOptFModes(optarg); break; + case GO_INSTALL: opt_install++; break; case GO_PT_DIR: err += ScanOptPtDir(optarg); break; case GO_LINKS: opt_links = true; break; @@ -5403,6 +5385,7 @@ static enumError CheckCommand ( int argc, char ** argv ) case CMD_VERSION: version_exit(); case CMD_HELP: PrintHelp(&InfoUI_wszst,stdout,0,"HELP",0,URI_HOME, first_param ? first_param->arg : 0 ); break; + case CMD_CONFIG: err = cmd_config(); break; case CMD_ARGTEST: err = cmd_argtest(argc,argv); break; case CMD_TEST: err = cmd_test(); break; case CMD_COLORS: err = Command_COLORS(brief_count?-brief_count:long_count,0,0); diff --git a/project/src/wtest.c b/project/src/wtest.c index 361e08b..dc4cca0 100644 --- a/project/src/wtest.c +++ b/project/src/wtest.c @@ -3782,7 +3782,7 @@ static enumError test_endian ( int argc, char ** argv ) putchar('\n'); //------------------------------------------------------------------------- - + printf("BE: h2n(1) = %x %x %llx / n2h(1) = %x %x %llx\n", be_func.h2ns(1), be_func.h2nl(1), be_func.h2n64(1), be_func.n2hs(1), be_func.n2hl(1), be_func.n2h64(1) ); @@ -3795,6 +3795,211 @@ static enumError test_endian ( int argc, char ** argv ) // /////////////////////////////////////////////////////////////////////////////// +/////////////// test_config() /////////////// +/////////////////////////////////////////////////////////////////////////////// + +static enumError test_config ( int argc, char ** argv ) +{ + config_t config; + InitializeConfig(&config); + + int i; + for ( i = 1; i < argc; i++ ) + { + ScanConfig(&config,argv[i],false); + printf( "--\n> %s\n",argv[i]); + PrintConfig(stdout,&config,true); + + #if 0 + char buf[100]; + NormalizeFileName(buf,sizeof(buf),config.autoadd_path,true,true,TRSL_AUTO); + printf( ">> |%s|\n",buf); + #endif + } + + ResetConfig(&config); + putchar('\n'); + return ERR_OK; +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// test_search() /////////////// +/////////////////////////////////////////////////////////////////////////////// + +static void print_search ( const search_file_list_t *sfl, ccp title ) +{ + if (title) + printf("> %s\n",title); + + uint i; + search_file_t *sf = sfl->list; + for ( i = 1; i <= sfl->used; i++, sf++ ) + printf("%5d. [a=%d,it=%d,h:%x] %s\n", + i, sf->alloced, sf->itype, sf->hint, sf->fname ); +} + +//----------------------------------------------------------------------------- + +static enumError test_search ( int argc, char ** argv ) +{ + search_file_list_t sfl; + InitializeSearchFile(&sfl); + print_search(&sfl,"init"); + + int i; + for ( i = 1; i < argc; i++ ) + { + ccp arg = argv[i]; + CopyMode_t cm = CPM_LINK; + if ( *arg == '+' ) + { + arg = STRDUP(arg+1); + cm = CPM_MOVE; + if ( i == 1 ) + { + int res = SearchConfig1(&sfl,"wiimms-szs-tools.conf",arg, + ".szs","/etc",std_share_path,0); + printf("SearchConfig1(), res=%d\n",res); + continue; + } + } + AppendSearchFile(&sfl,arg,cm,"config0.txt"); + } + print_search(&sfl,"argv[]"); + + ResetSearchFile(&sfl); + putchar('\n'); + return ERR_OK; +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// test_quote() /////////////// +/////////////////////////////////////////////////////////////////////////////// + +static void print_quote_result ( ccp str, ccp info ) +{ + printf("[%-2.2s,EQM=%d%d%d,C=%d] |%s|\n", + info, str == EmptyString, str == EmptyQuote, + str == MinusString, IsCircBuf(str), str ); + FreeString(str); +} + +static void test_quote_helper ( ccp str ) +{ + printf("\n--- %p\n",str); + print_quote_result(EscapeStringS(str,0,CHMD__MODERN),"E"); + print_quote_result(EscapeStringCircS(str,0,CHMD__MODERN),"EC"); + print_quote_result(QuoteStringS(str,0,CHMD__MODERN),"Q"); + print_quote_result(QuoteStringCircS(str,0,CHMD__MODERN),"QC"); + print_quote_result(QuoteBashS(str,0,CHMD__MODERN),"B"); + print_quote_result(QuoteBashCircS(str,0,CHMD__MODERN),"BC"); +} + +static enumError test_quote ( int argc, char ** argv ) +{ + test_quote_helper(0); + test_quote_helper(EmptyString); + test_quote_helper("ab\ec\td\n \"xyz\' ghi"); + + int i; + for ( i = 1; i < argc; i++ ) + test_quote_helper(argv[i]); + putchar('\n'); + return ERR_OK; +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// test_eml() /////////////// +/////////////////////////////////////////////////////////////////////////////// + +static enumError test_eml ( int argc, char ** argv ) +{ + exmem_list_t eml; + InitializeEML(&eml); + AddStandardSymbolsEML(&eml,false); + // DumpEML(stdout,3,&eml,"symbols(false)"); + + int i; + for ( i = 1; i < argc; i++ ) + { + ccp arg = argv[i]; + exmem_t res = ResolveSymbolsEML(&eml,arg); + printf(">ADD: %s\n",PrintExMem(&res)); + FreeExMem(&res); + + char *eq = strchr(arg,'='); + if (eq) + *eq++ = 0; + exmem_t data = ExMemByString(eq?eq:arg); + + if ( *arg == '-' ) + RemoveEML(&eml,arg+1); + else if ( *arg == '+' ) + ReplaceEML(&eml,arg+1,CPM_COPY,&data,CPM_COPY); + else if ( *arg == '%' ) + OverwriteEML(&eml,arg+1,CPM_COPY,&data,CPM_COPY); + else + InsertEML(&eml,arg,CPM_COPY,&data,CPM_COPY); + } + + DumpEML(stdout,3,&eml,0); + + #if 0 + AddStandardSymbolsEML(&eml,false); + DumpEML(stdout,3,&eml,"symbols(false)"); + AddStandardSymbolsEML(&eml,true); + DumpEML(stdout,3,&eml,"symbols(true)"); + #endif + + #if 1 + ResolveAllSymbolsEML(&eml); + DumpEML(stdout,3,&eml,"ResolveAllSymbolsEML()"); + #endif + + ResetEML(&eml); + + putchar('\n'); + return ERR_OK; +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// test_cygpath() /////////////// +/////////////////////////////////////////////////////////////////////////////// + +static enumError test_cygpath ( int argc, char ** argv ) +{ + int i; + for ( i = 1; i < argc; i++ ) + { + ccp arg = argv[i]; + bool try_circ = *arg != '-'; + if (!try_circ) + arg++; + ccp cyg = AllocNormalizedFilenameCygwin(arg,try_circ); + exmem_t mem = GetNormalizeFilenameCygwin(arg,try_circ); + printf( "---\n" + "< %s\n" + ">[%u,%c] %s\n" + ">%s\n" + ,arg + ,IsWindowsDriveSpec(arg) + ,IsCircBuf(cyg) ? 'C' : '-' + ,cyg + ,PrintExMem(&mem) + ); + FreeString(cyg); + FreeExMem(&mem); + } + putchar('\n'); + return ERR_OK; +} + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// develop() /////////////// /////////////////////////////////////////////////////////////////////////////// @@ -3822,6 +4027,45 @@ const gobj_cond_ref_t * FindConditionRef2 ( u16 ref_id ) static enumError develop ( int argc, char ** argv ) { #if 1 + bool filter_active = false; + for ( int i = 1; i < argc; i++ ) + { + ccp arg = argv[i]; + if (!strcmp(arg,"+a")) + filter_active = true; + else if (!strcmp(arg,"-a")) + filter_active = false; + else + { + lecode_debug_t mode = str2l(arg,0,10) & LEDEB__ALL; + printf("-----\n%02x\n",mode); + lecode_debug_info_t ldi; + for ( GetFirstDebugMode(&ldi,mode,filter_active); + ldi.name; + GetNextDebugMode(&ldi) ) + { + printf("\t%s\n",GetDebugModeSummary(&ldi)); + } + } + } + #elif 1 + ccp test = + "n=123\n" + "s=\"ab\e[0m c\"\n" + "t=\"ab\ncd\"\n"; + + printf("%s\n",test); + + PrintScript_t ps; + script_fform = FF_BASH; + SetupPrintScriptByOptions(&ps); + ps.f = stdout; + PutScriptVars(&ps,3,test); + + ps.auto_quote = true; + PutScriptVars(&ps,3,test); + + #elif 1 static const char text[] = "abc/def/ghi\0jkl/mno/pqr"; uint i; for ( i = 0; i < sizeof(text); i++ ) @@ -4028,6 +4272,11 @@ enum CMD_SLOT_INFO, // test_slot_info(argc,argv) CMD_CLOCK, // test_clock(argc,argv) CMD_ENDIAN, // test_endian(argc,argv) + CMD_CONFIG, // test_config(argc,argv) + CMD_SEARCH, // test_search(argc,argv) + CMD_QUOTE, // test_quote(argc,argv) + CMD_EML, // test_eml(argc,argv) + CMD_CYGPATH, // test_cygpath(argc,argv) CMD__N }; @@ -4086,6 +4335,11 @@ static const KeywordTab_t CommandTab[] = { CMD_SLOT_INFO, "SLOT-INFO", "SI", 0 }, { CMD_CLOCK, "CLOCK", 0, 0 }, { CMD_ENDIAN, "ENDIAN", 0, 0 }, + { CMD_CONFIG, "CONFIG", 0, 0 }, + { CMD_SEARCH, "SEARCH", 0, 0 }, + { CMD_QUOTE, "QUOTE", "Q", 0 }, + { CMD_EML, "EML", 0, 0 }, + { CMD_CYGPATH, "CYGPATH", 0, 0 }, { CMD__N,0,0,0 } }; @@ -4146,7 +4400,7 @@ int main ( int argc, char ** argv ) float *f = f3.v; printf("%zu/%zu=%zu\n",sizeof(f3.v),sizeof(*f),sizeof(f3.v)/sizeof(*f)); } - + if (0) { double34 x; @@ -4226,6 +4480,11 @@ int main ( int argc, char ** argv ) case CMD_SLOT_INFO: test_slot_info(argc,argv); break; case CMD_CLOCK: test_clock(argc,argv); break; case CMD_ENDIAN: test_endian(argc,argv); break; + case CMD_CONFIG: test_config(argc,argv); break; + case CMD_SEARCH: test_search(argc,argv); break; + case CMD_QUOTE: test_quote(argc,argv); break; + case CMD_EML: test_eml(argc,argv); break; + case CMD_CYGPATH: test_cygpath(argc,argv); break; //case CMD_HELP: default: help_exit(); diff --git a/project/system.c b/project/system.c index 2981af0..67cbe8d 100644 --- a/project/system.c +++ b/project/system.c @@ -17,7 +17,7 @@ * This file is part of the SZS project. * * Visit http://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> * * * *************************************************************************** * * @@ -37,9 +37,11 @@ #include "dclib/dclib-system.h" -int main ( int argc, char ** argv ) -{ +#ifndef PRINT_SYSTEM_SETTINGS + int main ( int argc, char ** argv ) + { dclibPrintSystem(stdout); return 0; -} + } +#endif diff --git a/project/templates/HISTORY-v0.txt b/project/templates/HISTORY-v0.txt index 6bbc789..0884e1e 100644 --- a/project/templates/HISTORY-v0.txt +++ b/project/templates/HISTORY-v0.txt @@ -569,10 +569,10 @@ szs v0.33a r3627 - 2012-05-02 -> https://szs.wiimm.de/doc/kmp/syntax The inline documentation in decoded KMP files is now much shorter. - Command SYNTAX removed. Use page https://szs.wiimm.de/doc/syntax instead. - - The backtracking algorithm for analyzing of CKPH + ENPH + ITPH pathes has + - The backtracking algorithm for analyzing of CKPH + ENPH + ITPH paths has been modified and optimized, because a test version of "Toad's Turnpike" has 105 ITPH groups and needs much to much steps and time to calculate - about 10^28 pathes total. + about 10^28 paths total. szs v0.34a r3659 - 2012-05-12 diff --git a/project/templates/HISTORY-v1.txt b/project/templates/HISTORY-v1.txt index 8da05de..bd7db5c 100644 --- a/project/templates/HISTORY-v1.txt +++ b/project/templates/HISTORY-v1.txt @@ -305,7 +305,7 @@ szs v1.17a r4358 - 2013-04-23 - Option --fast overrides compression rates set by --norm or --compr=list. - New --kcl mode: FIX-ALL: Short cut for DROP,RM,NEW,LOG. - New option: --autoadd-path=dir: Define a path for the auto-add library - and override the default search pathes. + and override the default search paths. - New option: --mdl=list: Define a MDL patching method. VERTEX patching is used by default. - New option for wszst: --patch-file=list: Define, which kind of KMP, KCL and diff --git a/project/templates/HISTORY.txt b/project/templates/HISTORY.txt index dba9049..2b1b62f 100644 --- a/project/templates/HISTORY.txt +++ b/project/templates/HISTORY.txt @@ -454,6 +454,15 @@ szs v2.22a r8323 - 2020-12-26 --copy-tracks, --move-tracks and --link-tracks failed for *_d.files. +szs v2.23a r8357 - 2021-02-03 + + - Buf fix for option --le-define=FILE, if FILE is a lecode binary. In this + case, the special functions of chat messages are copied now. + - wszst ANALYSE: Detection of additional files (like ObjFlow.bin) that have + not been changed. + - MAC support improved. + + @@MODULE(last-history.txt)@@ diff --git a/project/templates/module/last-history.txt b/project/templates/module/last-history.txt index bee09e7..4cad383 100644 --- a/project/templates/module/last-history.txt +++ b/project/templates/module/last-history.txt @@ -1,10 +1,30 @@ szs v@@VERSION@@ r@@REV-NEXT@@ - @@@@-@@-@@ - - Buf fix for option --le-define=FILE, if FILE is a lecode binary. In this - case, the special functions of chat messages are copied now. - - wszst ANALYSE: Detection of additional files (like ObjFlow.bin) that have - not been changed. - - MAC support improved. + - The tools support a configuration file now to define different paths. + Therefor the file "wiimms-szs-tools.conf" is searched in different + directories. + - Option --config=file allows to define a specific config file. + - Command CONFIG (available for all tools) prints an information about + searching and the final settings. + - wszst CONFIG can export configuration settings for scripts. + - wszst CONFIG can create new or updated configuration files. + - wszst ANALYZE: + - Behavior changed for item position bug. + - New warning if minimap is missed. + - Detect AIParam. + - Print Item Posisiton Factors. + - Speedometer settings changed. It is either disabled or enabled with or + without fraction (up to 3 digits). + - wlect option --speedometer=modus accpets now parameters OFF, AUTO, ON, + FRACTION (=1DIGIT), 2DIGITS and 3DIGITS. + - LE-CODE supports debug output while racing. LPAR parameter DEBUG, LPAR + sections [DEBUG-*] and wlect option --debug define the output format. + See http://wiki.tockdom.com/wiki/LPAR#debug for details. + - Wiimm's Item Cheat has been integrated into LE-CODE. It is enabled by a + LPAR setting and supports Wiimote+Nunchuk, Classic Controller and GCN + Controller for all 4 regions. + - Bug fix for CT-CODE/LE-CODE configuration file: In v2.21a command 'S' was + modified to accept 16 bit slot numbers. And here a copy bug is fixed now. ~ - MDL support: Scanning a MDL file and transferring the data into an internal ~ format was already implemented, but only used for analysis purposes. Now it diff --git a/project/text-files/lpar.inc/lpar-sect-param-cr.inc b/project/text-files/lpar.inc/lpar-sect-param-cr.inc index 9b012cf..0579e4c 100644 --- a/project/text-files/lpar.inc/lpar-sect-param-cr.inc +++ b/project/text-files/lpar.inc/lpar-sect-param-cr.inc @@ -47,17 +47,10 @@ CUSTOM-TT = %u # Enable (1) or disable (0) support for Extended Presence Flags. Disable it # only for tests! If LIMIT-MODE==LE$PRODUCTIVE, XPFLAGS is always enabled. -# Option --xpflags will overrides this setting. +# Option --xpflags overrides this setting. XPFLAGS = %u -# Enable (1) or disable (0) the speedometer at Wii and Wii U. The special -# value 2 enables it for Dolphin too, but only on LE$EXPERIMENTAL. It doesn't -# work correctly with Dolphin. If enabled, the speedometer is displayed at the -# bottom right. Option --speedometer will overrides this setting. - -SPEEDOMETER = %u - # Define the number of races that a previously used track is blocked. LE-CODE # will try to find another possible track among the selected tracks. Values # between 0 (deactivated at all) and %u are allowed. Chat messages can clear @@ -65,3 +58,24 @@ SPEEDOMETER = %u BLOCK-TRACK = %u +# Enables (SPEEDO$0 .. SPPEDO$3) or disables (SPEEDO$OFF) the speedometer. +# If enabled, the speedometer is displayed at bottom right of the screen +# using format »123.123 km/h«. The digit behind SPEEDO$ defines the number +# of fraction digits. +# Option --speedometer overrides this setting. + +SPEEDOMETER = SPEEDO$%s + +# Define a debug mode. Debug output is displayed below the speedometer. It is +# defined by sections [DEBUG-*]. This parameter defines the general behaviour. +# Possible values are DEBUG$OFF, DEBUG$ENABLED and DEBUG$1 to DEBUG$4. +# DEBUG$OFF disables the debug output at all. All other values enable debug +# output and define the start configuration. +# Option --debug overrides this setting. + +DEBUG = DEBUG$%s + +# Enable (1) or disable (0) built-in item cheats. + +ITEM-CHEATS = %u + diff --git a/project/text-files/lpar.inc/lpar-sect-reserved-cr.inc b/project/text-files/lpar.inc/lpar-sect-reserved-cr.inc deleted file mode 100644 index cc31ec0..0000000 --- a/project/text-files/lpar.inc/lpar-sect-reserved-cr.inc +++ /dev/null @@ -1,6 +0,0 @@ -#------------------------------------------------------------------------------ - -# Here are some parameters, that are reserved for future versions of LE-CODE. -# The idea is, that the current wlect tool can edit some settings, that are -# not defined yet. - diff --git a/project/text-files/setup.inc/setup-include-cr.inc b/project/text-files/setup.inc/setup-include-cr.inc index 8edec87..9772481 100644 --- a/project/text-files/setup.inc/setup-include-cr.inc +++ b/project/text-files/setup.inc/setup-include-cr.inc @@ -2,8 +2,8 @@ ############################################################################### # # Some general rules for the next sections: -# All pathes are relative to the current base directory (directory that -# contains the file wszst-setup.txt). Prefix at least pathes that starts +# All paths are relative to the current base directory (directory that +# contains the file wszst-setup.txt). Prefix at least paths that starts # not with a letter, digit, point, star or underscore with "./". # #------------------------------------------------------------------------------ |
