Ok. First thing to say is that all the tmt files are slightly different so I can't really give you a byte list.
The first thing the editor does is to get the tour type (which is the same byte for all tours):
Byte 830448 - Tour Type (in decimal)
02 = Knockout
03 = World Championship
04 = World Series
05 = Test Series
08 = English Season
09 = County Championship
10 = National League
11 = C&G
12 = Twenty20
13 = Australian Season
14 = PURA Cup
15 = ING Cup
17 = Long Aus Tour
18 = Short Aus Tour
19 = West Indies Tour
20 = Long English Tour
21 = Short English Tour
22 = Ashes Tour (Aus)
23 = Ashes Tour (Eng)
24 = ODI Circuit
25 = South African Tour
26 = Subcontinent Tour
27 = Zim/NZ Tour
There are then 4 offsets (at minimum) you have know for each tournament:
Where the teams are stored
Where the user controlled teams are stored
Where the standings are stored
Where the fixtures are stored
Annoyingly these vary from tmt to tmt.
Teams
These are stored at 4 byte intervals and use the team code for each team. Knockout is 857728 for example and there are 8 teams.
I've posted my code below so you can get the offsets for each one: (teamoffset - ignore the other stuff and standings offsets aren't included).
Code:
Select Case tourntype
Case 2
lbltournamenttype.Text = "Knockout"
totalteams = 8
tournoffset = 857760
teamoffset = 857728
fixturesoffset = 857792
fixturesoffset1 = 0
lblcc1.Hide()
lblcc2.Hide()
lblwc2.Hide()
lbltw2.Hide()
lbltw3.Hide()
lblcgpre.Hide()
fixtures.cbofixturesfilter.Hide()
cboteamfilter.Hide()
Case 3
lbltournamenttype.Text = "World Championship"
totalteams = 14
tournoffset = 858588
teamoffset = 858532
fixturesoffset = 858644
fixturesoffset1 = 0
lblcc1.Text = "Pool 1 -"
lblcc1.Show()
lblcc2.Hide()
lblwc2.Show()
lblcgpre.Hide()
lbltw2.Hide()
lbltw3.Hide()
fixtures.cbofixturesfilter.Hide()
cboteamfilter.Hide()
Case 4
lbltournamenttype.Text = "World Series"
totalteams = 5
tournoffset = 857948
teamoffset = 857928
fixturesoffset = 857968
fixturesoffset1 = 0
lblcc1.Hide()
lblcc2.Hide()
lblwc2.Hide()
lblcgpre.Hide()
lbltw2.Hide()
lbltw3.Hide()
fixtures.cbofixturesfilter.Hide()
cboteamfilter.Hide()
Case 5
lbltournamenttype.Text = "Test Series"
totalteams = 2
tournoffset = 857948
teamoffset = 857728
fixturesoffset = 857752
fixturesoffset1 = 0
lblcc1.Hide()
lblcc2.Hide()
lblwc2.Hide()
lblcgpre.Hide()
lbltw2.Hide()
lbltw3.Hide()
fixtures.cbofixturesfilter.Hide()
cboteamfilter.Hide()
Case 8
lbltournamenttype.Text = "English Season"
totalteams = 18
tournoffset = 885800
teamoffset = 885728
fixturesoffset = 885872
fixturesoffset1 = 918152
fixturesoffset2 = 920672
fixturesoffset3 = 950624
fixturesoffset4 = 979244
lblcc1.Hide()
lblcc2.Hide()
lblwc2.Hide()
lblcgpre.Hide()
lbltw2.Hide()
lbltw3.Hide()
cboteamfilter.Show()
cboteamfilter.Items.Clear()
cboteamfilter.Items.Add("County Championship")
cboteamfilter.Items.Add("National League")
cboteamfilter.Items.Add("C&G Trophy")
cboteamfilter.Items.Add("Twenty20 Cup")
fixtures.cbofixturesfilter.Show()
fixtures.cbofixturesfilter.Items.Clear()
fixtures.cbofixturesfilter.Items.Add("All")
fixtures.cbofixturesfilter.Items.Add("County Championship")
fixtures.cbofixturesfilter.Items.Add("National League")
fixtures.cbofixturesfilter.Items.Add("C&G Trophy")
fixtures.cbofixturesfilter.Items.Add("Twenty20 Cup")
Case 9
lbltournamenttype.Text = "County Championship"
totalteams = 18
tournoffset = 858520
teamoffset = 858448
fixturesoffset = 858592
fixturesoffset1 = 0
lblcc1.Show()
lblcc2.Show()
lblwc2.Hide()
lblcgpre.Hide()
lbltw2.Hide()
lbltw3.Hide()
fixtures.cbofixturesfilter.Hide()
cboteamfilter.Hide()
Case 10
lbltournamenttype.Text = "National League"
totalteams = 19
tournoffset = 858612
teamoffset = 858528
fixturesoffset = 858688
fixturesoffset1 = 861208
lblcc1.Show()
lblcc2.Show()
lblwc2.Hide()
lblcgpre.Hide()
lbltw2.Hide()
lbltw3.Hide()
fixtures.cbofixturesfilter.Hide()
cboteamfilter.Hide()
Case 11
lbltournamenttype.Text = "C&&G Trophy"
totalteams = 18
tournoffset = 857800
teamoffset = 857728
fixturesoffset = 857872
fixturesoffset1 = 0
lblcc1.Text = "Main -"
lblcc1.Show()
lblcc2.Hide()
lblwc2.Hide()
lbltw2.Hide()
lbltw3.Hide()
lblcgpre.Show()
fixtures.cbofixturesfilter.Hide()
cboteamfilter.Hide()
Case 12
lbltournamenttype.Text = "Twenty20 Cup"
totalteams = 18
tournoffset = 858520
teamoffset = 858448
fixturesoffset = 858592
fixturesoffset1 = 0
lblcc1.Text = "Pool 1 -"
lblcc1.Show()
lbltw2.Show()
lbltw3.Show()
lblcc2.Hide()
lblwc2.Hide()
lblcgpre.Hide()
fixtures.cbofixturesfilter.Hide()
cboteamfilter.Hide()
Case 13
lbltournamenttype.Text = "Australian Season"
fixturesoffset = 885296
fixturesoffset1 = 913732
totalteams = 6
lblcc1.Hide()
lbltw2.Hide()
lbltw3.Hide()
lblcc2.Hide()
lblwc2.Hide()
lblcgpre.Hide()
cboteamfilter.Show()
cboteamfilter.Items.Clear()
cboteamfilter.Items.Add("PURA Cup")
cboteamfilter.Items.Add("ING")
fixtures.cbofixturesfilter.Show()
fixtures.cbofixturesfilter.Items.Clear()
fixtures.cbofixturesfilter.Items.Add("All")
fixtures.cbofixturesfilter.Items.Add("PURA Cup")
fixtures.cbofixturesfilter.Items.Add("ING")
Case 14
lbltournamenttype.Text = "PURA Cup"
totalteams = 6
tournoffset = 857992
teamoffset = 857968
fixturesoffset = 858016
fixturesoffset1 = 0
lblcc1.Hide()
lblcc2.Hide()
lblwc2.Hide()
lblcgpre.Hide()
lbltw2.Hide()
lbltw3.Hide()
fixtures.cbofixturesfilter.Hide()
cboteamfilter.Hide()
Case 15
lbltournamenttype.Text = "ING Cup"
totalteams = 6
tournoffset = 857992
teamoffset = 857968
fixturesoffset = 858016
fixturesoffset1 = 0
lblcc1.Hide()
lblcc2.Hide()
lblwc2.Hide()
lblcgpre.Hide()
lbltw2.Hide()
lbltw3.Hide()
fixtures.cbofixturesfilter.Hide()
cboteamfilter.Hide()
Case 17
lbltournamenttype.Text = "Long Australian Tour"
totalteams = 9
tournoffset = 859484
teamoffset = 859448
fixturesoffset = 859520
fixturesoffset1 = 0
lblcc1.Hide()
lblcc2.Hide()
lblwc2.Hide()
lblcgpre.Hide()
lbltw2.Hide()
lbltw3.Hide()
fixtures.cbofixturesfilter.Hide()
cboteamfilter.Hide()
Case 18
lbltournamenttype.Text = "Short Australian Tour"
totalteams = 10
tournoffset = 859488
teamoffset = 859448
fixturesoffset = 859528
fixturesoffset1 = 0
lblcc1.Hide()
lblcc2.Hide()
lblwc2.Hide()
lblcgpre.Hide()
lbltw2.Hide()
lbltw3.Hide()
fixtures.cbofixturesfilter.Hide()
cboteamfilter.Hide()
Case 19
lbltournamenttype.Text = "West Indies Tour"
totalteams = 5
tournoffset = 859468
teamoffset = 859448
fixturesoffset = 859488
fixturesoffset1 = 0
lblcc1.Hide()
lblcc2.Hide()
lblwc2.Hide()
lblcgpre.Hide()
lbltw2.Hide()
lbltw3.Hide()
fixtures.cbofixturesfilter.Hide()
cboteamfilter.Hide()
Case 20
lbltournamenttype.Text = "Long English Tour"
totalteams = 15
tournoffset = 860368
teamoffset = 860304
fixturesoffset = 860432
fixturesoffset1 = 0
lblcc1.Hide()
lblcc2.Hide()
lblwc2.Hide()
lblcgpre.Hide()
lbltw2.Hide()
lbltw3.Hide()
fixtures.cbofixturesfilter.Hide()
cboteamfilter.Hide()
Case 21
lbltournamenttype.Text = "Short English Tour"
totalteams = 12
tournoffset = 859496
teamoffset = 859448
fixturesoffset = 859544
fixturesoffset1 = 0
lblcc1.Hide()
lblcc2.Hide()
lblwc2.Hide()
lblcgpre.Hide()
lbltw2.Hide()
lbltw3.Hide()
fixtures.cbofixturesfilter.Hide()
cboteamfilter.Hide()
Case 22
lbltournamenttype.Text = "Ashes Tour (Australia)"
totalteams = 10
tournoffset = 859488
teamoffset = 859448
fixturesoffset = 859528
fixturesoffset1 = 0
lblcc1.Hide()
lblcc2.Hide()
lblwc2.Hide()
lblcgpre.Hide()
lbltw2.Hide()
lbltw3.Hide()
fixtures.cbofixturesfilter.Hide()
cboteamfilter.Hide()
Case 23
lbltournamenttype.Text = "Ashes Tour (England)"
totalteams = 16
tournoffset = 859512
teamoffset = 859448
fixturesoffset = 859576
fixturesoffset1 = 0
lblcc1.Hide()
lblcc2.Hide()
lblwc2.Hide()
lblcgpre.Hide()
lbltw2.Hide()
lbltw3.Hide()
fixtures.cbofixturesfilter.Hide()
cboteamfilter.Hide()
Case 24
lbltournamenttype.Text = "ODI Circuit"
totalteams = 10
tournoffset = 857776
teamoffset = 857736
fixturesoffset = 861240
fixturesoffset1 = 861520
fixturesoffset2 = 861716
lblcc1.Hide()
lblcc2.Hide()
lblwc2.Hide()
lblcgpre.Hide()
lbltw2.Hide()
lbltw3.Hide()
fixtures.cbofixturesfilter.Hide()
cboteamfilter.Hide()
Case 25
lbltournamenttype.Text = "South Africa Tour"
totalteams = 6
tournoffset = 859472
teamoffset = 859448
fixturesoffset = 859496
fixturesoffset1 = 0
lblcc1.Hide()
lblcc2.Hide()
lblwc2.Hide()
lblcgpre.Hide()
lbltw2.Hide()
lbltw3.Hide()
fixtures.cbofixturesfilter.Hide()
cboteamfilter.Hide()
Case 26
lbltournamenttype.Text = "Subcontinent Tour"
totalteams = 8
tournoffset = 857768
teamoffset = 857736
fixturesoffset = 862936
fixturesoffset1 = 863328
lblcc1.Hide()
lblcc2.Hide()
lblwc2.Hide()
lblcgpre.Hide()
lbltw2.Hide()
lbltw3.Hide()
fixtures.cbofixturesfilter.Hide()
cboteamfilter.Hide()
Case 27
lbltournamenttype.Text = "Zimbabwe/New Zealand Tour"
totalteams = 5
tournoffset = 861180
teamoffset = 861160
fixturesoffset = 861200
fixturesoffset1 = 0
lblcc1.Hide()
lblcc2.Hide()
lblwc2.Hide()
lblcgpre.Hide()
lbltw2.Hide()
lbltw3.Hide()
fixtures.cbofixturesfilter.Hide()
cboteamfilter.Hide()
Case Else
MsgBox("format not yet supported", MsgBoxStyle.Critical)
Me.Close()
User controlled teams
tournoffset is where the teams are listed again (4 bytes apart) with a 1 if they are user controlled and a 0 for computer
Standings
Stored in 40 byte intervals, shows the tables for the tournament.
e.g 857744 - Test Series
In a lot of tournaments there is more than one set of standings (and indeed teams). Hopefully the following code will help (!):
Code:
'test series
For a = 0 To 50
FS.Seek(fixturesoffset + a * 28 + 2, SeekOrigin.Begin)
b = BR.ReadByte
If b = 5 Then Exit For
Next
FS.Seek(fixturesoffset + a * 28, SeekOrigin.Begin)
a = BR.ReadByte
b = BR.ReadByte
FS.Seek(857744, SeekOrigin.Begin)
BW.Write(a)
FS.Seek(857784, SeekOrigin.Begin)
BW.Write(b)
'world series 3 teams in position 2 "858600"
'for aus ashes, sa tour, aus long tour, aus short tour, eng long tour
Dim i, j As Integer
If tourntype = 22 Or tourntype = 25 Or tourntype = 17 Or tourntype = 18 Or tourntype = 20 Then
j = 858600
If tourntype = 22 Then i = 859892
If tourntype = 25 Then i = 859748
If tourntype = 17 Then i = 859856
If tourntype = 18 Then i = 859836
If tourntype = 20 Then i = 860992
FS.Seek(i, SeekOrigin.Begin)
a = BR.ReadByte
b = BR.ReadByte
FS.Seek(i + 28, SeekOrigin.Begin)
c = BR.ReadByte
d = BR.ReadByte
FS.Seek(j, SeekOrigin.Begin)
BW.Write(a)
FS.Seek(j + 40, SeekOrigin.Begin)
BW.Write(b)
If a = c Or b = c Then
FS.Seek(j + 80, SeekOrigin.Begin)
BW.Write(d)
ElseIf a = d Or b = d Then
FS.Seek(j + 80, SeekOrigin.Begin)
BW.Write(c)
End If
End If
'odi series in position 2
'for eng ashes, eng short tour, wi tour, nz/zim tour
'odi series in in position 3 "859456"
'for eng long tour
If tourntype = 23 Or tourntype = 21 Or tourntype = 19 Or tourntype = 20 Or tourntype = 27 Then
j = 858600
If tourntype = 23 Then i = 859716
If tourntype = 21 Then i = 859908
If tourntype = 19 Then i = 859768
If tourntype = 20 Then i = 861048
If tourntype = 20 Then j = 859456
If tourntype = 27 Then i = 861228
FS.Seek(i, SeekOrigin.Begin)
a = BR.ReadByte
b = BR.ReadByte
FS.Seek(j, SeekOrigin.Begin)
BW.Write(a)
FS.Seek(j + 40, SeekOrigin.Begin)
BW.Write(b)
End If
'odi series in position 4 "860312"
'for nz/zim tour
'test series in position 3
'for nz/zim tour
If tourntype = 27 Then
i = 861480
j = 860312
FS.Seek(i, SeekOrigin.Begin)
a = BR.ReadByte
b = BR.ReadByte
FS.Seek(j, SeekOrigin.Begin)
BW.Write(a)
FS.Seek(j + 40, SeekOrigin.Begin)
BW.Write(b)
i = 861564
j = 858600
FS.Seek(i, SeekOrigin.Begin)
a = BR.ReadByte
b = BR.ReadByte
FS.Seek(j, SeekOrigin.Begin)
BW.Write(a)
FS.Seek(j + 40, SeekOrigin.Begin)
BW.Write(b)
End If
Fixtures
This is probably the easiest part to understand (the offsets for c2k5 are in the first block of code):
Fixtures come in 28 byte blocks as follows:
(28+) 0 - Team 2
1 - Team 1
2 - Length of match (days)
3 - Match result
4-13 - match result and scorecard info (haven't checked it out properly)
14-15 - Overs
16-18 - date and venue (also changes when match is over)
20-23 - Match Type (e.g. test match, tour match etc).
I realise this isn't as helpful as it might be but the tmt file was quite a lot more complicated than I was expecting. I can give you a breakdown of exactly how the fixture bytes work if you like or if you have any other questions then feel free to post them.