Hi! We see you’re using an ad-blocker. We’re fine with that and won’t stop you visiting the site.
But as we’re losing ad-revenue from this then why not make a donation towards website running costs?. Or you could disable your ad-blocker for this site. We think you’ll find our adverts are not overbearing!
I've tried the code psoted in this forum, to try generating my own sounds for POI alreting.
I'm using application 5.100 (5158/050510) SE:832
My chk file (5158.data.chk) is in C:\TomTom
My ogg files are under C:\TomTom\UKVoices
The VB code I'm using is the following :
Quote:
Sub data_chk_reload()
Dim g As Long
Dim b As Byte
Dim bt As Byte
Dim Maxfiles
Maxfiles = 30
'this folder holds the original data.chk file N.B. Following line modified by TomTomTim
folder = "C:\TomTom\"
'identifier of the data.chk version. complete file name is identifier.data.chk
fname = "5158"
'the OGG files need to be in the subfolder specified by cell C1
fnum = FreeFile
Open folder & fname & ".data.chk" For Binary Access Read As #fnum
flen = FileLen(folder & fname & ".data.chk")
g = get_long
Debug.Print fname; " Number of modules: "; g; " File size: "; flen
'If (g <> 102) And (g <> 120) And (g <> 123) And (g <> 136) Then
'a = MsgBox("Not a good DATA.CHK file. Please report your build version of the TomTom program to [email protected]", vbOKCancel, "Error - wrong file version")
'Close
'Exit Sub
'End If
'get offsets
If g = 102 Then Maxfiles = 12
ReDim entry(g + 1)
For i = 1 To g + 1
entry(i).offset = get_long
entry(i).sourceoffset = entry(i).offset
If i > 1 Then entry(i - 1).length = entry(i).offset - entry(i - 1).offset
Next
'confirm file size
If entry(g + 1).offset = flen Then
Debug.Print "File size confirmed"
Else
Debug.Print "File size mismatch! Reported:" & Hex(entry(g + 1).offset) & " Actual:" & flen
End If
'calculating new offsets etc
Debug.Print "Calculating new parameters"
i = 2
For f = g - Maxfiles To g
If (Cells(i, 3) > vbNullString) And (f < g) Then 'new file
Debug.Print "Verifying "; Cells(i, 3)
Debug.Print folder
Debug.Print Cells(1, 3)
Debug.Print Cells(i, 3)
flen = FileLen(folder & Cells(1, 3) & "\" & Cells(i, 3))
entry(f).ogglength = flen
pad = 0
While flen Mod 4 <> 0
flen = flen + 1
pad = pad + 1
Wend
entry(f).blocks = (flen + 12) / 4
entry(f).length = flen + 16
End If
i = i + 1
Next
'recalculate header
Debug.Print "Recalculating header ";
For i = g - Maxfiles To g + 1
entry(i).offset = entry(i - 1).offset + entry(i - 1).length
Next
Debug.Print "- new File Size is "; entry(g + 1).offset
'write output file
Debug.Print "Writing CHK file "
On Error Resume Next
Kill folder & Cells(1, 3) & "\" & fname & "_new.data.chk"
On Error GoTo 0
fnum2 = FreeFile
Open folder & Cells(1, 3) & "\" & fname & "_new.data.chk" For Binary Access Write As #fnum2
'write header
'number of segments
put_long (g)
'offsets
For i = 1 To g + 1
put_long (entry(i).offset)
Next
'non-voice files
'position pointer
Get #fnum, entry(1).offset, b
h = entry(g - Maxfiles).offset - entry(1).offset
For i = 1 To h
Get #fnum, , b
Put #fnum2, , b
DoEvents
Next
'write sound files, either from source or from new OGG
Debug.Print "Writing CHK file - Sounds"
i = 2
For f = g - Maxfiles To g
If (Cells(i, 3) > vbNullString) And (f < g) Then 'read new file
Debug.Print "Including "; Cells(i, 3); " for "; Cells(i, 1)
'recreate header
b = 1
Put #fnum2, , b
b = 0
Put #fnum2, , b
b = entry(f).blocks \ 256
Put #fnum2, , b
b = entry(f).blocks And 255
Put #fnum2, , b
put_long (1)
put_long (8)
put_long (entry(f).ogglength)
fout = FreeFile
Open folder & Cells(1, 3) & "\" & Cells(i, 3) For Binary Access Read As #fout
For h = 1 To entry(f).ogglength
Get #fout, , b
Put #fnum2, , b
DoEvents
Next
'padding
b = 0
flen = entry(f).ogglength
While flen Mod 4 <> 0
Put #fnum2, , b
flen = flen + 1
Wend
Close (fout)
Else 'read from source
'position pointer
Get #fnum, entry(f).sourceoffset, b
For h = 1 To entry(f).length
Get #fnum, , b
Put #fnum2, , b
DoEvents
Next
End If
i = i + 1
Next
Close
Beep
MsgBox ("Done - real new file size is " & FileLen(folder & Cells(1, 3) & "\" & fname & "_new.data.chk"))
End Sub
'required because of the little endian storage of long values
Function get_long() As Long
Dim b As Byte
l = 0
For h = 1 To 4
Get #fnum, , b
l = l * 256 + b
Next
get_long = l
End Function
Sub put_long(ByVal l As Long)
Dim b(4) As Byte
For h = 1 To 4
b(h) = l And 255
l = l \ 256
Next
For h = 4 To 1 Step -1
Put #fnum2, , b(h)
Next
End Sub
Private Sub CommandButton1_Click()
data_chk_reload
End Sub
The Excel sheet I'm using (For TOMTOM GO) is the following, since I only wants to change the Cow sound to radar1.ogg (Please note
the first line here below is at C1, D1, E1
the second line with Cow is at C12, D12, E12 :
Quote:
UKVoices Sampling UKVoices
Cow 22050 radar1.ogg
When launching the macro, I'm getting the follwowing error :
Quote:
Runtime Error at line :
flen = FileLen(folder & Cells(1, 3) & "\" & Cells(i, 3))
I've added the following debug lines just before the faulty line :
Just put my ogg file in Cell C12 ...
But now getting another error :
Runtime Error '9'
Subscript Out of range
into the section below :
Quote:
'calculating new offsets etc
Debug.Print "Calculating new parameters"
i = 2
For f = g - Maxfiles To g
If (Cells(i, 3) > vbNullString) And (f < g) Then 'new file
Debug.Print "Verifying "; Cells(i, 3)
Debug.Print folder
Debug.Print Cells(1, 3)
Debug.Print Cells(i, 3)
flen = FileLen(folder & Cells(1, 3) & "\" & Cells(i, 3))
entry(f).ogglength = flen
pad = 0
While flen Mod 4 <> 0
flen = flen + 1
pad = pad + 1
The faulty line is :
flen = FileLen(folder & Cells(1, 3) & "\" & Cells(i, 3))
Does anyone have a working Excel sheet with Lutz's code working to build a data.chk file for a TT GO 5.1 ?
application 5.100 (5158/050510) SE:832
I've tried pasting and following instructions from TomTomtim, changing some things like the version control or number of modukes control (With the help of Lutz), but with no success (See latest error message I got on my previous reply ...
Posted: Today Post subject: Pocket GPS Advertising
We see you’re using an ad-blocker. We’re fine with that and won’t stop you visiting the site.
Have you considered making a donation towards website running costs?. Or you could disable your ad-blocker for this site. We think you’ll find our adverts are not overbearing!
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
Or you could disable your ad-blocker for this site. We think you’ll find our adverts are not overbearing!
Hi! We see you’re using an ad-blocker. We’re fine with that and won’t stop you visiting the site.
But as we’re losing ad-revenue from this then why not make a donation towards website running costs?. Or you could disable your ad-blocker for this site. We think you’ll find our adverts are not overbearing!