i downloaded all the latest plugins from phoenic and i had to edit the goof plugin to work
basically this script looks for lines beginning with '<unused' and replaces it with multiple floats, shorts, and bytes adding up to the original size of the unused section
if it messes up something then please let me know what it did
dont ask for help with edited plugins, i'll only help with using this script on the latest unedited plugins
open notepad, paste this text, save in ent folder as convert.vbs, close notepad and double click convert.vbs
Code: Select all
Option Explicit
Dim fso 'filesystemobject, used for reading/creating files and folders
Dim oInFile 'this will be the ent plugin being read
Dim oOutFile 'this will be the ent plugin written to the output folder
Dim x 'i use this for a generic counter in a loop
Dim sLine 'this will be the current line read from the input file
Dim iOffset 'this will be the offset of the unused section
Dim oFile 'this is the current file object used in the loop checking the current directory for ent files
Dim iFileCount 'this is the counter to tell how many ent plugins were converted
Dim iNumFloats 'this will tell how many times to add a float line
Dim iBegin 'this will be used to store the beginning byte of the unused tag in the current line read from the input file
Dim iSizeBegin 'this will be used to store the beginning byte of the size parameter in the current line read from the input file
Dim iOffsetBegin 'this will be used to store the beginning byte of the Offset parameter in the current line read from the input file
Const sOutputDir = "Converted Ent Plugins\" 'This needs to end with a backslash
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists(sOutputDir) Then fso.CreateFolder sOutputDir 'If the output directory doesnt exist then create it
iFileCount = 0 'we havent processed any ent files yes
For Each oFile In fso.GetFolder(".").Files
If RightB(oFile.Name, 8) = ".ent" Then 'only process ent files
Set oInFile = oFile.OpenAsTextStream 'this returns the textstream object of the current input file
Set oOutFile = fso.CreateTextFile(sOutputDir & oFile.Name, True) 'this creates the current output file
Do Until oInFile.AtEndOfStream 'we run a loop until the end of the file
sLine = oInFile.ReadLine 'read one line
If LenB(sLine) Then 'dont try to process empty lines
iBegin = InStrB(LCase(sLine), "<unused") 'find the beginning of the 'unused' tag
If iBegin Then 'if it doesnt contain unused then iBegin will contain 0 so this would be false
iSizeBegin = InStrB(LCase(sLine), "size=") 'if it does contain 'unused' then find the position of the size parameter
If iSizeBegin Then
iSizeBegin = iSizeBegin + 12 'if it does have a size param, then get the position immediately after size="
Else
Msgbox "Fix " & oFile.Name & vbNewLine & sLine 'if it doesnt have a size param then notify the user to fix this file and exit the script
oInFile.Close
oOutFile.Close
WScript.Quit
End If
iNumFloats = MidB(sLine, iSizeBegin, InStrB(iSizeBegin, LCase(sLine), """") - iSizeBegin) 'this retrieves just the number in quotes immediately after size=
iNumFloats = iNumFloats 'take the size and divide it by 4 since floats are 4 bytes and we need to take up all bytes of the unused data using floats
iOffsetBegin = InStrB(LCase(sLine), "offset=") 'find the beginning of the offset param
If iOffsetBegin Then
iOffsetBegin = iOffsetBegin + 16 'if it does contain an offset param, then skip to the beginning of the value
Else
Msgbox "Fix " & oFile.Name & vbNewLine & sLine 'if it doesnt contain an offset param then notify the user and quit the script
oInFile.Close
oOutFile.Close
WScript.Quit
End If
iOffset = MidB(sLine, iOffsetBegin, InStrB(iOffsetBegin, LCase(sLine), """") - iOffsetBegin) 'this gets the number in quotes after 'offset='
If iNumFloats > 3 Then
For x = 0 To (iNumFloats / 4) - 1 'loop once for each float
If iBegin > 1 Then oOutFile.Write LeftB(sLine, iBegin - 1) 'if there were tabs or spaces before the beginning of '<unused' then put them back
oOutFile.WriteLine "<float name=""Unused"" offset=""" & iOffset & """ visible=""False"" />" 'add each float compensating for the unused section
iNumFloats = iNumFloats - 4 'subtract one float from iNumFloats so we can check after all loops to make sure all bytes of size were procesed
iOffset = iOffset + 4 'adjust the offset for the next line
Next
End If
If iNumFloats AND 2 Then
If iBegin > 1 Then oOutFile.Write LeftB(sLine, iBegin - 1) 'if there were tabs or spaces before the beginning of '<unused' then put them back
oOutFile.WriteLine "<short name=""Unused"" offset=""" & iOffset & """ visible=""False"" />"
iNumFloats = iNumFloats - 2 'subtract one short from iNumFloats so we can check after all loops to make sure all bytes of size were procesed
iOffset = iOffset + 2 'adjust the offset for the next line
If iNumFloats Then
If iBegin > 1 Then oOutFile.Write LeftB(sLine, iBegin - 1) 'if there were tabs or spaces before the beginning of '<unused' then put them back
oOutFile.WriteLine "<byte name=""Unused"" offset=""" & iOffset & """ visible=""False"" />"
iNumFloats = iNumFloats - 1 'subtract one byte from iNumFloats so we can check to make sure all bytes are accounted for
End IF
ElseIf iNumFloats Then
If iBegin > 1 Then oOutFile.Write LeftB(sLine, iBegin - 1) 'if there were tabs or spaces before the beginning of '<unused' then put them back
oOutFile.WriteLine "byte name=""Unused"" offset=""" & iOffset & """ visible=""False"" />"
iNumFloats = iNumFloats - 1
End If
If iNumFloats Then MsgBox "Something went wrong!" & vbNewLine & "iNumFloats = " & iNumFloats & vbNewLine & "sLine: " & sLine & vbNewLine & oFile.Name: WScript.Quit
Else 'if this isnt an 'unused' section then just pass it on to the new file
oOutFile.WriteLine sLine
End If
Else 'if this is a blank line then pass it on to the new file
oOutFile.WriteLine
End If
Loop
iFileCount = iFileCount + 1 'add one to the counter of ent files processed
End If
Next
WScript.Echo "Finished!"
WScript.Quit