From b5b1fe7fc0cf460d6204c18ba7bb4c40f7597efa Mon Sep 17 00:00:00 2001 From: Wiimm Date: Tue, 11 Jul 2023 16:18:26 +0200 Subject: SZS v2.35a --- project/Makefile | 16 +- project/dclib/dclib-basics.h | 14 + project/dclib/dclib-debug.c | 44 ++- project/dclib/dclib-debug.h | 7 + project/dclib/dclib-numeric.c | 85 +++++ project/dclib/dclib-parser.c | 5 +- project/dclib/dclib-parser.h | 4 +- project/dclib/dclib-types.h | 3 + project/dclib/lib-mkw.c | 138 +++++++++ project/dclib/lib-mkw.h | 11 +- project/revision.sh | 2 +- project/src/lib-analyze.c | 22 +- project/src/lib-file.c | 7 +- project/src/lib-kmp-text.c | 2 +- project/src/lib-kmp.h | 4 +- project/src/lib-lecode.c | 81 ++++- project/src/lib-lecode.h | 72 ++++- project/src/lib-lex.c | 345 ++++++++++++++++++--- project/src/lib-lex.h | 54 +++- project/src/lib-mdl.c | 2 +- project/src/lib-numeric.c | 36 --- project/src/lib-parser-func.c | 4 + project/src/lib-pat.c | 2 +- project/src/lib-std.h | 2 +- project/src/lib-szs.h | 1 + project/src/prefix.inc | 187 +++++------ project/src/ui/tab-wlect.inc | 2 +- project/src/ui/tab-wszst.inc | 2 +- project/src/ui/ui-wlect.c | 6 +- project/src/ui/ui-wszst.c | 4 +- project/src/ui/ui.def | 10 +- project/src/wlect.c | 13 +- project/src/wszst.c | 2 + project/src/wtest.c | 165 ++++++++++ project/templates/HISTORY.txt | 15 + project/templates/module/last-history.txt | 17 +- project/text-files/kmp.inc/kmp-pt-info-cr.inc | 2 +- project/text-files/lex.inc/lex-elem-ritp-cr.inc | 47 +++ .../lex.inc/lex-elem-ritp-tabhead-cr.inc | 4 + project/text-files/lex.inc/lex-elem-set1-cr.inc | 9 + .../lex.inc/lex-elem-set1-develop-cr.inc | 4 +- project/text-files/lex.inc/lex-hexdump-cr.inc | 19 +- project/text-files/lex.inc/lex-hexdump-sep-cr.inc | 1 + project/text-files/lex.inc/lex-setup-cr.inc | 4 +- project/text-files/lpar.inc/lpar-sect-param-cr.inc | 14 + 45 files changed, 1240 insertions(+), 250 deletions(-) create mode 100644 project/text-files/lex.inc/lex-elem-ritp-cr.inc create mode 100644 project/text-files/lex.inc/lex-elem-ritp-tabhead-cr.inc create mode 100644 project/text-files/lex.inc/lex-hexdump-sep-cr.inc (limited to 'project') diff --git a/project/Makefile b/project/Makefile index 289fd8e..a125294 100644 --- a/project/Makefile +++ b/project/Makefile @@ -57,7 +57,7 @@ WPATT_LONG = Wiimms PAT Tool WSTRT_SHORT = wstrt WSTRT_LONG = Wiimms StaticR Tool -VERSION_NUM = 2.34a +VERSION_NUM = 2.35a BETA_VERSION = 0 # 0:off -1:"beta" >0:"beta#" @@ -147,7 +147,7 @@ DEFINES1 += -DUIOPT_INDEX_SIZE=320 # define max number of options (default 0x100 CFLAGS += $(DCLIB_CFLAGS) CFLAGS += -std=gnu99 -fomit-frame-pointer -fno-strict-aliasing -funroll-loops CFLAGS += -Wall -Wno-parentheses -Wno-unused-function -CFLAGS += -Wno-deprecated-declarations -Wno-gnu-variable-sized-type-not-at-end +CFLAGS += -Wno-deprecated-declarations CFLAGS += -O3 -Isrc -I$(UI) -I. DEPFLAGS += -MMD @@ -155,11 +155,11 @@ DEPFLAGS += -MMD #--- system depedent flags & libs ifeq ($(SYSTEM),mac) - CFLAGS += -I/usr/local/include -Wno-typedef-redefinition + CFLAGS += -I/usr/local/include -Wno-typedef-redefinition -Wno-gnu-variable-sized-type-not-at-end endif ifeq ($(SYSTEM_LINUX),1) - CFLAGS += -ffunction-sections -fdata-sections + CFLAGS += -ffunction-sections -fdata-sections -Wno-gnu-variable-sized-type-not-at-end LDFLAGS += -Xlinker --gc-sections #LDFLAGS += -Xlinker --print-gc-sections LIBS += -ltinfo @@ -170,6 +170,14 @@ ifeq ($(SYSTEM),cygwin) LDFLAGS += -static-libgcc endif +ifeq ($(SYSTEM2),cygwin32) + CFLAGS += -Wno-gnu-variable-sized-type-not-at-end +endif + +ifeq ($(SYSTEM2),cygwin64) + CFLAGS += -Wno-char-subscripts +endif + ifeq ($(shell expr $(GCC_VERSION) '>=' 7.0 ),1) ifneq ($(SYSTEM),mac) CFLAGS += -Wno-format-truncation diff --git a/project/dclib/dclib-basics.h b/project/dclib/dclib-basics.h index 3110e57..c03708a 100644 --- a/project/dclib/dclib-basics.h +++ b/project/dclib/dclib-basics.h @@ -4190,6 +4190,20 @@ char * PrintSize1024 sizeform_mode_t sform_mode // output format, bit field ); +//----------------------------------------------------------------------------- + +char * PrintHMS +( + char *buf, // result buffer + // NULL: use a local circulary static buffer + size_t buf_size, // size of 'buf', ignored if buf==NULL + + int seconds, // seconds to print + int min_seconds, // print only if 'seconds >= min_seconds' + ccp pre_text, // not NULL: Print text before H:M:S + ccp post_text // not NULL: Print text behind H:M:S +); + // /////////////////////////////////////////////////////////////////////////////// /////////////// scan size /////////////// diff --git a/project/dclib/dclib-debug.c b/project/dclib/dclib-debug.c index a5d978f..a3af57f 100644 --- a/project/dclib/dclib-debug.c +++ b/project/dclib/dclib-debug.c @@ -597,6 +597,21 @@ bool mark_used ( ccp name, ... ) /////////////// hexdump /////////////// /////////////////////////////////////////////////////////////////////////////// +uint HexDump ( FILE * f, int indent, u64 addr, int addr_fw, int row_len, + const void * p_data, size_t count ) +{ + // return the number of printed lines + if ( !f || !p_data || !count ) + return 0; + + XDump_t xd; + InitializeXDumpEx(&xd,f,indent,addr,addr_fw,row_len); + const int stat = XDump(&xd,p_data,count,true); + return stat < 0 ? 0 : stat; +} + +//----------------------------------------------------------------------------- + uint HexDump16 ( FILE * f, int indent, u64 addr, const void * data, size_t count ) { @@ -613,19 +628,32 @@ uint HexDump20 ( FILE * f, int indent, u64 addr, return HexDump(f,indent,addr,4,20,data,count); } -//----------------------------------------------------------------------------- +/////////////////////////////////////////////////////////////////////////////// -uint HexDump ( FILE * f, int indent, u64 addr, int addr_fw, int row_len, +uint HexDumpCRLF ( FILE * f, int indent, u64 addr, int addr_fw, int row_len, const void * p_data, size_t count ) +{ + const typeof(hexdump_eol)saved_eol = hexdump_eol; + hexdump_eol = "\r\n"; + const uint stat = HexDump(f,indent,addr,addr_fw,row_len,p_data,count); + hexdump_eol = saved_eol; + return stat; +} + +//----------------------------------------------------------------------------- + +uint HexDump16CRLF ( FILE * f, int indent, u64 addr, const void * data, size_t count ) { // return the number of printed lines - if ( !f || !p_data || !count ) - return 0; + return HexDumpCRLF(f,indent,addr,4,16,data,count); +} - XDump_t xd; - InitializeXDumpEx(&xd,f,indent,addr,addr_fw,row_len); - const int stat = XDump(&xd,p_data,count,true); - return stat < 0 ? 0 : stat; +//----------------------------------------------------------------------------- + +uint HexDump20CRLF ( FILE * f, int indent, u64 addr, const void * data, size_t count ) +{ + // return the number of printed lines + return HexDumpCRLF(f,indent,addr,4,20,data,count); } /////////////////////////////////////////////////////////////////////////////// diff --git a/project/dclib/dclib-debug.h b/project/dclib/dclib-debug.h index 7328770..4285f61 100644 --- a/project/dclib/dclib-debug.h +++ b/project/dclib/dclib-debug.h @@ -171,6 +171,13 @@ uint HexDump16 ( FILE * f, int indent, u64 addr, uint HexDump20 ( FILE * f, int indent, u64 addr, const void * data, size_t count ); +uint HexDumpCRLF ( FILE * f, int indent, u64 addr, int addr_fw, int row_len, + const void * p_data, size_t count ); +uint HexDump16CRLF ( FILE * f, int indent, u64 addr, + const void * data, size_t count ); +uint HexDump20CRLF ( FILE * f, int indent, u64 addr, + const void * data, size_t count ); + uint HexDumpBE2 ( FILE * f, int indent, u64 addr, int addr_fw, int row_len, const void * data, size_t count ); uint HexDump16BE2 ( FILE * f, int indent, u64 addr, diff --git a/project/dclib/dclib-numeric.c b/project/dclib/dclib-numeric.c index 6896b53..aa0ecd6 100644 --- a/project/dclib/dclib-numeric.c +++ b/project/dclib/dclib-numeric.c @@ -966,6 +966,41 @@ int CheckIndexCEnd ( int max, int * p_begin, int count ) return end - begin; } +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// struct IntMode_t /////////////// +/////////////////////////////////////////////////////////////////////////////// + +ccp GetIntModeName ( IntMode_t mode ) +{ + switch(mode) + { + case IMD_UNSET: return "-"; + + case IMD_BE0: return "BE"; + case IMD_BE1: return "BE1"; + case IMD_BE2: return "BE2"; + case IMD_BE3: return "BE3"; + case IMD_BE4: return "BE4"; + case IMD_BE5: return "BE5"; + case IMD_BE6: return "BE6"; + case IMD_BE7: return "BE7"; + case IMD_BE8: return "BE8"; + + case IMD_LE0: return "LE"; + case IMD_LE1: return "LE1"; + case IMD_LE2: return "LE2"; + case IMD_LE3: return "LE3"; + case IMD_LE4: return "LE4"; + case IMD_LE5: return "LE5"; + case IMD_LE6: return "LE6"; + case IMD_LE7: return "LE7"; + case IMD_LE8: return "LE8"; + + default: return "?"; + } +} + // /////////////////////////////////////////////////////////////////////////////// /////////////// lt/eq/gt /////////////// @@ -8336,6 +8371,56 @@ char * PrintSize1024 return buf; }; +//----------------------------------------------------------------------------- + +char * PrintHMS +( + char *buf, // result buffer + // NULL: use a local circulary static buffer + size_t buf_size, // size of 'buf', ignored if buf==NULL + + int seconds, // seconds to print + int min_seconds, // print only if 'seconds >= min_seconds' + ccp pre_text, // not NULL: Print text before H:M:S + ccp post_text // not NULL: Print text behind H:M:S +) +{ + if ( seconds < min_seconds ) + { + if (!buf) + return ""; + + *buf = 0; + return buf; + } + + if (!pre_text) + pre_text = ""; + if (!post_text) + post_text = ""; + + const ccp sign = seconds < 0 ? "-" : ""; + seconds = abs(seconds); + const int hours = seconds / 3600; + const int minutes = seconds % 3600 / 60; + seconds = seconds % 60; + + if (!buf) + return hours + ? PrintCircBuf("%s%s%u:%02u:%02u%s",pre_text,sign,hours,minutes,seconds,post_text) + : minutes + ? PrintCircBuf("%s%s%u:%02u%s",pre_text,sign,minutes,seconds,post_text) + : PrintCircBuf("%s%s%02us%s",pre_text,sign,seconds,post_text); + + if (hours) + snprintf(buf,buf_size,"%s%s%u:%02u:%02u%s",pre_text,sign,hours,minutes,seconds,post_text); + else if (minutes) + snprintf(buf,buf_size,"%s%s%u:%02u%s",pre_text,sign,minutes,seconds,post_text); + else + snprintf(buf,buf_size,"%s%s%02us%s",pre_text,sign,seconds,post_text); + return buf; +} + // /////////////////////////////////////////////////////////////////////////////// /////////////// scan size /////////////// diff --git a/project/dclib/dclib-parser.c b/project/dclib/dclib-parser.c index b64914f..a94b8c6 100644 --- a/project/dclib/dclib-parser.c +++ b/project/dclib/dclib-parser.c @@ -49,6 +49,7 @@ void SetupScanText ( ScanText_t *st, cvp data, uint data_size ) st->data = data; st->data_size = data_size; st->ignore_comments = true; + st->ignore_values = true; RewindScanText(st); } @@ -97,6 +98,7 @@ bool NextLineScanText ( ScanText_t *st ) { DASSERT(st); st->is_section = false; + st->is_value = false; ccp ptr = st->ptr; ccp eot = st->eot; @@ -120,7 +122,8 @@ bool NextLineScanText ( ScanText_t *st ) while ( eol > line && eol[-1] == ' ' || eol[-1] == '\t' ) eol--; - if ( line == eol || *line == '#' && st->ignore_comments ) + st->is_value = *line == '@'; + if ( line == eol || *line == '#' && st->ignore_comments || st->is_value && st->ignore_values ) continue; if ( st->detect_sections > 0 && *line == '[' diff --git a/project/dclib/dclib-parser.h b/project/dclib/dclib-parser.h index e9a4830..ff73a58 100644 --- a/project/dclib/dclib-parser.h +++ b/project/dclib/dclib-parser.h @@ -56,15 +56,17 @@ typedef struct ScanText_t //-- options bool ignore_comments; // true: ignore lines with leading '#' + bool ignore_values; // true: ignore lines with leading '@' int detect_sections; // >0: detect lines of format '[...]' - //-- current statee + //-- current state ccp ptr; // current text position ccp eot; // end of text ccp line; // current line ccp eol; // end of current line + bool is_value; // current line begins with '@' bool is_eot; // end of text reached bool is_section; // new section reached bool is_term; // := is_eot || is_section diff --git a/project/dclib/dclib-types.h b/project/dclib/dclib-types.h index 3d17081..2ef0de7 100644 --- a/project/dclib/dclib-types.h +++ b/project/dclib/dclib-types.h @@ -160,6 +160,9 @@ __attribute__ ((packed)) dcEndian_t; #define ALIGNOFF32(d,a) ((d)&~(u32)((a)-1)) #define ALIGNOFF64(d,a) ((d)&~(u64)((a)-1)) +#define MINMAX(v,min,max) ( v < min ? min : v > max ? max : v ) +#define MINMAX0(v,min,max) ( v == 0 ? 0 : v < min ? min : v > max ? max : v ) + // /////////////////////////////////////////////////////////////////////////////// /////////////// error codes /////////////// diff --git a/project/dclib/lib-mkw.c b/project/dclib/lib-mkw.c index 5213e72..da955a1 100644 --- a/project/dclib/lib-mkw.c +++ b/project/dclib/lib-mkw.c @@ -1322,6 +1322,63 @@ ccp GetVehicleName4 ( u8 vehicle ) /////////////// LE-CODE track flags /////////////// /////////////////////////////////////////////////////////////////////////////// +typedef struct use_color_t +{ + char *buf; // valid destination buffer + char *ptr; // current pointer for appends, if NULL: set to 'buf' first + uint size; // size of 'buf' + ColorSet_t *col; // valid color definition, never NULL + int index; // current color index: 0:off, 1:on, 2:bold +} +use_color_t; + +//----------------------------------------------------------------------------- + +static char * UseColor +( + // returns 'ucol.ptr' + use_color_t *ucol, // initialized data structure + int index, // next color + char ch // not NULL: Append character +) +{ + DASSERT(ucol); + DASSERT(ucol->buf); + DASSERT(ucol->col); + if (!ucol->ptr) + ucol->ptr = ucol->buf; + + ccp copy_src = 0; + int copy_len = 0; + if ( ucol->index != index ) + { + ucol->index = index; + switch (index) + { + case 1: copy_src = ucol->col->info; break; + case 2: copy_src = ucol->col->hint; break; + default: copy_src = ucol->col->reset; break; + } + copy_len = strlen(copy_src); + } + + if ( ucol->ptr + copy_len < ucol->buf + ucol->size - 1 ) + { + if (copy_len) + { + memcpy(ucol->ptr,copy_src,copy_len); + ucol->ptr += copy_len; + } + if (ch) + *ucol->ptr++ = ch; + } + + *ucol->ptr = 0; + return ucol->ptr; +} + +/////////////////////////////////////////////////////////////////////////////// + le_flags_t ScanLEFL ( ccp text ) { // automatic flags are not scannend! @@ -1378,6 +1435,21 @@ ccp PrintLEFL8 ( le_flags_t flags, bool aligned ) /////////////////////////////////////////////////////////////////////////////// +ccp PrintLEFL8col ( le_flags_t flags, bool aligned, ColorSet_t *col ) +{ + #if 1 + return PrintLEFL8(flags,aligned); + #else + if (!col) + return PrintLEFL8(flags,aligned); + + // ??? [[2do]] + return PrintLEFL8(flags,aligned); + #endif +} + +/////////////////////////////////////////////////////////////////////////////// + ccp PrintLEFL16 ( le_flags_t flags, bool aligned ) { char *buf = GetCircBuf(7); @@ -1445,6 +1517,72 @@ ccp PrintLEFL16 ( le_flags_t flags, bool aligned ) return buf; } +/////////////////////////////////////////////////////////////////////////////// + +ccp PrintLEFL16col ( le_flags_t flags, bool aligned, ColorSet_t *col ) +{ + if ( !col || (flags & ~G_LEFL__XALL) ) + return PrintLEFL16(flags,aligned); + + char buf[300]; + use_color_t ucol = { .buf = buf, .size = sizeof(buf), .col = col }; + + switch ( flags & (G_LEFL_BATTLE|G_LEFL_VERSUS|G_LEFL_RANDOM) ) + { + case G_LEFL_BATTLE: UseColor(&ucol,1,'B'); break; + case G_LEFL_VERSUS: UseColor(&ucol,0,'V'); break; + case G_LEFL_RANDOM: UseColor(&ucol,2,'r'); break; + default: + if ( aligned ) + UseColor(&ucol,0,'-'); + } + + switch ( flags & (G_LEFL_ORIG_CUP|G_LEFL_CUSTOM_CUP) ) + { + case G_LEFL_ORIG_CUP: UseColor(&ucol,0,'o'); break; + case G_LEFL_CUSTOM_CUP: UseColor(&ucol,1,'c'); break; + case G_LEFL_ORIG_CUP | G_LEFL_CUSTOM_CUP: UseColor(&ucol,2,'b'); break; + default: + if ( aligned ) + UseColor(&ucol,0,'-'); + } + + switch ( flags & (G_LEFL_RND_HEAD|G_LEFL_RND_GROUP) ) + { + case G_LEFL_RND_HEAD: UseColor(&ucol,1,'H'); break; + case G_LEFL_RND_GROUP: UseColor(&ucol,0,'G'); break; + case G_LEFL_RND_HEAD | G_LEFL_RND_GROUP: UseColor(&ucol,2,'X'); break; + default: + if ( aligned ) + UseColor(&ucol,0,'-'); + } + + switch ( flags & (G_LEFL_NEW|G_LEFL_TEXTURE) ) + { + case G_LEFL_NEW: UseColor(&ucol,0,'N'); break; + case G_LEFL_TEXTURE: UseColor(&ucol,1,'T'); break; + case G_LEFL_NEW | G_LEFL_TEXTURE: UseColor(&ucol,2,'2'); break; + default: + if ( aligned ) + UseColor(&ucol,0,'-'); + } + + if (aligned) + { + UseColor(&ucol,0, flags & G_LEFL_ALIAS ? 'A' : '-' ); + UseColor(&ucol,0, flags & G_LEFL_HIDDEN ? 'i' : '-' ); + } + else + { + if ( flags & G_LEFL_ALIAS ) UseColor(&ucol,0,'A'); + if ( flags & G_LEFL_HIDDEN ) UseColor(&ucol,0,'i'); + if ( ucol.ptr == buf ) + UseColor(&ucol,0,'-'); + } + + return CopyCircBuf0(buf,ucol.ptr-buf); +} + // /////////////////////////////////////////////////////////////////////////////// /////////////// distribution flags /////////////// diff --git a/project/dclib/lib-mkw.h b/project/dclib/lib-mkw.h index 71ef140..b0d7558 100644 --- a/project/dclib/lib-mkw.h +++ b/project/dclib/lib-mkw.h @@ -474,12 +474,19 @@ static inline bool IsRandomLEFL ( le_flags_t flags ) le_flags_t ScanLEFL ( ccp text ); -ccp PrintLEFL8 ( le_flags_t flags, bool aligned ); -ccp PrintLEFL16 ( le_flags_t flags, bool aligned ); +ccp PrintLEFL8 ( le_flags_t flags, bool aligned ); +ccp PrintLEFL16 ( le_flags_t flags, bool aligned ); + +// use PrintLEFL8() or PrintLEFL16() if col==0 +ccp PrintLEFL8col ( le_flags_t flags, bool aligned, ColorSet_t *col ); +ccp PrintLEFL16col ( le_flags_t flags, bool aligned, ColorSet_t *col ); static inline ccp PrintLEFL ( le_flags_t flags_bits, le_flags_t flags, bool aligned ) { return ( flags_bits == 16 ? PrintLEFL16 : PrintLEFL8 )(flags,aligned); } +static inline ccp PrintLEFLcol ( le_flags_t flags_bits, le_flags_t flags, bool aligned, ColorSet_t *col ) + { return ( flags_bits == 16 ? PrintLEFL16col : PrintLEFL8col )(flags,aligned,col); } + typedef ccp (*PrintLEFL_func) ( le_flags_t flags, bool aligned ); static inline PrintLEFL_func GetPrintLEFL ( uint flags_bits ) { return flags_bits == 16 ? PrintLEFL16 : PrintLEFL8; } diff --git a/project/revision.sh b/project/revision.sh index b3f9416..d2bf6d4 100644 --- a/project/revision.sh +++ b/project/revision.sh @@ -1 +1 @@ -revision=8786 +revision=8801 diff --git a/project/src/lib-analyze.c b/project/src/lib-analyze.c index 3f2049e..322a2bd 100644 --- a/project/src/lib-analyze.c +++ b/project/src/lib-analyze.c @@ -202,8 +202,9 @@ void AnalyzeSZS InitializeLEX(&lex); lex.check_only = true; ScanLEX(&lex,false,szs->course_lex_data,szs->course_lex_size); - szs->have.lex_sect = lex.have_sect; - szs->have.lex_feat = lex.have_feat; + szs->have.lex_sect = lex.have_sect; + szs->have.lex_feat = lex.have_feat; + szs->have.lex_apply_otl = lex.apply_otl; SetupLexInfo(&as->lexinfo,&lex); ResetLEX(&lex); } @@ -445,7 +446,24 @@ void AnalyzeSZS //--- finalize ct_attrib by "lex" and "warn" if (szs->course_lex_data) + { ct_dest = StringCopyE(ct_dest,ct_end,",lex"); + if ( szs->have.lex_apply_otl ) + { + if ( szs->have.lex_apply_otl < 100 ) + ct_dest = snprintfE(ct_dest,ct_end,",otl=%us",szs->have.lex_apply_otl); + else + { + uint sec = szs->have.lex_apply_otl % 60; + if (sec) + ct_dest = snprintfE(ct_dest,ct_end,",otl=%um%02u", + szs->have.lex_apply_otl / 60, sec ); + else + ct_dest = snprintfE(ct_dest,ct_end,",otl=%um", + szs->have.lex_apply_otl / 60 ); + } + } + } if (szs->warn_bits) ct_dest = StringCat2E(ct_dest,ct_end,",warn=",GetWarnSZSNames(szs->warn_bits,'+')); diff --git a/project/src/lib-file.c b/project/src/lib-file.c index 0bd1daa..5e4f7c4 100644 --- a/project/src/lib-file.c +++ b/project/src/lib-file.c @@ -4254,10 +4254,10 @@ enumError SavePrefixTable ( FILE *f, const mkw_prefix_t * tab ) fprintf(f, "#-------------------\r\n" "# %u prefixes total\r\n" - "# Max prefix len:%2u\r\n" - "# Max info len:%4u\r\n" + "# Max prefix len:%3u\r\n" + "# Max info len:%5u\r\n" ,count - ,fw_prefix + ,fw_prefix ,fw_info ); @@ -4653,6 +4653,7 @@ void ScanSha1Ref ( struct ScanText_t *st ) uint good_size = 0; + st->ignore_values = false; while ( NextLineScanText(st) ) { mem_t srcline = { .ptr = st->line, .len = st->eol - st->line }; diff --git a/project/src/lib-kmp-text.c b/project/src/lib-kmp-text.c index 161765e..036a311 100644 --- a/project/src/lib-kmp-text.c +++ b/project/src/lib-kmp-text.c @@ -6418,7 +6418,7 @@ enumError SaveTextKMP fprintf(F.f, "%s[SETUP]\r\n\r\n" "TOOL = %s\r\n" - "SYSTEM2 = %s\r\n" + "SYSTEM = %s\r\n" "VERSION = %s\r\n" "REVISION = %u\r\n" "DATE = %s\r\n" diff --git a/project/src/lib-kmp.h b/project/src/lib-kmp.h index c1c42cb..8de8ea1 100644 --- a/project/src/lib-kmp.h +++ b/project/src/lib-kmp.h @@ -494,7 +494,7 @@ __attribute__ ((packed)) kmp_poti_group_t; // [[kmp_poti_point_t]] typedef struct kmp_poti_point_t -{ +{ // Routes /*0x00*/ float32 position[3]; @@ -581,7 +581,7 @@ typedef struct kmp_stgi_entry_t { // Stage Information - /*0x00*/ u8 lap_count; // XML suggest but ignored + /*0x00*/ u8 lap_count; // XML suggest, used by lap_modifier /*0x01*/ u8 pole_pos; // 0:left, 1:right /*0x02*/ u8 narrow_start; // 0:normal, 1:closer together /*0x03*/ u8 enable_lens_flare; // 0:off, 1:enabled diff --git a/project/src/lib-lecode.c b/project/src/lib-lecode.c index 672aca5..5a859f4 100644 --- a/project/src/lib-lecode.c +++ b/project/src/lib-lecode.c @@ -1081,6 +1081,19 @@ bool LimitToLparMode ( le_lpar_t * lp, lpar_mode_t lpmode ) { lp->enable_perfmon = 1; modified = true; } } + #if 0 + // [[time-limit]] + if ( lpmode <= LPM_TESTING ) + { + if ( lp->default_online_sec > LE_MAX_ONLINE_SEC ) + { lp->default_online_sec = LE_MAX_ONLINE_SEC; modified = true; } + if ( lp->min_online_sec > LE_MAX_ONLINE_SEC ) + { lp->min_online_sec = LE_MAX_ONLINE_SEC; modified = true; } + if ( lp->max_online_sec > LE_MAX_ONLINE_SEC ) + { lp->max_online_sec = LE_MAX_ONLINE_SEC; modified = true; } + } + #endif + // [[new-lpar]] return modified; @@ -1266,6 +1279,10 @@ void InitializeLPAR ( le_lpar_t *lpar, bool load_lpar ) lpar->drag_blue_shell = 1; lpar->thcloud_frames = 300; lpar->block_textures = 1; +// [[time-limit]] + lpar->default_online_sec = LE_DEF_ONLINE_SEC; + lpar->min_online_sec = LE_DEF_ONLINE_SEC; + lpar->max_online_sec = LE_MAX_WD_ONLINE_SEC; // [[new-lpar]] @@ -1325,6 +1342,16 @@ static void NormalizeLPAR ( le_lpar_t * lp, int build ) lp->vs_worldwide &= 1; } +// [[time-limit]] + lp->default_online_sec = MINMAX( lp->default_online_sec, LE_MIN_ONLINE_SEC, LE_MAX_ONLINE_SEC ); + if ( !lp->min_online_sec || lp->min_online_sec > lp->max_online_sec ) + lp->min_online_sec = lp->max_online_sec = 0; + else + { + lp->min_online_sec = MINMAX( lp->min_online_sec, LE_MIN_ONLINE_SEC, LE_MAX_ONLINE_SEC ); + lp->max_online_sec = MINMAX( lp->max_online_sec, lp->min_online_sec, LE_MAX_ONLINE_SEC ); + } + // [[new-lpar]] #if 0 @@ -1418,6 +1445,14 @@ static void CopyLPAR2Data ( le_analyze_t * ana ) if ( offsetof(le_binpar_v1_t,staticr_points) < ana->param_size ) h->staticr_points = lp->staticr_points; +// [[time-limit]] + if ( offsetof(le_binpar_v1_t,default_online_sec) < ana->param_size ) + h->default_online_sec = htons(lp->default_online_sec); + if ( offsetof(le_binpar_v1_t,min_online_sec) < ana->param_size ) + h->min_online_sec = htons(lp->min_online_sec); + if ( offsetof(le_binpar_v1_t,max_online_sec) < ana->param_size ) + h->max_online_sec = htons(lp->max_online_sec); + // [[new-lpar]] } @@ -1574,6 +1609,13 @@ enumError WriteSectionLPAR ,lpar_std_flags( lpar->vs_textures & LE_M_TEXTURE ) ,lpar->block_textures ,lpar->staticr_points +// [[time-limit]] + ,LE_MIN_ONLINE_SEC ,PrintHMS(0,0,LE_MIN_ONLINE_SEC,LE_VIEW_ONLINE_HMS," (",")") + ,LE_MAX_ONLINE_SEC ,PrintHMS(0,0,LE_MAX_ONLINE_SEC,LE_VIEW_ONLINE_HMS," (",")") + ,LE_MAX_WD_ONLINE_SEC ,PrintHMS(0,0,LE_MAX_WD_ONLINE_SEC,LE_VIEW_ONLINE_HMS," (",")") + ,lpar->default_online_sec ,PrintHMS(0,0,lpar->default_online_sec,LE_VIEW_ONLINE_HMS," # ",0) + ,lpar->min_online_sec ,PrintHMS(0,0,lpar->min_online_sec,LE_VIEW_ONLINE_HMS," # ",0) + ,lpar->max_online_sec ,PrintHMS(0,0,lpar->max_online_sec,LE_VIEW_ONLINE_HMS," # ",0) ); } else @@ -1600,6 +1642,9 @@ enumError WriteSectionLPAR "VS-TEXTURES = %s\r\n" "BLOCK-TEXTURES = %u\r\n" "STATICR-POINTS = %u\r\n" + "DEF-ONLINE-SEC = %3u%s\r\n" + "MIN-ONLINE-SEC = %3u%s\r\n" + "MAX-ONLINE-SEC = %3u%s\r\n" ,GetLparModeName(CalcCurrentLparMode(lpar,true),export_count>0) ,lpar->cheat_mode ,lpar->engine[0],lpar->engine[1],lpar->engine[2] @@ -1619,6 +1664,10 @@ enumError WriteSectionLPAR ,lpar_std_flags( lpar->vs_textures & LE_M_TEXTURE ) ,lpar->block_textures ,lpar->staticr_points +// [[time-limit]] + ,lpar->default_online_sec ,PrintHMS(0,0,lpar->default_online_sec,LE_VIEW_ONLINE_HMS," # ",0) + ,lpar->min_online_sec ,PrintHMS(0,0,lpar->min_online_sec,LE_VIEW_ONLINE_HMS," # ",0) + ,lpar->max_online_sec ,PrintHMS(0,0,lpar->max_online_sec,LE_VIEW_ONLINE_HMS," # ",0) ); } @@ -2090,6 +2139,15 @@ enumError AnalyzeLEBinary ana->lpar.staticr_points = p->staticr_points; } + if ( param_size >= sizeof(le_binpar_v1_270_t) ) + { +// [[time-limit]] + le_binpar_v1_270_t *p = (le_binpar_v1_270_t*)(data+off_param); + ana->lpar.default_online_sec = ntohs(p->default_online_sec); + ana->lpar.min_online_sec = ntohs(p->min_online_sec); + ana->lpar.max_online_sec = ntohs(p->max_online_sec); + } + // [[new-lpar]] break; @@ -2547,11 +2605,11 @@ static ccp GetSlotInfo return flags & G_LEFL_ALIAS ? PrintCircBuf("[%s->%4x %s,%s] ", col->differ, TrackByAliasLE(prop,music), - col->reset, PrintLEFL(ana->flags_bits,flags,true) ) + col->reset, PrintLEFLcol(ana->flags_bits,flags,true,col) ) : PrintCircBuf("[%s%s%s,%s%s%s,%s]%c", prop1, propx, prop0, music1, musicx, music0, - PrintLEFL(ana->flags_bits,flags,true), warn_list[warn] ); + PrintLEFLcol(ana->flags_bits,flags,true,col), warn_list[warn] ); } if (col) @@ -3250,6 +3308,21 @@ void DumpLEAnalyse ( FILE *f, uint indent, const le_analyze_t *ana ) ); } + if ( ana->param_size >= sizeof(le_binpar_v1_270_t) ) + { +// [[time-limit]] + const uint def = ntohs(h->default_online_sec); + const uint min = ntohs(h->min_online_sec); + const uint max = ntohs(h->max_online_sec); + fprintf(f, + "%*s" "Online time limit: %us%s / Range for LEX: %us%s .. %us%s\n" + ,indent,"" + ,def, PrintHMS(0,0,def,LE_VIEW_ONLINE_HMS," (",")") + ,min, PrintHMS(0,0,min,LE_VIEW_ONLINE_HMS," (",")") + ,max, PrintHMS(0,0,max,LE_VIEW_ONLINE_HMS," (",")") + ); + } + // [[new-lpar]] #if 0 // for later use @@ -3959,6 +4032,10 @@ static enumError ScanTextLPAR_PARAM { "VS-TEXTURES", SPM_U8, &lpar->vs_textures }, { "BLOCK-TEXTURES", SPM_U8, &lpar->block_textures }, { "STATICR-POINTS", SPM_U8, &lpar->staticr_points }, +// [[time-limit]] + { "DEF-ONLINE-SEC", SPM_U16, &lpar->default_online_sec }, + { "MIN-ONLINE-SEC", SPM_U16, &lpar->min_online_sec }, + { "MAX-ONLINE-SEC", SPM_U16, &lpar->max_online_sec }, // [[new-lpar]] {0} diff --git a/project/src/lib-lecode.h b/project/src/lib-lecode.h index 0793d6c..c2b6a81 100644 --- a/project/src/lib-lecode.h +++ b/project/src/lib-lecode.h @@ -62,6 +62,13 @@ #define LE_RESERVED_SLOTS (LE_FIRST_CT_SLOT - 32) #define LE_MAX_BLOCK_TRACK 50 +// [[time-limit]] +#define LE_DEF_ONLINE_SEC 340 // 5:40 : default online time limit +#define LE_MIN_ONLINE_SEC 30 // 0:30 : min accepted online time limit +#define LE_MAX_WD_ONLINE_SEC 525 // 8:45 : max online time limit for enabled watchdog +#define LE_MAX_ONLINE_SEC 0xffff // 18:12:15 : max possible online time limit +#define LE_VIEW_ONLINE_HMS 61 // 1:01 : min value when time is printed as additonal HMS + //----------------------------------------------------------------------------- // [[le_valid_t]] @@ -284,7 +291,6 @@ ccp PatchNameLEREG ( char *buf, uint bufsize, ccp name, le_region_t lereg ); const mem_t GetLecodeLEREG ( le_region_t reg ); - //----------------------------------------------------------------------------- // some more global functions, used as helpers for *LEREG functions @@ -313,6 +319,10 @@ typedef struct le_lpar_t lpar_mode_t limit_mode; // limit of other params u16 thcloud_frames; // number of frames a player is small after thundercloud hit +// [[time-limit]] + u16 default_online_sec; // default time limit in seconds + u16 min_online_sec; // minimal time limit in seconds, that can be set by LEX:SET1 + u16 max_online_sec; // maximal time limit in seconds, that can be set by LEX:SET1 u8 cheat_mode; // 0:off, 1:debug only, 2:allow all u8 engine[3]; // 100cc, 150cc, mirror (sum always 100) @@ -933,12 +943,68 @@ typedef struct le_binpar_v1_26a_t } __attribute__ ((packed)) le_binpar_v1_26a_t; -_Static_assert(sizeof(le_binpar_v1_26a_t)==0x26a,"le_binpar_v1_26a_t"); +//----------------------------------------------------------------------------- +// [[le_binpar_v1_270_t]] + +typedef struct le_binpar_v1_270_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 flags + + /*030*/ u8 engine[3]; // 100cc, 150cc, mirror (sum always 100) + /*033*/ u8 enable_200cc; // TRUE: 200C enabled => 150cc, 200cc, mirror + /*034*/ u8 enable_perfmon; // >0: performance monitor enabled; >1: for dolphin too + /*035*/ u8 enable_custom_tt; // TRUE: time trial for cusotm tracks enabled + /*036*/ u8 enable_xpflags; // TRUE: extended presence flags enabled + /*037*/ u8 block_track; // block used track for 0.. tracks + /*038*/ u16 chat_mode_1[BMG_N_CHAT]; // mode for each chat message + /*0f8*/ u16 chat_mode_2[BMG_N_CHAT]; // mode for each chat message + /*1b8*/ u8 enable_speedo; // speedometer selection (0..2), see SPEEDO_* + /*1b9*/ u8 no_speedo_if_debug; // if bit is set: suppress speedometer + /*1ba*/ u8 debug_mode; // debug mode (0..), see DEBUGMD_* + /*1bb*/ u8 item_cheat; // 0:disabled, 1:enabled + + /*1bc*/ u8 debug_predef[LEDEB__N_CONFIG]; + // information about used predefined mode + /*1c0*/ u32 debug[LEDEB__N_CONFIG][LEDEB__N_LINE]; + // debug line settings, see LEDEB_* + + /*260*/ u8 cheat_mode; // 0:off, 1:debug only, 2:allow all + /*261*/ u8 drag_blue_shell; // >0: allow dragging of blue shell + /*262*/ u16 thcloud_frames; // number of frames a player is small after thundercloud hit + + /*264*/ u8 bt_worldwide; // >0: enable worldwide battles + /*265*/ u8 vs_worldwide; // >0: enable worldwide versus races + /*266*/ u8 bt_textures; // &1: enable texture hacks for battles, &2:alternable + /*267*/ u8 vs_textures; // &1: enable texture hacks for versus, &2:alternable + /*268*/ u8 block_textures; // >0: enable blocking of recent texture hacks + /*269*/ u8 staticr_points; // >0: use points definied by StaticR.rel + +// [[time-limit]] + /*26a*/ u16 default_online_sec; // default time limit in seconds + /*26c*/ u16 min_online_sec; // minimal time limit in seconds, that can be set by LEX:SET1 + /*26e*/ u16 max_online_sec; // maximal time limit in seconds, that can be set by LEX:SET1 + + /*270*/ +} +__attribute__ ((packed)) le_binpar_v1_270_t; + +_Static_assert(sizeof(le_binpar_v1_270_t)==0x270,"le_binpar_v1_270_t"); //----------------------------------------------------------------------------- // [[le_binpar_v1_t]] [[new-lpar]] -typedef struct le_binpar_v1_26a_t le_binpar_v1_t; +typedef struct le_binpar_v1_270_t le_binpar_v1_t; // /////////////////////////////////////////////////////////////////////////////// diff --git a/project/src/lib-lex.c b/project/src/lib-lex.c index 0a37bfe..a786477 100644 --- a/project/src/lib-lex.c +++ b/project/src/lib-lex.c @@ -161,7 +161,9 @@ static const feature_var_t lex_section_list[] = DEF_VAR( 0,HAVELEXS_SET1, lex_sect_set1, "LEX section SET1" ), DEF_VAR( 0,HAVELEXS_CANN, lex_sect_cann, "LEX section CANN" ), DEF_VAR( 0,HAVELEXS_HIPT, lex_sect_hipt, "LEX section HIPT" ), + DEF_VAR( 0,HAVELEXS_RITP, lex_sect_ritp, "LEX section RITP" ), + // [[new-lex-sect]] {0,0,0,0,0} }; @@ -174,6 +176,10 @@ static const feature_var_t lex_feature_list[] = DEF_VAR( 0,HAVELEXF_CANNON, lex_cannon, "LEX: Alternative cannon settings" ), DEF_VAR( 0,HAVELEXF_HIDE_POS, lex_hide_pos, "LEX: Hide position tracker conditionally" ), DEF_VAR( 0,HAVELEXF_START_ITEM, lex_start_item, "LEX: Player can get item before start of race." ), + DEF_VAR( 0,HAVELEXF_APPLY_OTL, lex_apply_otl, "LEX: Track applies alternative online time limit." ), + DEF_VAR( 0,HAVELEXF_RND_ITPH, lex_rnd_itph, "LEX: Random next links @KMP:ITPH." ), + + // [[new-lex-sect]] {0,0,0,0,0} }; @@ -566,12 +572,17 @@ const features_szs_t * GetFeaturesModes() m.lex_sect_set1 = FZM_GAMEPLAY | FZM_M_TYPE | FZM_ONLINE | FZM_SECTION; m.lex_sect_cann = FZM_GAMEPLAY | FZM_M_TYPE | FZM_M_WHERE | FZM_SECTION; m.lex_sect_hipt = FZM_VISUAL | FZM_M_TYPE | no_timetrial | FZM_SECTION; + m.lex_sect_ritp = FZM_GAMEPLAY | FZM_M_TYPE | no_timetrial | FZM_SECTION; + + // [[new-lex-sect]] m.lex_test_active = FZM_VISUAL | FZM_GAMEPLAY | FZM_M_TYPE | no_timetrial; m.lex_item_range = FZM_GAMEPLAY | FZM_M_TYPE | FZM_ONLINE; m.lex_cannon = FZM_GAMEPLAY | FZM_M_TYPE | FZM_M_WHERE; m.lex_hide_pos = FZM_VISUAL | FZM_M_TYPE | no_timetrial; m.lex_start_item = FZM_GAMEPLAY | FZM_M_TYPE | FZM_ONLINE; + m.lex_apply_otl = FZM_GAMEPLAY | FZM_M_TYPE | FZM_ONLINE; + m.lex_rnd_itph = FZM_GAMEPLAY | FZM_M_TYPE | no_timetrial; #if CHECK_FEATURES uint err_count = 0; @@ -796,6 +807,7 @@ lex_element_t * FindLexElement ( lex_header_t *head, uint data_size, u32 magic ) typedef void (*FixElementFunc) ( lex_t * lex, lex_item_t * item ); +/////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// static void FixLEXElement_SET1 ( lex_set1_t *set1 ) @@ -811,6 +823,12 @@ static void FixLEXElement_SET1 ( lex_set1_t *set1 ) } set1->start_item = set1->start_item > 0; + +// [[time-limit]] + set1->apply_online_sec = htons(MINMAX0( ntohs(set1->apply_online_sec), + LE_MIN_ONLINE_SEC, LE_MAX_ONLINE_SEC )); + + // [[new-lex-set1]] } //----------------------------------------------------------------------------- @@ -830,7 +848,6 @@ static void FixLEXItem_SET1 } //----------------------------------------------------------------------------- -// [[+]] static void ClearLEXElement_SET1 ( lex_set1_t *set1 ) { @@ -840,7 +857,6 @@ static void ClearLEXElement_SET1 ( lex_set1_t *set1 ) } //----------------------------------------------------------------------------- -// [[+]] static bool IsActiveLEXElement_SET1 ( const lex_set1_t *set1 ) { @@ -853,7 +869,11 @@ static bool IsActiveLEXElement_SET1 ( const lex_set1_t *set1 ) /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -// [[+]] + +// [[new-lex-sect]] upto 4 functions, see SET1 above + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// static void FixLEXElement_TEST ( lex_test_t *lt ) { @@ -884,7 +904,6 @@ static void FixLEXElement_TEST ( lex_test_t *lt ) } //----------------------------------------------------------------------------- -// [[+]] static void FixLEXItem_TEST ( @@ -901,7 +920,6 @@ static void FixLEXItem_TEST } //----------------------------------------------------------------------------- -// [[+]] static void ClearLEXElement_TEST ( lex_test_t *lt ) { @@ -910,7 +928,6 @@ static void ClearLEXElement_TEST ( lex_test_t *lt ) } //----------------------------------------------------------------------------- -// [[+]] static bool IsActiveLEXElement_TEST ( const lex_test_t *lt ) { @@ -951,6 +968,7 @@ static uint GetLexSortOrder ( u32 magic ) case LEXS_FEAT: return 1; case LEXS_SET1: return 2; case LEXS_TEST: return 9; + // [[new-lex-sect]] default: return 5; } } @@ -975,7 +993,7 @@ static void UpdateHaveLex ( lex_t *lex ) && size >= have_lex_sect_info[j].min_size ) { have_sect |= 1 << j; - have_feat |= GetLexFeatures(&(*ss)->elem); + have_feat |= GetLexFeatures(&(*ss)->elem,lex); break; } } @@ -1050,6 +1068,8 @@ static lex_item_t * AppendElementLEX size4 = ALIGN32(sizeof(lex_set1_t),4); break; + // [[new-lex-sect]] + case LEXS_TEST: if ( size4 < sizeof(lex_test_t) ) size4 = ALIGN32(sizeof(lex_test_t),4); @@ -1155,8 +1175,10 @@ static void SortItemsLEX /////////////// LEX features /////////////// /////////////////////////////////////////////////////////////////////////////// -static uint GetLexFeaturesSET1 ( const lex_element_t *elem ) +static uint GetLexFeaturesSET1 ( const lex_element_t *elem, lex_t *lex ) { + // if 'lex' not NULL: store additional data + uint have_feat = 0; const uint size = ntohl(elem->size); const lex_set1_t *set1 = (lex_set1_t*)elem->data; @@ -1175,6 +1197,20 @@ static uint GetLexFeaturesSET1 ( const lex_element_t *elem ) if ( size > offsetof(lex_set1_t,start_item) && set1->start_item ) have_feat |= 1 << HAVELEXF_START_ITEM; +// [[time-limit]] + if ( size > offsetof(lex_set1_t,apply_online_sec) ) + { + const uint apply_otl = ntohs(set1->apply_online_sec); + if (apply_otl) + { + have_feat |= 1 << HAVELEXF_APPLY_OTL; + if (lex) + lex->apply_otl = apply_otl; + } + } + + // [[new-lex-set1]] + return have_feat; } @@ -1197,6 +1233,14 @@ static uint GetLexFeaturesHIPT ( const lex_element_t *elem ) //----------------------------------------------------------------------------- +static uint GetLexFeaturesRITP ( const lex_element_t *elem ) +{ + return ntohl(elem->size) >= sizeof(lex_ritp_rule_t) + ? 1 << HAVELEXF_RND_ITPH : 0; +} + +//----------------------------------------------------------------------------- + static uint GetLexFeaturesTEST ( const lex_element_t *elem ) { DASSERT(elem); @@ -1206,14 +1250,18 @@ static uint GetLexFeaturesTEST ( const lex_element_t *elem ) //----------------------------------------------------------------------------- -uint GetLexFeatures ( const lex_element_t *elem ) +uint GetLexFeatures ( const lex_element_t *elem, lex_t *lex ) { + // if 'lex' not NULL: store additional data + switch(ntohl(elem->magic)) { - case LEXS_SET1: return GetLexFeaturesSET1(elem); + case LEXS_SET1: return GetLexFeaturesSET1(elem,lex); case LEXS_CANN: return GetLexFeaturesCANN(elem); case LEXS_HIPT: return GetLexFeaturesHIPT(elem); + case LEXS_RITP: return GetLexFeaturesRITP(elem); case LEXS_TEST: return GetLexFeaturesTEST(elem); + // [[new-lex-sect]] } return 0; } @@ -1227,7 +1275,9 @@ const have_lex_info_t have_lex_feat_info[HAVELEXF__N] = { HAVELEXF_CANNON, "cannon", 0 }, { HAVELEXF_HIDE_POS, "hipt", 0 }, { HAVELEXF_START_ITEM, "startitem", 0 }, - //--- add new sections here (order is important) + { HAVELEXF_APPLY_OTL, "apply-otl", 0 }, + { HAVELEXF_RND_ITPH, "rnd-itph", 0 }, + //--- add new elements here (order is important) }; /////////////////////////////////////////////////////////////////////////////// @@ -1266,7 +1316,9 @@ const have_lex_info_t have_lex_sect_info[HAVELEXS__N] = { LEXS_TEST, "test", 1 }, // HAVELEXS_TEST { LEXS_HIPT, "hidepos", sizeof(lex_hipt_rule_t) }, // HAVELEXS_HIPT { LEXS_FEAT, "features", 2 }, // HAVELEXS_FEAT + { LEXS_RITP, "rnditph", sizeof(lex_ritp_rule_t) }, // HAVELEXS_RITP //--- add new sections here (order is important) + // [[new-lex-sect]] }; /////////////////////////////////////////////////////////////////////////////// @@ -1349,6 +1401,9 @@ void UpdateLEX ( lex_t * lex, bool add_missing, bool add_test ) //--- HIPT AppendHiptLEX(lex,false); + + //--- RITP + AppendRitpLEX(lex,false); } if (add_test) //--- TEST @@ -1387,14 +1442,21 @@ lex_item_t * AppendSet1LEX ( lex_t * lex, bool overwrite ) lex_item_t * AppendCannLEX ( lex_t * lex, bool overwrite ) { return AppendElementLEX( lex, LEXS_CANN, CannonDataLEX, - sizeof(CannonDataLEX), overwrite); + sizeof(CannonDataLEX), overwrite ); } //----------------------------------------------------------------------------- lex_item_t * AppendHiptLEX ( lex_t * lex, bool overwrite ) { - return AppendElementLEX( lex, LEXS_HIPT, 0, 0, overwrite); + return AppendElementLEX( lex, LEXS_HIPT, 0, 0, overwrite ); +} + +//----------------------------------------------------------------------------- + +lex_item_t * AppendRitpLEX ( lex_t * lex, bool overwrite ) +{ + return AppendElementLEX( lex, LEXS_RITP, 0, 0, overwrite ); } //----------------------------------------------------------------------------- @@ -1402,9 +1464,11 @@ lex_item_t * AppendHiptLEX ( lex_t * lex, bool overwrite ) lex_item_t * AppendTestLEX ( lex_t * lex, bool overwrite ) { return AppendElementLEX( lex, LEXS_TEST, TestDataLEX, - sizeof(TestDataLEX), overwrite); + sizeof(TestDataLEX), overwrite ); } +// [[new-lex-sect]] + /////////////////////////////////////////////////////////////////////////////// void DumpElementsLEX ( FILE *f, lex_t *lex, bool hexdump ) @@ -1604,7 +1668,10 @@ typedef enum lex_section_id LID_SETTINGS1, LID_CANNON, LID_HIDE_PT, + LID_RND_ITPH, LID_TEST, + + // [[new-lex-sect]] } lex_section_id; @@ -1623,8 +1690,10 @@ static const KeywordTab_t lex_section_name[] = { LID_SETTINGS1, "SET1", "Basic settings", 0 }, { LID_CANNON, "CANN", "Cannon settings", 0 }, { LID_HIDE_PT, "HIPT", "Hide position tracker", 0 }, + { LID_RND_ITPH, "RITP", "Random next-links @KMP:ITPH", 0 }, { LID_TEST, "TEST", "Test case", 0 }, + // [[new-lex-sect]] { 0,0,0,0 } }; @@ -1743,15 +1812,10 @@ static enumError ScanLEXElement_SET1 { { "ITEM-POS-FACTOR", SPM_FLOAT3_BE, &set1.item_factor }, { "START-ITEM", SPM_U8, &set1.start_item }, - - // renamed at 2021-05-12 - { "TEST1", SPM_U8, &set1.start_item }, // [[obsolete]] 2022 - { "TEST2", SPM_U8, &set1.test_0d }, // [[obsolete]] 2022 - { "TEST_0D", SPM_U8, &set1.test_0d }, - { "TEST3", SPM_U8, &set1.test_0e }, // [[obsolete]] 2022 - { "TEST_0E", SPM_U8, &set1.test_0e }, - { "TEST4", SPM_U8, &set1.test_0f }, // [[obsolete]] 2022 - { "TEST_0F", SPM_U8, &set1.test_0f }, + { "PADDING-0D", SPM_U8, &set1.padding_0d }, +// [[time-limit]] + { "APPLY-ONLINE-SEC", SPM_U16_BE, &set1.apply_online_sec }, + // [[new-lex-set1]] {0} }; @@ -1903,6 +1967,60 @@ static enumError ScanLEXElement_HIPT /////////////////////////////////////////////////////////////////////////////// +static enumError ScanLEXElement_RITP +( + lex_t * lex, // KMP data structure + ScanInfo_t * si // valid data +) +{ + DASSERT(lex); + DASSERT(si); + TRACE("ScanLEXElement_HIPT()\n"); + + + //--- setup data + + ScanParam_t ptab[] = + { + {0} + }; + + char fb_buf[1000]; + FastBuf_t *fb = InitializeFastBuf(fb_buf,sizeof(fb_buf)); + + + //--- main loop + + for(;;) + { + char ch = NextCharSI(si,true); + if ( !ch || ch == '[' ) + break; + + if ( ch == '@' ) + { + ScanParamSI(si,ptab); + continue; + } + + u8 num[sizeof(lex_ritp_rule_t)] = {0}; + ScanU8SI(si,num,sizeof(num)-1,false); + if (NextCharSI(si,false)) + ScanU8SI(si,num+sizeof(num)-1,1,false); + AppendFastBuf(fb,num,sizeof(num)); + CheckEolSI(si); + } + + AppendElementLEX(lex,LEXS_RITP,fb->buf,fb->ptr-fb->buf,true); + ResetFastBuf(fb); + + return ERR_OK; +} + +/////////////////////////////////////////////////////////////////////////////// +// [[new-lex-sect]] +/////////////////////////////////////////////////////////////////////////////// + static enumError ScanLEXElement_TEST ( lex_t * lex, // KMP data structure @@ -2045,11 +2163,17 @@ enumError ScanTextLEX err = ScanLEXElement_HIPT(lex,&si); break; + case LID_RND_ITPH: + err = ScanLEXElement_RITP(lex,&si); + break; + + // [[new-lex-sect]] + case LID_TEST: err = ScanLEXElement_TEST(lex,&si); break; - default: + default: err = ERROR0(ERR_WARNING,"Unknown section (ignored): %s\n",sect_name); break; } @@ -2273,7 +2397,7 @@ static enumError SaveTextLEX_FEAT DASSERT(item); const uint size = ntohl(item->elem.size); - noPRINT("SaveTextLEX_SET1(), size=%u\n",size); + noPRINT("SaveTextLEX_FEAT(), size=%u\n",size); DASSERT( size >= sizeof(lex_set1_t) ); if ( size < sizeof(features_szs_t)) return ERR_OK; @@ -2288,7 +2412,7 @@ static enumError SaveTextLEX_FEAT ps.force_case = LOUP_UPPER; int comments = -1; - if (!brief_count) + if ( !brief_count && !export_count ) { comments = 1; ps.ena_empty = true; @@ -2308,7 +2432,7 @@ static enumError SaveTextLEX_FEAT u8 *ptr = item->elem.data + sizeof(features_szs_t); if ( size >= 4 || !IsMemConst(ptr,size,0) ) { - fputs("\n# Hex dump for unknown settings:\n",f); + fputs("\r\n# Hex dump for unknown settings:\r\n",f); HexDump(f,0,sizeof(features_szs_t),5,16,ptr,size); } } @@ -2338,23 +2462,44 @@ static enumError SaveTextLEX_SET1 const u8 *data = item->elem.data; const lex_set1_t *set1 = (lex_set1_t*)data; - fprintf(f,text_lex_elem_set1_cr +// [[time-limit]] + const unsigned apply_online_sec = ntohs(set1->apply_online_sec); + if ( brief_count || export_count ) + fprintf(f, + "%s[SET1]\r\n\r\n" + "@ITEM-POS-FACTOR = v( %5.3f, %5.3f, %5.3f )\r\n" + "@START-ITEM = %u\r\n" + "@APPLY-ONLINE-SEC = %u%s\r\n" + "\r\n" + ,section_sep + ,bef4(&set1->item_factor.x) + ,bef4(&set1->item_factor.y) + ,bef4(&set1->item_factor.z) + ,set1->start_item + ,apply_online_sec ,PrintHMS(0,0,apply_online_sec,LE_VIEW_ONLINE_HMS," # ",0) + // [[new-lex-set1]] + ); + else + fprintf(f,text_lex_elem_set1_cr ,item->sort_order ,bef4(&set1->item_factor.x) ,bef4(&set1->item_factor.y) ,bef4(&set1->item_factor.z) ,set1->start_item + ,LE_MIN_ONLINE_SEC ,PrintHMS(0,0,LE_MIN_ONLINE_SEC,LE_VIEW_ONLINE_HMS," (",")") + ,LE_MAX_ONLINE_SEC ,PrintHMS(0,0,LE_MAX_ONLINE_SEC,LE_VIEW_ONLINE_HMS," (",")") + ,apply_online_sec ,PrintHMS(0,0,apply_online_sec,LE_VIEW_ONLINE_HMS," # ",0) + // [[new-lex-set1]] ); - if ( set1->test_0d || set1->test_0e || set1->test_0f ) + if ( set1->padding_0d ) fprintf(f,text_lex_elem_set1_develop_cr - ,set1->test_0d - ,set1->test_0e - ,set1->test_0f + ,set1->padding_0d ); + if ( size > sizeof(lex_set1_t) ) { - fputs("\n# Hex dump for unknown settings:\n",f); + fputs("\r\n# Hex dump for unknown settings:\r\n",f); HexDump(f,0,sizeof(lex_set1_t),5,16, item->elem.data + sizeof(lex_set1_t), size - sizeof(lex_set1_t) ); @@ -2415,8 +2560,8 @@ static enumError SaveTextLEX_HIPT const lex_hipt_rule_t *rule = (lex_hipt_rule_t*)item->elem.data; int n = ntohl(item->elem.size) / sizeof(*rule) ; - int i, last_lap = 1000; - for ( i = 0; i < n; i++, rule++ ) + int last_lap = 1000; + for ( int i = 0; i < n; i++, rule++ ) { if ( last_lap != rule->lap ) { @@ -2424,7 +2569,7 @@ static enumError SaveTextLEX_HIPT fputs("\r\n",f); } - fprintf(f,"%5u %4d %4u %4u %4u\r\n", + fprintf(f,"%6u %5d %4u %4u %4u\r\n", rule->cond, rule->lap, rule->from, rule->to, rule->mode ); } @@ -2433,6 +2578,73 @@ static enumError SaveTextLEX_HIPT /////////////////////////////////////////////////////////////////////////////// +static enumError SaveTextLEX_RITP +( + FILE * f, // file to write + const lex_t * lex, // pointer to valid LEX + lex_item_t * item // item to save +) +{ + DASSERT(f); + DASSERT(lex); + DASSERT(item); + + if ( brief_count || export_count ) + fprintf(f,"%s[RITP]\r\n\r\n",section_sep); + else + fprintf(f,text_lex_elem_ritp_cr,item->sort_order); + + const lex_ritp_rule_t *rule = (lex_ritp_rule_t*)item->elem.data; + int n = ntohl(item->elem.size) / sizeof(*rule) ; + if ( n <= 0 ) + return ERR_OK; + + fputs(text_lex_elem_ritp_tabhead_cr,f); + + + struct mode_t + { + u8 print_param; // 0:never, 1:if not null, 2:always + char name[7]; + }; + + static const struct mode_t mode_tab[] = + { + { 1, "OFF" }, + { 0, "START" }, + // [[new-ritp-mode]] + }; + _Static_assert( sizeof(mode_tab)/sizeof(*mode_tab) == RITP_MODE__N, "RITP_MODE__N" ); + + for ( int i = 0; i < n; i++, rule++ ) + { + bool print_param; + char name[20]; + if ( rule->mode < RITP_MODE__N ) + { + const struct mode_t *md = mode_tab + rule->mode; + print_param = md->print_param; + snprintf(name,sizeof(name),"RITP$%s",md->name); + } + else + { + print_param = 2; + snprintf(name,sizeof(name),"%4u",rule->mode); + } + + if ( print_param >= 2 || print_param == 1 && rule->param ) + fprintf(f,"%6u %3u %-9s %6u\r\n", + rule->index, rule->n_next, name, rule->param ); + else + fprintf(f,"%6u %3u %s\r\n", + rule->index, rule->n_next, name ); + } + + return ERR_OK; +} + +/////////////////////////////////////////////////////////////////////////////// + static enumError SaveTextLEX_TEST ( FILE * f, // file to write @@ -2481,7 +2693,7 @@ static enumError SaveTextLEX_TEST if ( size > sizeof(lex_test_t) ) { - fputs("\n# Hex dump for unknown settings:\n",f); + fputs("\r\n# Hex dump for unknown settings:\r\n",f); HexDump(f,0,sizeof(lex_test_t),5,16, item->elem.data + sizeof(lex_test_t), size - sizeof(lex_test_t) ); @@ -2492,6 +2704,33 @@ static enumError SaveTextLEX_TEST /////////////////////////////////////////////////////////////////////////////// +static enumError SaveTextLEX_HEXDUMP +( + FILE * f, // file to write + const lex_t * lex, // pointer to valid LEX + lex_item_t * item // item to save +) +{ + DASSERT(f); + DASSERT(lex); + DASSERT(item); + + const bool brief = brief_count || export_count; + const u32 magic = ntohl(item->elem.magic); + if (brief) + fprintf(f,"%s[HEXDUMP]\r\n@MAGIC = 0x%08x\r\n\r\n",section_sep,magic); + else + fprintf(f,text_lex_hexdump_cr, + item->sort_order, magic, PrintID(&item->elem.magic,4,0) ); + + HexDumpCRLF(f,0,0,5,16,item->elem.data,ntohl(item->elem.size)); + if (!brief) + fputs(text_lex_hexdump_sep_cr,f); + return ERR_OK; +} + +/////////////////////////////////////////////////////////////////////////////// + enumError SaveTextLEX ( const lex_t * lex, // pointer to valid LEX @@ -2533,7 +2772,7 @@ enumError SaveTextLEX fprintf(F.f, "%s[SETUP]\r\n\r\n" "TOOL = %s\r\n" - "SYSTEM2 = %s\r\n" + "SYSTEM = %s\r\n" "VERSION = %s\r\n" "REVISION = %u\r\n" "DATE = %s\r\n" @@ -2550,7 +2789,7 @@ enumError SaveTextLEX for ( i = 0; i < lex->item_used; i++ ) { lex_item_t *s = lex->item[i]; - const uint size = ntohl(s->elem.size); + const uint size = ntohl(s->elem.size) + 8; fprintf(F.f,"# %-4.4s %08x, 0x%04x bytes\r\n", PrintID(&s->elem.magic,4,0), s->elem.magic, size ); } @@ -2562,7 +2801,6 @@ enumError SaveTextLEX for ( i = 0; i < lex->item_used; i++ ) { lex_item_t *s = lex->item[i]; - const uint size = ntohl(s->elem.size); const u32 magic = ntohl(s->elem.magic); enumError err = ERR_OK; switch(magic) @@ -2571,14 +2809,11 @@ enumError SaveTextLEX case LEXS_SET1: err = SaveTextLEX_SET1(F.f,lex,s); break; case LEXS_CANN: err = SaveTextLEX_CANN(F.f,lex,s); break; case LEXS_HIPT: err = SaveTextLEX_HIPT(F.f,lex,s); break; + case LEXS_RITP: err = SaveTextLEX_RITP(F.f,lex,s); break; case LEXS_TEST: err = SaveTextLEX_TEST(F.f,lex,s); break; + // [[new-lex-sect]] - default: - hexdump_eol = "\r\n"; - fprintf(F.f,text_lex_hexdump_cr, - s->sort_order, magic, PrintID(&s->elem.magic,4,0) ); - HexDump(F.f,0,0,5,16,s->elem.data,size); - break; + default: err = SaveTextLEX_HEXDUMP(F.f,lex,s); break; } if ( max_err < err ) @@ -2765,7 +3000,7 @@ void SetupLexInfo ( lex_info_t *info, const lex_t *lex ) if (lex) { - info->lex_found = true; + info->lex_found = true; info->have_sect = lex->have_sect; info->have_feat = lex->have_feat; @@ -2774,9 +3009,10 @@ void SetupLexInfo ( lex_info_t *info, const lex_t *lex ) if (item) { info->set1_found = true; - memcpy(&info->set1,item->elem.data,sizeof(info->set1)); - bef4n(info->set1.item_factor.v,info->set1.item_factor.v,3); - memcpy(&info->item_factor,&info->set1.item_factor,sizeof(info->item_factor)); + memcpy( &info->set1, item->elem.data, sizeof(info->set1) ); + // copy from info to info is correct, because of memcpy() above + bef4n( info->set1.item_factor.v, info->set1.item_factor.v, 3 ); + memcpy( &info->item_factor, &info->set1.item_factor, sizeof(info->item_factor) ); } item = FindElementLEX(lex,LEXS_TEST); @@ -2785,6 +3021,8 @@ void SetupLexInfo ( lex_info_t *info, const lex_t *lex ) info->test_found = true; memcpy(&info->test,item->elem.data,sizeof(info->test)); } + + // [[new-lex-sect]] } } @@ -2966,6 +3204,7 @@ bool PatchLEX ( lex_t * lex, const szs_have_t *have ) } + // [[new-lex-sect]] //--- section FEAT @@ -3029,6 +3268,12 @@ bool PurgeLEX ( lex_t * lex ) remove = size < sizeof(lex_hipt_rule_t); break; + case LEXS_RITP: + remove = size < sizeof(lex_ritp_rule_t); + break; + + // [[new-lex-sect]] + case LEXS_TEST: remove = !IsActiveLEXElement_TEST((lex_test_t*)data); break; diff --git a/project/src/lib-lex.h b/project/src/lib-lex.h index bd25b1e..17b5a92 100644 --- a/project/src/lib-lex.h +++ b/project/src/lib-lex.h @@ -109,6 +109,14 @@ typedef struct features_szs_t u8 lex_hide_pos; // HAVELEXF_HIDE_POS u8 lex_start_item; // HAVELEXF_START_ITEM + //--- since v2.35a + + u8 lex_apply_otl; // HAVELEXF_APPLY_OTL + u8 lex_sect_ritp; // HAVELEXS_RIPT + u8 lex_rnd_itph; // HAVELEXF_RND_ITPH + + // [[new-lex-sect]] + //--- new files and features will be appended here } __attribute__ ((packed)) features_szs_t; @@ -241,6 +249,8 @@ typedef enum have_lex_sect_t HAVELEXS_TEST, HAVELEXS_HIPT, HAVELEXS_FEAT, + HAVELEXS_RITP, + // [[new-lex-sect]] //--- add new elements here (order is important) HAVELEXS__N } @@ -257,6 +267,9 @@ typedef enum have_lex_feat_t HAVELEXF_CANNON, HAVELEXF_HIDE_POS, HAVELEXF_START_ITEM, + HAVELEXF_APPLY_OTL, + HAVELEXF_RND_ITPH, + // [[new-lex-sect]] //--- add new elements here (order is important) HAVELEXF__N } @@ -274,7 +287,10 @@ typedef enum lex_stream_id LEXS_SET1 = 0x53455431, // "SET1" primary settings LEXS_CANN = 0x43414e4e, // "CANN" cannon settings LEXS_HIPT = 0x48495054, // "HIPT" hide position tracker + LEXS_RITP = 0x52495450, // "RITP" random next links @KMP:ITPH LEXS_TEST = 0x54455354, // "TEST" settings for tests + + // [[new-lex-sect]] } lex_stream_id; @@ -323,9 +339,9 @@ typedef struct lex_set1_t { /*00*/ float3 item_factor; // factor for item positions, always >=1.0 /*0c*/ u8 start_item; // 1: player can get an item before start (hint only) - /*0d*/ u8 test_0d; // reserved - /*0e*/ u8 test_0e; // reserved - /*0f*/ u8 test_0f; // reserved + /*0d*/ u8 padding_0d; // padding_0d + /*0e*/ u16 apply_online_sec; // >0: wanted time limit if playing online + // [[new-lex-set1]] } __attribute__ ((packed,aligned(4))) lex_set1_t; @@ -342,6 +358,31 @@ typedef struct lex_hipt_rule_t } __attribute__ ((packed)) lex_hipt_rule_t; +//----------------------------------------------------------------------------- +// [[lex_hipt_rule_t]] + +typedef enum lex_ritp_mode_t +{ + RITP_MODE_OFF, // ignore this element + RITP_MODE_START, // shuffle once after reading KMP + // [[new-ritp-mode]] >>> keep order! + RITP_MODE__N +} +__attribute__((packed)) lex_ritp_mode_t; + +//--------------- + +typedef struct lex_ritp_rule_t +{ + u8 index; // index into section KMP/ITPH + u8 n_next; // number of next elements to shuffle (2..6) + lex_ritp_mode_t mode; // shuffle mode + u8 param; // additional parameter for some modes +} +__attribute__((packed)) lex_ritp_rule_t; + +//----------------------------------------------------------------------------- +// [[new-lex-sect]] //----------------------------------------------------------------------------- // [[lex_test_t]] @@ -408,6 +449,7 @@ typedef struct lex_t lex_item_t **item; // NULL or item list (alloced) uint have_sect; // bit field for found lex sections uint have_feat; // bit field for found lex features + uint apply_otl; // >0: applied online time limit //--- parser helpers @@ -436,6 +478,7 @@ lex_item_t * AppendFeatLEX ( lex_t * lex, bool overwrite, const features_szs_t * lex_item_t * AppendSet1LEX ( lex_t * lex, bool overwrite ); lex_item_t * AppendCannLEX ( lex_t * lex, bool overwrite ); lex_item_t * AppendHiptLEX ( lex_t * lex, bool overwrite ); +lex_item_t * AppendRitpLEX ( lex_t * lex, bool overwrite ); lex_item_t * AppendTestLEX ( lex_t * lex, bool overwrite ); const VarMap_t * SetupVarsLEX(); @@ -447,7 +490,8 @@ ccp CreateSectionInfoLEX ccp CreateFeatureInfoLEX ( have_lex_feat_t special, bool add_value, ccp return_if_empty ); -uint GetLexFeatures ( const lex_element_t *elem ); +// if 'lex' not NULL: store additional data +uint GetLexFeatures ( const lex_element_t *elem, lex_t *lex ); static inline bool IsLexFF ( file_format_t fform ) { return fform == FF_LEX || fform == FF_LEX_TXT; } @@ -552,6 +596,8 @@ typedef struct lex_info_t // data float3 item_factor; // 1.0 or copy of set1.item_factor + + // [[new-lex-sect]] [[new-lex-set1]] } lex_info_t; diff --git a/project/src/lib-mdl.c b/project/src/lib-mdl.c index 7056033..831e336 100644 --- a/project/src/lib-mdl.c +++ b/project/src/lib-mdl.c @@ -2505,7 +2505,7 @@ enumError SaveTextMDL fprintf(F.f, "%s[SETUP]\r\n\r\n" "TOOL = %s\r\n" - "SYSTEM2 = %s\r\n" + "SYSTEM = %s\r\n" "VERSION = %s\r\n" "REVISION = %u\r\n" "DATE = %s\r\n" diff --git a/project/src/lib-numeric.c b/project/src/lib-numeric.c index 0e4349e..2da7ed5 100644 --- a/project/src/lib-numeric.c +++ b/project/src/lib-numeric.c @@ -1806,7 +1806,6 @@ void PrintNameIL /////////////// color conversions /////////////// /////////////////////////////////////////////////////////////////////////////// - int ScanOptCmprDefault ( ccp arg ) { DASSERT( opt_cmpr_def[4] == 0xff ); @@ -2008,41 +2007,6 @@ const u8 cc86[256] = // convert 8-bit color to 6-bit color 0x3b,0x3c,0x3c,0x3c, 0x3c,0x3d,0x3d,0x3d, 0x3d,0x3e,0x3e,0x3e, 0x3e,0x3f,0x3f,0x3f }; -// -/////////////////////////////////////////////////////////////////////////////// -/////////////// misc /////////////// -/////////////////////////////////////////////////////////////////////////////// - -ccp GetIntModeName ( IntMode_t mode ) -{ - switch(mode) - { - case IMD_UNSET: return "-"; - - case IMD_BE0: return "BE"; - case IMD_BE1: return "BE1"; - case IMD_BE2: return "BE2"; - case IMD_BE3: return "BE3"; - case IMD_BE4: return "BE4"; - case IMD_BE5: return "BE5"; - case IMD_BE6: return "BE6"; - case IMD_BE7: return "BE7"; - case IMD_BE8: return "BE8"; - - case IMD_LE0: return "LE"; - case IMD_LE1: return "LE1"; - case IMD_LE2: return "LE2"; - case IMD_LE3: return "LE3"; - case IMD_LE4: return "LE4"; - case IMD_LE5: return "LE5"; - case IMD_LE6: return "LE6"; - case IMD_LE7: return "LE7"; - case IMD_LE8: return "LE8"; - - default: return "?"; - } -} - // /////////////////////////////////////////////////////////////////////////////// /////////////// END /////////////// diff --git a/project/src/lib-parser-func.c b/project/src/lib-parser-func.c index 005b93e..6d84be2 100644 --- a/project/src/lib-parser-func.c +++ b/project/src/lib-parser-func.c @@ -234,6 +234,10 @@ void DefineMkwVars ( VarMap_t * vm ) { "LEX$EN_150M", LEX_ENGINE_150M }, { "LEX$EN_200M", LEX_ENGINE_200M }, + { "RITP$OFF", RITP_MODE_OFF }, + { "RITP$START", RITP_MODE_START }, + // [[new-ritp-mode]] + { "VEH$SMALL", CHATVEH_SMALL }, { "VEH$MEDIUM", CHATVEH_MEDIUM }, { "VEH$LARGE", CHATVEH_LARGE }, diff --git a/project/src/lib-pat.c b/project/src/lib-pat.c index 9c4424d..d549254 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" - "SYSTEM2 = %s\r\n" + "SYSTEM = %s\r\n" "VERSION = %s\r\n" "REVISION = %u\r\n" "DATE = %s\r\n" diff --git a/project/src/lib-std.h b/project/src/lib-std.h index 66eddad..dfb4919 100644 --- a/project/src/lib-std.h +++ b/project/src/lib-std.h @@ -2191,8 +2191,8 @@ __attribute__ ((packed)) mkw_prefix_flags_t; typedef struct mkw_prefix_t { - char prefix[8]; ccp info; // if NULL: list terminator + char prefix[12]; mkw_prefix_flags_t flags; u8 order; u8 color; diff --git a/project/src/lib-szs.h b/project/src/lib-szs.h index e00b64d..0f7fbdd 100644 --- a/project/src/lib-szs.h +++ b/project/src/lib-szs.h @@ -344,6 +344,7 @@ typedef struct szs_have_t kmp_special_t kmp; // u8-list: elem>0: number of special KMP objects found uint lex_sect; // bit field for found lex sections uint lex_feat; // bit field for found lex features + uint lex_apply_otl; // >0: applied online time limit have_attrib_t attrib; // bit field for special attributes } szs_have_t; diff --git a/project/src/prefix.inc b/project/src/prefix.inc index 96926a9..2c09c59 100644 --- a/project/src/prefix.inc +++ b/project/src/prefix.inc @@ -1,98 +1,105 @@ static const u8 prefix_inc_bz2[] = { - // decompressed size: 0xcb7 = 3255 bytes - 0x00,0x00,0x0c,0xb7, + // decompressed size: 0xe34 = 3636 bytes + 0x00,0x00,0x0e,0x34, // bzipped data - 0x42,0x5a,0x68,0x39, 0x31,0x41,0x59,0x26, 0x53,0x59,0x9e,0x05, 0xfa,0xfd,0x00,0x01, - 0xcc,0xdf,0x80,0x00, 0x12,0x61,0xef,0x7f, 0xf2,0x7f,0xef,0xdf, 0xf0,0xbf,0xff,0xff, - 0xf4,0x50,0x05,0x5e, 0xc6,0xf7,0x8d,0x6b, 0xb2,0x75,0xdb,0x6c, 0xdb,0xdd,0xe7,0x07, - 0x71,0xe1,0xa2,0x4d, 0x30,0x93,0x4c,0x98, 0x98,0x8c,0x9a,0x60, 0x49,0xea,0x69,0x93, - 0x50,0xf4,0xd1,0xa8, 0x7a,0x9a,0x68,0x00, 0xd3,0xd4,0x1a,0x26, 0x89,0xb4,0xd2,0x1a, - 0x4d,0xa9,0x3c,0x9a, 0x90,0xf4,0xd4,0xf5, 0x1a,0x0c,0x80,0x32, 0x34,0x00,0x69,0xb5, - 0x00,0x12,0x9a,0x11, 0x02,0x69,0x3d,0x21, 0x91,0x19,0xa8,0x1e, 0x90,0xd0,0x64,0x03, - 0x41,0x90,0xd3,0x4d, 0x0d,0x00,0x48,0x92, 0x8a,0x7e,0x99,0x4d, 0xe4,0x4a,0x3d,0x1e, - 0xa0,0xd3,0x28,0xf5, 0x34,0xc2,0x30,0x04, 0x34,0xc1,0x19,0x00, 0x69,0x84,0x8a,0x69, - 0x51,0xb6,0xa9,0x93, 0x40,0x03,0x6a,0x68, 0x00,0x03,0x20,0x03, 0x40,0x34,0x00,0x18, - 0x20,0x5f,0xc6,0x73, 0x40,0x0b,0xe3,0xab, 0x0e,0x8f,0x76,0x0b, 0x0b,0xdf,0xd6,0xac, - 0x12,0x96,0x1f,0xd8, 0x78,0xd3,0xa4,0xa2, 0x1b,0x06,0x52,0xcc, 0x95,0xe3,0xf2,0xcf, - 0x1a,0x7d,0x84,0x74, 0x8d,0x8c,0x38,0x22, 0xee,0xe9,0xe5,0xbd, 0x5d,0x89,0xa0,0x98, - 0xd5,0xd7,0x87,0xde, 0x02,0xf1,0x2b,0x75, 0xc9,0x9f,0xd9,0x29, 0xa9,0x00,0xe3,0x21, - 0x33,0x14,0x30,0xd6, 0x98,0x70,0xb5,0xa2, 0xc4,0x4e,0x31,0x53, 0x13,0x9d,0x55,0x6d, - 0xaa,0x02,0x75,0xd7, 0x75,0x61,0x4a,0x4a, 0xde,0x03,0x3b,0xd8, 0x59,0x9c,0xdd,0x80, - 0xdb,0x53,0x74,0xcc, 0xb3,0x48,0x60,0x3f, 0x10,0xc5,0x4f,0x58, 0xbf,0xb2,0xf2,0xb3, - 0x1f,0x52,0xd9,0x8e, 0x11,0x2c,0x36,0x55, 0x26,0x95,0x55,0x10, 0x85,0x43,0x6b,0xf2, - 0x5a,0x5f,0x11,0x21, 0xcb,0x9d,0x24,0x5f, 0xef,0x9b,0xc0,0x1f, 0xd0,0x9b,0x9b,0x84, - 0x22,0x3a,0xb9,0xce, 0x07,0xbc,0x06,0x0f, 0x6e,0x20,0x1f,0xb9, 0x09,0x04,0x77,0xe5, - 0x5a,0x2e,0x9e,0xe7, 0x56,0xa9,0x88,0x49, 0xf7,0x6a,0x04,0xab, 0x48,0xb1,0x59,0x67, - 0x65,0x75,0x85,0x4b, 0x97,0x90,0xb1,0x2d, 0x51,0x4d,0xb5,0xe6, 0x21,0x24,0xcc,0x86, - 0x66,0x0e,0xfc,0x19, 0xb1,0xce,0xea,0x21, 0x1c,0xd5,0x2b,0x04, 0x44,0x47,0xbd,0x04, - 0xc8,0x56,0x93,0xf0, 0x96,0x01,0x8a,0x79, 0xdd,0xac,0x42,0x00, 0x62,0xb5,0xe3,0xc7, - 0xc5,0xbe,0x6f,0x27, 0x59,0x74,0xee,0x0f, 0xa7,0x27,0x8d,0x18, 0x06,0x74,0x56,0x84, - 0x94,0xd5,0x1d,0x10, 0x39,0xf5,0xb0,0x2d, 0x35,0x89,0xda,0x6e, 0xab,0xc3,0x96,0xf4, - 0x77,0x6e,0xe9,0xb2, 0xad,0x61,0x72,0x12, 0x40,0x7f,0x9d,0x7e, 0x6a,0x12,0xac,0x66, - 0x3d,0x75,0xe4,0x43, 0x9a,0x5c,0xc9,0x49, 0x87,0x5d,0x47,0xa1, 0x90,0x80,0x8c,0x85, - 0xf3,0x06,0x08,0x86, 0x8b,0x16,0x1a,0x73, 0xa0,0xfe,0xee,0x45, 0xe1,0x19,0x49,0x86, - 0xa2,0x84,0x26,0x29, 0x4d,0xc8,0x64,0x41, 0xd5,0x02,0xc2,0x75, 0x2a,0xd8,0x47,0x6a, - 0x0e,0x0b,0x46,0x37, 0xda,0x13,0x73,0x18, 0x52,0xdd,0x68,0xcf, 0xb9,0x8c,0xa9,0x91, - 0x51,0x25,0x2f,0x96, 0x21,0x2a,0x23,0x2b, 0x30,0x4d,0x90,0xd0, 0x3c,0xd9,0xb5,0x67, - 0xc3,0x04,0x08,0x01, 0x08,0x64,0x93,0x55, 0x3a,0x65,0x79,0xa3, 0x6a,0x18,0xbe,0xbb, - 0xd0,0x00,0xb5,0x65, 0xae,0xf2,0x75,0xdc, 0x3a,0xd0,0x24,0xa5, 0x61,0x36,0xac,0xac, - 0x0e,0x05,0x73,0xe3, 0x18,0xf2,0x18,0x2f, 0x49,0x92,0xb3,0x71, 0xf9,0x30,0x69,0xf0, - 0x3e,0x00,0xc3,0x11, 0x11,0xcd,0x42,0x6e, 0xcd,0x1a,0x2f,0x99, 0x9f,0x5d,0xe1,0x9c, - 0x5b,0x8a,0x9f,0x97, 0x51,0x34,0xdc,0x5c, 0x38,0x6c,0x57,0xb1, 0x2c,0xee,0xfc,0x76, - 0x49,0x48,0x66,0x4c, 0x83,0x67,0x3c,0x40, 0x31,0x31,0x83,0x19, 0x28,0xcc,0xe4,0xdb, - 0x69,0x0d,0x9f,0x85, 0xee,0xba,0xd5,0x46, 0x5b,0x67,0x6e,0x0f, 0x1c,0x43,0x3b,0xc6, - 0x4c,0x2f,0xbc,0xc1, 0x91,0x87,0x99,0x3b, 0x8b,0x7e,0xf9,0xf4, 0x15,0xb8,0x2f,0x1b, - 0x38,0x31,0xe5,0x1e, 0xfe,0x4f,0x30,0x2b, 0xa2,0x8e,0xd1,0x92, 0x19,0x42,0x40,0x66, - 0x48,0x10,0x12,0x6a, 0xbb,0x2a,0x29,0x8e, 0xf5,0x20,0xb8,0x03, 0x6b,0xc0,0xcf,0xa4, - 0x6e,0x3e,0x73,0x6c, 0x48,0x12,0x2f,0xe2, 0x1c,0xa5,0x23,0x8c, 0x92,0x68,0xc0,0x37, - 0xbc,0xdb,0xd1,0x1e, 0xbd,0xa2,0xd5,0xcd, 0xd2,0x0a,0x4e,0x1d, 0x2f,0x44,0xea,0xe4, - 0x0f,0x5d,0xeb,0x2a, 0x88,0x88,0xaa,0xae, 0x40,0x10,0x8a,0x82, 0x71,0x50,0x50,0xac, - 0xb3,0x57,0x6f,0x51, 0x40,0xa6,0x73,0x40, 0xbf,0xd4,0x29,0x3d, 0xbe,0x22,0x92,0x5a, - 0x09,0x36,0xc0,0x07, 0xb9,0xcd,0x9a,0xa6, 0x4e,0x15,0xb6,0x08, 0x63,0x05,0x3e,0x0b, - 0x61,0x57,0x69,0x08, 0xa4,0x9c,0x52,0x51, 0x4c,0xad,0x86,0x9b, 0x34,0x63,0xcf,0x07, - 0x38,0x48,0x30,0xf1, 0x8b,0x00,0x4d,0xc9, 0xa8,0x29,0xbf,0x7d, 0x35,0xb1,0x72,0xed, - 0xcd,0xe0,0x2a,0xe2, 0xd5,0xc1,0x83,0x4c, 0x65,0xca,0x28,0x75, 0x04,0x42,0x13,0x27, - 0x3e,0xbb,0x53,0xab, 0xc3,0x41,0xeb,0x31, 0xbc,0x33,0x48,0xf3, 0x7d,0x67,0xbb,0x6d, - 0x39,0x96,0x40,0x5f, 0x19,0x49,0xf0,0xac, 0xa4,0x7b,0x2e,0xb4, 0x3f,0xbb,0x09,0x03, - 0x2d,0xc8,0x79,0x74, 0xaa,0xfb,0x24,0x28, 0x3a,0x28,0xc1,0x9c, 0x6c,0x43,0x49,0xad, - 0x22,0x2e,0x2d,0xd9, 0x93,0xb4,0x20,0xda, 0xb8,0x69,0xcc,0x6a, 0xa6,0x6c,0x35,0x2f, - 0x39,0x8a,0xe6,0xae, 0x56,0xf7,0x00,0x4a, 0x8a,0x85,0xe7,0x8d, 0xf0,0xab,0x8c,0x33, - 0x95,0xec,0xd5,0x40, 0x02,0x83,0x0a,0x59, 0x54,0x60,0x11,0x53, 0xb2,0x6d,0xb7,0x47, - 0x20,0x16,0xce,0xfc, 0xfd,0xd4,0xbc,0xcf, 0x48,0x2c,0x02,0xb6, 0xb8,0x11,0x71,0x93, - 0x89,0x44,0xc9,0xad, 0x0b,0xdd,0x71,0x3a, 0x10,0xdc,0x02,0x69, 0xe0,0x34,0x49,0xe5, - 0x6a,0x66,0x65,0x0b, 0xb9,0x13,0xd0,0x80, 0x23,0xd7,0x9b,0x02, 0xd1,0x46,0x74,0x51, - 0x19,0x40,0x38,0xe8, 0xc9,0x6f,0x3f,0x42, 0x48,0xda,0xd6,0xb4, 0x42,0x4e,0x3a,0xb3, - 0x38,0xf0,0x82,0x59, 0x29,0x76,0x07,0x66, 0x81,0x02,0xcf,0x85, 0x27,0x35,0x0a,0xbc, - 0x41,0x32,0x21,0xb5, 0x35,0x53,0x04,0x34, 0xd0,0x32,0xf7,0xe4, 0x95,0x2d,0xef,0xe5, - 0x4e,0xf9,0x49,0x69, 0x5f,0x0c,0x59,0x85, 0x76,0xb4,0xc9,0x53, 0x19,0x16,0x9d,0xe3, - 0x7e,0x0e,0x35,0x1b, 0x87,0x5a,0xc0,0x5c, 0x7b,0x6b,0xda,0x32, 0xec,0x37,0xa5,0x0b, - 0x82,0x0e,0xfe,0x46, 0x58,0x2b,0xb0,0xec, 0xcf,0x60,0x00,0x4c, 0x20,0x5d,0xf1,0x01, - 0x2c,0x03,0x68,0x5b, 0x1a,0x61,0x12,0x7b, 0x11,0x7c,0xb1,0xda, 0x4f,0x4d,0xcb,0x67, - 0x68,0xcd,0x3d,0xd1, 0xd2,0x94,0x8b,0xfe, 0x32,0xb4,0xa1,0x74, 0xea,0xdf,0x69,0x24, - 0xdd,0x67,0xa1,0xbc, 0x3b,0xc8,0x86,0xe2, 0x64,0x2c,0x2c,0x69, 0x03,0x66,0x14,0xd0, - 0x3a,0xe1,0x0b,0xb3, 0x4e,0xf3,0x8e,0xf6, 0xc2,0x2a,0x6e,0xbb, 0x71,0x70,0xde,0x34, - 0x9a,0x2e,0xbf,0x15, 0x4a,0xe9,0x7c,0xdc, 0x74,0x1f,0x5b,0xf2, 0xe3,0xab,0x59,0x50, - 0x32,0x55,0xf4,0x38, 0x14,0xbd,0xdb,0x5e, 0x89,0x04,0x6d,0xb4, 0xd9,0x7d,0x8d,0x19, - 0xad,0xb6,0xd9,0x57, 0x2a,0xc1,0x2e,0x41, 0x6c,0x8d,0x29,0x58, 0xea,0x50,0xf6,0x92, - 0xff,0xec,0x2f,0xaf, 0x27,0x2f,0x97,0x4d, 0x2b,0xe9,0xac,0x00, 0x47,0x85,0x69,0xc4, - 0x76,0xbf,0x1c,0xb7, 0x5a,0x63,0x65,0xc1, 0x4b,0x27,0x82,0x1b, 0x72,0x1d,0x7a,0xe8, - 0xc7,0x25,0x07,0xc3, 0x08,0x5d,0xbb,0x63, 0xcd,0x48,0x35,0xb2, 0xaa,0xb2,0x6e,0xb2, - 0x47,0xe9,0xf9,0xa1, 0x9b,0xfa,0xee,0x1d, 0x9d,0x4e,0x07,0x54, 0xb8,0xc7,0xed,0xdc, - 0x49,0x98,0x6e,0xb4, 0x12,0xa9,0x2e,0x91, 0x0e,0x9d,0x9d,0x24, 0xef,0xd6,0xff,0x8b, - 0x2a,0x0b,0x00,0x4e, 0xba,0x12,0x86,0xd0, 0x90,0x34,0x65,0xb4, 0x74,0x89,0x20,0xb3, - 0x0d,0x6e,0xf2,0x54, 0xaf,0x57,0x10,0x16, 0xf8,0x73,0xad,0x23, 0xc4,0xd5,0x91,0x1e, - 0x0c,0x6c,0x4f,0x86, 0x75,0xe2,0xea,0x2f, 0xdd,0x7f,0x4f,0x97, 0x95,0x34,0x53,0x05, - 0x2f,0x85,0x1d,0x76, 0x6c,0xcb,0x21,0xf5, 0x3c,0x1c,0x3f,0xe3, 0x22,0x0a,0x21,0x24, - 0x9a,0x16,0x8d,0x5b, 0xf9,0xd6,0xa0,0xbb, 0x2d,0xbd,0x68,0x46, 0x15,0x38,0x2a,0xba, - 0x29,0x17,0x6b,0x9e, 0x66,0xe8,0x4a,0xe1, 0xbd,0x54,0x66,0xbb, 0x2e,0x7e,0x08,0x4b, - 0xe2,0x8d,0x9d,0xb5, 0x01,0x56,0xb1,0xce, 0xaf,0x63,0x86,0x27, 0x30,0xc3,0x62,0x98, - 0xab,0x1d,0x6a,0xb9, 0x29,0x38,0xe3,0x8e, 0x38,0xc5,0xd8,0xcc, 0x61,0x8c,0x0a,0xb5, - 0xdd,0xbf,0x5c,0x39, 0x65,0x13,0x8e,0x23, 0x34,0xba,0x32,0x9c, 0x41,0xa3,0x2d,0x6c, - 0x44,0x37,0x9a,0xd8, 0x89,0xff,0x17,0x72, 0x45,0x38,0x50,0x90, 0x9e,0x05,0xfa,0xfd, - // 0x570 = 1392 data bytes (43%) + 0x42,0x5a,0x68,0x39, 0x31,0x41,0x59,0x26, 0x53,0x59,0xf9,0x95, 0x37,0xa2,0x00,0x01, + 0xfa,0xdf,0x80,0x00, 0x12,0x61,0xef,0x7f, 0xf2,0x7f,0xef,0xdf, 0xf0,0xbf,0xff,0xff, + 0xf4,0x50,0x05,0xde, 0xc6,0xce,0x74,0x24, 0x6e,0xee,0xdb,0x65, 0xa6,0x8d,0x0e,0xe0, + 0x34,0x42,0x9f,0xa1, 0x0a,0x6d,0x34,0xf4, 0x53,0x0d,0x31,0x06, 0x89,0xe9,0x0d,0x10, + 0xf2,0x1a,0x23,0x6a, 0x00,0x0d,0xa8,0x34, 0x20,0x1a,0x14,0xf4, 0x42,0x6d,0x22,0x7a, + 0x9f,0xa6,0xa9,0xea, 0x01,0xa0,0xd0,0x69, 0x90,0x64,0x1e,0xa1, 0xe5,0x00,0x24,0x44, + 0x40,0x8c,0x82,0x99, 0x82,0x35,0x0f,0x4d, 0x14,0xf4,0x4d,0x32, 0x03,0xd4,0x68,0x34, + 0x36,0xa6,0x9a,0x34, 0x07,0x19,0x32,0x69, 0xa6,0x13,0x23,0x20, 0x60,0x46,0x26,0x8c, + 0x11,0x84,0x1a,0x34, 0xc0,0x00,0x82,0x49, 0x35,0x28,0x7b,0x25, 0x0f,0x29,0xe9,0x34, + 0xf5,0x00,0x00,0x00, 0x32,0x64,0x61,0x01, 0xa0,0x00,0xc0,0x90, 0xbf,0x8b,0x4c,0x81, + 0x0b,0xe3,0xb7,0x25, 0x98,0xf1,0x1a,0xab, 0xdf,0xd6,0x7c,0x50, 0x86,0x4f,0xd7,0x69, + 0x4d,0x18,0x3b,0xb3, 0x09,0x88,0xd0,0x91, 0x68,0xe2,0xad,0x1b, 0x82,0x0d,0xe3,0x66, + 0xf1,0x30,0xbb,0x16, 0x0d,0x1c,0x18,0xbd, 0xfe,0xaa,0x5a,0x29, 0xa0,0x1b,0x04,0xc6, + 0x7b,0x5d,0xfa,0xfb, 0xbc,0x58,0x2d,0x79, 0x16,0x6d,0xe0,0xb4, 0x89,0x10,0x43,0x21, + 0x43,0x17,0x18,0x5a, 0x18,0x41,0x45,0x82, 0x90,0x08,0x63,0x49, 0x89,0xa4,0xf4,0xba, + 0x31,0xa6,0x96,0x02, 0x4a,0xd7,0xe1,0x75, 0xad,0x2c,0xdc,0x46, 0xbb,0x28,0x7d,0x35, + 0xd1,0x99,0xc6,0x57, 0xea,0x46,0x54,0xcb, 0x5b,0x1f,0x9c,0x7e, 0x49,0xd3,0x94,0x53, + 0x90,0x59,0xa3,0xf5, 0x29,0x35,0x70,0xde, 0xa4,0x84,0xc1,0xa5, 0x18,0xc9,0x3a,0xe3, + 0x5b,0x04,0xe9,0x4c, 0xa1,0xb2,0xea,0x92, 0x1a,0x8b,0xe2,0x20, 0x74,0x4e,0xc0,0x07, + 0xb7,0xce,0x22,0x1b, 0xd1,0x46,0xae,0xba, 0x4b,0x5b,0x38,0x2d, 0x86,0x10,0x9c,0x2e, + 0x5d,0xbf,0xca,0x10, 0xbc,0x80,0x44,0x2d, 0xaf,0x2d,0xca,0xe9, 0xe2,0xc3,0x61,0x38, + 0x81,0xbc,0x68,0x43, 0xc9,0x22,0x41,0x29, 0x77,0xc6,0x21,0x98, 0xaf,0x76,0x12,0x41, + 0x60,0xc4,0xd3,0xe5, 0xdd,0x1d,0x99,0x92, 0x61,0x02,0x39,0xcf, 0xb5,0xe3,0x96,0x88, + 0x73,0x2c,0xe8,0xb4, 0xb6,0x49,0x99,0x94, 0xaa,0x52,0x88,0x8a, 0x52,0x44,0x84,0x53, + 0xe8,0xfc,0x64,0x6c, 0x1b,0x69,0x02,0x2b, 0x5d,0xa7,0xa7,0x2e, 0xf9,0x36,0xf9,0xa2, + 0x61,0x46,0xaf,0x7f, 0x41,0x1b,0x34,0xc4, 0xea,0xce,0x1a,0x19, 0x65,0x4a,0x15,0xdb, + 0xb3,0x9d,0xd7,0xf6, 0xbc,0x30,0x43,0xea, 0x81,0x40,0x99,0x83, 0x86,0x4c,0x06,0x4c, + 0x42,0x26,0xd0,0x40, 0xe2,0xc6,0xa0,0xa7, 0x6e,0xe9,0xfd,0xa0, 0xf2,0x80,0xc1,0x8d, + 0xb0,0x7f,0x1e,0x5f, 0xb5,0x86,0xfb,0x4c, 0x9f,0x2e,0xcc,0xd1, 0x3a,0xe7,0x37,0x95, + 0x95,0xf0,0xb2,0x7f, 0x76,0x2d,0x09,0xa3, 0x76,0xd2,0xf3,0x59, 0xc3,0xb2,0xd2,0xf7, + 0xb8,0x87,0x4f,0x84, 0x94,0xc1,0x13,0xaa, 0x86,0x6d,0xa5,0x49, 0x68,0xad,0x7a,0x25, + 0x32,0x4f,0xe2,0x47, 0x7d,0x36,0xbb,0x15, 0xa4,0xf0,0x93,0x8d, 0xc0,0xb7,0xb4,0x26, + 0xf1,0x18,0x65,0xa3, 0x6c,0x72,0xef,0xce, 0x5a,0xc8,0xb4,0x95, 0x3e,0xdb,0x84,0xb2, + 0x4b,0xa1,0x94,0x58, 0xb2,0x1a,0x07,0xc7, 0x3e,0xcc,0xb3,0x66, 0x62,0x62,0x06,0x31, + 0x36,0xd5,0x8e,0x18, 0x3c,0x16,0xad,0x04, 0x89,0x5f,0x83,0x08, 0x00,0x7a,0xae,0xc5, + 0x43,0x83,0xb4,0xd4, 0x7e,0x18,0x19,0x27, 0x80,0xb7,0xea,0x70, 0x42,0x0e,0x07,0x57, + 0x31,0x61,0x91,0x18, 0x2e,0x93,0x28,0xaf, 0x34,0xfa,0x2e,0x59, 0xf1,0x3e,0x20,0xc2, + 0x80,0x01,0xd4,0x90, 0x8c,0xd7,0x6e,0xdc, 0x28,0x31,0xd6,0x6e, 0xaa,0x5a,0x39,0xb8, + 0x2a,0x44,0x54,0x9b, 0x8d,0x23,0x86,0xc0, 0xda,0xc0,0x3c,0xbb, 0x08,0xdb,0x96,0x79, + 0x52,0x33,0x5e,0xb4, 0xd9,0xe1,0x10,0x0c, 0x4c,0x62,0x63,0x26, 0x17,0x5b,0x96,0xdb, + 0x1b,0x10,0xd9,0xf1, 0x5f,0x31,0xaf,0x4f, 0x6b,0x34,0xb5,0xe6, 0xcf,0x8e,0xba,0x1b, + 0x8c,0xb7,0xb3,0x7e, 0x63,0x46,0x86,0x34, 0xd3,0x74,0x61,0xbb, 0xb3,0x0e,0x7f,0x82, + 0xcf,0xa6,0xde,0x17, 0xc1,0x83,0xdb,0x6f, 0x76,0xda,0x30,0xf2, 0x75,0x5c,0x71,0x6a, + 0x59,0xea,0x76,0x12, 0x0d,0x44,0xe3,0xa4, 0xf5,0xe7,0xd8,0x54, 0x45,0x8e,0x0a,0xb2, + 0xa7,0xd0,0x22,0x12, 0x76,0xa4,0x34,0xf0, 0x1b,0xcd,0xd2,0xd8, 0x91,0x9b,0xa2,0x22, + 0x5e,0x8f,0x20,0xba, 0x98,0x3c,0xa8,0xa0, 0x65,0xea,0x0f,0xf7, 0x9b,0xfd,0x55,0xfe, + 0xec,0x1a,0x9b,0x8f, 0xd6,0xfd,0x47,0x2d, 0x31,0x4d,0x79,0xb0, 0x02,0x2d,0x3f,0x62, + 0xa1,0x08,0x80,0x1b, 0x74,0x6a,0x04,0x42, 0x11,0x04,0x85,0x61, 0x62,0x7b,0xef,0xee, + 0xde,0x4e,0xb8,0x18, 0xa1,0xd1,0xa2,0x5f, 0xd6,0x12,0xb6,0x7c, 0xa2,0xe2,0x94,0x6e, + 0x17,0xe1,0xb8,0x0e, 0xc8,0x39,0xec,0xa5, 0x0e,0xb7,0xe4,0x43, 0x48,0xcc,0xe9,0xca, + 0xcb,0xa8,0xed,0xd0, 0xd3,0x4a,0xca,0x1d, 0xb4,0x2a,0xe9,0x47, 0xcc,0x74,0xb6,0x6e, + 0x8e,0x41,0x63,0x90, 0x60,0x31,0x11,0x80, 0xb1,0x9c,0x03,0xd2, 0x4c,0x2a,0xc2,0x3f, + 0xf1,0x92,0x97,0x37, 0x0e,0xdc,0x1c,0x08, 0xaa,0xde,0xf0,0xd1, 0x9b,0xc1,0x23,0x15, + 0xa8,0xe6,0x72,0x10, 0x2b,0x19,0x33,0x7e, 0x2c,0xf8,0xf8,0xec, 0x3a,0x4c,0x6e,0x0a, + 0xb2,0x07,0x83,0x74, 0x4f,0x2c,0x6d,0xcf, 0x19,0x01,0x9a,0x11, 0xbd,0xd2,0xbd,0x7d, + 0x18,0x60,0xf7,0xe5, 0x89,0xc2,0xbc,0xbb, 0x8b,0x73,0x8d,0x72, 0x64,0x56,0x13,0x77, + 0x47,0x6d,0x02,0xa4, 0x32,0xa2,0x35,0x0b, 0x01,0x0c,0x62,0xc3, 0x30,0x16,0x8f,0x08, + 0x1d,0x6c,0x14,0x4c, 0x30,0x26,0xbc,0x0b, 0x29,0x8b,0x2b,0xc9, 0xae,0xc6,0xd9,0x89, + 0x43,0x16,0x3d,0x13, 0x45,0xd6,0x01,0x22, 0x0c,0x35,0x3a,0x88, 0x74,0x06,0xe6,0x30, + 0xf1,0xe1,0x6b,0xab, 0xa4,0x01,0x49,0x96, 0x50,0xd7,0x10,0xb0, 0xc1,0x11,0x66,0xd9, + 0x8f,0x6d,0xb0,0x9c, 0x86,0xad,0xf8,0xef, 0xf9,0xf8,0xe1,0x77, 0xe5,0x97,0x60,0x72, + 0xbe,0x48,0xe6,0x35, 0x34,0x86,0x6d,0xa7, 0x9e,0x2d,0xf5,0x76, 0xaa,0x91,0x7f,0x72, + 0x53,0xc3,0xd0,0xd4, 0xce,0x1b,0x28,0xcc, 0x0c,0x9d,0x5c,0x99, 0xea,0x60,0x0c,0x69, + 0x47,0xcd,0x71,0x72, 0xc4,0x61,0x68,0x88, 0x49,0xc1,0x0e,0xcb, 0x06,0xd3,0xcf,0xee, + 0x62,0x99,0x48,0x84, 0x81,0x8d,0xc1,0x0c, 0xbb,0x22,0x25,0x85, 0x13,0x6a,0x90,0x0a, + 0x12,0x91,0x83,0xcb, 0x3d,0x69,0x9a,0xa5, 0x91,0x32,0x14,0x26, 0x5b,0x54,0x45,0xcc, + 0x48,0x69,0xa5,0xb1, 0x90,0x7b,0x3f,0xc8, 0x58,0x68,0xf4,0xad, 0x74,0xf5,0x98,0x47, + 0x0f,0xa4,0x2c,0xdc, 0x54,0x31,0xc7,0x30, 0x55,0x25,0x02,0x2c, 0xbd,0xc3,0x75,0xab, + 0x7a,0xbb,0x47,0x39, 0x00,0x6e,0x81,0x0e, 0xbc,0xfb,0x45,0xfd, 0x67,0x1f,0x48,0x0d, + 0x9c,0x76,0x4d,0xdd, 0x84,0xf8,0x19,0x4b, 0xb2,0xfd,0x2f,0x96, 0xce,0x42,0x0d,0xc4, + 0x01,0xe3,0x10,0x29, 0xa6,0xf1,0xc3,0x49, 0x75,0x73,0x84,0x4b, 0xa4,0x6f,0x9c,0x74, + 0x98,0xf3,0xd4,0xba, 0xf8,0x9d,0x38,0xf7, 0x8f,0x2c,0xb2,0x85, 0xbf,0xcf,0xe1,0x4d, + 0x26,0x83,0x56,0x57, 0x7a,0x5a,0x40,0x37, 0x81,0x63,0x75,0xf4, 0x22,0x1b,0x8c,0x82, + 0x15,0x58,0xd0,0x86, 0xca,0xa6,0x81,0xdf, 0x23,0x1f,0xcb,0x66, 0xe8,0x22,0x2e,0x96, + 0x58,0x0c,0xe9,0x6b, 0xbb,0xcd,0x80,0xa8, 0x67,0x92,0xd4,0xdc, 0xfd,0x49,0x4f,0x2b, + 0x82,0x64,0x9d,0x15, 0xc3,0x10,0xf0,0x42, 0xe3,0x7f,0x79,0x00, 0x0e,0x54,0x2c,0x6f, + 0x69,0x03,0x19,0xc9, 0xb0,0x52,0x2d,0x53, 0x9e,0xeb,0xae,0xa3, 0xbd,0xab,0x24,0x65, + 0x30,0x20,0xa1,0x7d, 0x45,0x56,0xee,0x87, 0x46,0x45,0xe5,0x22, 0xdf,0xf9,0x3c,0x2c, + 0xf5,0xcf,0xb3,0x8f, 0x4f,0x75,0xb5,0xfa, 0xad,0x91,0x04,0xd1, 0xf4,0xe2,0x42,0xc1, + 0x63,0xa7,0xa0,0xa3, 0x73,0xce,0xf4,0x56, 0xda,0x75,0x29,0x5e, 0x49,0x87,0xf6,0xd5, + 0x1e,0xba,0x91,0x9b, 0x34,0xbe,0x17,0x4f, 0x7d,0x64,0xe2,0x9d, 0x8e,0xda,0x5f,0x6d, + 0x08,0xf7,0xfe,0xac, 0x4b,0xc6,0x20,0x3f, 0x4f,0x18,0x4b,0xc4, 0x65,0x18,0x8f,0x94, + 0x40,0xda,0x10,0xd8, 0x36,0x82,0x7e,0x15, 0x9a,0x36,0xc6,0xe8, 0xd3,0x85,0x11,0x1f, + 0x08,0xfe,0x6d,0xb9, 0x16,0xa4,0x4d,0xad, 0x12,0x0e,0xcc,0x80, 0x43,0x22,0xb1,0x85, + 0x7c,0x40,0x88,0x50, 0x63,0x18,0xe3,0xb9, 0x15,0xd5,0xae,0xee, 0x14,0xf7,0xf1,0xce, + 0xc1,0xe2,0x69,0x22, 0xb8,0x39,0xf8,0x64, 0x1c,0xde,0xc5,0x6f, 0x52,0xad,0xed,0xb7, + 0xe5,0x3f,0x8d,0x39, 0x69,0xbf,0x4c,0x81, 0x0e,0xc8,0xf3,0xeb, 0x54,0x0f,0x99,0xda, + 0xb3,0xfe,0x3a,0x60, 0x80,0xa1,0xed,0x16, 0x47,0x51,0x56,0xee, 0x39,0xd0,0x3f,0x46, + 0x9b,0x5a,0xa5,0x6b, 0x70,0xad,0x82,0xbd, 0x50,0xa1,0x1d,0xa5, 0x9c,0x8d,0x03,0x1c, + 0x96,0xa5,0x38,0x16, 0x70,0xef,0xbe,0xb8, 0xc3,0x2d,0x0c,0xcd, 0xb3,0x6d,0x80,0x59, + 0x98,0x71,0xab,0xdc, 0xb3,0x18,0x8c,0x38, 0xdc,0x8e,0x4d,0x17, 0x9e,0x9e,0x08,0x97, + 0xae,0xba,0xeb,0xae, 0x9f,0xa9,0xf7,0x4b, 0x84,0x0a,0xab,0xd3, 0xb9,0x9f,0x09,0x8f, + 0x64,0x4e,0x37,0x40, 0x63,0x5d,0xf8,0xaf, 0x45,0x22,0x8d,0x51, 0xb8,0x4e,0x8b,0x51, + 0xb0,0xc3,0x91,0x7f, 0xf1,0x77,0x24,0x53, 0x85,0x09,0x0f,0x99, 0x53,0x7a,0x20, + // 0x5df = 1503 data bytes (41%) }; static BZ2Manager_t prefix_inc_mgr diff --git a/project/src/ui/tab-wlect.inc b/project/src/ui/tab-wlect.inc index 90cdd5d..c6b7251 100644 --- a/project/src/ui/tab-wlect.inc +++ b/project/src/ui/tab-wlect.inc @@ -422,7 +422,7 @@ { T_OPT_GP, "LT_RANDOM", "lt-random|ltrandom", "index", - "Force a random scenario, if between 1 and 8." + "Force a random scenario, if INDEX is between 1 and 8." " Value 0 enables auto selection and -1 disables this option." " If needed, LEX section TEST is created or removed if empty." }, diff --git a/project/src/ui/tab-wszst.inc b/project/src/ui/tab-wszst.inc index aa60a17..f1feaf0 100644 --- a/project/src/ui/tab-wszst.inc +++ b/project/src/ui/tab-wszst.inc @@ -1538,7 +1538,7 @@ { T_OPT_GP, "LT_RANDOM", "lt-random|ltrandom", "index", - "Force a random scenario, if between 1 and 8." + "Force a random scenario, if INDEX is between 1 and 8." " Value 0 enables auto selection and -1 disables this option." " Only track.szs files are modified." " If needed, file course.lex and section TEST" diff --git a/project/src/ui/ui-wlect.c b/project/src/ui/ui-wlect.c index a751fdd..551d201 100644 --- a/project/src/ui/ui-wlect.c +++ b/project/src/ui/ui-wlect.c @@ -604,9 +604,9 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = { OPT_LT_RANDOM, false, false, false, false, false, 0, "lt-random", "index", - "Force a random scenario, if between 1 and 8. Value 0 enables auto" - " selection and -1 disables this option. If needed, LEX section TEST" - " is created or removed if empty." + "Force a random scenario, if INDEX is between 1 and 8. Value 0 enables" + " auto selection and -1 disables this option. If needed, LEX section" + " TEST is created or removed if empty." }, { OPT_LEX_PURGE, false, false, false, false, false, 0, "lex-purge", diff --git a/project/src/ui/ui-wszst.c b/project/src/ui/ui-wszst.c index 8a813a4..da13aa2 100644 --- a/project/src/ui/ui-wszst.c +++ b/project/src/ui/ui-wszst.c @@ -1622,8 +1622,8 @@ static const InfoOption_t OptionInfo[OPT__N_TOTAL+1] = { OPT_LT_RANDOM, false, false, false, false, false, 0, "lt-random", "index", - "Force a random scenario, if between 1 and 8. Value 0 enables auto" - " selection and -1 disables this option. Only track.szs files are" + "Force a random scenario, if INDEX is between 1 and 8. Value 0 enables" + " auto selection and -1 disables this option. Only track.szs files are" " modified. If needed, file course.lex and section TEST are created or" " removed if empty." }, diff --git a/project/src/ui/ui.def b/project/src/ui/ui.def index 51bcbd5..fe9833c 100644 --- a/project/src/ui/ui.def +++ b/project/src/ui/ui.def @@ -1252,8 +1252,8 @@ #:def_opt( "LT_RANDOM", "lt-random|ltrandom", "GP", \ "index", \ - "Force a random scenario, if between 1 and 8. Value 0 enables auto" \ - " selection and -1 disables this option. Only track.szs files are" \ + "Force a random scenario, if INDEX is between 1 and 8. Value 0 enables" \ + " auto selection and -1 disables this option. Only track.szs files are" \ " modified. If needed, file course.lex and section TEST are created or" \ " removed if empty." ) @@ -20805,9 +20805,9 @@ #:def_opt( "LT_RANDOM", "lt-random|ltrandom", "GP", \ "index", \ - "Force a random scenario, if between 1 and 8. Value 0 enables auto" \ - " selection and -1 disables this option. If needed, LEX section TEST" \ - " is created or removed if empty." ) + "Force a random scenario, if INDEX is between 1 and 8. Value 0 enables" \ + " auto selection and -1 disables this option. If needed, LEX section" \ + " TEST is created or removed if empty." ) #:def_opt( "LEX_PURGE", "lex-purge|lexpurge", "G", \ "", \ diff --git a/project/src/wlect.c b/project/src/wlect.c index 832bee8..2441970 100644 --- a/project/src/wlect.c +++ b/project/src/wlect.c @@ -1004,7 +1004,7 @@ static enumError cmd_create() //--- data enum { C_HELP, - C_LEX, C_FEATURES, C_SET1, C_CANNON, C_HIDE_PT, C_TEST, + C_LEX, C_FEATURES, C_SET1, C_CANNON, C_HIDE_PT, C_RND_ITPH, C_TEST, C_LPAR, C_LEDEF, C_PREFIX, C_CATEGORY, C_LEINFO, }; @@ -1020,6 +1020,7 @@ static enumError cmd_create() { C_SET1, "SET1", 0, 0 }, { C_CANNON, "CANNONS", 0, 0 }, { C_HIDE_PT, "HIPT", 0, 0 }, + { C_RND_ITPH, "RITP ", 0, 0 }, { C_TEST, "TEST", 0, 0 }, { C_LPAR, "LPAR", 0, 0 }, @@ -1071,15 +1072,17 @@ static enumError cmd_create() case C_SET1: case C_CANNON: case C_HIDE_PT: + case C_RND_ITPH: { lex_t lex; InitializeLEX(&lex); switch (cmd->id) { - case C_FEATURES: AppendFeatLEX(&lex,false,0); break; - case C_SET1: AppendSet1LEX(&lex,false); break; - case C_CANNON: AppendCannLEX(&lex,false); break; - case C_HIDE_PT: AppendHiptLEX(&lex,false); break; + case C_FEATURES: AppendFeatLEX(&lex,false,0); break; + case C_SET1: AppendSet1LEX(&lex,false); break; + case C_CANNON: AppendCannLEX(&lex,false); break; + case C_HIDE_PT: AppendHiptLEX(&lex,false); break; + case C_RND_ITPH: AppendRitpLEX(&lex,false); break; } err = SaveTextLEX(&lex,opt_dest,false); ResetLEX(&lex); diff --git a/project/src/wszst.c b/project/src/wszst.c index 767583d..db45867 100644 --- a/project/src/wszst.c +++ b/project/src/wszst.c @@ -509,6 +509,8 @@ static const sizeof_info_t sizeof_info_szs_list[] = SIZEOF_INFO_ENTRY(lex_element_t) SIZEOF_INFO_ENTRY(lex_set1_t) SIZEOF_INFO_ENTRY(lex_hipt_rule_t) + SIZEOF_INFO_ENTRY(lex_ritp_rule_t) + // [[new-lex-sect]] SIZEOF_INFO_ENTRY(lex_test_t) SIZEOF_INFO_ENTRY(lex_item_t) SIZEOF_INFO_ENTRY(lex_t) diff --git a/project/src/wtest.c b/project/src/wtest.c index e66c89e..48a6af5 100644 --- a/project/src/wtest.c +++ b/project/src/wtest.c @@ -4296,6 +4296,137 @@ static enumError test_key_list ( int argc, char ** argv ) return 0; } +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// test_random() /////////////// +/////////////////////////////////////////////////////////////////////////////// +// test random generator for MKWFUN patcher (LE-CODE) + +unsigned sim_select_id = 0; // simulated select_id +unsigned dwc_gamedata = 1; // simulate always onlne + +/////////////////////////////////////////////////////////////////////////////// + +static unsigned GetSelectId(void) +{ + return sim_select_id; +} + +/////////////////////////////////////////////////////////////////////////////// +// Algorithm based on ideas by Donald E. Knuth + +static unsigned GetSyncRandom1 ( int max ) +{ + unsigned num; + + if (dwc_gamedata) // if online + { + // static vars + static unsigned last_select_id = 0; + static unsigned val_a = 0, val_c = 0, val_x = 0; + + const unsigned select_id = GetSelectId(); + if ( last_select_id != select_id || !val_a ) + { + // new select_id => calculate new seed + last_select_id = select_id; + + // rotate, because lower 16 may be 0 + const int n_shift = 21; + unsigned base = select_id >> n_shift | select_id << (32-n_shift); + base = base ^ ( select_id * 101 ); + + static unsigned val_a_tab[7] = + { + 0xbb40e62d, 0x3dc8f2f5, 0xdc024635, 0x7a5b6c8d, + 0x583feb95, 0x91e06dbd, 0xa7ec03f5, + }; + + val_a = val_a_tab[base%7]; + const u32 VAL_C_ADD = 2 * 197731421; // 2 * prime + val_c = ( (base & 15) + 1 ) * VAL_C_ADD + 1; // always odd + val_x = base; + } + + num = val_x = val_a * val_x + val_c; + } + else + { + // if offline => use standard random function + num = rand(); + } + + // If max>0 return a random (0..max( otherwise return a 32 bit random + return max <= 0 ? num : num % max; +} + +/////////////////////////////////////////////////////////////////////////////// + +static enumError test_random ( int argc, char ** argv ) +{ + if ( argc != 3 ) + { + fputs( "\n" + "Test random generator for MKWFUN patcher (LE-CODE)\n" + "\n" + "Syntax: 'wtest' 'random' SEED N\n" + "\n" + ,stdout); + return ERR_WARNING; + } + + sim_select_id = str2ul(argv[1],0,10); + uint n = str2ul(argv[2],0,10); + printf("\nselect_id = %u = 0x%08x\n\n",sim_select_id,sim_select_id); + + for ( uint i = 0; i < n; i++ ) + { + uint r = GetSyncRandom1(0); + printf("%6u. %11u = %08x\n",i,r,r); + } + + return ERR_OK; +} + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// test_hms() /////////////// +/////////////////////////////////////////////////////////////////////////////// + +static enumError test_hms ( int argc, char ** argv ) +{ + if ( argc < 2 ) + { + fputs( "\n" + "Test output of PrintHMS()\n" + "\n" + "Syntax: 'wtest' 'hms' [+min] value...\n" + "\n" + ,stdout); + return ERR_WARNING; + } + + int min = 30; + printf(">> min = %d%s\n",min,PrintHMS(0,0,min,60," (",")")); + + for ( int i = 1; i < argc; i++ ) + { + ccp arg = argv[i]; + if ( *arg == '+' ) + { + min = str2ul(arg,0,10); + printf(">> min = %d%s\n",min,PrintHMS(0,0,min,60," (",")")); + } + else + { + int val = str2ul(arg,0,10); + printf("val %s: %d%s\n",arg,val,PrintHMS(0,0,val,min," (",")")); + } + } + + return ERR_OK; +} + // /////////////////////////////////////////////////////////////////////////////// /////////////// develop() /////////////// @@ -4604,6 +4735,8 @@ enum CMD_PF_EXPAND, // test_pf_expand(argc,argv) CMD_CODED_VERSION, // test_coded_version(argc,argv) CMD_KEY_LIST, // test_key_list(argc,argv) + CMD_RANDOM, // test_random(argc,argv) + CMD_HMS, // test_hms(argc,argv) #ifdef HAVE_WIIMM_EXT CMD_WIIMM, // test_wiimm(argc,argv) @@ -4683,6 +4816,8 @@ static const KeywordTab_t CommandTab[] = { CMD_PF_EXPAND, "PF-EXPAND", "PFE", 0 }, { CMD_CODED_VERSION, "CVERSION", "CV", 0 }, { CMD_KEY_LIST, "KEY-LIST", "KL", 0 }, + { CMD_RANDOM, "RANDOM", "RND", 0 }, + { CMD_HMS, "HMS", 0, 0 }, #ifdef HAVE_WIIMM_EXT { CMD_WIIMM, "WIIMM", "W", 0 }, @@ -4752,6 +4887,34 @@ int main ( int argc, char ** argv ) ADDRT_MIRROR_BEGIN, ADDRT_MIRROR_END, ADDRT__N, ADDRT__NN ); + if (0) // test MINMAX() and MINMAX0() + { + const int list[] = { -3, -1, 0, 5, 9 }; + const int n = sizeof(list)/sizeof(*list); + for ( int i = 0; i < n; i++ ) + { + putchar('\n'); + const int x = list[i]; + for ( int j = 0; j < n; j++ ) + { + const int y = list[j]; + for ( int k = 0; k < n; k++ ) + { + const int z = list[k]; + printf("%2d %2d %2d => %2d %2d\n",x,y,z,MINMAX(x,y,z),MINMAX0(x,y,z)); + } + } + } + + double3 d3; + double *d = d3.v; + printf("%zu/%zu=%zu\n",sizeof(d3.v),sizeof(*d),sizeof(d3.v)/sizeof(*d)); + + float3 f3; + float *f = f3.v; + printf("%zu/%zu=%zu\n",sizeof(f3.v),sizeof(*f),sizeof(f3.v)/sizeof(*f)); + } + if (0) { double3 d3; @@ -4862,6 +5025,8 @@ int main ( int argc, char ** argv ) case CMD_PF_EXPAND: test_pf_expand(argc,argv); break; case CMD_CODED_VERSION: test_coded_version(argc,argv); break; case CMD_KEY_LIST: test_key_list(argc,argv); break; + case CMD_RANDOM: test_random(argc,argv); break; + case CMD_HMS: test_hms(argc,argv); break; #ifdef HAVE_WIIMM_EXT case CMD_WIIMM: test_wiimm(argc,argv); break; diff --git a/project/templates/HISTORY.txt b/project/templates/HISTORY.txt index 92a6048..77c0802 100644 --- a/project/templates/HISTORY.txt +++ b/project/templates/HISTORY.txt @@ -739,6 +739,21 @@ szs v2.33a r8773 - 2023-01-14 - All tools: Command V is a well defined short cut for command VERSION. +szs v2.34a r8786 - 2023-05-28 + + - Windows only: Updated 64 bit version of Cygwin to DLL 3.4.3 / 2022-12-16. + - GNU Compiler (GNUC) upto version 13 supported. + - wstrt PORT: Updated porting database. + - Updated prefix database: + - Added LBPK, M&SOWG, MP5, MP6, MSS, S1, S2, S3 and WFUS. + - Renamed RV to Re-Volt + - wszst PATCH --ignore: Keep silent if a wildcard pattern matches no file. + - New command: wszst WILDCARDS: Each parameter is treated as a file name and + wildcards are expanded. Finally, one line is printed for each matched name. + - Tool wszst: New otpion --log-cache=file: Log some cache activities to FILE. + - Improved detection of invalid references in KCL octree (avoid crash). + + @@MODULE(last-history.txt)@@ diff --git a/project/templates/module/last-history.txt b/project/templates/module/last-history.txt index 81da6a7..b027df1 100644 --- a/project/templates/module/last-history.txt +++ b/project/templates/module/last-history.txt @@ -1,16 +1,11 @@ szs v@@VERSION@@ r@@REV-NEXT@@ - @@@@-@@-@@ - - Windows only: Updated 64 bit version of Cygwin to DLL 3.4.3 / 2022-12-16. - - GNU Compiler (GNUC) upto version 13 supported. - - wstrt PORT: Updated porting database. - - Updated prefix database: - - Added LBPK, M&SOWG, MP5, MP6, MSS, S1, S2, S3 and WFUS. - - Renamed RV to Re-Volt - - wszst PATCH --ignore: Keep silent if a wildcard pattern matches no file. - - New command: wszst WILDCARDS: Each parameter is treated as a file name and - wildcards are expanded. Finally, one line is printed for each matched name. - - Tool wszst: New otpion --log-cache=file: Log some cache activities to FILE. - - Improved detection of invalid references in KCL octree (avoid crash). + - Updated prefix database: Added MK8DX (alias of SW), MK8S, SBSPBfBB, SMB, + SMBM, TFR, ZeldaWW (alias of WW). + - Support for online-time-limit by LPAR and LEX:SET1. + - Support for new LEX section RITP (Random next-links @KMP:ITPH). + - Fixed end-of-line bugs in LEX text output (CR+LF required for Windows). + - wlect dump: Colored flags. ~ - MDL support: Scanning a MDL file and transferring the data into an internal ~ format was already implemented, but only used for analysis purposes. Now it diff --git a/project/text-files/kmp.inc/kmp-pt-info-cr.inc b/project/text-files/kmp.inc/kmp-pt-info-cr.inc index f11d5a8..a90e5dc 100644 --- a/project/text-files/kmp.inc/kmp-pt-info-cr.inc +++ b/project/text-files/kmp.inc/kmp-pt-info-cr.inc @@ -31,6 +31,6 @@ # If you enable EXPORT-FLAGS (set it to 1), the flags are exported using the # lowest byte of WIDTH FACTOR. The factor needs only 2 or 3 digits, so this # has no disadvantage on the width factors. 5 of the 8 bits are used to verify -# changes by other tools on import. If at least 1 of these bit of all points +# changes by other tools on import. If at least 1 of these bit of any point # is wrong, import is canceled. @EXPORT-FLAGS = %d # 0=disabled, 1=enabled (overridden by option --export-flags) diff --git a/project/text-files/lex.inc/lex-elem-ritp-cr.inc b/project/text-files/lex.inc/lex-elem-ritp-cr.inc new file mode 100644 index 0000000..88050d2 --- /dev/null +++ b/project/text-files/lex.inc/lex-elem-ritp-cr.inc @@ -0,0 +1,47 @@ + +#FF# +############################################################################### + +[RITP] +# Sort order: %u + +# Normally only the first next-link of KMP:ITPH is used for Bullet Bill and +# Red Shells (except when the shell has already targeted a player). In the +# case of equivalent routes, however, it would be desirable for one of the +# possible routes to always be selected at random. It is important to ensure +# that everyone uses the same route when racing online. +# +# And exactly this can be defined with this section. Therfore you define a +# list with rules. Each rule defines the index of the ITPH element, the number +# of next-links affected, and the type of modification. LE-CODE is very robust +# here and only accepts valid rules on existing elements. + +# Rule members: +# INDEX: Index of KMP:ITPH entry (0..255). +# NN: Number of next-links to shuffle (2..6). +# MODE: How to shuffle (see below). +# PARAM: Optional parameter for some modes (see below). + +# Modes: +# +# RITP$OFF +# Ignore this rule, but store it including PARAM. +# This mode can be used to temporary deactivate a rule. +# +# RITP$START +# Select first next-link by random at race start. The selected next-link +# must be defined (not -1 == not 0xff), otherwise ignore the rule. +# PARAM is ignored. +# +# More modes are planned. + +# Example: +# ITPH element #10 (zero based index) has defined 3 equivalent routes and 2 +# additional routes by its next-links. At race start one of the first 3 links +# should be selected by random as standard route. The rule for this case is: +# +# 10 3 RITP$START +# +# This rule is ignored by LE-CODE, if the addressed ITPH element does not +# exists or if the by random selected next-link is not defined. + diff --git a/project/text-files/lex.inc/lex-elem-ritp-tabhead-cr.inc b/project/text-files/lex.inc/lex-elem-ritp-tabhead-cr.inc new file mode 100644 index 0000000..971cafb --- /dev/null +++ b/project/text-files/lex.inc/lex-elem-ritp-tabhead-cr.inc @@ -0,0 +1,4 @@ +#RITP# +#----------------------------- +# index nn mode param +#----------------------------- 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 4700bc8..e41d1ca 100644 --- a/project/text-files/lex.inc/lex-elem-set1-cr.inc +++ b/project/text-files/lex.inc/lex-elem-set1-cr.inc @@ -25,3 +25,12 @@ # tracks that must be marked with value 1 as an exception to avoid banning. @START-ITEM = %u + +# If playing online, the racing time is limited. The original MKW uses 5:00 +# and LE-CODE 5:40 by default. A racing track can apply another online limit +# if the following setting is >0. Values between %us%s and %us%s +# are accepted. LPAR settings MIN-ONLINE-SEC and MAX-ONLINE-SEC limit the +# actually used value. + +@APPLY-ONLINE-SEC = %u%s + 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 index b639c61..f0de66c 100644 --- a/project/text-files/lex.inc/lex-elem-set1-develop-cr.inc +++ b/project/text-files/lex.inc/lex-elem-set1-develop-cr.inc @@ -5,6 +5,4 @@ # values can still change. Therefore, they should not be used, or at most # experimentally. -@TEST_0D = %d -@TEST_0E = %d -@TEST_0F = %d +@PADDING-0D = %d diff --git a/project/text-files/lex.inc/lex-hexdump-cr.inc b/project/text-files/lex.inc/lex-hexdump-cr.inc index 156281f..ecd3e28 100644 --- a/project/text-files/lex.inc/lex-hexdump-cr.inc +++ b/project/text-files/lex.inc/lex-hexdump-cr.inc @@ -5,12 +5,25 @@ [HEXDUMP] # Sort order: %u -# Unknown sections are stored as hexdump to keep the data. The address field -# and the ASCII part are for info only and ignored on scanning. +# Unknown sections are stored as hexdump to keep the data. Parameter @MAGIC +# defines the type of the section. @MAGIC = 0x%08x # %s +# Syntax of the data lines: +# HEXLINE := [ ADDRESS ':' ] DATA [COMMENT] +# COMMENT := ( [ ':' | '#' | '/' ) ANY_TEXT +# DATA := HEXBYTE | EXPR +# EXPR := '(' SZS_TOOLS_EXPRESSION ')' +# +# The address field and the ASCII part (a COMMENT by definition) are for info +# only and ignored on scanning. +# +# The result of SZS_TOOLS_EXPRESSION is stored in network byte order (big +# endian). Integers and floats are stored as 4 bytes, vectors as 3 floats with +# 12 bytes total. Strings are stored as bytes without terminating NULL. + #HEX# #----+------------------------------------------------------+----------------+ -#addr: data: bytes in hex | '(' expression ')' : ASCII of data : +#addr: data: byte in hex | '(' expression ')' : ASCII of data : #----+------------------------------------------------------+----------------+ diff --git a/project/text-files/lex.inc/lex-hexdump-sep-cr.inc b/project/text-files/lex.inc/lex-hexdump-sep-cr.inc new file mode 100644 index 0000000..403297c --- /dev/null +++ b/project/text-files/lex.inc/lex-hexdump-sep-cr.inc @@ -0,0 +1 @@ +#----+------------------------------------------------------+----------------+ diff --git a/project/text-files/lex.inc/lex-setup-cr.inc b/project/text-files/lex.inc/lex-setup-cr.inc index 9ba1e5f..2e22c97 100644 --- a/project/text-files/lex.inc/lex-setup-cr.inc +++ b/project/text-files/lex.inc/lex-setup-cr.inc @@ -5,7 +5,7 @@ [SETUP] # This is the general setup and info section. Some parameters are preceeded by # a hash ('#') to signal the informative only status. This section should -# always be the first one. +# always be the first one to setup correct scanning modes. # Identify the tool and version, that have written this file: TOOL = %s @@ -14,4 +14,4 @@ VERSION = %s REVISION = %u DATE = %s -# Statistics: List of all included sections (magic text+hex,size): +# Statistics: List of all included sections (magic name+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 e83bb8e..d165e35 100644 --- a/project/text-files/lpar.inc/lpar-sect-param-cr.inc +++ b/project/text-files/lpar.inc/lpar-sect-param-cr.inc @@ -130,3 +130,17 @@ BLOCK-TEXTURES = %u STATICR-POINTS = %u +# If playing online, the racing time is limited. The original MKW uses 5:00 +# and LE-CODE & CTGP use 5:40. With the next parameter this time can be +# changed between %us%s and %us%s. If the time is >%u%s, then +# the related watchdog (countdown + race_time + scoreboards) is disabled. + +DEF-ONLINE-SEC = %3u%s + +# A racing track can request a different online limit by LEX setting +# SET1:APPLY-ONLINE-SEC. The following 2 parameters limit the actually used +# value. If either of them is zero, then SET1:APPLY-ONLINE-SEC is ignored. + +MIN-ONLINE-SEC = %3u%s +MAX-ONLINE-SEC = %3u%s + -- cgit v1.3.1