diff options
| author | Wiimm <wiimm@wiimm.de> | 2020-11-30 16:16:56 +0100 |
|---|---|---|
| committer | Wiimm <wiimm@wiimm.de> | 2020-11-30 16:16:56 +0100 |
| commit | 9c0078c6b9c1309b48f9ece8b5cad1b9be9a75c5 (patch) | |
| tree | 0abd3b6a244076650e40a07e42adae9c2a6b2d8c /project | |
| parent | a0815499b2d9014695e6e261c909476729445360 (diff) | |
SZS v2.21a
Diffstat (limited to 'project')
89 files changed, 4489 insertions, 1346 deletions
diff --git a/project/Makefile b/project/Makefile index cf71285..f918113 100644 --- a/project/Makefile +++ b/project/Makefile @@ -58,7 +58,7 @@ WPATT_LONG = Wiimms PAT Tool WSTRT_SHORT = wstrt WSTRT_LONG = Wiimms StaticR Tool -VERSION_NUM = 2.20a +VERSION_NUM = 2.21a BETA_VERSION = 0 # 0:off -1:"beta" >0:"beta#" @@ -78,7 +78,8 @@ endif URI_DOWNLOAD_I386 = $(URI_DOWNLOAD)/$(DISTRIB_I386) URI_DOWNLOAD_X86_64 = $(URI_DOWNLOAD)/$(DISTRIB_X86_64) URI_DOWNLOAD_MAC = $(URI_DOWNLOAD)/$(DISTRIB_MAC) -URI_DOWNLOAD_CYGWIN = $(URI_DOWNLOAD)/$(DISTRIB_CYGWIN) +URI_DOWNLOAD_CYGWIN32 = $(URI_DOWNLOAD)/$(DISTRIB_CYGWIN32) +URI_DOWNLOAD_CYGWIN64 = $(URI_DOWNLOAD)/$(DISTRIB_CYGWIN64) DOWNLOAD_DIR = /n/www/szs.wiimm.de/download EXPORT_DIR = /cygdrive/n/wit/wiimms-szs-tools/bin @@ -178,6 +179,18 @@ endif # DEFINES1 += -DHAVE_PCRE=1 #endif +ifeq ($(HAVE_SHA),1) + ifeq ($(SYSTEM_LINUX),1) + ifneq ($(STATIC),1) + DEFINES1 += -DUSE_SHA_LIB + LIBS += -lcrypto + endif + else ifeq ($(SYSTEM),cygwin) + DEFINES1 += -DUSE_SHA_LIB + LIBS += -lcrypto + endif +endif + #------------------------------------------------------------------------------- # tools @@ -356,13 +369,15 @@ LIBS += $(LIBPNG) -lm -lncurses $(XLIBS) #------------------------------------------------------------------------------- + DISTRIB_RM = ./szs-v$(VERSION)-r DISTRIB_BASE = szs-v$(VERSION)-r$(REVISION_NEXT) -DISTRIB_PATH = ./$(DISTRIB_BASE)-$(SYSTEM) +DISTRIB_PATH = ./$(DISTRIB_BASE)-$(SYSTEM2) DISTRIB_I386 = $(DISTRIB_BASE)-i386.tar.gz DISTRIB_X86_64 = $(DISTRIB_BASE)-x86_64.tar.gz DISTRIB_MAC = $(DISTRIB_BASE)-mac.tar.gz -DISTRIB_CYGWIN = $(DISTRIB_BASE)-cygwin.zip +DISTRIB_CYGWIN32 = $(DISTRIB_BASE)-cygwin32.zip +DISTRIB_CYGWIN64 = $(DISTRIB_BASE)-cygwin64.zip DISTRIB_FILES = gpl-2.0.txt $(INSTALL_SCRIPTS) $(SETUP_INFO) DOC_FILES = doc/*.txt @@ -432,10 +447,10 @@ $(ALL_TOOLS_X): %: %.o $(ALL_OBJECTS) $(TOBJ_ALL) Makefile | $(HELPER_TOOLS) $(U $(ALL_OBJECTS) $(TOBJ_$@) $(LIBS) $(TOPT_$@) -o $@ @if test -f $@.exe; then $(STRIP) $@.exe; else $(STRIP) $@; fi - @mkdir -p bin/$(SYSTEM) bin/$(SYSTEM)/debug + @mkdir -p bin/$(SYSTEM2) bin/$(SYSTEM2)/debug @if test -s $(MODE_FILE) && grep -Fq -e -DDEBUG $(MODE_FILE); \ - then cp -p $@ bin/$(SYSTEM)/debug/; \ - else cp -p $@ bin/; cp -p $@ bin/$(SYSTEM)/; fi + then cp -p $@ bin/$(SYSTEM2)/debug/; \ + else cp -p $@ bin/; cp -p $@ bin/$(SYSTEM2)/; fi #-------------------------- @@ -528,6 +543,7 @@ chmod: @printf "$(LOGFORMAT)" chmod 775/664 "" @for d in . $(DIR_LIST); do test -d "$$d" && chmod ug+rw "$$d"/*; done || true @for d in . $(DIR_LIST); do test -d "$$d" && chmod -f a+x "$$d"/*.sh; done || true + @find . -type f -name '*.sh' -exec chmod -f a+x {} + @for d in $(DIR_LIST); do test -d "$$d" && chmod 775 "$$d"; done || true @for t in $(ALL_TOOLS_X); do test -f "$$t" && chmod 775 "$$t"; done || true @chmod 664 src/*.[hc] src/*/*.[hc] dclib/*.[hc] @@ -628,6 +644,7 @@ distrib: ifeq ($(SYSTEM),mac) @NOWIIMM=1 $(MAKE) --no-print-directory mac-distrib else ifeq ($(SYSTEM),cygwin) + rm -f version.h cygwin-copy.sh templates.sed NOWIIMM=1 $(MAKE) --no-print-directory all doc cygwin-copy.sh \ $(CYGWIN_SCRIPTS) gen-distrib info else @@ -664,6 +681,7 @@ ifeq ($(SYSTEM),cygwin) else + @printf "$(LOGFORMAT)" create "$(DISTRIB_PATH)" "" @rm -rf $(DISTRIB_PATH) @mkdir -p $(DISTRIB_PATH)/bin $(DISTRIB_PATH)/scripts @mkdir -p $(DISTRIB_PATH)/doc $(DISTRIB_PATH)/support @@ -699,8 +717,11 @@ copy-distrib: distrib2 @[[ -s "$(DISTRIB_X86_64)" ]] \ && cp --preserve=time "$(DISTRIB_X86_64)" "$(DOWNLOAD_DIR)" \ || true - @[[ -s "$(DISTRIB_CYGWIN)" ]] \ - && cp --preserve=time "$(DISTRIB_CYGWIN)" "$(DOWNLOAD_DIR)" \ + @[[ -s "$(DISTRIB_CYGWIN32)" ]] \ + && cp --preserve=time "$(DISTRIB_CYGWIN32)" "$(DOWNLOAD_DIR)" \ + || true + @[[ -s "$(DISTRIB_CYGWIN64)" ]] \ + && cp --preserve=time "$(DISTRIB_CYGWIN64)" "$(DOWNLOAD_DIR)" \ || true # @@ -958,7 +979,8 @@ templates.sed: Makefile 's|@@DISTRIB-I386@@|$(DISTRIB_I386)|g;' \ 's|@@DISTRIB-X86_64@@|$(DISTRIB_X86_64)|g;' \ 's|@@DISTRIB-MAC@@|$(DISTRIB_MAC)|g;' \ - 's|@@DISTRIB-CYGWIN@@|$(DISTRIB_CYGWIN)|g;' \ + 's|@@DISTRIB-CYGWIN32@@|$(DISTRIB_CYGWIN64)|g;' \ + 's|@@DISTRIB-CYGWIN64@@|$(DISTRIB_CYGWIN32)|g;' \ 's|@@URI-REPOS@@|$(URI_REPOS)|g;' \ 's|@@URI-VIEWVC@@|$(URI_VIEWVC)|g;' \ 's|@@URI-HOME@@|$(URI_HOME)|g;' \ diff --git a/project/dclib/Makefile.inc b/project/dclib/Makefile.inc index 6ab04d8..d386594 100644 --- a/project/dclib/Makefile.inc +++ b/project/dclib/Makefile.inc @@ -2,7 +2,7 @@ #------------------------------------------------------------------------------ # standard object files -DCLIB_O = dclib-basics.o dclib-color.o dclib-numeric.o \ +DCLIB_O = dclib-basics.o dclib-cli.o dclib-color.o dclib-numeric.o \ dclib-file.o dclib-option.o dclib-regex.o \ dclib-utf8.o dclib-shift-jis.o \ dclib-vector.o dclib-tables.o dclib-ui.o \ diff --git a/project/dclib/dclib-basics.c b/project/dclib/dclib-basics.c index 64ea883..8176aed 100644 --- a/project/dclib/dclib-basics.c +++ b/project/dclib/dclib-basics.c @@ -4672,12 +4672,7 @@ char * PrintKeywordList if (ret_length) *ret_length = len; - if ( buf == temp ) - { - buf = GetCircBuf(len+1); - memcpy(buf,temp,len+1); - } - return buf; + return buf == temp ? CopyCircBuf(temp,len+1) : buf; } /////////////////////////////////////////////////////////////////////////////// @@ -4874,7 +4869,7 @@ int ScanCommandList //--- scan and copy command ccp param = cmd; - while ( param < endcmd && ( isalnum(*param) || *param == '-' || *param == '_' ) ) + while ( param < endcmd && ( isalnum((int)*param) || *param == '-' || *param == '_' ) ) param++; cli->cmd_len = param - cmd; if ( cli->cmd_len > sizeof(cli->cmd)-1 ) @@ -5063,75 +5058,6 @@ int ScanCommandList // /////////////////////////////////////////////////////////////////////////////// -/////////////// global commands /////////////// -/////////////////////////////////////////////////////////////////////////////// - -enumError Command_ARGTEST ( int argc, char ** argv ) -{ - printf("ARGUMENT TEST: %u arguments:\n",argc); - - int idx; - for ( idx = 0; idx < argc; idx++ ) - printf("%4u.: |%s|\n",idx,argv[idx]); - return ERR_OK; -} - -/////////////////////////////////////////////////////////////////////////////// - -enumError Command_COLORS -( - int level, // only used, if mode==NULL - // < 0: status message (ignore mode) - // >= 1: include names - // >= 2: include alt names - // >= 3: include color names incl bold - // >= 4: include background color names - uint mode, // output mode => see PrintColorSetHelper() - uint format // output format => see PrintColorSetEx() -) -{ - if (!colout) - SetupStdMsg(); - - if ( level < 0 ) - { - 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)), - colout->col_mode, GetColorModeName(colout->col_mode,"?"), - colout->colorize, colout->n_colors, colout->reset ); - return ERR_OK; - } - - if ( !mode && level > 0 ) - switch (level) - { - case 1: mode = 0x08; break; - case 2: mode = 0x18; break; - case 3: mode = 0x1b; break; - default: mode = 0x1f; break; - } - - if (!format) - { - const ColorMode_t col_mode = colout ? colout->col_mode : COLMD_AUTO; - PrintTextModes( stdout, 4, col_mode ); - PrintColorModes( stdout, 4, col_mode, GCM_ALT ); - #ifdef TEST - PrintColorModes( stdout, 4, col_mode, GCM_ALT|GCM_SHORT ); - #endif - } - if ( mode || format ) - PrintColorSetEx(stdout,4,colout,mode,format); - return ERR_OK; -} - -// -/////////////////////////////////////////////////////////////////////////////// /////////////// dynamic data support /////////////// /////////////////////////////////////////////////////////////////////////////// diff --git a/project/dclib/dclib-basics.h b/project/dclib/dclib-basics.h index 68eeca7..fd0b1a9 100644 --- a/project/dclib/dclib-basics.h +++ b/project/dclib/dclib-basics.h @@ -580,7 +580,7 @@ typedef struct endian_func_t { //--- info section - u8 bom[2]; // btye order mark: BE=0xfe,0xff, LE=0xff,0xfe + u8 bom[2]; // byte order mark: BE=0xfe,0xff, LE=0xff,0xfe bool is_be; // true: is big endian bool is_le; // true: is little endian dcEndian_t endian; // DC_BIG_ENDIAN or DC_LITTLE_ENDIAN @@ -609,6 +609,16 @@ typedef struct endian_func_t void (*wrf4) ( void * data_ptr, float data ); void (*wrf8) ( void * data_ptr, double data ); + //--- convert functions + + u16 (*n2hs) ( u16 data ); + u32 (*n2hl) ( u32 data ); + u64 (*n2h64) ( u64 data ); + + u16 (*h2ns) ( u16 data ); + u32 (*h2nl) ( u32 data ); + u64 (*h2n64) ( u64 data ); + } endian_func_t; extern const endian_func_t be_func; @@ -689,6 +699,8 @@ int CheckIndex1 ( int max, int index ); int CheckIndex1End ( int max, int index ); int CheckIndex2 ( int max, int * p_begin, int * p_end ); int CheckIndex2End ( int max, int * p_begin, int * p_end ); +int CheckIndexC ( int max, int * p_begin, int count ); +int CheckIndexCEnd ( int max, int * p_begin, int count ); //----------------------------------------------------------------------------- @@ -1683,6 +1695,42 @@ int ScanSplitArg // /////////////////////////////////////////////////////////////////////////////// +/////////////// arg_manager_t /////////////// +/////////////////////////////////////////////////////////////////////////////// +// [[arg_manager_t]] + +typedef struct arg_manager_t +{ + char **argv; // list of strings + int argc; // number of used elements in 'argv' + uint size; // >0: 'argv' is alloced to store # elements + // last NULL element is not counted here +} +arg_manager_t; + +//----------------------------------------------------------------------------- + +void ResetArgManager ( arg_manager_t *am ); +void SetupArgManager ( arg_manager_t *am, int argc, char ** argv, bool clone ); +void AttachArgManager ( arg_manager_t *am, int argc, char ** argv ); +void CloneArgManager ( arg_manager_t *am, int argc, char ** argv ); + +void AddSpaceArgManager ( arg_manager_t *am, int needed_space ); + +void CopyArgManager ( arg_manager_t *dest, const arg_manager_t *src ); +void MoveArgManager ( arg_manager_t *dest, arg_manager_t *src ); + +void PrepareEditArgManager ( arg_manager_t *am, int needed_space ); + +uint AppendArgManager ( arg_manager_t *am, ccp arg1, ccp arg2, bool move_arg ); +uint InsertArgManager ( arg_manager_t *am, int pos, ccp arg1, ccp arg2, bool move_arg ); +uint ReplaceArgManager( arg_manager_t *am, int pos, ccp arg1, ccp arg2, bool move_arg ); +uint RemoveArgManager ( arg_manager_t *am, int pos, int count ); + +void DumpArgManager ( FILE *f, int indent, const arg_manager_t *am, ccp title ); + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// ContainerData_t, Container_t /////////////// /////////////////////////////////////////////////////////////////////////////// @@ -4253,7 +4301,7 @@ typedef struct DynDataList_t { DynData_t *list; // pointer to the data list uint used; // number of used data elements - uint size; // number of allocated pointer in 'list' + uint size; // number of allocated pointers in 'list' } DynDataList_t; @@ -4287,7 +4335,7 @@ typedef struct StringField_t { ccp * field; // pointer to the string field uint used; // number of used titles in the title field - uint size; // number of allocated pointer in 'field' + uint size; // number of allocated pointers in 'field' int (*func_cmp)( ccp s1, ccp s2 ); // compare function, default is strcmp() } StringField_t; @@ -4394,7 +4442,7 @@ typedef struct ParamField_t { ParamFieldItem_t * field; // pointer to the string field uint used; // number of used titles in the title field - uint size; // number of allocated pointer in 'field' + uint size; // number of allocated pointers in 'field' bool free_data; // true: unused data will be free'd // initialized with 'false' int (*func_cmp)( ccp s1, ccp s2 ); // compare function, default is strcmp() @@ -4454,7 +4502,7 @@ typedef struct MemMap_t { MemMapItem_t ** field; // pointer to the item field uint used; // number of used titles in the item field - uint size; // number of allocated pointer in 'field' + uint size; // number of allocated pointers in 'field' u64 begin; // first address } MemMap_t; @@ -4833,7 +4881,15 @@ typedef struct RestoreState_t } RestoreState_t; -//----------------------------------------------------------------------------- +/////////////////////////////////////////////////////////////////////////////// + +static inline void InitializeRestoreState ( RestoreState_t *rs ) + { DASSERT(rs); memset(rs,0,sizeof(*rs)); } + +void ResetRestoreState ( RestoreState_t *rs ); + +/////////////////////////////////////////////////////////////////////////////// +// [[RestoreStateFunc]] typedef void (*RestoreStateFunc) ( @@ -4842,6 +4898,7 @@ typedef void (*RestoreStateFunc) ); //----------------------------------------------------------------------------- +// [[RestoreStateTab_t]] typedef struct RestoreStateTab_t { @@ -4853,6 +4910,16 @@ RestoreStateTab_t; /////////////////////////////////////////////////////////////////////////////// +enumError ScanRestoreState +( + RestoreState_t *rs, // valid control + void *data, // file data, modified, terminated by NULL or LF + uint size, // size of file data + void **end_data // not NULL: store end of analysed here +); + +/////////////////////////////////////////////////////////////////////////////// + enumError RestoreState ( const RestoreStateTab_t @@ -5111,6 +5178,11 @@ __attribute__ ((packed)) SaveRestoreTab_t; #define DEF_SRT_ARRAY_AC(v) DEF_SRT_ARRAY_C(v,0,SRT_DEF_ARRAY,0) #define DEF_SRT_ARRAY_END() {0,0,0,0,SRT_DEF_ARRAY,0} +//--- global array of structs + +#define DEF_SRT_ARRAY_GN(ne) {0,sizeof(SRT_NAME),0,ne,SRT_DEF_ARRAY,0} +#define DEF_SRT_ARRAY_GA(v) {0,sizeof(*v),0,sizeof(v)/sizeof(*v),SRT_DEF_ARRAY,0} + //--- special #define DEF_SRT_SEPARATOR() {0,0,0,0,SRT__IS_LIST,0} diff --git a/project/dclib/dclib-cli.c b/project/dclib/dclib-cli.c new file mode 100644 index 0000000..24fed39 --- /dev/null +++ b/project/dclib/dclib-cli.c @@ -0,0 +1,357 @@ + +/*************************************************************************** + * * + * _____ ____ * + * | __ \ / __ \ _ _ _____ * + * | | \ \ / / \_\ | | | | _ \ * + * | | \ \| | | | | | |_| | * + * | | | || | | | | | ___/ * + * | | / /| | __ | | | | _ \ * + * | |__/ / \ \__/ / | |___| | |_| | * + * |_____/ \____/ |_____|_|_____/ * + * * + * Wiimms source code library * + * * + *************************************************************************** + * * + * Copyright (c) 2012-2020 by Dirk Clemens <wiimm@wiimm.de> * + * * + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * See file gpl-2.0.txt or http://www.gnu.org/licenses/gpl-2.0.txt * + * * + ***************************************************************************/ + +#define _GNU_SOURCE 1 + +#include <unistd.h> + +#include "dclib-basics.h" +#include "dclib-debug.h" + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// arg_manager_t /////////////// +/////////////////////////////////////////////////////////////////////////////// + +void ResetArgManager ( arg_manager_t *am ) +{ + static char *null_list[] = {0}; + + if (am) + { + if (am->size) + { + uint i; + for ( i = 0; i < am->argc; i++ ) + FreeString(am->argv[i]); + if ( am->argv != null_list ) + FREE(am->argv); + } + memset(am,0,sizeof(*am)); + + am->argv = null_list; + } +} + +/////////////////////////////////////////////////////////////////////////////// + +void SetupArgManager ( arg_manager_t *am, int argc, char ** argv, bool clone ) +{ + DASSERT(am); + memset(am,0,sizeof(*am)); + if (clone) + CloneArgManager(am,argc,argv); + else + AttachArgManager(am,argc,argv); +} + +/////////////////////////////////////////////////////////////////////////////// + +void AttachArgManager ( arg_manager_t *am, int argc, char ** argv ) +{ + DASSERT(am); + ResetArgManager(am); + am->argc = argc; + am->argv = argv; +} + +/////////////////////////////////////////////////////////////////////////////// + +void CloneArgManager ( arg_manager_t *am, int argc, char ** argv ) +{ + DASSERT(am); + AttachArgManager(am,argc,argv); + PrepareEditArgManager(am,0); +} + +/////////////////////////////////////////////////////////////////////////////// + +void CopyArgManager ( arg_manager_t *dest, const arg_manager_t *src ) +{ + DASSERT(dest); + if (!src) + ResetArgManager(dest); + else if( dest != src ) + AttachArgManager(dest,src->argc,src->argv); +} + +/////////////////////////////////////////////////////////////////////////////// + +void MoveArgManager ( arg_manager_t *dest, arg_manager_t *src ) +{ + DASSERT(dest); + ResetArgManager(dest); + if (src) + { + dest->argv = src->argv; + dest->argc = src->argc; + dest->size = src->size; + memset(src,0,sizeof(*src)); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +void PrepareEditArgManager ( arg_manager_t *am, int needed_space ) +{ + DASSERT(am); + + uint new_size = am->argc; + if ( needed_space > 0 ) + new_size += needed_space; + new_size = GetGoodAllocSize2(new_size+(new_size>>4)+10,sizeof(*am->argv)); + PRINT("PrepareEditArgManager(,%d) n=%d, size: %d -> %d\n", + needed_space, am->argc, am->size, new_size ); + + if (am->size) + am->argv = REALLOC(am->argv,sizeof(*am->argv)*new_size); + else + { + char **old = am->argv; + am->argv = MALLOC(sizeof(*am->argv)*new_size); + + uint i; + for ( i = 0; i < am->argc; i++ ) + am->argv[i] = old[i] ? STRDUP(old[i]) : 0; + } + am->size = new_size - 1; + DASSERT( am->argc <= am->size ); + am->argv[am->argc] = 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +uint AppendArgManager ( arg_manager_t *am, ccp arg1, ccp arg2, bool move_arg ) +{ + DASSERT(am); + PRINT("AppendArgManager(,%s,%s,%d)\n",arg1,arg2,move_arg); + return InsertArgManager(am,am->argc,arg1,arg2,move_arg); +} + +/////////////////////////////////////////////////////////////////////////////// + +uint InsertArgManager + ( arg_manager_t *am, int pos, ccp arg1, ccp arg2, bool move_arg ) +{ + PRINT("InsertArgManager(,%d,%s,%s,%d)\n",pos,arg1,arg2,move_arg); + + pos = CheckIndex1(am->argc,pos); + const int n = (arg1!=0) + (arg2!=0); + if (n) + { + PrepareEditArgManager(am,n); + DASSERT( pos>0 && pos <= am->argc ); + char **dest = am->argv + pos; + if ( pos < am->argc ) + memmove( dest+n, dest, (u8*)(am->argv+am->argc) - (u8*)dest ); + if (arg1) + *dest++ = move_arg ? (char*)arg1 : STRDUP(arg1); + if (arg2) + *dest++ = move_arg ? (char*)arg2 : STRDUP(arg2); + am->argc += n; + am->argv[am->argc] = 0; + } + return pos+n; +} + +/////////////////////////////////////////////////////////////////////////////// + +uint ReplaceArgManager + ( arg_manager_t *am, int pos, ccp arg1, ccp arg2, bool move_arg ) +{ + PRINT("ReplaceArgManager(,%d,%s,%s,%d)\n",pos,arg1,arg2,move_arg); + + pos = CheckIndex1(am->argc,pos); + const int n = (arg1!=0) + (arg2!=0); + if (n) + { + PrepareEditArgManager(am,n); + DASSERT( pos>0 && pos <= am->argc ); + char **dest = am->argv + pos; + if (arg1) + { + if ( pos++ < am->argc ) + FreeString(*dest); + *dest++ = move_arg ? (char*)arg1 : STRDUP(arg1); + } + if (arg2) + { + if ( pos++ < am->argc ) + FreeString(*dest); + *dest++ = move_arg ? (char*)arg2 : STRDUP(arg2); + } + if ( pos > am->argc ) + { + am->argc = pos; + am->argv[am->argc] = 0; + } + } + return pos; +} + +/////////////////////////////////////////////////////////////////////////////// + +uint RemoveArgManager ( arg_manager_t *am, int pos, int count ) +{ + DASSERT(am); + + #if HAVE_PRINT + const int oldpos = pos; + #endif + const int n = CheckIndexC(am->argc,&pos,count); + PRINT("RemoveArgManager(,%d,%d) : remove n=%d: %d..%d\n", + oldpos, count, n, pos, pos+n ); + + DASSERT( pos >= 0 && pos <= am->argc ); + DASSERT( n >= 0 && pos+n <= am->argc ); + + if ( n > 0 ) + { + PrepareEditArgManager(am,0); + char **dest = am->argv + pos; + + uint i; + for ( i = 0; i <n; i++ ) + FreeString(dest[i]); + am->argc -= n; + memmove( dest, dest+n, (u8*)(am->argv+am->argc) - (u8*)dest ); + am->argv[am->argc] = 0; + } + return pos; +} + +/////////////////////////////////////////////////////////////////////////////// + +void DumpArgManager ( FILE *f, int indent, const arg_manager_t *am, ccp title ) +{ + if ( !f || !am ) + return; + + indent = NormalizeIndent(indent); + if (title) + fprintf(f,"%*s" "ArgManager[%s]: N=%d", + indent,"", title, am->argc ); + else + fprintf(f,"%*s" "ArgManager: N=%d", indent,"", am->argc ); + + if (am->size) + fprintf(f,"/%u\n",am->size); + else + fputc('\n',f); + + if (am->argc) + { + char buf[10]; + int fw = snprintf(buf,sizeof(buf),"%u",am->argc-1)+2; + + uint i; + for ( i = 0; i < am->argc; i++ ) + fprintf(f,"%*s%*u: |%s|\n", indent,"", fw,i, am->argv[i] ); + } +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// global commands /////////////// +/////////////////////////////////////////////////////////////////////////////// + +enumError Command_ARGTEST ( int argc, char ** argv ) +{ + printf("ARGUMENT TEST: %u arguments:\n",argc); + + int idx; + for ( idx = 0; idx < argc; idx++ ) + printf("%4u.: |%s|\n",idx,argv[idx]); + return ERR_OK; +} + +/////////////////////////////////////////////////////////////////////////////// + +enumError Command_COLORS +( + int level, // only used, if mode==NULL + // < 0: status message (ignore mode) + // >= 1: include names + // >= 2: include alt names + // >= 3: include color names incl bold + // >= 4: include background color names + uint mode, // output mode => see PrintColorSetHelper() + uint format // output format => see PrintColorSetEx() +) +{ + if (!colout) + SetupStdMsg(); + + if ( level < 0 ) + { + 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)), + colout->col_mode, GetColorModeName(colout->col_mode,"?"), + colout->colorize, colout->n_colors, colout->reset ); + return ERR_OK; + } + + if ( !mode && level > 0 ) + switch (level) + { + case 1: mode = 0x08; break; + case 2: mode = 0x18; break; + case 3: mode = 0x1b; break; + default: mode = 0x1f; break; + } + + if (!format) + { + const ColorMode_t col_mode = colout ? colout->col_mode : COLMD_AUTO; + PrintTextModes( stdout, 4, col_mode ); + PrintColorModes( stdout, 4, col_mode, GCM_ALT ); + #ifdef TEST + PrintColorModes( stdout, 4, col_mode, GCM_ALT|GCM_SHORT ); + #endif + } + if ( mode || format ) + PrintColorSetEx(stdout,4,colout,mode,format); + return ERR_OK; +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// END /////////////// +/////////////////////////////////////////////////////////////////////////////// + diff --git a/project/dclib/dclib-file.c b/project/dclib/dclib-file.c index 4f02ea5..a527c5a 100644 --- a/project/dclib/dclib-file.c +++ b/project/dclib/dclib-file.c @@ -4136,6 +4136,81 @@ int ScanSections /////////////// scan configuration /////////////// /////////////////////////////////////////////////////////////////////////////// +void ResetRestoreState ( RestoreState_t *rs ) +{ + if (rs) + { + ResetParamField(&rs->param); + InitializeRestoreState(rs); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +enumError ScanRestoreState +( + RestoreState_t *rs, // valid control + void *data, // file data, modified, terminated by NULL or LF + uint size, // size of file data + void **end_data // not NULL: store end of analysed here +) +{ + DASSERT(rs); + DASSERT(data||!size); + if (!size) + return ERR_OK; + + char *ptr = data; + char *end = ptr + size; + + if (!rs->param.field) + InitializeParamField(&rs->param); + + //--- scan name=value + + while ( ptr < end ) + { + //--- skip lines and blanks + while ( ptr < end && (uchar)*ptr <= ' ' ) + ptr++; + + if ( *ptr == '[' ) + break; + + //--- scan name + ccp name = ptr; + while ( *ptr >= '!' && *ptr <= '~' && *ptr != '=' ) + ptr++; + char *name_end = ptr; + + //--- scan param + while ( *ptr == ' ' || *ptr == '\t' ) + ptr++; + if ( *ptr != '=' ) + continue; + if ( *++ptr == ' ' ) // skip max 1 space + ptr++; + + ccp value = ptr; + while ( (uchar)*ptr >= ' ' || *ptr == '\t' ) + ptr++; + + *name_end = *ptr = 0; + InsertParamField(&rs->param,name,false,0,value); + + //--- next line + while ( ptr < end && *ptr && *ptr != '\n' ) + ptr++; + } + + if (end_data) + *end_data = ptr; + + return ERR_OK; +} + +/////////////////////////////////////////////////////////////////////////////// + enumError RestoreState ( const RestoreStateTab_t @@ -4267,8 +4342,9 @@ enumError RestoreState } #endif - tab->func(&rs,tab->user_table); - if ( log_mode & RSL_UNUSED_NAMES ) + if (tab->func) + tab->func(&rs,tab->user_table); + if ( log_file && log_mode & RSL_UNUSED_NAMES ) { ParamFieldItem_t *ptr = rs.param.field, *end; for ( end = ptr + rs.param.used; ptr < end; ptr++ ) @@ -4285,7 +4361,7 @@ enumError RestoreState ptr->key, len, (ccp)ptr->data ); } } - ResetParamField(&rs.param); + ResetRestoreState(&rs); } return ERR_OK; @@ -5590,6 +5666,269 @@ ccp PrintOpenFiles ( bool count_current ) // /////////////////////////////////////////////////////////////////////////////// +/////////////// PrintScript /////////////// +/////////////////////////////////////////////////////////////////////////////// + +ccp GetNamePSFF ( PrintScriptFF fform ) +{ + switch(fform) + { + case PSFF_UNKNOWN: return "TEXT"; + case PSFF_JSON: return "JSON"; + case PSFF_BASH: return "BASH"; + case PSFF_SH: return "SH"; + case PSFF_PHP: return "PHP"; + case PSFF_MAKEDOC: return "MDOC"; + } + return "???"; +} + +/////////////////////////////////////////////////////////////////////////////// + +void PrintScriptHeader ( PrintScript_t *ps ) +{ + DASSERT(ps); + + ps->index = 0; + ps->add_index = false; + ps->sep[0] = ps->sep[1] = 0; + + if ( ps->f ) + { + switch (ps->fform) + { + case PSFF_JSON: + if (ps->create_array) + fputs("[",ps->f); + break; + + case PSFF_SH: + ps->add_index =ps->create_array; + break; + + case PSFF_PHP: + if (ps->create_array) + fprintf(ps->f,"$%s = array();\n\n",ps->varname); + break; + + case PSFF_MAKEDOC: + if (ps->create_array) + fprintf(ps->f,"%s = @LIST\n\n",ps->varname); + break; + + default: + //fputc('\n',ps->f); + break; + } + } +} + +/////////////////////////////////////////////////////////////////////////////// + +void PrintScriptFooter ( PrintScript_t *ps ) +{ + DASSERT(ps); + + if (ps->f) + { + switch (ps->fform) + { + case PSFF_JSON: + if (ps->create_array) + fputs("]\n",ps->f); + break; + + case PSFF_SH: + if (ps->create_array) + fprintf(ps->f,"%s_N=%u\n\n",ps->varname,ps->index); + break; + + case PSFF_PHP: + fputs("?>\n",ps->f); + break; + + default: + break; + } + } +} + +/////////////////////////////////////////////////////////////////////////////// + +int PutScriptVars +( + PrintScript_t *ps, // valid control struct + uint mode, // bit field: 1=open var, 2:close var + ccp text // text with line of format NAME=VALUE +) +{ + FILE * f = ps ? ps->f : 0; + if (!f) + return 0; + + + //--- begin of output + + if ( mode & 1 ) + { + if ( ps->add_index ) + snprintf( ps->prefix, sizeof(ps->prefix), + "%s_%u", ps->varname, ps->index ); + else + snprintf( ps->prefix, sizeof(ps->prefix), + "%s", ps->varname ); + + switch (ps->fform) + { + case PSFF_JSON: + fprintf(f,"%s{",ps->sep); + ps->sep[0] = ','; + break; + + case PSFF_PHP: + fputs("$d = new \\stdClass;\n",f); + break; + + case PSFF_MAKEDOC: + fprintf(f,"d = @MAP\n"); + break; + + default: + break; + } + } + + + //--- print var lines + + if (!text) + text = ""; + + uint count; + for( count = 0; ; count++ ) + { + while ( *text && (uchar)*text <= ' ' ) + text++; + + ccp ptr = text; + while ( *ptr && *ptr != '=' ) + ptr++; + if ( *ptr != '=' || ptr == text ) + break; + + ccp param = ptr++; + while ( (uchar)*ptr >= ' ' ) + ptr++; + + switch (ps->fform) + { + case PSFF_JSON: + fprintf(f, "%s\"%.*s\":%.*s", + count ? "," : "", + (int)( param - text ), text, + (int)( ptr - param - 1 ), param+1 ); + break; + + case PSFF_BASH: + if (ps->create_array) + { + fprintf(f, "%s_%.*s%s=(%.*s)\n", ps->prefix, + (int)( param - text ), text, + ps->index ? "+" : "", + (int)( ptr - param - 1 ), param+1 ); + break; + } + // fall through + + case PSFF_SH: + fprintf(f, "%s_%.*s=%.*s\n", ps->prefix, + (int)( param - text ), text, + (int)( ptr - param - 1 ), param+1 ); + break; + + case PSFF_PHP: + fprintf(f, "$d->%.*s = %.*s;\n", + (int)( param - text ), text, + (int)( ptr - param - 1 ), param+1 ); + break; + + case PSFF_MAKEDOC: + fprintf(f, "d[\"%.*s\"] = %.*s\n", + (int)( param - text ), text, + (int)( ptr - param - 1 ), param+1 ); + break; + + default: + fprintf(f, "%20.*s = %.*s\n", + (int)( param - text ), text, + (int)( ptr - param - 1 ), param+1 ); + break; + } + + text = ptr; + } + + + //--- end of output + + if ( mode & 2 ) + { + switch (ps->fform) + { + case PSFF_JSON: + fputs("}\n",f); + break; + + case PSFF_PHP: + fprintf(f, "$%s%s = $d;\n\n", + ps->prefix, ps->create_array ? "[]" : "" ); + break; + + case PSFF_MAKEDOC: + fprintf(f, "%s %s= move(d);\n\n", + ps->prefix, ps->create_array ? "#" : "" ); + break; + + default: + fputc('\n',f); + break; + } + fflush(f); + } + + ps->index++; + return count; +} + +/////////////////////////////////////////////////////////////////////////////// + +int PrintScriptVars +( + PrintScript_t *ps, // valid control struct + uint mode, // bit field: 1=open var, 2:close var + ccp format, // format of message + ... // arguments + +) +{ + DASSERT(ps); + + char buf[5000]; + if (format) + { + va_list arg; + va_start(arg,format); + vsnprintf(buf,sizeof(buf),format,arg); + va_end(arg); + } + else + *buf = 0; + + return PutScriptVars(ps,mode,buf); +} + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// END /////////////// /////////////////////////////////////////////////////////////////////////////// diff --git a/project/dclib/dclib-file.h b/project/dclib/dclib-file.h index 6f6aee9..bce66b1 100644 --- a/project/dclib/dclib-file.h +++ b/project/dclib/dclib-file.h @@ -183,7 +183,6 @@ static inline int CompareTimeSpecVal static inline int CompareTimeSpecTime ( const struct timespec *a, const time_t tim ) { DASSERT(a); - DASSERT(b); return a->tv_sec < tim ? -1 : a->tv_sec > tim ? 1 : a->tv_nsec > 0; @@ -1330,6 +1329,70 @@ ccp PrintOpenFiles ( bool count_current ); // print to circ buffer // /////////////////////////////////////////////////////////////////////////////// +/////////////// PrintScript /////////////// +/////////////////////////////////////////////////////////////////////////////// +// [[PrintScriptFF]] // FF = File Format + +typedef enum PrintScriptFF +{ + PSFF_UNKNOWN, // always 0 + PSFF_JSON, + PSFF_BASH, + PSFF_SH, + PSFF_PHP, + PSFF_MAKEDOC, +} +PrintScriptFF; + +ccp GetNamePSFF ( PrintScriptFF fform ); + +//----------------------------------------------------------------------------- +// [[PrintScript_t]] + +typedef struct PrintScript_t +{ + FILE *f; // valid output file + PrintScriptFF fform; // output: file format + ccp varname; // valid ponter to var name + bool create_array; // true: create ar arrays + bool add_index; // true: add index to varname + uint index; // index for array operations + char sep[2]; // separator for JSON + char prefix[100]; // varname prefix +} +PrintScript_t; + +//----------------------------------------------------------------------------- + +static inline void InitializePrintScript ( PrintScript_t *ps ) + { DASSERT(ps); memset(ps,0,sizeof(*ps)); } + +static inline void ResetPrintScript ( PrintScript_t *ps ) + { DASSERT(ps); memset(ps,0,sizeof(*ps)); } + +/////////////////////////////////////////////////////////////////////////////// + +void PrintScriptHeader ( PrintScript_t *ps ); +void PrintScriptFooter ( PrintScript_t *ps ); + +int PutScriptVars +( + PrintScript_t *ps, // valid control struct + uint mode, // bit field: 1=open var, 2:close var + ccp text // text with line of format NAME=VALUE +); + +int PrintScriptVars +( + PrintScript_t *ps, // valid control struct + uint mode, // bit field: 1=open var, 2:close var + ccp format, // format of message + ... // arguments +) +__attribute__ ((__format__(__printf__,3,4))); + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// E N D /////////////// /////////////////////////////////////////////////////////////////////////////// diff --git a/project/dclib/dclib-network-linux.c b/project/dclib/dclib-network-linux.c index 900714e..b913aa4 100644 --- a/project/dclib/dclib-network-linux.c +++ b/project/dclib/dclib-network-linux.c @@ -49,6 +49,111 @@ // /////////////////////////////////////////////////////////////////////////////// +/////////////// IP/UDP /////////////// +/////////////////////////////////////////////////////////////////////////////// + +ssize_t ReceiveUDPv4 +( + int sock, // valid socket + void *buf, // buffer tostore incoming data + size_t buf_size, // size of buffer + int flags, // flags for recffrom() or recvmsg() + struct sockaddr_in *src_addr, // not NULL: store source address + in_addr_t *dest_addr // not NULL: store destination IPv4 (NBO) +) +{ + DASSERT(buf); + + if (!dest_addr) + { + socklen_t src_len = sizeof(*src_addr); + return recvfrom( sock, buf, buf_size, flags, + (struct sockaddr*)src_addr, &src_len ); + } + + struct sockaddr_in sa_temp; + if (!src_addr) + src_addr = &sa_temp; + + *dest_addr = 0; + u8 control[CMSG_SPACE(sizeof(struct in_pktinfo))]; + + struct iovec iov; + iov.iov_base = buf; + iov.iov_len = buf_size; + + struct msghdr msg = {0}; + msg.msg_name = src_addr; + msg.msg_namelen = sizeof(*src_addr); + msg.msg_iov = &iov; + msg.msg_iovlen = 1; + msg.msg_control = control; + msg.msg_controllen = sizeof(control); + + ssize_t stat = recvmsg(sock,&msg,flags); + if ( stat < 0 ) + return stat; + + struct cmsghdr *cp; + for ( cp = CMSG_FIRSTHDR(&msg); cp; cp = CMSG_NXTHDR(&msg,cp)) + { + if ( cp->cmsg_level == IPPROTO_IP && cp->cmsg_type == IP_PKTINFO ) + { + struct in_pktinfo *pktinfo = (struct in_pktinfo*) CMSG_DATA(cp); + *dest_addr = pktinfo->ipi_spec_dst.s_addr; + break; + } + } + + return stat; +} + +/////////////////////////////////////////////////////////////////////////////// + +ssize_t SendUDPv4 +( + int sock, // valid socket + const void *data, // data to send + size_t data_size, // size of data + int flags, // flags for sendto() or sendmsg() + struct sockaddr_in *dest_addr, // destination address (NULL possible) + in_addr_t src_addr // not 0: source IPv4 (NBO) +) +{ + DASSERT(data); + DASSERT(dest_addr); + + if (!src_addr) + return sendto(sock,data,data_size,flags,dest_addr,sizeof(*dest_addr)); + + u8 control[CMSG_SPACE(sizeof(struct in_pktinfo))]; + + struct iovec iov; + iov.iov_base = (void*)data; + iov.iov_len = data_size; + + struct msghdr msg = {0}; + msg.msg_name = dest_addr; + msg.msg_namelen = sizeof(*dest_addr); + msg.msg_iov = &iov; + msg.msg_iovlen = 1; + msg.msg_control = control; + msg.msg_controllen = sizeof(control); + + struct cmsghdr *cp = CMSG_FIRSTHDR(&msg); + cp->cmsg_level = IPPROTO_IP; + cp->cmsg_type = IP_PKTINFO; + cp->cmsg_len = CMSG_LEN(sizeof(struct in_pktinfo)); + + struct in_pktinfo *pki = (struct in_pktinfo*) CMSG_DATA(cp); + pki->ipi_ifindex = 0; + pki->ipi_spec_dst.s_addr = src_addr; + + return sendmsg(sock,&msg,flags); +} + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// SendRawUDP() /////////////// /////////////////////////////////////////////////////////////////////////////// diff --git a/project/dclib/dclib-network-linux.h b/project/dclib/dclib-network-linux.h index fc09ed8..bd3cb79 100644 --- a/project/dclib/dclib-network-linux.h +++ b/project/dclib/dclib-network-linux.h @@ -41,7 +41,62 @@ // /////////////////////////////////////////////////////////////////////////////// -/////////////// IP interface /////////////// +/////////////// IP/UDP /////////////// +/////////////////////////////////////////////////////////////////////////////// + +ssize_t ReceiveUDPv4 +( + int sock, // valid socket + void *buf, // buffer tostore incoming data + size_t buf_size, // size of buffer + int flags, // flags for recffrom() or recvmsg() + struct sockaddr_in *src_addr, // not NULL: stire source address + in_addr_t *dest_addr // not NULL: store destination IPv4 (NBO) +); + +/////////////////////////////////////////////////////////////////////////////// + +ssize_t SendUDPv4 +( + int sock, // valid socket + const void *data, // data to send + size_t data_size, // size of data + int flags, // flags for sendto() or sendmsg() + struct sockaddr_in *dest_addr, // destination address (NULL possible) + in_addr_t src_addr // not 0: source IPv4 (NBO) +); + +/////////////////////////////////////////////////////////////////////////////// + +ssize_t recvfrom2 +( + int sock, + void *buf, + size_t buf_size, + int flags, + struct sockaddr *src_addr, + socklen_t *src_addrlen, + struct sockaddr *dest_addr, + socklen_t *dest_addrlen +); + +//----------------------------------------------------------------------------- + +ssize_t sendto2 +( + int sock, + const void *buf, + size_t buf_size, + int flags, + struct sockaddr *dest_addr, + socklen_t dest_addrlen, + struct sockaddr_in *src_addr, + socklen_t src_addrlen +); + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// SendRawUDP() /////////////// /////////////////////////////////////////////////////////////////////////////// enumError SendRawUDP diff --git a/project/dclib/dclib-network.h b/project/dclib/dclib-network.h index 4cf099f..58076c9 100644 --- a/project/dclib/dclib-network.h +++ b/project/dclib/dclib-network.h @@ -42,6 +42,13 @@ // /////////////////////////////////////////////////////////////////////////////// +/////////////// definitions /////////////// +/////////////////////////////////////////////////////////////////////////////// + +#define GOOD_SOCKADR_SIZE sizeof(struct sockaddr_un) + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// host name support /////////////// /////////////////////////////////////////////////////////////////////////////// // [[NetworkHost_t]] diff --git a/project/dclib/dclib-numeric.c b/project/dclib/dclib-numeric.c index 138053d..d39567b 100644 --- a/project/dclib/dclib-numeric.c +++ b/project/dclib/dclib-numeric.c @@ -711,13 +711,29 @@ void write_lef4n ( float32 * dest, const float32 * src, int n ) /////////////////////////////////////////////////////////////////////////////// +static inline u16 ident16 ( u16 data ) { return data; } +static inline u32 ident32 ( u32 data ) { return data; } +static inline u64 ident64 ( u64 data ) { return data; } + +static inline u16 reverse16 ( u16 data ) { return swap16(&data); } +static inline u32 reverse32 ( u32 data ) { return swap32(&data); } +static inline u64 reverse64 ( u64 data ) { return swap64(&data); } + const endian_func_t be_func = { {0xfe,0xff}, true, false, DC_BIG_ENDIAN, be16, be24, be32, be40, be48, be56, be64, bef4, bef8, write_be16, write_be24, write_be32, write_be40, write_be48, write_be56, write_be64, - write_bef4, write_bef8 + write_bef4, write_bef8, + + #if IS_BIG_ENDIAN + ident16, ident32, ident64, + ident16, ident32, ident64, + #else + reverse16, reverse32, reverse64, + reverse16, reverse32, reverse64, + #endif }; const endian_func_t le_func = @@ -726,7 +742,15 @@ const endian_func_t le_func = le16, le24, le32, le40, le48, le56, le64, lef4, lef8, write_le16, write_le24, write_le32, write_le40, write_le48, write_le56, write_le64, - write_lef4, write_lef8 + write_lef4, write_lef8, + + #if IS_LITTLE_ENDIAN + ident16, ident32, ident64, + ident16, ident32, ident64, + #else + reverse16, reverse32, reverse64, + reverse16, reverse32, reverse64, + #endif }; const endian_func_t * GetEndianFunc ( const void * byte_order_mark ) @@ -854,6 +878,72 @@ int CheckIndex2End ( int max, int * p_begin, int * p_end ) return end - begin; } +/////////////////////////////////////////////////////////////////////////////// + +int CheckIndexC ( int max, int * p_begin, int count ) +{ + DASSERT( max >= 0 ); + DASSERT(p_begin); + + int begin = *p_begin, end = begin + count; + if ( begin < 0 ) + { + begin += max; + end = begin + count; + if ( begin < 0 ) + begin = 0; + } + else if ( begin > max ) + begin = max; + + if ( end < 0 ) + end = 0; + else if ( end > max ) + end = max; + + if ( end < begin ) + { + *p_begin = end; + return begin-end; + } + + *p_begin = begin; + return end - begin; +} + +/////////////////////////////////////////////////////////////////////////////// + +int CheckIndexCEnd ( int max, int * p_begin, int count ) +{ + DASSERT( max >= 0 ); + DASSERT(p_begin); + + int begin = *p_begin, end = begin + count; + if ( begin <= 0 ) + { + begin += max; + end = begin + count; + if ( begin < 0 ) + begin = 0; + } + else if ( begin > max ) + begin = max; + + if ( end < 0 ) + end = 0; + else if ( end > max ) + end = max; + + if ( end < begin ) + { + *p_begin = end; + return begin-end; + } + + *p_begin = begin; + return end - begin; +} + // /////////////////////////////////////////////////////////////////////////////// /////////////// encoding/decoding /////////////// diff --git a/project/dclib/dclib-option.h b/project/dclib/dclib-option.h index f1bf8f0..d293b9e 100644 --- a/project/dclib/dclib-option.h +++ b/project/dclib/dclib-option.h @@ -269,7 +269,7 @@ typedef struct GOptions_t //--- parameters int argc; // number of parameters - char **argv; // paramters without options + char **argv; // parameters without options //--- named options diff --git a/project/dclib/dclib-system.h b/project/dclib/dclib-system.h index e5a7380..e1f8264 100644 --- a/project/dclib/dclib-system.h +++ b/project/dclib/dclib-system.h @@ -44,10 +44,11 @@ typedef enum enumSystemID SYSID_UNKNOWN = 0x00000000, SYSID_I386 = 0x01000000, SYSID_X86_64 = 0x02000000, - SYSID_CYGWIN = 0x03000000, - SYSID_APPLE = 0x04000000, - SYSID_LINUX = 0x05000000, - SYSID_UNIX = 0x06000000, + SYSID_CYGWIN32 = 0x03000000, + SYSID_CYGWIN64 = 0x04000000, + SYSID_APPLE = 0x05000000, + SYSID_LINUX = 0x06000000, + SYSID_UNIX = 0x07000000, } enumSystemID; @@ -56,29 +57,39 @@ typedef enum enumSystemID #undef SYSTEM_LINUX #ifdef __CYGWIN__ - #define SYSTEM "cygwin" - #define SYSTEMID SYSID_CYGWIN + #define SYSTEM "cygwin" + #ifdef __x86_64 + #define SYSTEM2 "cygwin64" + #define SYSTEMID SYSID_CYGWIN64 + #else + #define SYSTEM2 "cygwin32" + #define SYSTEMID SYSID_CYGWIN32 + #endif #elif __APPLE__ - #define SYSTEM "mac" - #define SYSTEMID SYSID_APPLE + #define SYSTEM "mac" + #define SYSTEMID SYSID_APPLE #elif __linux__ #define SYSTEM_LINUX 1 #ifdef __i386__ - #define SYSTEM "i386" - #define SYSTEMID SYSID_I386 + #define SYSTEM "i386" + #define SYSTEMID SYSID_I386 #elif __x86_64__ - #define SYSTEM "x86_64" - #define SYSTEMID SYSID_X86_64 + #define SYSTEM "x86_64" + #define SYSTEMID SYSID_X86_64 #else - #define SYSTEM "linux" - #define SYSTEMID SYSID_LINUX + #define SYSTEM "linux" + #define SYSTEMID SYSID_LINUX #endif #elif __unix__ - #define SYSTEM "unix" - #define SYSTEMID SYSID_UNIX + #define SYSTEM "unix" + #define SYSTEMID SYSID_UNIX #else - #define SYSTEM "unknown" - #define SYSTEMID SYSID_UNKNOWN + #define SYSTEM "unknown" + #define SYSTEMID SYSID_UNKNOWN +#endif + +#ifndef SYSTEM2 + #define SYSTEM2 SYSTEM #endif /////////////////////////////////////////////////////////////////////////////// @@ -87,11 +98,13 @@ static inline void dclibPrintSystem ( FILE * f ) { fprintf(f, "SYSTEM\t\t:= %s\n" + "SYSTEM2\t\t:= %s\n" "SYSTEMID\t:= 0x%x\n" #ifdef SYSTEM_LINUX "SYSTEM_LINUX\t:= 1\n" #endif ,SYSTEM + ,SYSTEM2 ,SYSTEMID ); } diff --git a/project/dclib/dclib-types.h b/project/dclib/dclib-types.h index 8631d9a..360c026 100644 --- a/project/dclib/dclib-types.h +++ b/project/dclib/dclib-types.h @@ -51,6 +51,22 @@ /////////////////////////////////////////////////////////////////////////////// /////////////// endian /////////////// /////////////////////////////////////////////////////////////////////////////// + +#undef IS_BIG_ENDIAN +#undef IS_LITTLE_ENDIAN + +#if __BYTE_ORDER == __BIG_ENDIAN + #define IS_BIG_ENDIAN 1 + #define IS_LITTLE_ENDIAN 0 +#elif __BYTE_ORDER == __LITTLE_ENDIAN + #define IS_BIG_ENDIAN 0 + #define IS_LITTLE_ENDIAN 1 +#else + #define IS_BIG_ENDIAN 0 + #define IS_LITTLE_ENDIAN 0 +#endif + +//----------------------------------------------------------------------------- // [[dcEndian_t]] typedef enum dcEndian_t @@ -63,7 +79,7 @@ typedef enum dcEndian_t //--- define local & reverse endian, if possible - #if __BYTE_ORDER == __LITTLE_ENDIAN || __BYTE_ORDER == __BIG_ENDIAN + #if IS_BIG_ENDIAN || IS_LITTLE_ENDIAN DC_LOCAL_ENDIAN = DC_DEFAULT_ENDIAN, DC_REVERSE_ENDIAN = DC_SECOND_ENDIAN, @@ -73,7 +89,7 @@ typedef enum dcEndian_t //--- define aliases for little & big endian - #if __BYTE_ORDER == __BIG_ENDIAN + #if IS_BIG_ENDIAN DC_BIG_ENDIAN = DC_DEFAULT_ENDIAN, DC_LITTLE_ENDIAN = DC_SECOND_ENDIAN, diff --git a/project/dclib/lib-bmg.c b/project/dclib/lib-bmg.c index 639d940..599c2dc 100644 --- a/project/dclib/lib-bmg.c +++ b/project/dclib/lib-bmg.c @@ -89,6 +89,7 @@ bool opt_bmg_use_raw_sections= 0; // true: use raw sections //----------------------------------------------------------------------------- +int opt_bmg_endian = BMG_AUTO_ENDIAN; int opt_bmg_encoding = BMG_ENC__UNDEFINED; uint opt_bmg_inf_size = 0; OffOn_t opt_bmg_mid = OFFON_AUTO; @@ -150,6 +151,42 @@ const KeywordTab_t PatchKeysBMG[] = // /////////////////////////////////////////////////////////////////////////////// +/////////////// endian helpers /////////////// +/////////////////////////////////////////////////////////////////////////////// + +static const endian_func_t * get_bmg_endian ( const bmg_t * bmg ) +{ + return opt_bmg_endian == BMG_LITTLE_ENDIAN + ? &le_func + : opt_bmg_endian == BMG_BIG_ENDIAN || !bmg + ? &be_func + : bmg->endian; +} + +//----------------------------------------------------------------------------- + +static const endian_func_t * get_endian_by_bh ( const bmg_header_t * bh, uint size ) +{ + DASSERT(bh); + if ( be_func.n2hl(bh->size) <= size + && be_func.n2hl(bh->n_sections) <= BMG_MAX_SECTIONS + ) + { + return &be_func; + } + + if ( le_func.n2hl(bh->size) <= size + && le_func.n2hl(bh->n_sections) <= BMG_MAX_SECTIONS + ) + { + return &le_func; + } + + return 0; +} + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// print & scan string16 /////////////// /////////////////////////////////////////////////////////////////////////////// @@ -1069,18 +1106,27 @@ static u16 * ScanRange16U32 /////////////// ScanSectionsBMG() /////////////// /////////////////////////////////////////////////////////////////////////////// -bmg_sect_list_t * ScanSectionsBMG ( cvp data, uint size ) +bmg_sect_list_t * ScanSectionsBMG + ( cvp data, uint size, const endian_func_t *endian ) { //--- initialize if ( !data || size < sizeof(bmg_header_t) || memcmp(data,BMG_MAGIC,8) ) return 0; - bmg_sect_list_t sl; - memset(&sl,0,sizeof(sl)); - sl.header = (bmg_header_t*)data; - sl.source_size = ntohl(sl.header->size); - sl.n_sections = ntohl(sl.header->n_sections); + bmg_sect_list_t sl = {0}; + sl.header = (bmg_header_t*)data; + + if (!endian) + { + endian = get_endian_by_bh(sl.header,size); + if (!endian) + return 0; + } + + sl.endian = endian; + sl.source_size = endian->n2hl(sl.header->size); + sl.n_sections = endian->n2hl(sl.header->n_sections); FastBuf_t fb; InitializeFastBufAlloc(&fb,10*sizeof(bmg_sect_info_t)); @@ -1099,7 +1145,7 @@ bmg_sect_list_t * ScanSectionsBMG ( cvp data, uint size ) memset(&si,0,sizeof(si)); si.offset = (u8*)sect - (u8*)data; - si.sect_size = si.real_size = ntohl(sect->size); + si.sect_size = si.real_size = endian->n2hl(sect->size); if ( (u8*)sect + si.real_size > data_end ) si.real_size = data_end - (u8*)sect; @@ -1110,8 +1156,8 @@ bmg_sect_list_t * ScanSectionsBMG ( cvp data, uint size ) { sl.pinf = (bmg_inf_t*)sect; si.head_size = sizeof(bmg_inf_t); - si.elem_size = ntohs(sl.pinf->inf_size); - si.n_elem_head = ntohs(sl.pinf->n_msg); + si.elem_size = endian->n2hs(sl.pinf->inf_size); + si.n_elem_head = endian->n2hs(sl.pinf->n_msg); si.known = true; si.supported = true; si.info = "offset & attributes"; @@ -1137,7 +1183,7 @@ bmg_sect_list_t * ScanSectionsBMG ( cvp data, uint size ) sl.pmid = (bmg_mid_t*)sect; si.head_size = sizeof(bmg_mid_t); si.elem_size = sizeof(u32); - si.n_elem_head = ntohs(sl.pinf->n_msg); + si.n_elem_head = endian->n2hs(sl.pinf->n_msg); si.known = true; si.supported = true; si.info = "message ids"; @@ -1821,6 +1867,32 @@ int (*GetArenaIndexBMG) ( uint idx, int result_on_invalid ) = GetArenaIndexBMG0; // /////////////////////////////////////////////////////////////////////////////// +/////////////// bmg endian support /////////////// +/////////////////////////////////////////////////////////////////////////////// + +const KeywordTab_t TabEndianBMG[] = +{ + { BMG_AUTO_ENDIAN, "AUTO", "UNDEFINED", 0 }, + { BMG_BIG_ENDIAN, "BIG", "BE", 0 }, + { BMG_LITTLE_ENDIAN, "LITTLE", "LE", 0 }, + { 0,0,0,0 } +}; + +//----------------------------------------------------------------------------- + +ccp GetEndianNameBMG ( int endian, ccp return_if_invalid ) +{ + switch (endian) + { + case BMG_AUTO_ENDIAN: return "AUTO"; + case BMG_BIG_ENDIAN: return "BIG"; + case BMG_LITTLE_ENDIAN: return "LITTLE"; + } + return return_if_invalid; +} + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// bmg encoding support /////////////// /////////////////////////////////////////////////////////////////////////////// @@ -1922,6 +1994,8 @@ void InitializeBMG ( bmg_t * bmg ) DASSERT(bmg); memset(bmg,0,sizeof(*bmg)); + + bmg->endian = &be_func; bmg->have_mid = 1; bmg->encoding = BMG_ENC__DEFAULT; bmg->use_slots = opt_bmg_use_slots; @@ -2168,11 +2242,12 @@ enumError ScanRawBMG ( bmg_t * bmg ) { DASSERT(bmg); DASSERT(bmg->data); + DASSERT(bmg->endian); const bmg_header_t * bh = (bmg_header_t*)bmg->data; DASSERT(!memcmp(bh->magic,BMG_MAGIC,sizeof(bh->magic))); - u32 data_size = ntohl(bh->size); + u32 data_size = bmg->endian->n2hl(bh->size); bmg->encoding = bh->encoding; if ( !bmg->encoding && data_size*BMG_LEGACY_BLOCK_SIZE <= bmg->data_size ) { @@ -2189,7 +2264,7 @@ enumError ScanRawBMG ( bmg_t * bmg ) data_size = bmg->data_size; } - const bmg_sect_list_t *sl = ScanSectionsBMG(bmg->data,data_size); + const bmg_sect_list_t *sl = ScanSectionsBMG(bmg->data,data_size,bmg->endian); if ( !sl || !sl->header ) return ERROR0(ERR_INVALID_DATA,"Invalid BMG data: %s",bmg->fname); @@ -2251,33 +2326,33 @@ enumError ScanRawBMG ( bmg_t * bmg ) if ( !sl->pinf || !sl->pdat ) return ERROR0(ERR_INVALID_DATA,"Corrupted BMG file: %s\n",bmg->fname); - bmg->unknown_inf_0c = ntohl(pinf->unknown_0c); + bmg->unknown_inf_0c = bmg->endian->n2hl(pinf->unknown_0c); uint max_item; bmg->have_mid = pmid != 0; if (bmg->have_mid) { - bmg->unknown_mid_0a = ntohs(pmid->unknown_0a); - bmg->unknown_mid_0c = ntohl(pmid->unknown_0c); + bmg->unknown_mid_0a = bmg->endian->n2hs(pmid->unknown_0a); + bmg->unknown_mid_0c = bmg->endian->n2hl(pmid->unknown_0c); - max_item = ( ntohl(pmid->size) - sizeof(*pmid) ) / sizeof(*pmid->mid); - if ( max_item > ntohs(pmid->n_msg) ) - max_item = ntohs(pmid->n_msg); + max_item = ( bmg->endian->n2hl(pmid->size) - sizeof(*pmid) ) / sizeof(*pmid->mid); + if ( max_item > bmg->endian->n2hs(pmid->n_msg) ) + max_item = bmg->endian->n2hs(pmid->n_msg); PRINT("BMG with MID1: N=%u [inf=%u,mid=%u], %s\n", - max_item, ntohs(pinf->n_msg), ntohs(pmid->n_msg), bmg->fname ); + max_item, bmg->endian->n2hs(pinf->n_msg), bmg->endian->n2hs(pmid->n_msg), bmg->fname ); } else { - max_item = ntohs(pinf->n_msg); + max_item = bmg->endian->n2hs(pinf->n_msg); PRINT("BMG without MID1: N=%u, %s\n",max_item,bmg->fname); } - const uint max_offset = ( ntohl(pdat->size) - sizeof(*pdat) ) + const uint max_offset = ( bmg->endian->n2hl(pdat->size) - sizeof(*pdat) ) / sizeof(*pdat->text_pool); const u8 *text_end = pdat->text_pool + max_offset; const u8 *raw_inf = (u8*)pinf->list; - const uint src_inf_size = ntohs(pinf->inf_size); + const uint src_inf_size = bmg->endian->n2hs(pinf->inf_size); AssignInfSizeBMG(bmg,src_inf_size); @@ -2289,7 +2364,7 @@ enumError ScanRawBMG ( bmg_t * bmg ) for ( idx = 0; idx < bmg->attrib_used; idx += 4 ) { const u32 major = FindMajority32(raw_inf+idx+4,max_item,src_inf_size); - noPRINT("-> IDX: %2u -> %8x\n",idx,ntohl(major)); + noPRINT("-> IDX: %2u -> %8x\n",idx,bmg->endian->n2hl(major)); memcpy(bmg->attrib+idx,&major,4); } //HexDump16(stderr,8,0x10,bmg->attrib,bmg->attrib_used); @@ -2309,9 +2384,9 @@ enumError ScanRawBMG ( bmg_t * bmg ) for ( slot = 0; slot < max_item; slot++, raw_inf += src_inf_size ) { bmg_inf_item_t *item = (bmg_inf_item_t*)raw_inf; - const u32 offset = ntohl(item->offset); + const u32 offset = bmg->endian->n2hl(item->offset); - u32 mid = pmid ? ntohl(pmid->mid[slot]) : slot; + u32 mid = pmid ? bmg->endian->n2hl(pmid->mid[slot]) : slot; if ( mid == 0xffff && !offset ) ffff_count++; if ( mid < prev_mid ) @@ -2677,7 +2752,9 @@ enumError ScanTextBMG ( bmg_t * bmg ) continue; noPRINT("PARAM: %s = |%.*s|\n",namebuf,(int)(ptr-start),start); - if (!strcmp(namebuf,"LEGACY")) + if (!strcmp(namebuf,"ENDIAN")) + bmg->endian = str2l(start,0,10) > 0 ? &le_func : &be_func; + else if (!strcmp(namebuf,"LEGACY")) bmg->legacy = str2l(start,0,10) > 0; else if (!strcmp(namebuf,"ENCODING")) AssignEncodingBMG(bmg,str2l(start,0,10)); @@ -2975,9 +3052,13 @@ enumError ScanBMG bmg->fname = STRDUP(fname); const bmg_header_t * bh = (bmg_header_t*)bmg->data; - if ( !memcmp(bh->magic,BMG_MAGIC,sizeof(bh->magic)) - && ntohl(bh->size) <= bmg->data_size ) - return ScanRawBMG(bmg); + + if (!memcmp(bh->magic,BMG_MAGIC,sizeof(bh->magic))) + { + bmg->endian = get_endian_by_bh(bh,bmg->data_size); + if (bmg->endian) + return ScanRawBMG(bmg); + } ccp ptr = (ccp)bmg->data + GetTextBOMLen(bmg->data,bmg->data_size); if ( !memcmp(ptr,BMG_TEXT_MAGIC,4) ) @@ -3072,6 +3153,7 @@ void InitializeCreateBMG ( bmg_create_t *bc, bmg_t *bmg ) memset(bc,0,sizeof(*bc)); bc->bmg = bmg; + bc->endian = get_bmg_endian(bmg); bc->have_mid = opt_bmg_mid == OFFON_AUTO ? bmg->have_mid : opt_bmg_mid >= OFFON_ON; @@ -3157,6 +3239,7 @@ bmg_item_t * GetNextBI ( bmg_create_t *bc ) { DASSERT(bc); DASSERT(bc->bmg); + DASSERT(bc->bmg->endian); bmg_t *bmg = bc->bmg; @@ -3191,14 +3274,14 @@ bmg_item_t * GetNextBI ( bmg_create_t *bc ) u32 *pmid = (u32*)WriteFastBuf( &bc->mid, bc->slot*sizeof(u32), 0, sizeof(u32) ); DASSERT(pmid); - *pmid = htonl(bi->mid); + *pmid = bc->endian->h2nl(bi->mid); const uint inf_size = bmg->inf_size; bmg_inf_item_t *ii = (bmg_inf_item_t*)WriteFastBuf ( &bc->inf, bc->slot * inf_size, 0, inf_size ); DASSERT(ii); if ( !isSpecialEntryBMG(bi->text) ) - ii->offset = htonl(GetFastBufLen(&bc->dat)); + ii->offset = bc->endian->h2nl(GetFastBufLen(&bc->dat)); memcpy(ii->attrib,bi->attrib,bmg->attrib_used); if ( bc->n_msg <= bc->slot ) @@ -3366,11 +3449,13 @@ enumError CreateRawBMG ) { DASSERT(bmg); + DASSERT(bmg->endian); TRACE("CreateRawBMG()\n"); //--- setup bmg_create_t +// [[opt-endian]] bmg_create_t bc; InitializeCreateBMG(&bc,bmg); PRINT("fb:inf: %s\n", GetFastBufStatus(&bc.inf) ); @@ -3457,8 +3542,8 @@ enumError CreateRawBMG //---- setup bmg header bmg_header_t *bh = (bmg_header_t*)bmg->raw_data; - bh->size = htonl( bmg->legacy ? total_size/BMG_LEGACY_BLOCK_SIZE: total_size ); - bh->n_sections = htonl( ( bc.have_mid ? 3 : 2 ) + raw_count ); + bh->size = bc.endian->h2nl( bmg->legacy ? total_size/BMG_LEGACY_BLOCK_SIZE: total_size ); + bh->n_sections = bc.endian->h2nl( ( bc.have_mid ? 3 : 2 ) + raw_count ); bh->encoding = bmg->legacy ? 0 : encoding; memcpy(bh->magic,BMG_MAGIC,sizeof(bh->magic)); @@ -3469,10 +3554,10 @@ enumError CreateRawBMG //---- setup inf section bmg_inf_t *pinf = (bmg_inf_t*)dest; - pinf->size = htonl(inf_size); - pinf->n_msg = htons(bc.n_msg); - pinf->inf_size = htons(bmg->inf_size); - pinf->unknown_0c = htonl(bmg->unknown_inf_0c); + pinf->size = bc.endian->h2nl(inf_size); + pinf->n_msg = bc.endian->h2ns(bc.n_msg); + pinf->inf_size = bc.endian->h2ns(bmg->inf_size); + pinf->unknown_0c = bc.endian->h2nl(bmg->unknown_inf_0c); memcpy(pinf->magic,BMG_INF_MAGIC,sizeof(pinf->magic)); memcpy(pinf->list,inf.ptr,inf.len); @@ -3483,7 +3568,7 @@ enumError CreateRawBMG //---- setup dat section bmg_dat_t * pdat = (bmg_dat_t*)dest; - pdat->size = htonl(dat_size); + pdat->size = bc.endian->h2nl(dat_size); memcpy(pdat->magic,BMG_DAT_MAGIC,sizeof(pdat->magic)); memcpy(pdat->text_pool,dat.ptr,dat.len); @@ -3496,10 +3581,10 @@ enumError CreateRawBMG if (bc.have_mid) { bmg_mid_t *pmid = (bmg_mid_t*)dest; - pmid->size = htonl(mid_size); - pmid->n_msg = htons(bc.n_msg); - pmid->unknown_0a = htons(bmg->unknown_mid_0a); - pmid->unknown_0c = htonl(bmg->unknown_mid_0c); + pmid->size = bc.endian->h2nl(mid_size); + pmid->n_msg = bc.endian->h2ns(bc.n_msg); + pmid->unknown_0a = bc.endian->h2ns(bmg->unknown_mid_0a); + pmid->unknown_0c = bc.endian->h2nl(bmg->unknown_mid_0c); memcpy(pmid->magic,BMG_MID_MAGIC,sizeof(pmid->magic)); memcpy(pmid->mid,mid.ptr,mid.len); @@ -3522,7 +3607,7 @@ enumError CreateRawBMG bmg_section_t *sect = (bmg_section_t*)dest; memcpy(sect->magic,raw->magic,sizeof(sect->magic)); - sect->size = htonl(raw->total_size); + sect->size = bc.endian->h2nl(raw->total_size); const mem_t mem = GetFastBufMem(&raw->data); memcpy(sect->data,mem.ptr,mem.len); @@ -3840,6 +3925,10 @@ enumError SaveTextBMG { "%s" "\r\n" + "# The endianness of binary files: 0=big endian (default), 1=little endian.\r\n" + "# Little endian is only tested for encoding UTF-8 (need examples of analysis).\r\n" + "@ENDIAN = %u\r\n" + "\r\n" "# If 1, then enable legacy (GameCube) mode for old binary BMG files.\r\n" "# If enabled, ENCODING is always CP1252.\r\n" "@LEGACY = %u\r\n" @@ -3847,7 +3936,7 @@ enumError SaveTextBMG "# Define encoding of BMG: 1=CP1252, 2=UTF-16/be, 3=Shift-JIS, 4=UTF-8\r\n" "@ENCODING = %u\r\n" "\r\n" - "# Create »MID1« section: 0:off, 1=on\r\n" + "# Create »MID1« section: 0=off, 1=on\r\n" "@BMG-MID = %u\r\n" "\r\n" "# Size of each element of section 'INF1' (MKW=8).\r\n" @@ -3871,7 +3960,7 @@ enumError SaveTextBMG { "%s" "\r\n" - "# This part define values for unknown parameters of section headers.\r\n" + "# This part defines values for unknown parameters of section headers.\r\n" "@UNKNOWN-INF32-0C = %#10x # 32 bit value of section INF1 offset 0x0c\r\n" "@UNKNOWN-MID16-0A = %#10x # 16 bit value of section MID1 offset 0x0a\r\n" "@UNKNOWN-MID32-0C = %#10x # 32 bit value of section MID1 offset 0x0c\r\n" @@ -3897,12 +3986,14 @@ enumError SaveTextBMG HavePredifinedSlots(bmg); bmg->legacy = bmg->legacy != 0; + const endian_func_t *endian = get_bmg_endian(bmg); const int encoding = bmg->legacy ? BMG_ENC_CP1252 : CheckEncodingBMG(opt_bmg_encoding,bmg->encoding); const bool print_settings // print only, if unusual - = encoding != BMG_ENC__DEFAULT + = endian->is_le + || encoding != BMG_ENC__DEFAULT || bmg->attrib_used != 4 || be32(bmg->attrib) != BMG_INF_STD_ATTRIB || !bmg->have_mid @@ -3917,12 +4008,14 @@ enumError SaveTextBMG { fprintf(F.f,text_param, param_announce, - bmg->legacy, encoding, bmg->have_mid, bmg->inf_size, abuf, + endian->is_le, bmg->legacy, + encoding, bmg->have_mid, bmg->inf_size, abuf, bmg->use_color_names, bmg->use_mkw_messages ); param_announce = ""; } else if ( brief_count < BRIEF_NO_MAGIC ) - fprintf(F.f,"@LEGACY = %u\r\n" + fprintf(F.f,"@ENDIAN = %u\r\n" + "@LEGACY = %u\r\n" "@ENCODING = %u\r\n" "@BMG-MID = %u\r\n" "@INF-SIZE = 0x%02x\r\n" @@ -3930,7 +4023,8 @@ enumError SaveTextBMG "@COLOR-NAMES = %u\r\n" "@MKW-MESSAGES = %u\r\n" "\r\n", - bmg->legacy, encoding, bmg->have_mid, bmg->inf_size, abuf, + endian->is_le, bmg->legacy, + encoding, bmg->have_mid, bmg->inf_size, abuf, bmg->use_color_names, bmg->use_mkw_messages ); } diff --git a/project/dclib/lib-bmg.h b/project/dclib/lib-bmg.h index 590d93b..561348e 100644 --- a/project/dclib/lib-bmg.h +++ b/project/dclib/lib-bmg.h @@ -49,6 +49,7 @@ #define BMG_INF_MAX_SIZE (4+BMG_ATTRIB_SIZE) // max supported inf size #define BMG_INF_LIMIT 1000 // max allowed inf size #define BMG_LEGACY_BLOCK_SIZE 32 // block size for legacy files +#define BMG_MAX_SECTIONS 100 // max supported sections (sanity check) // [[xbuf]] #define BMG_MSG_BUF_SIZE 20050 // good buf size for messages @@ -69,6 +70,7 @@ typedef u16 bmg_slot_t; // type of slot typedef struct bmg_t bmg_t; + // /////////////////////////////////////////////////////////////////////////////// /////////////// MKW specific consts /////////////// @@ -240,6 +242,7 @@ extern bool opt_bmg_use_raw_sections;// true: use raw sections //----------------------------------------------------------------------------- +extern int opt_bmg_endian; extern int opt_bmg_encoding; extern uint opt_bmg_inf_size; extern OffOn_t opt_bmg_mid; @@ -400,6 +403,22 @@ typedef struct bmg_section_t __attribute__ ((packed)) bmg_section_t; //----------------------------------------------------------------------------- +// [[bmg_endian_t]] + +typedef enum bmg_endian_t +{ + BMG_AUTO_ENDIAN, + BMG_BIG_ENDIAN, // used in MKWii + BMG_LITTLE_ENDIAN, + + BMG_DEFAULT_ENDIAN = BMG_BIG_ENDIAN, +} +__attribute__ ((packed)) bmg_endian_t; + +extern const KeywordTab_t TabEndianBMG[]; +ccp GetEndianNameBMG ( int endian, ccp return_if_invalid ); + +//----------------------------------------------------------------------------- // [[bmg_encoding_t]] typedef enum bmg_encoding_t @@ -583,11 +602,11 @@ bmg_sect_info_t; typedef struct bmg_sect_list_t { - // all pointers point into raw source data - uint source_size; // valid source size uint this_size; // total size of this including info[] + const endian_func_t *endian; // endian functions, never NULL + // all following pointers point into raw source data bmg_header_t *header; // NULL or pointer to BMG file header bmg_inf_t *pinf; // NULL or pointer to INF1 header bmg_dat_t *pdat; // NULL or pointer to DAT1 header @@ -606,7 +625,8 @@ bmg_sect_list_t; //----------------------------------------------------------------------------- // result is alloced => FREE(result) -bmg_sect_list_t * ScanSectionsBMG ( cvp data, uint size ); +bmg_sect_list_t * ScanSectionsBMG + ( cvp data, uint size, const endian_func_t *endian ); // endian==0: auto detect const bmg_sect_info_t * SearchSectionBMG ( @@ -729,6 +749,7 @@ typedef struct bmg_t ccp fname; // alloced filename of loaded file FileAttrib_t fatt; // file attribute bool is_text_src; // true: source was text + const endian_func_t * endian; // endian functions, never NULL //--- container, used by SZS tools @@ -897,6 +918,10 @@ enumError SaveTextBMG typedef struct bmg_create_t { bmg_t *bmg; // current bmg + const endian_func_t // endian functions, never NULL + *endian; // init by bmg->endian, overridden by opt_bmg_endian + + FastBuf_t inf; // INF1 data FastBuf_t dat; // DAT1 data FastBuf_t mid; // MID1 data diff --git a/project/revision.sh b/project/revision.sh index c29d890..7336ee2 100644 --- a/project/revision.sh +++ b/project/revision.sh @@ -1 +1 @@ -revision=8279 +revision=8311 diff --git a/project/setup.sh b/project/setup.sh index 205ec80..f33cbfa 100644 --- a/project/setup.sh +++ b/project/setup.sh @@ -26,6 +26,12 @@ have_fuse=0 [[ $NO_FUSE != 1 && -r /usr/include/fuse.h || -r /usr/local/include/fuse.h ]] \ && have_fuse=1 +have_md5=0 +[[ -r /usr/include/openssl/md5.h ]] && have_md5=1 + +have_sha=0 +[[ -r /usr/include/openssl/sha.h ]] && have_sha=1 + #--- if [[ $M32 = 1 ]] @@ -51,7 +57,7 @@ fi && defines="$defines -DHAVE_POSIX_FALLOCATE=1" gcc $xflags system.c -o system.tmp && ./system.tmp >Makefile.setup -rm -f system.tmp +#rm -f system.tmp SYSTEM=$(awk '$1=="SYSTEM" {print $3}' Makefile.setup) #echo "SYSTEM=|$SYSTEM|" >&2 @@ -171,6 +177,8 @@ cat <<- ---EOT--- >>Makefile.setup FORCE_M32 := $force_m32 HAVE_FUSE := $have_fuse + HAVE_MD5 := $have_md5 + HAVE_SHA := $have_sha STATIC := $STATIC XFLAGS += $xflags DEFINES1 := $defines -DDEBUG_ASSERT=1 diff --git a/project/setup/cygwin-copy.sh b/project/setup/cygwin-copy.sh index 3ce6c46..6e47c33 100644 --- a/project/setup/cygwin-copy.sh +++ b/project/setup/cygwin-copy.sh @@ -56,9 +56,18 @@ done #------------------------------------------------------------------------------ # copy needed cygwin dlls +CYGCHECK="$( which cygcheck 2>/dev/null )" + for tool in $CYGWIN_TOOLS do - ldd "$BIN_PATH/$tool.exe" | grep -F "=> $CYGWIN_DIR/" | awk '{print $1}' + if [[ $CYGCHECK ]] + then + "$CYGCHECK" "$BIN_PATH/$tool.exe" \ + | grep -E 'cygwin.*\\bin\\.*\.dll' \ + | sed 's/.*\\//' + else + ldd "$BIN_PATH/$tool.exe" | grep -F "=> $CYGWIN_DIR/" | awk '{print $1}' + fi done | sort | uniq | while read dll do cp --preserve=time "$CYGWIN_DIR/$dll" "$BIN_PATH" || exit 1 diff --git a/project/src/analyze.c b/project/src/analyze.c index 0c294b0..152b439 100644 --- a/project/src/analyze.c +++ b/project/src/analyze.c @@ -1124,9 +1124,9 @@ void AnalyzeBREFF ( szs_file_t * szs, u8 * data, uint data_size, ccp name ) szs_file_t szs2; // [[fname-]] InitializeSubSZS(&szs2,szs,data-szs->data,szs->size,fform,0,false); - IterateFilesSZS(&szs2, + IterateFilesParSZS(&szs2, fform == FF_BREFF ? ana_breff_subfile : ana_breft_subfile, - f, true, false, -1, SORT_NONE ); + f, false, true, false, -1, SORT_NONE ); ResetSZS(&szs2); } diff --git a/project/src/crypt.h b/project/src/crypt.h index c541bc8..6bf4359 100644 --- a/project/src/crypt.h +++ b/project/src/crypt.h @@ -38,8 +38,12 @@ #ifndef WIIMM_CRYPT_H #define WIIMM_CRYPT_H 1 -#include "crypto/wiimm-sha.h" -#define SHA1 WIIMM_SHA1 +#ifdef USE_SHA_LIB + #include <openssl/sha.h> +#else + #include "crypto/wiimm-sha.h" + #define SHA1 WIIMM_SHA1 +#endif #endif // WIIMM_CRYPT_H diff --git a/project/src/crypto/sha1-586-cygwin.s b/project/src/crypto/sha1-586-cygwin.s index 2751a8f..fb10e3c 100644 --- a/project/src/crypto/sha1-586-cygwin.s +++ b/project/src/crypto/sha1-586-cygwin.s @@ -1,4 +1,4 @@ -.file "sha1-586.s" +.file "sha1-586-cygwin.s" .text .globl _wit_sha1_block_data_order .def _wit_sha1_block_data_order; .scl 2; .type 32; .endef diff --git a/project/src/crypto/sha1-cygwin64.s b/project/src/crypto/sha1-cygwin64.s new file mode 100644 index 0000000..7a7421f --- /dev/null +++ b/project/src/crypto/sha1-cygwin64.s @@ -0,0 +1,1284 @@ +.file "sha1-cygwin64.s" +.text +.globl wit_sha1_block_data_order +.def wit_sha1_block_data_order; .scl 2; .type 32; .endef + +.align 16 +wit_sha1_block_data_order: +.Lwit_sha1_block_data_order_begin: + pushq %rbx + pushq %rbp + pushq %r12 + movq %rsp,%r11 + movq %rdi,%r8 + subq $72,%rsp + movq %rsi,%r9 + andq $-64,%rsp + movq %rdx,%r10 + movq %r11,64(%rsp) +.Lprologue: + + movl 0(%r8),%edx + movl 4(%r8),%esi + movl 8(%r8),%edi + movl 12(%r8),%ebp + movl 16(%r8),%r11d +.align 4 +.Lloop: + movl 0(%r9),%eax + bswapl %eax + movl %eax,0(%rsp) + leal 1518500249(%rax,%r11,1),%r12d + movl %edi,%ebx + movl 4(%r9),%eax + movl %edx,%r11d + xorl %ebp,%ebx + bswapl %eax + roll $5,%r11d + andl %esi,%ebx + movl %eax,4(%rsp) + addl %r11d,%r12d + xorl %ebp,%ebx + roll $30,%esi + addl %ebx,%r12d + leal 1518500249(%rax,%rbp,1),%r11d + movl %esi,%ebx + movl 8(%r9),%eax + movl %r12d,%ebp + xorl %edi,%ebx + bswapl %eax + roll $5,%ebp + andl %edx,%ebx + movl %eax,8(%rsp) + addl %ebp,%r11d + xorl %edi,%ebx + roll $30,%edx + addl %ebx,%r11d + leal 1518500249(%rax,%rdi,1),%ebp + movl %edx,%ebx + movl 12(%r9),%eax + movl %r11d,%edi + xorl %esi,%ebx + bswapl %eax + roll $5,%edi + andl %r12d,%ebx + movl %eax,12(%rsp) + addl %edi,%ebp + xorl %esi,%ebx + roll $30,%r12d + addl %ebx,%ebp + leal 1518500249(%rax,%rsi,1),%edi + movl %r12d,%ebx + movl 16(%r9),%eax + movl %ebp,%esi + xorl %edx,%ebx + bswapl %eax + roll $5,%esi + andl %r11d,%ebx + movl %eax,16(%rsp) + addl %esi,%edi + xorl %edx,%ebx + roll $30,%r11d + addl %ebx,%edi + leal 1518500249(%rax,%rdx,1),%esi + movl %r11d,%ebx + movl 20(%r9),%eax + movl %edi,%edx + xorl %r12d,%ebx + bswapl %eax + roll $5,%edx + andl %ebp,%ebx + movl %eax,20(%rsp) + addl %edx,%esi + xorl %r12d,%ebx + roll $30,%ebp + addl %ebx,%esi + leal 1518500249(%rax,%r12,1),%edx + movl %ebp,%ebx + movl 24(%r9),%eax + movl %esi,%r12d + xorl %r11d,%ebx + bswapl %eax + roll $5,%r12d + andl %edi,%ebx + movl %eax,24(%rsp) + addl %r12d,%edx + xorl %r11d,%ebx + roll $30,%edi + addl %ebx,%edx + leal 1518500249(%rax,%r11,1),%r12d + movl %edi,%ebx + movl 28(%r9),%eax + movl %edx,%r11d + xorl %ebp,%ebx + bswapl %eax + roll $5,%r11d + andl %esi,%ebx + movl %eax,28(%rsp) + addl %r11d,%r12d + xorl %ebp,%ebx + roll $30,%esi + addl %ebx,%r12d + leal 1518500249(%rax,%rbp,1),%r11d + movl %esi,%ebx + movl 32(%r9),%eax + movl %r12d,%ebp + xorl %edi,%ebx + bswapl %eax + roll $5,%ebp + andl %edx,%ebx + movl %eax,32(%rsp) + addl %ebp,%r11d + xorl %edi,%ebx + roll $30,%edx + addl %ebx,%r11d + leal 1518500249(%rax,%rdi,1),%ebp + movl %edx,%ebx + movl 36(%r9),%eax + movl %r11d,%edi + xorl %esi,%ebx + bswapl %eax + roll $5,%edi + andl %r12d,%ebx + movl %eax,36(%rsp) + addl %edi,%ebp + xorl %esi,%ebx + roll $30,%r12d + addl %ebx,%ebp + leal 1518500249(%rax,%rsi,1),%edi + movl %r12d,%ebx + movl 40(%r9),%eax + movl %ebp,%esi + xorl %edx,%ebx + bswapl %eax + roll $5,%esi + andl %r11d,%ebx + movl %eax,40(%rsp) + addl %esi,%edi + xorl %edx,%ebx + roll $30,%r11d + addl %ebx,%edi + leal 1518500249(%rax,%rdx,1),%esi + movl %r11d,%ebx + movl 44(%r9),%eax + movl %edi,%edx + xorl %r12d,%ebx + bswapl %eax + roll $5,%edx + andl %ebp,%ebx + movl %eax,44(%rsp) + addl %edx,%esi + xorl %r12d,%ebx + roll $30,%ebp + addl %ebx,%esi + leal 1518500249(%rax,%r12,1),%edx + movl %ebp,%ebx + movl 48(%r9),%eax + movl %esi,%r12d + xorl %r11d,%ebx + bswapl %eax + roll $5,%r12d + andl %edi,%ebx + movl %eax,48(%rsp) + addl %r12d,%edx + xorl %r11d,%ebx + roll $30,%edi + addl %ebx,%edx + leal 1518500249(%rax,%r11,1),%r12d + movl %edi,%ebx + movl 52(%r9),%eax + movl %edx,%r11d + xorl %ebp,%ebx + bswapl %eax + roll $5,%r11d + andl %esi,%ebx + movl %eax,52(%rsp) + addl %r11d,%r12d + xorl %ebp,%ebx + roll $30,%esi + addl %ebx,%r12d + leal 1518500249(%rax,%rbp,1),%r11d + movl %esi,%ebx + movl 56(%r9),%eax + movl %r12d,%ebp + xorl %edi,%ebx + bswapl %eax + roll $5,%ebp + andl %edx,%ebx + movl %eax,56(%rsp) + addl %ebp,%r11d + xorl %edi,%ebx + roll $30,%edx + addl %ebx,%r11d + leal 1518500249(%rax,%rdi,1),%ebp + movl %edx,%ebx + movl 60(%r9),%eax + movl %r11d,%edi + xorl %esi,%ebx + bswapl %eax + roll $5,%edi + andl %r12d,%ebx + movl %eax,60(%rsp) + addl %edi,%ebp + xorl %esi,%ebx + roll $30,%r12d + addl %ebx,%ebp + leal 1518500249(%rax,%rsi,1),%edi + movl 0(%rsp),%eax + movl %r12d,%ebx + movl %ebp,%esi + xorl 8(%rsp),%eax + xorl %edx,%ebx + roll $5,%esi + xorl 32(%rsp),%eax + andl %r11d,%ebx + addl %esi,%edi + xorl 52(%rsp),%eax + xorl %edx,%ebx + roll $30,%r11d + addl %ebx,%edi + roll $1,%eax + movl %eax,0(%rsp) + leal 1518500249(%rax,%rdx,1),%esi + movl 4(%rsp),%eax + movl %r11d,%ebx + movl %edi,%edx + xorl 12(%rsp),%eax + xorl %r12d,%ebx + roll $5,%edx + xorl 36(%rsp),%eax + andl %ebp,%ebx + addl %edx,%esi + xorl 56(%rsp),%eax + xorl %r12d,%ebx + roll $30,%ebp + addl %ebx,%esi + roll $1,%eax + movl %eax,4(%rsp) + leal 1518500249(%rax,%r12,1),%edx + movl 8(%rsp),%eax + movl %ebp,%ebx + movl %esi,%r12d + xorl 16(%rsp),%eax + xorl %r11d,%ebx + roll $5,%r12d + xorl 40(%rsp),%eax + andl %edi,%ebx + addl %r12d,%edx + xorl 60(%rsp),%eax + xorl %r11d,%ebx + roll $30,%edi + addl %ebx,%edx + roll $1,%eax + movl %eax,8(%rsp) + leal 1518500249(%rax,%r11,1),%r12d + movl 12(%rsp),%eax + movl %edi,%ebx + movl %edx,%r11d + xorl 20(%rsp),%eax + xorl %ebp,%ebx + roll $5,%r11d + xorl 44(%rsp),%eax + andl %esi,%ebx + addl %r11d,%r12d + xorl 0(%rsp),%eax + xorl %ebp,%ebx + roll $30,%esi + addl %ebx,%r12d + roll $1,%eax + movl %eax,12(%rsp) + leal 1518500249(%rax,%rbp,1),%r11d + movl 16(%rsp),%eax + movl %esi,%ebx + movl %r12d,%ebp + xorl 24(%rsp),%eax + xorl %edi,%ebx + roll $5,%ebp + xorl 48(%rsp),%eax + andl %edx,%ebx + addl %ebp,%r11d + xorl 4(%rsp),%eax + xorl %edi,%ebx + roll $30,%edx + addl %ebx,%r11d + roll $1,%eax + movl %eax,16(%rsp) + leal 1859775393(%rax,%rdi,1),%ebp + movl 20(%rsp),%eax + movl %edx,%ebx + movl %r11d,%edi + xorl 28(%rsp),%eax + xorl %r12d,%ebx + roll $5,%edi + xorl 52(%rsp),%eax + xorl %esi,%ebx + addl %edi,%ebp + xorl 8(%rsp),%eax + roll $30,%r12d + addl %ebx,%ebp + roll $1,%eax + movl %eax,20(%rsp) + leal 1859775393(%rax,%rsi,1),%edi + movl 24(%rsp),%eax + movl %r12d,%ebx + movl %ebp,%esi + xorl 32(%rsp),%eax + xorl %r11d,%ebx + roll $5,%esi + xorl 56(%rsp),%eax + xorl %edx,%ebx + addl %esi,%edi + xorl 12(%rsp),%eax + roll $30,%r11d + addl %ebx,%edi + roll $1,%eax + movl %eax,24(%rsp) + leal 1859775393(%rax,%rdx,1),%esi + movl 28(%rsp),%eax + movl %r11d,%ebx + movl %edi,%edx + xorl 36(%rsp),%eax + xorl %ebp,%ebx + roll $5,%edx + xorl 60(%rsp),%eax + xorl %r12d,%ebx + addl %edx,%esi + xorl 16(%rsp),%eax + roll $30,%ebp + addl %ebx,%esi + roll $1,%eax + movl %eax,28(%rsp) + leal 1859775393(%rax,%r12,1),%edx + movl 32(%rsp),%eax + movl %ebp,%ebx + movl %esi,%r12d + xorl 40(%rsp),%eax + xorl %edi,%ebx + roll $5,%r12d + xorl 0(%rsp),%eax + xorl %r11d,%ebx + addl %r12d,%edx + xorl 20(%rsp),%eax + roll $30,%edi + addl %ebx,%edx + roll $1,%eax + movl %eax,32(%rsp) + leal 1859775393(%rax,%r11,1),%r12d + movl 36(%rsp),%eax + movl %edi,%ebx + movl %edx,%r11d + xorl 44(%rsp),%eax + xorl %esi,%ebx + roll $5,%r11d + xorl 4(%rsp),%eax + xorl %ebp,%ebx + addl %r11d,%r12d + xorl 24(%rsp),%eax + roll $30,%esi + addl %ebx,%r12d + roll $1,%eax + movl %eax,36(%rsp) + leal 1859775393(%rax,%rbp,1),%r11d + movl 40(%rsp),%eax + movl %esi,%ebx + movl %r12d,%ebp + xorl 48(%rsp),%eax + xorl %edx,%ebx + roll $5,%ebp + xorl 8(%rsp),%eax + xorl %edi,%ebx + addl %ebp,%r11d + xorl 28(%rsp),%eax + roll $30,%edx + addl %ebx,%r11d + roll $1,%eax + movl %eax,40(%rsp) + leal 1859775393(%rax,%rdi,1),%ebp + movl 44(%rsp),%eax + movl %edx,%ebx + movl %r11d,%edi + xorl 52(%rsp),%eax + xorl %r12d,%ebx + roll $5,%edi + xorl 12(%rsp),%eax + xorl %esi,%ebx + addl %edi,%ebp + xorl 32(%rsp),%eax + roll $30,%r12d + addl %ebx,%ebp + roll $1,%eax + movl %eax,44(%rsp) + leal 1859775393(%rax,%rsi,1),%edi + movl 48(%rsp),%eax + movl %r12d,%ebx + movl %ebp,%esi + xorl 56(%rsp),%eax + xorl %r11d,%ebx + roll $5,%esi + xorl 16(%rsp),%eax + xorl %edx,%ebx + addl %esi,%edi + xorl 36(%rsp),%eax + roll $30,%r11d + addl %ebx,%edi + roll $1,%eax + movl %eax,48(%rsp) + leal 1859775393(%rax,%rdx,1),%esi + movl 52(%rsp),%eax + movl %r11d,%ebx + movl %edi,%edx + xorl 60(%rsp),%eax + xorl %ebp,%ebx + roll $5,%edx + xorl 20(%rsp),%eax + xorl %r12d,%ebx + addl %edx,%esi + xorl 40(%rsp),%eax + roll $30,%ebp + addl %ebx,%esi + roll $1,%eax + movl %eax,52(%rsp) + leal 1859775393(%rax,%r12,1),%edx + movl 56(%rsp),%eax + movl %ebp,%ebx + movl %esi,%r12d + xorl 0(%rsp),%eax + xorl %edi,%ebx + roll $5,%r12d + xorl 24(%rsp),%eax + xorl %r11d,%ebx + addl %r12d,%edx + xorl 44(%rsp),%eax + roll $30,%edi + addl %ebx,%edx + roll $1,%eax + movl %eax,56(%rsp) + leal 1859775393(%rax,%r11,1),%r12d + movl 60(%rsp),%eax + movl %edi,%ebx + movl %edx,%r11d + xorl 4(%rsp),%eax + xorl %esi,%ebx + roll $5,%r11d + xorl 28(%rsp),%eax + xorl %ebp,%ebx + addl %r11d,%r12d + xorl 48(%rsp),%eax + roll $30,%esi + addl %ebx,%r12d + roll $1,%eax + movl %eax,60(%rsp) + leal 1859775393(%rax,%rbp,1),%r11d + movl 0(%rsp),%eax + movl %esi,%ebx + movl %r12d,%ebp + xorl 8(%rsp),%eax + xorl %edx,%ebx + roll $5,%ebp + xorl 32(%rsp),%eax + xorl %edi,%ebx + addl %ebp,%r11d + xorl 52(%rsp),%eax + roll $30,%edx + addl %ebx,%r11d + roll $1,%eax + movl %eax,0(%rsp) + leal 1859775393(%rax,%rdi,1),%ebp + movl 4(%rsp),%eax + movl %edx,%ebx + movl %r11d,%edi + xorl 12(%rsp),%eax + xorl %r12d,%ebx + roll $5,%edi + xorl 36(%rsp),%eax + xorl %esi,%ebx + addl %edi,%ebp + xorl 56(%rsp),%eax + roll $30,%r12d + addl %ebx,%ebp + roll $1,%eax + movl %eax,4(%rsp) + leal 1859775393(%rax,%rsi,1),%edi + movl 8(%rsp),%eax + movl %r12d,%ebx + movl %ebp,%esi + xorl 16(%rsp),%eax + xorl %r11d,%ebx + roll $5,%esi + xorl 40(%rsp),%eax + xorl %edx,%ebx + addl %esi,%edi + xorl 60(%rsp),%eax + roll $30,%r11d + addl %ebx,%edi + roll $1,%eax + movl %eax,8(%rsp) + leal 1859775393(%rax,%rdx,1),%esi + movl 12(%rsp),%eax + movl %r11d,%ebx + movl %edi,%edx + xorl 20(%rsp),%eax + xorl %ebp,%ebx + roll $5,%edx + xorl 44(%rsp),%eax + xorl %r12d,%ebx + addl %edx,%esi + xorl 0(%rsp),%eax + roll $30,%ebp + addl %ebx,%esi + roll $1,%eax + movl %eax,12(%rsp) + leal 1859775393(%rax,%r12,1),%edx + movl 16(%rsp),%eax + movl %ebp,%ebx + movl %esi,%r12d + xorl 24(%rsp),%eax + xorl %edi,%ebx + roll $5,%r12d + xorl 48(%rsp),%eax + xorl %r11d,%ebx + addl %r12d,%edx + xorl 4(%rsp),%eax + roll $30,%edi + addl %ebx,%edx + roll $1,%eax + movl %eax,16(%rsp) + leal 1859775393(%rax,%r11,1),%r12d + movl 20(%rsp),%eax + movl %edi,%ebx + movl %edx,%r11d + xorl 28(%rsp),%eax + xorl %esi,%ebx + roll $5,%r11d + xorl 52(%rsp),%eax + xorl %ebp,%ebx + addl %r11d,%r12d + xorl 8(%rsp),%eax + roll $30,%esi + addl %ebx,%r12d + roll $1,%eax + movl %eax,20(%rsp) + leal 1859775393(%rax,%rbp,1),%r11d + movl 24(%rsp),%eax + movl %esi,%ebx + movl %r12d,%ebp + xorl 32(%rsp),%eax + xorl %edx,%ebx + roll $5,%ebp + xorl 56(%rsp),%eax + xorl %edi,%ebx + addl %ebp,%r11d + xorl 12(%rsp),%eax + roll $30,%edx + addl %ebx,%r11d + roll $1,%eax + movl %eax,24(%rsp) + leal 1859775393(%rax,%rdi,1),%ebp + movl 28(%rsp),%eax + movl %edx,%ebx + movl %r11d,%edi + xorl 36(%rsp),%eax + xorl %r12d,%ebx + roll $5,%edi + xorl 60(%rsp),%eax + xorl %esi,%ebx + addl %edi,%ebp + xorl 16(%rsp),%eax + roll $30,%r12d + addl %ebx,%ebp + roll $1,%eax + movl %eax,28(%rsp) + leal 1859775393(%rax,%rsi,1),%edi + movl 32(%rsp),%eax + movl %r12d,%ebx + movl %ebp,%esi + xorl 40(%rsp),%eax + xorl %r11d,%ebx + roll $5,%esi + xorl 0(%rsp),%eax + xorl %edx,%ebx + addl %esi,%edi + xorl 20(%rsp),%eax + roll $30,%r11d + addl %ebx,%edi + roll $1,%eax + movl %eax,32(%rsp) + leal -1894007588(%rax,%rdx,1),%esi + movl 36(%rsp),%eax + movl %ebp,%ebx + movl %ebp,%ecx + xorl 44(%rsp),%eax + movl %edi,%edx + andl %r11d,%ebx + xorl 4(%rsp),%eax + orl %r11d,%ecx + roll $5,%edx + xorl 24(%rsp),%eax + andl %r12d,%ecx + addl %edx,%esi + roll $1,%eax + orl %ecx,%ebx + roll $30,%ebp + movl %eax,36(%rsp) + addl %ebx,%esi + leal -1894007588(%rax,%r12,1),%edx + movl 40(%rsp),%eax + movl %edi,%ebx + movl %edi,%ecx + xorl 48(%rsp),%eax + movl %esi,%r12d + andl %ebp,%ebx + xorl 8(%rsp),%eax + orl %ebp,%ecx + roll $5,%r12d + xorl 28(%rsp),%eax + andl %r11d,%ecx + addl %r12d,%edx + roll $1,%eax + orl %ecx,%ebx + roll $30,%edi + movl %eax,40(%rsp) + addl %ebx,%edx + leal -1894007588(%rax,%r11,1),%r12d + movl 44(%rsp),%eax + movl %esi,%ebx + movl %esi,%ecx + xorl 52(%rsp),%eax + movl %edx,%r11d + andl %edi,%ebx + xorl 12(%rsp),%eax + orl %edi,%ecx + roll $5,%r11d + xorl 32(%rsp),%eax + andl %ebp,%ecx + addl %r11d,%r12d + roll $1,%eax + orl %ecx,%ebx + roll $30,%esi + movl %eax,44(%rsp) + addl %ebx,%r12d + leal -1894007588(%rax,%rbp,1),%r11d + movl 48(%rsp),%eax + movl %edx,%ebx + movl %edx,%ecx + xorl 56(%rsp),%eax + movl %r12d,%ebp + andl %esi,%ebx + xorl 16(%rsp),%eax + orl %esi,%ecx + roll $5,%ebp + xorl 36(%rsp),%eax + andl %edi,%ecx + addl %ebp,%r11d + roll $1,%eax + orl %ecx,%ebx + roll $30,%edx + movl %eax,48(%rsp) + addl %ebx,%r11d + leal -1894007588(%rax,%rdi,1),%ebp + movl 52(%rsp),%eax + movl %r12d,%ebx + movl %r12d,%ecx + xorl 60(%rsp),%eax + movl %r11d,%edi + andl %edx,%ebx + xorl 20(%rsp),%eax + orl %edx,%ecx + roll $5,%edi + xorl 40(%rsp),%eax + andl %esi,%ecx + addl %edi,%ebp + roll $1,%eax + orl %ecx,%ebx + roll $30,%r12d + movl %eax,52(%rsp) + addl %ebx,%ebp + leal -1894007588(%rax,%rsi,1),%edi + movl 56(%rsp),%eax + movl %r11d,%ebx + movl %r11d,%ecx + xorl 0(%rsp),%eax + movl %ebp,%esi + andl %r12d,%ebx + xorl 24(%rsp),%eax + orl %r12d,%ecx + roll $5,%esi + xorl 44(%rsp),%eax + andl %edx,%ecx + addl %esi,%edi + roll $1,%eax + orl %ecx,%ebx + roll $30,%r11d + movl %eax,56(%rsp) + addl %ebx,%edi + leal -1894007588(%rax,%rdx,1),%esi + movl 60(%rsp),%eax + movl %ebp,%ebx + movl %ebp,%ecx + xorl 4(%rsp),%eax + movl %edi,%edx + andl %r11d,%ebx + xorl 28(%rsp),%eax + orl %r11d,%ecx + roll $5,%edx + xorl 48(%rsp),%eax + andl %r12d,%ecx + addl %edx,%esi + roll $1,%eax + orl %ecx,%ebx + roll $30,%ebp + movl %eax,60(%rsp) + addl %ebx,%esi + leal -1894007588(%rax,%r12,1),%edx + movl 0(%rsp),%eax + movl %edi,%ebx + movl %edi,%ecx + xorl 8(%rsp),%eax + movl %esi,%r12d + andl %ebp,%ebx + xorl 32(%rsp),%eax + orl %ebp,%ecx + roll $5,%r12d + xorl 52(%rsp),%eax + andl %r11d,%ecx + addl %r12d,%edx + roll $1,%eax + orl %ecx,%ebx + roll $30,%edi + movl %eax,0(%rsp) + addl %ebx,%edx + leal -1894007588(%rax,%r11,1),%r12d + movl 4(%rsp),%eax + movl %esi,%ebx + movl %esi,%ecx + xorl 12(%rsp),%eax + movl %edx,%r11d + andl %edi,%ebx + xorl 36(%rsp),%eax + orl %edi,%ecx + roll $5,%r11d + xorl 56(%rsp),%eax + andl %ebp,%ecx + addl %r11d,%r12d + roll $1,%eax + orl %ecx,%ebx + roll $30,%esi + movl %eax,4(%rsp) + addl %ebx,%r12d + leal -1894007588(%rax,%rbp,1),%r11d + movl 8(%rsp),%eax + movl %edx,%ebx + movl %edx,%ecx + xorl 16(%rsp),%eax + movl %r12d,%ebp + andl %esi,%ebx + xorl 40(%rsp),%eax + orl %esi,%ecx + roll $5,%ebp + xorl 60(%rsp),%eax + andl %edi,%ecx + addl %ebp,%r11d + roll $1,%eax + orl %ecx,%ebx + roll $30,%edx + movl %eax,8(%rsp) + addl %ebx,%r11d + leal -1894007588(%rax,%rdi,1),%ebp + movl 12(%rsp),%eax + movl %r12d,%ebx + movl %r12d,%ecx + xorl 20(%rsp),%eax + movl %r11d,%edi + andl %edx,%ebx + xorl 44(%rsp),%eax + orl %edx,%ecx + roll $5,%edi + xorl 0(%rsp),%eax + andl %esi,%ecx + addl %edi,%ebp + roll $1,%eax + orl %ecx,%ebx + roll $30,%r12d + movl %eax,12(%rsp) + addl %ebx,%ebp + leal -1894007588(%rax,%rsi,1),%edi + movl 16(%rsp),%eax + movl %r11d,%ebx + movl %r11d,%ecx + xorl 24(%rsp),%eax + movl %ebp,%esi + andl %r12d,%ebx + xorl 48(%rsp),%eax + orl %r12d,%ecx + roll $5,%esi + xorl 4(%rsp),%eax + andl %edx,%ecx + addl %esi,%edi + roll $1,%eax + orl %ecx,%ebx + roll $30,%r11d + movl %eax,16(%rsp) + addl %ebx,%edi + leal -1894007588(%rax,%rdx,1),%esi + movl 20(%rsp),%eax + movl %ebp,%ebx + movl %ebp,%ecx + xorl 28(%rsp),%eax + movl %edi,%edx + andl %r11d,%ebx + xorl 52(%rsp),%eax + orl %r11d,%ecx + roll $5,%edx + xorl 8(%rsp),%eax + andl %r12d,%ecx + addl %edx,%esi + roll $1,%eax + orl %ecx,%ebx + roll $30,%ebp + movl %eax,20(%rsp) + addl %ebx,%esi + leal -1894007588(%rax,%r12,1),%edx + movl 24(%rsp),%eax + movl %edi,%ebx + movl %edi,%ecx + xorl 32(%rsp),%eax + movl %esi,%r12d + andl %ebp,%ebx + xorl 56(%rsp),%eax + orl %ebp,%ecx + roll $5,%r12d + xorl 12(%rsp),%eax + andl %r11d,%ecx + addl %r12d,%edx + roll $1,%eax + orl %ecx,%ebx + roll $30,%edi + movl %eax,24(%rsp) + addl %ebx,%edx + leal -1894007588(%rax,%r11,1),%r12d + movl 28(%rsp),%eax + movl %esi,%ebx + movl %esi,%ecx + xorl 36(%rsp),%eax + movl %edx,%r11d + andl %edi,%ebx + xorl 60(%rsp),%eax + orl %edi,%ecx + roll $5,%r11d + xorl 16(%rsp),%eax + andl %ebp,%ecx + addl %r11d,%r12d + roll $1,%eax + orl %ecx,%ebx + roll $30,%esi + movl %eax,28(%rsp) + addl %ebx,%r12d + leal -1894007588(%rax,%rbp,1),%r11d + movl 32(%rsp),%eax + movl %edx,%ebx + movl %edx,%ecx + xorl 40(%rsp),%eax + movl %r12d,%ebp + andl %esi,%ebx + xorl 0(%rsp),%eax + orl %esi,%ecx + roll $5,%ebp + xorl 20(%rsp),%eax + andl %edi,%ecx + addl %ebp,%r11d + roll $1,%eax + orl %ecx,%ebx + roll $30,%edx + movl %eax,32(%rsp) + addl %ebx,%r11d + leal -1894007588(%rax,%rdi,1),%ebp + movl 36(%rsp),%eax + movl %r12d,%ebx + movl %r12d,%ecx + xorl 44(%rsp),%eax + movl %r11d,%edi + andl %edx,%ebx + xorl 4(%rsp),%eax + orl %edx,%ecx + roll $5,%edi + xorl 24(%rsp),%eax + andl %esi,%ecx + addl %edi,%ebp + roll $1,%eax + orl %ecx,%ebx + roll $30,%r12d + movl %eax,36(%rsp) + addl %ebx,%ebp + leal -1894007588(%rax,%rsi,1),%edi + movl 40(%rsp),%eax + movl %r11d,%ebx + movl %r11d,%ecx + xorl 48(%rsp),%eax + movl %ebp,%esi + andl %r12d,%ebx + xorl 8(%rsp),%eax + orl %r12d,%ecx + roll $5,%esi + xorl 28(%rsp),%eax + andl %edx,%ecx + addl %esi,%edi + roll $1,%eax + orl %ecx,%ebx + roll $30,%r11d + movl %eax,40(%rsp) + addl %ebx,%edi + leal -1894007588(%rax,%rdx,1),%esi + movl 44(%rsp),%eax + movl %ebp,%ebx + movl %ebp,%ecx + xorl 52(%rsp),%eax + movl %edi,%edx + andl %r11d,%ebx + xorl 12(%rsp),%eax + orl %r11d,%ecx + roll $5,%edx + xorl 32(%rsp),%eax + andl %r12d,%ecx + addl %edx,%esi + roll $1,%eax + orl %ecx,%ebx + roll $30,%ebp + movl %eax,44(%rsp) + addl %ebx,%esi + leal -1894007588(%rax,%r12,1),%edx + movl 48(%rsp),%eax + movl %edi,%ebx + movl %edi,%ecx + xorl 56(%rsp),%eax + movl %esi,%r12d + andl %ebp,%ebx + xorl 16(%rsp),%eax + orl %ebp,%ecx + roll $5,%r12d + xorl 36(%rsp),%eax + andl %r11d,%ecx + addl %r12d,%edx + roll $1,%eax + orl %ecx,%ebx + roll $30,%edi + movl %eax,48(%rsp) + addl %ebx,%edx + leal -899497514(%rax,%r11,1),%r12d + movl 52(%rsp),%eax + movl %edi,%ebx + movl %edx,%r11d + xorl 60(%rsp),%eax + xorl %esi,%ebx + roll $5,%r11d + xorl 20(%rsp),%eax + xorl %ebp,%ebx + addl %r11d,%r12d + xorl 40(%rsp),%eax + roll $30,%esi + addl %ebx,%r12d + roll $1,%eax + movl %eax,52(%rsp) + leal -899497514(%rax,%rbp,1),%r11d + movl 56(%rsp),%eax + movl %esi,%ebx + movl %r12d,%ebp + xorl 0(%rsp),%eax + xorl %edx,%ebx + roll $5,%ebp + xorl 24(%rsp),%eax + xorl %edi,%ebx + addl %ebp,%r11d + xorl 44(%rsp),%eax + roll $30,%edx + addl %ebx,%r11d + roll $1,%eax + movl %eax,56(%rsp) + leal -899497514(%rax,%rdi,1),%ebp + movl 60(%rsp),%eax + movl %edx,%ebx + movl %r11d,%edi + xorl 4(%rsp),%eax + xorl %r12d,%ebx + roll $5,%edi + xorl 28(%rsp),%eax + xorl %esi,%ebx + addl %edi,%ebp + xorl 48(%rsp),%eax + roll $30,%r12d + addl %ebx,%ebp + roll $1,%eax + movl %eax,60(%rsp) + leal -899497514(%rax,%rsi,1),%edi + movl 0(%rsp),%eax + movl %r12d,%ebx + movl %ebp,%esi + xorl 8(%rsp),%eax + xorl %r11d,%ebx + roll $5,%esi + xorl 32(%rsp),%eax + xorl %edx,%ebx + addl %esi,%edi + xorl 52(%rsp),%eax + roll $30,%r11d + addl %ebx,%edi + roll $1,%eax + movl %eax,0(%rsp) + leal -899497514(%rax,%rdx,1),%esi + movl 4(%rsp),%eax + movl %r11d,%ebx + movl %edi,%edx + xorl 12(%rsp),%eax + xorl %ebp,%ebx + roll $5,%edx + xorl 36(%rsp),%eax + xorl %r12d,%ebx + addl %edx,%esi + xorl 56(%rsp),%eax + roll $30,%ebp + addl %ebx,%esi + roll $1,%eax + movl %eax,4(%rsp) + leal -899497514(%rax,%r12,1),%edx + movl 8(%rsp),%eax + movl %ebp,%ebx + movl %esi,%r12d + xorl 16(%rsp),%eax + xorl %edi,%ebx + roll $5,%r12d + xorl 40(%rsp),%eax + xorl %r11d,%ebx + addl %r12d,%edx + xorl 60(%rsp),%eax + roll $30,%edi + addl %ebx,%edx + roll $1,%eax + movl %eax,8(%rsp) + leal -899497514(%rax,%r11,1),%r12d + movl 12(%rsp),%eax + movl %edi,%ebx + movl %edx,%r11d + xorl 20(%rsp),%eax + xorl %esi,%ebx + roll $5,%r11d + xorl 44(%rsp),%eax + xorl %ebp,%ebx + addl %r11d,%r12d + xorl 0(%rsp),%eax + roll $30,%esi + addl %ebx,%r12d + roll $1,%eax + movl %eax,12(%rsp) + leal -899497514(%rax,%rbp,1),%r11d + movl 16(%rsp),%eax + movl %esi,%ebx + movl %r12d,%ebp + xorl 24(%rsp),%eax + xorl %edx,%ebx + roll $5,%ebp + xorl 48(%rsp),%eax + xorl %edi,%ebx + addl %ebp,%r11d + xorl 4(%rsp),%eax + roll $30,%edx + addl %ebx,%r11d + roll $1,%eax + movl %eax,16(%rsp) + leal -899497514(%rax,%rdi,1),%ebp + movl 20(%rsp),%eax + movl %edx,%ebx + movl %r11d,%edi + xorl 28(%rsp),%eax + xorl %r12d,%ebx + roll $5,%edi + xorl 52(%rsp),%eax + xorl %esi,%ebx + addl %edi,%ebp + xorl 8(%rsp),%eax + roll $30,%r12d + addl %ebx,%ebp + roll $1,%eax + movl %eax,20(%rsp) + leal -899497514(%rax,%rsi,1),%edi + movl 24(%rsp),%eax + movl %r12d,%ebx + movl %ebp,%esi + xorl 32(%rsp),%eax + xorl %r11d,%ebx + roll $5,%esi + xorl 56(%rsp),%eax + xorl %edx,%ebx + addl %esi,%edi + xorl 12(%rsp),%eax + roll $30,%r11d + addl %ebx,%edi + roll $1,%eax + movl %eax,24(%rsp) + leal -899497514(%rax,%rdx,1),%esi + movl 28(%rsp),%eax + movl %r11d,%ebx + movl %edi,%edx + xorl 36(%rsp),%eax + xorl %ebp,%ebx + roll $5,%edx + xorl 60(%rsp),%eax + xorl %r12d,%ebx + addl %edx,%esi + xorl 16(%rsp),%eax + roll $30,%ebp + addl %ebx,%esi + roll $1,%eax + movl %eax,28(%rsp) + leal -899497514(%rax,%r12,1),%edx + movl 32(%rsp),%eax + movl %ebp,%ebx + movl %esi,%r12d + xorl 40(%rsp),%eax + xorl %edi,%ebx + roll $5,%r12d + xorl 0(%rsp),%eax + xorl %r11d,%ebx + addl %r12d,%edx + xorl 20(%rsp),%eax + roll $30,%edi + addl %ebx,%edx + roll $1,%eax + movl %eax,32(%rsp) + leal -899497514(%rax,%r11,1),%r12d + movl 36(%rsp),%eax + movl %edi,%ebx + movl %edx,%r11d + xorl 44(%rsp),%eax + xorl %esi,%ebx + roll $5,%r11d + xorl 4(%rsp),%eax + xorl %ebp,%ebx + addl %r11d,%r12d + xorl 24(%rsp),%eax + roll $30,%esi + addl %ebx,%r12d + roll $1,%eax + movl %eax,36(%rsp) + leal -899497514(%rax,%rbp,1),%r11d + movl 40(%rsp),%eax + movl %esi,%ebx + movl %r12d,%ebp + xorl 48(%rsp),%eax + xorl %edx,%ebx + roll $5,%ebp + xorl 8(%rsp),%eax + xorl %edi,%ebx + addl %ebp,%r11d + xorl 28(%rsp),%eax + roll $30,%edx + addl %ebx,%r11d + roll $1,%eax + movl %eax,40(%rsp) + leal -899497514(%rax,%rdi,1),%ebp + movl 44(%rsp),%eax + movl %edx,%ebx + movl %r11d,%edi + xorl 52(%rsp),%eax + xorl %r12d,%ebx + roll $5,%edi + xorl 12(%rsp),%eax + xorl %esi,%ebx + addl %edi,%ebp + xorl 32(%rsp),%eax + roll $30,%r12d + addl %ebx,%ebp + roll $1,%eax + movl %eax,44(%rsp) + leal -899497514(%rax,%rsi,1),%edi + movl 48(%rsp),%eax + movl %r12d,%ebx + movl %ebp,%esi + xorl 56(%rsp),%eax + xorl %r11d,%ebx + roll $5,%esi + xorl 16(%rsp),%eax + xorl %edx,%ebx + addl %esi,%edi + xorl 36(%rsp),%eax + roll $30,%r11d + addl %ebx,%edi + roll $1,%eax + movl %eax,48(%rsp) + leal -899497514(%rax,%rdx,1),%esi + movl 52(%rsp),%eax + movl %r11d,%ebx + movl %edi,%edx + xorl 60(%rsp),%eax + xorl %ebp,%ebx + roll $5,%edx + xorl 20(%rsp),%eax + xorl %r12d,%ebx + addl %edx,%esi + xorl 40(%rsp),%eax + roll $30,%ebp + addl %ebx,%esi + roll $1,%eax + leal -899497514(%rax,%r12,1),%edx + movl 56(%rsp),%eax + movl %ebp,%ebx + movl %esi,%r12d + xorl 0(%rsp),%eax + xorl %edi,%ebx + roll $5,%r12d + xorl 24(%rsp),%eax + xorl %r11d,%ebx + addl %r12d,%edx + xorl 44(%rsp),%eax + roll $30,%edi + addl %ebx,%edx + roll $1,%eax + leal -899497514(%rax,%r11,1),%r12d + movl 60(%rsp),%eax + movl %edi,%ebx + movl %edx,%r11d + xorl 4(%rsp),%eax + xorl %esi,%ebx + roll $5,%r11d + xorl 28(%rsp),%eax + xorl %ebp,%ebx + addl %r11d,%r12d + xorl 48(%rsp),%eax + roll $30,%esi + addl %ebx,%r12d + roll $1,%eax + leal -899497514(%rax,%rbp,1),%r11d + movl %esi,%ebx + movl %r12d,%ebp + xorl %edx,%ebx + roll $5,%ebp + xorl %edi,%ebx + addl %ebp,%r11d + roll $30,%edx + addl %ebx,%r11d + addl 0(%r8),%r11d + addl 4(%r8),%r12d + addl 8(%r8),%edx + addl 12(%r8),%esi + addl 16(%r8),%edi + movl %r11d,0(%r8) + movl %r12d,4(%r8) + movl %edx,8(%r8) + movl %esi,12(%r8) + movl %edi,16(%r8) + + xchgl %r11d,%edx + xchgl %r12d,%esi + xchgl %r11d,%edi + xchgl %r12d,%ebp + + leaq 64(%r9),%r9 + subq $1,%r10 + jnz .Lloop + movq 64(%rsp),%rsi + movq (%rsi),%r12 + movq 8(%rsi),%rbp + movq 16(%rsi),%rbx + leaq 24(%rsi),%rsp +.Lepilogue: + .byte 0xf3,0xc3 +.byte 83,72,65,49,32,98,108,111,99,107,32,116,114,97,110,115,102,111,114,109,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0 +.align 16 diff --git a/project/src/crypto/sha1-x86_64.s b/project/src/crypto/sha1-x86_64.s index f0ae885..c94edd0 100644 --- a/project/src/crypto/sha1-x86_64.s +++ b/project/src/crypto/sha1-x86_64.s @@ -1,3 +1,4 @@ +.file "sha1-x86_64.s" .text .globl wit_sha1_block_data_order .type wit_sha1_block_data_order,@function diff --git a/project/src/crypto/sha1_one.c b/project/src/crypto/sha1_one.c index a47b78b..15c482d 100644 --- a/project/src/crypto/sha1_one.c +++ b/project/src/crypto/sha1_one.c @@ -60,8 +60,10 @@ #include <string.h> #include "wiimm-sha.h" -unsigned char *WIIMM_SHA1(const unsigned char *d, size_t n, unsigned char *md) -{ +#ifndef USE_SHA_LIB + + unsigned char *WIIMM_SHA1(const unsigned char *d, size_t n, unsigned char *md) + { WIIMM_SHA_CTX c; static unsigned char m[SHA_DIGEST_LENGTH]; @@ -71,4 +73,7 @@ unsigned char *WIIMM_SHA1(const unsigned char *d, size_t n, unsigned char *md) WIIMM_SHA1_Update(&c,d,n); WIIMM_SHA1_Final(md,&c); return(md); -} + } + +#endif + diff --git a/project/src/crypto/ssl-asm.h b/project/src/crypto/ssl-asm.h index aef71db..0d1e49b 100644 --- a/project/src/crypto/ssl-asm.h +++ b/project/src/crypto/ssl-asm.h @@ -35,12 +35,17 @@ * * ***************************************************************************/ -#ifdef __CYGWIN__ +#ifndef USE_SHA_LIB + #ifdef __CYGWIN__ #define SHA1_ASM #ifdef WIIMM_INCLUDE_SSL_ASM - #include "sha1-586-cygwin.s" + #if defined(__x86_64__) + #include "sha1-cygwin64.s" + #else + #include "sha1-586-cygwin.s" + #endif #endif -#elif defined(__linux__) + #elif defined(__linux__) #if defined(__i386__) #define SHA1_ASM #ifdef WIIMM_INCLUDE_SSL_ASM @@ -52,5 +57,6 @@ #include "sha1-x86_64.s" #endif #endif -#endif + #endif +#endif // !USE_SHA_LIB diff --git a/project/src/lib-brres.c b/project/src/lib-brres.c index 128fb33..f19cada 100644 --- a/project/src/lib-brres.c +++ b/project/src/lib-brres.c @@ -829,7 +829,11 @@ static int iterate_brres_group const brres_entry_t * entry_end = entry + n_entries; int stat = 0; + #if USE_ITERATOR_PARAM + if (it->itpar.cut_files) + #else if (it->cut_files) + #endif { it->index = 0; it->fst_item = 0; @@ -957,7 +961,11 @@ int IterateFilesBRRES //----- cut files? + #if USE_ITERATOR_PARAM + if (it->itpar.cut_files) + #else if (it->cut_files) + #endif { it->index = 0; it->fst_item = 0; @@ -1326,12 +1334,16 @@ int IterateStringsBRSUB it->fform = FF_UNKNOWN; - szs_iterator_t it2; - memset(&it2,0,sizeof(it2)); + szs_iterator_t it2 = {0}; it2.szs = it->szs; it2.size = it->file_size; it2.endian = it->endian; + //it2.clean_path = ; + #if USE_ITERATOR_PARAM // [[itpar]] copy itpar + it2.itpar.cut_files = true; + #else it2.cut_files = true; + #endif CutFilesBRSUB( &it2, brsub_string_func, it, 0, 0 ); return count + it2.index; } @@ -1721,7 +1733,7 @@ int DumpStructureBRRES if ( szs->fform_arch != FF_BRRES ) return -1; - return IterateFilesSZS(szs,dump_func,f,false,0,-1,SORT_NONE); + return IterateFilesParSZS(szs,dump_func,f,false,false,0,-1,SORT_NONE); } // @@ -1982,7 +1994,7 @@ enumError CreateNameRef nr->brief = brief; if ( szs->fform_arch == FF_BRRES ) - IterateFilesSZS( szs, iterate_nr_brres,nr, true,0,-1, SORT_NONE ); + IterateFilesParSZS( szs, iterate_nr_brres,nr, false,true,0,-1, SORT_NONE ); else iterate_nr_brsub(nr,szs,szs->data,szs->file_size,FF_UNKNOWN); #if 0 diff --git a/project/src/lib-bzip2.c b/project/src/lib-bzip2.c index 69ff271..aaefe2b 100644 --- a/project/src/lib-bzip2.c +++ b/project/src/lib-bzip2.c @@ -584,9 +584,17 @@ enumError DecodeBZIP2buf DASSERT(src); uint dest_need = ntohl(*(u32*)src); - *dest_written = dest_need; PRINT("DecodeBZIP2buf() %u -> %u,%u bytes\n",src_size,dest_size,dest_need); + if ( be32(src+4) == 0x52415730 ) // "RAW0" == not compressed + { + const uint copy_len = dest_size < dest_need ? dest_size : dest_need; + *dest_written = copy_len; + memcpy(dest,(u8*)src+8,copy_len); + return ERR_OK; + } + + *dest_written = dest_need; int bzerror = BZ2_bzBuffToBuffDecompress ( (char*)dest, dest_written, (char*)src+4, src_size-4, 0, 0 ); diff --git a/project/src/lib-bzip2.h b/project/src/lib-bzip2.h index 0b59c11..508f18f 100644 --- a/project/src/lib-bzip2.h +++ b/project/src/lib-bzip2.h @@ -175,7 +175,7 @@ typedef struct BZ2Manager_t //--- source cvp src_data; // BZ2 is automatically detected and - // decoded by DecodeBZIP2. Nver NULL + // decoded by DecodeBZIP2(). Never NULL uint src_size; // size of 'src_data' //--- decoded @@ -304,7 +304,7 @@ typedef struct BZ2Source_t cvp src_data; // NULL or internal fall back data. // BZ2 is automatically detected and - // decoded by DecodeBZIP2. + // decoded by DecodeBZIP2(). uint src_size; // size of 'src_data' file_format_t fform; // not FF_UNKNOWN: Allow only this type diff --git a/project/src/lib-ctcode.c b/project/src/lib-ctcode.c index dd954c6..ed0e7b1 100644 --- a/project/src/lib-ctcode.c +++ b/project/src/lib-ctcode.c @@ -2525,7 +2525,7 @@ enumError ScanBrresCTCODE szs_file_t szs; AssignSZS(&szs,true,(void*)data,data_size,false,FF_BRRES,0); - IterateFilesSZS(&szs,iter_brres_ctcode,ctcode,false,0,-1,SORT_NONE); + IterateFilesParSZS(&szs,iter_brres_ctcode,ctcode,false,false,0,-1,SORT_NONE); ResetSZS(&szs); return ERR_OK; @@ -2928,7 +2928,7 @@ enumError SaveTextCTCODE MARK_USED(keybuf,namebuf); fprintf( F.f, text_ctcode_setup_cr, - tool_name, SYSTEM, VERSION, REVISION_NUM, DATE, + tool_name, SYSTEM2, VERSION, REVISION_NUM, DATE, ctcode->ctb.ct_mode, ctcode->n_racing_cups, ctcode->max_racing_cups, diff --git a/project/src/lib-ctcode.h b/project/src/lib-ctcode.h index facd900..15520f9 100644 --- a/project/src/lib-ctcode.h +++ b/project/src/lib-ctcode.h @@ -305,7 +305,7 @@ typedef struct ctcode_t //--- text scan support u8 used_slot[CODE_MAX_TRACKS]; // 0:free, 1:used, 2:reserved - u8 next_slot[CODE_MAX_TRACKS]; // predefined slots + u16 next_slot[CODE_MAX_TRACKS]; // predefined slots u8 force_slot[CODE_MAX_TRACKS]; // 0:std, 1:force slot usage uint n_next_slot; // >0: index-1 into 'next_slot' and 'force_slot' uint tracks_defined; // number of really defined tracks diff --git a/project/src/lib-file.c b/project/src/lib-file.c index d5a01f2..979d875 100644 --- a/project/src/lib-file.c +++ b/project/src/lib-file.c @@ -3107,255 +3107,6 @@ enumError SaveSubFiles ( SubDir_t *sd, ccp basepath ) // /////////////////////////////////////////////////////////////////////////////// -/////////////// PrintScript /////////////// -/////////////////////////////////////////////////////////////////////////////// - -void PrintScriptHeader ( PrintScript_t *ps ) -{ - DASSERT(ps); - - ps->index = 0; - ps->add_index = false; - ps->sep[0] = ps->sep[1] = 0; - - if ( ps->fo && ps->fo->f ) - { - switch (script_fform) - { - case FF_JSON: - if ( script_array > 0 ) - fputs("[",ps->fo->f); - break; - - case FF_SH: - ps->add_index = script_array > 0; - break; - - case FF_PHP: - if ( script_array > 0 ) - fprintf(ps->fo->f,"$%s = array();\n\n",script_varname); - break; - - case FF_MAKEDOC: - if ( script_array > 0 ) - fprintf(ps->fo->f,"%s = @LIST\n\n",script_varname); - break; - - default: - //fputc('\n',ps->fo->f); - break; - } - } -} - -/////////////////////////////////////////////////////////////////////////////// - -void PrintScriptFooter ( PrintScript_t *ps ) -{ - DASSERT(ps); - - if ( ps && ps->fo && ps->fo->f ) - { - switch (script_fform) - { - case FF_JSON: - if ( script_array > 0 ) - fputs("]\n",ps->fo->f); - break; - - case FF_SH: - if (script_array) - fprintf(ps->fo->f,"%s_N=%u\n\n",script_varname,ps->index); - break; - - case FF_PHP: - fputs("?>\n",ps->fo->f); - break; - - default: - break; - } - } -} - -/////////////////////////////////////////////////////////////////////////////// - -int PutScriptVars -( - PrintScript_t *ps, // valid control struct - uint mode, // bit field: 1=open var, 2:close var - ccp text // text with line of format NAME=VALUE -) -{ - DASSERT(ps); - - FILE * f = ps->fo ? ps->fo->f : 0; - if (!f) - return 0; - - - //--- begin of output - - if ( mode & 1 ) - { - if ( ps->add_index ) - snprintf( ps->prefix, sizeof(ps->prefix), - "%s_%u", script_varname, ps->index ); - else - snprintf( ps->prefix, sizeof(ps->prefix), - "%s", script_varname ); - - switch (script_fform) - { - case FF_JSON: - fprintf(f,"%s{",ps->sep); - ps->sep[0] = ','; - break; - - case FF_PHP: - fputs("$d = new \\stdClass;\n",f); - break; - - case FF_MAKEDOC: - fprintf(f,"d = @MAP\n"); - break; - - default: - break; - } - } - - - //--- print var lines - - if (!text) - text = ""; - - uint count; - for( count = 0; ; count++ ) - { - while ( *text && (uchar)*text <= ' ' ) - text++; - - ccp ptr = text; - while ( *ptr && *ptr != '=' ) - ptr++; - if ( *ptr != '=' || ptr == text ) - break; - - ccp param = ptr++; - while ( (uchar)*ptr >= ' ' ) - ptr++; - - switch (script_fform) - { - case FF_JSON: - fprintf(f, "%s\"%.*s\":%.*s", - count ? "," : "", - (int)( param - text ), text, - (int)( ptr - param - 1 ), param+1 ); - break; - - case FF_BASH: - if (script_array) - { - fprintf(f, "%s_%.*s%s=(%.*s)\n", ps->prefix, - (int)( param - text ), text, - ps->index ? "+" : "", - (int)( ptr - param - 1 ), param+1 ); - break; - } - // fall through - - case FF_SH: - fprintf(f, "%s_%.*s=%.*s\n", ps->prefix, - (int)( param - text ), text, - (int)( ptr - param - 1 ), param+1 ); - break; - - case FF_PHP: - fprintf(f, "$d->%.*s = %.*s;\n", - (int)( param - text ), text, - (int)( ptr - param - 1 ), param+1 ); - break; - - case FF_MAKEDOC: - fprintf(f, "d[\"%.*s\"] = %.*s\n", - (int)( param - text ), text, - (int)( ptr - param - 1 ), param+1 ); - break; - - default: - fprintf(f, "%20.*s = %.*s\n", - (int)( param - text ), text, - (int)( ptr - param - 1 ), param+1 ); - break; - } - - text = ptr; - } - - - //--- end of output - - if ( mode & 2 ) - { - switch (script_fform) - { - case FF_JSON: - fputs("}\n",f); - break; - - case FF_PHP: - fprintf(f, "$%s%s = $d;\n\n", - ps->prefix, script_array ? "[]" : "" ); - break; - - case FF_MAKEDOC: - fprintf(f, "%s %s= move(d);\n\n", - ps->prefix, script_array ? "#" : "" ); - break; - - default: - fputc('\n',f); - break; - } - fflush(f); - } - - ps->index++; - return count; -} - -/////////////////////////////////////////////////////////////////////////////// - -int PrintScriptVars -( - PrintScript_t *ps, // valid control struct - uint mode, // bit field: 1=open var, 2:close var - ccp format, // format of message - ... // arguments - -) -{ - DASSERT(ps); - - char buf[5000]; - if (format) - { - va_list arg; - va_start(arg,format); - vsnprintf(buf,sizeof(buf),format,arg); - va_end(arg); - } - else - *buf = 0; - - return PutScriptVars(ps,mode,buf); -} - -// -/////////////////////////////////////////////////////////////////////////////// /////////////// Base64 coding /////////////// /////////////////////////////////////////////////////////////////////////////// diff --git a/project/src/lib-geohit.c b/project/src/lib-geohit.c index 55d13c9..8090e0c 100644 --- a/project/src/lib-geohit.c +++ b/project/src/lib-geohit.c @@ -668,7 +668,7 @@ enumError SaveTextGEOHIT if (!tiny) fprintf(F.f,text_geohit_kart_setup_cr, - tool_name, SYSTEM, VERSION, REVISION_NUM, DATE ); + tool_name, SYSTEM2, VERSION, REVISION_NUM, DATE ); #if USE_OBJECT_MANAGER > 1 WriteObjMgrToSetupSection( F.f, &geohit->obj_mgr, @@ -684,7 +684,7 @@ enumError SaveTextGEOHIT if (!tiny) fprintf(F.f,text_geohit_item_setup_cr, - tool_name, SYSTEM, VERSION, REVISION_NUM, DATE ); + tool_name, SYSTEM2, VERSION, REVISION_NUM, DATE ); #if USE_OBJECT_MANAGER > 1 WriteObjMgrToSetupSection( F.f, &geohit->obj_mgr, diff --git a/project/src/lib-itemslot.c b/project/src/lib-itemslot.c index 20d0060..a7b7727 100644 --- a/project/src/lib-itemslot.c +++ b/project/src/lib-itemslot.c @@ -672,7 +672,7 @@ enumError SaveTextITEMSLOT const bool tiny = brief_count > 1 || export_count; if (!tiny) fprintf(F.f,text_itemslot_setup_cr, - tool_name, SYSTEM, VERSION, REVISION_NUM, DATE ); + tool_name, SYSTEM2, VERSION, REVISION_NUM, DATE ); //--- print parameters diff --git a/project/src/lib-kcl.c b/project/src/lib-kcl.c index 86acd6b..b78a632 100644 --- a/project/src/lib-kcl.c +++ b/project/src/lib-kcl.c @@ -3585,7 +3585,9 @@ enumError ScanTextKCL { uint idx; double3 pt; - } tab[KCL_MAX_PT_PER_TRI]; + } + tab_buf[KCL_MAX_PT_PER_TRI], *tab = tab_buf; + uint tab_size = KCL_MAX_PT_PER_TRI; kcl_tri_param_t par; InitializeTriParam(&par,kcl,0); @@ -3655,11 +3657,23 @@ enumError ScanTextKCL //--- scan points uint k, norm = ~0; - for ( k = 0; k < KCL_MAX_PT_PER_TRI; k++ ) + for ( k = 0;; k++ ) { if ( k >= 3 && !NextCharSI(&si,false) ) break; + if ( k >= tab_size ) + { + const uint new_size = 2*tab_size; + struct tab_t *new_tab = MALLOC(new_size*sizeof(*new_tab)); + memcpy(new_tab,tab,tab_size*sizeof(*tab)); + PRINT("KCMD_F/TAB: grow %d -> %d\n",tab_size,new_size); + if ( tab != tab_buf ) + FREE(tab); + tab = new_tab; + tab_size = new_size; + } + u32 idx; err = ScanU32SI(&si,&idx,1,0); if (err) @@ -3683,7 +3697,7 @@ enumError ScanTextKCL && !k && (KCL_MODE & KCLMD_AUTO) ) { - noPRINT("NORMAL FOUND: %u\n",idx-1); + PRINT1("NORMAL FOUND: %u\n",idx-1); norm = idx - 1; } } @@ -3829,6 +3843,8 @@ enumError ScanTextKCL //--- terminate + if ( tab != tab_buf ) + FREE(tab); ResetD3L(&vertex); ResetD3L(&normal); return max_err; @@ -4938,7 +4954,7 @@ enumError SaveTextKCL //--- print header fprintf(F.f, text_kcl_head_cr, - tool_name, SYSTEM, VERSION, REVISION_NUM, DATE, GetKclMode(), + tool_name, SYSTEM2, VERSION, REVISION_NUM, DATE, GetKclMode(), n_vert, n_norm, n_valid_tri, n_grp ); uint i; diff --git a/project/src/lib-kmp-text.c b/project/src/lib-kmp-text.c index 15f93c8..22bc664 100644 --- a/project/src/lib-kmp-text.c +++ b/project/src/lib-kmp-text.c @@ -6369,7 +6369,7 @@ enumError SaveTextKMP fprintf(F.f, "%s[SETUP]\r\n\r\n" "TOOL = %s\r\n" - "SYSTEM = %s\r\n" + "SYSTEM2 = %s\r\n" "VERSION = %s\r\n" "REVISION = %u\r\n" "DATE = %s\r\n" @@ -6381,14 +6381,14 @@ enumError SaveTextKMP "KMP-WIM0 = %d\r\n" "\r\n", section_sep, - tool_name, SYSTEM, VERSION, REVISION_NUM, DATE, + tool_name, SYSTEM2, VERSION, REVISION_NUM, DATE, kmp->info ? kmp->info : "", kmp->kmp_version, kmp->battle_mode, kmp->wim0_export ); } else { fprintf(F.f, text_kmp_setup_cr, - tool_name, SYSTEM, VERSION, REVISION_NUM, DATE, + tool_name, SYSTEM2, VERSION, REVISION_NUM, DATE, kmp->info ? kmp->info : "", kmp->kmp_version, kmp->battle_mode, kmp->wim0_export ); diff --git a/project/src/lib-kmp.c b/project/src/lib-kmp.c index ba31951..66de994 100644 --- a/project/src/lib-kmp.c +++ b/project/src/lib-kmp.c @@ -6571,7 +6571,7 @@ static void check_ph if ( ph->pt_len == 1 ) print_check_error(chk,CMOD_WARNING,sect_ph,i,0, "Self linked item route with exact 1 point:" - " This will force a heavy lag if a red shell arrive.\n" ); + " This will force a heavy lag if a red shell arrives.\n" ); else print_check_error(chk,CMOD_HINT,sect_ph,i,0, "Self linked item route.\n" ); diff --git a/project/src/lib-lecode.c b/project/src/lib-lecode.c index b63909c..0974ed8 100644 --- a/project/src/lib-lecode.c +++ b/project/src/lib-lecode.c @@ -62,6 +62,11 @@ 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; bool opt_complete = false; @@ -188,6 +193,43 @@ int ScanOptXPFlags ( ccp arg ) /////////////////////////////////////////////////////////////////////////////// +int ScanOptSpeedometer ( ccp arg ) +{ + const int stat + = ScanKeywordOffAutoOn(arg,OFFON_ON,OFFON_ON,"Option --speedo"); + if ( stat == OFFON_ERROR ) + return 1; + + opt_speedo = stat; + PRINT("SPEEDO=%d\n",opt_speedo); + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +int ScanOptReserved_1b9 ( ccp arg ) +{ + opt_reserved_1b9 = str2l(arg,0,10); + PRINT("RESERVED_1B9=%d\n",opt_reserved_1b9); + return 0; +} + +int ScanOptReserved_1ba ( ccp arg ) +{ + opt_reserved_1ba = str2l(arg,0,10); + PRINT("RESERVED_1BA=%d\n",opt_reserved_1ba); + return 0; +} + +int ScanOptReserved_1bb ( ccp arg ) +{ + opt_reserved_1bb = str2l(arg,0,10); + PRINT("RESERVED_1BB=%d\n",opt_reserved_1b9); + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// + int ScanOptAlias ( ccp arg ) { if ( arg && *arg ) @@ -302,7 +344,7 @@ 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 ) + if ( lp->enable_perfmon > 1 || lp->enable_speedo > 1 ) return LPM_EXPERIMENTAL; return lp->enable_perfmon || !lp->enable_xpflags @@ -339,11 +381,15 @@ 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; } } 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; @@ -554,6 +600,7 @@ 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->block_track = lp->block_track < LE_MAX_BLOCK_TRACK ? lp->block_track : LE_MAX_BLOCK_TRACK; } @@ -583,6 +630,9 @@ static void CopyLPAR2Data ( le_analyse_t * ana ) if ( offsetof(le_binpar_v1_t,enable_xpflags) < ana->param_size ) h->enable_xpflags = lp->enable_xpflags; + if ( offsetof(le_binpar_v1_t,enable_speedo) < ana->param_size ) + h->enable_speedo = lp->enable_speedo; + if ( offsetof(le_binpar_v1_t,block_track) < ana->param_size ) h->block_track = lp->block_track; @@ -591,6 +641,15 @@ 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; } // @@ -606,7 +665,7 @@ enumError SaveTextLPAR { DASSERT(lpar); DASSERT(fname); - PRINT("SaveTextLEX(%s,%d)\n",fname,set_time); + PRINT("SaveTextLPAR(%s,%d)\n",fname,set_time); //--- open file @@ -682,7 +741,12 @@ 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) + { fprintf(f,text_lpar_sect_param_cr ,GetLparModeName(CalcCurrentLparMode(lpar,true),export_count>0) ,lpar->engine[0],lpar->engine[1],lpar->engine[2] @@ -690,10 +754,16 @@ enumError WriteSectionLPAR ,lpar->enable_perfmon ,lpar->enable_custom_tt ,lpar->enable_xpflags + ,lpar->enable_speedo ,LE_MAX_BLOCK_TRACK ,lpar->block_track ); + + if (have_reserved) + fputs(text_lpar_sect_reserved_cr,f); + } else + { fprintf(f, "\r\n" "LIMIT-MODE = %s\r\n\r\n" @@ -702,6 +772,7 @@ 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" ,GetLparModeName(CalcCurrentLparMode(lpar,true),export_count>0) ,lpar->engine[0],lpar->engine[1],lpar->engine[2] @@ -709,9 +780,17 @@ enumError WriteSectionLPAR ,lpar->enable_perfmon ,lpar->enable_custom_tt ,lpar->enable_xpflags + ,lpar->enable_speedo ,lpar->block_track ); + 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 @@ -942,6 +1021,14 @@ 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; + } break; default: @@ -1644,7 +1731,7 @@ void DumpLEAnalyse ( FILE *f, uint indent, const le_analyse_t *ana ) ColorSet_t col; SetupColorSet(&col,f); - fprintf(f,"%*s%sLE-CODE binary, valid=%s, file size: %x/hex = %u%s\n", + fprintf(f,"%*s%sLE-CODE binary, valid=%s, file size: %x/hex = %u bytes%s\n", indent,"", col.caption, GetLEValid(ana->valid), ana->size, ana->size, col.reset ); @@ -1688,10 +1775,10 @@ void DumpLEAnalyse ( FILE *f, uint indent, const le_analyse_t *ana ) "%*s" "Build number: %u\n" "%*s" "Base address: %8x/hex\n" "%*s" "Entry point: %8x/hex\n" - "%*s" "Total size: %8x/hex = %u\n" + "%*s" "Total size: %8x/hex = %u bytes\n" "%*s" "Offset param: %8x/hex\n" - "%*s" "Region code: %c (%s)\n" - "%*s" "Debug flag: %c (%s)\n" + "%*s" "Region code: %c = %s\n" + "%*s" "Debug flag: %c = %s\n" "%*s" "LE version/phase: %u\n" ,indent-2,"", col.heading, col.reset ,indent,"", h->magic @@ -1744,7 +1831,7 @@ void DumpLEAnalyse ( FILE *f, uint indent, const le_analyse_t *ana ) "\n%*s%s" "Parameters:%s\n" "%*s" "Magic: %.4s\n" "%*s" "Version: %u\n" - "%*s" "Param size: %x/hex = %u\n" + "%*s" "Param size: %x/hex = %u bytes\n" ,indent-2,"", col.heading, col.reset ,indent,"", h->magic ,indent,"", ntohl(h->version) @@ -1760,29 +1847,49 @@ void DumpLEAnalyse ( FILE *f, uint indent, const le_analyse_t *ana ) DASSERT(h); fprintf(f, "%*s" "Engine chances: " - "%u + %u + %u = %u (1%s0cc,mirror)\n" - "%*s" "200cc: %u (%sabled)\n" - "%*s" "Perform. monitor: %u (%s)\n" + "%u + %u + %u = %u (1%s0cc+mirror=total)\n" + "%*s" "200cc: %u = %sabled\n" + "%*s" "Perform. monitor: %u = %s\n" ,indent,"" ,h->engine[0], h->engine[1], h->engine[2] ,h->engine[0] + h->engine[1] + h->engine[2] - ,h->enable_200cc ? "50cc,20" : "00cc,15" + ,h->enable_200cc ? "50cc+20" : "00cc+15" ,indent,"", h->enable_200cc, h->enable_200cc ? "en" :"dis" ,indent,"", h->enable_perfmon, - h->enable_perfmon > 1 ? "Wii+Dolphin" - : h->enable_perfmon ? "Wii only" :"disabled" + h->enable_perfmon > 1 ? "Wii(U)+Dolphin" + : h->enable_perfmon ? "Wii(U) only" :"disabled" ); if ( ana->param_size >= sizeof(le_binpar_v1_37_t) ) fprintf(f, - "%*s" "Custom Timetrial: %u (%sabled)\n" - "%*s" "Extended P-Flags: %u (%sabled)\n" - "%*s" "Block tracks for: %u races\n" + "%*s" "Custom Timetrial: %u = %sabled\n" + "%*s" "Extended P-Flags: %u = %sabled\n" + "%*s" "Block tracks for: %u race%s\n" ,indent,"", h->enable_custom_tt, h->enable_custom_tt ? "en" :"dis" ,indent,"", h->enable_xpflags, h->enable_xpflags ? "en" :"dis" - ,indent,"", h->block_track + ,indent,"", h->block_track, h->block_track == 1 ? "" : "s" ); + if ( ana->param_size >= sizeof(le_binpar_v1_1bc_t) ) + { + 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" + ); + + 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 (h->reserved_1bb) + fprintf(f,"%*s" "Reserved 1BB: %u\n", + indent,"", h->reserved_1bb ); + } + #if defined(DEBUG) && defined(TEST) && 0 const uint po = ana->param_offset; fprintf(f, @@ -2241,6 +2348,30 @@ uint PatchAliasLE ( le_analyse_t * ana, ccp list ) /////////////////////////////////////////////////////////////////////////////// +void PatchLPAR ( le_lpar_t * lp ) +{ + DASSERT(lp); + + if (opt_engine_valid) + memcpy(lp->engine,opt_engine,sizeof(lp->engine)); + if ( opt_200cc != OFFON_AUTO ) + lp->enable_200cc = opt_200cc >= OFFON_ON; + if ( opt_perfmon != OFFON_AUTO ) + lp->enable_perfmon = opt_perfmon >= OFFON_FORCE ? 2 : opt_perfmon >= OFFON_ON; + if ( opt_custom_tt != OFFON_AUTO ) + lp->enable_custom_tt = opt_custom_tt >= OFFON_ON; + 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; +} + +/////////////////////////////////////////////////////////////////////////////// + void PatchLECODE ( le_analyse_t * ana ) { DASSERT(ana); @@ -2252,23 +2383,9 @@ void PatchLECODE ( le_analyse_t * ana ) switch (ana->param_vers) { case 1: - { - if (opt_le_alias) - PatchAliasLE(ana,opt_le_alias); - - le_lpar_t *lp = &ana->lpar; - if (opt_engine_valid) - memcpy(lp->engine,opt_engine,sizeof(lp->engine)); - if ( opt_200cc != OFFON_AUTO ) - lp->enable_200cc = opt_200cc >= OFFON_ON; - if ( opt_perfmon != OFFON_AUTO ) - lp->enable_perfmon = opt_perfmon >= OFFON_FORCE ? 2 - : opt_perfmon >= OFFON_ON; - if ( opt_custom_tt != OFFON_AUTO ) - lp->enable_custom_tt = opt_custom_tt >= OFFON_ON; - if ( opt_xpflags != OFFON_AUTO ) - lp->enable_xpflags = opt_xpflags >= OFFON_ON; - } + if (opt_le_alias) + PatchAliasLE(ana,opt_le_alias); + PatchLPAR(&ana->lpar); break; } @@ -2454,7 +2571,12 @@ enumError ScanTextLPAR_PARAM { "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} }; @@ -2693,6 +2815,8 @@ static void FixLEXElement_SET1 ( lex_set1_t *set1 ) if ( !isnormal(f) || f < 1.0 ) write_bef4(set1->item_factor.v+i,1.0); } + + set1->fix_online_delay = set1->fix_online_delay > 0; } //----------------------------------------------------------------------------- @@ -3042,7 +3166,7 @@ lex_item_t * AppendSet1LEX ( lex_t * lex, bool overwrite ) { lex_set1_t set1; memset(&set1,0,sizeof(set1)); - // AppendElementLE() do call FixLEXItem_SET1() + // AppendElementLE() does call FixLEXItem_SET1() return AppendElementLEX(lex,LEXS_SET1,&set1,sizeof(set1),false); } @@ -3406,6 +3530,7 @@ static enumError ScanLEXElement_SET1 const ScanParam_t ptab[] = { { "ITEM-POS-FACTOR", SPM_FLOAT3_BE, &set1.item_factor }, + { "FIX-ONLINE-DELAY", SPM_U8, &set1.fix_online_delay }, {0} }; @@ -3942,6 +4067,11 @@ static enumError SaveTextLEX_SET1 ,bef4(&set1->item_factor.z) ); + if (set1->fix_online_delay) + fprintf(f,text_lex_elem_set1_develop_cr + ,set1->fix_online_delay + ); + if ( size > sizeof(lex_set1_t) ) { fputs("\n# Hex dump for unknown settings:\n",f); @@ -4123,18 +4253,18 @@ enumError SaveTextLEX fprintf(F.f, "%s[SETUP]\r\n\r\n" "TOOL = %s\r\n" - "SYSTEM = %s\r\n" + "SYSTEM2 = %s\r\n" "VERSION = %s\r\n" "REVISION = %u\r\n" "DATE = %s\r\n" "\r\n", section_sep, - tool_name, SYSTEM, VERSION, REVISION_NUM, DATE ); + tool_name, SYSTEM2, VERSION, REVISION_NUM, DATE ); } else { fprintf(F.f, text_lex_setup_cr, - tool_name, SYSTEM, VERSION, REVISION_NUM, DATE ); + tool_name, SYSTEM2, VERSION, REVISION_NUM, DATE ); uint i; for ( i = 0; i < lex->item_used; i++ ) diff --git a/project/src/lib-lecode.h b/project/src/lib-lecode.h index 79788c9..6f314a2 100644 --- a/project/src/lib-lecode.h +++ b/project/src/lib-lecode.h @@ -115,8 +115,14 @@ typedef struct le_lpar_t u8 enable_perfmon; // TRUE: performance monitor enabled 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 block_track; // block used tracks for 0..20 races + // reserved for future extensions + u8 reserved_1b9; + u8 reserved_1ba; + u8 reserved_1bb; + 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 } @@ -355,9 +361,45 @@ typedef struct le_binpar_v1_1b8_t __attribute__ ((packed)) 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 + + /*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 + + //--- reserved for future extensions + /*1b9*/ u8 reserved_1b9; + /*1ba*/ u8 reserved_1ba; + /*1bb*/ u8 reserved_1bb; + /*1bc*/ +} +__attribute__ ((packed)) le_binpar_v1_1bc_t; + +//----------------------------------------------------------------------------- // [[le_binpar_v1_t]] -typedef struct le_binpar_v1_1b8_t le_binpar_v1_t; +typedef struct le_binpar_v1_1bc_t le_binpar_v1_t; // /////////////////////////////////////////////////////////////////////////////// @@ -497,6 +539,7 @@ const ctcode_t * LoadLEFile ( uint le_phase ); enumError ApplyLEFile ( le_analyse_t * ana ); enumError ApplyCTCODE ( le_analyse_t * ana, const ctcode_t * ctcode ); void PatchLECODE ( le_analyse_t * ana ); +void PatchLPAR ( le_lpar_t * lp ); // /////////////////////////////////////////////////////////////////////////////// @@ -583,7 +626,9 @@ __attribute__ ((packed)) lex_element_t; typedef struct lex_set1_t { - float3 item_factor; // factor for item positions, always >=1.0 + float3 item_factor; // factor for item positions, always >=1.0 + u8 fix_online_delay; // fix delay of GOBJ objects + u8 padding[3]; } __attribute__ ((packed,aligned(4))) lex_set1_t; @@ -876,16 +921,26 @@ 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 bool opt_complete; -int ScanOptTrackSource ( ccp arg, int mode ); -int ScanOptAlias ( ccp arg ); -int ScanOptEngine ( ccp arg ); -int ScanOpt200cc ( ccp arg ); -int ScanOptPerfMon ( ccp arg ); -int ScanOptCustomTT( ccp arg ); -int ScanOptXPFlags ( ccp arg ); +int ScanOptTrackSource ( ccp arg, int mode ); +int ScanOptAlias ( ccp arg ); +int ScanOptEngine ( ccp arg ); +int ScanOpt200cc ( ccp arg ); +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 ); // /////////////////////////////////////////////////////////////////////////////// diff --git a/project/src/lib-mdl.c b/project/src/lib-mdl.c index b05b260..72c055b 100644 --- a/project/src/lib-mdl.c +++ b/project/src/lib-mdl.c @@ -1629,7 +1629,7 @@ enumError IterateRawDataMDL szs_file_t szs; // [[fname+]] AssignSZS(&szs,true,raw->data,raw->data_size,false,raw->fform,raw->fname); - IterateFilesSZS(&szs,iter_raw_data_mdl,&iparam,false,-1,-1,SORT_NONE); + IterateFilesParSZS(&szs,iter_raw_data_mdl,&iparam,false,false,-1,-1,SORT_NONE); ResetSZS(&szs); return iparam.max_err; } @@ -2505,7 +2505,7 @@ enumError SaveTextMDL fprintf(F.f, "%s[SETUP]\r\n\r\n" "TOOL = %s\r\n" - "SYSTEM = %s\r\n" + "SYSTEM2 = %s\r\n" "VERSION = %s\r\n" "REVISION = %u\r\n" "DATE = %s\r\n" @@ -2515,14 +2515,14 @@ enumError SaveTextMDL "N-SECTIONS = %2u\r\n" "\r\n", section_sep, - tool_name, SYSTEM, VERSION, REVISION_NUM, DATE, + tool_name, SYSTEM2, VERSION, REVISION_NUM, DATE, mdl->name ? mdl->name : "", mdl->version, mdl->n_sect ); } else { fprintf(F.f, text_mdl_setup_cr, - tool_name, SYSTEM, VERSION, REVISION_NUM, DATE, + tool_name, SYSTEM2, VERSION, REVISION_NUM, DATE, mdl->name ? mdl->name : "", mdl->version, mdl->n_sect ); } @@ -3478,8 +3478,8 @@ static int find_minimap_brres PRINT("MDL FOUND: %x |%s|%s| fn=%s\n",it->fform,it->path,it->name,it->szs->fname); szs_file_t szs; InitializeSubSZS(&szs,it->szs,it->off,it->size,FF_MDL,it->path,false); - int stat = IterateFilesSZS ( &szs, find_minimap_mdl, it->param, - true, 0, 1, SORT_NONE ); + int stat = IterateFilesParSZS ( &szs, find_minimap_mdl, it->param, + false, true, 0, 1, SORT_NONE ); ResetSZS(&szs); return stat; } @@ -3507,8 +3507,8 @@ static int find_minimap_szs PRINT("MAP MODEL FOUND: %x |%s|%s|\n",it->fform,it->path,it->name); szs_file_t szs; InitializeSubSZS(&szs,it->szs,it->off,it->size,FF_BRRES,it->path,false); - int stat = IterateFilesSZS ( &szs, find_minimap_brres, it->param, - true, 0, -1, SORT_NONE ); + int stat = IterateFilesParSZS ( &szs, find_minimap_brres, it->param, + false, true, 0, -1, SORT_NONE ); ResetSZS(&szs); return stat; } @@ -3532,11 +3532,11 @@ bool FindMinimapData mmap->max.x = mmap->max.y = mmap->max.z = -INFINITY; if ( szs->fform_arch == FF_MDL ) - IterateFilesSZS ( szs, find_minimap_mdl, mmap, true, 0, 1, SORT_NONE ); + IterateFilesParSZS ( szs, find_minimap_mdl, mmap, false, true, 0, 1, SORT_NONE ); else if ( szs->fform_arch == FF_BRRES ) - IterateFilesSZS ( szs, find_minimap_brres, mmap, true, 0, -1, SORT_NONE ); + IterateFilesParSZS ( szs, find_minimap_brres, mmap, false, true, 0, -1, SORT_NONE ); else if (IsArchiveFF(szs->fform_arch)) - IterateFilesSZS ( szs, find_minimap_szs, mmap, true, 0, -1, SORT_NONE ); + IterateFilesParSZS ( szs, find_minimap_szs, mmap, false, true, 0, -1, SORT_NONE ); PRINT_IF(mmap->posLD," posLD found, in=%d\n", (u8*)mmap->posLD >= szs->data && (u8*)mmap->posLD < szs->data + szs->size ); @@ -3883,8 +3883,8 @@ static int ana_slot42_brres szs_file_t szs; // [[fname+]] InitializeSubSZS(&szs,it->szs,it->off,it->size,FF_MDL,it->path,false); - int stat = IterateFilesSZS ( &szs, ana_slot42_mdl, it->param, - true, 0, 1, SORT_NONE ); + int stat = IterateFilesParSZS ( &szs, ana_slot42_mdl, it->param, + false, true, 0, 1, SORT_NONE ); Slot42MaterialStat_t *stat42 = it->param; DASSERT(stat42); @@ -3963,8 +3963,8 @@ static int ana_slot42_szs szs_file_t szs; // [[fname+]] InitializeSubSZS(&szs,it->szs,it->off,it->size,FF_BRRES,it->path,false); - int stat = IterateFilesSZS ( &szs, ana_slot42_brres, it->param, - true, 0, -1, SORT_NONE ); + int stat = IterateFilesParSZS ( &szs, ana_slot42_brres, it->param, + false, true, 0, -1, SORT_NONE ); ResetSZS(&szs); return stat; } @@ -3987,11 +3987,11 @@ Slot42MaterialStat_t GetSlot42SupportSZS ( struct szs_file_t *szs ) PRINT("CHECK MOONVIEW [%zu] %s\n",szs->size,GetNameFF(szs->fform_arch,0)); if ( szs->fform_arch == FF_MDL ) - IterateFilesSZS ( szs, ana_slot42_mdl, &stat42, true, 0, 1, SORT_NONE ); + IterateFilesParSZS ( szs, ana_slot42_mdl, &stat42, false, true, 0, 1, SORT_NONE ); else if ( szs->fform_arch == FF_BRRES ) - IterateFilesSZS ( szs, ana_slot42_brres, &stat42, true, 0, -1, SORT_NONE ); + IterateFilesParSZS ( szs, ana_slot42_brres, &stat42, false, true, 0, -1, SORT_NONE ); else if (IsArchiveFF(szs->fform_arch)) - IterateFilesSZS ( szs, ana_slot42_szs, &stat42, true, 0, -1, SORT_NONE ); + IterateFilesParSZS ( szs, ana_slot42_szs, &stat42, false, true, 0, -1, SORT_NONE ); PRINT("MOONVIEW [%zu] %s: found=%x, mod=%x -> all=%d, content=%d -> ok=%d\n", szs->size, GetNameFF(szs->fform_arch,0), @@ -4540,7 +4540,7 @@ uint PatchRawDataMDL // [[fname+]] AssignSZS(&szs,true,data_ptr,data_size,false,FF_MDL,fname); szs.fname = fname; - IterateFilesSZS(&szs,patch_mdl,&mdlpat,true,0,1,SORT_NONE); + IterateFilesParSZS(&szs,patch_mdl,&mdlpat,false,true,0,1,SORT_NONE); szs.fname = 0; ResetSZS(&szs); diff --git a/project/src/lib-minigame.c b/project/src/lib-minigame.c index d13fe21..59eead7 100644 --- a/project/src/lib-minigame.c +++ b/project/src/lib-minigame.c @@ -718,7 +718,7 @@ enumError SaveTextMINIGAME const bool tiny = brief_count > 1 || export_count; if (!tiny) fprintf(F.f,text_minigame_setup_cr, - tool_name, SYSTEM, VERSION, REVISION_NUM, DATE ); + tool_name, SYSTEM2, VERSION, REVISION_NUM, DATE ); //--- print parameters diff --git a/project/src/lib-numeric.h b/project/src/lib-numeric.h index 5414c7f..2239a0f 100644 --- a/project/src/lib-numeric.h +++ b/project/src/lib-numeric.h @@ -1833,17 +1833,24 @@ ccp FindEndOfLineSI ccp FindLineFeedSI ( - ScanInfo_t * si, // valid data + const ScanInfo_t * si, // valid data ccp ptr, // start search here - bool mark_error // true: increment error counter + bool mark_error // true: increment error counter (ignore const) ); //----------------------------------------------------------------------------- ccp FindNextLineFeedSI ( - ScanInfo_t * si, // valid data - bool mark_error // true: increment error counter + const ScanInfo_t * si, // valid data + bool mark_error // true: increment error counter (ignore const) +); + +//----------------------------------------------------------------------------- + +mem_t GetLineSI +( + const ScanInfo_t * si // valid data ); /////////////////////////////////////////////////////////////////////////////// diff --git a/project/src/lib-objflow.c b/project/src/lib-objflow.c index ddecb37..773b0dc 100644 --- a/project/src/lib-objflow.c +++ b/project/src/lib-objflow.c @@ -575,7 +575,7 @@ enumError SaveTextOBJFLOW const bool tiny = brief_count > 1 || export_count; if (!tiny) fprintf(F.f,text_objflow_setup_cr, - tool_name, SYSTEM, VERSION, REVISION_NUM, DATE ); + tool_name, SYSTEM2, VERSION, REVISION_NUM, DATE ); #if USE_OBJECT_MANAGER>1 WriteObjMgrToSetupSection( F.f, &objflow->obj_mgr, diff --git a/project/src/lib-pack.c b/project/src/lib-pack.c index 5961839..3edaafb 100644 --- a/project/src/lib-pack.c +++ b/project/src/lib-pack.c @@ -77,7 +77,11 @@ int IterateFilesPACK //--- cut file header + #if USE_ITERATOR_PARAM + if (it->itpar.cut_files) + #else if (it->cut_files) + #endif { it->index = 0; it->fst_item = 0; diff --git a/project/src/lib-parser.c b/project/src/lib-parser.c index 6437b2c..3224c12 100644 --- a/project/src/lib-parser.c +++ b/project/src/lib-parser.c @@ -2377,6 +2377,7 @@ void GotoEolSI ScanInfo_t * si // valid data ) { + DASSERT(si); ScanFile_t *sf = si->cur_file; DASSERT(sf); sf->prev_ptr = sf->ptr; @@ -2511,9 +2512,9 @@ ccp FindEndOfLineSI ccp FindLineFeedSI ( - ScanInfo_t * si, // valid data + const ScanInfo_t * si, // valid data ccp ptr, // start search here - bool mark_error // true: increment error counter + bool mark_error // true: increment error counter (ignore const) ) { DASSERT(si); @@ -2523,7 +2524,7 @@ ccp FindLineFeedSI if (mark_error) { sf->line_err++; - si->total_err++; + ((ScanInfo_t*)si)->total_err++; } while ( ptr < sf->end && *ptr != '\n' ) @@ -2536,8 +2537,8 @@ ccp FindLineFeedSI ccp FindNextLineFeedSI ( - ScanInfo_t * si, // valid data - bool mark_error // true: increment error counter + const ScanInfo_t * si, // valid data + bool mark_error // true: increment error counter (ignore const) ) { DASSERT(si); @@ -2545,6 +2546,22 @@ ccp FindNextLineFeedSI return FindLineFeedSI(si,si->cur_file->ptr,mark_error); } +/////////////////////////////////////////////////////////////////////////////// + +mem_t GetLineSI +( + const ScanInfo_t * si // valid data +) +{ + DASSERT(si); + DASSERT(si->cur_file); + ccp eol = FindNextLineFeedSI(si,false); + mem_t mem; + mem.ptr = si->cur_file->ptr; + mem.len = eol ? eol - mem.ptr : 0; + return mem; +} + // /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// diff --git a/project/src/lib-pat.c b/project/src/lib-pat.c index ad3131c..f1cbf6a 100644 --- a/project/src/lib-pat.c +++ b/project/src/lib-pat.c @@ -1907,7 +1907,7 @@ enumError SaveTextPAT fprintf(F.f, "%s[SETUP]\r\n\r\n" "TOOL = %s\r\n" - "SYSTEM = %s\r\n" + "SYSTEM2 = %s\r\n" "VERSION = %s\r\n" "REVISION = %u\r\n" "DATE = %s\r\n" @@ -1917,13 +1917,13 @@ enumError SaveTextPAT "OUTPUT-MODE = %s\r\n" "\r\n", section_sep, - tool_name, SYSTEM, VERSION, REVISION_NUM, DATE, + tool_name, SYSTEM2, VERSION, REVISION_NUM, DATE, pat->version, pat->n_sect, outmode_info ); } else { fprintf(F.f, text_pat_setup_cr, - tool_name, SYSTEM, VERSION, REVISION_NUM, DATE, + tool_name, SYSTEM2, VERSION, REVISION_NUM, DATE, pat->version, pat->n_sect, outmode_info ); } diff --git a/project/src/lib-rarc.c b/project/src/lib-rarc.c index a38b4b5..e6dc911 100644 --- a/project/src/lib-rarc.c +++ b/project/src/lib-rarc.c @@ -223,7 +223,11 @@ int IterateFilesRARC } #endif + #if USE_ITERATOR_PARAM + if (it->itpar.cut_files) + #else if (it->cut_files) + #endif { it->index = 0; it->fst_item = 0; diff --git a/project/src/lib-rkc.c b/project/src/lib-rkc.c index c7bbb51..c3deb92 100644 --- a/project/src/lib-rkc.c +++ b/project/src/lib-rkc.c @@ -105,7 +105,11 @@ int IterateFilesRKC it->fst_item = 0; it->is_dir = 0; + #if USE_ITERATOR_PARAM + if (it->itpar.cut_files) + #else if (it->cut_files) + #endif { it->no_recurse++; it->off = 0; @@ -136,7 +140,11 @@ int IterateFilesRKC return it->func_it(it,false); } + #if USE_ITERATOR_PARAM + if ( it->itpar.cut_files && sizeof(rkct_t)+sizeof(rkco_t) < u8_off ) + #else if ( it->cut_files && sizeof(rkct_t)+sizeof(rkco_t) < u8_off ) + #endif { it->off = sizeof(rkct_t)+sizeof(rkco_t); it->size = u8_off - it->off; @@ -157,8 +165,13 @@ int IterateFilesRKC // [[fname+]] InitializeSubSZS(&szs2,szs,u8_off,u8_end-u8_off,FF_UNKNOWN,it->path,true); + #if USE_ITERATOR_PARAM + szs_iterator_func it_func + = GetIteratorFunction(szs2.fform_arch,it->itpar.cut_files); + #else szs_iterator_func it_func = GetIteratorFunction(szs2.fform_arch,it->cut_files); + #endif if (it_func) { diff --git a/project/src/lib-staticr.c b/project/src/lib-staticr.c index 2125714..bd49760 100644 --- a/project/src/lib-staticr.c +++ b/project/src/lib-staticr.c @@ -1316,6 +1316,115 @@ static BZ2Manager_t * GetLecodeLoader ( str_mode_t mode ) // /////////////////////////////////////////////////////////////////////////////// +/////////////// fix_51420 data /////////////// +/////////////////////////////////////////////////////////////////////////////// + +static const u8 fix_51420_pal_bz2[] = +{ + // decompressed size: 0x88 = 136 bytes + 0x00,0x00,0x00,0x88, + + // raw data + 0x52,0x41,0x57,0x30, 0x00,0xd0,0xc0,0xde, 0x00,0xd0,0xc0,0xde, 0xc2,0x65,0x8c,0xe4, + 0x00,0x00,0x00,0x0f, 0x48,0x00,0x00,0x0d, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0x7c,0xc8,0x03,0xa6, 0x80,0x86,0x00,0x00, 0x7c,0x04,0x18,0x00, 0x41,0x82,0x00,0x4c, + 0x80,0xa6,0x00,0x04, 0x38,0xa5,0x00,0x01, 0x2c,0x05,0x00,0x03, 0x41,0x82,0x00,0x3c, + 0x90,0xa6,0x00,0x04, 0x90,0x66,0x00,0x00, 0x38,0x61,0x00,0x10, 0x3c,0xa0,0x80,0x66, + 0x38,0xa5,0x84,0x18, 0x3c,0x80,0x80,0x66, 0x38,0x84,0x84,0x98, 0x90,0xa1,0x00,0x10, + 0x90,0x81,0x00,0x14, 0x3c,0xe0,0x80,0x66, 0x38,0xe7,0x8c,0xe4, 0x38,0xe7,0xfe,0xf0, + 0x7c,0xe9,0x03,0xa6, 0x4e,0x80,0x04,0x20, 0x3c,0x80,0x80,0x1d, 0x38,0x84,0x15,0xf4, + 0x7c,0x88,0x03,0xa6, 0x4e,0x80,0x00,0x21, 0x60,0x00,0x00,0x00, + // 0x88 = 136 data bytes (103%) +}; + +static BZ2Manager_t fix_51420_pal_mgr + = { fix_51420_pal_bz2, sizeof(fix_51420_pal_bz2), 0, 0 }; + +//----------------------------------------------------------------------------- + +static const u8 fix_51420_usa_bz2[] = +{ + // decompressed size: 0x88 = 136 bytes + 0x00,0x00,0x00,0x88, + + // raw data + 0x52,0x41,0x57,0x30, 0x00,0xd0,0xc0,0xde, 0x00,0xd0,0xc0,0xde, 0xc2,0x65,0x48,0x5c, + 0x00,0x00,0x00,0x0f, 0x48,0x00,0x00,0x0d, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0x7c,0xc8,0x03,0xa6, 0x80,0x86,0x00,0x00, 0x7c,0x04,0x18,0x00, 0x41,0x82,0x00,0x4c, + 0x80,0xa6,0x00,0x04, 0x38,0xa5,0x00,0x01, 0x2c,0x05,0x00,0x03, 0x41,0x82,0x00,0x3c, + 0x90,0xa6,0x00,0x04, 0x90,0x66,0x00,0x00, 0x38,0x61,0x00,0x10, 0x3c,0xa0,0x80,0x65, + 0x38,0xa5,0x3f,0x90, 0x3c,0x80,0x80,0x65, 0x38,0x84,0x40,0x10, 0x90,0xa1,0x00,0x10, + 0x90,0x81,0x00,0x14, 0x3c,0xe0,0x80,0x65, 0x38,0xe7,0x48,0x5c, 0x38,0xe7,0xfe,0xf0, + 0x7c,0xe9,0x03,0xa6, 0x4e,0x80,0x04,0x20, 0x3c,0x80,0x80,0x1d, 0x38,0x84,0x15,0x54, + 0x7c,0x88,0x03,0xa6, 0x4e,0x80,0x00,0x21, 0x60,0x00,0x00,0x00, + // 0x88 = 136 data bytes (103%) +}; + +static BZ2Manager_t fix_51420_usa_mgr + = { fix_51420_usa_bz2, sizeof(fix_51420_usa_bz2), 0, 0 }; + +//----------------------------------------------------------------------------- + +static const u8 fix_51420_jap_bz2[] = +{ + // decompressed size: 0x88 = 136 bytes + 0x00,0x00,0x00,0x88, + + // raw data + 0x52,0x41,0x57,0x30, 0x00,0xd0,0xc0,0xde, 0x00,0xd0,0xc0,0xde, 0xc2,0x65,0x83,0x50, + 0x00,0x00,0x00,0x0f, 0x48,0x00,0x00,0x0d, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0x7c,0xc8,0x03,0xa6, 0x80,0x86,0x00,0x00, 0x7c,0x04,0x18,0x00, 0x41,0x82,0x00,0x4c, + 0x80,0xa6,0x00,0x04, 0x38,0xa5,0x00,0x01, 0x2c,0x05,0x00,0x03, 0x41,0x82,0x00,0x3c, + 0x90,0xa6,0x00,0x04, 0x90,0x66,0x00,0x00, 0x38,0x61,0x00,0x10, 0x3c,0xa0,0x80,0x65, + 0x38,0xa5,0x7a,0x84, 0x3c,0x80,0x80,0x65, 0x38,0x84,0x7b,0x04, 0x90,0xa1,0x00,0x10, + 0x90,0x81,0x00,0x14, 0x3c,0xe0,0x80,0x66, 0x38,0xe7,0x83,0x50, 0x38,0xe7,0xfe,0xf0, + 0x7c,0xe9,0x03,0xa6, 0x4e,0x80,0x04,0x20, 0x3c,0x80,0x80,0x1d, 0x38,0x84,0x15,0x14, + 0x7c,0x88,0x03,0xa6, 0x4e,0x80,0x00,0x21, 0x60,0x00,0x00,0x00, + // 0x88 = 136 data bytes (103%) +}; + +static BZ2Manager_t fix_51420_jap_mgr + = { fix_51420_jap_bz2, sizeof(fix_51420_jap_bz2), 0, 0 }; + +//----------------------------------------------------------------------------- + +static const u8 fix_51420_kor_bz2[] = +{ + // decompressed size: 0x88 = 136 bytes + 0x00,0x00,0x00,0x88, + + // raw data + 0x52,0x41,0x57,0x30, 0x00,0xd0,0xc0,0xde, 0x00,0xd0,0xc0,0xde, 0xc2,0x64,0x6f,0xfc, + 0x00,0x00,0x00,0x0f, 0x48,0x00,0x00,0x0d, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0x7c,0xc8,0x03,0xa6, 0x80,0x86,0x00,0x00, 0x7c,0x04,0x18,0x00, 0x41,0x82,0x00,0x4c, + 0x80,0xa6,0x00,0x04, 0x38,0xa5,0x00,0x01, 0x2c,0x05,0x00,0x03, 0x41,0x82,0x00,0x3c, + 0x90,0xa6,0x00,0x04, 0x90,0x66,0x00,0x00, 0x38,0x61,0x00,0x10, 0x3c,0xa0,0x80,0x64, + 0x38,0xa5,0x67,0x30, 0x3c,0x80,0x80,0x64, 0x38,0x84,0x67,0xb0, 0x90,0xa1,0x00,0x10, + 0x90,0x81,0x00,0x14, 0x3c,0xe0,0x80,0x64, 0x38,0xe7,0x6f,0xfc, 0x38,0xe7,0xfe,0xf0, + 0x7c,0xe9,0x03,0xa6, 0x4e,0x80,0x04,0x20, 0x3c,0x80,0x80,0x1d, 0x38,0x84,0x19,0x50, + 0x7c,0x88,0x03,0xa6, 0x4e,0x80,0x00,0x21, 0x60,0x00,0x00,0x00, + // 0x88 = 136 data bytes (103%) +}; + +static BZ2Manager_t fix_51420_kor_mgr + = { fix_51420_kor_bz2, sizeof(fix_51420_kor_bz2), 0, 0 }; + +//----------------------------------------------------------------------------- + +static BZ2Manager_t * GetFix51420 ( str_mode_t mode ) +{ + switch (mode) + { + case STR_M_PAL: return &fix_51420_pal_mgr; + case STR_M_USA: return &fix_51420_usa_mgr; + case STR_M_JAP: return &fix_51420_jap_mgr; + case STR_M_KOR: return &fix_51420_kor_mgr; + default: return 0; + } +} + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// more data /////////////// /////////////////////////////////////////////////////////////////////////////// @@ -5012,21 +5121,24 @@ static enumError AddSectionHelper /////////////////////////////////////////////////////////////////////////////// -static enumError ReadCodeFile ( staticr_t *str, ccp fname, u8 **data, uint *size ) +static enumError ReadCodeFile + ( staticr_t *str, ccp fname, u8 **data, uint *size, bool *alloced ) { DASSERT(str); DASSERT(fname); DASSERT(data); DASSERT(size); + DASSERT(alloced); *data = 0; *size = 0; + *alloced = false; if ( fname && fname[0] == '@' ) { BZ2Manager_t *wcm = 0; if (!strcmp(fname,"@LECODE")) wcm = GetLecodeLoader(str->mode); -// else if (!strcmp(fname,"@XXX")) wcm = GetXXXX(str->mode); + else if (!strcmp(fname,"@FIX51420")) wcm = GetFix51420(str->mode); if (wcm) { @@ -5051,6 +5163,7 @@ static enumError ReadCodeFile ( staticr_t *str, ccp fname, u8 **data, uint *size } } + *alloced = true; return ERR_OK; } @@ -5222,7 +5335,8 @@ enumError AddWCodeFile ( staticr_t *str, ccp fname ) u8 *data; uint size; - enumError err = ReadCodeFile(str,fname,&data,&size); + bool alloced; + enumError err = ReadCodeFile(str,fname,&data,&size,&alloced); if (err) return err; @@ -5237,7 +5351,8 @@ enumError AddWCodeFile ( staticr_t *str, ccp fname ) else err = ERROR0(ERR_WARNING,"Not a GCT file: %s\n",fname); - FREE(data); + if(alloced) + FREE(data); return err; } @@ -5338,12 +5453,14 @@ static uint AddSectionDOL u8 *gh_data = 0; uint gh_size = 0; - enumError err = ReadCodeFile(str,fname,&gh_data,&gh_size); + bool gh_alloced; + enumError err = ReadCodeFile(str,fname,&gh_data,&gh_size,&gh_alloced); if (err) return err; const uint stat = AddSectionGCH(str,gh_data,gh_size,fname,get_min_addr); - FREE(gh_data); + if (gh_alloced) + FREE(gh_data); return stat; } @@ -6872,6 +6989,18 @@ const data_tab_t maindol_data_tab[] = DEF_BZIP(codehandler) DEF_BZIP(codehandleronly) + #if HAVE_WIIMM_EXT + DEF_BZIP(lecode_loader_pal) + DEF_BZIP(lecode_loader_usa) + DEF_BZIP(lecode_loader_jap) + DEF_BZIP(lecode_loader_kor) + + DEF_BZIP(fix_51420_pal) + DEF_BZIP(fix_51420_usa) + DEF_BZIP(fix_51420_jap) + DEF_BZIP(fix_51420_kor) + #endif + {0,0,0} }; diff --git a/project/src/lib-std.c b/project/src/lib-std.c index 9346208..74d7cf8 100644 --- a/project/src/lib-std.c +++ b/project/src/lib-std.c @@ -3792,7 +3792,7 @@ void cmd_version_section "version=" VERSION "\n" "beta=%d\n" "revision=" REVISION "\n" - "system=" SYSTEM "\n" + "system=" SYSTEM2 "\n" "endian=%u%u%u%u %s\n" "author=" AUTHOR "\n" "date=" DATE "\n" diff --git a/project/src/lib-std.h b/project/src/lib-std.h index e049a64..2230199 100644 --- a/project/src/lib-std.h +++ b/project/src/lib-std.h @@ -56,7 +56,7 @@ #include <arpa/inet.h> #endif -#include "system.h" +#include "dclib-system.h" #include "dclib-basics.h" #include "dclib-file.h" #include "dclib-debug.h" @@ -1939,49 +1939,6 @@ valid_t IsValidCTCODE // /////////////////////////////////////////////////////////////////////////////// -/////////////// PrintScript /////////////// -/////////////////////////////////////////////////////////////////////////////// -// [[PrintScript_t]] - -typedef struct PrintScript_t -{ - File_t *fo; // pointer output file - bool add_index; // true: add index to varname - uint index; // index for array operations - char sep[2]; // separator for JSON - char prefix[100]; // varname prefix -} -PrintScript_t; - -static inline void InitializePrintScript ( PrintScript_t *ps ) - { DASSERT(ps); memset(ps,0,sizeof(*ps)); } - -static inline void ResetPrintScript ( PrintScript_t *ps ) - { DASSERT(ps); memset(ps,0,sizeof(*ps)); } - -/////////////////////////////////////////////////////////////////////////////// - -void PrintScriptHeader ( PrintScript_t *ps ); -void PrintScriptFooter ( PrintScript_t *ps ); - -int PutScriptVars -( - PrintScript_t *ps, // valid control struct - uint mode, // bit field: 1=open var, 2:close var - ccp text // text with line of format NAME=VALUE -); - -int PrintScriptVars -( - PrintScript_t *ps, // valid control struct - uint mode, // bit field: 1=open var, 2:close var - ccp format, // format of message - ... // arguments -) -__attribute__ ((__format__(__printf__,3,4))); - -// -/////////////////////////////////////////////////////////////////////////////// /////////////// misc /////////////// /////////////////////////////////////////////////////////////////////////////// // [[IsArena_t]] diff --git a/project/src/lib-szs-create.c b/project/src/lib-szs-create.c index ccf4f1d..007d2cb 100644 --- a/project/src/lib-szs-create.c +++ b/project/src/lib-szs-create.c @@ -1519,7 +1519,7 @@ bool NormalizeExSZS memset(&norm,0,sizeof(norm)); norm.rm_aiparam = rm_aiparam; norm.clean_lex = clean_lex; - IterateFilesSZS(szs,norm_collect_func,&norm,false,0,-1,SORT_NONE); + IterateFilesParSZS(szs,norm_collect_func,&norm,false,false,0,-1,SORT_NONE); if (autoadd) AddMissingFiles(szs,0,0,&norm,2); @@ -2643,7 +2643,7 @@ bool PatchSZS ( szs_file_t * szs ) { PRINT("** PatchSZS() **\n"); ScanTformBegin(); - IterateFilesSZS(szs,transform_collect_func,&dirty,false,-1,-1,SORT_NONE); + IterateFilesParSZS(szs,transform_collect_func,&dirty,false,false,-1,-1,SORT_NONE); TformScriptEnd(); ClearSpecialFilesSZS(szs); } @@ -2965,7 +2965,7 @@ static int check_file_func // [[fname+]] InitializeSubSZS(&subszs,it->szs,it->off,it->size,fform,it->path,false); subszs.fname = it->path; - IterateFilesSZS(&subszs,check_mdl_func,chk,true,0,1,SORT_NONE); + IterateFilesParSZS(&subszs,check_mdl_func,chk,false,true,0,1,SORT_NONE); subszs.fname = 0; ResetSZS(&subszs); } @@ -3117,7 +3117,7 @@ int CheckSZS //--- check BRRES + BRSUB - IterateFilesSZS(szs,check_brres_func,&chk,false,-1,0,SORT_AUTO); + IterateFilesParSZS(szs,check_brres_func,&chk,false,false,-1,0,SORT_AUTO); //--- find KCL @@ -3377,7 +3377,7 @@ int CheckSZS //--- check images - IterateFilesSZS(szs,check_file_func,&chk,false,-1,0,SORT_AUTO); + IterateFilesParSZS(szs,check_file_func,&chk,false,false,-1,0,SORT_AUTO); if (chk.img_count) print_check_error( &chk, CMOD_INFO, "Geometry of %u images checked.\n",chk.img_count); @@ -3666,7 +3666,7 @@ int CheckBRRES SetupColorSet(&chk.col,stdlog); chk.szs = szs; chk.mode = check_mode; - IterateFilesSZS(szs,check_brres,&chk,false,0,-1,SORT_NONE); + IterateFilesParSZS(szs,check_brres,&chk,false,false,0,-1,SORT_NONE); if (parent_chk) { @@ -4621,7 +4621,7 @@ enumError ExtractFilesSZS ? 1 : recurse_level || IsArchiveFF(szs->fform_arch) ? -1 : 0; PRINT("cut_files=%d\n",cut_files); - IterateFilesSZS(szs,extract_func,&ep,false,0,cut_files,SORT_NONE); + IterateFilesParSZS(szs,extract_func,&ep,true,false,0,cut_files,SORT_NONE); //----- write setup file diff --git a/project/src/lib-szs.c b/project/src/lib-szs.c index e002da5..bea7884 100644 --- a/project/src/lib-szs.c +++ b/project/src/lib-szs.c @@ -1845,13 +1845,13 @@ static void iterate_wu8 wu8_info_t *wu8 // valud wu8 ) { - IterateFilesSZS(szs,code_wu8_pass_1,wu8,false,0,-1,SORT_NONE); + IterateFilesParSZS(szs,code_wu8_pass_1,wu8,false,false,0,-1,SORT_NONE); PRINT("PASS1-COUNT = %d, ERR-COUNT = %d\n",wu8->pass1_count,wu8->err_count); if (!wu8->err_count) { if (!wu8->pass1_count) load_wu8(wu8,"itembox.brres",0); - IterateFilesSZS(szs,code_wu8_pass_2,wu8,false,0,-1,SORT_NONE); + IterateFilesParSZS(szs,code_wu8_pass_2,wu8,false,false,0,-1,SORT_NONE); } } @@ -2406,7 +2406,7 @@ enumError CreateU8 if ( logging > 0 ) { printf("----- internal file list -----\n"); - IterateFilesSZS(szs,PrintFileSZS,0,true,0,0,SORT_NONE); + IterateFilesParSZS(szs,PrintFileSZS,0,false,true,0,0,SORT_NONE); printf("------------------------------\n"); } @@ -2641,7 +2641,7 @@ enumError ExtractSZS eszs->szs_found = true; eszs->subpath = subpath + 1; eszs->subpath_len = strlen(eszs->subpath); - IterateFilesSZS(&szs,extract_data_func,eszs,false,0,-1,SORT_NONE); + IterateFilesParSZS(&szs,extract_data_func,eszs,false,false,0,-1,SORT_NONE); PRINT("### FOUND: lev=%d n=%d off=%x siz=%x %s\n", eszs->exlevel, eszs->found_count, @@ -2916,7 +2916,11 @@ int IterateFilesU8 //----- cut files? + #if USE_ITERATOR_PARAM + if (it->itpar.cut_files) + #else if (it->cut_files) + #endif { it->index = 0; it->fst_item = 0; @@ -2955,7 +2959,11 @@ int IterateFilesU8 int stat = 0; const u8_node_t *fst; + #if USE_ITERATOR_PARAM + for ( fst = fst_base + !it->itpar.show_root_node; fst < fst_end && !stat; fst++ ) + #else for ( fst = fst_base + !it->show_root_node; fst < fst_end && !stat; fst++ ) + #endif { while ( fst >= dir_end && stack > stack_buf ) { @@ -2968,9 +2976,27 @@ int IterateFilesU8 ccp fname = (ccp)fst_end + (ntohl(fst->name_off)&0xffffff); it->name = fname; - char * path_dest = it->trail_path = path_ptr; + char *path_dest = it->trail_path = path_ptr; + #if USE_ITERATOR_PARAM + while ( path_dest < path_end && *fname ) + { + const char ch = *fname++; + if ( ch != '\\' && ch != '/' || !it->itpar.clean_path ) + *path_dest++ = ch; + } + if ( it->itpar.clean_path && path_dest == path_ptr+2 + && path_ptr[0] == '.' && path_ptr[1] == '.' ) + path_dest--; + #else while ( path_dest < path_end && *fname ) - *path_dest++ = *fname++; + { + const char ch = *fname++; + if ( ch != '\\' && ch != '/' || !it->clean_path ) + *path_dest++ = ch; + } + if ( it->clean_path && path_dest == path_ptr+2 && path_ptr[0] == '.' && path_ptr[1] == '.' ) + path_dest--; + #endif it->index = fst - fst_base; it->fst_item = (u8_node_t*)fst; @@ -3137,7 +3163,11 @@ static int iterate_sort_files return 0; } + #if USE_ITERATOR_PARAM + SortSubFilesSZS(it->szs,it->itpar.sort_mode); + #else SortSubFilesSZS(it->szs,it->sort_mode); + #endif const szs_subfile_t * ptr = it->szs->subfile.list; const szs_subfile_t * end = ptr + it->szs->subfile.used; @@ -3212,9 +3242,17 @@ static int iterate_sub_files szs_iterator_func it_func = 0; if ( it->recurse_level < it->recurse_max ) { + #if USE_ITERATOR_PARAM + it_func = GetIteratorFunction(fform,it->itpar.cut_files); + #else it_func = GetIteratorFunction(fform,it->cut_files); + #endif } + #if USE_ITERATOR_PARAM + else if ( it->itpar.cut_files ) + #else else if ( it->cut_files ) + #endif { it_func = GetIteratorFunction(fform,true); if (GetIteratorFunction(fform,false)) @@ -3262,6 +3300,71 @@ int IterateFilesSZS szs_file_t * szs, // valid szs szs_iterator_func func, // call back function void * param, // user defined parameter + const iterator_param_t + *p_itpar, // NULL or iteration parameters + int recurse // 0:off, <0:unlimited, >0:max depth +) +{ + DASSERT(szs); + DASSERT(func); + + iterator_param_t itpar; + if (p_itpar) + memcpy(&itpar,p_itpar,sizeof(itpar)); + else + memset(&itpar,0,sizeof(itpar)); + + PRINT("IterateFilesParSZS(ipar=%d,clean=%d,rec=%d,cut=%d,sort=%d) ff=%s\n", + p_itpar!=0, itpar.clean_path, recurse, itpar.cut_files, itpar.sort_mode, + GetNameFF(szs->fform_file,szs->fform_arch)); + + szs_iterator_func ifunc + = GetIteratorFunction( szs->fform_arch, itpar.cut_files>=0 ); + if (!ifunc) + return -1; + + if ( itpar.sort_mode == SORT_NONE && IsBRSUB(szs->fform_arch) ) + itpar.sort_mode = SORT_OFFSET; + const bool sort_files = itpar.sort_mode != SORT_NONE; + if ( sort_files && szs->subfile.used ) + ResetFileSZS(szs,false); + + szs_iterator_t it = {0}; + it.szs = szs; + #if USE_ITERATOR_PARAM + it.itpar = itpar; + #else + it.cut_files = itpar->cut_files > 0; + it.sort_mode = itpar->sort_mode; + it.clean_path = itpar->clean_path; + it.show_root_node = itpar->show_root_node; + #endif + + it.func_sub = func; + it.func_sort = recurse || itpar.cut_files ? iterate_sub_files : func; + it.func_it = sort_files ? iterate_sort_files : it.func_sort; + it.param = param; + it.endian = &be_func; + it.recurse_max = recurse >= 0 ? recurse : INT_MAX; + it.group = GROUP_INVALID; + it.entry = ENTRY_INVALID; + + const int stat = ifunc(&it,false); + it.name = 0; + *it.path = 0; + const int stat_term = it.func_it(&it,true); + return stat ? stat : stat_term; +} + +/////////////////////////////////////////////////////////////////////////////// +// [[IterateFilesParSZS]] + +int IterateFilesParSZS +( + szs_file_t * szs, // valid szs + szs_iterator_func func, // call back function + void * param, // user defined parameter + bool clean_path, // true: clean path from ../ and more bool show_root_node, // true: include root node in iteration int recurse, // 0:off, <0:unlimited, >0:max depth int cut_files, // <0:never, =0:auto(first level), >0:always @@ -3271,10 +3374,19 @@ int IterateFilesSZS DASSERT(szs); DASSERT(func); - PRINT("IterateFilesSZS(rec=%d,cut=%d,sort=%d) ff=%s\n", - recurse, cut_files, sort_mode, + #if USE_ITERATOR_PARAM + iterator_param_t itpar = {0}; + itpar.cut_files = cut_files > 0; + itpar.sort_mode = sort_mode; + itpar.clean_path = clean_path; + itpar.show_root_node = show_root_node; + return IterateFilesSZS(szs,func,param,&itpar,recurse); + #else + PRINT("IterateFilesParSZS(clean=%d,rec=%d,cut=%d,sort=%d) ff=%s\n", + clean_path,recurse, cut_files, sort_mode, GetNameFF(szs->fform_file,szs->fform_arch)); + szs_iterator_func ifunc = GetIteratorFunction(szs->fform_arch,cut_files>=0); if (!ifunc) return -1; @@ -3285,8 +3397,7 @@ int IterateFilesSZS if ( sort_files && szs->subfile.used ) ResetFileSZS(szs,false); - szs_iterator_t it; - memset(&it,0,sizeof(it)); + szs_iterator_t it = {0}; it.szs = szs; it.cut_files = cut_files > 0; it.sort_mode = sort_mode; @@ -3295,6 +3406,7 @@ int IterateFilesSZS it.func_it = sort_files ? iterate_sort_files : it.func_sort; it.param = param; it.endian = &be_func; + it.clean_path = clean_path; it.show_root_node = show_root_node; it.recurse_max = recurse >= 0 ? recurse : INT_MAX; it.group = GROUP_INVALID; @@ -3305,6 +3417,7 @@ int IterateFilesSZS *it.path = 0; const int stat_term = it.func_it(&it,true); return stat ? stat : stat_term; + #endif } /////////////////////////////////////////////////////////////////////////////// @@ -3431,10 +3544,10 @@ uint CollectFilesSZS cr.szs = szs; cr.path_end = cr.path; cr.last_path = EmptyString; - IterateFilesSZS(szs,collect_r_func,&cr,false,recurse,cut_files,SORT_NONE); + IterateFilesParSZS(szs,collect_r_func,&cr,false,false,recurse,cut_files,SORT_NONE); } else - IterateFilesSZS(szs,collect_func,0,false,0,-1,SORT_NONE); + IterateFilesParSZS(szs,collect_func,0,false,false,0,-1,SORT_NONE); SortSubFilesSZS(szs,sort_mode); noPRINT("%d/%d files collected.\n", szs->subfile.used - base, szs->subfile.used ); @@ -3460,7 +3573,7 @@ int IterateFilesData szs_file_t szs; AssignSZS(&szs,true,(u8*)data,data_size,false,fform,fname); const int stat - = IterateFilesSZS ( &szs, func, param, true, -1, 1, SORT_OFFSET ); + = IterateFilesParSZS ( &szs, func, param, false, true, -1, 1, SORT_OFFSET ); ResetSZS(&szs); return stat; } @@ -3567,7 +3680,11 @@ int CutFilesBRSUB (brsub_header_t*)data,n_grp,it->endian); u32 name_off = bcut.endian->rd32(data+brsub_header_size-4); ccp name_str = GETSTR(name_off,0); + #if USE_ITERATOR_PARAM + if (it->itpar.cut_files) + #else if (it->cut_files) + #endif { it->name = name_str; stat = func(&bcut,GROUP_IDX_BRSUB_HEADER,ENTRY_IDX_ETC); @@ -3615,7 +3732,11 @@ int CutFilesBRSUB if ( x_size > bg_size ) goto plain; + #if USE_ITERATOR_PARAM + if (it->itpar.cut_files) + #else if (it->cut_files) + #endif { bcut.path_end = it->path + snprintf(it->path,sizeof(it->path),".%s.s%0*u%s.header.n%u.bin", @@ -3629,8 +3750,17 @@ int CutFilesBRSUB bcut.eptr = bcut.gptr->entry + 1; int cur_entry; + const u8* max_eptr = bcut.data + bcut.size - sizeof(*bcut.eptr); for ( cur_entry = 0; cur_entry < bg_n_entry; cur_entry++, bcut.eptr++ ) { + if ( (u8*)bcut.eptr > max_eptr ) + { + ERROR0(ERR_WARNING, + "Invalid offset for BRSUB file => %u of %u entries ignored: %s%s%s\n", + bg_n_entry - cur_entry, bg_n_entry, + it->szs->fname, *it->szs->fname ? "/" : "", it->path ); + break; + } u32 data_off = bcut.endian->rd32(&bcut.eptr->data_off); u32 name_off = bcut.endian->rd32(&bcut.eptr->name_off); ccp name_ptr = GETSTR(name_off+((u8*)bcut.gptr-data),""); @@ -3698,7 +3828,11 @@ int CutFilesBRSUB } } + #if USE_ITERATOR_PARAM + if ( it->itpar.cut_files && bcut.brsub_size < bcut.size ) + #else if ( it->cut_files && bcut.brsub_size < bcut.size ) + #endif { it->off = bcut.brsub_size; it->size = bcut.size - bcut.brsub_size; diff --git a/project/src/lib-szs.h b/project/src/lib-szs.h index eff7eed..aac60b8 100644 --- a/project/src/lib-szs.h +++ b/project/src/lib-szs.h @@ -773,6 +773,20 @@ typedef int (*szs_iterator_func) ); //----------------------------------------------------------------------------- +// [[iterator_param_t]] + +typedef struct iterator_param_t +{ + bool clean_path; // true: clean path + bool show_root_node; // true: show root node + bool cut_files; // true: cut files into peaces + SortMode_t sort_mode; // sort files +} +iterator_param_t; + +#define USE_ITERATOR_PARAM 1 + +//----------------------------------------------------------------------------- // [[szs_iterator_t]] typedef struct szs_iterator_t @@ -781,9 +795,14 @@ typedef struct szs_iterator_t szs_file_t * szs; // valid szs pointer const endian_func_t * endian; // endian functions + #if USE_ITERATOR_PARAM + iterator_param_t itpar; // global parameters + #else + bool clean_path; // true: clean path bool show_root_node; // true: show root node bool cut_files; // true: cut files into peaces SortMode_t sort_mode; // sort files + #endif //--- client values @@ -830,8 +849,8 @@ typedef struct szs_iterator_t int brsub_version; // 0 or version of parent brsub file s16 group; // group index, type grp_entry_t s16 entry; // entry index, type grp_entry_t - -} szs_iterator_t; +} +szs_iterator_t; //----------------------------------------------------------------------------- @@ -852,6 +871,17 @@ int IterateFilesSZS szs_file_t * szs, // valid szs szs_iterator_func func, // call back function void * param, // user defined parameter + const iterator_param_t + *p_itpar, // NULL or iteration parameters + int recurse // 0:off, <0:unlimited, >0:max depth +); + +int IterateFilesParSZS +( + szs_file_t * szs, // valid szs + szs_iterator_func func, // call back function + void * param, // user defined parameter + bool clean_path, // true: clean path from ../ and more bool show_root_node, // true: include root node in iteration int recurse, // 0:off, <0:unlimited, >0:max depth int cut_files, // <0:never, =0:auto(first level), >0:always diff --git a/project/src/lib-xbmg.c b/project/src/lib-xbmg.c index 2648091..8eb09ce 100644 --- a/project/src/lib-xbmg.c +++ b/project/src/lib-xbmg.c @@ -323,7 +323,7 @@ enumError LoadXBMG if ( allow_archive && IsArchiveFF(szs.fform_arch) ) { bmg->src_is_arch = true; - IterateFilesSZS(&szs,read_bmg,bmg,false,0,-1,SORT_NONE); + IterateFilesParSZS(&szs,read_bmg,bmg,false,false,0,-1,SORT_NONE); bmg->fname = szs.fname; szs.fname = 0; ResetSZS(&szs); @@ -380,7 +380,7 @@ enumError ScanRawDataBMG AssignSZS(&szs,true,raw->data,raw->data_size,false,raw->fform,bmg->fname); szs.fname = raw->fname; raw->fname = 0; - IterateFilesSZS(&szs,read_bmg,bmg,false,0,-1,SORT_NONE); + IterateFilesParSZS(&szs,read_bmg,bmg,false,false,0,-1,SORT_NONE); bmg->fname = szs.fname; szs.fname = 0; noPRINT("BMG/FNAME=%s\n",bmg->fname); @@ -1402,6 +1402,22 @@ enumError cmd_bmg_identifier() /////////////// scan options /////////////// /////////////////////////////////////////////////////////////////////////////// +int ScanOptBmgEndian ( ccp arg ) +{ + const KeywordTab_t *cmd = ScanKeyword(0,arg,TabEndianBMG); + if (!cmd) + { + ERROR0(ERR_SYNTAX, + "Option --bmg-endian: Invalid mode: '%s'\n",arg); + return 1; + } + + opt_bmg_endian = cmd->id; + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// + int ScanOptBmgEncoding ( ccp arg ) { const KeywordTab_t *cmd = ScanKeyword(0,arg,TabEncodingBMG); diff --git a/project/src/lib-xbmg.h b/project/src/lib-xbmg.h index 6c16316..cdc40fa 100644 --- a/project/src/lib-xbmg.h +++ b/project/src/lib-xbmg.h @@ -122,6 +122,7 @@ enumError DiffBMG //----------------------------------------------------------------------------- +int ScanOptBmgEndian ( ccp arg ); int ScanOptBmgEncoding ( ccp arg ); int ScanOptBmgInfSize ( ccp arg, bool is_wbmgt ); int ScanOptBmgMid ( ccp arg ); diff --git a/project/src/system.h b/project/src/system.h deleted file mode 100644 index 375c75d..0000000 --- a/project/src/system.h +++ /dev/null @@ -1,88 +0,0 @@ - -/*************************************************************************** - * _______ _______ _______ * - * | ___ |____ | ___ | * - * | | |_| / /| | |_| * - * | |_____ / / | |_____ * - * |_____ | / / |_____ | * - * _ | | / / _ | | * - * | |___| |/ /____| |___| | * - * |_______|_______|_______| * - * * - * Wiimms SZS Tools * - * https://szs.wiimm.de/ * - * * - *************************************************************************** - * * - * This file is part of the SZS project. * - * Visit https://szs.wiimm.de/ for project details and sources. * - * * - * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * - * * - *************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * See file gpl-2.0.txt or http://www.gnu.org/licenses/gpl-2.0.txt * - * * - ***************************************************************************/ - -#ifndef SZS_SYSTEM_H -#define SZS_SYSTEM_H 1 - -/////////////////////////////////////////////////////////////////////////////// - -typedef enum enumSystemID -{ - SYSID_UNKNOWN = 0x00000000, - SYSID_I386 = 0x01000000, - SYSID_X86_64 = 0x02000000, - SYSID_CYGWIN = 0x03000000, - SYSID_APPLE = 0x04000000, - SYSID_LINUX = 0x05000000, - SYSID_UNIX = 0x06000000, - -} enumSystemID; - -/////////////////////////////////////////////////////////////////////////////// - -#undef SYSTEM_LINUX - -#ifdef __CYGWIN__ - #define SYSTEM "cygwin" - #define SYSTEMID SYSID_CYGWIN -#elif __APPLE__ - #define SYSTEM "mac" - #define SYSTEMID SYSID_APPLE -#elif __linux__ - #define SYSTEM_LINUX 1 - #ifdef __i386__ - #define SYSTEM "i386" - #define SYSTEMID SYSID_I386 - #elif __x86_64__ - #define SYSTEM "x86_64" - #define SYSTEMID SYSID_X86_64 - #else - #define SYSTEM "linux" - #define SYSTEMID SYSID_LINUX - #endif -#elif __unix__ - #define SYSTEM "unix" - #define SYSTEMID SYSID_UNIX -#else - #define SYSTEM "unknown" - #define SYSTEMID SYSID_UNKNOWN -#endif - -/////////////////////////////////////////////////////////////////////////////// - -#endif // SZS_SYSTEM_H 1 - diff --git a/project/src/ui/tab-wbmgt.inc b/project/src/ui/tab-wbmgt.inc index 86eb2ba..f16a615 100644 --- a/project/src/ui/tab-wbmgt.inc +++ b/project/src/ui/tab-wbmgt.inc @@ -337,6 +337,9 @@ { T_OPT_CMP, "FILTER_BMG", "filter-bmg|filterbmg|fb|msg", 0, 0 /* copy of wszst */ }, + { T_OPT_CP, "BMG_ENDIAN", "endian|bmg-endian|bmgendian", + 0, 0 /* copy of wszst */ }, + { T_OPT_CP, "BMG_ENCODING", "encoding|bmg-encoding|bmgencoding", 0, 0 /* copy of wszst */ }, @@ -406,6 +409,8 @@ { T_COPT, "NO_HEADER", 0,0,0 }, { T_COPT, "BRIEF", 0,0,0 }, + { T_SEP_OPT, 0,0,0,0 }, + { T_COPT, "BMG_ENDIAN", 0,0,0 }, { T_COPT, "BMG_ENCODING", 0,0,0 }, { T_COPT, "BMG_INF_SIZE", 0,0,0 }, { T_COPT, "BMG_MID", 0,0,0 }, @@ -578,6 +583,8 @@ { T_CMD_BEG, "ENCODE", 0,0,0 }, { T_COPY_GRP, "DEST", 0,0,0 }, + { T_SEP_OPT, 0,0,0,0 }, + { T_COPT, "BMG_ENDIAN", 0,0,0 }, { T_COPT, "BMG_ENCODING", 0,0,0 }, { T_COPT, "BMG_INF_SIZE", 0,0,0 }, { T_COPT, "BMG_MID", 0,0,0 }, diff --git a/project/src/ui/tab-wctct.inc b/project/src/ui/tab-wctct.inc index 1a4c166..af35de7 100644 --- a/project/src/ui/tab-wctct.inc +++ b/project/src/ui/tab-wctct.inc @@ -248,6 +248,9 @@ 0, "Print BMG messages as UTF-8 text without escape sequences." }, + { T_OPT_CP, "BMG_ENDIAN", "bmg-endian|bmgendian", + 0, 0 /* copy of wszst */ }, + { T_OPT_CP, "BMG_ENCODING", "bmg-encoding|bmgencoding", 0, 0 /* copy of wszst */ }, @@ -669,6 +672,7 @@ " If set, cup names are exported too as MID 4200-423F." " If set twice, cup/track relations are also exported as MID 4300-43FF."}, { T_COPY_GRP, "TEXTOUT", 0,0,0 }, + { T_COPT, "BMG_ENDIAN", 0,0,0 }, { T_COPT, "BMG_ENCODING", 0,0,0 }, { T_COPT, "BMG_INF_SIZE", 0,0,0 }, { T_COPT, "BMG_MID", 0,0,0 }, @@ -733,6 +737,7 @@ { T_COPY_GRP, "DEST", 0,0,0 }, { T_COPT, "IGNORE", 0,0,0 }, { T_COPY_GRP, "TEXTOPT", 0,0,0 }, + { T_COPT, "BMG_ENDIAN", 0,0,0 }, { T_COPT, "BMG_ENCODING", 0,0,0 }, { T_COPT, "BMG_INF_SIZE", 0,0,0 }, { T_COPT, "BMG_MID", 0,0,0 }, diff --git a/project/src/ui/tab-wlect.inc b/project/src/ui/tab-wlect.inc index 1eec891..e4b4772 100644 --- a/project/src/ui/tab-wlect.inc +++ b/project/src/ui/tab-wlect.inc @@ -260,6 +260,9 @@ 0, "Print BMG messages as UTF-8 text without escape sequences." }, + { T_OPT_CP, "BMG_ENDIAN", "bmg-endian|bmgendian", + 0, 0 /* copy of wszst */ }, + { T_OPT_CP, "BMG_ENCODING", "bmg-encoding|bmgencoding", 0, 0 /* copy of wszst */ }, @@ -436,8 +439,9 @@ "[=mode]", "Enable or disable the performance monitor." " Mode is one of @OFF@, @AUTO@ (default, don't change setting)," - " @ON@ (enable it for Wii only; default, if option is used without parameter)" - " or @FORCE@ (enable it for Wii and for Dolphin)." }, + " @ON@ (enable it for Wii and Wii U only;" + " default, if option is used without parameter)" + " or @FORCE@ (enable it for Wii, Wii U and for Dolphin)." }, { T_OPT_CO, "CUSTOM_TT", "custom-tt|customtt", "[=mode]", @@ -452,6 +456,29 @@ " (default, if option is used without parameter)." " Disable it only for tests!" }, + { T_OPT_CO, "SPEEDOMETER", "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)." }, + + { 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." }, + + { H_OPT_CP, "RESERVED_1BB", "reserved-1bb|reserved1bb", + "[=mode]", + "Set LPAR byte at offset 0x1bb to this value." + " Value -1 disables this option." }, + { T_SEP_OPT, 0,0,0,0 }, //----- separator ----- { T_OPT_CP, "TRACK_DIR", "track-dir|trackdir", @@ -582,18 +609,28 @@ { T_COPT, "UPDATE", 0,0,0 }, { T_COPT, "PRESERVE", 0,0,0 }, - //---------- wlect GROUP PATCH ---------- + //---------- wlect GROUP PARAM ---------- - { T_GRP_BEG, "PATCH", 0,0,0 }, + { T_GRP_BEG, "PARAM", 0,0,0 }, - { T_COPT, "LE_DEFINE", 0,0,0 }, - { T_COPT, "LPAR", 0,0,0 }, - { T_COPT, "ALIAS", 0,0,0 }, { T_COPT, "ENGINE", 0,0,0 }, { T_COPT, "200CC", 0,0,0 }, { T_COPT, "PERFMON", 0,0,0 }, { 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 }, + + //---------- wlect GROUP PATCH ---------- + + { T_GRP_BEG, "PATCH", 0,0,0 }, + + { T_COPT, "LE_DEFINE", 0,0,0 }, + { T_COPT, "LPAR", 0,0,0 }, + { T_COPT, "ALIAS", 0,0,0 }, + { T_COPY_GRP, "PARAM", 0,0,0 }, //---------- wlect GROUP PATCH_LEX ---------- @@ -797,6 +834,7 @@ { T_COPT, "NO_ECHO", 0,0,0 }, { T_COPY_GRP, "DEST", 0,0,0 }, { T_COPT, "LPAR", 0,0,0 }, + { T_SEP_OPT, 0,0,0,0 }, { T_COPT, "LT_CLEAR", 0,0,0 }, { T_COPT, "LT_ONLINE", 0,0,0 }, { T_COPT, "LT_N_PLAYERS", 0,0,0 }, @@ -805,6 +843,8 @@ { T_COPT, "LT_ENGINE", 0,0,0 }, { T_COPT, "LT_RANDOM", 0,0,0 }, { T_COPT, "LEX_PURGE", 0,0,0 }, + { T_SEP_OPT, 0,0,0,0 }, + { T_COPY_GRP, "PARAM", 0,0,0 }, //---------- COMMAND wlect CAT ---------- diff --git a/project/src/ui/tab-wszst.inc b/project/src/ui/tab-wszst.inc index e8f85a2..e84695d 100644 --- a/project/src/ui/tab-wszst.inc +++ b/project/src/ui/tab-wszst.inc @@ -1522,10 +1522,19 @@ " if their difference is less than or equal to epsilon." " The default value is @" CONVERT_TO_STRING(DEF_EPSILON_POS) "@." }, + { T_OPT_CP, "BMG_ENDIAN", "bmg-endian|bmgendian", + "name", + "Force an endian for new BMG files." + " Accepted values are @BIG@ or @BE@ for big endian, @LITTLE@ or @LE@" + " for little endian and @AUTO@ for automatic detection (default)." + "\n " + " Mario Kart Wii uses big endian;" + " the default if no other endian is defined." }, + { T_OPT_CP, "BMG_ENCODING", "bmg-encoding|bmgencoding", "name", - "Force a BMG encoding for new BMG files." - " Accepted encoding names are: @CP-1252@, @UTF-16BE@ (or @UTF-16@)," + "Force an encoding for new BMG files." + " Accepted encoding names are @CP-1252@, @UTF-16BE@ (or @UTF-16@)," " @SHIFT-JIS@, @UTF-8@ and @AUTO@ for automatic detection (default)." " Same keywords without minus signs are accepted too." "\n " @@ -2400,6 +2409,7 @@ { T_GRP_BEG, "BMG", 0,0,0 }, + { T_COPT, "BMG_ENDIAN", 0,0,0 }, { T_COPT, "BMG_ENCODING", 0,0,0 }, { T_COPT, "BMG_INF_SIZE", 0,0,0 }, { T_COPT, "BMG_MID", 0,0,0 }, diff --git a/project/src/ui/ui-wbmgt.c b/project/src/ui/ui-wbmgt.c index b3836f2..1a6c522 100644 --- a/project/src/ui/ui-wbmgt.c +++ b/project/src/ui/ui-wbmgt.c @@ -186,9 +186,18 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " Read https://szs.wiimm.de/opt/filter-bmg for more details." }, + { OPT_BMG_ENDIAN, false, false, false, false, false, 0, "endian", + "name", + "Force an endian for new BMG files. Accepted values are BIG or BE for" + " big endian, LITTLE or LE for little endian and AUTO for automatic" + " detection (default).\n" + " Mario Kart Wii uses big endian; the default if no other endian is" + " defined." + }, + { OPT_BMG_ENCODING, false, false, false, false, false, 0, "encoding", "name", - "Force a BMG encoding for new BMG files. Accepted encoding names are:" + "Force an encoding for new BMG files. Accepted encoding names are" " CP-1252, UTF-16BE (or UTF-16), SHIFT-JIS, UTF-8 and AUTO for" " automatic detection (default). Same keywords without minus signs are" " accepted too.\n" @@ -284,7 +293,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 == 31 + {0,0,0,0,0,0,0,0,0,0}, // OPT__N_SPECIFIC == 32 //----- global options ----- @@ -506,7 +515,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 == 60 + {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 61 }; @@ -694,6 +703,9 @@ static const struct option OptionLong[] = { "filterbmg", 1, 0, GO_FILTER_BMG }, { "fb", 1, 0, GO_FILTER_BMG }, { "msg", 1, 0, GO_FILTER_BMG }, + { "endian", 1, 0, GO_BMG_ENDIAN }, + { "bmg-endian", 1, 0, GO_BMG_ENDIAN }, + { "bmgendian", 1, 0, GO_BMG_ENDIAN }, { "encoding", 1, 0, GO_BMG_ENCODING }, { "bmg-encoding", 1, 0, GO_BMG_ENCODING }, { "bmgencoding", 1, 0, GO_BMG_ENCODING }, @@ -801,19 +813,20 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x094 */ OPT_ALIGN, /* 0x095 */ OPT_MACRO_BMG, /* 0x096 */ OPT_FILTER_BMG, - /* 0x097 */ OPT_BMG_ENCODING, - /* 0x098 */ OPT_BMG_INF_SIZE, - /* 0x099 */ OPT_BMG_MID, - /* 0x09a */ OPT_FORCE_ATTRIB, - /* 0x09b */ OPT_DEF_ATTRIB, - /* 0x09c */ OPT_NO_ATTRIB, - /* 0x09d */ OPT_X_ESCAPES, - /* 0x09e */ OPT_OLD_ESCAPES, - /* 0x09f */ OPT_NO_BMG_COLORS, - /* 0x0a0 */ OPT_BMG_COLORS, - /* 0x0a1 */ OPT_NO_BMG_INLINE, - /* 0x0a2 */ OPT_SECTIONS, - /* 0x0a3 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0, + /* 0x097 */ OPT_BMG_ENDIAN, + /* 0x098 */ OPT_BMG_ENCODING, + /* 0x099 */ OPT_BMG_INF_SIZE, + /* 0x09a */ OPT_BMG_MID, + /* 0x09b */ OPT_FORCE_ATTRIB, + /* 0x09c */ OPT_DEF_ATTRIB, + /* 0x09d */ OPT_NO_ATTRIB, + /* 0x09e */ OPT_X_ESCAPES, + /* 0x09f */ OPT_OLD_ESCAPES, + /* 0x0a0 */ OPT_NO_BMG_COLORS, + /* 0x0a1 */ OPT_BMG_COLORS, + /* 0x0a2 */ OPT_NO_BMG_INLINE, + /* 0x0a3 */ OPT_SECTIONS, + /* 0x0a4 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 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, @@ -829,130 +842,130 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /////////////// opt_allowed_cmd_* /////////////// /////////////////////////////////////////////////////////////////////////////// -static u8 option_allowed_cmd_VERSION[31] = // cmd #1 +static u8 option_allowed_cmd_VERSION[32] = // cmd #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,0, 0,0,0,0,0, - 1 + 0,1 }; -static u8 option_allowed_cmd_HELP[31] = // cmd #2 +static u8 option_allowed_cmd_HELP[32] = // 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 }; -static u8 option_allowed_cmd_ARGTEST[31] = // cmd #3 +static u8 option_allowed_cmd_ARGTEST[32] = // cmd #3 { 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, - 1 + 1,1 }; -static u8 option_allowed_cmd_TEST[31] = // cmd #4 +static u8 option_allowed_cmd_TEST[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,1 }; -static u8 option_allowed_cmd_COLORS[31] = // cmd #5 +static u8 option_allowed_cmd_COLORS[32] = // cmd #5 { 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 }; -static u8 option_allowed_cmd_ERROR[31] = // cmd #6 +static u8 option_allowed_cmd_ERROR[32] = // cmd #6 { 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,1 }; -static u8 option_allowed_cmd_FILETYPE[31] = // cmd #7 +static u8 option_allowed_cmd_FILETYPE[32] = // cmd #7 { 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,0 }; -static u8 option_allowed_cmd_FILEATTRIB[31] = // cmd #8 +static u8 option_allowed_cmd_FILEATTRIB[32] = // 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 }; -static u8 option_allowed_cmd_POINTS[31] = // cmd #9 +static u8 option_allowed_cmd_POINTS[32] = // cmd #9 { 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 }; -static u8 option_allowed_cmd_REGEXP[31] = // cmd #10 +static u8 option_allowed_cmd_REGEXP[32] = // 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 }; -static u8 option_allowed_cmd_EXTRACT[31] = // cmd #11 +static u8 option_allowed_cmd_EXTRACT[32] = // cmd #11 { 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 }; -static u8 option_allowed_cmd_SECTIONS[31] = // cmd #12 +static u8 option_allowed_cmd_SECTIONS[32] = // cmd #12 { 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_LIST[31] = // cmd #13 +static u8 option_allowed_cmd_LIST[32] = // cmd #13 { 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,0 }; -static u8 option_allowed_cmd_SLOTS[31] = // cmd #14 +static u8 option_allowed_cmd_SLOTS[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,0 }; -static u8 option_allowed_cmd_DIFF[31] = // cmd #15 +static u8 option_allowed_cmd_DIFF[32] = // cmd #15 { 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,0 }; -static u8 option_allowed_cmd_CAT[31] = // cmd #16 +static u8 option_allowed_cmd_CAT[32] = // cmd #16 { 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, - 0 + 1,0 }; -static u8 option_allowed_cmd_MIX[31] = // cmd #17 +static u8 option_allowed_cmd_MIX[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, - 0 + 1,0 }; -static u8 option_allowed_cmd_IDENTIFIER[31] = // cmd #18 +static u8 option_allowed_cmd_IDENTIFIER[32] = // cmd #18 { 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, - 0 + 1,0 }; -static u8 option_allowed_cmd_DECODE[31] = // cmd #19 +static u8 option_allowed_cmd_DECODE[32] = // cmd #19 { 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, - 0 + 1,0 }; -static u8 option_allowed_cmd_ENCODE[31] = // cmd #20 +static u8 option_allowed_cmd_ENCODE[32] = // cmd #20 { - 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,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,0,0,0, 0,0,0,0,0, + 0,0 }; -static u8 option_allowed_cmd_PATCH[31] = // cmd #21 +static u8 option_allowed_cmd_PATCH[32] = // cmd #21 { 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, - 0 + 1,0 }; @@ -1123,6 +1136,10 @@ static const InfoOption_t * option_tab_cmd_CAT[] = { OptionInfo + OPT_NO_HEADER, OptionInfo + OPT_BRIEF, + + OptionInfo + OPT_NONE, // separator + + OptionInfo + OPT_BMG_ENDIAN, OptionInfo + OPT_BMG_ENCODING, OptionInfo + OPT_BMG_INF_SIZE, OptionInfo + OPT_BMG_MID, @@ -1149,6 +1166,10 @@ static const InfoOption_t * option_tab_cmd_MIX[] = { OptionInfo + OPT_NO_HEADER, OptionInfo + OPT_BRIEF, + + OptionInfo + OPT_NONE, // separator + + OptionInfo + OPT_BMG_ENDIAN, OptionInfo + OPT_BMG_ENCODING, OptionInfo + OPT_BMG_INF_SIZE, OptionInfo + OPT_BMG_MID, @@ -1180,6 +1201,10 @@ static const InfoOption_t * option_tab_cmd_IDENTIFIER[] = OptionInfo + OPT_NO_HEADER, OptionInfo + OPT_BRIEF, + + OptionInfo + OPT_NONE, // separator + + OptionInfo + OPT_BMG_ENDIAN, OptionInfo + OPT_BMG_ENCODING, OptionInfo + OPT_BMG_INF_SIZE, OptionInfo + OPT_BMG_MID, @@ -1213,6 +1238,10 @@ static const InfoOption_t * option_tab_cmd_DECODE[] = OptionInfo + OPT_PRESERVE, OptionInfo + OPT_NO_HEADER, OptionInfo + OPT_BRIEF, + + OptionInfo + OPT_NONE, // separator + + OptionInfo + OPT_BMG_ENDIAN, OptionInfo + OPT_BMG_ENCODING, OptionInfo + OPT_BMG_INF_SIZE, OptionInfo + OPT_BMG_MID, @@ -1248,6 +1277,10 @@ static const InfoOption_t * option_tab_cmd_ENCODE[] = OptionInfo + OPT_REMOVE_DEST, OptionInfo + OPT_UPDATE, OptionInfo + OPT_PRESERVE, + + OptionInfo + OPT_NONE, // separator + + OptionInfo + OPT_BMG_ENDIAN, OptionInfo + OPT_BMG_ENCODING, OptionInfo + OPT_BMG_INF_SIZE, OptionInfo + OPT_BMG_MID, @@ -1276,6 +1309,10 @@ static const InfoOption_t * option_tab_cmd_PATCH[] = OptionInfo + OPT_PRESERVE, OptionInfo + OPT_NO_HEADER, OptionInfo + OPT_BRIEF, + + OptionInfo + OPT_NONE, // separator + + OptionInfo + OPT_BMG_ENDIAN, OptionInfo + OPT_BMG_ENCODING, OptionInfo + OPT_BMG_INF_SIZE, OptionInfo + OPT_BMG_MID, @@ -1574,7 +1611,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " single archive (SZS,...) are combined to 1 source. The output of all" " source files is concatenated.", 0, - 20, + 21, option_tab_cmd_CAT, option_allowed_cmd_CAT }, @@ -1592,7 +1629,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " combined and strings of later source files override prior defined" " strings.", 0, - 20, + 21, option_tab_cmd_MIX, option_allowed_cmd_MIX }, @@ -1608,7 +1645,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " respect to options --le-code and --ct-code. Print the result to" " standard output.", 0, - 18, + 19, option_tab_cmd_IDENTIFIER, option_allowed_cmd_IDENTIFIER }, @@ -1625,7 +1662,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " This command is similar to PATCH, but the result is always decoded." " The default destination is '%P/%N.txt'.", 0, - 28, + 29, option_tab_cmd_DECODE, option_allowed_cmd_DECODE }, @@ -1642,7 +1679,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " This command is similar to PATCH, but the result is always encoded." " The default destination is '%P/%N.bmg'.", 0, - 17, + 18, option_tab_cmd_ENCODE, option_allowed_cmd_ENCODE }, @@ -1660,7 +1697,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " Use 'wszst patch --patch-bmg ...' to patch BMG files within a SZS" " file.", 0, - 29, + 30, option_tab_cmd_PATCH, option_allowed_cmd_PATCH }, diff --git a/project/src/ui/ui-wbmgt.h b/project/src/ui/ui-wbmgt.h index 4dceb36..75625de 100644 --- a/project/src/ui/ui-wbmgt.h +++ b/project/src/ui/ui-wbmgt.h @@ -72,6 +72,7 @@ typedef enum enumOptions OPT_PATCH_BMG, OPT_MACRO_BMG, OPT_FILTER_BMG, + OPT_BMG_ENDIAN, OPT_BMG_ENCODING, OPT_BMG_INF_SIZE, OPT_BMG_MID, @@ -87,7 +88,7 @@ typedef enum enumOptions OPT_EXPORT, OPT_SECTIONS, - OPT__N_SPECIFIC, // == 31 + OPT__N_SPECIFIC, // == 32 //----- global options ----- @@ -121,7 +122,7 @@ typedef enum enumOptions OPT_NEW, OPT_EXTRACT, - OPT__N_TOTAL // == 60 + OPT__N_TOTAL // == 61 } enumOptions; @@ -152,6 +153,7 @@ typedef enum enumOptions // OB_PATCH_BMG = 1llu << OPT_PATCH_BMG, // OB_MACRO_BMG = 1llu << OPT_MACRO_BMG, // OB_FILTER_BMG = 1llu << OPT_FILTER_BMG, +// OB_BMG_ENDIAN = 1llu << OPT_BMG_ENDIAN, // OB_BMG_ENCODING = 1llu << OPT_BMG_ENCODING, // OB_BMG_INF_SIZE = 1llu << OPT_BMG_INF_SIZE, // OB_BMG_MID = 1llu << OPT_BMG_MID, @@ -180,6 +182,7 @@ typedef enum enumOptions // // OB_GRP_TEXTOUT = OB_NO_HEADER // | OB_BRIEF +// | OB_BMG_ENDIAN // | OB_BMG_ENCODING // | OB_BMG_INF_SIZE // | OB_BMG_MID @@ -261,6 +264,7 @@ typedef enum enumOptions // | OB_FILTER_BMG, // // OB_CMD_ENCODE = OB_GRP_DEST +// | OB_BMG_ENDIAN // | OB_BMG_ENCODING // | OB_BMG_INF_SIZE // | OB_BMG_MID @@ -378,6 +382,7 @@ typedef enum enumGetOpt GO_ALIGN, GO_MACRO_BMG, GO_FILTER_BMG, + GO_BMG_ENDIAN, GO_BMG_ENCODING, GO_BMG_INF_SIZE, GO_BMG_MID, diff --git a/project/src/ui/ui-wctct.c b/project/src/ui/ui-wctct.c index cd7f2d6..d106ed3 100644 --- a/project/src/ui/ui-wctct.c +++ b/project/src/ui/ui-wctct.c @@ -80,9 +80,18 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = "Print BMG messages as UTF-8 text without escape sequences." }, + { OPT_BMG_ENDIAN, false, false, false, false, false, 0, "bmg-endian", + "name", + "Force an endian for new BMG files. Accepted values are BIG or BE for" + " big endian, LITTLE or LE for little endian and AUTO for automatic" + " detection (default).\n" + " Mario Kart Wii uses big endian; the default if no other endian is" + " defined." + }, + { OPT_BMG_ENCODING, false, false, false, false, false, 0, "bmg-encoding", "name", - "Force a BMG encoding for new BMG files. Accepted encoding names are:" + "Force an encoding for new BMG files. Accepted encoding names are" " CP-1252, UTF-16BE (or UTF-16), SHIFT-JIS, UTF-8 and AUTO for" " automatic detection (default). Same keywords without minus signs are" " accepted too.\n" @@ -384,7 +393,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 == 46 + {0,0,0,0,0,0,0,0,0,0}, // OPT__N_SPECIFIC == 47 //----- global options ----- @@ -637,7 +646,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 == 79 + {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 80 }; @@ -845,6 +854,8 @@ static const struct option OptionLong[] = { "noheader", 0, 0, 'H' }, { "brief", 0, 0, 'B' }, { "raw", 0, 0, GO_RAW }, + { "bmg-endian", 1, 0, GO_BMG_ENDIAN }, + { "bmgendian", 1, 0, GO_BMG_ENDIAN }, { "bmg-encoding", 1, 0, GO_BMG_ENCODING }, { "bmgencoding", 1, 0, GO_BMG_ENCODING }, { "bmg-inf-size", 1, 0, GO_BMG_INF_SIZE }, @@ -1011,46 +1022,47 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x08b */ OPT_CHDIR, /* 0x08c */ OPT_ROUND, /* 0x08d */ OPT_RAW, - /* 0x08e */ OPT_BMG_ENCODING, - /* 0x08f */ OPT_BMG_INF_SIZE, - /* 0x090 */ OPT_BMG_MID, - /* 0x091 */ OPT_FORCE_ATTRIB, - /* 0x092 */ OPT_DEF_ATTRIB, - /* 0x093 */ OPT_NO_ATTRIB, - /* 0x094 */ OPT_X_ESCAPES, - /* 0x095 */ OPT_OLD_ESCAPES, - /* 0x096 */ OPT_NO_BMG_COLORS, - /* 0x097 */ OPT_BMG_COLORS, - /* 0x098 */ OPT_NO_BMG_INLINE, - /* 0x099 */ OPT_NO_ECHO, - /* 0x09a */ OPT_UTF_8, - /* 0x09b */ OPT_NO_UTF_8, - /* 0x09c */ OPT_FORCE, - /* 0x09d */ OPT_REPAIR_MAGICS, - /* 0x09e */ OPT_OLD, - /* 0x09f */ OPT_STD, - /* 0x0a0 */ OPT_NEW, - /* 0x0a1 */ OPT_EXTRACT, - /* 0x0a2 */ OPT_LIST, - /* 0x0a3 */ OPT_REF, - /* 0x0a4 */ OPT_FULL, - /* 0x0a5 */ OPT_HEX, - /* 0x0a6 */ OPT_CT_DIR, - /* 0x0a7 */ OPT_CT_LOG, - /* 0x0a8 */ OPT_ALLOW_SLOTS, - /* 0x0a9 */ OPT_IMAGES, - /* 0x0aa */ OPT_LOAD_BMG, - /* 0x0ab */ OPT_PATCH_BMG, - /* 0x0ac */ OPT_MACRO_BMG, - /* 0x0ad */ OPT_FILTER_BMG, - /* 0x0ae */ OPT_PATCH_NAMES, - /* 0x0af */ OPT_ORDER_BY, - /* 0x0b0 */ OPT_ORDER_ALL, - /* 0x0b1 */ OPT_DYNAMIC, - /* 0x0b2 */ OPT_WRITE_TRACKS, - /* 0x0b3 */ OPT_NUMBER, - /* 0x0b4 */ OPT_SECTIONS, - /* 0x0b5 */ 0,0,0,0, 0,0,0,0, 0,0,0, + /* 0x08e */ OPT_BMG_ENDIAN, + /* 0x08f */ OPT_BMG_ENCODING, + /* 0x090 */ OPT_BMG_INF_SIZE, + /* 0x091 */ OPT_BMG_MID, + /* 0x092 */ OPT_FORCE_ATTRIB, + /* 0x093 */ OPT_DEF_ATTRIB, + /* 0x094 */ OPT_NO_ATTRIB, + /* 0x095 */ OPT_X_ESCAPES, + /* 0x096 */ OPT_OLD_ESCAPES, + /* 0x097 */ OPT_NO_BMG_COLORS, + /* 0x098 */ OPT_BMG_COLORS, + /* 0x099 */ OPT_NO_BMG_INLINE, + /* 0x09a */ OPT_NO_ECHO, + /* 0x09b */ OPT_UTF_8, + /* 0x09c */ OPT_NO_UTF_8, + /* 0x09d */ OPT_FORCE, + /* 0x09e */ OPT_REPAIR_MAGICS, + /* 0x09f */ OPT_OLD, + /* 0x0a0 */ OPT_STD, + /* 0x0a1 */ OPT_NEW, + /* 0x0a2 */ OPT_EXTRACT, + /* 0x0a3 */ OPT_LIST, + /* 0x0a4 */ OPT_REF, + /* 0x0a5 */ OPT_FULL, + /* 0x0a6 */ OPT_HEX, + /* 0x0a7 */ OPT_CT_DIR, + /* 0x0a8 */ OPT_CT_LOG, + /* 0x0a9 */ OPT_ALLOW_SLOTS, + /* 0x0aa */ OPT_IMAGES, + /* 0x0ab */ OPT_LOAD_BMG, + /* 0x0ac */ OPT_PATCH_BMG, + /* 0x0ad */ OPT_MACRO_BMG, + /* 0x0ae */ OPT_FILTER_BMG, + /* 0x0af */ OPT_PATCH_NAMES, + /* 0x0b0 */ OPT_ORDER_BY, + /* 0x0b1 */ OPT_ORDER_ALL, + /* 0x0b2 */ OPT_DYNAMIC, + /* 0x0b3 */ OPT_WRITE_TRACKS, + /* 0x0b4 */ OPT_NUMBER, + /* 0x0b5 */ OPT_SECTIONS, + /* 0x0b6 */ 0,0,0,0, 0,0,0,0, 0,0, /* 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, @@ -1065,130 +1077,130 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /////////////// opt_allowed_cmd_* /////////////// /////////////////////////////////////////////////////////////////////////////// -static u8 option_allowed_cmd_VERSION[46] = // cmd #1 +static u8 option_allowed_cmd_VERSION[47] = // 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,0, 1 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1 }; -static u8 option_allowed_cmd_HELP[46] = // cmd #2 +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,1,1,1, 1,1,1,1,1, 1,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,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[46] = // cmd #3 +static u8 option_allowed_cmd_ARGTEST[47] = // cmd #3 { 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1 + 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1 }; -static u8 option_allowed_cmd_TEST[46] = // cmd #4 +static u8 option_allowed_cmd_TEST[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,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1 }; -static u8 option_allowed_cmd_COLORS[46] = // cmd #5 +static u8 option_allowed_cmd_COLORS[47] = // cmd #5 { 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 }; -static u8 option_allowed_cmd_ERROR[46] = // cmd #6 +static u8 option_allowed_cmd_ERROR[47] = // cmd #6 { 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, 1 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1 }; -static u8 option_allowed_cmd_FILETYPE[46] = // cmd #7 +static u8 option_allowed_cmd_FILETYPE[47] = // cmd #7 { 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,1, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,0 }; -static u8 option_allowed_cmd_FILEATTRIB[46] = // cmd #8 +static u8 option_allowed_cmd_FILEATTRIB[47] = // cmd #8 { 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[46] = // cmd #9 +static u8 option_allowed_cmd_SYMBOLS[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,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0 }; -static u8 option_allowed_cmd_FUNCTIONS[46] = // cmd #10 +static u8 option_allowed_cmd_FUNCTIONS[47] = // cmd #10 { 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 }; -static u8 option_allowed_cmd_CALCULATE[46] = // cmd #11 +static u8 option_allowed_cmd_CALCULATE[47] = // 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,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0 }; -static u8 option_allowed_cmd_FLOAT[46] = // cmd #12 +static u8 option_allowed_cmd_FLOAT[47] = // cmd #12 { 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 }; -static u8 option_allowed_cmd_EXPORT[46] = // cmd #13 +static u8 option_allowed_cmd_EXPORT[47] = // 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 }; -static u8 option_allowed_cmd_RAWDUMP[46] = // cmd #14 +static u8 option_allowed_cmd_RAWDUMP[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,1,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 }; -static u8 option_allowed_cmd_DUMP[46] = // cmd #15 +static u8 option_allowed_cmd_DUMP[47] = // cmd #15 { - 0,0,1,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, - 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,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[46] = // cmd #16 +static u8 option_allowed_cmd_CAT[47] = // cmd #16 { - 0,0,0,1,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,0, 1,1,1,1,1, 1,0,1,1,1, - 1,1,1,1,0, 1,0,0,0,0, 0,0,0,0,1, 0 + 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[46] = // cmd #17 +static u8 option_allowed_cmd_BMG[47] = // cmd #17 { - 0,0,1,1,1, 0,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 + 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[46] = // cmd #18 +static u8 option_allowed_cmd_TRACKS[47] = // cmd #18 { - 0,0,1,1,1, 1,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 + 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[46] = // cmd #19 +static u8 option_allowed_cmd_DECODE[47] = // cmd #19 { - 0,0,0,1,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,0, 1,1,1,1,1, 1,0,1,1,1, - 1,1,1,1,0, 1,1,1,1,1, 1,1,1,1,1, 0 + 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[46] = // cmd #20 +static u8 option_allowed_cmd_CREATE[47] = // cmd #20 { - 0,0,1,1,1, 0,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 + 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[46] = // cmd #21 +static u8 option_allowed_cmd_PATCH[47] = // cmd #21 { - 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 + 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 }; @@ -1390,6 +1402,7 @@ static const InfoOption_t * option_tab_cmd_BMG[] = OptionInfo + OPT_HEX, &option_grp_TEXTOPT_NO_HEADER, OptionInfo + OPT_EXPORT, + OptionInfo + OPT_BMG_ENDIAN, OptionInfo + OPT_BMG_ENCODING, OptionInfo + OPT_BMG_INF_SIZE, OptionInfo + OPT_BMG_MID, @@ -1499,6 +1512,7 @@ static const InfoOption_t * option_tab_cmd_CREATE[] = &option_grp_TEXTOPT_NO_HEADER, OptionInfo + OPT_BRIEF, OptionInfo + OPT_EXPORT, + OptionInfo + OPT_BMG_ENDIAN, OptionInfo + OPT_BMG_ENCODING, OptionInfo + OPT_BMG_INF_SIZE, OptionInfo + OPT_BMG_MID, @@ -1850,7 +1864,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " output. BRRES, TEX0, CT-CODE, CT-TEXT and LE-BIN are accepted as" " input.", 0, - 31, + 32, option_tab_cmd_BMG, option_allowed_cmd_BMG }, @@ -1902,7 +1916,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " The Korean support needs external CT-CODE files. Use option" " --ct-dir to define at least one search path.", 0, - 40, + 41, option_tab_cmd_CREATE, option_allowed_cmd_CREATE }, diff --git a/project/src/ui/ui-wctct.h b/project/src/ui/ui-wctct.h index 4e0e4d0..184515b 100644 --- a/project/src/ui/ui-wctct.h +++ b/project/src/ui/ui-wctct.h @@ -61,6 +61,7 @@ typedef enum enumOptions OPT_NO_HEADER, OPT_BRIEF, OPT_RAW, + OPT_BMG_ENDIAN, OPT_BMG_ENCODING, OPT_BMG_INF_SIZE, OPT_BMG_MID, @@ -102,7 +103,7 @@ typedef enum enumOptions OPT_IGNORE, OPT_SECTIONS, - OPT__N_SPECIFIC, // == 46 + OPT__N_SPECIFIC, // == 47 //----- global options ----- @@ -140,7 +141,7 @@ typedef enum enumOptions OPT_CT_LOG, OPT_ALLOW_SLOTS, - OPT__N_TOTAL // == 79 + OPT__N_TOTAL // == 80 } enumOptions; @@ -160,6 +161,7 @@ typedef enum enumOptions // OB_NO_HEADER = 1llu << OPT_NO_HEADER, // OB_BRIEF = 1llu << OPT_BRIEF, // OB_RAW = 1llu << OPT_RAW, +// OB_BMG_ENDIAN = 1llu << OPT_BMG_ENDIAN, // OB_BMG_ENCODING = 1llu << OPT_BMG_ENCODING, // OB_BMG_INF_SIZE = 1llu << OPT_BMG_INF_SIZE, // OB_BMG_MID = 1llu << OPT_BMG_MID, @@ -276,6 +278,7 @@ typedef enum enumOptions // OB_CMD_BMG = OB_BRIEF // | OB_LONG // | OB_GRP_TEXTOUT +// | OB_BMG_ENDIAN // | OB_BMG_ENCODING // | OB_BMG_INF_SIZE // | OB_BMG_MID @@ -322,6 +325,7 @@ typedef enum enumOptions // OB_CMD_CREATE = OB_GRP_DEST // | OB_IGNORE // | OB_GRP_TEXTOPT +// | OB_BMG_ENDIAN // | OB_BMG_ENCODING // | OB_BMG_INF_SIZE // | OB_BMG_MID @@ -439,6 +443,7 @@ typedef enum enumGetOpt GO_CHDIR, GO_ROUND, GO_RAW, + GO_BMG_ENDIAN, GO_BMG_ENCODING, GO_BMG_INF_SIZE, GO_BMG_MID, diff --git a/project/src/ui/ui-wlect.c b/project/src/ui/ui-wlect.c index e590351..e74581c 100644 --- a/project/src/ui/ui-wlect.c +++ b/project/src/ui/ui-wlect.c @@ -150,9 +150,9 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = { OPT_PERFMON, true, false, false, false, false, 0, "perf-mon", "[=mode]", "Enable or disable the performance monitor. Mode is one of OFF, AUTO" - " (default, don't change setting), ON (enable it for Wii only;" - " default, if option is used without parameter) or FORCE (enable it" - " for Wii and for Dolphin)." + " (default, don't change setting), ON (enable it for Wii and Wii U" + " only; default, if option is used without parameter) or FORCE (enable" + " it for Wii, Wii U and for Dolphin)." }, { OPT_CUSTOM_TT, true, false, false, false, false, 0, "custom-tt", @@ -168,6 +168,32 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " parameter). Disable it only for tests!" }, + { 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)." + }, + + { 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_TRACK_DIR, false, false, false, false, true, 0, "track-dir", "directory", "Define a destination directory, where track files are copied, moved" @@ -337,7 +363,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 == 41 + {0,0,0,0,0,0,0,0,0,0}, // OPT__N_SPECIFIC == 45 //----- global options ----- @@ -559,7 +585,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 == 72 + {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 76 }; @@ -784,6 +810,13 @@ static const struct option OptionLong[] = { "custom-tt", 2, 0, GO_CUSTOM_TT }, { "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 }, { "track-dir", 1, 0, GO_TRACK_DIR }, { "trackdir", 1, 0, GO_TRACK_DIR }, { "copy-tracks", 1, 0, GO_COPY_TRACKS }, @@ -912,20 +945,24 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x0a1 */ OPT_PERFMON, /* 0x0a2 */ OPT_CUSTOM_TT, /* 0x0a3 */ OPT_XPFLAGS, - /* 0x0a4 */ OPT_TRACK_DIR, - /* 0x0a5 */ OPT_COPY_TRACKS, - /* 0x0a6 */ OPT_MOVE_TRACKS, - /* 0x0a7 */ OPT_MOVE1_TRACKS, - /* 0x0a8 */ OPT_LINK_TRACKS, - /* 0x0a9 */ OPT_LOAD_BMG, - /* 0x0aa */ OPT_PATCH_BMG, - /* 0x0ab */ OPT_MACRO_BMG, - /* 0x0ac */ OPT_PATCH_NAMES, - /* 0x0ad */ OPT_ORDER_BY, - /* 0x0ae */ OPT_ORDER_ALL, - /* 0x0af */ OPT_NUMBER, - /* 0x0b0 */ OPT_SECTIONS, - /* 0x0b1 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0, + /* 0x0a4 */ OPT_SPEEDOMETER, + /* 0x0a5 */ OPT_RESERVED_1B9, + /* 0x0a6 */ OPT_RESERVED_1BA, + /* 0x0a7 */ OPT_RESERVED_1BB, + /* 0x0a8 */ OPT_TRACK_DIR, + /* 0x0a9 */ OPT_COPY_TRACKS, + /* 0x0aa */ OPT_MOVE_TRACKS, + /* 0x0ab */ OPT_MOVE1_TRACKS, + /* 0x0ac */ OPT_LINK_TRACKS, + /* 0x0ad */ OPT_LOAD_BMG, + /* 0x0ae */ OPT_PATCH_BMG, + /* 0x0af */ OPT_MACRO_BMG, + /* 0x0b0 */ OPT_PATCH_NAMES, + /* 0x0b1 */ OPT_ORDER_BY, + /* 0x0b2 */ OPT_ORDER_ALL, + /* 0x0b3 */ OPT_NUMBER, + /* 0x0b4 */ OPT_SECTIONS, + /* 0x0b5 */ 0,0,0,0, 0,0,0,0, 0,0,0, /* 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, @@ -940,142 +977,142 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /////////////// opt_allowed_cmd_* /////////////// /////////////////////////////////////////////////////////////////////////////// -static u8 option_allowed_cmd_VERSION[41] = // cmd #1 +static u8 option_allowed_cmd_VERSION[45] = // 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, 1 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1 }; -static u8 option_allowed_cmd_HELP[41] = // cmd #2 +static u8 option_allowed_cmd_HELP[45] = // 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 }; -static u8 option_allowed_cmd_ARGTEST[41] = // cmd #3 +static u8 option_allowed_cmd_ARGTEST[45] = // cmd #3 { 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1 + 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1 }; -static u8 option_allowed_cmd_TEST[41] = // cmd #4 +static u8 option_allowed_cmd_TEST[45] = // 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 }; -static u8 option_allowed_cmd_COLORS[41] = // cmd #5 +static u8 option_allowed_cmd_COLORS[45] = // cmd #5 { 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 }; -static u8 option_allowed_cmd_ERROR[41] = // cmd #6 +static u8 option_allowed_cmd_ERROR[45] = // cmd #6 { 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, 1 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1 }; -static u8 option_allowed_cmd_FILETYPE[41] = // cmd #7 +static u8 option_allowed_cmd_FILETYPE[45] = // cmd #7 { 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,1, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,0 }; -static u8 option_allowed_cmd_FILEATTRIB[41] = // cmd #8 +static u8 option_allowed_cmd_FILEATTRIB[45] = // cmd #8 { 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 }; -static u8 option_allowed_cmd_SYMBOLS[41] = // cmd #9 +static u8 option_allowed_cmd_SYMBOLS[45] = // 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 }; -static u8 option_allowed_cmd_FUNCTIONS[41] = // cmd #10 +static u8 option_allowed_cmd_FUNCTIONS[45] = // cmd #10 { 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 }; -static u8 option_allowed_cmd_CALCULATE[41] = // cmd #11 +static u8 option_allowed_cmd_CALCULATE[45] = // 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,0,0,0, 0,0,0,0,0 }; -static u8 option_allowed_cmd_FLOAT[41] = // cmd #12 +static u8 option_allowed_cmd_FLOAT[45] = // cmd #12 { 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_EXPORT[41] = // cmd #13 +static u8 option_allowed_cmd_EXPORT[45] = // 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 }; -static u8 option_allowed_cmd_DUMP[41] = // cmd #14 +static u8 option_allowed_cmd_DUMP[45] = // cmd #14 { - 0,0,1,0,0, 0,0,0,0,0, 0,1,1,1,1, 1,1,1,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,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,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_DL[41] = // cmd #15 +static u8 option_allowed_cmd_DL[45] = // cmd #15 { - 0,0,1,0,0, 0,0,0,0,0, 0,1,1,1,1, 1,1,1,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,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,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[41] = // cmd #16 +static u8 option_allowed_cmd_DLL[45] = // cmd #16 { - 0,0,1,0,0, 0,0,0,0,0, 0,1,1,1,1, 1,1,1,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,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,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[41] = // cmd #17 +static u8 option_allowed_cmd_BIN_DIFF[45] = // cmd #17 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0 + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0 }; -static u8 option_allowed_cmd_PATCH[41] = // cmd #18 +static u8 option_allowed_cmd_PATCH[45] = // cmd #18 { - 0,0,0,0,0, 0,0,0,0,0, 0,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,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[41] = // cmd #19 +static u8 option_allowed_cmd_LPAR[45] = // cmd #19 { - 0,0,0,1,1, 1,0,0,0,0, 0,1,1,1,1, 1,1,1,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,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,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[41] = // cmd #20 +static u8 option_allowed_cmd_CREATE[45] = // cmd #20 { - 0,0,0,1,1, 1,0,1,1,1, 1,0,1,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, 0 + 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 }; -static u8 option_allowed_cmd_CAT[41] = // cmd #21 +static u8 option_allowed_cmd_CAT[45] = // cmd #21 { - 0,0,0,1,1, 1,0,1,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 0,0,0,0,0, - 0,0,0,0,0, 0,0,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,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[41] = // cmd #22 +static u8 option_allowed_cmd_DECODE[45] = // cmd #22 { - 0,0,0,1,1, 1,0,1,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 0,0,0,0,0, - 0,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,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[41] = // cmd #23 +static u8 option_allowed_cmd_ENCODE[45] = // cmd #23 { - 0,0,0,0,0, 0,0,1,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 0,0,0,0,0, - 0,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,0,0,1,0, + 0,0,0,0,0, 1,1,1,1,1, 1,1,1,1,0 }; @@ -1230,6 +1267,7 @@ static const InfoOption_t * option_tab_cmd_DUMP[] = OptionInfo + OPT_PERFMON, OptionInfo + OPT_CUSTOM_TT, OptionInfo + OPT_XPFLAGS, + OptionInfo + OPT_SPEEDOMETER, OptionInfo + OPT_NONE, // separator @@ -1249,6 +1287,7 @@ static const InfoOption_t * option_tab_cmd_DL[] = OptionInfo + OPT_PERFMON, OptionInfo + OPT_CUSTOM_TT, OptionInfo + OPT_XPFLAGS, + OptionInfo + OPT_SPEEDOMETER, OptionInfo + OPT_NONE, // separator @@ -1268,6 +1307,7 @@ static const InfoOption_t * option_tab_cmd_DLL[] = OptionInfo + OPT_PERFMON, OptionInfo + OPT_CUSTOM_TT, OptionInfo + OPT_XPFLAGS, + OptionInfo + OPT_SPEEDOMETER, OptionInfo + OPT_NONE, // separator @@ -1295,6 +1335,7 @@ static const InfoOption_t * option_tab_cmd_PATCH[] = OptionInfo + OPT_PERFMON, OptionInfo + OPT_CUSTOM_TT, OptionInfo + OPT_XPFLAGS, + OptionInfo + OPT_SPEEDOMETER, OptionInfo + OPT_TRACK_DIR, OptionInfo + OPT_COPY_TRACKS, OptionInfo + OPT_MOVE_TRACKS, @@ -1329,6 +1370,7 @@ static const InfoOption_t * option_tab_cmd_LPAR[] = OptionInfo + OPT_PERFMON, OptionInfo + OPT_CUSTOM_TT, OptionInfo + OPT_XPFLAGS, + OptionInfo + OPT_SPEEDOMETER, OptionInfo + OPT_NONE, // separator @@ -1370,6 +1412,9 @@ static const InfoOption_t * option_tab_cmd_CREATE[] = OptionInfo + OPT_UPDATE, OptionInfo + OPT_PRESERVE, OptionInfo + OPT_LPAR, + + OptionInfo + OPT_NONE, // separator + OptionInfo + OPT_LT_CLEAR, OptionInfo + OPT_LT_ONLINE, OptionInfo + OPT_LT_N_PLAYERS, @@ -1379,6 +1424,15 @@ static const InfoOption_t * option_tab_cmd_CREATE[] = OptionInfo + OPT_LT_RANDOM, OptionInfo + OPT_LEX_PURGE, + OptionInfo + OPT_NONE, // separator + + OptionInfo + OPT_ENGINE, + OptionInfo + OPT_200CC, + OptionInfo + OPT_PERFMON, + OptionInfo + OPT_CUSTOM_TT, + OptionInfo + OPT_XPFLAGS, + OptionInfo + OPT_SPEEDOMETER, + 0 }; @@ -1682,7 +1736,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, - 10, + 11, option_tab_cmd_DUMP, option_allowed_cmd_DUMP }, @@ -1696,7 +1750,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "wlect DL [source]...", "Short cut for 'DUMP --long'.", 0, - 10, + 11, option_tab_cmd_DL, option_allowed_cmd_DL }, @@ -1710,7 +1764,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = "wlect DLL [source]...", "Short cut for 'DUMP --long --long'.", 0, - 10, + 11, option_tab_cmd_DLL, option_allowed_cmd_DLL }, @@ -1747,7 +1801,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, - 22, + 23, option_tab_cmd_PATCH, option_allowed_cmd_PATCH }, @@ -1763,7 +1817,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, - 20, + 21, option_tab_cmd_LPAR, option_allowed_cmd_LPAR }, @@ -1784,7 +1838,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, - 22, + 28, 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 94a0f2e..a170a51 100644 --- a/project/src/ui/ui-wlect.h +++ b/project/src/ui/ui-wlect.h @@ -74,6 +74,10 @@ typedef enum enumOptions OPT_PERFMON, OPT_CUSTOM_TT, OPT_XPFLAGS, + OPT_SPEEDOMETER, + OPT_RESERVED_1B9, + OPT_RESERVED_1BA, + OPT_RESERVED_1BB, OPT_TRACK_DIR, OPT_COPY_TRACKS, OPT_MOVE_TRACKS, @@ -97,7 +101,7 @@ typedef enum enumOptions OPT_IGNORE, OPT_SECTIONS, - OPT__N_SPECIFIC, // == 41 + OPT__N_SPECIFIC, // == 45 //----- global options ----- @@ -133,7 +137,7 @@ typedef enum enumOptions OPT_NEW, OPT_EXTRACT, - OPT__N_TOTAL // == 72 + OPT__N_TOTAL // == 76 } enumOptions; @@ -166,6 +170,10 @@ typedef enum enumOptions // OB_PERFMON = 1llu << OPT_PERFMON, // 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_TRACK_DIR = 1llu << OPT_TRACK_DIR, // OB_COPY_TRACKS = 1llu << OPT_COPY_TRACKS, // OB_MOVE_TRACKS = 1llu << OPT_MOVE_TRACKS, @@ -200,14 +208,20 @@ typedef enum enumOptions // | OB_UPDATE // | OB_PRESERVE, // -// OB_GRP_PATCH = OB_LE_DEFINE -// | OB_LPAR -// | OB_ALIAS -// | OB_ENGINE +// OB_GRP_PARAM = OB_ENGINE // | OB_200CC // | OB_PERFMON // | OB_CUSTOM_TT -// | OB_XPFLAGS, +// | OB_XPFLAGS +// | OB_SPEEDOMETER +// | OB_RESERVED_1B9 +// | OB_RESERVED_1BA +// | OB_RESERVED_1BB, +// +// OB_GRP_PATCH = OB_LE_DEFINE +// | OB_LPAR +// | OB_ALIAS +// | OB_GRP_PARAM, // // OB_GRP_TRACK_COPY = OB_TRACK_DIR // | OB_COPY_TRACKS @@ -282,7 +296,8 @@ typedef enum enumOptions // | OB_LPAR // | OB_LT_CLEAR // | OB_LT_ONLINE -// | OB_LT_N_PLAYERS, +// | OB_LT_N_PLAYERS +// | OB_GRP_PARAM, // // OB_CMD_CAT = OB_COMPLETE // | OB_GRP_TEXTOUT @@ -411,6 +426,10 @@ typedef enum enumGetOpt GO_PERFMON, GO_CUSTOM_TT, GO_XPFLAGS, + GO_SPEEDOMETER, + GO_RESERVED_1B9, + GO_RESERVED_1BA, + GO_RESERVED_1BB, GO_TRACK_DIR, GO_COPY_TRACKS, GO_MOVE_TRACKS, diff --git a/project/src/ui/ui-wszst.c b/project/src/ui/ui-wszst.c index f6a0afc..d5f36b5 100644 --- a/project/src/ui/ui-wszst.c +++ b/project/src/ui/ui-wszst.c @@ -527,9 +527,18 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = " default value is 0.01." }, + { OPT_BMG_ENDIAN, false, false, false, false, false, 0, "bmg-endian", + "name", + "Force an endian for new BMG files. Accepted values are BIG or BE for" + " big endian, LITTLE or LE for little endian and AUTO for automatic" + " detection (default).\n" + " Mario Kart Wii uses big endian; the default if no other endian is" + " defined." + }, + { OPT_BMG_ENCODING, false, false, false, false, false, 0, "bmg-encoding", "name", - "Force a BMG encoding for new BMG files. Accepted encoding names are:" + "Force an encoding for new BMG files. Accepted encoding names are" " CP-1252, UTF-16BE (or UTF-16), SHIFT-JIS, UTF-8 and AUTO for" " automatic detection (default). Same keywords without minus signs are" " accepted too.\n" @@ -1094,7 +1103,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 == 130 + {0,0,0,0,0,0,0,0,0,0}, // OPT__N_SPECIFIC == 131 //----- global options ----- @@ -1680,7 +1689,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 == 200 + {0,0,0,0,0,0,0,0,0,0} // OPT__N_TOTAL == 201 }; @@ -2370,6 +2379,8 @@ static const struct option OptionLong[] = { "delta", 0, 0, GO_DELTA }, { "diff", 0, 0, GO_DIFF }, { "epsilon", 1, 0, GO_EPSILON }, + { "bmg-endian", 1, 0, GO_BMG_ENDIAN }, + { "bmgendian", 1, 0, GO_BMG_ENDIAN }, { "bmg-encoding", 1, 0, GO_BMG_ENCODING }, { "bmgencoding", 1, 0, GO_BMG_ENCODING }, { "bmg-inf-size", 1, 0, GO_BMG_INF_SIZE }, @@ -2700,85 +2711,86 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /* 0x0d5 */ OPT_DELTA, /* 0x0d6 */ OPT_DIFF, /* 0x0d7 */ OPT_EPSILON, - /* 0x0d8 */ OPT_BMG_ENCODING, - /* 0x0d9 */ OPT_BMG_INF_SIZE, - /* 0x0da */ OPT_BMG_MID, - /* 0x0db */ OPT_FORCE_ATTRIB, - /* 0x0dc */ OPT_DEF_ATTRIB, - /* 0x0dd */ OPT_NO_ATTRIB, - /* 0x0de */ OPT_X_ESCAPES, - /* 0x0df */ OPT_OLD_ESCAPES, - /* 0x0e0 */ OPT_NO_BMG_COLORS, - /* 0x0e1 */ OPT_BMG_COLORS, - /* 0x0e2 */ OPT_NO_BMG_INLINE, - /* 0x0e3 */ OPT_AUTOADD_PATH, - /* 0x0e4 */ OPT_STRIP, - /* 0x0e5 */ OPT_UTF_8, - /* 0x0e6 */ OPT_NO_UTF_8, - /* 0x0e7 */ OPT_FORCE, - /* 0x0e8 */ OPT_REPAIR_MAGICS, - /* 0x0e9 */ OPT_TINY, - /* 0x0ea */ OPT_YAZ0, - /* 0x0eb */ OPT_YAZ1, - /* 0x0ec */ OPT_XYZ, - /* 0x0ed */ OPT_BZ, - /* 0x0ee */ OPT_SH, - /* 0x0ef */ OPT_BASH, - /* 0x0f0 */ OPT_JSON, - /* 0x0f1 */ OPT_PHP, - /* 0x0f2 */ OPT_MAKEDOC, - /* 0x0f3 */ OPT_VAR, - /* 0x0f4 */ OPT_ARRAY, - /* 0x0f5 */ OPT_AVAR, - /* 0x0f6 */ OPT_ANALYZE, - /* 0x0f7 */ OPT_ANALYZE_MODE, - /* 0x0f8 */ OPT_OLD, - /* 0x0f9 */ OPT_STD, - /* 0x0fa */ OPT_NEW, - /* 0x0fb */ OPT_EXTRACT, - /* 0x0fc */ OPT_NUMBER, - /* 0x0fd */ OPT_REMOVE_SRC, - /* 0x0fe */ OPT_IGNORE_SETUP, - /* 0x0ff */ OPT_PURGE, - /* 0x100 */ OPT_ALIGN_U8, - /* 0x101 */ OPT_ALIGN_PACK, - /* 0x102 */ OPT_ALIGN_BRRES, - /* 0x103 */ OPT_ALIGN_BREFF, - /* 0x104 */ OPT_ALIGN_BREFT, - /* 0x105 */ OPT_ALIGN, - /* 0x106 */ OPT_ENCODE_ALL, - /* 0x107 */ OPT_ENCODE_IMG, - /* 0x108 */ OPT_NO_ENCODE, - /* 0x109 */ OPT_NO_RECURSE, - /* 0x10a */ OPT_AUTO_ADD, - /* 0x10b */ OPT_NO_ECHO, - /* 0x10c */ OPT_PT_DIR, - /* 0x10d */ OPT_RM_AIPARAM, - /* 0x10e */ OPT_U8, - /* 0x10f */ OPT_SZS, - /* 0x110 */ OPT_WU8, - /* 0x111 */ OPT_XWU8, - /* 0x112 */ OPT_WBZ, - /* 0x113 */ OPT_PACK, - /* 0x114 */ OPT_BRRES, - /* 0x115 */ OPT_BREFF, - /* 0x116 */ OPT_BREFT, - /* 0x117 */ OPT_NO_COMPRESS, - /* 0x118 */ OPT_FAST, - /* 0x119 */ OPT_LINKS, - /* 0x11a */ OPT_BASEDIR, - /* 0x11b */ OPT_DECODE, - /* 0x11c */ OPT_MIPMAPS, - /* 0x11d */ OPT_NO_MIPMAPS, - /* 0x11e */ OPT_N_MIPMAPS, - /* 0x11f */ OPT_MAX_MIPMAPS, - /* 0x120 */ OPT_MIPMAP_SIZE, - /* 0x121 */ OPT_FAST_MIPMAPS, - /* 0x122 */ OPT_CMPR_DEFAULT, - /* 0x123 */ OPT_CUT, - /* 0x124 */ OPT_RAW, - /* 0x125 */ OPT_SECTIONS, - /* 0x126 */ 0,0,0,0, 0,0, + /* 0x0d8 */ OPT_BMG_ENDIAN, + /* 0x0d9 */ OPT_BMG_ENCODING, + /* 0x0da */ OPT_BMG_INF_SIZE, + /* 0x0db */ OPT_BMG_MID, + /* 0x0dc */ OPT_FORCE_ATTRIB, + /* 0x0dd */ OPT_DEF_ATTRIB, + /* 0x0de */ OPT_NO_ATTRIB, + /* 0x0df */ OPT_X_ESCAPES, + /* 0x0e0 */ OPT_OLD_ESCAPES, + /* 0x0e1 */ OPT_NO_BMG_COLORS, + /* 0x0e2 */ OPT_BMG_COLORS, + /* 0x0e3 */ OPT_NO_BMG_INLINE, + /* 0x0e4 */ OPT_AUTOADD_PATH, + /* 0x0e5 */ OPT_STRIP, + /* 0x0e6 */ OPT_UTF_8, + /* 0x0e7 */ OPT_NO_UTF_8, + /* 0x0e8 */ OPT_FORCE, + /* 0x0e9 */ OPT_REPAIR_MAGICS, + /* 0x0ea */ OPT_TINY, + /* 0x0eb */ OPT_YAZ0, + /* 0x0ec */ OPT_YAZ1, + /* 0x0ed */ OPT_XYZ, + /* 0x0ee */ OPT_BZ, + /* 0x0ef */ OPT_SH, + /* 0x0f0 */ OPT_BASH, + /* 0x0f1 */ OPT_JSON, + /* 0x0f2 */ OPT_PHP, + /* 0x0f3 */ OPT_MAKEDOC, + /* 0x0f4 */ OPT_VAR, + /* 0x0f5 */ OPT_ARRAY, + /* 0x0f6 */ OPT_AVAR, + /* 0x0f7 */ OPT_ANALYZE, + /* 0x0f8 */ OPT_ANALYZE_MODE, + /* 0x0f9 */ OPT_OLD, + /* 0x0fa */ OPT_STD, + /* 0x0fb */ OPT_NEW, + /* 0x0fc */ OPT_EXTRACT, + /* 0x0fd */ OPT_NUMBER, + /* 0x0fe */ OPT_REMOVE_SRC, + /* 0x0ff */ OPT_IGNORE_SETUP, + /* 0x100 */ OPT_PURGE, + /* 0x101 */ OPT_ALIGN_U8, + /* 0x102 */ OPT_ALIGN_PACK, + /* 0x103 */ OPT_ALIGN_BRRES, + /* 0x104 */ OPT_ALIGN_BREFF, + /* 0x105 */ OPT_ALIGN_BREFT, + /* 0x106 */ OPT_ALIGN, + /* 0x107 */ OPT_ENCODE_ALL, + /* 0x108 */ OPT_ENCODE_IMG, + /* 0x109 */ OPT_NO_ENCODE, + /* 0x10a */ OPT_NO_RECURSE, + /* 0x10b */ OPT_AUTO_ADD, + /* 0x10c */ OPT_NO_ECHO, + /* 0x10d */ OPT_PT_DIR, + /* 0x10e */ OPT_RM_AIPARAM, + /* 0x10f */ OPT_U8, + /* 0x110 */ OPT_SZS, + /* 0x111 */ OPT_WU8, + /* 0x112 */ OPT_XWU8, + /* 0x113 */ OPT_WBZ, + /* 0x114 */ OPT_PACK, + /* 0x115 */ OPT_BRRES, + /* 0x116 */ OPT_BREFF, + /* 0x117 */ OPT_BREFT, + /* 0x118 */ OPT_NO_COMPRESS, + /* 0x119 */ OPT_FAST, + /* 0x11a */ OPT_LINKS, + /* 0x11b */ OPT_BASEDIR, + /* 0x11c */ OPT_DECODE, + /* 0x11d */ OPT_MIPMAPS, + /* 0x11e */ OPT_NO_MIPMAPS, + /* 0x11f */ OPT_N_MIPMAPS, + /* 0x120 */ OPT_MAX_MIPMAPS, + /* 0x121 */ OPT_MIPMAP_SIZE, + /* 0x122 */ OPT_FAST_MIPMAPS, + /* 0x123 */ OPT_CMPR_DEFAULT, + /* 0x124 */ OPT_CUT, + /* 0x125 */ OPT_RAW, + /* 0x126 */ OPT_SECTIONS, + /* 0x127 */ 0,0,0,0, 0, }; // @@ -2786,652 +2798,652 @@ static const OptionIndex_t OptionIndex[UIOPT_INDEX_SIZE] = /////////////// opt_allowed_cmd_* /////////////// /////////////////////////////////////////////////////////////////////////////// -static u8 option_allowed_cmd_VERSION[130] = // cmd #1 +static u8 option_allowed_cmd_VERSION[131] = // 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,1 + 0,0,0,0,0, 0,0,0,0,0, 1 }; -static u8 option_allowed_cmd_HELP[130] = // cmd #2 +static u8 option_allowed_cmd_HELP[131] = // 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 }; -static u8 option_allowed_cmd_ARGTEST[130] = // cmd #3 +static u8 option_allowed_cmd_ARGTEST[131] = // cmd #3 { 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1 + 1,1,1,1,1, 1,1,1,1,1, 1 }; -static u8 option_allowed_cmd_TEST[130] = // cmd #4 +static u8 option_allowed_cmd_TEST[131] = // 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 }; -static u8 option_allowed_cmd_COLORS[130] = // cmd #5 +static u8 option_allowed_cmd_COLORS[131] = // cmd #5 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0 + 0,0,0,0,0, 0,0,0,0,0, 0 }; -static u8 option_allowed_cmd_ERROR[130] = // cmd #6 +static u8 option_allowed_cmd_ERROR[131] = // cmd #6 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,1 + 0,0,0,0,0, 0,0,0,0,0, 1 }; -static u8 option_allowed_cmd_FILETYPE[130] = // cmd #7 +static u8 option_allowed_cmd_FILETYPE[131] = // cmd #7 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,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 }; -static u8 option_allowed_cmd_FILEATTRIB[130] = // cmd #8 +static u8 option_allowed_cmd_FILEATTRIB[131] = // cmd #8 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0 + 0,0,0,0,0, 0,0,0,0,0, 0 }; -static u8 option_allowed_cmd_BRSUB[130] = // cmd #9 +static u8 option_allowed_cmd_BRSUB[131] = // cmd #9 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,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 }; -static u8 option_allowed_cmd_SYMBOLS[130] = // cmd #10 +static u8 option_allowed_cmd_SYMBOLS[131] = // cmd #10 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0 + 0,0,0,0,0, 0,0,0,0,0, 0 }; -static u8 option_allowed_cmd_FUNCTIONS[130] = // cmd #11 +static u8 option_allowed_cmd_FUNCTIONS[131] = // cmd #11 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0 + 0,0,0,0,0, 0,0,0,0,0, 0 }; -static u8 option_allowed_cmd_CALCULATE[130] = // cmd #12 +static u8 option_allowed_cmd_CALCULATE[131] = // cmd #12 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0 + 0,0,0,0,0, 0,0,0,0,0, 0 }; -static u8 option_allowed_cmd_MATRIX[130] = // cmd #13 +static u8 option_allowed_cmd_MATRIX[131] = // cmd #13 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0 + 0,0,0,0,0, 0,0,0,0,0, 0 }; -static u8 option_allowed_cmd_FLOAT[130] = // cmd #14 +static u8 option_allowed_cmd_FLOAT[131] = // cmd #14 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0 + 0,0,0,0,0, 0,0,0,0,0, 0 }; -static u8 option_allowed_cmd_VR_CALC[130] = // cmd #15 +static u8 option_allowed_cmd_VR_CALC[131] = // cmd #15 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0 + 0,0,0,0,0, 0,0,0,0,0, 0 }; -static u8 option_allowed_cmd_VR_RACE[130] = // cmd #16 +static u8 option_allowed_cmd_VR_RACE[131] = // cmd #16 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0 + 0,0,0,0,0, 0,0,0,0,0, 0 }; -static u8 option_allowed_cmd_AUTOADD[130] = // cmd #17 +static u8 option_allowed_cmd_AUTOADD[131] = // cmd #17 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,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 }; -static u8 option_allowed_cmd_TRACKS[130] = // cmd #18 +static u8 option_allowed_cmd_TRACKS[131] = // cmd #18 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0,0, 0,0,0,0,0, 0,0,1,0,0, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,1,0,0 + 0,0,0,0,0, 0,0,0,1,0, 0 }; -static u8 option_allowed_cmd_SCANCACHE[130] = // cmd #19 +static u8 option_allowed_cmd_SCANCACHE[131] = // cmd #19 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 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 }; -static u8 option_allowed_cmd_EXPORT[130] = // cmd #20 +static u8 option_allowed_cmd_EXPORT[131] = // cmd #20 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0 + 0,0,0,0,0, 0,0,0,0,0, 0 }; -static u8 option_allowed_cmd_CODE[130] = // cmd #21 +static u8 option_allowed_cmd_CODE[131] = // 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 }; -static u8 option_allowed_cmd_RECODE[130] = // cmd #22 +static u8 option_allowed_cmd_RECODE[131] = // 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 }; -static u8 option_allowed_cmd_SUBFILE[130] = // cmd #23 +static u8 option_allowed_cmd_SUBFILE[131] = // 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,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 }; -static u8 option_allowed_cmd_LIST[130] = // cmd #24 +static u8 option_allowed_cmd_LIST[131] = // 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,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,1,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 0,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,0,0,1,1, 0,1,1,0,1, - 1,1,1,1,1, 1,1,1,0,0 + 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,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[130] = // cmd #25 +static u8 option_allowed_cmd_LIST_L[131] = // cmd #25 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,1,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 0,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,0,0,1,1, 0,1,1,0,1, - 1,1,1,1,1, 1,1,1,0,0 + 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,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[130] = // cmd #26 +static u8 option_allowed_cmd_LIST_LL[131] = // 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,1,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 0,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,0,0,1,1, 0,1,1,0,1, - 1,1,1,1,1, 1,1,1,0,0 + 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,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[130] = // cmd #27 +static u8 option_allowed_cmd_LIST_LLL[131] = // 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,1,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 0,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,0,0,1,1, 0,1,1,0,1, - 1,1,1,1,1, 1,1,1,0,0 + 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,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[130] = // cmd #28 +static u8 option_allowed_cmd_LIST_A[131] = // 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,1,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 0,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,0,0,1,1, 0,1,1,0,1, - 1,1,1,1,1, 1,1,1,0,0 + 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,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[130] = // cmd #29 +static u8 option_allowed_cmd_LIST_LA[131] = // 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,1,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 0,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,0,0,1,1, 0,1,1,0,1, - 1,1,1,1,1, 1,1,1,0,0 + 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,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[130] = // cmd #30 +static u8 option_allowed_cmd_NAME_REF[131] = // 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, 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,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,0 + 0,0,0,0,0, 0,0,0,0,0, 0 }; -static u8 option_allowed_cmd_ILIST[130] = // cmd #31 +static u8 option_allowed_cmd_ILIST[131] = // cmd #31 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,1,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 0,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,0,0,1,1, 0,1,0,0,1, - 1,1,1,1,1, 1,0,1,0,0 + 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,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[130] = // cmd #32 +static u8 option_allowed_cmd_ILIST_L[131] = // cmd #32 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,1,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 0,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,0,0,1,1, 0,1,0,0,1, - 1,1,1,1,1, 1,0,1,0,0 + 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,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[130] = // cmd #33 +static u8 option_allowed_cmd_ILIST_LL[131] = // 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,1,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 0,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,0,0,1,1, 0,1,0,0,1, - 1,1,1,1,1, 1,0,1,0,0 + 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,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[130] = // cmd #34 +static u8 option_allowed_cmd_ILIST_A[131] = // 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,1,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 0,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,0,0,1,1, 0,1,0,0,1, - 1,1,1,1,1, 1,0,1,0,0 + 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,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[130] = // cmd #35 +static u8 option_allowed_cmd_ILIST_LA[131] = // 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,1,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 0,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,0,0,1,1, 0,1,0,0,1, - 1,1,1,1,1, 1,0,1,0,0 + 0,0,0,0,0, 0,0,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,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[130] = // cmd #36 +static u8 option_allowed_cmd_MEMORY[131] = // 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,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,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 0,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,0,0,1,1, 0,1,1,1,1, - 1,1,1,1,1, 1,1,1,0,0 + 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,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[130] = // cmd #37 +static u8 option_allowed_cmd_MEMORY_A[131] = // cmd #37 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 0,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,0,0,1,1, 0,1,1,1,1, - 1,1,1,1,1, 1,1,1,0,0 + 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,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[130] = // cmd #38 +static u8 option_allowed_cmd_DUMP[131] = // 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,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 0,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,0,0,1,1, 0,0,0,0,1, - 1,1,1,1,1, 1,0,1,0,0 + 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,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[130] = // cmd #39 +static u8 option_allowed_cmd_SHA1[131] = // cmd #39 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,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,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 0,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,0,0,1,1, 0,0,0,0,1, - 1,1,1,1,1, 1,0,1,0,0 + 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,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[130] = // cmd #40 +static u8 option_allowed_cmd_ANALYZE[131] = // 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,1,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 1,0,0,0,0, 0,0,0,1,0, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 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 }; -static u8 option_allowed_cmd_DISTRIBUTION[130] = // cmd #41 +static u8 option_allowed_cmd_DISTRIBUTION[131] = // cmd #41 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,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, 1,0,0,1,0, 0,0,0,0,0, 0,0,0,1,1, 0,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,0,0,1,1, 0,0,0,0,1, - 1,1,1,1,1, 1,0,1,0,0 + 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,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[130] = // cmd #42 +static u8 option_allowed_cmd_DIFF[131] = // 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,0,0,0, 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, 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[130] = // cmd #43 +static u8 option_allowed_cmd_CHECK[131] = // cmd #43 { 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,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 0,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,0,0,0,1, 0,0,0,0,1, - 1,1,1,1,1, 1,0,1,0,0 + 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,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[130] = // cmd #44 +static u8 option_allowed_cmd_SLOTS[131] = // cmd #44 { 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,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 0,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 0,0,0,0,1, 0,0,0,0,1, - 1,1,1,1,1, 1,0,1,0,0 + 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,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[130] = // cmd #45 +static u8 option_allowed_cmd_STGI[131] = // 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,1,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,0, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,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_ISARENA[130] = // cmd #46 +static u8 option_allowed_cmd_ISARENA[131] = // cmd #46 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,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,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 }; -static u8 option_allowed_cmd_NORMALIZE[130] = // cmd #47 +static u8 option_allowed_cmd_NORMALIZE[131] = // 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,0, 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, 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[130] = // cmd #48 +static u8 option_allowed_cmd_PATCH[131] = // cmd #48 { 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,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, 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[130] = // cmd #49 +static u8 option_allowed_cmd_COPY[131] = // cmd #49 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 1,0,0,1,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,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, 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[130] = // cmd #50 +static u8 option_allowed_cmd_DUPLICATE[131] = // 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,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,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, 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[130] = // cmd #51 +static u8 option_allowed_cmd_MINIMAP[131] = // cmd #51 { 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, 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,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[130] = // cmd #52 +static u8 option_allowed_cmd_COMPRESS[131] = // 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,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, 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[130] = // cmd #53 +static u8 option_allowed_cmd_DECOMPRESS[131] = // 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,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,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, 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[130] = // cmd #54 +static u8 option_allowed_cmd_ENCODE[131] = // cmd #54 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 1,0,0,1,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,1, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 0,1,1,1,1, - 1,1,1,1,1, 1,0,1,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, - 1,1,1,1,1, 1,0,1,0,0 + 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 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[130] = // cmd #55 +static u8 option_allowed_cmd_CREATE[131] = // 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,1, 1,0,0,0,1, 1,1,1,1,0, 1,1,1,0,1, 0,1,1,1,1, - 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,0,1, 0,0,0,0,1, - 1,1,1,1,1, 1,0,1,0,0 + 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,0, 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[130] = // cmd #56 +static u8 option_allowed_cmd_UPDATE[131] = // 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,1, 1,0,0,1,1, 1,1,1,1,0, 1,1,1,1,0, 0,0,0,0,0, - 0,0,1,1,1, 1,0,1,1,0, 0,0,0,0,0, 0,0,0,0,0, 1,1,1,0,0, 0,1,0,0,0, - 0,0,0,0,0, 0,0,1,0,0 + 0,0,0,0,0, 0,0,0,0,0, 1,1,0,0,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[130] = // cmd #57 +static u8 option_allowed_cmd_EXTRACT[131] = // 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,1,1, 0,1,1,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,1,1,0,0, 0,1,1,0,1, 1,1,1,1,0, 1,1,1,1,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 1,1,1,1,1, - 1,0,0,0,1, 1,1,1,1,0 + 0,0,0,0,0, 0,0,1,1,0, 0,0,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[130] = // cmd #58 +static u8 option_allowed_cmd_XDECODE[131] = // 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,1,1, 0,1,1,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,1,1,0,0, 0,1,1,0,1, 1,1,1,1,0, 1,1,1,1,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 1,1,1,1,1, - 1,0,0,0,1, 1,1,1,1,0 + 0,0,0,0,0, 0,0,1,1,0, 0,0,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[130] = // cmd #59 +static u8 option_allowed_cmd_XEXPORT[131] = // cmd #59 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 1,0,0,1,1, 1,0,0,0,0, 0,0,0,1,1, 0,1,1,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,1,1,0,0, 0,1,1,0,1, 1,1,1,1,0, 1,1,1,1,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 1,1,1,1,1, - 1,0,0,0,1, 1,1,1,1,0 + 0,0,0,0,0, 0,0,1,1,0, 0,0,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[130] = // cmd #60 +static u8 option_allowed_cmd_XALL[131] = // 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,1,1,0,0, 0,1,1,0,1, 1,1,1,1,0, 1,1,1,1,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 1,1,1,1,1, - 1,0,0,0,1, 1,1,1,1,0 + 0,0,0,0,0, 0,0,1,1,0, 0,0,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[130] = // cmd #61 +static u8 option_allowed_cmd_XCOMMON[131] = // cmd #61 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 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 }; -static u8 option_allowed_cmd_BINARY[130] = // cmd #62 +static u8 option_allowed_cmd_BINARY[131] = // cmd #62 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 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 }; -static u8 option_allowed_cmd_TEXT[130] = // cmd #63 +static u8 option_allowed_cmd_TEXT[131] = // cmd #63 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, 0,1,1,0,1, 1,1,1,1,1, - 1,1,1,1,1, 1,1,1,0,0, 0,0,0,0,1, 1,1,1,1,0, 1,1,1,1,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,0, - 0,0,0,0,0, 0,0,0,0,0 + 1,1,1,1,1, 1,1,1,1,0, 0,0,0,0,0, 1,1,1,1,1, 0,1,1,1,1, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, + 0,0,0,0,0, 0,0,0,0,0, 0 }; -static u8 option_allowed_cmd_CAT[130] = // cmd #64 +static u8 option_allowed_cmd_CAT[131] = // 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,1,1,1, 0,1,1,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,1,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,0, - 0,0,0,0,0, 0,0,0,0,0 + 1,1,1,1,1, 1,1,1,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 0,0,0,0,0, + 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, + 0,0,0,0,0, 0,0,0,0,0, 0 }; -static u8 option_allowed_cmd_BMG[130] = // cmd #65 +static u8 option_allowed_cmd_BMG[131] = // cmd #65 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, 0,0,0,0,1, 1,1,1,1,1, - 1,1,1,1,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,0, 0,0,0,0,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,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_KCL[130] = // cmd #66 +static u8 option_allowed_cmd_KCL[131] = // cmd #66 { 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,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,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[130] = // cmd #67 +static u8 option_allowed_cmd_KMP[131] = // cmd #67 { 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,1,1,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,0,0,0,0 + 0,0,0,0,0, 0,0,1,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,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[130] = // cmd #68 +static u8 option_allowed_cmd_LEX[131] = // 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,0,1,1, 0,0,0,0,0, 0,0,0,0,0, - 0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,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,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 }; -static u8 option_allowed_cmd_INFO[130] = // cmd #69 +static u8 option_allowed_cmd_INFO[131] = // cmd #69 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,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,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 }; -static u8 option_allowed_cmd_GHOST[130] = // cmd #70 +static u8 option_allowed_cmd_GHOST[131] = // cmd #70 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,1,0, 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 }; -static u8 option_allowed_cmd_YAZDUMP[130] = // cmd #71 +static u8 option_allowed_cmd_YAZDUMP[131] = // 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,0,0, 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 }; -static u8 option_allowed_cmd_VEHICLE[130] = // cmd #72 +static u8 option_allowed_cmd_VEHICLE[131] = // 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,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,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 }; @@ -6277,6 +6289,7 @@ static const InfoOption_t * option_tab_cmd_TEXT[] = OptionInfo + OPT_DIFF, OptionInfo + OPT_EXPORT, OptionInfo + OPT_NO_PARAM, + OptionInfo + OPT_BMG_ENDIAN, OptionInfo + OPT_BMG_ENCODING, OptionInfo + OPT_BMG_INF_SIZE, OptionInfo + OPT_BMG_MID, @@ -6318,6 +6331,7 @@ static const InfoOption_t * option_tab_cmd_CAT[] = OptionInfo + OPT_DIFF, OptionInfo + OPT_EXPORT, OptionInfo + OPT_NO_PARAM, + OptionInfo + OPT_BMG_ENDIAN, OptionInfo + OPT_BMG_ENCODING, OptionInfo + OPT_BMG_INF_SIZE, OptionInfo + OPT_BMG_MID, @@ -6340,6 +6354,7 @@ static const InfoOption_t * option_tab_cmd_BMG[] = OptionInfo + OPT_IGNORE, &option_cmd_BMG_NO_HEADER, OptionInfo + OPT_BRIEF, + OptionInfo + OPT_BMG_ENDIAN, OptionInfo + OPT_BMG_ENCODING, OptionInfo + OPT_BMG_INF_SIZE, OptionInfo + OPT_BMG_MID, @@ -7633,7 +7648,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " ITEMSLOT, KCL, KMG, KMP, LEX, OBJFLOW, PAT and the related text" " formats.", 0, - 31, + 32, option_tab_cmd_TEXT, option_allowed_cmd_TEXT }, @@ -7649,7 +7664,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " and RARC archives. The output of all source files is concatenated" " and written to stdout.", 0, - 21, + 22, option_tab_cmd_CAT, option_allowed_cmd_CAT }, @@ -7665,7 +7680,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] = " decoded and printed as combined BMG text file. The command works" " exactly like 'wbmgt MIX'.", 0, - 17, + 18, option_tab_cmd_BMG, option_allowed_cmd_BMG }, diff --git a/project/src/ui/ui-wszst.h b/project/src/ui/ui-wszst.h index ee85a24..bdeeeae 100644 --- a/project/src/ui/ui-wszst.h +++ b/project/src/ui/ui-wszst.h @@ -109,6 +109,7 @@ typedef enum enumOptions OPT_DELTA, OPT_DIFF, OPT_EPSILON, + OPT_BMG_ENDIAN, OPT_BMG_ENCODING, OPT_BMG_INF_SIZE, OPT_BMG_MID, @@ -186,7 +187,7 @@ typedef enum enumOptions OPT_RAW, OPT_SECTIONS, - OPT__N_SPECIFIC, // == 130 + OPT__N_SPECIFIC, // == 131 //----- global options ----- @@ -261,7 +262,7 @@ typedef enum enumOptions OPT_NEW, OPT_EXTRACT, - OPT__N_TOTAL // == 200 + OPT__N_TOTAL // == 201 } enumOptions; @@ -329,6 +330,7 @@ typedef enum enumOptions // OB_DELTA = 1llu << OPT_DELTA, // OB_DIFF = 1llu << OPT_DIFF, // OB_EPSILON = 1llu << OPT_EPSILON, +// OB_BMG_ENDIAN = 1llu << OPT_BMG_ENDIAN, // OB_BMG_ENCODING = 1llu << OPT_BMG_ENCODING, // OB_BMG_INF_SIZE = 1llu << OPT_BMG_INF_SIZE, // OB_BMG_MID = 1llu << OPT_BMG_MID, @@ -478,7 +480,8 @@ typedef enum enumOptions // | OB_EXPORT // | OB_NO_PARAM, // -// OB_GRP_BMG = OB_BMG_ENCODING +// OB_GRP_BMG = OB_BMG_ENDIAN +// | OB_BMG_ENCODING // | OB_BMG_INF_SIZE // | OB_BMG_MID // | OB_FORCE_ATTRIB @@ -1121,6 +1124,7 @@ typedef enum enumGetOpt GO_DELTA, GO_DIFF, GO_EPSILON, + GO_BMG_ENDIAN, GO_BMG_ENCODING, GO_BMG_INF_SIZE, GO_BMG_MID, diff --git a/project/src/ui/ui.def b/project/src/ui/ui.def index b0b8a3c..bf829ab 100644 --- a/project/src/ui/ui.def +++ b/project/src/ui/ui.def @@ -1243,9 +1243,17 @@ " short cut for --no-header --brief --brief --delta --delta." \ " Additional, the output is limited to data sections." ) +#:def_opt( "BMG_ENDIAN", "bmg-endian|bmgendian", "CP", \ + "name", \ + "Force an endian for new BMG files. Accepted values are @BIG@ or @BE@" \ + " for big endian, @LITTLE@ or @LE@ for little endian and @AUTO@ for" \ + " automatic detection (default).\n" \ + " Mario Kart Wii uses big endian; the default if no other endian is" \ + " defined." ) + #:def_opt( "BMG_ENCODING", "bmg-encoding|bmgencoding", "CP", \ "name", \ - "Force a BMG encoding for new BMG files. Accepted encoding names are:" \ + "Force an encoding for new BMG files. Accepted encoding names are" \ " @CP-1252@, @UTF-16BE@ (or @UTF-16@), @SHIFT-JIS@, @UTF-8@ and @AUTO@" \ " for automatic detection (default). Same keywords without minus signs" \ " are accepted too.\n" \ @@ -10161,6 +10169,10 @@ "", \ "" ) +#:def_cmd_opt( "TEXT", "BMG_ENDIAN", \ + "", \ + "" ) + #:def_cmd_opt( "TEXT", "BMG_ENCODING", \ "", \ "" ) @@ -10278,6 +10290,10 @@ "", \ "" ) +#:def_cmd_opt( "CAT", "BMG_ENDIAN", \ + "", \ + "" ) + #:def_cmd_opt( "CAT", "BMG_ENCODING", \ "", \ "" ) @@ -10343,6 +10359,10 @@ "", \ "" ) +#:def_cmd_opt( "BMG", "BMG_ENDIAN", \ + "", \ + "" ) + #:def_cmd_opt( "BMG", "BMG_ENCODING", \ "", \ "" ) @@ -11359,9 +11379,17 @@ " With v2.01a, this option was renamed from --msg to the more" \ " meaningful name --filter-bmg. The old name is still available." ) +#:def_opt( "BMG_ENDIAN", "endian|bmg-endian|bmgendian", "CP", \ + "name", \ + "Force an endian for new BMG files. Accepted values are @BIG@ or @BE@" \ + " for big endian, @LITTLE@ or @LE@ for little endian and @AUTO@ for" \ + " automatic detection (default).\n" \ + " Mario Kart Wii uses big endian; the default if no other endian is" \ + " defined." ) + #:def_opt( "BMG_ENCODING", "encoding|bmg-encoding|bmgencoding", "CP", \ "name", \ - "Force a BMG encoding for new BMG files. Accepted encoding names are:" \ + "Force an encoding for new BMG files. Accepted encoding names are" \ " @CP-1252@, @UTF-16BE@ (or @UTF-16@), @SHIFT-JIS@, @UTF-8@ and @AUTO@" \ " for automatic detection (default). Same keywords without minus signs" \ " are accepted too.\n" \ @@ -11598,6 +11626,10 @@ "", \ "" ) +#:def_cmd_opt( "CAT", "BMG_ENDIAN", \ + "", \ + "" ) + #:def_cmd_opt( "CAT", "BMG_ENCODING", \ "", \ "" ) @@ -11678,6 +11710,10 @@ "", \ "" ) +#:def_cmd_opt( "MIX", "BMG_ENDIAN", \ + "", \ + "" ) + #:def_cmd_opt( "MIX", "BMG_ENCODING", \ "", \ "" ) @@ -11766,6 +11802,10 @@ "", \ "" ) +#:def_cmd_opt( "IDENTIFIER", "BMG_ENDIAN", \ + "", \ + "" ) + #:def_cmd_opt( "IDENTIFIER", "BMG_ENCODING", \ "", \ "" ) @@ -11862,6 +11902,10 @@ "", \ "" ) +#:def_cmd_opt( "DECODE", "BMG_ENDIAN", \ + "", \ + "" ) + #:def_cmd_opt( "DECODE", "BMG_ENCODING", \ "", \ "" ) @@ -11966,6 +12010,10 @@ "", \ "" ) +#:def_cmd_opt( "ENCODE", "BMG_ENDIAN", \ + "", \ + "" ) + #:def_cmd_opt( "ENCODE", "BMG_ENCODING", \ "", \ "" ) @@ -12042,6 +12090,10 @@ "", \ "" ) +#:def_cmd_opt( "PATCH", "BMG_ENDIAN", \ + "", \ + "" ) + #:def_cmd_opt( "PATCH", "BMG_ENCODING", \ "", \ "" ) @@ -12384,9 +12436,17 @@ "", \ "Print BMG messages as UTF-8 text without escape sequences." ) +#:def_opt( "BMG_ENDIAN", "bmg-endian|bmgendian", "CP", \ + "name", \ + "Force an endian for new BMG files. Accepted values are @BIG@ or @BE@" \ + " for big endian, @LITTLE@ or @LE@ for little endian and @AUTO@ for" \ + " automatic detection (default).\n" \ + " Mario Kart Wii uses big endian; the default if no other endian is" \ + " defined." ) + #:def_opt( "BMG_ENCODING", "bmg-encoding|bmgencoding", "CP", \ "name", \ - "Force a BMG encoding for new BMG files. Accepted encoding names are:" \ + "Force an encoding for new BMG files. Accepted encoding names are" \ " @CP-1252@, @UTF-16BE@ (or @UTF-16@), @SHIFT-JIS@, @UTF-8@ and @AUTO@" \ " for automatic detection (default). Same keywords without minus signs" \ " are accepted too.\n" \ @@ -12942,6 +13002,10 @@ "", \ "" ) +#:def_cmd_opt( "BMG", "BMG_ENDIAN", \ + "", \ + "" ) + #:def_cmd_opt( "BMG", "BMG_ENCODING", \ "", \ "" ) @@ -13271,6 +13335,10 @@ "", \ "" ) +#:def_cmd_opt( "CREATE", "BMG_ENDIAN", \ + "", \ + "" ) + #:def_cmd_opt( "CREATE", "BMG_ENCODING", \ "", \ "" ) @@ -19084,9 +19152,9 @@ #:def_opt( "PERFMON", "perf-mon|perfmon", "CO", \ "[=mode]", \ "Enable or disable the performance monitor. Mode is one of @OFF@," \ - " @AUTO@ (default, don't change setting), @ON@ (enable it for Wii" \ - " only; default, if option is used without parameter) or @FORCE@" \ - " (enable it for Wii and for Dolphin)." ) + " @AUTO@ (default, don't change setting), @ON@ (enable it for Wii and" \ + " Wii U only; default, if option is used without parameter) or @FORCE@" \ + " (enable it for Wii, Wii U and for Dolphin)." ) #:def_opt( "CUSTOM_TT", "custom-tt|customtt", "CO", \ "[=mode]", \ @@ -19100,6 +19168,13 @@ " @OFF@, @AUTO@ (default) or @ON@ (default, if option is used without" \ " parameter). Disable it only for tests!" ) +#: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)." ) + #:def_opt( "TRACK_DIR", "track-dir|trackdir", "CP", \ "directory", \ "Define a destination directory, where track files are copied, moved" \ @@ -19368,6 +19443,10 @@ "", \ "" ) +#:def_cmd_opt( "DUMP", "SPEEDOMETER", \ + "", \ + "" ) + #:def_cmd_opt( "DUMP", "LONG", \ "", \ "For LE-CODE binaries: If set, print cups with tracks or arenas. For" \ @@ -19413,6 +19492,10 @@ "", \ "" ) +#:def_cmd_opt( "DL", "SPEEDOMETER", \ + "", \ + "" ) + #:def_cmd_opt( "DL", "LONG", \ "", \ "For LE-CODE binaries: If set, print cups with tracks or arenas. For" \ @@ -19458,6 +19541,10 @@ "", \ "" ) +#:def_cmd_opt( "DLL", "SPEEDOMETER", \ + "", \ + "" ) + #:def_cmd_opt( "DLL", "LONG", \ "", \ "For LE-CODE binaries: If set, print cups with tracks or arenas. For" \ @@ -19511,6 +19598,10 @@ "", \ "" ) +#:def_cmd_opt( "PATCH", "SPEEDOMETER", \ + "", \ + "" ) + #:def_cmd_opt( "PATCH", "TRACK_DIR", \ "", \ "" ) @@ -19599,6 +19690,10 @@ "", \ "" ) +#:def_cmd_opt( "LPAR", "SPEEDOMETER", \ + "", \ + "" ) + #:def_cmd_opt( "LPAR", "DEST", \ "", \ "" ) @@ -19735,6 +19830,30 @@ "", \ "" ) +#:def_cmd_opt( "CREATE", "ENGINE", \ + "", \ + "" ) + +#:def_cmd_opt( "CREATE", "200CC", \ + "", \ + "" ) + +#:def_cmd_opt( "CREATE", "PERFMON", \ + "", \ + "" ) + +#:def_cmd_opt( "CREATE", "CUSTOM_TT", \ + "", \ + "" ) + +#:def_cmd_opt( "CREATE", "XPFLAGS", \ + "", \ + "" ) + +#:def_cmd_opt( "CREATE", "SPEEDOMETER", \ + "", \ + "" ) + #:def_cmd_opt( "CAT", "COMPLETE", \ "", \ "" ) diff --git a/project/src/wbmgt.c b/project/src/wbmgt.c index 25ba0a9..23ffec3 100644 --- a/project/src/wbmgt.c +++ b/project/src/wbmgt.c @@ -61,7 +61,7 @@ /////////////////////////////////////////////////////////////////////////////// #define TITLE WBMGT_SHORT ": " WBMGT_LONG " v" VERSION " r" REVISION \ - " " SYSTEM " - " AUTHOR " - " DATE + " " SYSTEM2 " - " AUTHOR " - " DATE // /////////////////////////////////////////////////////////////////////////////// @@ -96,7 +96,7 @@ static void version_exit() if ( brief_count > 1 ) fputs( VERSION "\n", stdout ); else if (brief_count) - fputs( VERSION " r" REVISION " " SYSTEM "\n", stdout ); + fputs( VERSION " r" REVISION " " SYSTEM2 "\n", stdout ); else if (print_sections) print_version_section(true); else if (long_count) @@ -291,7 +291,7 @@ static enumError cmd_extract() //--- search sections - const bmg_sect_list_t *sl = ScanSectionsBMG(raw.data,raw.data_size); + const bmg_sect_list_t *sl = ScanSectionsBMG(raw.data,raw.data_size,0); #if 0 { const bmg_sect_info_t *si; @@ -374,7 +374,7 @@ static enumError cmd_sections() continue; } - const bmg_sect_list_t *sl = ScanSectionsBMG(raw.data,raw.data_size); + const bmg_sect_list_t *sl = ScanSectionsBMG(raw.data,raw.data_size,0); if (!sl) { ERROR0(ERR_INVALID_DATA,"Can't scan binary BMG file: %s",raw.fname); @@ -398,15 +398,16 @@ static enumError cmd_sections() const uint seplen = 3*(56+max_info_len); printf( "\n" "%sFile: %s\n" - "%sSize: 0x%x = %u bytes, %u sections, encoding #%u (%s)\n" + "%sSize: 0x%x = %u bytes%s, %u sections, encoding #%u (%s)\n" "%s%.*s\n" "%s offset size sect cut head n(elem) n(e)\n" "%s hex hex size size magic size *size cut info\n" "%s%.*s%s\n" , colout->heading, param->arg, - colout->heading, sl->source_size, sl->source_size, sl->n_sections, - sl->header->encoding, + colout->heading, sl->source_size, sl->source_size, + sl->endian->is_be ? " BE" : sl->endian->is_le ? " LE" : "", + sl->n_sections, sl->header->encoding, GetEncodingNameBMG(sl->header->encoding,"?"), colout->heading, seplen, ThinLine300_3, colout->heading, @@ -815,6 +816,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_NO_HEADER: print_header = false; break; case GO_BRIEF: brief_count++; break; + case GO_BMG_ENDIAN: err += ScanOptBmgEndian(optarg); break; case GO_BMG_ENCODING: err += ScanOptBmgEncoding(optarg); break; case GO_BMG_INF_SIZE: err += ScanOptBmgInfSize(optarg,true); break; case GO_BMG_MID: err += ScanOptBmgMid(optarg); break; diff --git a/project/src/wctct.c b/project/src/wctct.c index e31671e..6220f09 100644 --- a/project/src/wctct.c +++ b/project/src/wctct.c @@ -49,7 +49,7 @@ /////////////////////////////////////////////////////////////////////////////// #define TITLE WCTCT_SHORT ": " WCTCT_LONG " v" VERSION " r" REVISION \ - " " SYSTEM " - " AUTHOR " - " DATE + " " SYSTEM2 " - " AUTHOR " - " DATE // /////////////////////////////////////////////////////////////////////////////// @@ -86,7 +86,7 @@ static void version_exit() if ( brief_count > 1 ) fputs( VERSION "\n", stdout ); else if (brief_count) - fputs( VERSION " r" REVISION " " SYSTEM "\n", stdout ); + fputs( VERSION " r" REVISION " " SYSTEM2 "\n", stdout ); else if (print_sections) print_version_section(true); else if (long_count) @@ -816,6 +816,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) print_header = output_mode.syntax = false; break; + case GO_BMG_ENDIAN: err += ScanOptBmgEndian(optarg); break; case GO_BMG_ENCODING: err += ScanOptBmgEncoding(optarg); break; case GO_BMG_INF_SIZE: err += ScanOptBmgInfSize(optarg,false); break; case GO_BMG_MID: err += ScanOptBmgMid(optarg); break; diff --git a/project/src/wimgt.c b/project/src/wimgt.c index d252be9..674b1ac 100644 --- a/project/src/wimgt.c +++ b/project/src/wimgt.c @@ -57,7 +57,7 @@ /////////////////////////////////////////////////////////////////////////////// #define TITLE WIMGT_SHORT ": " WIMGT_LONG " v" VERSION " r" REVISION \ - " " SYSTEM " - " AUTHOR " - " DATE + " " SYSTEM2 " - " AUTHOR " - " DATE // /////////////////////////////////////////////////////////////////////////////// @@ -92,7 +92,7 @@ static void version_exit() if ( brief_count > 1 ) fputs( VERSION "\n", stdout ); else if (brief_count) - fputs( VERSION " r" REVISION " " SYSTEM "\n", stdout ); + fputs( VERSION " r" REVISION " " SYSTEM2 "\n", stdout ); else if (print_sections) print_version_section(true); else if (long_count) diff --git a/project/src/wkclt.c b/project/src/wkclt.c index 2ef0bf5..8be86b4 100644 --- a/project/src/wkclt.c +++ b/project/src/wkclt.c @@ -47,7 +47,7 @@ /////////////////////////////////////////////////////////////////////////////// #define TITLE WKCLT_SHORT ": " WKCLT_LONG " v" VERSION " r" REVISION \ - " " SYSTEM " - " AUTHOR " - " DATE + " " SYSTEM2 " - " AUTHOR " - " DATE static const char autoname[] = "/course.kcl"; @@ -86,7 +86,7 @@ static void version_exit() if ( brief_count > 1 ) fputs( VERSION "\n", stdout ); else if (brief_count) - fputs( VERSION " r" REVISION " " SYSTEM "\n", stdout ); + fputs( VERSION " r" REVISION " " SYSTEM2 "\n", stdout ); else if (print_sections) print_version_section(true); else if (long_count) diff --git a/project/src/wkmpt.c b/project/src/wkmpt.c index b1709c2..29e1c83 100644 --- a/project/src/wkmpt.c +++ b/project/src/wkmpt.c @@ -50,7 +50,7 @@ /////////////////////////////////////////////////////////////////////////////// #define TITLE WKMPT_SHORT ": " WKMPT_LONG " v" VERSION " r" REVISION \ - " " SYSTEM " - " AUTHOR " - " DATE + " " SYSTEM2 " - " AUTHOR " - " DATE static const char autoname[] = "/course.kmp"; @@ -87,7 +87,7 @@ static void version_exit() if ( brief_count > 1 ) fputs( VERSION "\n", stdout ); else if (brief_count) - fputs( VERSION " r" REVISION " " SYSTEM "\n", stdout ); + fputs( VERSION " r" REVISION " " SYSTEM2 "\n", stdout ); else if (print_sections) print_version_section(true); else if (long_count) diff --git a/project/src/wlect.c b/project/src/wlect.c index b5deded..7a02f5e 100644 --- a/project/src/wlect.c +++ b/project/src/wlect.c @@ -49,7 +49,7 @@ /////////////////////////////////////////////////////////////////////////////// #define TITLE WLECT_SHORT ": " WLECT_LONG " v" VERSION " r" REVISION \ - " " SYSTEM " - " AUTHOR " - " DATE + " " SYSTEM2 " - " AUTHOR " - " DATE static const char autoname[] = "/course.lex"; @@ -88,7 +88,7 @@ static void version_exit() if ( brief_count > 1 ) fputs( VERSION "\n", stdout ); else if (brief_count) - fputs( VERSION " r" REVISION " " SYSTEM "\n", stdout ); + fputs( VERSION " r" REVISION " " SYSTEM2 "\n", stdout ); else if (print_sections) print_version_section(true); else if (long_count) @@ -814,6 +814,7 @@ static enumError cmd_create() { le_lpar_t lpar; InitializeLPAR(&lpar,true); + PatchLPAR(&lpar); lpar.limit_mode = LPM_FORCE_AUTOMATIC; err = SaveTextLPAR(&lpar,"-",false); } @@ -1095,6 +1096,10 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_PERFMON: err += ScanOptPerfMon(optarg); break; 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_TRACK_DIR: opt_track_dest = optarg; break; case GO_COPY_TRACKS: err += ScanOptTrackSource(optarg,TFMD_COPY); break; @@ -1123,6 +1128,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) #if 0 // BMG disabled for wlect case GO_RAW: raw_mode = true; break; + case GO_BMG_ENDIAN: err += ScanOptBmgEndian(optarg); break; case GO_BMG_ENCODING: err += ScanOptBmgEncoding(optarg); break; case GO_BMG_INF_SIZE: err += ScanOptBmgInfSize(optarg,false); break; case GO_BMG_MID: err += ScanOptBmgMid(optarg); break; diff --git a/project/src/wmdlt.c b/project/src/wmdlt.c index 8b112a3..9109f5c 100644 --- a/project/src/wmdlt.c +++ b/project/src/wmdlt.c @@ -46,7 +46,7 @@ /////////////////////////////////////////////////////////////////////////////// #define TITLE WMDLT_SHORT ": " WMDLT_LONG " v" VERSION " r" REVISION \ - " " SYSTEM " - " AUTHOR " - " DATE + " " SYSTEM2 " - " AUTHOR " - " DATE // /////////////////////////////////////////////////////////////////////////////// @@ -81,7 +81,7 @@ static void version_exit() if ( brief_count > 1 ) fputs( VERSION "\n", stdout ); else if (brief_count) - fputs( VERSION " r" REVISION " " SYSTEM "\n", stdout ); + fputs( VERSION " r" REVISION " " SYSTEM2 "\n", stdout ); else if (print_sections) print_version_section(true); else if (long_count) diff --git a/project/src/wpatt.c b/project/src/wpatt.c index 09c9814..a5b9905 100644 --- a/project/src/wpatt.c +++ b/project/src/wpatt.c @@ -46,7 +46,7 @@ /////////////////////////////////////////////////////////////////////////////// #define TITLE WPATT_SHORT ": " WPATT_LONG " v" VERSION " r" REVISION \ - " " SYSTEM " - " AUTHOR " - " DATE + " " SYSTEM2 " - " AUTHOR " - " DATE // /////////////////////////////////////////////////////////////////////////////// @@ -81,7 +81,7 @@ static void version_exit() if ( brief_count > 1 ) fputs( VERSION "\n", stdout ); else if (brief_count) - fputs( VERSION " r" REVISION " " SYSTEM "\n", stdout ); + fputs( VERSION " r" REVISION " " SYSTEM2 "\n", stdout ); else if (print_sections) print_version_section(true); else if (long_count) diff --git a/project/src/wstrt.c b/project/src/wstrt.c index a73248a..442249e 100644 --- a/project/src/wstrt.c +++ b/project/src/wstrt.c @@ -58,7 +58,7 @@ /////////////////////////////////////////////////////////////////////////////// #define TITLE WSTRT_SHORT ": " WSTRT_LONG " v" VERSION " r" REVISION \ - " " SYSTEM " - " AUTHOR " - " DATE + " " SYSTEM2 " - " AUTHOR " - " DATE // /////////////////////////////////////////////////////////////////////////////// @@ -93,7 +93,7 @@ static void version_exit() if ( brief_count > 1 ) fputs( VERSION "\n", stdout ); else if (brief_count) - fputs( VERSION " r" REVISION " " SYSTEM "\n", stdout ); + fputs( VERSION " r" REVISION " " SYSTEM2 "\n", stdout ); else if (print_sections) print_version_section(true); else if (long_count) diff --git a/project/src/wszst.c b/project/src/wszst.c index 366f4a7..9f85a58 100644 --- a/project/src/wszst.c +++ b/project/src/wszst.c @@ -71,10 +71,10 @@ /////////////////////////////////////////////////////////////////////////////// #define TITLE WSZST_SHORT ": " WSZST_LONG " v" VERSION " r" REVISION \ - " " SYSTEM " - " AUTHOR " - " DATE + " " SYSTEM2 " - " AUTHOR " - " DATE #define TOOLSET_TITLE TOOLSET_SHORT ": " TOOLSET_LONG " v" VERSION " r" REVISION \ - " " SYSTEM " - " AUTHOR " - " DATE + " " SYSTEM2 " - " AUTHOR " - " DATE // /////////////////////////////////////////////////////////////////////////////// @@ -187,7 +187,7 @@ static void version_exit() if ( brief_count > 1 ) fputs( VERSION "\n", stdout ); else if (brief_count) - fputs( VERSION " r" REVISION " " SYSTEM "\n", stdout ); + fputs( VERSION " r" REVISION " " SYSTEM2 "\n", stdout ); else if (print_sections) print_version_section(true); else if (long_count) @@ -1210,7 +1210,7 @@ enumError cmd_brsub() cb.szs = &szs; cb.mode = long_count; cb.sep_fw = 3*99; - IterateFilesSZS(&szs,check_brsub,&cb,false,-1,-1,SORT_NONE); + IterateFilesParSZS(&szs,check_brsub,&cb,false,false,-1,-1,SORT_NONE); line_count += cb.line_count; if ( print_header && cb.header_printed ) @@ -1345,9 +1345,9 @@ static enumError cmd_list ( int long_level ) printf("\n* Files of %s\n",param->arg); if ( long_count > 2 ) - IterateFilesSZS(&szs,PrintFileSZS,0,true,opt_recurse,opt_cut,opt_sort); + IterateFilesParSZS(&szs,PrintFileSZS,0,false,true,opt_recurse,opt_cut,opt_sort); else - IterateFilesSZS(&szs,list_func,0,false,opt_recurse,opt_cut,opt_sort); + IterateFilesParSZS(&szs,list_func,0,false,false,opt_recurse,opt_cut,opt_sort); ResetSZS(&szs); } @@ -1482,7 +1482,7 @@ static enumError cmd_ilist ( int long_level ) else if ( n_param > 1 ) printf("\n* Files of %s\n",param->arg); - IterateFilesSZS(&szs,ilist_func,0,false,-1,0,opt_sort); + IterateFilesParSZS(&szs,ilist_func,0,false,false,-1,0,opt_sort); ResetSZS(&szs); } @@ -1647,7 +1647,7 @@ static enumError cmd_memory() Minus300 ); } - IterateFilesSZS(&szs,memory_func,&dm,false,opt_recurse,opt_cut,SORT_OFFSET); + IterateFilesParSZS(&szs,memory_func,&dm,false,false,opt_recurse,opt_cut,SORT_OFFSET); ResetSZS(&szs); } @@ -1738,7 +1738,7 @@ static enumError cmd_sha1() return err; } - if ( opt_norm || need_norm > 0 ) + if ( opt_norm || need_norm > 0 || opt_rm_aiparam ) NormalizeSZS(&szs); char checksum[100]; @@ -1854,6 +1854,27 @@ static enumError cmd_sha1() /////////////// command analyze /////////////// /////////////////////////////////////////////////////////////////////////////// +static void SetupPrintScript ( PrintScript_t *ps ) +{ + DASSERT(ps); + + InitializePrintScript(ps); + ps->varname = script_varname; + ps->create_array = script_array > 0; + + 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"; @@ -1873,8 +1894,7 @@ static enumError cmd_analyze() InitializeFile(&fo); PrintScript_t ps; - InitializePrintScript(&ps); - ps.fo = &fo; + SetupPrintScript(&ps); ParamList_t *param; for ( param = first_param; param; param = param->next ) @@ -1928,6 +1948,7 @@ static enumError cmd_analyze() max_err = err; break; } + ps.f = fo.f; PrintScriptHeader(&ps); } @@ -2054,6 +2075,7 @@ static enumError cmd_analyze() if (!script_array) { PrintScriptFooter(&ps); + ps.f = 0; ResetFile(&fo,0); } } @@ -4113,7 +4135,7 @@ static enumError job_update up.update_sub = recurse_level < opt_recurse; up.indent = indent + 2; - IterateFilesSZS(szs,update_func,&up,false,0,-1,SORT_NONE); + IterateFilesParSZS(szs,update_func,&up,false,false,0,-1,SORT_NONE); return ERR_OK; } @@ -4745,8 +4767,7 @@ static enumError cmd_ghost() InitializeFile(&fo); PrintScript_t ps; - InitializePrintScript(&ps); - ps.fo = &fo; + SetupPrintScript(&ps); ParamList_t *param; for ( param = first_param; param; param = param->next ) @@ -4787,6 +4808,7 @@ static enumError cmd_ghost() max_err = err; break; } + ps.f = fo.f; PrintScriptHeader(&ps); } @@ -4816,6 +4838,7 @@ static enumError cmd_ghost() if (!script_array) { PrintScriptFooter(&ps); + ps.f = 0; ResetFile(&fo,0); } } @@ -5113,6 +5136,7 @@ static enumError CheckOptions ( int argc, char ** argv, bool is_env ) case GO_NO_PARAM: print_param = false; break; case GO_EPSILON: err += ScanOptEpsilon(optarg); break; + case GO_BMG_ENDIAN: err += ScanOptBmgEndian(optarg); break; case GO_BMG_ENCODING: err += ScanOptBmgEncoding(optarg); break; case GO_BMG_INF_SIZE: err += ScanOptBmgInfSize(optarg,false); break; case GO_BMG_MID: err += ScanOptBmgMid(optarg); break; diff --git a/project/src/wtest.c b/project/src/wtest.c index 83e2d81..8aadaab 100644 --- a/project/src/wtest.c +++ b/project/src/wtest.c @@ -72,7 +72,7 @@ #define NAME "wtest" #undef TITLE -#define TITLE NAME " v" VERSION " r" REVISION " " SYSTEM " - " AUTHOR " - " DATE +#define TITLE NAME " v" VERSION " r" REVISION " " SYSTEM2 " - " AUTHOR " - " DATE // /////////////////////////////////////////////////////////////////////////////// @@ -3758,6 +3758,43 @@ static enumError test_clock ( int argc, char ** argv ) // /////////////////////////////////////////////////////////////////////////////// +/////////////// test_endian() /////////////// +/////////////////////////////////////////////////////////////////////////////// + +static enumError test_endian ( int argc, char ** argv ) +{ + const int verbose = argc > 1 ? str2l(argv[1],0,0) : 0; + + printf("IS_BIG_ENDIAN=%d, IS_LITTLE_ENDIAN=%d\n\n", + IS_BIG_ENDIAN, IS_LITTLE_ENDIAN ); + + printf("BE_FUNC: bom=%02x,%02x, is_be=%u, is_le=%u, endian=%d\n", + be_func.bom[0], be_func.bom[1], + be_func.is_be, be_func.is_le, be_func.endian ); + if (verbose) + HexDump16(stdout,0,0,&be_func,sizeof(be_func)); + + printf("LE_FUNC: bom=%02x,%02x, is_be=%u, is_le=%u, endian=%d\n", + le_func.bom[0], le_func.bom[1], + le_func.is_be, le_func.is_le, le_func.endian ); + if (verbose) + HexDump16(stdout,0,0,&le_func,sizeof(le_func)); + 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) ); + printf("LE: h2n(1) = %x %x %llx / n2h(1) = %x %x %llx\n", + le_func.h2ns(1), le_func.h2nl(1), le_func.h2n64(1), + le_func.n2hs(1), le_func.n2hl(1), le_func.n2h64(1) ); + putchar('\n'); + return 0; +} + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// develop() /////////////// /////////////////////////////////////////////////////////////////////////////// @@ -3990,6 +4027,7 @@ enum CMD_SLOT_ATTRIB, // test_slot_attrib(argc,argv) CMD_SLOT_INFO, // test_slot_info(argc,argv) CMD_CLOCK, // test_clock(argc,argv) + CMD_ENDIAN, // test_endian(argc,argv) CMD__N }; @@ -4047,6 +4085,7 @@ static const KeywordTab_t CommandTab[] = { CMD_SLOT_ATTRIB, "SLOT-ATTRIB", "SA", 0 }, { CMD_SLOT_INFO, "SLOT-INFO", "SI", 0 }, { CMD_CLOCK, "CLOCK", 0, 0 }, + { CMD_ENDIAN, "ENDIAN", 0, 0 }, { CMD__N,0,0,0 } }; @@ -4175,6 +4214,7 @@ int main ( int argc, char ** argv ) case CMD_SLOT_ATTRIB: test_slot_attrib(argc,argv); break; 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_HELP: default: help_exit(); diff --git a/project/system.c b/project/system.c index 01c5b8f..2981af0 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-2012 by Dirk Clemens <wiimm@wiimm.de> * + * Copyright (c) 2011-2020 by Dirk Clemens <wiimm@wiimm.de> * * * *************************************************************************** * * diff --git a/project/templates/HISTORY.txt b/project/templates/HISTORY.txt index b7cd9e2..e8e8af9 100644 --- a/project/templates/HISTORY.txt +++ b/project/templates/HISTORY.txt @@ -417,6 +417,16 @@ szs v2.19b r8243 - 2020-08-03 - Bug fix for wlect LPAR: Message functions are not longer printed twice. +szs v2.20a r8279 - 2020-10-03 + + - Time stamps of the files are now managed in nanoseconds instead of seconds. + - wszst ANALYSE: New result "warn=": Print warnings about Item Position Bug + and self linked item routes with 1 point. + - wszst CHECK: Hints about unusual TEX version 1 are suppressed now if option + --verbose is not set. + - Fewer program crashes when reading faulty SZS files. + + @@MODULE(last-history.txt)@@ diff --git a/project/templates/module/last-history.txt b/project/templates/module/last-history.txt index c9505ab..31e7704 100644 --- a/project/templates/module/last-history.txt +++ b/project/templates/module/last-history.txt @@ -1,12 +1,20 @@ szs v@@VERSION@@ r@@REV-NEXT@@ - @@@@-@@-@@ - - Time stamps of the files are now managed in nanoseconds instead of seconds. - - wszst ANALYSE: New result "warn=": Print warnings about Item Position Bug - and self linked item routes with 1 point. - - wszst CHECK: Hints about unusual TEX version 1 are suppressed now if option - --verbose is not set. - - Fewer program crashes when reading faulty SZS files. - + - Windows only: 32 bit and 64 bit versions of Cygwin are supported now. + The 64 bit version is recommended. + - 32 bit version: Cygwin DLL 3.0.7 / 2019-04-30 + - 64 bit version: Cygwin DLL 3.1.7 / 2020-08-22 + - Support of LE-CODE build 25: + - Speedometer support for LPAR-files. + - New option for wlect: --speedometer=off/on + - Again fewer program crashes when reading faulty SZS files. + - BMG supports little endian files now, but only encoding UTF-8 was checked. + I need example files to verify other encodings (CP-1252,UTF-16,SHIFT-JIS). + - KCL/OBJ: Faces with any number of vertices are accepted now. Before there + was a limit of 50 vertices. + - Bug fix for CT-CODE/LE-CODE configuration file: Command 'S' stored a slot + number as single byte, so that only values between 0 and 255 were possible. + ~ - 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 ~ is possible to create a binary MDL by reading the internal data. This is diff --git a/project/text-files/lex.inc/lex-elem-set1-cr.inc b/project/text-files/lex.inc/lex-elem-set1-cr.inc index 541fc88..487f5b5 100644 --- a/project/text-files/lex.inc/lex-elem-set1-cr.inc +++ b/project/text-files/lex.inc/lex-elem-set1-cr.inc @@ -12,9 +12,9 @@ #------------------------- -# Online, items are only transmitted correctly, if the positions of all 3 axis -# are between -131071 and +131071. The following vector defines 3 factors to -# increase the range at the expense of accuracy. Factors <1.0 are set to 1.0. +# Online, item positions are only transmitted correctly, if the positions of +# all 3 axis are between -131071 and +131071. The following vector defines 3 +# factors to increase the range at the expense of accuracy. Factors <1.0 are +# ignored and set to 1.0. @ITEM-POS-FACTOR = v( %5.3f, %5.3f, %5.3f ) - diff --git a/project/text-files/lex.inc/lex-elem-set1-develop-cr.inc b/project/text-files/lex.inc/lex-elem-set1-develop-cr.inc new file mode 100644 index 0000000..41094ad --- /dev/null +++ b/project/text-files/lex.inc/lex-elem-set1-develop-cr.inc @@ -0,0 +1,8 @@ + +#------------------------- + +# The following settings are under development and experimental. Names and +# values can still change. Therefore, they should not be used, or at most +# experimentally. + +@FIX-ONLINE-DELAY = %u diff --git a/project/text-files/lex.inc/lex-setup-cr.inc b/project/text-files/lex.inc/lex-setup-cr.inc index d56bfdb..9ba1e5f 100644 --- a/project/text-files/lex.inc/lex-setup-cr.inc +++ b/project/text-files/lex.inc/lex-setup-cr.inc @@ -14,4 +14,4 @@ VERSION = %s REVISION = %u DATE = %s -# Statistics: List of all included sections: +# Statistics: List of all included sections (magic text+hex,size): 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 f01d07c..9b012cf 100644 --- a/project/text-files/lpar.inc/lpar-sect-param-cr.inc +++ b/project/text-files/lpar.inc/lpar-sect-param-cr.inc @@ -24,11 +24,11 @@ LIMIT-MODE = %s # expected. If 200cc is enabled, the values are for »150cc,200cc,mirror«. Any # number is accepted. They are normalized to get a total of 100 percent. # Use »0,1,0« to force 150cc. Use »0,0,0« to reset to Nintendo's VR based -# choice. Option --engine will override these settings. +# choice. Option --engine will overrides these settings. ENGINE = %u,%u,%u -# Enable (1) or disable (0) 200cc support. Option --200cc will override this +# Enable (1) or disable (0) 200cc support. Option --200cc will overrides this # setting. LE-CODE hasn't implemented this feature yet! ENABLE-200CC = %u @@ -36,21 +36,28 @@ ENABLE-200CC = %u # Enable (1) or disable (0) the performance monitor at Wii and Wii U. Enabling # is only possible if LIMIT-MODE is LE$TESTING or LE$EXPERIMENTAL. The special # value 2 enables it for Dolphin too, but only on LE$EXPERIMENTAL. It doesn't -# work correctly with Dolphin. Option --perf-mon will override this setting. +# work correctly with Dolphin. Option --perf-mon will overrides this setting. PERF-MONITOR = %u # Enable (1) or disable (0) Time Trial for custom tracks. Option --custom-tt -# will override this setting. +# will overrides this setting. 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 override this setting. +# Option --xpflags will 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 diff --git a/project/text-files/lpar.inc/lpar-sect-reserved-cr.inc b/project/text-files/lpar.inc/lpar-sect-reserved-cr.inc new file mode 100644 index 0000000..cc31ec0 --- /dev/null +++ b/project/text-files/lpar.inc/lpar-sect-reserved-cr.inc @@ -0,0 +1,6 @@ +#------------------------------------------------------------------------------ + +# 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. + |
