aboutsummaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
Diffstat (limited to 'project')
-rw-r--r--project/Makefile2
-rw-r--r--project/dclib/dclib-network.c8
-rw-r--r--project/dclib/dclib-numeric.c2
-rw-r--r--project/dclib/dclib-option.c2
-rw-r--r--project/dclib/lib-mkw-def.h29
-rw-r--r--project/dclib/lib-mkw.c155
-rw-r--r--project/dclib/lib-mkw.h53
-rw-r--r--project/revision.sh2
-rw-r--r--project/src/lib-analyze.c18
-rw-r--r--project/src/lib-ctcode.h2
-rw-r--r--project/src/lib-file.c12
-rw-r--r--project/src/lib-lecode.c288
-rw-r--r--project/src/lib-lecode.h56
-rw-r--r--project/src/lib-ledis.c373
-rw-r--r--project/src/lib-ledis.h91
-rw-r--r--project/src/lib-numeric.c104
-rw-r--r--project/src/lib-numeric.h47
-rw-r--r--project/src/lib-parser-func.c12
-rw-r--r--project/src/lib-std.c2
-rw-r--r--project/src/lib-std.h3
-rw-r--r--project/src/ui/tab-wlect.inc24
-rw-r--r--project/src/ui/ui-wlect.c134
-rw-r--r--project/src/ui/ui-wlect.h9
-rw-r--r--project/src/ui/ui.def159
-rw-r--r--project/src/wkmpt.c4
-rw-r--r--project/src/wlect.c74
-rw-r--r--project/src/wszst.c6
-rw-r--r--project/src/wtest.c8
-rw-r--r--project/templates/HISTORY.txt7
-rw-r--r--project/templates/module/last-history.txt19
-rw-r--r--project/text-files/distrib.inc/distrib-tracks-cr.inc26
-rw-r--r--project/text-files/ledis.inc/ledis-ledef-track-list-cr.inc8
32 files changed, 1179 insertions, 560 deletions
diff --git a/project/Makefile b/project/Makefile
index a55b2d7..8a0a55f 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.29b
+VERSION_NUM = 2.30a
BETA_VERSION = 0
# 0:off -1:"beta" >0:"beta#"
diff --git a/project/dclib/dclib-network.c b/project/dclib/dclib-network.c
index abc5f08..adfa7c9 100644
--- a/project/dclib/dclib-network.c
+++ b/project/dclib/dclib-network.c
@@ -2908,7 +2908,7 @@ void PrintTranferStatistics
char duration_buf[10];
if (!duration_info)
{
- PrintTimerUSec6(duration_buf,sizeof(duration_buf),duration,false);
+ PrintTimerUSec6(duration_buf,sizeof(duration_buf),duration,0);
duration_info = duration_buf;
}
@@ -3765,21 +3765,21 @@ char * BufInfoTCPStream
char connect_usec[7];
if ( ts->connect_usec )
PrintTimerUSec6(connect_usec,sizeof(connect_usec),
- now_usec - ts->connect_usec, true );
+ now_usec - ts->connect_usec, DC_SFORM_ALIGN );
else
connect_usec[0] = '-', connect_usec[1] = 0;
char receive_usec[7];
if ( ts->receive_usec )
PrintTimerUSec6(receive_usec,sizeof(receive_usec),
- now_usec - ts->receive_usec, true );
+ now_usec - ts->receive_usec, DC_SFORM_ALIGN );
else
receive_usec[0] = '-', receive_usec[1] = 0;
char send_usec[7];
if ( ts->send_usec )
PrintTimerUSec6(send_usec,sizeof(send_usec),
- now_usec - ts->send_usec, true );
+ now_usec - ts->send_usec, DC_SFORM_ALIGN );
else
send_usec[0] = '-', send_usec[1] = 0;
diff --git a/project/dclib/dclib-numeric.c b/project/dclib/dclib-numeric.c
index 500d3bc..e26376b 100644
--- a/project/dclib/dclib-numeric.c
+++ b/project/dclib/dclib-numeric.c
@@ -1442,7 +1442,7 @@ uint EncodeVersion ( ccp arg )
char *next;
uint major = str2ul(arg,&next,10);
if ( major > 4293 )
- major = major;
+ major = 4293;
uint minor = 0, letter = 0, beta = ~0;
if ( *next == '.' )
diff --git a/project/dclib/dclib-option.c b/project/dclib/dclib-option.c
index fdcce94..ae7e3a8 100644
--- a/project/dclib/dclib-option.c
+++ b/project/dclib/dclib-option.c
@@ -547,7 +547,7 @@ ccp PrintGParam ( const GParam_t *par )
case GOPT_IDX_DURATION:
snprintf(buf,sizeof(buf),"[DUR] %12g = %s",
- par->d, PrintTimerUSec6(0,0,double2usec(par->d),false) );
+ par->d, PrintTimerUSec6(0,0,double2usec(par->d),0) );
break;
case GOPT_IDX_STRING:
diff --git a/project/dclib/lib-mkw-def.h b/project/dclib/lib-mkw-def.h
index fbda197..df5c85f 100644
--- a/project/dclib/lib-mkw-def.h
+++ b/project/dclib/lib-mkw-def.h
@@ -91,6 +91,35 @@ MkwTrackCategory_t * GetMkwTrackCategory ( int id );
//
///////////////////////////////////////////////////////////////////////////////
+//////////////////////////// LE-CODE track flags //////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+
+// [[LecodeFlags_t]]
+typedef enum LecodeFlags_t
+{
+ G_LEFL_NEW = 0x0001, // N2: new track
+ G_LEFL_RND_HEAD = 0x0002, // HX: first track of random group
+ G_LEFL_RND_GROUP = 0x0004, // GX: member of random group, but not first
+ G_LEFL_ALIAS = 0x0008, // A-: use TrackByAliasLE(prop,music)
+ G_LEFL_TEXTURE = 0x0010, // T2: track is declared as texture hack of same property slot
+ G_LEFL_HIDDEN = 0x0020, // i-: exclude a track from cups.
+ G_LEFL__RND = 0x0006, // both random flags
+ G_LEFL__ALL = 0x003f, // all bits of above
+ G_LEFL_BATTLE = 0x0100, // B-: track is a battle arena
+ G_LEFL_VERSUS = 0x0200, // V-: track is a versus track
+ G_LEFL_CUP = 0x0400, // --: track is referenced by a cup
+ G_LEFL_ORIG_CUP = 0x0800, // ob: track is referenced by a original cup
+ G_LEFL_CUSTOM_CUP = 0x1000, // cb: track is referenced by a custom cup
+ G_LEFL_RANDOM = 0x2000, // r-: slot id LE-CODE random
+ G_LEFL__USED = 0x3c3f, // if any of these bits is set, the track is used
+ G_LEFL__XALL = 0x3f3f, // all bits of above
+}
+LecodeFlags_t;
+
+#define DB_LECODE_FLAGS_TYPE "smallint unsigned"
+
+//
+///////////////////////////////////////////////////////////////////////////////
/////////////////////////////////// misc //////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
diff --git a/project/dclib/lib-mkw.c b/project/dclib/lib-mkw.c
index a97b8e2..bdbf80b 100644
--- a/project/dclib/lib-mkw.c
+++ b/project/dclib/lib-mkw.c
@@ -1171,33 +1171,33 @@ const mkw_driver_t mkw_driver_attrib[MKW_N_DRIVER+1] =
{ 1, 0, "Peac", "Peac", "Peach", "Peach" }, // M2 #16
{ 1, 0, "Bird", "Bird", "Birdo", "Birdo" }, // M5
{ 1, 0, "DidK", "DidK", "Diddy Kong", "Diddy Kong" }, // M6
- { 2, 0, "KBoo", "BuHu", "King Boo", "König Buu Huu" }, // L4
+ { 2, 0, "KBoo", "BuHu", "King Boo", "König Buu Huu" }, // L4
{ 1, 0, "B.Jr", "B.Jr", "Bowser Jr.", "Bowser Jr." }, // M7 #20
{ 2, 0, "DBow", "KnBo", "Dry Bowser", "Knochen-Bowser" }, // L7
{ 2, 0, "Funk", "Funk", "Funky Kong", "Funky Kong" }, // L6
{ 2, 0, "Rosa", "Rosa", "Rosalina", "Rosalina" }, // L5
- { 0, 1, "MAsm", "MAkm", "Mii A (small,male)", "Mii A (klein,männ)" }, // S8 #24
+ { 0, 1, "MAsm", "MAkm", "Mii A (small,male)", "Mii A (klein,männ)" }, // S8 #24
{ 0, 1, "MAsf", "MAkw", "Mii A (small,female)", "Mii A (klein,weib)" }, // S9
- { 0, 2, "MBsm", "MBkm", "Mii B (small,male)", "Mii B (klein,männ)" }, // S10
+ { 0, 2, "MBsm", "MBkm", "Mii B (small,male)", "Mii B (klein,männ)" }, // S10
{ 0, 2, "MBsf", "MBkw", "Mii B (small,female)", "Mii B (klein,weib)" }, // S11
- { 0, 3, "MCsm", "MCkm", "Mii C (small,male)", "Mii C (klein,männ)" }, // 0x11c
+ { 0, 3, "MCsm", "MCkm", "Mii C (small,male)", "Mii C (klein,männ)" }, // 0x11c
{ 0, 3, "MCsf", "MCkw", "Mii C (small,female)", "Mii C (klein,weib)" }, // 0x11d
- { 1, 1, "MAmm", "MAmm", "Mii A (medium,male)", "Mii A (mittel,männ)" },// M8 #30
+ { 1, 1, "MAmm", "MAmm", "Mii A (medium,male)", "Mii A (mittel,männ)" },// M8 #30
{ 1, 1, "MAmf", "MAmw", "Mii A (medium,female)","Mii A (mittel,weib)" },// M9
- { 1, 2, "MBmm", "MBmm", "Mii B (medium,male)", "Mii B (mittel,männ)" },// M10
+ { 1, 2, "MBmm", "MBmm", "Mii B (medium,male)", "Mii B (mittel,männ)" },// M10
{ 1, 2, "MBmf", "MBmw", "Mii B (medium,female)","Mii B (mittel,weib)" },// M11
- { 1, 3, "MCmm", "MCmm", "Mii C (medium,male)", "Mii C (mittel,männ)" },// 0x122
+ { 1, 3, "MCmm", "MCmm", "Mii C (medium,male)", "Mii C (mittel,männ)" },// 0x122
{ 1, 3, "MCmf", "MCmw", "Mii C (medium,female)","Mii C (mittel,weib)" },// 0x123
- { 2, 1, "MAlm", "MAgm", "Mii A (large,male)", "Mii A (groß,männ)" }, // L8 #36
- { 2, 1, "MAlf", "MAgw", "Mii A (large,female)", "Mii A (groß,weib)" }, // L9
- { 2, 2, "MBlm", "MBgm", "Mii B (large,male)", "Mii B (groß,männ)" }, // L10
- { 2, 2, "MBlf", "MBgw", "Mii B (large,female)", "Mii B (groß,weib)" }, // L11
- { 2, 3, "MClm", "MCgm", "Mii C (large,male)", "Mii C (groß,männ)" }, // 0x128
- { 2, 3, "MClf", "MCgw", "Mii C (large,female)", "Mii C (groß,weib)" }, // 0x129
+ { 2, 1, "MAlm", "MAgm", "Mii A (large,male)", "Mii A (groß,männ)" }, // L8 #36
+ { 2, 1, "MAlf", "MAgw", "Mii A (large,female)", "Mii A (groß,weib)" }, // L9
+ { 2, 2, "MBlm", "MBgm", "Mii B (large,male)", "Mii B (groß,männ)" }, // L10
+ { 2, 2, "MBlf", "MBgw", "Mii B (large,female)", "Mii B (groß,weib)" }, // L11
+ { 2, 3, "MClm", "MCgm", "Mii C (large,male)", "Mii C (groß,männ)" }, // 0x128
+ { 2, 3, "MClf", "MCgw", "Mii C (large,female)", "Mii C (groß,weib)" }, // 0x129
{0,0,"","",0,0} // TERM #42
};
@@ -1319,6 +1319,134 @@ ccp GetVehicleName4 ( u8 vehicle )
//
///////////////////////////////////////////////////////////////////////////////
+/////////////// LE-CODE track flags ///////////////
+///////////////////////////////////////////////////////////////////////////////
+
+le_flags_t ScanLEFL ( ccp text )
+{
+ // automatic flags are not scannend!
+
+ le_flags_t res = 0;
+ if (text)
+ {
+ if ( strchr(text,'N') || strchr(text,'n') ) res |= G_LEFL_NEW;
+ if ( strchr(text,'H') || strchr(text,'h') ) res |= G_LEFL_RND_HEAD;
+ if ( strchr(text,'G') || strchr(text,'g') ) res |= G_LEFL_RND_GROUP;
+ if ( strchr(text,'X') || strchr(text,'x') ) res |= G_LEFL_RND_HEAD | G_LEFL_RND_GROUP;
+ if ( strchr(text,'A') || strchr(text,'a') ) res |= G_LEFL_ALIAS;
+ if ( strchr(text,'T') || strchr(text,'t') ) res |= G_LEFL_TEXTURE;
+ if ( strchr(text,'2') ) res |= G_LEFL_ALIAS | G_LEFL_TEXTURE;
+ if ( strchr(text,'I') || strchr(text,'i') ) res |= G_LEFL_HIDDEN;
+ }
+ return res;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+ccp PrintLEFL8 ( le_flags_t flags, bool aligned )
+{
+ char *buf = GetCircBuf(7);
+ flags &= 0xff;
+
+ if ( flags & ~G_LEFL__ALL )
+ snprintf(buf,7,"?0x%02x ",flags);
+ else if (aligned)
+ {
+ buf[0] = flags & G_LEFL_NEW ? 'N' : '-';
+ buf[1] = flags & G_LEFL_RND_HEAD ? 'H' : '-';
+ buf[2] = flags & G_LEFL_RND_GROUP ? 'G' : '-';
+ buf[3] = flags & G_LEFL_ALIAS ? 'A' : '-';
+ buf[4] = flags & G_LEFL_TEXTURE ? 'T' : '-';
+ buf[5] = flags & G_LEFL_HIDDEN ? 'i' : '-';
+ buf[6] = 0;
+ }
+ else
+ {
+ char *d = buf;
+ if ( flags & G_LEFL_NEW ) *d++ = 'N';
+ if ( flags & G_LEFL_RND_HEAD ) *d++ = 'H';
+ if ( flags & G_LEFL_RND_GROUP ) *d++ = 'G';
+ if ( flags & G_LEFL_ALIAS ) *d++ = 'A';
+ if ( flags & G_LEFL_TEXTURE ) *d++ = 'T';
+ if ( flags & G_LEFL_HIDDEN ) *d++ = 'i';
+ if ( d == buf )
+ *d++ = '-';
+ *d = 0;
+ }
+ return buf;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+ccp PrintLEFL16 ( le_flags_t flags, bool aligned )
+{
+ char *buf = GetCircBuf(7);
+
+ if ( flags & ~G_LEFL__XALL )
+ {
+ snprintf(buf,7,"?0x%03x ",flags);
+ return buf;
+ }
+
+ char *d = buf;
+ switch ( flags & (G_LEFL_BATTLE|G_LEFL_VERSUS|G_LEFL_RANDOM) )
+ {
+ case G_LEFL_BATTLE: *d++ = 'B'; break;
+ case G_LEFL_VERSUS: *d++ = 'V'; break;
+ case G_LEFL_RANDOM: *d++ = 'r'; break;
+ default:
+ if ( aligned )
+ *d++ = '-';
+ }
+
+ switch ( flags & (G_LEFL_ORIG_CUP|G_LEFL_CUSTOM_CUP) )
+ {
+ case G_LEFL_ORIG_CUP: *d++ = 'o'; break;
+ case G_LEFL_CUSTOM_CUP: *d++ = 'c'; break;
+ case G_LEFL_ORIG_CUP | G_LEFL_CUSTOM_CUP: *d++ = 'b'; break;
+ default:
+ if ( aligned )
+ *d++ = '-';
+ }
+
+ switch ( flags & (G_LEFL_RND_HEAD|G_LEFL_RND_GROUP) )
+ {
+ case G_LEFL_RND_HEAD: *d++ = 'H'; break;
+ case G_LEFL_RND_GROUP: *d++ = 'G'; break;
+ case G_LEFL_RND_HEAD | G_LEFL_RND_GROUP: *d++ = 'X'; break;
+ default:
+ if ( aligned )
+ *d++ = '-';
+ }
+
+ switch ( flags & (G_LEFL_NEW|G_LEFL_TEXTURE) )
+ {
+ case G_LEFL_NEW: *d++ = 'N'; break;
+ case G_LEFL_TEXTURE: *d++ = 'T'; break;
+ case G_LEFL_NEW | G_LEFL_TEXTURE: *d++ = '2'; break;
+ default:
+ if ( aligned )
+ *d++ = '-';
+ }
+
+ if (aligned)
+ {
+ *d++ = flags & G_LEFL_ALIAS ? 'A' : '-';
+ *d++ = flags & G_LEFL_HIDDEN ? 'i' : '-';
+ }
+ else
+ {
+ if ( flags & G_LEFL_ALIAS ) *d++ = 'A';
+ if ( flags & G_LEFL_HIDDEN ) *d++ = 'i';
+ if ( d == buf )
+ *d++ = '-';
+ }
+ *d = 0;
+ return buf;
+}
+
+//
+///////////////////////////////////////////////////////////////////////////////
/////////////// random slots ///////////////
///////////////////////////////////////////////////////////////////////////////
@@ -1350,6 +1478,7 @@ ccp GetLecodeRandomInfo ( uint slot, ccp return_on_err )
: return_on_err;
}
+
//
///////////////////////////////////////////////////////////////////////////////
/////////////// sizeof_info_t: mkw ///////////////
diff --git a/project/dclib/lib-mkw.h b/project/dclib/lib-mkw.h
index 5233506..8141e46 100644
--- a/project/dclib/lib-mkw.h
+++ b/project/dclib/lib-mkw.h
@@ -89,6 +89,7 @@ enum mkw_consts_t // some constants
MKW_ORIGINAL_BEG = MKW_TRACK_BEG,
MKW_ORIGINAL_END = MKW_ARENA_END,
+
//--- LE-CODE random tracks
MKW_LE_RANDOM_BEG = 0x3d,
@@ -106,6 +107,13 @@ enum mkw_consts_t // some constants
MKW_LE_SLOT_END = 0x1000,
MKW_N_LE_SLOT = MKW_LE_SLOT_END - MKW_LE_SLOT_BEG,
+
+ //--- special slots (LE-CODE randon included)
+
+ MKW_SPECIAL_BEG = MKW_ORIGINAL_END,
+ MKW_SPECIAL_END = MKW_LE_SLOT_BEG,
+
+
//--- music ids
MKW_MUSIC_MIN_ID = 0x75,
@@ -148,7 +156,11 @@ static inline bool IsValidLecodeSlot ( uint tid )
|| tid >= MKW_LE_RANDOM_BEG && tid < MKW_LE_RANDOM_END; }
static inline bool IsMkwSpecial ( uint tid )
- { return tid >= MKW_ARENA_END && tid < MKW_LE_SLOT_BEG; }
+ { return tid >= MKW_SPECIAL_BEG && tid < MKW_SPECIAL_END; }
+
+static inline bool IsLecodeSpecial ( uint tid )
+ { return tid >= MKW_SPECIAL_BEG && tid < MKW_LE_RANDOM_BEG
+ || tid >= MKW_LE_RANDOM_END && tid < MKW_SPECIAL_END; }
//
///////////////////////////////////////////////////////////////////////////////
@@ -430,6 +442,45 @@ ccp GetVehicleName4 ( u8 vehicle );
//
///////////////////////////////////////////////////////////////////////////////
+/////////////// LE-CODE track flags ///////////////
+///////////////////////////////////////////////////////////////////////////////
+// bits for [[le_flags8_t]] [[le_flags_t]]
+
+typedef u8 le_flags8_t; // type of LE-CODE track flags (classic 8 bits)
+typedef u16 le_flags_t; // type of LE-CODE track flags since build 35
+
+// see 'LecodeFlags_t' in dclib/lib-mkw-def.h for G_LEFL_*
+
+static inline bool IsTitleLEFL ( le_flags_t flags )
+ { return (flags&(G_LEFL_RND_HEAD|G_LEFL_RND_GROUP)) == G_LEFL_RND_HEAD; }
+
+static inline bool IsHiddenLEFL ( le_flags_t flags )
+ { return (flags&G_LEFL_HIDDEN)
+ || (flags&(G_LEFL_RND_HEAD|G_LEFL_RND_GROUP)) == G_LEFL_RND_GROUP; }
+
+static inline bool IsRandomLEFL ( le_flags_t flags )
+ { return (flags&(G_LEFL_RND_HEAD|G_LEFL_RND_GROUP)) != 0; }
+
+//-----------------------------------------------------------------------------
+// scan lecode flags
+
+le_flags_t ScanLEFL ( ccp text );
+
+//-----------------------------------------------------------------------------
+// print lecode flags
+
+ccp PrintLEFL8 ( le_flags_t flags, bool aligned );
+ccp PrintLEFL16 ( le_flags_t flags, bool aligned );
+
+static inline ccp PrintLEFL ( le_flags_t flags_bits, le_flags_t flags, bool aligned )
+ { return ( flags_bits == 16 ? PrintLEFL16 : PrintLEFL8 )(flags,aligned); }
+
+typedef ccp (*PrintLEFL_func) ( le_flags_t flags, bool aligned );
+static inline PrintLEFL_func GetPrintLEFL ( uint flags_bits )
+ { return flags_bits == 16 ? PrintLEFL16 : PrintLEFL8; }
+
+//
+///////////////////////////////////////////////////////////////////////////////
/////////////// END ///////////////
///////////////////////////////////////////////////////////////////////////////
diff --git a/project/revision.sh b/project/revision.sh
index ad26d03..5b63af6 100644
--- a/project/revision.sh
+++ b/project/revision.sh
@@ -1 +1 @@
-revision=8696
+revision=8708
diff --git a/project/src/lib-analyze.c b/project/src/lib-analyze.c
index 710fbf5..e8eeadd 100644
--- a/project/src/lib-analyze.c
+++ b/project/src/lib-analyze.c
@@ -677,6 +677,7 @@ enumError ExecAnalyzeLECODE ( analyze_param_t *ap )
"build=%d\n"
"region=\"%s\"\n"
"debug=%d\n"
+ "identifier=\"%s\"\n"
"header_size=%d\n"
"file_size=%d\n"
"creation_time=\"%u, %s\"\n"
@@ -685,17 +686,18 @@ enumError ExecAnalyzeLECODE ( analyze_param_t *ap )
"recommended_szs=\"%u, %s\"\n"
"edit_by_szs=\"%u, %s\"\n"
- ,ana.head->phase
+ ,ana.head->v3.phase
,ana.header_vers
- ,ntohl(ana.head->build_number)
- ,ana.head->region == 'P' ? "PAL"
- :ana.head->region == 'E' ? "USA"
- :ana.head->region == 'J' ? "Japan"
- :ana.head->region == 'K' ? "Korea"
+ ,ntohl(ana.head->v3.build_number)
+ ,ana.head->v3.region == 'P' ? "PAL"
+ :ana.head->v3.region == 'E' ? "USA"
+ :ana.head->v3.region == 'J' ? "Japan"
+ :ana.head->v3.region == 'K' ? "Korea"
: "?"
- ,ana.head->debug == 'D'
+ ,ana.head->v3.debug == 'D'
+ ,ana.identifier
,ana.header_size
- ,ntohl(ana.head->file_size)
+ ,ntohl(ana.head->v3.file_size)
,ana.creation_time
,ana.creation_time ? PrintTimeByFormat("%F %T %Z",ana.creation_time) : "-"
,ana.edit_time
diff --git a/project/src/lib-ctcode.h b/project/src/lib-ctcode.h
index 068c51c..5e97766 100644
--- a/project/src/lib-ctcode.h
+++ b/project/src/lib-ctcode.h
@@ -116,8 +116,6 @@ typedef u8 le_music_t; // type of music indices
static inline int TrackByAliasLE ( le_property_t prop, le_music_t music )
{ return prop << 8 | music; }
-le_flags_t ScanLEFT ( ccp text );
-
//
///////////////////////////////////////////////////////////////////////////////
/////////////// ctcode_*_t ///////////////
diff --git a/project/src/lib-file.c b/project/src/lib-file.c
index 2cd1019..0160f7b 100644
--- a/project/src/lib-file.c
+++ b/project/src/lib-file.c
@@ -4713,25 +4713,25 @@ void AnalyseSPF
if (!memcmp(p.ptr,"head=",5))
{
- spf->le_flags |= LEFL_RND_HEAD;
+ spf->le_flags |= G_LEFL_RND_HEAD;
spf->le_group = MidMem(p,5,p.len);
}
else if (!memcmp(p.ptr,"grp=",4))
{
- spf->le_flags |= LEFL_RND_GROUP;
+ spf->le_flags |= G_LEFL_RND_GROUP;
if (!spf->le_group.len)
spf->le_group = MidMem(p,4,p.len);
}
else if ( spf->le_group.len && !StrCmpMem(p,"grp") )
{
- spf->le_flags |= LEFL_RND_GROUP;
+ spf->le_flags |= G_LEFL_RND_GROUP;
}
else if ( !StrCmpMem(p,"new") )
- spf->le_flags |= LEFL_NEW;
+ spf->le_flags |= G_LEFL_NEW;
else if ( !StrCmpMem(p,"texture") || !StrCmpMem(p,"temp-allow") )
- spf->le_flags |= LEFL_TEXTURE;
+ spf->le_flags |= G_LEFL_TEXTURE;
else if ( !StrCmpMem(p,"hidden") )
- spf->le_flags |= LEFL_HIDDEN;
+ spf->le_flags |= G_LEFL_HIDDEN;
else if (!memcmp(p.ptr,"order=",6))
spf->attrib_order = str2l(p.ptr+6,0,10);
else
diff --git a/project/src/lib-lecode.c b/project/src/lib-lecode.c
index 2ff7377..f966669 100644
--- a/project/src/lib-lecode.c
+++ b/project/src/lib-lecode.c
@@ -489,7 +489,6 @@ const VarMap_t * SetupVarsLECODE()
{ "LE$STRING_LIST_ENABLED", LE_STRING_LIST_ENABLED },
{ "LE$STRING_SET_ENABLED", LE_STRING_SET_ENABLED },
- { "LE$TYPE_MARKERS_ENABLED",LE_TYPE_MARKERS_ENABLED },
{0,0}
};
@@ -872,10 +871,13 @@ ccp GetBuildLECODE ( mem_t lecode )
if ( !lecode.ptr || lecode.len < sizeof(le_binary_head_v4_t) )
return "?";
+ const u_sec_t creation_time = GetCTimeLECODE(lecode);
const le_binary_head_v4_t *head = (le_binary_head_v4_t*)lecode.ptr;
- return ntohl(head->version) < 4
+ return !creation_time
? PrintCircBuf("%u",ntohl(head->build_number))
- : PrintCircBuf("%u (%.10s)",ntohl(head->build_number),head->timestamp);
+ : PrintCircBuf("%u (%.10s)",
+ ntohl(head->build_number),
+ PrintTimeByFormat("%F %T %Z",creation_time) );
}
///////////////////////////////////////////////////////////////////////////////
@@ -892,26 +894,66 @@ ccp GetInfoLECODE ( mem_t lecode )
if ( !lecode.ptr || lecode.len < sizeof(le_binary_head_v4_t) )
return "?";
- const le_binary_head_v4_t *head = (le_binary_head_v4_t*)lecode.ptr;
- ccp region = head->region == 'P' ? "PAL"
- : head->region == 'E' ? "USA"
- : head->region == 'J' ? "JAP"
- : head->region == 'K' ? "KOR"
+ const le_binary_head_t *head = (le_binary_head_t*)lecode.ptr;
+
+ ccp region = head->v3.region == 'P' ? "PAL"
+ : head->v3.region == 'E' ? "USA"
+ : head->v3.region == 'J' ? "JAP"
+ : head->v3.region == 'K' ? "KOR"
: "?";
- ccp debug = head->debug == 'D' ? "/debug" : "";
+ ccp debug = head->v3.debug == 'D' ? "/debug" : "";
+ const u_sec_t creation_time = GetCTimeLECODE(lecode);
- return ntohl(head->version) < 4
- ? PrintCircBuf("%s%s v%u, build %u, %u bytes",
+ return creation_time
+ ? PrintCircBuf("%s%s v%u, build %u (%s), %u bytes",
region, debug,
- ntohl(head->version),
- ntohl(head->build_number),
- ntohl(head->file_size) )
- : PrintCircBuf("%s%s v%u, build %u (%s UTC), %u bytes",
+ ntohl(head->v3.version),
+ ntohl(head->v3.build_number),
+ PrintTimeByFormat("%F %T %Z",creation_time),
+ ntohl(head->v3.file_size) )
+ : PrintCircBuf("%s%s v%u, build %u, %u bytes",
region, debug,
- ntohl(head->version),
- ntohl(head->build_number),
- head->timestamp,
- ntohl(head->file_size) );
+ ntohl(head->v3.version),
+ ntohl(head->v3.build_number),
+ ntohl(head->v3.file_size) );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+u_sec_t GetLecodeCTimeLEREG ( le_region_t reg )
+{
+ return GetCTimeLECODE(GetLecodeLEREG(reg));
+}
+
+//-----------------------------------------------------------------------------
+
+u_sec_t GetCTimeLECODE ( mem_t lecode )
+{
+ return lecode.len >= sizeof(le_binary_head_v5_t)
+ ? GetCTimeLeHead((le_binary_head_t*)lecode.ptr)
+ : 0;
+}
+
+//-----------------------------------------------------------------------------
+
+u_sec_t GetCTimeLeHead ( const le_binary_head_t *head )
+{
+ if (!head)
+ return 0;
+
+ const uint version = ntohl(head->v3.version);
+
+ if ( version >= 5 )
+ return ntohl(head->v5.creation_time);
+
+ if ( version >= 4 )
+ {
+ time_t tim;
+ ScanDateTime(&tim,0,head->v4.timestamp,false,false);
+ return tim;
+ }
+
+ return 0;
}
//
@@ -1654,6 +1696,7 @@ static void ApplyArena ( le_analyze_t * ana, const ctcode_arena_t * ca )
if ( ntohl(ana->cup_arena[idx]) == slot )
{
ana->cup_arena[idx] = htonl(prop);
+ ana->arena_applied = true;
break;
}
}
@@ -1672,11 +1715,14 @@ static void ApplyArena ( le_analyze_t * ana, const ctcode_arena_t * ca )
if ( ca->flags[a] & CT_ARENA_FLAGS_VALID )
{
- ana->flags[slot] = ca->flags[a] & LEFL__ALL;
+ ana->flags[slot] = ca->flags[a] & G_LEFL__ALL;
ana->arena_applied = true;
}
}
}
+
+ if (ana->arena_applied)
+ UpdateLecodeFlags(ana);
}
///////////////////////////////////////////////////////////////////////////////
@@ -1732,26 +1778,25 @@ enumError AnalyzeLEBinary
memset(ana,0,sizeof(*ana));
if ( !data
- || data_size < sizeof(le_binary_head_t)
+ || data_size < sizeof(le_binary_head_v3_t)
|| memcmp(data,LE_BINARY_MAGIC,4) )
{
return ERR_INVALID_DATA;
}
le_binary_head_t *head = (le_binary_head_t*)data;
- const uint file_size = ntohl(head->file_size);
+ const uint file_size = ntohl(head->v3.file_size);
if ( file_size > data_size )
return ERR_INVALID_DATA;
ana->valid = LE_HEAD_FOUND;
- ana->version = head->phase;
- ana->region = GetLEREG(head->region);
+ ana->region = GetLEREG(head->v3.region);
ana->data = data;
ana->data_size = data_size;
ana->head = head;
- ana->header_vers = ntohl(head->version);
+ ana->header_vers = ntohl(head->v3.version);
ana->end_of_data = (u8*)data + file_size;
- ana->flags_bits = ntohl(head->build_number) < 35 ? 8 : 16;
+ ana->flags_bits = ntohl(head->v3.build_number) < 35 ? 8 : 16;
ana->le_random_beg = MKW_LE_RANDOM_BEG;
ana->le_random_end = MKW_LE_RANDOM_END;
@@ -1761,13 +1806,13 @@ enumError AnalyzeLEBinary
case 4:
if ( ana->data_size > sizeof(le_binary_head_v4_t) )
{
- off_param = ntohl(ana->head_v4->off_param);
+ off_param = ntohl(ana->head->v4.off_param);
ana->header_size = sizeof(le_binary_head_v4_t);
- ana->le_random_beg = MKW_LE_RANDOM_BY_CUP;
+ ana->le_random_beg = MKW_LE_RANDOM_BY_CUP;
ana->valid |= LE_HEAD_VALID | LE_HEAD_KNOWN;
time_t tim;
- ScanDateTime(&tim,0,ana->head_v4->timestamp,false,0);
+ ScanDateTime(&tim,0,ana->head->v4.timestamp,false,false);
ana->creation_time = tim;
}
break;
@@ -1775,26 +1820,34 @@ enumError AnalyzeLEBinary
case 5:
if ( ana->data_size > sizeof(le_binary_head_v5_34_t) )
{
- off_param = ntohl(ana->head_v5->off_param);
- ana->szs_required = ntohl(ana->head_v5->szs_required);
- ana->edit_version = ntohl(ana->head_v5->edit_version);
- ana->header_size = ntohl(ana->head_v5->head_size);
- ana->creation_time = ntohl(ana->head_v5->creation_time);
- ana->edit_time = ntohl(ana->head_v5->edit_time);
+ off_param = ntohl(ana->head->v5.off_param);
+ ana->szs_required = ntohl(ana->head->v5.szs_required);
+ ana->edit_version = ntohl(ana->head->v5.edit_version);
+ ana->header_size = ntohl(ana->head->v5.head_size);
+ ana->creation_time = ntohl(ana->head->v5.creation_time);
+ ana->edit_time = ntohl(ana->head->v5.edit_time);
- if ( ana->header_size > offsetof(le_binary_head_v5_t,szs_recommended) )
- ana->szs_recommended = ntohl(ana->head_v5->szs_recommended);
-
- if ( ana->edit_version != 0x32303232 ) // first 4 bytes of "2022-10-23" => invalid
+ if ( ana->edit_version != 0x32303232 ) // if first 4 bytes of "2022-10-23" => invalid
+ {
ana->valid |= LE_HEAD_VALID | LE_HEAD_KNOWN;
+
+ if ( ana->header_size > offsetof(le_binary_head_v5_t,szs_recommended) )
+ {
+ ana->szs_recommended = ntohl(ana->head->v5.szs_recommended);
+ // if ( ana->szs_recommended >= 2300100 )
+ // {
+ // //?
+ // }
+ }
+ }
}
break;
default:
- if ( ana->header_vers > 5 && ana->data_size > sizeof(le_binary_head_t) )
+ if ( ana->header_vers > 5 && ana->data_size > sizeof(le_binary_head_v3_t) )
{
- off_param = ntohl(head->off_param);
- ana->header_size = ntohl(ana->head_v5->head_size);
+ off_param = ntohl(head->v3.off_param);
+ ana->header_size = ntohl(head->v5.head_size);
ana->valid |= LE_HEAD_VALID;
}
break;
@@ -1803,6 +1856,13 @@ enumError AnalyzeLEBinary
if ( GetEncodedVersion() >= ana->szs_required )
ana->valid |= LE_HEAD_VERSION;
+ snprintf(ana->identifier,sizeof(ana->identifier),
+ "v%u-b%02u-h%02u-%c%c",
+ ntohl(ana->head->v3.version),
+ ntohl(ana->head->v3.build_number),
+ ana->header_size,
+ tolower(ana->head->v3.debug),
+ tolower(ana->head->v3.region) );
//--- analyse parameters (prepare)
@@ -2065,8 +2125,7 @@ le_region_t GetLERegion ( const le_analyze_t *ana )
{
if (ana->valid)
{
- const le_binary_head_t *h = ana->head;
- switch (h->region)
+ switch (ana->head->v3.region)
{
case 'P': return LEREG_PAL;
case 'E': return LEREG_USA;
@@ -2169,25 +2228,27 @@ const le_usage_t * GetLEUsage ( const le_analyze_t *ana0, bool force_recalc )
for ( slot = LE_FIRST_CT_SLOT; slot < ana->usage_size; slot++ )
{
+ const le_flags_t flags = ana->flags[slot];
+ if (!flags)
+ continue;
+
if (IsLESlotUsed(ana,slot))
{
- const le_flags_t flags = ana->flags[slot];
-
- if ( flags & LEFL_ALIAS )
+ if ( flags & G_LEFL_ALIAS )
usage[slot] = LEU_S_ALIAS;
else if ( IsLEBattleSlot(ana,slot) )
usage[slot]
- = flags & LEFL_RND_HEAD ? LEU_S_ARENA_RND
- : flags & (LEFL_RND_GROUP|LEFL_HIDDEN) ? LEU_S_ARENA_HIDE
+ = flags & G_LEFL_RND_HEAD ? LEU_S_ARENA_RND
+ : flags & (G_LEFL_RND_GROUP|G_LEFL_HIDDEN) ? LEU_S_ARENA_HIDE
: LEU_S_ARENA;
else
usage[slot]
- = flags & LEFL_RND_HEAD ? LEU_S_TRACK_RND
- : flags & (LEFL_RND_GROUP|LEFL_HIDDEN) ? LEU_S_TRACK_HIDE
+ = flags & G_LEFL_RND_HEAD ? LEU_S_TRACK_RND
+ : flags & (G_LEFL_RND_GROUP|G_LEFL_HIDDEN) ? LEU_S_TRACK_HIDE
: LEU_S_TRACK;
}
- if ( ana->version > 1 || slot < 0xff
+ if ( ana->head->v3.phase > 1 || slot < 0xff
|| slot >= LE_FIRST_UPPER_CT_SLOT && slot <= LE_LAST_UPPER_CT_SLOT )
{
usage[slot] |= LEU_F_ONLINE;
@@ -2202,9 +2263,9 @@ const le_usage_t * GetLEUsage ( const le_analyze_t *ana0, bool force_recalc )
if (IsLESlotUsed(ana,slot))
{
const le_flags_t flags = ana->flags[slot];
- usage[slot] = flags & LEFL_ALIAS ? LEU_S_ALIAS
- : flags & LEFL_RND_HEAD ? LEU_S_ARENA_RND
- : flags & LEFL_RND_GROUP ? LEU_S_ARENA_HIDE
+ usage[slot] = flags & G_LEFL_ALIAS ? LEU_S_ALIAS
+ : flags & G_LEFL_RND_HEAD ? LEU_S_ARENA_RND
+ : flags & G_LEFL_RND_GROUP ? LEU_S_ARENA_HIDE
: LEU_S_ARENA;
}
}
@@ -2212,7 +2273,7 @@ const le_usage_t * GetLEUsage ( const le_analyze_t *ana0, bool force_recalc )
//--- override Network.random
- if ( ana->version == 1 )
+ if ( ana->head->v3.phase == 1 )
usage[0xff] = LEU_S_NETWORK|LEU_F_ONLINE;
return usage;
@@ -2399,7 +2460,7 @@ static ccp GetSlotInfo
static const char warn_list[] = " <!!";
const le_flags_t flags = ana->flags[tid];
- return flags & LEFL_ALIAS
+ return flags & G_LEFL_ALIAS
? PrintCircBuf("[%s->%4x %s,%s] ",
col->differ, TrackByAliasLE(prop,music),
col->reset, PrintLEFL(ana->flags_bits,flags,true) )
@@ -2481,7 +2542,7 @@ static void DumpLETracks
u16 *done = CALLOC(sizeof(*done),ana->n_slot);
DASSERT(done);
- if ( ana->version == 1 )
+ if ( ana->head->v3.phase == 1 )
{
uint max = ana->n_slot < LE_FIRST_UPPER_CT_SLOT
? ana->n_slot : LE_FIRST_UPPER_CT_SLOT;
@@ -2629,7 +2690,7 @@ static void DumpLETracks
else // if ( !done[i] )
{
const typeof(*ana->flags) flags = ana->flags ? ana->flags[i] : 0;
- if ( flags & LEFL_RND_GROUP )
+ if ( flags & G_LEFL_RND_GROUP )
{
n_group++;
max_viewed_slot = i;
@@ -2637,7 +2698,7 @@ static void DumpLETracks
else
{
n_unused++;
- if ( flags & LEFL_TEXTURE )
+ if ( flags & G_LEFL_TEXTURE )
max_viewed_slot = i;
}
}
@@ -2670,13 +2731,22 @@ static void DumpLETracks
n_group, n_group == 1 ? "" : "s",
col->reset );
- for ( i = 0; i < ana->n_slot; i++ )
- if ( !done[i] && IsRacingTrackLE(i) && ana->flags[i] & LEFL_RND_GROUP )
+ int prev = -1, line_count = 99;
+ for ( int i = 0; i <= max_viewed_slot; i++ )
+ {
+ if ( !done[i] && IsRacingTrackLE(i) && ana->flags[i] & G_LEFL_RND_GROUP )
{
+ if ( ++line_count > 4 || i != prev+1 )
+ {
+ fprintf(f,"\n%*sSlot %4d/dec :", indent,"", i );
+ line_count = 1;
+ }
done[i]++;
- fprintf(f,"%*sSlot %4d/dec : %3x%s\n",
- indent,"", i, i, GetSlotInfo(ana,i,col,CHECK_OFF,0));
+ fprintf(f," %3x%s", i, GetSlotInfo(ana,i,col,CHECK_OFF,0) );
+ prev = i;
}
+ }
+ putchar('\n');
}
//HexDump16(stdout,0,0,done,ana->n_slot*sizeof(*done));
@@ -2705,7 +2775,6 @@ static void DumpLETracks
{
if ( ++line_count > 4 || i != prev+1 )
{
-//DEL if ( i == prev+1 ) fputs("...",f);
fprintf(f,"\n%*sSlot %4d/dec :", indent,"", i );
line_count = 1;
}
@@ -2721,10 +2790,14 @@ static void DumpLETracks
first_unused_slot = LE_FIRST_CT_SLOT;
const int unused_slots = ana->n_slot - first_unused_slot;
if ( unused_slots > 0 )
- fprintf(f,"%*s > %u slot%s beginning with slot %u (%x/hex) are not used.\n",
- indent,"",
- unused_slots, unused_slots == 1 ? "" : "s",
- first_unused_slot, first_unused_slot );
+ {
+ if ( unused_slots > 1 )
+ fprintf(f,"%*s > %u slots beginning with slot %u (%x/hex) are not used.\n",
+ indent,"", unused_slots, first_unused_slot, first_unused_slot );
+ else
+ fprintf(f,"%*s > Slot %u (%x/hex) is not used.\n",
+ indent,"", first_unused_slot, first_unused_slot );
+ }
}
@@ -2751,11 +2824,10 @@ static void DumpLEUsageMap
if ( max_view > ana->usage_size )
max_view = ana->usage_size;
- #if 1
fprintf(f,"\n%*s%s" "Slot usage map for %u slots%s\n"
- "%*s" "%s: Arena%s, %s: Hidden Arena%s, %s: Random Arena%s, "
+ "%*s" "%s: Arena%s, %s: Hidden Arena%s, %s: Random Group Arena%s, "
"%s: LE-CODE random%s, %s: Alias%s,\n"
- "%*s" "%s: Track%s, %s: Hidden Track%s, %s: Random Track%s, "
+ "%*s" "%s: Track%s, %s: Hidden Track%s, %s: Random Group Track%s, "
"%s: Network%s, %s: Special%s, %s: unused%s.\n",
indent-2,"", col->heading, max_view, col->reset,
@@ -2773,32 +2845,6 @@ static void DumpLEUsageMap
GetLEUsageCharCol( LEU_S_SPECIAL, col,0 ), col->reset,
GetLEUsageCharCol( LEU_S_UNUSED, col,0 ), col->reset );
- #else
- fprintf(f,"\n%*s%s" "Slot usage map for %u slots%s\n"
- "%*s" "%s: Arena%s, %s: Hidden Arena%s, %s: Random Arena%s, "
- "%s: LE-CODE arena random%s,\n"
- "%*s" "%s: Track%s, %s: Hidden Track%s, %s: Random Track%s, "
- "%s: LE-CODE track random%s,\n"
- "%*s" "%s: Alias%s, %s: Network%s, %s: Special%s, %s: unused%s.\n",
-
- indent-2,"", col->heading, max_view, col->reset,
- indent,"",
- GetLEUsageCharCol( LEU_F_ONLINE | LEU_S_ARENA, col,0 ), col->reset,
- GetLEUsageCharCol( LEU_F_ONLINE | LEU_S_ARENA_HIDE, col,0 ), col->reset,
- GetLEUsageCharCol( LEU_F_ONLINE | LEU_S_ARENA_RND, col,0 ), col->reset,
- GetLEUsageCharCol( LEU_F_ONLINE | LEU_S_ARENA_LE_RND, col,0 ), col->reset,
- indent,"",
- GetLEUsageCharCol( LEU_F_ONLINE | LEU_S_TRACK, col,0 ), col->reset,
- GetLEUsageCharCol( LEU_F_ONLINE | LEU_S_TRACK_HIDE, col,0 ), col->reset,
- GetLEUsageCharCol( LEU_F_ONLINE | LEU_S_TRACK_RND, col,0 ), col->reset,
- GetLEUsageCharCol( LEU_F_ONLINE | LEU_S_TRACK_LE_RND, col,0 ), col->reset,
- indent,"",
- GetLEUsageCharCol( LEU_F_ONLINE | LEU_S_ALIAS, col,0 ), col->reset,
- GetLEUsageCharCol( LEU_F_ONLINE | LEU_S_NETWORK, col,0 ), col->reset,
- GetLEUsageCharCol( LEU_S_SPECIAL, col,0 ), col->reset,
- GetLEUsageCharCol( LEU_S_UNUSED, col,0 ), col->reset );
- #endif
-
uint slot;
ccp prev_col = 0;
for ( slot = 0; slot < max_view; slot++ )
@@ -2873,7 +2919,7 @@ void DumpLEAnalyse ( FILE *f, uint indent, const le_analyze_t *ana )
if ( ana->valid & LE_HEAD_VALID )
{
- const le_binary_head_t *h = ana->head;
+ const le_binary_head_v3_t *h = &ana->head->v3;
DASSERT(h);
fprintf(f,
"\n%*s%s" "File header:%s\n"
@@ -2929,7 +2975,7 @@ void DumpLEAnalyse ( FILE *f, uint indent, const le_analyze_t *ana )
fprintf(f,
"%*s" "Current SZS Tool: v%s\n", indent,"", BASE_VERSION );
- int fw = 0;
+ int fw = strlen(BASE_VERSION);
ccp required = 0, recommended = 0;
if (ana->szs_required)
@@ -2948,6 +2994,13 @@ void DumpLEAnalyse ( FILE *f, uint indent, const le_analyze_t *ana )
fw = len;
}
+ if (ana->edit_version)
+ {
+ int len = strlen(DecodeVersion(ana->edit_version));
+ if ( fw < len )
+ fw = len;
+ }
+
if (ana->szs_required)
{
const bool valid = GetEncodedVersion() >= ana->szs_required;
@@ -2979,6 +3032,10 @@ void DumpLEAnalyse ( FILE *f, uint indent, const le_analyze_t *ana )
indent,"", DecodeVersion(ana->edit_version) );
}
+ fputc('\n',f);
+ if ( brief_count > 0 )
+ return;
+
//--- parameters
@@ -2987,7 +3044,7 @@ void DumpLEAnalyse ( FILE *f, uint indent, const le_analyze_t *ana )
const le_binary_param_t *h = ana->param;
DASSERT(h);
fprintf(f,
- "\n%*s%s" "Parameters (LPAR):%s\n"
+ "%*s%s" "Parameters (LPAR):%s\n"
"%*s" "Magic: %.4s\n"
"%*s" "Version: %u\n"
"%*s" "Param size: %x/hex = %u bytes\n"
@@ -3258,7 +3315,7 @@ void DumpLEAnalyse ( FILE *f, uint indent, const le_analyze_t *ana )
if ( long_count > 0 )
DumpLETracks(f,indent,&col,ana);
- if ( verbose > 0 )
+ if ( verbose > 0 || long_count > 2 )
DumpLEUsageMap(f,indent,&col,ana);
fputc('\n',f);
@@ -3387,7 +3444,7 @@ enumError ApplyLEFile ( le_analyze_t * ana )
DASSERT(ana);
SetupArenasLEAnalyze(ana,false);
- const ctcode_t *ctcode = LoadLEFile(ana->version);
+ const ctcode_t *ctcode = LoadLEFile(ana->head->v3.phase);
return ctcode ? ApplyCTCODE(ana,ctcode) : ERR_ERROR;
}
@@ -3531,6 +3588,7 @@ enumError ApplyCTCODE ( le_analyze_t * ana, const ctcode_t * ctcode )
}
CalculateStatsLE(ana);
+ UpdateLecodeFlags(ana);
return ERR_OK;
}
@@ -3558,9 +3616,9 @@ bool DefineAliasLE ( le_analyze_t * ana, uint slot, uint alias )
}
const le_flags_t fl = ana->flags[alias];
- if ( !(fl & LEFL_ALIAS) )
+ if ( !(fl & G_LEFL_ALIAS) )
{
- ana->flags[slot] |= LEFL_ALIAS;
+ ana->flags[slot] |= G_LEFL_ALIAS;
ana->property[slot] = alias >> 8;
ana->music[slot] = alias & 0xff;
return true;
@@ -3647,27 +3705,27 @@ void UpdateLecodeFlags ( le_analyze_t * ana )
return;
- //--- calculate flags LEFL_BATTLE and LEFL_VERSUS, reset other flags
+ //--- calculate flags G_LEFL_BATTLE and G_LEFL_VERSUS, reset other flags
for ( int slot = 0; slot < ana->max_flags; slot++ )
{
- le_flags_t flags = ana->flags[slot] & LEFL__ALL;
+ le_flags_t flags = ana->flags[slot] & G_LEFL__ALL;
if ( slot < ana->max_property )
{
if ( slot < MKW_ARENA_END || slot >= MKW_LE_SLOT_BEG )
- flags |= IsMkwTrack(ana->property[slot]) ? LEFL_VERSUS : LEFL_BATTLE;
+ flags |= IsMkwTrack(ana->property[slot]) ? G_LEFL_VERSUS : G_LEFL_BATTLE;
}
ana->flags[slot] = flags;
}
- //--- define LEFL_RANDOM
+ //--- define G_LEFL_RANDOM
for ( int slot = LE_SLOT_RND_BEG; slot < LE_SLOT_RND_END; slot++ )
- ana->flags[slot] |= LEFL_RANDOM;
+ ana->flags[slot] |= G_LEFL_RANDOM;
- //--- calculate flags LEFL_CUP, LEFL_ORIG_CUP, LEFL_CUSTOM_CUP
+ //--- calculate flags G_LEFL_CUP, G_LEFL_ORIG_CUP, G_LEFL_CUSTOM_CUP
if ( ana->n_cup_track && ana->cup_track )
{
@@ -3679,8 +3737,8 @@ void UpdateLecodeFlags ( le_analyze_t * ana )
for ( int tr = 0; tr < max_tr; tr++ )
{
const uint slot = ntohl(*src++);
- if ( slot < ana->max_flags && ana->flags[slot] & (LEFL_VERSUS|LEFL_RANDOM) )
- ana->flags[slot] |= LEFL_CUP | ( tr < MKW_N_TRACKS ? LEFL_ORIG_CUP : LEFL_CUSTOM_CUP );
+ if ( slot < ana->max_flags && ana->flags[slot] & (G_LEFL_VERSUS|G_LEFL_RANDOM) )
+ ana->flags[slot] |= G_LEFL_CUP | ( tr < MKW_N_TRACKS ? G_LEFL_ORIG_CUP : G_LEFL_CUSTOM_CUP );
}
}
@@ -3691,8 +3749,8 @@ void UpdateLecodeFlags ( le_analyze_t * ana )
for ( int tr = 0; tr < max_tr; tr++ )
{
const uint slot = ntohl(*src++);
- if ( slot < ana->max_flags && ana->flags[slot] & (LEFL_BATTLE|LEFL_RANDOM) )
- ana->flags[slot] |= LEFL_CUP | ( tr < MKW_N_ARENAS ? LEFL_ORIG_CUP : LEFL_CUSTOM_CUP );
+ if ( slot < ana->max_flags && ana->flags[slot] & (G_LEFL_BATTLE|G_LEFL_RANDOM) )
+ ana->flags[slot] |= G_LEFL_CUP | ( tr < MKW_N_ARENAS ? G_LEFL_ORIG_CUP : G_LEFL_CUSTOM_CUP );
}
}
}
diff --git a/project/src/lib-lecode.h b/project/src/lib-lecode.h
index 992cb14..3e21f53 100644
--- a/project/src/lib-lecode.h
+++ b/project/src/lib-lecode.h
@@ -84,7 +84,7 @@ static inline bool IsLecodeSupported ( le_valid_t mode )
{ return ( mode & LE_M_ALL_VALID ) == LE_M_ALL_VALID; }
//-----------------------------------------------------------------------------
-// [[le_usage_t]]
+// [[le_usage_t]] => edit usage_ch[] before GetLEUsageChar() on changes
typedef enum le_usage_t
{
@@ -98,7 +98,7 @@ typedef enum le_usage_t
LEU_S_TRACK_HIDE, // t track slot
LEU_S_TRACK_RND, // R track slot
- LEU_S_LE_RANDOM, // L network slot
+ LEU_S_LE_RANDOM, // L LE-CODE random
LEU_S_SPECIAL, // s special slot
LEU_S_NETWORK, // n network slot
LEU_S_ALIAS, // > is alias <<< last element!
@@ -284,16 +284,19 @@ ccp PatchNameLEREG ( char *buf, uint bufsize, ccp name, le_region_t lereg );
const mem_t GetLecodeLEREG ( le_region_t reg );
-// returns circ-buf
-ccp GetLecodeBuildLEREG ( le_region_t reg );
-ccp GetLecodeInfoLEREG ( le_region_t reg );
//-----------------------------------------------------------------------------
// some more global functions, used as helpers for *LEREG functions
-// returns circ-buf
-ccp GetBuildLECODE ( mem_t lecode );
-ccp GetInfoLECODE ( mem_t lecode );
+// returns circ-buf for strings
+ccp GetLecodeBuildLEREG ( le_region_t reg );
+ccp GetLecodeInfoLEREG ( le_region_t reg );
+u_sec_t GetLecodeCTimeLEREG ( le_region_t reg );
+
+// returns circ-buf for strings
+ccp GetInfoLECODE ( mem_t lecode );
+ccp GetBuildLECODE ( mem_t lecode );
+u_sec_t GetCTimeLECODE ( mem_t lecode );
//
///////////////////////////////////////////////////////////////////////////////
@@ -407,9 +410,9 @@ bool SetupLecodeDebugLPAR
///////////////////////////////////////////////////////////////////////////////
/////////////// binary headers ///////////////
///////////////////////////////////////////////////////////////////////////////
-// [[le_binary_head_t]]
+// [[le_binary_head_v3_t]]
-typedef struct le_binary_head_t
+typedef struct le_binary_head_v3_t
{
/*00*/ char magic[4]; // LE_BINARY_MAGIC
/*04*/ u32 version; // always 4 for v4
@@ -423,7 +426,7 @@ typedef struct le_binary_head_t
/*1e*/ u8 phase; // >0: PHASE
/*1f*/ char unknown_1f;
}
-__attribute__ ((packed)) le_binary_head_t;
+__attribute__ ((packed)) le_binary_head_v3_t;
//-----------------------------------------------------------------------------
// [[le_binary_head_v4_t]]
@@ -503,6 +506,19 @@ __attribute__ ((packed)) le_binary_head_v5_38_t;
typedef le_binary_head_v5_38_t le_binary_head_v5_t;
+//-----------------------------------------------------------------------------
+// [[le_binary_head_t]]
+
+typedef union
+{
+ le_binary_head_v3_t v3;
+ le_binary_head_v4_t v4;
+ le_binary_head_v5_t v5;
+}
+le_binary_head_t;
+
+u_sec_t GetCTimeLeHead ( const le_binary_head_t *head );
+
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// [[le_binary_param_t]]
@@ -862,13 +878,13 @@ typedef struct le_analyze_t
//--- header data
le_valid_t valid; // see LE_VALID_* above
- uint version; // version = phase
le_region_t region; // one of LEREG_*
u32 creation_time; // unixtime of LE-CODE creation
u32 edit_time; // >0: unixtime of last LE-CODE edit
uint szs_required; // minimal encoded version number of szs-tools required to edit
uint szs_recommended;// >0: recommended version number of szs-tools to manage LE binaries
uint edit_version; // >0: encoded version number of szs-tools, that did last edit
+ char identifier[20]; // identifier of format "v#-b###-h###-<debug><region>"
const u8 *data; // pointer to raw data
u32 data_size; // data size
@@ -921,6 +937,7 @@ typedef struct le_analyze_t
//--- pointers into LE-CODE binary
+ le_binary_head_t *head; // LECT file header
le_cup_par_t *cup_par; // NULL or cup parameters
le_course_par_t *course_par; // NULL or course parameters
le_cup_track_t *cup_track; // NULL or list of cup tracks
@@ -934,13 +951,6 @@ typedef struct le_analyze_t
union
{
- le_binary_head_t * head;
- le_binary_head_v4_t * head_v4;
- le_binary_head_v5_t * head_v5;
- };
-
- union
- {
le_binary_param_t * param;
le_binpar_v1_t * param_v1;
};
@@ -976,13 +986,15 @@ void TransferTrackFile ( LogFile_t *log, uint dest_slot, ccp src_name, Transf
void TransferTrackBySlot ( LogFile_t *log, uint dest_slot, uint src_slot, TransferMode_t flags );
static inline bool IsLESlotUsed ( const le_analyze_t *ana, uint slot )
- { return slot < ana->n_slot && ana->music[slot]; }
+ { return slot < ana->n_slot && ana->flags[slot] & G_LEFL__USED; }
static inline bool IsLERacingSlot ( const le_analyze_t *ana, uint slot )
- { return slot < ana->n_slot && ana->music[slot] && ana->property[slot] < MKW_TRACK_END; }
+ { return slot < ana->n_slot && ana->flags[slot] & G_LEFL__USED
+ && ana->property[slot] < MKW_TRACK_END; }
static inline bool IsLEBattleSlot ( const le_analyze_t *ana, uint slot )
- { return slot < ana->n_slot && ana->music[slot] && ana->property[slot] >= MKW_ARENA_BEG; }
+ { return slot < ana->n_slot && ana->flags[slot] & G_LEFL__USED
+ && ana->property[slot] >= MKW_ARENA_BEG; }
///////////////////////////////////////////////////////////////////////////////
diff --git a/project/src/lib-ledis.c b/project/src/lib-ledis.c
index f653db5..2fcdae3 100644
--- a/project/src/lib-ledis.c
+++ b/project/src/lib-ledis.c
@@ -72,14 +72,6 @@ static const le_cup_ref_t standard_vs_ref[MKW_N_TRACKS] =
static const le_cup_ref_t mkwfun_random_ref[MKW_N_LE_RANDOM] =
{ 62, 63, 64, 65 };
-///////////////////////////////////////////////////////////////////////////////
-
-#if LE_TYPE_MARKERS_ENABLED
- #define LTT_MARKER_ARENA 0x1000
- #define LTT_MARKER_TRACK 0x2000
- #define LTT_MARKER__ALL 0x3000
-#endif
-
//
///////////////////////////////////////////////////////////////////////////////
/////////////// helpers ///////////////
@@ -191,10 +183,12 @@ static KeywordTab_t keywords_leo[] =
{ LEO_IN_LECODE, "IN-LECODE", "INLECODE", 0 },
{ LEO_IN_LECODE, "ILECODE", 0, 0 },
+ { LEO_NO_SLOT, "NO-SLOT", "NOSLOT", 0 },
{ LEO_BRIEF, "BRIEF", 0, 0 },
{ LEO_HELP, "HELP", "H", 0 },
+ { LEO_CUT_ALL, "CUT-ALL", "CUTALL", 0 },
{ LEO_CUT_STD, "CUT-STD", "CUTSTD", 0 },
{ LEO_CUT_CTCODE, "CUT-CTCODE", "CUTCTCODE", 0 },
@@ -569,7 +563,7 @@ ccp GetNameLSP ( const le_strpar_t *par )
{
if (par)
{
- ccp name = GetLowerNameLTT(par->opt);
+ ccp name = GetLowerNameLEO(par->opt);
if (name)
return name;
@@ -652,6 +646,7 @@ void InitializeLECUP ( le_cup_t *lc, uint max_cups, uint tracks_per_cup )
memset(lc,0,sizeof(*lc));
lc->max = max_cups;
lc->tracks = tracks_per_cup;
+ lc->first_custom = tracks_per_cup == 5 ? 2 : 8;
lc->fill_slot = -1;
lc->fill_src = -1;
lc->dirty = true;
@@ -715,6 +710,28 @@ le_cup_ref_t * DefineLECUP ( le_cup_t *lc, uint cup_index )
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
+int GetIndexByRefLECUP ( const le_cup_t *lc, int cup_ref )
+{
+ if ( !lc || cup_ref <= 0 )
+ return -1;
+
+ const uint cup = cup_ref / 10 - 1;
+ const uint idx = cup_ref % 10 - 1;
+ return cup < lc->max && idx < lc->tracks ? cup*lc->tracks + idx : -1;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+uint GetRefByIndexLECUP ( const le_cup_t *lc, uint cup_index )
+{
+ if ( !lc || cup_index >= lc->max * lc->tracks )
+ return 0;
+ return cup_index / lc->tracks * 10 + cup_index % lc->tracks + 11;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+
uint GetCupSlotLECUP ( const le_cup_t *lc, const le_cup_ref_t *ptr )
{
if ( !lc || !lc->list || !ptr )
@@ -962,7 +979,7 @@ void SetupLecodeRandomTrackLT ( le_track_t *lt, uint setup_slot )
if (info)
{
lt->track_status = LTS_ACTIVE;
- lt->track_type = LTTY_RANDOM|LTTY_TRACK;
+ lt->track_type = LTTY_RANDOM|LTTY_TRACK|LTTY_ARENA;
lt->cup_slot = setup_slot - MKW_LE_RANDOM_BEG + 91;
lt->property = 0;
lt->music = MKW_MUSIC_MIN_ID;
@@ -1400,7 +1417,7 @@ ccp GetTextOptLT ( const le_track_t *lt, le_options_t opt, ccp return_on_empty )
default:
#if LE_STRING_LIST_ENABLED
if ( ltt >= LTT__LIST_BEG && ltt < LTT__LIST_END )
- return GetListLT(lt,ltt,return_on_empty);
+ return GetListLT(lt,opt,return_on_empty);
#endif
break;
}
@@ -1598,7 +1615,7 @@ ccp QuoteTextOptLT ( const le_track_t *lt, le_options_t opt, ccp return_on_empty
default:
#if LE_STRING_LIST_ENABLED
if ( ltt >= LTT__LIST_BEG && ltt < LTT__LIST_END )
- return QuoteListLT(lt,ltt,return_on_empty);
+ return QuoteListLT(lt,opt,return_on_empty);
#endif
break;
}
@@ -1618,7 +1635,7 @@ void InitializeLD ( le_distrib_t *ld )
ld->is_initialized = true;
ld->scan.bt.add_unused = true;
- ld->scan.bt.add_unused = true;
+ ld->scan.vs.add_unused = true;
ld->auto_setup = LAS_DEFAULT;
InitializeLSP(&ld->spar,SetupDefaultLEO());
@@ -1730,13 +1747,13 @@ void AutoSetupLD ( le_distrib_t *ld, le_auto_setup_t auto_setup )
if ( i == 3 )
{
- lt->flags = LEFL_RND_HEAD;
+ lt->flags = G_LEFL_RND_HEAD;
SetNameLT(lt,0,"Head of a group");
*ref++ = lt->track_slot;
}
else if ( i == 4 || i == 5 )
{
- lt->flags = LEFL_RND_GROUP;
+ lt->flags = G_LEFL_RND_GROUP;
snprintf(buf,sizeof(buf),"Group Track #%u (hidden)",i-3);
SetNameLT(lt,0,buf);
SetIdentOptLT(lt,"SHA1 of SZS",false,false,0);
@@ -1801,13 +1818,18 @@ void CutLD ( le_distrib_t *ld, le_options_t opt )
if (!ld)
return;
- if ( opt & LEO_CUT_STD )
- ClearTracksLD( ld, BMG_N_TRACK + BMG_N_ARENA, INT_MAX );
-
- if ( opt & LEO_CUT_CTCODE )
+ if ( opt & LEO_CUT_ALL )
+ ClearTracksLD( ld, 0, INT_MAX );
+ else
{
- ClearTracksLD( ld, CT_CODE_MAX_TRACKS, INT_MAX );
- ClearTracksLD( ld, BMG_N_TRACK, BMG_N_TRACK + BMG_N_ARENA );
+ if ( opt & LEO_CUT_STD )
+ ClearTracksLD( ld, BMG_N_TRACK + BMG_N_ARENA, INT_MAX );
+
+ if ( opt & LEO_CUT_CTCODE )
+ {
+ ClearTracksLD( ld, CT_CODE_MAX_TRACKS, INT_MAX );
+ ClearTracksLD( ld, BMG_N_TRACK, BMG_N_TRACK + BMG_N_ARENA );
+ }
}
}
@@ -1892,12 +1914,25 @@ void CheckTracksLD ( const le_distrib_t *ld )
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
+void DefineRandomTracksLD ( le_distrib_t *ld )
+{
+ for ( int slot = MKW_LE_RANDOM_BEG; slot < MKW_LE_RANDOM_END; slot++ )
+ DefineTrackLD(ld,slot,false);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
le_track_t * GetTrackLD ( le_distrib_t *ld, int slot )
{
if ( !ld || !IsValidLecodeSlot(slot) || slot >= ld->tlist_used )
return 0;
le_track_t *lt = ld->tlist + slot;
+
+ // random slots are defined automatically on access
+ if ( lt->track_status < LTS_ACTIVE && IsLecodeRandom(slot) )
+ DefineTrackLD(ld,slot,false);
+
return lt->track_status < LTS_ACTIVE ? 0 : lt;
}
@@ -1908,7 +1943,6 @@ le_track_t * DefineTrackLD ( le_distrib_t *ld, int slot, bool mark_export )
if ( !ld || !IsValidLecodeSlot(slot) )
return 0;
-
if (!ld->is_initialized)
InitializeLD(ld);
@@ -1958,7 +1992,7 @@ le_track_t * DefineTrackLD ( le_distrib_t *ld, int slot, bool mark_export )
else if ( IsLecodeRandom(slot) )
{
lt->track_status = LTS_ACTIVE;
- lt->track_type = LTTY_RANDOM|LTTY_TRACK;
+ lt->track_type = LTTY_RANDOM|LTTY_TRACK|LTTY_ARENA;
if ( ld->auto_setup & LAS_RANDOM )
SetupLecodeRandomTrackLT(lt,slot);
}
@@ -2096,7 +2130,7 @@ le_track_t * ReserveTracksLD
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
-void ClearUserFlagsAndCupsLD ( le_distrib_t *ld )
+void ClearUserFlagsAndCupsLD ( le_distrib_t *ld, bool purge_le_flags )
{
if (ld)
{
@@ -2105,6 +2139,15 @@ void ClearUserFlagsAndCupsLD ( le_distrib_t *ld )
{
lt->user_flags = 0;
lt->cup_slot = 0;
+
+ if (purge_le_flags)
+ {
+ lt->flags &= G_LEFL__ALL;
+ if (IsMkwTrack(lt->property))
+ lt->flags |= G_LEFL_VERSUS;
+ else if (IsMkwArena(lt->property))
+ lt->flags |= G_LEFL_BATTLE;
+ }
}
}
}
@@ -2325,6 +2368,22 @@ void ScanRefSTLD
lt->lap_count = str2l(src[IDX_LAPS].ptr,0,10);
lt->speed_factor= strtof(src[IDX_SPEED].ptr,0);
+ le_cup_t *cup = &ld->cup_versus;
+ if (IsMkwArena(lt->property))
+ {
+ lt->track_type = LTTY_ARENA;
+ cup = &ld->cup_battle;
+ }
+
+ int cup_index = GetIndexByRefLECUP(cup,lt->cup_slot);
+ if ( cup_index >= 0 )
+ {
+ le_cup_ref_t *ref = DefineLECUP(cup,cup_index);
+ PRINT0("tslot=%d, cup_slot=%d, cup_index=%d, ref=%p\n",tslot,lt->cup_slot,cup_index,ref);
+ if (ref)
+ *ref = tslot;
+ }
+
char buf[LE_TRACK_STRING_MAX+1];
if ( n > IDX_SHA1 ) SetIdentOptLT(lt,xstring(buf,sizeof(buf),src[IDX_SHA1]), 0,1,ld->spar.opt );
if ( n > IDX_IDENT ) SetIdentOptLT(lt,xstring(buf,sizeof(buf),src[IDX_IDENT]), 0,0,ld->spar.opt );
@@ -2476,11 +2535,11 @@ bool ScanSha1LineLD
uint tslot = -1;
uint cup = 0;
- int pi;
+ int pi, le_flags = -1;
char buf[300];
int valid_sha1 = false;
sha1_size_t bin;
- enum { P_TYPE, P_FLAGS, P_SHA1, P_TSLOT, P_CUP, P_NAME };
+ enum { P_TYPE, P_FLAGS, P_LEFLAGS, P_SHA1, P_TSLOT, P_CUP, P_NAME };
for ( pi = P_TYPE; pi <= P_NAME; pi++ )
{
@@ -2509,6 +2568,18 @@ bool ScanSha1LineLD
is_d = strchr(buf,'d') != 0;
break;
+ case P_LEFLAGS:
+ if ( src - par < 40 )
+ {
+ PRINT0("LEFLAGS: %.*s\n",(int)(src-par),par);
+ StringCopySM(buf,sizeof(buf),par,src-par);
+ le_flags = ScanLEFL(buf);
+ break;
+ }
+
+ pi++;
+ // fall through
+
case P_SHA1:
PRINT0("SHA1: %.*s\n",(int)(src-par),par);
valid_sha1 = IsSSChecksum(&bin,par,src-par);
@@ -2562,6 +2633,9 @@ bool ScanSha1LineLD
{
lt->track_type = is_arena ? LTTY_ARENA : LTTY_TRACK;
lt->cup_slot = cup;
+ if ( le_flags >= 0 )
+ lt->flags = le_flags;
+
SetXNameLT(lt,0,buf);
}
SetIdentOptLT(lt,hex,is_d,true,0);
@@ -2659,7 +2733,7 @@ static enumError scan_track ( le_track_t *lt, ScanInfo_t *si )
DEFINE_VAR(var);
err = ScanValueSI(si,&var);
if (!err)
- lt->flags = var.mode == VAR_STRING ? ScanLEFT(var.str) : GetIntV(&var);
+ lt->flags = var.mode == VAR_STRING ? ScanLEFL(var.str) : GetIntV(&var);
ResetV(&var);
PRINT0("TRACK %s: t=%d, p=%d, m=%d, f:%x\n",
@@ -2723,13 +2797,15 @@ static enumError ScanLeDefTRACKS
if ( !ld || !si )
return ERR_MISSING_PARAM;
- enum { C_SLOT, C_TRACK, C_LAPS, C_SPEED, C_IDENT, C_FILE, C_NAME, C_XNAME,
+ enum { C_SLOT, C_IGNORE_SLOT, C_TRACK,
+ C_LAPS, C_SPEED, C_IDENT, C_FILE, C_NAME, C_XNAME,
C_LIST, C_STD_ARENAS, C_STD_VERSUS };
enum { O_CURRENT = 0x100, O_STRING = 0x200 };
static const KeywordTab_t commands[] =
{
{ C_SLOT, "SLOT", 0, 0 },
+ { C_IGNORE_SLOT,"IGNORE-SLOT", "IGNORESLOT", 0 },
{ C_TRACK, "TRACK", 0, 0 },
{ C_LAPS, "LAPS", "LAP", O_CURRENT },
@@ -2757,7 +2833,7 @@ static enumError ScanLeDefTRACKS
s_nsec_t total_nsec = -GetTimerNSec(), get_track_nsec = 0;
enumError max_err = ERR_OK;
- int next_slot = -1, count = 0;
+ int next_slot = -1, ignore_slot = 0, count = 0;
DEFINE_VAR(string_par);
le_track_t *current_lt = 0;
le_strpar_t spar = { .opt = ld->spar.opt };
@@ -2843,6 +2919,10 @@ static enumError ScanLeDefTRACKS
CheckEolSI(si);
continue; // skip 'next_slot=-1'
+ case C_IGNORE_SLOT:
+ ScanIntValueSI(si,&ignore_slot);
+ break;
+
case C_TRACK:
{
current_lt = 0;
@@ -2853,7 +2933,7 @@ static enumError ScanLeDefTRACKS
get_track_nsec -= GetTimerNSec();
le_track_t *lt
- = next_slot >= 0
+ = next_slot >= 0 && !ignore_slot
? DefineTrackLD(ld,next_slot,true) // SLOT has highest priority
: IsRandomLEFL(temp.flags)
? DefineGroupTrackLD(ld,temp.track_type,true) // append random tracks always
@@ -2865,18 +2945,7 @@ static enumError ScanLeDefTRACKS
temp.track_slot = lt->track_slot;
MoveLT(lt,&temp);
if (*last_index_name)
- {
- #if LE_TYPE_MARKERS_ENABLED
- uint val = lt->track_slot;
- if ( lt->track_type & LTTY_ARENA )
- val |= LTT_MARKER_ARENA;
- if ( lt->track_type & LTTY_TRACK )
- val |= LTT_MARKER_TRACK;
- DefineIntVar(&si->gvar,last_index_name,val);
- #else
DefineIntVar(&si->gvar,last_index_name,lt->track_slot);
- #endif
- }
current_lt = lt;
}
}
@@ -2961,44 +3030,39 @@ static enumError ScanLeDefTRACKS
///////////////////////////////////////////////////////////////////////////////
static void add_reflist_to_cup
- ( le_distrib_t *ld, const le_cup_ref_t *slot_list, int n_slots )
+ ( le_distrib_t *ld, const le_cup_ref_t *slot_list,
+ int n_slots, le_track_type_t force_ltty )
{
if ( !ld || !slot_list || n_slots < 1 )
return;
while ( n_slots-- > 0 )
{
- #if LE_TYPE_MARKERS_ENABLED
- le_cup_ref_t val = *slot_list++;
- le_cup_ref_t slot = val & ~LTT_MARKER__ALL;
- PRINT0("APPEND %d (val:%x)%s\n",slot,val,IsValidLecodeSlot(slot)?"":" INVALID!");
- #else
le_cup_ref_t slot = *slot_list++;
PRINT0("APPEND %d %s\n",slot,IsValidLecodeSlot(slot)?"":" INVALID!");
- #endif
if (!IsValidLecodeSlot(slot))
continue;
- le_track_t *lt = GetTrackLD(ld,slot);
- if ( !IsVisibleLT(lt) )
+ if (IsLecodeRandom(slot))
{
- #if LE_TYPE_MARKERS_ENABLED
- if ( val & LTT_MARKER_TRACK )
- AppendLECUP(&ld->cup_versus,slot);
-
- if ( val & LTT_MARKER_ARENA )
+ if ( force_ltty == LTTY_ARENA )
AppendLECUP(&ld->cup_battle,slot);
- #endif
+ else
+ AppendLECUP(&ld->cup_versus,slot);
continue;
}
- if ( lt->track_type & LTTY_TRACK )
+ le_track_t *lt = GetTrackLD(ld,slot);
+ if ( !IsVisibleLT(lt) )
+ continue;
+
+ if ( lt->track_type & LTTY_TRACK && force_ltty != LTTY_ARENA )
{
lt->user_flags |= LTTY_TRACK;
AppendLECUP(&ld->cup_versus,slot);
}
- if ( lt->track_type & LTTY_ARENA )
+ if ( lt->track_type & LTTY_ARENA && force_ltty != LTTY_TRACK )
{
lt->user_flags |= LTTY_ARENA;
AppendLECUP(&ld->cup_battle,slot);
@@ -3008,7 +3072,7 @@ static void add_reflist_to_cup
//-----------------------------------------------------------------------------
-static void append_to_cup ( ScanInfo_t *si )
+static void append_to_cup ( ScanInfo_t *si, le_track_type_t ltty )
{
if ( !si || !si->ld )
return;
@@ -3025,7 +3089,7 @@ static void append_to_cup ( ScanInfo_t *si )
return;
le_cup_ref_t ref = val;
- add_reflist_to_cup(si->ld,&ref,1);
+ add_reflist_to_cup(si->ld,&ref,1,ltty);
SkipCharSI(si,',');
}
}
@@ -3068,11 +3132,13 @@ static enumError ScanLeDefCUPS
if ( !ld || !si )
return ERR_MISSING_PARAM;
- enum { C_APPEND, C_NEW_CUP, C_STD_CUPS, C_MKWFUN, C_UNUSED };
+ enum { C_APPEND, C_APPEND_BT, C_APPEND_VS, C_NEW_CUP, C_STD_CUPS, C_MKWFUN, C_UNUSED };
enum { O_BOOL_VAL = 1, O_BT = 2, O_VS = 4 };
static const KeywordTab_t commands[] =
{
{ C_APPEND, "APPEND", 0, 0 },
+ { C_APPEND_BT, "APPEND-BT", "APPEND-BT", 0 },
+ { C_APPEND_VS, "APPEND-VS", "APPEND-VS", 0 },
{ C_NEW_CUP, "NEW-CUP", "NEWCUP", 0 },
{ C_STD_CUPS, "STANDARD-BATTLE-CUPS", "STANDARDBATTLECUPS", O_BT },
@@ -3115,7 +3181,15 @@ static enumError ScanLeDefCUPS
switch(cmd->id)
{
case C_APPEND:
- append_to_cup(si);
+ append_to_cup(si,0);
+ break;
+
+ case C_APPEND_BT:
+ append_to_cup(si,LTTY_ARENA);
+ break;
+
+ case C_APPEND_VS:
+ append_to_cup(si,LTTY_TRACK);
break;
case C_NEW_CUP:
@@ -3124,15 +3198,15 @@ static enumError ScanLeDefCUPS
case C_STD_CUPS:
if (cmd->opt&O_BT)
- add_reflist_to_cup(ld,standard_bt_ref,MKW_N_ARENAS);
+ add_reflist_to_cup(ld,standard_bt_ref,MKW_N_ARENAS,LTTY_ARENA);
if (cmd->opt&O_VS)
- add_reflist_to_cup(ld,standard_vs_ref,MKW_N_TRACKS);
+ add_reflist_to_cup(ld,standard_vs_ref,MKW_N_TRACKS,LTTY_TRACK);
break;
case C_MKWFUN:
for ( int slot = MKW_LE_RANDOM_BEG; slot <= MKW_LE_RANDOM_END; slot++ )
DefineTrackLD(ld,slot,true);
- add_reflist_to_cup(ld,mkwfun_random_ref,MKW_N_LE_RANDOM);
+ add_reflist_to_cup(ld,mkwfun_random_ref,MKW_N_LE_RANDOM,LTTY_TRACK);
break;
case C_UNUSED:
@@ -3145,6 +3219,11 @@ static enumError ScanLeDefCUPS
CheckEolSI(si);
}
+ #if 0
+ xBINGO;
+ HexDump16(stdout,0,0,ld->cup_versus.list,
+ sizeof(*ld->cup_versus.list)*ld->cup_versus.used*ld->cup_versus.tracks);
+ #endif
return max_err;
}
@@ -3202,7 +3281,7 @@ enumError ScanLeDefSTLD
ld->scan.valid = true;
ld->scan.bt.add_unused = true;
ld->scan.vs.add_unused = true;
- ClearUserFlagsAndCupsLD(ld);
+ ClearUserFlagsAndCupsLD(ld,false);
}
ScanInfo_t si;
@@ -3385,7 +3464,7 @@ bool PrintCupRefLD ( FILE *f, le_distrib_t *ld, le_cup_t *lc )
///////////////////////////////////////////////////////////////////////////////
-void update_cup_helper
+static void update_cup_helper
(
le_distrib_t *ld, // valid distrib
le_cup_t *lc, // cup to update
@@ -3452,7 +3531,10 @@ void update_cup_helper
}
else if ( fill->track_status != LTS_FILL )
{
+ const int fill_slot = fill->track_slot;
le_track_t *next = DefineTrackLD(ld,ld->tlist_used,true);
+ fill = ld->tlist + fill_slot; // maybe REALLOC()
+
if (next)
{
next->track_status = LTS_FILL;
@@ -3487,24 +3569,33 @@ void update_cup_helper
if ( lc->tracks == 4 )
DumpCupSlots(ld,"before assign");
+ const uint first_custom = lc->first_custom * lc->tracks;
end = lc->list + lc->used * lc->tracks;
for ( le_cup_ref_t *ptr = lc->list; ptr < end; ptr++ )
{
if ( *ptr >= 0 )
{
le_track_t *lt = GetTrackLD(ld,*ptr);
- if ( lt && !lt->cup_slot && lt->track_type & ltty )
+ if ( lt && lt->track_type & ltty )
{
- lt->cup_slot = GetCupSlotLECUP(lc,ptr);
- if ( lt->flags & LEFL_RND_HEAD )
+ if ( ptr - lc->list < first_custom )
+ lt->flags |= G_LEFL_CUP|G_LEFL_ORIG_CUP;
+ else
+ lt->flags |= G_LEFL_CUP|G_LEFL_CUSTOM_CUP;
+
+ if (!lt->cup_slot)
{
- for ( int hslot = lt->track_slot+1; hslot < ld->tlist_used; hslot++ )
+ lt->cup_slot = GetCupSlotLECUP(lc,ptr);
+ if ( lt->flags & G_LEFL_RND_HEAD )
{
- le_track_t *hlt = GetTrackLD(ld,hslot);
- if ( IsActiveLT(hlt) && IsHiddenLEFL(hlt->flags) )
- hlt->cup_slot = lt->cup_slot;
- else
- break;
+ for ( int hslot = lt->track_slot+1; hslot < ld->tlist_used; hslot++ )
+ {
+ le_track_t *hlt = GetTrackLD(ld,hslot);
+ if ( IsActiveLT(hlt) && IsHiddenLEFL(hlt->flags) )
+ hlt->cup_slot = lt->cup_slot;
+ else
+ break;
+ }
}
}
}
@@ -3540,13 +3631,13 @@ void UpdateCupsLD ( le_distrib_t *ld )
//--- clear user flags
CheckTracksLD(ld);
- ClearUserFlagsAndCupsLD(ld);
+ ClearUserFlagsAndCupsLD(ld,true);
//--- battle cups
if (!ld->cup_battle.used)
- add_reflist_to_cup(ld,standard_bt_ref,MKW_N_ARENAS);
+ add_reflist_to_cup(ld,standard_bt_ref,MKW_N_ARENAS,LTTY_ARENA);
update_cup_helper( ld, &ld->cup_battle, LTTY_ARENA,MKW_ARENA_BEG,
!ld->scan.valid || ld->scan.bt.add_unused );
@@ -3555,7 +3646,7 @@ void UpdateCupsLD ( le_distrib_t *ld )
//--- versus cups
if (!ld->cup_versus.used)
- add_reflist_to_cup(ld,standard_vs_ref,MKW_N_TRACKS);
+ add_reflist_to_cup(ld,standard_vs_ref,MKW_N_TRACKS,LTTY_TRACK);
update_cup_helper( ld, &ld->cup_versus, LTTY_TRACK,MKW_TRACK_BEG,
!ld->scan.valid || ld->scan.vs.add_unused );
@@ -3649,9 +3740,9 @@ static void AddToGroup ( le_distrib_t *ld, le_track_arch_t *ta, mem_t grp )
//-- append index to list;
- if ( ta->lt.flags & LEFL_RND_HEAD && !gi->n_head++ )
+ if ( ta->lt.flags & G_LEFL_RND_HEAD && !gi->n_head++ )
gi->head1 = ta->lt.track_slot;
- if ( ta->lt.flags & LEFL_RND_GROUP )
+ if ( ta->lt.flags & G_LEFL_RND_GROUP )
gi->n_group++;
if ( gi->used >= gi->size )
@@ -3769,7 +3860,7 @@ enumError AddToArchLD ( le_distrib_t *ld, raw_data_t *raw )
// [[split-le-flags]]
if (spf.plus.len)
- ta->lt.flags |= LEFL_NEW;
+ ta->lt.flags |= G_LEFL_NEW;
//-- setup basic strings
@@ -3824,21 +3915,21 @@ enumError AddToArchLD ( le_distrib_t *ld, raw_data_t *raw )
// [[split-le-flags]]
if (!memcmp(attr.ptr,"head=",5))
{
- ta->lt.flags |= LEFL_RND_HEAD;
+ ta->lt.flags |= G_LEFL_RND_HEAD;
grp = MidMem(attr,5,attr.len);
}
else if (!memcmp(attr.ptr,"grp=",4))
{
- ta->lt.flags |= LEFL_RND_GROUP;
+ ta->lt.flags |= G_LEFL_RND_GROUP;
if (!grp.len)
grp = MidMem(attr,4,attr.len);
}
else if ( grp.len && !StrCmpMem(attr,"grp") )
{
- ta->lt.flags |= LEFL_RND_GROUP;
+ ta->lt.flags |= G_LEFL_RND_GROUP;
}
else if ( !StrCmpMem(attr,"new") )
- ta->lt.flags |= LEFL_NEW;
+ ta->lt.flags |= G_LEFL_NEW;
else if (!memcmp(attr.ptr,"order=",6))
ta->attr_order = str2l(attr.ptr+6,0,10);
}
@@ -3934,18 +4025,18 @@ bool CloseArchLD ( le_distrib_t *ld )
le_track_arch_t *ta = ld->arch + index;
if (clear_group)
{
- if ( ta->lt.flags & LEFL_RND_GROUP )
+ if ( ta->lt.flags & G_LEFL_RND_GROUP )
{
- ta->lt.flags &= ~LEFL__RND;
+ ta->lt.flags &= ~G_LEFL__RND;
ta->group = 0;
}
else
ta->lt.track_status = LTS_VALID; // deactivate track
}
else if ( index == gi->head1 )
- ta->lt.flags |= LEFL_RND_HEAD;
- else if ( ta->lt.flags & LEFL_RND_GROUP )
- ta->lt.flags &= ~LEFL_RND_HEAD;
+ ta->lt.flags |= G_LEFL_RND_HEAD;
+ else if ( ta->lt.flags & G_LEFL_RND_GROUP )
+ ta->lt.flags &= ~G_LEFL_RND_HEAD;
else
ta->lt.track_status = LTS_VALID; // deactivate track
}
@@ -4018,6 +4109,7 @@ bool CloseArchLD ( le_distrib_t *ld )
FREE(order);
ResetArchLD(ld);
+
return true;
}
@@ -4163,6 +4255,8 @@ void ImportCtcodeLD ( le_distrib_t *ld, const ctcode_t *ctcode )
lt->music = GetMkwMusicSlot(slot);
}
+ DefineRandomTracksLD(ld);
+
//--- copy track properties
@@ -4199,6 +4293,9 @@ void ImportCtcodeLD ( le_distrib_t *ld, const ctcode_t *ctcode )
lt->flags = ctcode->le_flags[slot];
}
+ if (IsMkwArena(lt->property))
+ lt->track_type = LTTY_ARENA;
+
char buf[200];
const int str_idx = ctcode->ctb.track_name1.beg + slot;
const bmg_item_t *bi;
@@ -4239,7 +4336,7 @@ void ImportCtcodeLD ( le_distrib_t *ld, const ctcode_t *ctcode )
const ctcode_cup1_data_t *cup;
cup = ctcode->cup_battle;
- if (cup )
+ if (cup)
{
uint max = ctcode->n_battle_cups;
if ( max > ld->cup_battle.max )
@@ -4279,7 +4376,7 @@ void ImportCtcodeLD ( le_distrib_t *ld, const ctcode_t *ctcode )
{
const int slot = ntohl(cup->track_id[i]);
le_track_t *lt = DefineTrackLD(ld,slot,false);
- if ( lt && !IsArenaLTTY(lt->track_type) )
+ if ( lt && IsTrackLTTY(lt->track_type) )
{
lt->cup_slot = 10*cup_idx + i + 11;
if (dest)
@@ -4288,6 +4385,33 @@ void ImportCtcodeLD ( le_distrib_t *ld, const ctcode_t *ctcode )
}
}
}
+
+ ld->ana.bt.add_unused = false;
+ ld->ana.vs.add_unused = false;
+ ld->scan.valid = true;
+ ld->scan.bt.add_unused = false;
+ ld->scan.vs.add_unused = false;
+
+ #if 0 // [[DEBUG]]
+ for ( int slot = 68; slot < 76; slot++ )
+ {
+ le_track_t *lt = DefineTrackLD(ld,slot,false);
+ if (lt)
+ {
+ printf("%2d %3d %x %x %2d %04x %3d %s\n",
+ lt->track_slot, lt->cup_slot,
+ lt->track_status, lt->track_type,
+ lt->property, lt->music, lt->flags,
+ lt->name );
+ }
+ }
+ #endif
+
+ #if 0
+ xBINGO;
+ HexDump16(stdout,0,0,ld->cup_versus.list,
+ sizeof(*ld->cup_versus.list)*ld->cup_versus.used*ld->cup_versus.tracks);
+ #endif
}
///////////////////////////////////////////////////////////////////////////////
@@ -5139,7 +5263,7 @@ enumError CreateInfoLD ( FILE *f, le_distrib_t *ld, bool use_xname, bool add_rat
GetCupAlignLT(lt),
PrintPropertyID(lt->property,false),
PrintMusicID(lt->music,false),
- PrintLEFL8(lt->flags,true),
+ PrintLEFL16(lt->flags,true),
esc.data.ptr );
FreeExMem(&esc);
}
@@ -5160,8 +5284,12 @@ enumError CreateSha1LD
if ( !f || !ld )
return ERR_MISSING_PARAM;
+ #if 1
+ SortByCupLD(ld,filter_options_td,ld->spar.opt);
+ #else
UpdateCupsLD(ld);
SetupReferenceList(ld,filter_options_td,ld->spar.opt);
+ #endif
static char sep[] = "#----------\r\n";
@@ -5179,27 +5307,28 @@ enumError CreateSha1LD
if ( filter && *filter )
fprintf(f,"# Active output filter: %s\r\n",filter);
- fputs( "# Columns: TYPE FLAGS SHA1 TRACK_SLOT CUP NAME\r\n"
+ fputs( "# Columns: TYPE FLAGS LE_FLAGS SHA1 TRACK_SLOT CUP NAME\r\n"
"# During the import, only the first 4 columns are evaluated.\r\n"
"# Flags: d:is _d file / t:title only / h:hidden / o:original track\r\n"
,f );
}
- int count = 0, prev_type = 99;
+ int count = 0, prev_type = 99, prev_cup = -1;
for ( le_track_t **plt = ld->reflist; *plt; plt++ )
{
const le_track_t *lt = *plt;
- if ( prev_type != lt->track_type )
+ if ( prev_type != lt->track_type || prev_cup != !lt->cup_slot )
{
prev_type = lt->track_type;
+ prev_cup = !lt->cup_slot;
fputs( add_comments ? sep : "\r\n", f );
}
const int max = ld->spar.opt & LEO_NO_D_FILES ? 0 : 1;
- for ( int d = 0; d <= max; d++ )
+ for ( int is_d = 0; is_d <= max; is_d++ )
{
- const le_track_id_t *lti = lt->lti + d;
+ const le_track_id_t *lti = lt->lti + is_d;
if ( lti->have_sha1 )
{
count++;
@@ -5209,12 +5338,13 @@ enumError CreateSha1LD
ccp name = use_xname ? GetXName2LT(lt,0) : GetNameLT(lt,0);
exmem_t esc = EscapeStringEx(name,-1,EmptyString,EmptyString,CHMD__MODERN,0,false);
- fprintf(f,"%s %c%c%c%c %s %4d %s %s\r\n",
+ fprintf(f,"%s %c%c%c%c %s %s %4d %s %s\r\n",
GetNameLTTY(lt->track_type),
- d ? 'd' : '-',
+ is_d ? 'd' : '-',
IsTitleLEFL(lt->flags) ? 't' : '-',
IsHiddenLEFL(lt->flags) ? 'h' : '-',
lti->orig_sha1 ? 'o' : '-',
+ PrintLEFL16(lt->flags,true),
hex, lt->track_slot, GetCupAlignLT(lt),
esc.data.ptr );
FreeExMem(&esc);
@@ -5332,14 +5462,19 @@ static void print_ledef_track
dest = StringCopyE(dest,comment+sizeof(comment),", hidden");
*dest = 0;
+ if (ld->spar.opt&LEO_NO_SLOT)
+ fputs("\r\n",f);
+ else
+ fprintf(f,"\r\nSLOT %u\r\n",lt->track_slot);
+
ccp type = GetNameLTTY(lt->track_type);
- fprintf(f,"\r\nTRACK %s%u\t%s\t%s\t%s\t\"%s\"%s%s\r\n",
+ fprintf(f,"TRACK %s%u\t%s\t%s\t%s\t\"%s\"%s%s\r\n",
type,
lt->track_slot,
type,
PrintPropertyID(lt->property,false),
PrintMusicID(lt->music,false),
- PrintLEFL8(lt->flags,true),
+ PrintLEFL16(lt->flags,true),
*comment ? "\t#" : "",
*comment ? comment+1 : "" );
@@ -5405,7 +5540,7 @@ static void print_ledef_track
//-----------------------------------------------------------------------------
static void print_ledef_cup
- ( FILE *f, le_distrib_t *ld, const le_cup_t *lc, int sep_index )
+ ( FILE *f, le_distrib_t *ld, const le_cup_t *lc, int sep_index, ccp suffix )
{
DASSERT(f);
DASSERT(ld);
@@ -5466,7 +5601,7 @@ static void print_ledef_cup
count++;
sep = "\r\n";
- fputs("APPEND",f);
+ fprintf(f,"APPEND%s",suffix);
for ( int t = 0; t < lc->tracks; t++ )
{
const int slot = ref[t];
@@ -5580,7 +5715,7 @@ enumError CreateLeDefLD ( FILE *f, le_distrib_t *ld )
// battle cups
fputs("#--- battle cups\r\n\r\n",f);
- print_ledef_cup(f,ld,&ld->cup_battle,2);
+ print_ledef_cup(f,ld,&ld->cup_battle,2,"-BT");
fprintf(f,
"# Append unused battle arenas automatically (0=NO/1=YES):\r\n"
@@ -5592,7 +5727,7 @@ enumError CreateLeDefLD ( FILE *f, le_distrib_t *ld )
// versus cups
fputs("#--- versus cups\r\n\r\n",f);
- print_ledef_cup(f,ld,&ld->cup_versus,8);
+ print_ledef_cup(f,ld,&ld->cup_versus,8,"-VS");
fprintf(f,
"# Append unused versus tracks automatically (0=NO/1=YES):\r\n"
@@ -5637,7 +5772,10 @@ enumError CreateLecode4LD ( ccp fname, le_distrib_t *ld )
File_t F;
enumError err = CreateFileOpt(&F,true,path,false,0);
if (!err)
+ {
err = CreateLecodeLD(F.f,ld,reg);
+ CloseFile(&F,0);
+ }
if (err)
return err;
}
@@ -6912,27 +7050,6 @@ void ScanOptLeDefine ( ccp arg )
///////////////////////////////////////////////////////////////////////////////
-le_flags_t ScanLEFT ( ccp text )
-{
- // automatic flags are not scannend!
-
- le_flags_t res = 0;
- if (text)
- {
- if ( strchr(text,'N') || strchr(text,'n') ) res |= LEFL_NEW;
- if ( strchr(text,'H') || strchr(text,'h') ) res |= LEFL_RND_HEAD;
- if ( strchr(text,'G') || strchr(text,'g') ) res |= LEFL_RND_GROUP;
- if ( strchr(text,'X') || strchr(text,'x') ) res |= LEFL_RND_HEAD | LEFL_RND_GROUP;
- if ( strchr(text,'A') || strchr(text,'a') ) res |= LEFL_ALIAS;
- if ( strchr(text,'T') || strchr(text,'t') ) res |= LEFL_TEXTURE;
- if ( strchr(text,'2') || strchr(text,'t') ) res |= LEFL_ALIAS | LEFL_TEXTURE;
- if ( strchr(text,'I') || strchr(text,'i') ) res |= LEFL_HIDDEN;
- }
- return res;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
ccp GetNameLTS ( le_track_status_t lts )
{
switch(lts)
diff --git a/project/src/lib-ledis.h b/project/src/lib-ledis.h
index 5e0d9d9..445245b 100644
--- a/project/src/lib-ledis.h
+++ b/project/src/lib-ledis.h
@@ -62,14 +62,6 @@
#define LE_STRING_SET_ENABLED 1
-//-----------------------------------------------------------------------------
-
-// LE-DEF can set track-type markers in vars to remember the track type.
-// So [CUP-LIST] can be defined before [TRACK-LIST]. Anyway, because [TRACK-LIST]
-// is scanned in pass-1 and [CUP-LIST] in pass-2 this can be always set to 0.
-
-#define LE_TYPE_MARKERS_ENABLED 0
-
//
///////////////////////////////////////////////////////////////////////////////
/////////////// definitions ///////////////
@@ -91,7 +83,7 @@
#define LE_SHA1REF_MAGIC8 "#SHA1REF"
#define LE_SHA1REF_MAGIC8_NUM 0x2353484131524546ull
-#define LE_SHA1REF_VERSION 1
+#define LE_SHA1REF_VERSION 2
#define LE_PREFIX_MAGIC8 "#PREFIX1"
#define LE_PREFIX_MAGIC8_NUM 0x2350524546495831ull
@@ -149,6 +141,13 @@ static inline bool IsTrackLTTY ( le_track_type_t track_type )
static inline bool IsRandomLTTY ( le_track_type_t track_type )
{ return ( track_type & LTTY_RANDOM ) > 0; }
+static inline bool IsArenaOrRandomLTTY ( le_track_type_t track_type )
+ { return ( track_type & (LTTY_ARENA|LTTY_RANDOM) ) > 0; }
+
+static inline bool IsTrackOrRandomLTTY ( le_track_type_t track_type )
+ { return ( track_type & (LTTY_TRACK|LTTY_RANDOM) ) > 0; }
+
+
ccp GetNameLTTY ( le_track_type_t track_type );
//
@@ -229,15 +228,15 @@ typedef enum le_options_t
{
//-- text selector
- LEO_LTT_SELECTOR = 0x000000f, // mask to store le_track_text_t selector
+ LEO_LTT_SELECTOR = 0x0000000f, // mask to store le_track_text_t selector
//-- BMG input source selector. If none is set then use all
- LEO_MKW1 = 0x0000010, // import track names from MKW set 1 (0x2454../0x24b8..)
- LEO_MKW2 = 0x0000020, // import track names from MKW set 2 (0x2490../0x24cc..)
- LEO_CTCODE = 0x0000040, // import track names from CT-CODE (0x4000..)
- LEO_LECODE = 0x0000080, // import track names from LE-CODE (0x7000..)
+ LEO_MKW1 = 0x00000010, // import track names from MKW set 1 (0x2454../0x24b8..)
+ LEO_MKW2 = 0x00000020, // import track names from MKW set 2 (0x2490../0x24cc..)
+ LEO_CTCODE = 0x00000040, // import track names from CT-CODE (0x4000..)
+ LEO_LECODE = 0x00000080, // import track names from LE-CODE (0x7000..)
LEO_MKW = LEO_MKW1 | LEO_MKW2,
LEO_DEFAULT_BMG = LEO_MKW | LEO_LECODE,
LEO_M_BMG = LEO_MKW | LEO_LECODE | LEO_CTCODE,
@@ -245,59 +244,61 @@ typedef enum le_options_t
//-- BMG input options
- LEO_IN_EMPTY = 0x0000100, // accept empty strings as valid
- LEO_IN_MINUS = 0x0000200, // accept minus strings as valid
+ LEO_IN_EMPTY = 0x00000100, // accept empty strings as valid
+ LEO_IN_MINUS = 0x00000200, // accept minus strings as valid
LEO_IN_ALL = LEO_IN_EMPTY | LEO_IN_MINUS,
//-- BMG operator
- LEO_INSERT = 0x0000400, // insert only new strings into the source.
- LEO_REPLACE = 0x0000800, // replace only strings that are already defined.
- LEO_OVERWRITE = 0x0000c00, // insert all valid strings
- LEO_M_HOW = 0x0000c00,
+ LEO_INSERT = 0x00000400, // insert only new strings into the source.
+ LEO_REPLACE = 0x00000800, // replace only strings that are already defined.
+ LEO_OVERWRITE = 0x00000c00, // insert all valid strings
+ LEO_M_HOW = 0x00000c00,
//-- Output filter pairs. Only valid if exact 1 bit is set
- LEO_VERSUS = 0x0001000, // use racing tracks only (!lt->arena)
- LEO_BATTLE = 0x0002000, // use battle arenas only (lt->arena)
+ LEO_VERSUS = 0x00001000, // use racing tracks only (!lt->arena)
+ LEO_BATTLE = 0x00002000, // use battle arenas only (lt->arena)
LEO_M_ARENA = LEO_VERSUS | LEO_BATTLE,
- LEO_CUSTOM = 0x0004000, // use custom tracks only (!lt->original)
- LEO_ORIGINAL = 0x0008000, // use original tracks only (lt->original)
+ LEO_CUSTOM = 0x00004000, // use custom tracks only (!lt->original)
+ LEO_ORIGINAL = 0x00008000, // use original tracks only (lt->original)
LEO_M_ORIGINAL = LEO_CUSTOM | LEO_ORIGINAL,
- LEO_NO_D_FILES = 0x0010000, // suppred info about _d files
+ LEO_NO_D_FILES = 0x00010000, // suppredd info about _d files
LEO_M_OUTPUT = LEO_M_ARENA | LEO_M_ORIGINAL | LEO_NO_D_FILES,
//-- Output filter flags
- LEO_OUT_EMPTY = 0x0020000, // accept empty strings as valid
- LEO_OUT_MINUS = 0x0040000, // accept minus strings as valid
+ LEO_OUT_EMPTY = 0x00020000, // accept empty strings as valid
+ LEO_OUT_MINUS = 0x00040000, // accept minus strings as valid
LEO_OUT_ALL = LEO_OUT_EMPTY | LEO_OUT_MINUS,
//-- more options
- LEO_IN_LECODE = 0x0100000, // import lecode binary
- LEO_BRIEF = 0x0200000, // suppress descriptions
+ LEO_IN_LECODE = 0x00100000, // import lecode binary
+ LEO_NO_SLOT = 0x00200000, // suppress 'SLOT <num>' if creating a LE-DEF file.
+ LEO_BRIEF = 0x00400000, // suppress descriptions
//-- special signals
- LEO_HELP = 0x1000000, // print help and exit
+ LEO_CUT_ALL = 0x01000000, // cut all
+ LEO_CUT_STD = 0x02000000, // cut for standard distribution.
+ LEO_CUT_CTCODE = 0x04000000, // cut for CT-CODE distribution.
+ LEO_M_CUT = LEO_CUT_ALL | LEO_CUT_STD | LEO_CUT_CTCODE,
- LEO_CUT_STD = 0x2000000, // cut for standard distribution.
- LEO_CUT_CTCODE = 0x4000000, // cut for CT-CODE distribution.
- LEO_M_CUT = LEO_CUT_STD | LEO_CUT_CTCODE,
+ LEO_HELP = 0x0800000, // print help and exit
//-- misc
- LEO__ALL = 0x7ffffff,
+ LEO__ALL = 0x07ffffff,
LEO__DEFAULT = LTT__DEFAULT | LEO_OVERWRITE,
LEO__SRC = LEO_LTT_SELECTOR | LEO_IN_ALL,
LEO__DEST = LEO_LTT_SELECTOR | LEO_OUT_ALL | LEO_M_OUTPUT | LEO_M_HOW,
@@ -325,6 +326,15 @@ ccp GetOutputFilterLEO ( le_options_t opt );
bool GetBmgBySlotLEO
( char *buf, uint bufsize, const bmg_t *bmg, int slot, le_options_t opt );
+//-----------------------------------------------------------------------------
+// wrapper from le_options_t to le_track_text_t
+
+static inline ccp GetUpperNameLEO ( le_options_t opt )
+ { return GetUpperNameLTT((le_track_text_t)opt); }
+
+static inline ccp GetLowerNameLEO ( le_options_t opt )
+ { return GetLowerNameLTT((le_track_text_t)opt); }
+
//
///////////////////////////////////////////////////////////////////////////////
/////////////// struct le_strpar_t ///////////////
@@ -388,7 +398,8 @@ typedef struct le_cup_t
le_cup_ref_t *list; // list with tracks => list[size][tracks]
uint used; // used cups of 'list'
uint size; // alloced cups of 'list'
- uint max; // max pssible cups of 'list'
+ uint max; // max possible cups of 'list'
+ uint first_custom; // index of first custom cup (2|8)
uint tracks; // number of tracks of each cup
uint cur_cup; // current cup
@@ -410,6 +421,9 @@ void ResetLECUP ( le_cup_t *lc );
le_cup_ref_t * GetLECUP ( const le_cup_t *lc, uint cup_index );
le_cup_ref_t * DefineLECUP ( le_cup_t *lc, uint cup_index );
+int GetIndexByRefLECUP ( const le_cup_t *lc, int cup_ref );
+uint GetRefByIndexLECUP ( const le_cup_t *lc, uint cup_index );
+
// return 0 or cup slot like 21
uint GetCupSlotLECUP ( const le_cup_t *lc, const le_cup_ref_t *ptr );
@@ -751,9 +765,10 @@ void SetupLparLD ( le_distrib_t *ld, bool load_lpar );
//-----------------------------------------------------------------------------
// trackhelpers
-uint PackTracksLD ( const le_distrib_t *ld );
-void CheckTracksLD ( const le_distrib_t *ld );
+uint PackTracksLD ( const le_distrib_t *ld );
+void CheckTracksLD ( const le_distrib_t *ld );
+void DefineRandomTracksLD ( le_distrib_t *ld );
le_track_t * GetTrackLD ( le_distrib_t *ld, int slot );
le_track_t * DefineTrackLD ( le_distrib_t *ld, int slot, bool mark_export );
le_track_t * DefineFreeTrackLD ( le_distrib_t *ld, le_track_type_t ltty, bool mark_export );
@@ -767,7 +782,7 @@ le_track_t * ReserveTracksLD ( le_distrib_t *ld, le_track_type_t ltty, int n, bo
//-----------------------------------------------------------------------------
// cup helpers
-void ClearUserFlagsAndCupsLD ( le_distrib_t *ld );
+void ClearUserFlagsAndCupsLD ( le_distrib_t *ld, bool purge_le_flags );
bool HaveWiimmCupLD ( const le_distrib_t *ld );
void DirtyCupLD ( le_distrib_t *ld, le_track_type_t ltty );
diff --git a/project/src/lib-numeric.c b/project/src/lib-numeric.c
index c355c57..7e47199 100644
--- a/project/src/lib-numeric.c
+++ b/project/src/lib-numeric.c
@@ -2043,110 +2043,6 @@ ccp GetIntModeName ( IntMode_t mode )
}
}
-///////////////////////////////////////////////////////////////////////////////
-
-ccp PrintLEFL8 ( le_flags_t flags, bool aligned )
-{
- char *buf = GetCircBuf(7);
- flags &= 0xff;
-
- if ( flags & ~LEFL__ALL )
- snprintf(buf,7,"?0x%02x ",flags);
- else if (aligned)
- {
- buf[0] = flags & LEFL_NEW ? 'N' : '-';
- buf[1] = flags & LEFL_RND_HEAD ? 'H' : '-';
- buf[2] = flags & LEFL_RND_GROUP ? 'G' : '-';
- buf[3] = flags & LEFL_ALIAS ? 'A' : '-';
- buf[4] = flags & LEFL_TEXTURE ? 'T' : '-';
- buf[5] = flags & LEFL_HIDDEN ? 'i' : '-';
- buf[6] = 0;
- }
- else
- {
- char *d = buf;
- if ( flags & LEFL_NEW ) *d++ = 'N';
- if ( flags & LEFL_RND_HEAD ) *d++ = 'H';
- if ( flags & LEFL_RND_GROUP ) *d++ = 'G';
- if ( flags & LEFL_ALIAS ) *d++ = 'A';
- if ( flags & LEFL_TEXTURE ) *d++ = 'T';
- if ( flags & LEFL_HIDDEN ) *d++ = 'i';
- if ( d == buf )
- *d++ = '-';
- *d = 0;
- }
- return buf;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-ccp PrintLEFL16 ( le_flags_t flags, bool aligned )
-{
- char *buf = GetCircBuf(7);
-
- if ( flags & ~LEFL__XALL )
- {
- snprintf(buf,7,"?0x%03x ",flags);
- return buf;
- }
-
- char *d = buf;
- switch ( flags & (LEFL_BATTLE|LEFL_VERSUS|LEFL_RANDOM) )
- {
- case LEFL_BATTLE: *d++ = 'B'; break;
- case LEFL_VERSUS: *d++ = 'V'; break;
- case LEFL_RANDOM: *d++ = 'r'; break;
- default:
- if ( aligned )
- *d++ = '-';
- }
-
- switch ( flags & (LEFL_ORIG_CUP|LEFL_CUSTOM_CUP) )
- {
- case LEFL_ORIG_CUP: *d++ = 'o'; break;
- case LEFL_CUSTOM_CUP: *d++ = 'c'; break;
- case LEFL_ORIG_CUP | LEFL_CUSTOM_CUP: *d++ = 'b'; break;
- default:
- if ( aligned )
- *d++ = '-';
- }
-
- switch ( flags & (LEFL_RND_HEAD|LEFL_RND_GROUP) )
- {
- case LEFL_RND_HEAD: *d++ = 'H'; break;
- case LEFL_RND_GROUP: *d++ = 'G'; break;
- case LEFL_RND_HEAD | LEFL_RND_GROUP: *d++ = 'X'; break;
- default:
- if ( aligned )
- *d++ = '-';
- }
-
- switch ( flags & (LEFL_NEW|LEFL_TEXTURE) )
- {
- case LEFL_NEW: *d++ = 'N'; break;
- case LEFL_TEXTURE: *d++ = 'T'; break;
- case LEFL_NEW | LEFL_TEXTURE: *d++ = '2'; break;
- default:
- if ( aligned )
- *d++ = '-';
- }
-
- if (aligned)
- {
- *d++ = flags & LEFL_ALIAS ? 'A' : '-';
- *d++ = flags & LEFL_HIDDEN ? 'i' : '-';
- }
- else
- {
- if ( flags & LEFL_ALIAS ) *d++ = 'A';
- if ( flags & LEFL_HIDDEN ) *d++ = 'i';
- if ( d == buf )
- *d++ = '-';
- }
- *d = 0;
- return buf;
-}
-
//
///////////////////////////////////////////////////////////////////////////////
/////////////// END ///////////////
diff --git a/project/src/lib-numeric.h b/project/src/lib-numeric.h
index 76df32f..d02d0e1 100644
--- a/project/src/lib-numeric.h
+++ b/project/src/lib-numeric.h
@@ -106,53 +106,6 @@ enum
#define LE_SLOT_RND_END 0x42
//-----------------------------------------------------------------------------
-// bits for [[le_flags8_t]] [[le_flags_t]]
-
-typedef u8 le_flags8_t; // type of LE-CODE track flags (classic 8 bits)
-typedef u16 le_flags_t; // type of LE-CODE track flags since build 35
-
-#define LEFL_NEW 0x01 // new track
-#define LEFL_RND_HEAD 0x02 // first track of random group
-#define LEFL_RND_GROUP 0x04 // member of random group, but not first
- // members are not added to cups
-#define LEFL_ALIAS 0x08 // use TrackByAliasLE(prop,music)
- // as alias for another track
-#define LEFL_TEXTURE 0x10 // track is declared as texture hack of same property slot
-#define LEFL_HIDDEN 0x20 // exclude a track from cups.
-
-#define LEFL__RND 0x06 // both random flags
-#define LEFL__ALL 0x3f // all bits of above
-
-// flags calculated by CopyLecodeFlags()
-#define LEFL_BATTLE 0x0100 // track is a battle arena
-#define LEFL_VERSUS 0x0200 // track is a versus track
-#define LEFL_CUP 0x0400 // track is refefrenced by a cup
-#define LEFL_ORIG_CUP 0x0800 // track is refefrenced by a original cup
-#define LEFL_CUSTOM_CUP 0x1000 // track is refefrenced by a custom cup
-#define LEFL_RANDOM 0x2000 // slot id LE-CODE random
-#define LEFL__XALL 0x3f3f // all bits of above
-
-static inline bool IsTitleLEFL ( uint flags )
- { return (flags&(LEFL_RND_HEAD|LEFL_RND_GROUP)) == LEFL_RND_HEAD; }
-
-static inline bool IsHiddenLEFL ( uint flags )
- { return (flags&LEFL_HIDDEN)
- || (flags&(LEFL_RND_HEAD|LEFL_RND_GROUP)) == LEFL_RND_GROUP; }
-
-static inline bool IsRandomLEFL ( uint flags )
- { return (flags&(LEFL_RND_HEAD|LEFL_RND_GROUP)) != 0; }
-
-ccp PrintLEFL8 ( le_flags_t flags, bool aligned );
-ccp PrintLEFL16 ( le_flags_t flags, bool aligned );
-
-static inline ccp PrintLEFL ( uint flags_bits, le_flags_t flags, bool aligned )
- { return ( flags_bits == 16 ? PrintLEFL16 : PrintLEFL8 )(flags,aligned); }
-
-typedef ccp (*PrintLEFL_func) ( le_flags_t flags, bool aligned );
-static inline PrintLEFL_func GetPrintLEFL ( uint flags_bits )
- { return flags_bits == 16 ? PrintLEFL16 : PrintLEFL8; }
-
-//-----------------------------------------------------------------------------
// some more constants
enum
diff --git a/project/src/lib-parser-func.c b/project/src/lib-parser-func.c
index 8790dff..51accd3 100644
--- a/project/src/lib-parser-func.c
+++ b/project/src/lib-parser-func.c
@@ -183,12 +183,12 @@ void DefineMkwVars ( VarMap_t * vm )
{ "SLOT$RND_CUSTOM", LE_SLOT_RND_CUSTOM },
{ "SLOT$RND_NEW", LE_SLOT_RND_NEW },
- { "LE$F_NEW", LEFL_NEW },
- { "LE$F_HEAD", LEFL_RND_HEAD },
- { "LE$F_GROUP", LEFL_RND_GROUP },
- { "LE$F_ALIAS", LEFL_ALIAS },
- { "LE$F_TEXTURE", LEFL_TEXTURE },
- { "LE$F_HIDDEN", LEFL_HIDDEN },
+ { "LE$F_NEW", G_LEFL_NEW },
+ { "LE$F_HEAD", G_LEFL_RND_HEAD },
+ { "LE$F_GROUP", G_LEFL_RND_GROUP },
+ { "LE$F_ALIAS", G_LEFL_ALIAS },
+ { "LE$F_TEXTURE", G_LEFL_TEXTURE },
+ { "LE$F_HIDDEN", G_LEFL_HIDDEN },
{ "LE$DISABLE", LE_DISABLED },
{ "LE$DISABLED", LE_DISABLED },
diff --git a/project/src/lib-std.c b/project/src/lib-std.c
index bf8aea6..85c1aef 100644
--- a/project/src/lib-std.c
+++ b/project/src/lib-std.c
@@ -707,7 +707,7 @@ ccp LibGetErrorText ( int stat, ccp ret_not_found )
///////////////////////////////////////////////////////////////////////////////
-void SetupPager()
+void SetupPager(void)
{
if ( !opt_no_pager && isatty(fileno(stdout)) )
{
diff --git a/project/src/lib-std.h b/project/src/lib-std.h
index 3296bf5..7bc302b 100644
--- a/project/src/lib-std.h
+++ b/project/src/lib-std.h
@@ -61,6 +61,7 @@
#include "file-type.h"
#include "lib-numeric.h"
#include "lib-mkw-def.h"
+#include "lib-mkw.h"
#if HAVE_XSRC
#include "xsrc/x-std.h"
@@ -157,7 +158,7 @@ enum
ccp LibGetErrorName ( int stat, ccp ret_not_found );
ccp LibGetErrorText ( int stat, ccp ret_not_found );
-void SetupPager();
+void SetupPager(void);
static inline void ClosePager() { CloseStdoutToPager(); }
struct InfoUI_t;
diff --git a/project/src/ui/tab-wlect.inc b/project/src/ui/tab-wlect.inc
index 5a8fbfe..0604c3d 100644
--- a/project/src/ui/tab-wlect.inc
+++ b/project/src/ui/tab-wlect.inc
@@ -127,6 +127,10 @@
"Print an information dump for each source file."
" LE-CODE binaries and LEX binaries are accepted as input." },
+ { T_DEF_CMD, "DB", "DB"
+ "wlect DL [source]...",
+ "Short cut for {DUMP --brief}." },
+
{ T_DEF_CMD, "DL", "DL",
"wlect DL [source]...",
"Short cut for {DUMP --long}." },
@@ -135,6 +139,10 @@
"wlect DLL [source]...",
"Short cut for {DUMP --long --long}." },
+ { T_DEF_CMD, "DLLL", "DLLL",
+ "wlect DLL [source]...",
+ "Short cut for {DUMP --long --long --long}." },
+
{ T_DEF_CMD, "BIN_DIFF", "BIN-DIFF|BINDIFF|BD",
"wlect BIN-DIFF settings binary1 binary2",
"Compare parts of 2 different LECODE binary files."
@@ -854,21 +862,30 @@
{ T_COPY_GRP, "PATCH", 0,0,0 },
{ T_SEP_OPT, 0,0,0,0 },
+ { T_COPT, "BRIEF", 0,0,
+ "For LE-CODE binaries:"
+ " If set, print infos about file header only." },
{ T_COPT, "LONG", 0,0,
"For LE-CODE binaries:"
" If set, print cups with tracks or arenas."
" For each track, property and music slot is printed in brackets."
" If set twice, print a track list too."
+ " If set 3 times, print a track slot usage map too (same as -v)."
"\n "
" For LEX binaries:"
" If set, print a hex dump of max 16 bytes (1 line) of the element data."
" If set twice, print a hex dump of max 64 bytes (4 lines)."
" If set 3 times ore more, print a complete hex dump." },
{ T_COPT, "VERBOSE", 0,0,
- "For LE-CODE binaries: If set, print a track slot usage table." },
+ "For LE-CODE binaries: If set, print a track slot usage map." },
{ T_COPY_GRP, "PATCH", 0,0,0 },
{ T_COPT, "CREATE_DISTRIB",0,0,0 },
+ //---------- COMMAND wlect DB ----------
+
+ { T_CMD_BEG, "DB", 0,0,0 },
+ { T_COPY_CMD, "DUMP", 0,0,0 },
+
//---------- COMMAND wlect DL ----------
{ T_CMD_BEG, "DL", 0,0,0 },
@@ -879,6 +896,11 @@
{ T_CMD_BEG, "DLL", 0,0,0 },
{ T_COPY_CMD, "DUMP", 0,0,0 },
+ //---------- COMMAND wlect DLLL ----------
+
+ { T_CMD_BEG, "DLLL", 0,0,0 },
+ { T_COPY_CMD, "DUMP", 0,0,0 },
+
//---------- COMMAND wlect BIN-DIFF ----------
{ T_CMD_BEG, "BIN_DIFF", 0,0,0 },
diff --git a/project/src/ui/ui-wlect.c b/project/src/ui/ui-wlect.c
index bac603a..f6f0aa9 100644
--- a/project/src/ui/ui-wlect.c
+++ b/project/src/ui/ui-wlect.c
@@ -761,12 +761,19 @@ static const InfoOption_t option_cmd_FUNCTIONS_LONG =
" --long is set, the descriptions are compared too."
};
+static const InfoOption_t option_cmd_DUMP_BRIEF =
+ { OPT_BRIEF, false, false, false, false, false, 'B', "brief",
+ 0,
+ "For LE-CODE binaries: If set, print infos about file header only."
+ };
+
static const InfoOption_t option_cmd_DUMP_LONG =
{ OPT_LONG, false, false, false, false, false, 'l', "long",
0,
"For LE-CODE binaries: If set, print cups with tracks or arenas. For"
" each track, property and music slot is printed in brackets. If set"
- " twice, print a track list too.\n"
+ " twice, print a track list too. If set 3 times, print a track slot"
+ " usage map too (same as -v).\n"
" For LEX binaries: If set, print a hex dump of max 16 bytes (1 line)"
" of the element data. If set twice, print a hex dump of max 64 bytes"
" (4 lines). If set 3 times ore more, print a complete hex dump."
@@ -775,7 +782,7 @@ static const InfoOption_t option_cmd_DUMP_LONG =
static const InfoOption_t option_cmd_DUMP_VERBOSE =
{ OPT_VERBOSE, false, false, false, false, false, 'v', "verbose",
0,
- "For LE-CODE binaries: If set, print a track slot usage table."
+ "For LE-CODE binaries: If set, print a track slot usage map."
};
static const InfoOption_t option_cmd_BIN_DIFF_QUIET =
@@ -816,8 +823,10 @@ static const KeywordTab_t CommandTab[] =
{ CMD_EXPORT, "_EXPORT", 0, 0 },
{ CMD_DPAD, "_DPAD", 0, 0 },
{ CMD_DUMP, "DUMP", "D", 0 },
+ { CMD_DB, "DBwlect DL [source]...",0, 0 },
{ CMD_DL, "DL", 0, 0 },
{ CMD_DLL, "DLL", 0, 0 },
+ { CMD_DLLL, "DLLL", 0, 0 },
{ CMD_BIN_DIFF, "BIN-DIFF", "BINDIFF", 0 },
{ CMD_BIN_DIFF, "BD", 0, 0 },
{ CMD_PATCH, "PATCH", "P", 0 },
@@ -1212,65 +1221,77 @@ static u8 option_allowed_cmd_DPAD[47] = // cmd #16
static u8 option_allowed_cmd_DUMP[47] = // cmd #17
{
- 0,0,0,1,0, 0,0,0,0,0, 0,0,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 0,0,0,0,0,
+ 0,0,0,1,0, 1,0,0,0,0, 0,0,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 0,0,0,0,0,
+ 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0
+};
+
+static u8 option_allowed_cmd_DB[47] = // cmd #18
+{
+ 0,0,0,1,0, 1,0,0,0,0, 0,0,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 0,0,0,0,0,
0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0
};
-static u8 option_allowed_cmd_DL[47] = // cmd #18
+static u8 option_allowed_cmd_DL[47] = // cmd #19
{
- 0,0,0,1,0, 0,0,0,0,0, 0,0,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 0,0,0,0,0,
+ 0,0,0,1,0, 1,0,0,0,0, 0,0,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 0,0,0,0,0,
0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0
};
-static u8 option_allowed_cmd_DLL[47] = // cmd #19
+static u8 option_allowed_cmd_DLL[47] = // cmd #20
{
- 0,0,0,1,0, 0,0,0,0,0, 0,0,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 0,0,0,0,0,
+ 0,0,0,1,0, 1,0,0,0,0, 0,0,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 0,0,0,0,0,
0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0
};
-static u8 option_allowed_cmd_BIN_DIFF[47] = // cmd #20
+static u8 option_allowed_cmd_DLLL[47] = // cmd #21
+{
+ 0,0,0,1,0, 1,0,0,0,0, 0,0,1,1,1, 1,1,1,1,1, 1,1,1,1,0, 0,0,0,0,0,
+ 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0
+};
+
+static u8 option_allowed_cmd_BIN_DIFF[47] = // cmd #22
{
0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0
};
-static u8 option_allowed_cmd_PATCH[47] = // cmd #21
+static u8 option_allowed_cmd_PATCH[47] = // cmd #23
{
0,0,0,0,0, 0,0,0,0,0, 0,0,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,0,
0,0,0,0,0, 0,0,1,1,1, 1,1,1,1,1, 1,0
};
-static u8 option_allowed_cmd_LPAR[47] = // cmd #22
+static u8 option_allowed_cmd_LPAR[47] = // cmd #24
{
0,0,0,0,1, 1,1,0,0,0, 0,0,0,1,1, 1,1,1,1,1, 1,1,1,1,0, 0,0,0,0,0,
0,0,0,0,0, 0,0,1,1,1, 1,1,1,1,1, 1,0
};
-static u8 option_allowed_cmd_CREATE[47] = // cmd #23
+static u8 option_allowed_cmd_CREATE[47] = // cmd #25
{
0,0,0,0,1, 1,1,0,1,1, 1,1,0,1,0, 1,0,1,1,1, 1,1,1,1,0, 0,0,0,0,0,
0,1,0,0,0, 0,0,1,1,1, 1,1,1,1,1, 1,0
};
-static u8 option_allowed_cmd_DISTRIBUTION[47] = // cmd #24
+static u8 option_allowed_cmd_DISTRIBUTION[47] = // cmd #26
{
0,1,0,0,1, 1,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 1,1,1,1,1,
0,0,0,0,0, 0,0,1,1,1, 1,1,1,1,1, 1,0
};
-static u8 option_allowed_cmd_CAT[47] = // cmd #25
+static u8 option_allowed_cmd_CAT[47] = // cmd #27
{
0,0,0,0,1, 1,1,0,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,0
};
-static u8 option_allowed_cmd_DECODE[47] = // cmd #26
+static u8 option_allowed_cmd_DECODE[47] = // cmd #28
{
0,0,0,0,1, 1,1,0,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
1,0,0,0,0, 0,0,1,1,1, 1,1,1,1,1, 1,0
};
-static u8 option_allowed_cmd_ENCODE[47] = // cmd #27
+static u8 option_allowed_cmd_ENCODE[47] = // cmd #29
{
0,0,0,0,0, 0,0,0,1,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
1,0,0,0,0, 0,0,1,1,1, 1,1,1,1,1, 1,0
@@ -1464,6 +1485,30 @@ static const InfoOption_t * option_tab_cmd_DUMP[] =
OptionInfo + OPT_NONE, // separator
+ &option_cmd_DUMP_BRIEF,
+ &option_cmd_DUMP_LONG,
+ &option_cmd_DUMP_VERBOSE,
+ OptionInfo + OPT_CREATE_DISTRIB,
+
+ 0
+};
+
+static const InfoOption_t * option_tab_cmd_DB[] =
+{
+ OptionInfo + OPT_LE_DEFINE,
+ OptionInfo + OPT_LPAR,
+ OptionInfo + OPT_ALIAS,
+ OptionInfo + OPT_ENGINE,
+ OptionInfo + OPT_200CC,
+ OptionInfo + OPT_PERFMON,
+ OptionInfo + OPT_CUSTOM_TT,
+ OptionInfo + OPT_XPFLAGS,
+ OptionInfo + OPT_SPEEDOMETER,
+ OptionInfo + OPT_DEBUG,
+
+ OptionInfo + OPT_NONE, // separator
+
+ &option_cmd_DUMP_BRIEF,
&option_cmd_DUMP_LONG,
&option_cmd_DUMP_VERBOSE,
OptionInfo + OPT_CREATE_DISTRIB,
@@ -1486,6 +1531,7 @@ static const InfoOption_t * option_tab_cmd_DL[] =
OptionInfo + OPT_NONE, // separator
+ &option_cmd_DUMP_BRIEF,
&option_cmd_DUMP_LONG,
&option_cmd_DUMP_VERBOSE,
OptionInfo + OPT_CREATE_DISTRIB,
@@ -1508,6 +1554,30 @@ static const InfoOption_t * option_tab_cmd_DLL[] =
OptionInfo + OPT_NONE, // separator
+ &option_cmd_DUMP_BRIEF,
+ &option_cmd_DUMP_LONG,
+ &option_cmd_DUMP_VERBOSE,
+ OptionInfo + OPT_CREATE_DISTRIB,
+
+ 0
+};
+
+static const InfoOption_t * option_tab_cmd_DLLL[] =
+{
+ OptionInfo + OPT_LE_DEFINE,
+ OptionInfo + OPT_LPAR,
+ OptionInfo + OPT_ALIAS,
+ OptionInfo + OPT_ENGINE,
+ OptionInfo + OPT_200CC,
+ OptionInfo + OPT_PERFMON,
+ OptionInfo + OPT_CUSTOM_TT,
+ OptionInfo + OPT_XPFLAGS,
+ OptionInfo + OPT_SPEEDOMETER,
+ OptionInfo + OPT_DEBUG,
+
+ OptionInfo + OPT_NONE, // separator
+
+ &option_cmd_DUMP_BRIEF,
&option_cmd_DUMP_LONG,
&option_cmd_DUMP_VERBOSE,
OptionInfo + OPT_CREATE_DISTRIB,
@@ -2028,11 +2098,25 @@ static const InfoCommand_t CommandInfo[CMD__N+1] =
"Print an information dump for each source file. LE-CODE binaries and"
" LEX binaries are accepted as input.",
0,
- 13,
+ 14,
option_tab_cmd_DUMP,
option_allowed_cmd_DUMP
},
+ { CMD_DB,
+ false,
+ false,
+ false,
+ "DBwlect DL [source]...",
+ 0,
+ "Short cut for 'DUMP --brief'.",
+ "",
+ 0,
+ 14,
+ option_tab_cmd_DB,
+ option_allowed_cmd_DB
+ },
+
{ CMD_DL,
false,
false,
@@ -2042,7 +2126,7 @@ static const InfoCommand_t CommandInfo[CMD__N+1] =
"wlect DL [source]...",
"Short cut for 'DUMP --long'.",
0,
- 13,
+ 14,
option_tab_cmd_DL,
option_allowed_cmd_DL
},
@@ -2056,11 +2140,25 @@ static const InfoCommand_t CommandInfo[CMD__N+1] =
"wlect DLL [source]...",
"Short cut for 'DUMP --long --long'.",
0,
- 13,
+ 14,
option_tab_cmd_DLL,
option_allowed_cmd_DLL
},
+ { CMD_DLLL,
+ false,
+ false,
+ false,
+ "DLLL",
+ 0,
+ "wlect DLL [source]...",
+ "Short cut for 'DUMP --long --long --long'.",
+ 0,
+ 14,
+ option_tab_cmd_DLLL,
+ option_allowed_cmd_DLLL
+ },
+
{ CMD_BIN_DIFF,
false,
false,
diff --git a/project/src/ui/ui-wlect.h b/project/src/ui/ui-wlect.h
index c44cd3f..c98d091 100644
--- a/project/src/ui/ui-wlect.h
+++ b/project/src/ui/ui-wlect.h
@@ -291,14 +291,19 @@ typedef enum enumOptions
// OB_CMD_DPAD = 0,
//
// OB_CMD_DUMP = OB_GRP_PATCH
+// | OB_BRIEF
// | OB_LONG
// | OB_GRP_PATCH
// | OB_CREATE_DISTRIB,
//
+// OB_CMD_DB = OB_CMD_DUMP,
+//
// OB_CMD_DL = OB_CMD_DUMP,
//
// OB_CMD_DLL = OB_CMD_DUMP,
//
+// OB_CMD_DLLL = OB_CMD_DUMP,
+//
// OB_CMD_BIN_DIFF = 0,
//
// OB_CMD_PATCH = OB_GRP_PATCH
@@ -373,8 +378,10 @@ typedef enum enumCommands
CMD_DPAD,
CMD_DUMP,
+ CMD_DB,
CMD_DL,
CMD_DLL,
+ CMD_DLLL,
CMD_BIN_DIFF,
CMD_PATCH,
CMD_LPAR,
@@ -386,7 +393,7 @@ typedef enum enumCommands
CMD_ENCODE,
- CMD__N // == 28
+ CMD__N // == 30
} enumCommands;
diff --git a/project/src/ui/ui.def b/project/src/ui/ui.def
index 8ed8fc1..9492806 100644
--- a/project/src/ui/ui.def
+++ b/project/src/ui/ui.def
@@ -20137,6 +20137,10 @@
"Print an information dump for each source file. LE-CODE binaries and" \
" LEX binaries are accepted as input." )
+#:def_cmd( "DB", "DBwlect DL [source]...", \
+ "Short cut for {DUMP --brief}.", \
+ "" )
+
#:def_cmd( "DL", "DL", \
"wlect DL [source]...", \
"Short cut for {DUMP --long}." )
@@ -20145,6 +20149,10 @@
"wlect DLL [source]...", \
"Short cut for {DUMP --long --long}." )
+#:def_cmd( "DLLL", "DLLL", \
+ "wlect DLL [source]...", \
+ "Short cut for {DUMP --long --long --long}." )
+
#:def_cmd( "BIN_DIFF", "BIN-DIFF|BINDIFF|BD", \
"wlect BIN-DIFF settings binary1 binary2", \
"Compare parts of 2 different LECODE binary files. @SETTINGS@ is a" \
@@ -20848,23 +20856,90 @@
"", \
"" )
+#:def_cmd_opt( "DUMP", "BRIEF", \
+ "", \
+ "For LE-CODE binaries: If set, print infos about file header only." )
+
#:def_cmd_opt( "DUMP", "LONG", \
"", \
"For LE-CODE binaries: If set, print cups with tracks or arenas. For" \
" each track, property and music slot is printed in brackets. If set" \
- " twice, print a track list too.\n" \
+ " twice, print a track list too. If set 3 times, print a track slot" \
+ " usage map too (same as -v).\n" \
" For LEX binaries: If set, print a hex dump of max 16 bytes (1 line)" \
" of the element data. If set twice, print a hex dump of max 64 bytes" \
" (4 lines). If set 3 times ore more, print a complete hex dump." )
#:def_cmd_opt( "DUMP", "VERBOSE", \
"", \
- "For LE-CODE binaries: If set, print a track slot usage table." )
+ "For LE-CODE binaries: If set, print a track slot usage map." )
#:def_cmd_opt( "DUMP", "CREATE_DISTRIB", \
"", \
"" )
+#:def_cmd_opt( "DB", "LE_DEFINE", \
+ "", \
+ "" )
+
+#:def_cmd_opt( "DB", "LPAR", \
+ "", \
+ "" )
+
+#:def_cmd_opt( "DB", "ALIAS", \
+ "", \
+ "" )
+
+#:def_cmd_opt( "DB", "ENGINE", \
+ "", \
+ "" )
+
+#:def_cmd_opt( "DB", "200CC", \
+ "", \
+ "" )
+
+#:def_cmd_opt( "DB", "PERFMON", \
+ "", \
+ "" )
+
+#:def_cmd_opt( "DB", "CUSTOM_TT", \
+ "", \
+ "" )
+
+#:def_cmd_opt( "DB", "XPFLAGS", \
+ "", \
+ "" )
+
+#:def_cmd_opt( "DB", "SPEEDOMETER", \
+ "", \
+ "" )
+
+#:def_cmd_opt( "DB", "DEBUG", \
+ "", \
+ "" )
+
+#:def_cmd_opt( "DB", "BRIEF", \
+ "", \
+ "For LE-CODE binaries: If set, print infos about file header only." )
+
+#:def_cmd_opt( "DB", "LONG", \
+ "", \
+ "For LE-CODE binaries: If set, print cups with tracks or arenas. For" \
+ " each track, property and music slot is printed in brackets. If set" \
+ " twice, print a track list too. If set 3 times, print a track slot" \
+ " usage map too (same as -v).\n" \
+ " For LEX binaries: If set, print a hex dump of max 16 bytes (1 line)" \
+ " of the element data. If set twice, print a hex dump of max 64 bytes" \
+ " (4 lines). If set 3 times ore more, print a complete hex dump." )
+
+#:def_cmd_opt( "DB", "VERBOSE", \
+ "", \
+ "For LE-CODE binaries: If set, print a track slot usage map." )
+
+#:def_cmd_opt( "DB", "CREATE_DISTRIB", \
+ "", \
+ "" )
+
#:def_cmd_opt( "DL", "LE_DEFINE", \
"", \
"" )
@@ -20905,18 +20980,23 @@
"", \
"" )
+#:def_cmd_opt( "DL", "BRIEF", \
+ "", \
+ "For LE-CODE binaries: If set, print infos about file header only." )
+
#:def_cmd_opt( "DL", "LONG", \
"", \
"For LE-CODE binaries: If set, print cups with tracks or arenas. For" \
" each track, property and music slot is printed in brackets. If set" \
- " twice, print a track list too.\n" \
+ " twice, print a track list too. If set 3 times, print a track slot" \
+ " usage map too (same as -v).\n" \
" For LEX binaries: If set, print a hex dump of max 16 bytes (1 line)" \
" of the element data. If set twice, print a hex dump of max 64 bytes" \
" (4 lines). If set 3 times ore more, print a complete hex dump." )
#:def_cmd_opt( "DL", "VERBOSE", \
"", \
- "For LE-CODE binaries: If set, print a track slot usage table." )
+ "For LE-CODE binaries: If set, print a track slot usage map." )
#:def_cmd_opt( "DL", "CREATE_DISTRIB", \
"", \
@@ -20962,23 +21042,90 @@
"", \
"" )
+#:def_cmd_opt( "DLL", "BRIEF", \
+ "", \
+ "For LE-CODE binaries: If set, print infos about file header only." )
+
#:def_cmd_opt( "DLL", "LONG", \
"", \
"For LE-CODE binaries: If set, print cups with tracks or arenas. For" \
" each track, property and music slot is printed in brackets. If set" \
- " twice, print a track list too.\n" \
+ " twice, print a track list too. If set 3 times, print a track slot" \
+ " usage map too (same as -v).\n" \
" For LEX binaries: If set, print a hex dump of max 16 bytes (1 line)" \
" of the element data. If set twice, print a hex dump of max 64 bytes" \
" (4 lines). If set 3 times ore more, print a complete hex dump." )
#:def_cmd_opt( "DLL", "VERBOSE", \
"", \
- "For LE-CODE binaries: If set, print a track slot usage table." )
+ "For LE-CODE binaries: If set, print a track slot usage map." )
#:def_cmd_opt( "DLL", "CREATE_DISTRIB", \
"", \
"" )
+#:def_cmd_opt( "DLLL", "LE_DEFINE", \
+ "", \
+ "" )
+
+#:def_cmd_opt( "DLLL", "LPAR", \
+ "", \
+ "" )
+
+#:def_cmd_opt( "DLLL", "ALIAS", \
+ "", \
+ "" )
+
+#:def_cmd_opt( "DLLL", "ENGINE", \
+ "", \
+ "" )
+
+#:def_cmd_opt( "DLLL", "200CC", \
+ "", \
+ "" )
+
+#:def_cmd_opt( "DLLL", "PERFMON", \
+ "", \
+ "" )
+
+#:def_cmd_opt( "DLLL", "CUSTOM_TT", \
+ "", \
+ "" )
+
+#:def_cmd_opt( "DLLL", "XPFLAGS", \
+ "", \
+ "" )
+
+#:def_cmd_opt( "DLLL", "SPEEDOMETER", \
+ "", \
+ "" )
+
+#:def_cmd_opt( "DLLL", "DEBUG", \
+ "", \
+ "" )
+
+#:def_cmd_opt( "DLLL", "BRIEF", \
+ "", \
+ "For LE-CODE binaries: If set, print infos about file header only." )
+
+#:def_cmd_opt( "DLLL", "LONG", \
+ "", \
+ "For LE-CODE binaries: If set, print cups with tracks or arenas. For" \
+ " each track, property and music slot is printed in brackets. If set" \
+ " twice, print a track list too. If set 3 times, print a track slot" \
+ " usage map too (same as -v).\n" \
+ " For LEX binaries: If set, print a hex dump of max 16 bytes (1 line)" \
+ " of the element data. If set twice, print a hex dump of max 64 bytes" \
+ " (4 lines). If set 3 times ore more, print a complete hex dump." )
+
+#:def_cmd_opt( "DLLL", "VERBOSE", \
+ "", \
+ "For LE-CODE binaries: If set, print a track slot usage map." )
+
+#:def_cmd_opt( "DLLL", "CREATE_DISTRIB", \
+ "", \
+ "" )
+
#:def_cmd_opt( "BIN_DIFF", "QUIET", \
"", \
"Suppress all messages and tell result as exit status only." )
diff --git a/project/src/wkmpt.c b/project/src/wkmpt.c
index 701db6e..7d8cfdb 100644
--- a/project/src/wkmpt.c
+++ b/project/src/wkmpt.c
@@ -1302,7 +1302,7 @@ static enumError cmd_gobj()
printf("%s%u object%s analyzed in %s: ",
col->status,
ag.n_gobj, ag.n_gobj == 1 ? "" : "s",
- PrintTimerUSec6(0,0,ag.dur_usec,false) );
+ PrintTimerUSec6(0,0,ag.dur_usec,0) );
printf("o=%u=%u+%u, en=%d,%d, do=%u/%u=%u+%u+%u\n",
ag.n_object, ag.n_disabled, ag.n_enabled,
@@ -1392,7 +1392,7 @@ static enumError cmd_gamemodes()
printf("%s%u object%s analyzed in %s: ",
col->status,
ap.ag.n_gobj, ap.ag.n_gobj == 1 ? "" : "s",
- PrintTimerUSec6(0,0,ap.dur_usec,false) );
+ PrintTimerUSec6(0,0,ap.dur_usec,0) );
if ( ap.n_version == ap.n_res )
printf("%u different scenario%s total",
diff --git a/project/src/wlect.c b/project/src/wlect.c
index b4c1c03..5a6fdbf 100644
--- a/project/src/wlect.c
+++ b/project/src/wlect.c
@@ -171,6 +171,22 @@ static enumError cmd_test()
#elif 1
+ le_cup_t cup;
+ //InitializeLECUP(&cup,BMG_MAX_BCUP,BMG_BCUP_TRACKS); // battle setup
+ InitializeLECUP(&cup,BMG_MAX_RCUP,BMG_RCUP_TRACKS); // versus setup
+
+ for ( int i = -1; i < 26; i++ )
+ {
+ int i1 = GetIndexByRefLECUP(&cup,i);
+ int r1 = GetRefByIndexLECUP(&cup,i1);
+ int r2 = GetRefByIndexLECUP(&cup,i);
+ int i2 = GetIndexByRefLECUP(&cup,r2);
+ printf("%3d : %3d %3d : %3d %3d\n",i,i1,r1,r2,i2);
+ }
+ return ERR_OK;
+
+ #elif 1
+
uint tr;
for ( tr = 0; tr < MKW_N_TRACKS + MKW_N_ARENAS; tr++ )
{
@@ -316,6 +332,13 @@ static enumError cmd_dump ( int long_level )
{
RegisterOptionByIndex(&InfoUI_wlect,OPT_LONG,long_level,false);
long_count += long_level;
+ brief_count = 0;
+ }
+ else if ( long_level < 0 )
+ {
+ RegisterOptionByIndex(&InfoUI_wlect,OPT_BRIEF,-long_level,false);
+ brief_count -= long_level;
+ long_count = 0;
}
raw_data_t raw;
@@ -496,22 +519,22 @@ static int BinDiffLECODE
const le_binary_head_t *h1 = a1->head;
const le_binary_head_t *h2 = a2->head;
- bd->stat_size = a1->data_size != a2->data_size;
+ bd->stat_size = a1->data_size != a2->data_size;
- if ( h1->version != h2->version || a1->header_size != a2->header_size )
+ if ( h1->v3.version != h2->v3.version || a1->header_size != a2->header_size )
bd->stat_header = true;
- else if ( h1->version <= 4 )
+ else if ( h1->v3.version <= 4 )
bd->stat_header = memcmp(h1,h2,sizeof(*h1)) != 0;
else
{
- DASSERT( h1->version >= 5 );
+ DASSERT( h1->v3.version >= 5 );
DASSERT(a1->header_size == a2->header_size );
le_binary_head_v5_t *h5 = MEMDUP(a1->head,a1->header_size);
- h5->edit_version = a2->head_v5->edit_version;
- h5->creation_time = a2->head_v5->creation_time;
- h5->edit_time = a2->head_v5->edit_time;
- bd->stat_header = memcmp(h5,a2->head_v5,a1->header_size) != 0;
+ h5->edit_version = a2->head->v5.edit_version;
+ h5->creation_time = a2->head->v5.creation_time;
+ h5->edit_time = a2->head->v5.edit_time;
+ bd->stat_header = memcmp(h5,&a2->head->v5,a1->header_size) != 0;
FREE(h5);
}
@@ -521,11 +544,11 @@ static int BinDiffLECODE
|| bodysize1 != bodysize2
|| memcmp( body1, body2, bodysize1 );
- bd->stat_timestamp = h1->version != h2->version
+ bd->stat_timestamp = h1->v3.version != h2->v3.version
? true
- : h1->version >= 5
- ? a1->head_v5->creation_time != a2->head_v5->creation_time
- : strcmp(a1->head_v4->timestamp,a2->head_v4->timestamp) != 0;
+ : h1->v3.version >= 5
+ ? a1->head->v5.creation_time != a2->head->v5.creation_time
+ : strcmp(a1->head->v4.timestamp,a2->head->v4.timestamp) != 0;
bd->stat_param = memcmp(&a1->lpar,&a2->lpar,sizeof(a1->lpar));
@@ -1091,9 +1114,6 @@ static void help_distrib ( enumError exit_code )
" The {name|instructions} are used to change the data or to write data to files."
" The {name|processing options} affect both reading and writing.\n"
"\n"
- " |{warn|This command is still under development."
- " Its use is therefore experimental and errors are quite likely!}\n"
- "\n"
" {syntax|Syntax:}\n"
"|[4]\n"
"\t|{cmd|%s DISTRIBUTION}\n"
@@ -1190,6 +1210,10 @@ static void help_distrib ( enumError exit_code )
"Replace the internal prefix list by the content of the file."
" {file|https://ct.wiimm.de/export/prefix} is the authoritative source for this.\n"
"\n"
+ "\t{name|MTCAT}:\t|"
+ "Replace the internal track category list by the content of the file."
+ " {file|https://ct.wiimm.de/export/category} is the authoritative source for this.\n"
+ "\n"
"\t{name|LPAR}:\t|"
"A LE-CODE parameter file (e.g. »{file|lpar.txt}«).\n"
"\n"
@@ -1206,6 +1230,11 @@ static void help_distrib ( enumError exit_code )
"A CT-CODE or LE-CODE definition file."
" The file is scanned by the CT-CODE scanner and then imported.\n"
"\n"
+ "\t{name|*.szs}:\t|"
+ "Track files are added to 2 different internal track tracks lists,"
+ " one for racing tracks and one for battle areans."
+ " I the argument is quoted then wlect will resolve the wildcards by itself."
+ "\n"
" |All file types that are accepted by option {opt|--le-define}"
" ({name|BRRES}, {name|TEX0}, {name|CT-CODE}, ...) are also possible.\n"
"\n"
@@ -1450,11 +1479,13 @@ static void help_distrib ( enumError exit_code )
"\t{name|RESET}:\t|"
"Reset the filter to its default.\n"
"\n"
+ "\t{name|CUT-ALL}:\t|"
+ "Remove all tracks and their settings.\n"
"\t{name|CUT-STD}:\t|"
- "Remove settings and tracks, that are not needed for a standard distribution"
+ "Remove tracks and their settings, that are not needed for a standard distribution"
" with 32 tracks and 10 battle arenas.\n"
"\t{name|CUT-CTCODE}:\t|"
- "Remove settings and tracks, that are not needed for a CT-CODE distribution."
+ "Remove tracks and their settings, that are not needed for a CT-CODE distribution."
" Arenas are also removed.\n"
"\n"
@@ -1621,6 +1652,11 @@ static void help_distrib ( enumError exit_code )
"\t{name|/IN-LECODE}:\t|"
"Switch option {name|IN-LECODE} off.\n"
"\n"
+ "\t{name|NO-SLOT}:\t|"
+ "Suppress »{name|SLOT <index>}« lines when creating a LE-CODE defintion file ({name|LE-DEF}).\n"
+ "\t{name|/NO-SLOT}:\t|"
+ "Switch option {name|NO-SLOT} off.\n"
+ "\n"
"\t{name|BRIEF}:\t|"
"When creating text files, detailed descriptions are suppressed."
" The default is based on the global options {opt|--no-header} and {opt|--brief}.\n"
@@ -1630,11 +1666,13 @@ static void help_distrib ( enumError exit_code )
//-------------------------------------------------------------------------
+ #if 0 // [[2do]]
"\n"
"{heading|Examples:}\n"
"\n"
" |....\n"
"\n"
+ #endif
//-------------------------------------------------------------------------
@@ -2473,8 +2511,10 @@ static enumError CheckCommand ( int argc, char ** argv )
case CMD_FLOAT: err = cmd_float(); break;
case CMD_DUMP: err = cmd_dump(0); break;
+ case CMD_DB: err = cmd_dump(-1); break;
case CMD_DL: err = cmd_dump(1); break;
case CMD_DLL: err = cmd_dump(2); break;
+ case CMD_DLLL: err = cmd_dump(3); break;
case CMD_BIN_DIFF: err = cmd_bin_diff(); break;
case CMD_PATCH: err = cmd_patch(); break;
diff --git a/project/src/wszst.c b/project/src/wszst.c
index 79b8ab2..39b58a0 100644
--- a/project/src/wszst.c
+++ b/project/src/wszst.c
@@ -454,9 +454,12 @@ static const sizeof_info_t sizeof_info_szs_list[] =
SIZEOF_INFO_ENTRY(lecode_debug_info_t)
SIZEOF_INFO_ENTRY(lecode_debug_ex_t)
SIZEOF_INFO_ENTRY(le_lpar_t)
- SIZEOF_INFO_ENTRY(le_binary_head_t)
+ SIZEOF_INFO_ENTRY(le_binary_head_v3_t)
SIZEOF_INFO_ENTRY(le_binary_head_v4_t)
+ SIZEOF_INFO_ENTRY(le_binary_head_v5_34_t)
+ SIZEOF_INFO_ENTRY(le_binary_head_v5_38_t)
SIZEOF_INFO_ENTRY(le_binary_head_v5_t)
+ SIZEOF_INFO_ENTRY(le_binary_head_t)
SIZEOF_INFO_ENTRY(le_binary_param_t)
SIZEOF_INFO_ENTRY(le_binpar_v1_35_t)
SIZEOF_INFO_ENTRY(le_binpar_v1_37_t)
@@ -475,6 +478,7 @@ static const sizeof_info_t sizeof_info_szs_list[] =
SIZEOF_INFO_ENTRY(le_music_t)
SIZEOF_INFO_ENTRY(le_flags8_t)
SIZEOF_INFO_ENTRY(le_flags_t)
+ SIZEOF_INFO_ENTRY(LecodeFlags_t)
SIZEOF_INFO_TITLE("LE-CODE distribution")
SIZEOF_INFO_ENTRY(le_group_t)
diff --git a/project/src/wtest.c b/project/src/wtest.c
index f4a23d8..04ee4e8 100644
--- a/project/src/wtest.c
+++ b/project/src/wtest.c
@@ -4365,8 +4365,8 @@ static enumError develop ( int argc, char ** argv )
}
duration += GetTimerUSec();
printf( " %s total, %s/1000, %u*1000 * FindConditionRef (%#x..%#x)\n",
- PrintTimerUSec6(0,0,duration,true),
- PrintTimerUSec6(0,0,duration/N1000/(ptr[1]-ptr[0]+1),true),
+ PrintTimerUSec6(0,0,duration,DC_SFORM_ALIGN),
+ PrintTimerUSec6(0,0,duration/N1000/(ptr[1]-ptr[0]+1),DC_SFORM_ALIGN),
N1000, ptr[0], ptr[1] );
duration = -GetTimerUSec();
@@ -4378,8 +4378,8 @@ static enumError develop ( int argc, char ** argv )
}
duration += GetTimerUSec();
printf( " %s total, %s/1000, %u*1000 * FindConditionRef2(%#x..%#x)\n",
- PrintTimerUSec6(0,0,duration,true),
- PrintTimerUSec6(0,0,duration/N1000/(ptr[1]-ptr[0]+1),true),
+ PrintTimerUSec6(0,0,duration,DC_SFORM_ALIGN),
+ PrintTimerUSec6(0,0,duration/N1000/(ptr[1]-ptr[0]+1),DC_SFORM_ALIGN),
N1000, ptr[0], ptr[1] );
}
putchar('\n');
diff --git a/project/templates/HISTORY.txt b/project/templates/HISTORY.txt
index bf778ff..28b332f 100644
--- a/project/templates/HISTORY.txt
+++ b/project/templates/HISTORY.txt
@@ -636,6 +636,13 @@ szs v2.29a r8691 - 2022-10-27
- New file type: MTCAT: Import and export 'MKW Track Category' files.
+szs v2.29b r8696 - 2022-10-28
+
+ - Removed a forgotten debug instruction, that created file _trace-wszst.tmp
+ when reading a LE-CODE binary file of version 4 (builds up to 34).
+ - wszst ANALYZE lecode: Changed output names.
+
+
@@MODULE(last-history.txt)@@
diff --git a/project/templates/module/last-history.txt b/project/templates/module/last-history.txt
index 5893a22..42bddc6 100644
--- a/project/templates/module/last-history.txt
+++ b/project/templates/module/last-history.txt
@@ -1,8 +1,21 @@
szs v@@VERSION@@ r@@REV-NEXT@@ - @@@@-@@-@@
- - Removed a forgotten debug instruction, that created file _trace-wszst.tmp
- when reading an LE-CODE binary file of version 4 (builds up to 34).
- - wszst ANALYZE lecode: Changed output names.
+ - Command "wlect DUMP":
+ - Accept option --brief to print file header of LE-CODE binaries only.
+ - New command "wlect DB" is a short cut for "wlect DUMP --brief".
+ - New command "wlect DLLL" is a short cut for "wlect DUMP -lll".
+ - Fixed some issues if displaying LE-CODE v5 dates.
+ - Dump of LE-CODE binaries improved.
+ - Command "wlect DISTRIB":
+ - Fixed support for random slots in cups.
+ - Updated distribution generator "distrib=...".
+ - New processing option: +CUT-ALL.
+ - File format #LE-DEF:
+ - Section [TRACK-LIST]: New instruction IGNORE-SLOT to ignore SLOT
+ instructions. When exporting, SLOT instructions are now inserted so that
+ an identical track distribution is achieved when reading in.
+ - Section [CUP-LIST]: New instructions APPEND-BT and APPEND-VS to force
+ the cup type (battle or versus). This is important for random tracks.
~ - 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/distrib.inc/distrib-tracks-cr.inc b/project/text-files/distrib.inc/distrib-tracks-cr.inc
index 21c6935..59a9e12 100644
--- a/project/text-files/distrib.inc/distrib-tracks-cr.inc
+++ b/project/text-files/distrib.inc/distrib-tracks-cr.inc
@@ -7,18 +7,30 @@
# This is the track listing. 2 formats are supported:
# old: SHA1 CUP NAME
-# new: TYPE FLAGS SHA1 TRACK_SLOT CUP NAME
-#
-# TYPE is either 'vs' or 'bt'. When TYPE is present, then TRACK_SLOT is
+# new: TYPE FLAGS LE_FLAGS SHA1 TRACK_SLOT CUP NAME
+
+# TYPE is either 'vs' or 'bt'. When TYPE is present, then TRACK_SLOT is
# expected. SHA1 is the SHA1 checksunm of the track.
-# FLAGS information about features:
+#
+# FLAGS information about features:
# d:is _d file / t:title only / h:hidden / o:original track
-# SHA1 is the sha1 of the track.
-# TRACK_SLOT is a number between 0 and 4095 to define the slot number of the
+#
+# LE_FLAGS are LE-CODE track flags:
+# Flag 1: B: battle arena, V: versus track, r: random slot.
+# Flag 2: Used in: o: original cup, c custom cup, b: both.
+# Flag 3: H: header of group, G: group member, X: header of group and group member.
+# Flags 4: N: new track, T: texture hack, 2: both.
+# Flags 5+6: A: alias, i: invisible/hidden.
+#
+# SHA1 is the sha1 of the track.
+#
+# TRACK_SLOT is a number between 0 and 4095 to define the slot number of the
# track. If <0 or not a number, the slot is undefined.
-# CUP is of format "cup.index". An optional 'A' can be used as the first
+#
+# CUP is of format "cup.index". An optional 'A' can be used as the first
# character to indicate an arena. However, this indicator is ignored if
# TYPE is present. Set it to "-" if the cup is unknown.
+#
# All other characters are read in as the NAME of the track.
#
# The new format is compatible with Wiimmfi.de for region limits.
diff --git a/project/text-files/ledis.inc/ledis-ledef-track-list-cr.inc b/project/text-files/ledis.inc/ledis-ledef-track-list-cr.inc
index f5c82f4..0a94877 100644
--- a/project/text-files/ledis.inc/ledis-ledef-track-list-cr.inc
+++ b/project/text-files/ledis.inc/ledis-ledef-track-list-cr.inc
@@ -52,3 +52,11 @@
# STANDARD-VERSUS-TRACKS
# Define 32 standard versus tracks.
+
+#--- Instructions
+
+# If IGNORE-SLOT is set to value 1, then all SLOT instructions are ignored
+# until it is reset to 0. This is easier than deleting all SLOT instructions.
+
+IGNORE-SLOT 0
+