potterr on 18/10/2005 at 16:59
Ok here is what happens with regards to the user.in file (code included)
first off the restore the GLBU version (note the code displayed is missing the occasional "\" and displaying "" instead, this is due to the forum display rather than the code itself).
Code:
Public Sub Restore_T3_INI_files()
If t3_game_location = "" Then Exit Sub
Set fs = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
myIniListArray = Split("default,FacialExp,MotionTags,reverbstyles,T3AutoTag,T3Camera,T3Hud,T3InputMem,T3ItemGrid,T3Menu,T3PhysicsSound,T3PlayerAnims,T3Rumble,T3UI,T3UILights,T3UISoup", ",")
If fs.FileExists(Replace(Replace(t3_game_location, "\System", ""), "\system", "") & "\user.ini.GLBU") Then
Call fs.deletefile(Replace(Replace(t3_game_location, "\System", ""), "\system", "") & "\user.ini", True)
Sleep (200)
Call fs.movefile(Replace(Replace(t3_game_location, "\System", ""), "\system", "") & "\user.ini.GLBU", Replace(Replace(t3_game_location, "\System", ""), "\system", "") & "\user.ini")
End If
For arra = 0 To UBound(myIniListArray)
If fs.FileExists(t3_game_location & "\" & myIniListArray(arra) & ".ini.GLBU") Then
Call fs.deletefile(Replace(t3_game_location, "\System", "") & "\" & myIniListArray(arra) & ".ini", True)
Sleep (200)
Call fs.movefile(t3_game_location & "\" & myIniListArray(arra) & ".ini.GLBU", t3_game_location & "\" & myIniListArray(arra) & ".ini")
End If
Next
Set fs = Nothing
End Sub
The important part here is
If fs.FileExists(Replace(Replace(t3_game_location, "\System", ""), "\system", "") & "\user.ini.GLBU") Thenas what this is doing is to say does the user.ini.glbu file exist in (for example my game path)
d:\thief3\user.ini.glbu, if so rename it to be user.ini (note that the
System folder is being knocked off the end of the game path, and teh game path is that of the T3GAME in teh garrettloader.ini file).
Ziemanskye, this would explain the 26th sept date as your original user.ini file is never touched, just the copied version and so the date never changes (changing teh file name does not change the modified date).
Ok next we have the actual work done to see if there is a need to update the user.ini file.
Code:
Public Sub Check_For_new_T3_INI_files()
If t3_game_location = "" Then Exit Sub
myIniListArray = Split("default,FacialExp,MotionTags,reverbstyles,T3AutoTag,T3Camera,T3Hud,T3InputMem,T3ItemGrid,T3Menu,T3PhysicsSound,T3PlayerAnims,T3Rumble,T3UI,T3UILights,T3UISoup", ",")
Set fs = CreateObject("Scripting.FileSystemObject")
If fs.FileExists(Replace(Replace(t3_game_location, "\System", ""), "\system", "") & "\user_patch.ini") Then
mycopy = fs.copyfile(Replace(Replace(t3_game_location, "\System", ""), "\system", "") & "\user.ini", Replace(Replace(t3_game_location, "\System", ""), "\system", "") & "\user.ini.GLBU")
Call Update_T3_ini_files(Replace(Replace(t3_game_location, "\System", ""), "\system", "") & "\user.ini", Replace(Replace(t3_game_location, "\System", ""), "\system", "") & "\user_patch.ini")
End If
For arra = 0 To UBound(myIniListArray)
If fs.FileExists(t3_game_location & "\" & myIniListArray(arra) & "_patch.ini") Then
mycopy = fs.copyfile(t3_game_location & "\" & myIniListArray(arra) & ".ini", t3_game_location & "\" & myIniListArray(arra) & ".ini.GLBU")
Call Update_T3_ini_files(t3_game_location & "\" & myIniListArray(arra) & ".ini", t3_game_location & "\" & myIniListArray(arra) & "_patch.ini")
End If
Next
Set fs = Nothing
End Sub
now if you are getting a user.ini.glbu file being made (delete your user.ini and rename your user.ini.glbu file to user.ini and click the PLAY button in GL for K.L. again and see if you get one created) then the following function should be run.
Code:
Public Sub Update_T3_ini_files(INI_File_Location As String, Custom_File_Name As String)
Dim ini_lists(50, 100) As String
Dim Current_ini_line As Integer, Current_ini_section As Integer
Current_ini_line = -1
Current_ini_section = 0
'get all ini file sections
Open Custom_File_Name For Input As #22
Do Until EOF(22) = True
If LOF(22) = 0 Then Exit Do
Line Input #22, myline
If Left(Trim(myline), 1) = "[" Then
'getting title section
Current_ini_line = Current_ini_line + 1
ini_lists(Current_ini_line, 0) = Replace(Replace(myline, "[", ""), ]", "")
Current_ini_section = 1
ElseIf Left(Trim(myline), 1) <> ";" And Len(Trim(myline)) <> 0 Then
'getting subsections
If ini_lists(Current_ini_line, 0) <> "" Then
ini_lists(Current_ini_line, Current_ini_section) = Trim(Left(myline, InStr(1, myline, "=", vbTextCompare) - 1))
Current_ini_section = Current_ini_section + 1
End If
End If
Loop
Close #22
'now edit each ini file section
Dim myOrigInITemp As String
Dim myNewInITemp As String
For i = 0 To UBound(ini_lists)
If ini_lists(i, 0) = "" Then Exit For
For w = 1 To UBound(ini_lists)
If ini_lists(i, w) = "" Then Exit For
myOrigInITemp = Trim(GetINI(INI_File_Location, ini_lists(i, 0), ini_lists(i, w), "0"))
myNewInITemp = (GetINI(Custom_File_Name, ini_lists(i, 0), ini_lists(i, w), "0"))
If myNewInITemp <> myOrigInITemp Then
myret = SetINI(INI_File_Location, ini_lists(i, 0), ini_lists(i, w), myNewInITemp)
End If
Next
Next
End Sub
This function currently handles up to 50 sections with 100 items in each (Dim ini_lists(50, 100) As String) (although I have concerns that in future this may not be sufficent).
Basically what its doing is opening up the user_patch.ini file, scanning the contents for each section header (the ones in the square brackets), adding them to the first value of the ini_lists variable. Then it scans down until either the end of the file or it finds another section and adds each item found to the second value of the ini_lists variable (under the first values section...see *** below). Having stepped through it countless times I can't see any problems with it unless the file does not exist.
What I would like to do is to test a debug version of GL 1.22 on a few people with this issue and see where the problem is occuring.
*** For those that don't know arrays, the ini_lists variable has two parts, 50 values and 100 values, this means that when a value is added to ini_lists(0,0) it adds it to the first 0, in corrispondence to the second 0 (this will be the section title), now when something is added to ini_lists(0,1) this will be under the first section title (0) but will be the first item, and so on (ini_lists(1,0) will be the title of section 2 in the user.ini file, etc).