scripts & contacts export support
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
Imports System.IO
|
||||
Imports Newtonsoft.Json
|
||||
Imports System.Runtime.Remoting.Metadata.W3cXsd2001
|
||||
|
||||
Public Class StringsOffsetEditorvb
|
||||
@@ -16,6 +17,8 @@ Public Class StringsOffsetEditorvb
|
||||
Public OffsetsTableSize As Integer
|
||||
Public TextSize As Integer
|
||||
|
||||
Public additionalsFilesToSave As List(Of FileToSave)
|
||||
|
||||
|
||||
Private Sub StringsOffsetEditorvb_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
|
||||
@@ -27,6 +30,8 @@ Public Class StringsOffsetEditorvb
|
||||
files3 = cd.makeFileList(JapISOPath.Text)
|
||||
files4 = cd.makeFileList(KUDOSpath.Text)
|
||||
|
||||
additionalsFilesToSave = New List(Of FileToSave)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub FindOffsetInJP_Click(sender As Object, e As EventArgs) Handles FindOffsetInJP.Click
|
||||
@@ -44,7 +49,7 @@ Public Class StringsOffsetEditorvb
|
||||
End If
|
||||
|
||||
Dim Off = BitConverter.ToInt32(EngFile, EngOffset.Text)
|
||||
If Off > 1000 Then MsgBox("Error in EngOffset (Kakaya-to Hnya)!", MsgBoxStyle.Critical) : Exit Sub
|
||||
If Off > 10000 Then MsgBox("Error in EngOffset (Kakaya-to Hnya)!", MsgBoxStyle.Critical) : Exit Sub
|
||||
|
||||
Dim offsets = New List(Of Integer)
|
||||
|
||||
@@ -104,7 +109,7 @@ Public Class StringsOffsetEditorvb
|
||||
End If
|
||||
|
||||
|
||||
If BitConverter.ToInt32(CurFile, Offset.Text) > 1000 Then MsgBox("Error in MainfileOffset!", MsgBoxStyle.Critical) : Exit Sub
|
||||
If BitConverter.ToInt32(CurFile, Offset.Text) > 10000 Then MsgBox("Error in MainfileOffset!", MsgBoxStyle.Critical) : Exit Sub
|
||||
'If BitConverter.ToInt32(EngFile, Offset.Text) > 1000 Then MsgBox("Error in ENGfileOffset!", MsgBoxStyle.Critical) : Exit Sub
|
||||
Dim rws As Integer = BitConverter.ToInt32(CurFile, Offset.Text)
|
||||
Dim reader = Offset.Text + 4
|
||||
@@ -298,9 +303,19 @@ Myscr:
|
||||
engReader += 4
|
||||
Next
|
||||
OffsetsTableSize = BitConverter.ToInt32(JapFile, Offset.Text) * 4 + 4
|
||||
Dim lastJapStrOffs As Integer = BitConverter.ToInt32(JapFile, OffsetsTableSize + Offset.Text - 4) + Offset.Text
|
||||
'reading japan table limis
|
||||
reader = lastJapStrOffs
|
||||
Dim maxJapStrOffs = 4
|
||||
|
||||
'we need to take MAXIMUM OFFSET from table (even its last or not)
|
||||
For bb = 4 To OffsetsTableSize - 4 Step 4
|
||||
Dim curOffs = BitConverter.ToInt32(JapFile, bb + Offset.Text)
|
||||
If curOffs >= maxJapStrOffs Then maxJapStrOffs = curOffs
|
||||
Next
|
||||
|
||||
'Dim lastJapStrOffs As Integer = BitConverter.ToInt32(JapFile, OffsetsTableSize + Offset.Text - 4) + Offset.Text
|
||||
|
||||
|
||||
'reading japan table limit
|
||||
reader = maxJapStrOffs + Offset.Text
|
||||
Do
|
||||
If JapFile(reader) = 3 And JapFile(reader + 1) = &H11 Then
|
||||
TextSize = reader + 2 - Offset.Text - OffsetsTableSize
|
||||
@@ -344,21 +359,26 @@ Myscr:
|
||||
|
||||
If str(xx) = "[" Then
|
||||
Dim skRes As String = getFromSkobki(str, xx)
|
||||
If skRes = "END" Then
|
||||
bts.AddRange({1, 17, 6, 17, 1, 17, 3, 17}) : Exit For
|
||||
End If
|
||||
|
||||
If skRes = "end" Then
|
||||
bts.AddRange({1, 17, 3, 17}) : Exit For
|
||||
End If
|
||||
|
||||
If skRes = "END311" Then
|
||||
bts.AddRange({3, 17}) : Exit For
|
||||
End If
|
||||
|
||||
|
||||
If skRes = "man" Then bts.AddRange({110, 9}) : Continue For
|
||||
If skRes = "woman" Then bts.AddRange({111, 9}) : Continue For
|
||||
Select Case skRes
|
||||
Case "END"
|
||||
bts.AddRange({1, 17, 6, 17, 1, 17, 3, 17}) : Exit For
|
||||
Case "end"
|
||||
bts.AddRange({1, 17, 3, 17}) : Exit For
|
||||
Case "END311"
|
||||
bts.AddRange({3, 17}) : Exit For
|
||||
Case "man"
|
||||
bts.AddRange({110, 9}) : Continue For
|
||||
Case "woman"
|
||||
bts.AddRange({111, 9}) : Continue For
|
||||
Case "col=white"
|
||||
bts.AddRange({&H2E, &H12, 1, 0}) : Continue For
|
||||
Case "col=orange"
|
||||
bts.AddRange({&H2E, &H12, &HD, 0}) : Continue For
|
||||
Case "col=yellow"
|
||||
bts.AddRange({&H2E, &H12, &HB, 0}) : Continue For
|
||||
Case "END"
|
||||
End Select
|
||||
|
||||
If skRes.Length = 4 Then
|
||||
bts.AddRange(SoapHexBinary.Parse(skRes).Value.ToList)
|
||||
@@ -378,8 +398,8 @@ Myscr:
|
||||
Loop
|
||||
|
||||
'if 1 or 2 bytes
|
||||
If SimpleTextAccum.Count = 1 Then bts.AddRange({SimpleTextAccum(0), 0}) : Continue For
|
||||
If SimpleTextAccum.Count = 2 Then bts.AddRange({SimpleTextAccum(0), 0, SimpleTextAccum(1), 0}) : Continue For
|
||||
'If SimpleTextAccum.Count = 1 Then bts.AddRange({SimpleTextAccum(0), 0}) : Continue For
|
||||
'If SimpleTextAccum.Count = 2 Then bts.AddRange({SimpleTextAccum(0), 0, SimpleTextAccum(1), 0}) : Continue For
|
||||
|
||||
|
||||
bts.Add(SimpleTextAccum.Count)
|
||||
@@ -458,6 +478,19 @@ Myscr:
|
||||
cd.saveCDfile(UserPath.Text, 27, 1812408, CurFile)
|
||||
End If
|
||||
|
||||
'Multisaving to doubled info
|
||||
If additionalsFilesToSave.Count > 0 Then
|
||||
If MsgBox($"Wanna add this info into{vbCrLf}additional {additionalsFilesToSave.Count} files?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
|
||||
For Each f In additionalsFilesToSave
|
||||
Dim fff = cd.getCDfile(UserPath.Text, files1(f.id).Sector, files1(f.id).Sizw).ToArray()
|
||||
For a = 0 To FinalArr.Count - 1
|
||||
fff(a + f.offset) = FinalArr(a)
|
||||
Next
|
||||
cd.saveCDfile(UserPath.Text, files1(f.id).Sector, files1(f.id).Sizw, fff)
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
MsgBox("Succesfully Saved!", MsgBoxStyle.Information)
|
||||
'Dim filnam As String = "D:\Games\PSX\Persona.2.Innocent.Sin\Export\0063_SHOPS_CODE\EDITOR\TESTOUTPUT"
|
||||
'My.Computer.FileSystem.WriteAllBytes(filnam, FinalArr.ToArray, False)
|
||||
@@ -483,6 +516,16 @@ Myscr:
|
||||
Dim fileInfo = Split(Path.GetFileNameWithoutExtension(Form1.OpenFileDialog1.FileName), "_")
|
||||
Dim Settings() = Split(My.Computer.FileSystem.ReadAllText(Form1.OpenFileDialog1.FileName), vbCrLf)
|
||||
SetName.Text = Settings(0)
|
||||
LinkedFiles.Items.Clear()
|
||||
If Settings.Count > 1 Then
|
||||
additionalsFilesToSave = JsonConvert.DeserializeObject(Of List(Of FileToSave))(Settings(1))
|
||||
For Each f In additionalsFilesToSave
|
||||
LinkedFiles.Items.Add($"#{f.id} o: {f.offset}")
|
||||
Next
|
||||
MsgBox($"Found additional {additionalsFilesToSave.Count} links to files.{vbCrLf}Be careful.", MsgBoxStyle.Information)
|
||||
Else
|
||||
additionalsFilesToSave = New List(Of FileToSave)
|
||||
End If
|
||||
|
||||
If fileInfo(0) = "0000" Then
|
||||
RadioFile.Checked = False : RadioSector.Checked = True
|
||||
@@ -538,8 +581,10 @@ Myscr:
|
||||
For xxx = 0 To curIndx - 1
|
||||
If DataGridView1.Rows(xxx).Cells(1).Value = row.Cells(1).Value Then GoTo simil
|
||||
Next
|
||||
Dim line As List(Of Byte) = CompileLine(row.Cells(1).Value.ToString) 'Check similar strings
|
||||
byteCount += line.Count
|
||||
If Not IsNothing(row.Cells(1).Value) Then
|
||||
Dim line As List(Of Byte) = CompileLine(row.Cells(1).Value.ToString) 'Check similar strings
|
||||
byteCount += line.Count
|
||||
End If
|
||||
|
||||
simil:
|
||||
Next
|
||||
@@ -564,7 +609,7 @@ simil:
|
||||
End Function
|
||||
|
||||
Private Sub DataGridView1_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit
|
||||
CalcYourTextSize()
|
||||
If Not DisableCalc.Checked Then CalcYourTextSize()
|
||||
End Sub
|
||||
|
||||
Private Sub DataGridView1_SelectionChanged(sender As Object, e As EventArgs) Handles DataGridView1.SelectionChanged
|
||||
@@ -737,5 +782,29 @@ simil:
|
||||
|
||||
End Function
|
||||
|
||||
Private Sub CopyTable_Click(sender As Object, e As EventArgs) Handles CopyTable.Click
|
||||
Dim off = Convert.ToInt32(Offset.Text)
|
||||
If CurFile Is Nothing OrElse CurFile.Length < off + 31 Then Exit Sub
|
||||
|
||||
Dim HexString As String = ""
|
||||
|
||||
For a = off To off + 31
|
||||
If a > 0 Then HexString &= " "
|
||||
HexString &= CurFile(a).ToString("X2")
|
||||
Next
|
||||
|
||||
Clipboard.SetText(HexString)
|
||||
MsgBox("32 bytes copied: " & HexString)
|
||||
End Sub
|
||||
|
||||
Private Sub unlink_Click(sender As Object, e As EventArgs) Handles unlink.Click
|
||||
additionalsFilesToSave.Clear()
|
||||
LinkedFiles.Items.Clear()
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
|
||||
Public Class FileToSave
|
||||
Public Property id As Integer
|
||||
Public Property offset As Integer
|
||||
End Class
|
||||
Reference in New Issue
Block a user