scripts & contacts export support

This commit is contained in:
sShemet
2025-12-29 19:03:54 +05:00
parent 3475406781
commit cbad01271c
43 changed files with 102510 additions and 1534 deletions

BIN
maya.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@@ -149,7 +149,7 @@ Partial Class Form1
For a = 57 To 397
For a = 57 To 396
'reading files
Debug.WriteLine("Working On......" & a.ToString("D4"))
Dim ind = files.FindIndex(Function(x) x.Contains(a.ToString("D4")))
@@ -337,8 +337,11 @@ Partial Class Form1
Dim exeFile = cd.getCDfile(getFilnam, 27, 1812408)
'search in exe
Dim res = ByteSearch(exeFile.ToArray, finfil.ToArray)
If res > -1 Then MsgBox("FOUND! IN SLPS!" & vbCrLf & "Offset: " & res) : Exit Sub
Dim exeResults = ByteSearchAll(exeFile.ToArray, finfil.ToArray)
For Each res In exeResults
MsgBox("FOUND! IN SLPS!" & vbCrLf & "Offset: " & res) : Exit Sub
Next
'all files to video
@@ -347,8 +350,10 @@ Partial Class Form1
'If curFile(0) = 1 Or curFile(0) = 2 Then Continue For 'IF ARCHIVE
'If curFile(1) = 1 Or curFile(1) = 2 Then Continue For
Debug.WriteLine("Searching... " & a)
res = ByteSearch(curFile.ToArray, finfil.ToArray)
If res > -1 Then MsgBox("FOUND! IN file #" & a & vbCrLf & "Offset: " & res) : Exit For
Dim fileResults = ByteSearchAll(curFile.ToArray, finfil.ToArray)
For Each res In fileResults
MsgBox("FOUND! IN file #" & a & vbCrLf & "Offset: " & res) : Exit For
Next
Next
@@ -485,20 +490,20 @@ Partial Class Form1
Private Sub ConvertContact_Click(sender As Object, e As EventArgs) Handles ExportContact.Click
Dim Japfiles = IO.Directory.GetFiles("D:\Games\PSX\Persona.2.Innocent.Sin\Export\1075_Battle_Contacts", "*_J").ToList
Dim Engfiles = IO.Directory.GetFiles("D:\Games\PSX\Persona.2.Innocent.Sin\Export\1075_Battle_Contacts", "*_E*").ToList
Dim OutPut_Dir = "D:\Games\PSX\Persona.2.Innocent.Sin\Export\1075_Battle_Contacts\Processing\Back\"
Dim Japfiles = IO.Directory.GetFiles("D:\Games\PSX\Persona 2 - Batsu (NTSC-J) [SLPS-02825]\Export\UnRLE\0864_Btl_CONTC\SRC\", "*_U").ToList
Dim Engfiles = IO.Directory.GetFiles("D:\Games\PSX\Persona 2 - Batsu (NTSC-J) [SLPS-02825]\Export\UnRLE\0864_Btl_CONTC\SRC\", "*_E").ToList
Dim OutPut_Dir = "D:\Games\PSX\Persona 2 - Batsu (NTSC-J) [SLPS-02825]\Export\UnRLE\0864_Btl_CONTC\"
Dim scr = New ScriptTools
Dim cnt = 0
For Each fil In Japfiles
Dim contact As String = scr.MakeExportFile(My.Computer.FileSystem.ReadAllBytes(fil), My.Computer.FileSystem.ReadAllBytes(Engfiles(Japfiles.IndexOf(fil))), cnt)
Dim contact As String = scr.MakeContactExportFile(My.Computer.FileSystem.ReadAllBytes(fil), My.Computer.FileSystem.ReadAllBytes(Engfiles(Japfiles.IndexOf(fil))), cnt)
Dim filename = OutPut_Dir & Path.GetFileName(fil) & "_exp.txt"
My.Computer.FileSystem.WriteAllText(filename, contact, False, Encoding.GetEncoding(1251))
My.Computer.FileSystem.WriteAllText(filename, contact, False)
Next
@@ -508,9 +513,9 @@ Partial Class Form1
Private Sub Summon_Export_Click(sender As Object, e As EventArgs) Handles Summon_Export.Click
Dim Japfiles = IO.Directory.GetFiles("D:\Games\PSX\Persona.2.Innocent.Sin\Export\0077_Summon_Text", "*_U").ToList
Dim Engfiles = IO.Directory.GetFiles("D:\Games\PSX\Persona.2.Innocent.Sin\Export\0077_Summon_Text", "*_E*").ToList
Dim OutPut_Dir = "D:\Games\PSX\Persona.2.Innocent.Sin\Export\0077_Summon_Text\Processing\Back\"
Dim Japfiles = IO.Directory.GetFiles("D:\Games\PSX\Persona 2 - Batsu (NTSC-J) [SLPS-02825]\Export\UnRLE\0035_SUMMON_MSGS", "*_U").ToList
Dim Engfiles = IO.Directory.GetFiles("D:\Games\PSX\Persona 2 - Batsu (NTSC-J) [SLPS-02825]\Export\UnRLE\0035_SUMMON_MSGS", "*_E").ToList
Dim OutPut_Dir = "D:\Games\PSX\Persona 2 - Batsu (NTSC-J) [SLPS-02825]\Export\UnRLE\0035_SUMMON_MSGS\Processing\"
Dim scr = New ScriptTools
Dim cnt = 0
@@ -519,9 +524,10 @@ Partial Class Form1
Dim contact As String = scr.MakeSummonExport(My.Computer.FileSystem.ReadAllBytes(fil), My.Computer.FileSystem.ReadAllBytes(Engfiles(Japfiles.IndexOf(fil))), cnt)
Dim filename = OutPut_Dir & Path.GetFileName(fil) & "_exp.txt"
Dim filename = OutPut_Dir & Path.GetFileName(fil) & "_CONV.txt"
My.Computer.FileSystem.WriteAllText(filename, contact, False, Encoding.GetEncoding(1251))
My.Computer.FileSystem.WriteAllText(filename, contact, False)
cnt += 1
Next

View File

@@ -32,10 +32,11 @@ Partial Class CityEditor
Me.DataGridView1 = New System.Windows.Forms.DataGridView()
Me.EngTitle = New System.Windows.Forms.TextBox()
Me.SaveToISO = New System.Windows.Forms.Button()
Me.Button4 = New System.Windows.Forms.Button()
Me.ChrCount = New System.Windows.Forms.Label()
Me.AreaCount = New System.Windows.Forms.Label()
Me.Column1 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.SecondVariant = New System.Windows.Forms.CheckBox()
Me.X = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.Y = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.Column2 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.Column3 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.STAT_E = New System.Windows.Forms.DataGridViewTextBoxColumn()
@@ -90,7 +91,7 @@ Partial Class CityEditor
Me.DataGridView1.AllowUserToDeleteRows = False
Me.DataGridView1.AllowUserToResizeRows = False
Me.DataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.DataGridView1.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.Column1, Me.Column2, Me.Column3, Me.STAT_E})
Me.DataGridView1.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.X, Me.Y, Me.Column2, Me.Column3, Me.STAT_E})
DataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft
DataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Window
DataGridViewCellStyle1.Font = New System.Drawing.Font("Consolas", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
@@ -106,6 +107,7 @@ Partial Class CityEditor
Me.DataGridView1.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing
DataGridViewCellStyle2.Font = New System.Drawing.Font("Lucida Sans Typewriter", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.DataGridView1.RowsDefaultCellStyle = DataGridViewCellStyle2
Me.DataGridView1.RowTemplate.DefaultCellStyle.Font = New System.Drawing.Font("Lucida Sans Typewriter", 14.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.DataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect
Me.DataGridView1.Size = New System.Drawing.Size(593, 675)
Me.DataGridView1.TabIndex = 4
@@ -126,15 +128,6 @@ Partial Class CityEditor
Me.SaveToISO.Text = "SaveToUSERISO"
Me.SaveToISO.UseVisualStyleBackColor = True
'
'Button4
'
Me.Button4.Location = New System.Drawing.Point(208, 783)
Me.Button4.Name = "Button4"
Me.Button4.Size = New System.Drawing.Size(115, 23)
Me.Button4.TabIndex = 6
Me.Button4.Text = "UpdateFileTable??"
Me.Button4.UseVisualStyleBackColor = True
'
'ChrCount
'
Me.ChrCount.AutoSize = True
@@ -155,12 +148,31 @@ Partial Class CityEditor
Me.AreaCount.TabIndex = 8
Me.AreaCount.Text = "0"
'
'Column1
'SecondVariant
'
Me.Column1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill
Me.Column1.FillWeight = 35.0!
Me.Column1.HeaderText = "COORDS"
Me.Column1.Name = "Column1"
Me.SecondVariant.Appearance = System.Windows.Forms.Appearance.Button
Me.SecondVariant.AutoSize = True
Me.SecondVariant.Location = New System.Drawing.Point(313, 57)
Me.SecondVariant.Name = "SecondVariant"
Me.SecondVariant.Size = New System.Drawing.Size(90, 23)
Me.SecondVariant.TabIndex = 12
Me.SecondVariant.Text = "Second Variant"
Me.SecondVariant.TextAlign = System.Drawing.ContentAlignment.MiddleRight
Me.SecondVariant.UseVisualStyleBackColor = True
'
'X
'
Me.X.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill
Me.X.FillWeight = 25.0!
Me.X.HeaderText = "X"
Me.X.Name = "X"
'
'Y
'
Me.Y.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill
Me.Y.FillWeight = 25.0!
Me.Y.HeaderText = "Y"
Me.Y.Name = "Y"
'
'Column2
'
@@ -171,13 +183,14 @@ Partial Class CityEditor
'Column3
'
Me.Column3.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill
Me.Column3.FillWeight = 69.38334!
Me.Column3.HeaderText = "ENG_TEXT"
Me.Column3.Name = "Column3"
'
'STAT_E
'
Me.STAT_E.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill
Me.STAT_E.FillWeight = 35.0!
Me.STAT_E.FillWeight = 24.28417!
Me.STAT_E.HeaderText = "COORDS_E"
Me.STAT_E.Name = "STAT_E"
'
@@ -186,9 +199,9 @@ Partial Class CityEditor
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(608, 818)
Me.Controls.Add(Me.SecondVariant)
Me.Controls.Add(Me.AreaCount)
Me.Controls.Add(Me.ChrCount)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.SaveToISO)
Me.Controls.Add(Me.DataGridView1)
Me.Controls.Add(Me.Button2)
@@ -217,10 +230,11 @@ Partial Class CityEditor
Friend WithEvents DataGridView1 As DataGridView
Friend WithEvents EngTitle As TextBox
Friend WithEvents SaveToISO As Button
Friend WithEvents Button4 As Button
Friend WithEvents ChrCount As Label
Friend WithEvents AreaCount As Label
Friend WithEvents Column1 As DataGridViewTextBoxColumn
Friend WithEvents SecondVariant As CheckBox
Friend WithEvents X As DataGridViewTextBoxColumn
Friend WithEvents Y As DataGridViewTextBoxColumn
Friend WithEvents Column2 As DataGridViewTextBoxColumn
Friend WithEvents Column3 As DataGridViewTextBoxColumn
Friend WithEvents STAT_E As DataGridViewTextBoxColumn

View File

@@ -117,7 +117,10 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="X.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Y.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

View File

@@ -1,4 +1,6 @@
Public Class CityEditor
Imports System.Windows.Forms.VisualStyles.VisualStyleElement.TextBox
Public Class CityEditor
Public files1 As List(Of fileInfo)
Public files2 As List(Of fileInfo)
@@ -20,6 +22,10 @@
LoadDistrict()
End Sub
Private Sub SecondVariant_CheckedChanged(sender As Object, e As EventArgs) Handles SecondVariant.CheckedChanged
LoadDistrict()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If ID.Text = 713 Then
ID.Text = 719
@@ -27,7 +33,6 @@
ID.Text -= 1
End If
LoadDistrict()
End Sub
@@ -38,7 +43,6 @@
ID.Text += 1
End If
LoadDistrict()
End Sub
@@ -48,60 +52,44 @@
Dim cd = New ISOTools
Dim rle = New rleTools
Form1.DeconstructFile(cd.getCDfile(Form1.UserPath.Text, files1(ID.Text).Sector, files1(ID.Text).Sizw).ToArray) 'here is separated binfile
CurFile = Form1.binFile(Form1.binFile.Count - 2) 'Get Before Last File
CurFileUnrle = CurFile.Bytes.ToArray
CurFile = Form1.binFile(Form1.binFile.Count - 3 + Convert.ToInt32(SecondVariant.Checked)) 'Get Before Last File
CurFileUnrle = rle.UnrleNocompr(CurFile.Bytes).ToArray
Form1.DeconstructFile(cd.getCDfile(Form1.EngISOPath.Text, files2(ID.Text).Sector, files2(ID.Text).Sizw).ToArray) 'here is separated binfile
EngFile = Form1.binFile(Form1.binFile.Count - 2) 'Get Before Last File
EngFileUnrle = EngFile.Bytes.ToArray
EngFile = Form1.binFile(Form1.binFile.Count - 3 + Convert.ToInt32(SecondVariant.Checked)) 'Get Before Last File
EngFileUnrle = rle.UnrleNocompr(EngFile.Bytes).ToArray
'Dim curfile As rleFile = binFile(8)
Dim JapBlock1Len = CurFileUnrle(0)
Dim JapBlock2Len = CurFileUnrle(1)
Dim JapBlockLines = CurFileUnrle(2)
Dim EnBlock1Len = EngFileUnrle(0)
Dim EnBlock2Len = EngFileUnrle(1)
Dim EnBlockLines = EngFileUnrle(2)
Dim JapBlock1Len = CurFileUnrle(8)
Dim JapBlock2Len = CurFileUnrle(9)
Dim JapBlockLines = CurFileUnrle(10)
Dim EnBlock1Len = EngFileUnrle(8)
Dim EnBlock2Len = EngFileUnrle(9)
Dim EnBlockLines = EngFileUnrle(10)
Dim JapTextStart = JapBlock1Len * 16 + JapBlock2Len * 8 + 8 + 4 'header 8 + head 4 block
Dim EngTextStart = EnBlock1Len * 16 + EnBlock2Len * 8 + 8 + 4
Dim JapTextStart = JapBlock1Len * 16 + JapBlock2Len * 8 + 4 'header 8 + head 4 block
Dim EngTextStart = EnBlock1Len * 16 + EnBlock2Len * 8 + 4
Try
EngTitle.Text = readEngText(EngTextStart + 4) 'after coords...
UserTitle.Text = readRusText(JapTextStart + 4) 'after coords...
DataGridView1.Rows.Clear()
For a = 1 To JapBlockLines - 1
JapTextStart += 40
EngTextStart += 40 'Move to Next Block...
Dim jap_coords As String = BitConverter.ToInt16(CurFileUnrle, JapTextStart) & " x " & BitConverter.ToInt16(CurFileUnrle, JapTextStart + 2)
Dim jap_X As String = BitConverter.ToInt16(CurFileUnrle, JapTextStart)
Dim jap_Y As Integer = BitConverter.ToInt16(CurFileUnrle, JapTextStart + 2)
Dim japLoc = readRusText(JapTextStart + 4 + 14) ' aftercoords
Dim en_coords As String = BitConverter.ToInt16(CurFileUnrle, EngTextStart) & " x " & BitConverter.ToInt16(CurFileUnrle, EngTextStart + 2)
Dim enLoc = readEngText(JapTextStart + 4 + 14) ' aftercoords
DataGridView1.Rows.Add(jap_coords, japLoc, enLoc, en_coords)
DataGridView1.Rows.Add(jap_X, jap_Y, japLoc, enLoc, en_coords)
Next
'Do
' If pointer >= endByte Then Exit Do
' Dim status = BitConverter.ToInt16(CurFileUnrle, pointer)
' Dim statusE = EngFileUnrle(pointer)
' pointer += 2
' Dim engString = readEngText(pointer - 1)
' Dim rustext = readRusText(pointer)
' DataGridView1.Rows.Add(status, rustext, engString, statusE)
' pointer += 30
'Loop
Catch ex As Exception
MsgBox("Error reading this district. Try another variant.")
End Try
End Sub
@@ -166,86 +154,68 @@
Dim cd = New ISOTools
Dim rle = New rleTools
'Making title bytes
MakeSaveRussianString(UserTitle.Text, 24, 0)
'Dim curfile As rleFile = binFile(8)
Dim off As Int32 = BitConverter.ToInt32(CurFileUnrle, 104)
'Dim pointer As Int32 = BitConverter.ToInt32(CurFileUnrle, 104)
Dim endByte As Int32 = BitConverter.ToInt32(CurFileUnrle, 60)
Dim JapBlock1Len = CurFileUnrle(0)
Dim JapBlock2Len = CurFileUnrle(1)
Dim JapBlockLines = CurFileUnrle(2)
Dim JapTextStart = JapBlock1Len * 16 + JapBlock2Len * 8 + 4 'header 8 + head 4 block
MakeSaveRussianString(UserTitle.Text, 14, JapTextStart + 4)
CurFileUnrle(18) = 0
CurFileUnrle(19) = 10
For Each row In DataGridView1.Rows
CurFileUnrle(off) = row.Cells(0).Value
CurFileUnrle(off + 1) = 0
MakeSaveRussianString(Trim(row.Cells(1).Value), 30, off + 2)
off += 32
JapTextStart += 40
Dim xxx = Convert.ToInt16(row.Cells(0).Value)
Dim yyy = Convert.ToInt16(row.Cells(1).Value)
CurFileUnrle(JapTextStart) = BitConverter.GetBytes(xxx)(0)
CurFileUnrle(JapTextStart + 1) = BitConverter.GetBytes(xxx)(1)
CurFileUnrle(JapTextStart + 2) = BitConverter.GetBytes(yyy)(0)
CurFileUnrle(JapTextStart + 3) = BitConverter.GetBytes(yyy)(1)
Dim japLoc = readRusText(JapTextStart + 4 + 14)
MakeSaveRussianString(Trim(row.Cells(2).Value), 22, JapTextStart + 4 + 14)
Next
Form1.DeconstructFile(cd.getCDfile(Form1.UserPath.Text, files1(ID.Text).Sector, files1(ID.Text).Sizw).ToArray) 'here is separated binfile
Dim curfile = Form1.binFile(0)
Dim before = curfile.Bytes.Count
Form1.binFile(0).Bytes = rle.decodeRLEnew(CurFileUnrle, curfile).ToArray
Form1.binFile(0).BytesAfter = 0
Dim after = Form1.binFile(0).Bytes.Count
Form1.DeconstructFile(cd.getCDfile(Form1.UserPath.Text, files1(ID.Text).Sector, files1(ID.Text).Sizw).ToArray) 'Deconstruct again!
Form1.binFile(Form1.binFile.Count - 3 + Convert.ToInt32(SecondVariant.Checked)).Bytes = rle.attachNoCompressionHeader(CurFile, CurFileUnrle).ToArray
'Packing
Dim finalPack = New List(Of Byte)
For Each bin In Form1.binFile
finalPack.AddRange(bin.Bytes)
'AddingBytesAfter
For g = 0 To bin.BytesAfter - 1
'Adding SectorGaps (ONLY FOR CITY DISTRICTS!!!!!!!)
Dim gap = 2048 - (finalPack.Count Mod 2048)
For g = 0 To gap - 1
finalPack.Add(0)
Next
Next
If finalPack.Count Mod 2048 > 0 Then
For g = 1 To (2048 - (finalPack.Count Mod 2048))
finalPack.Add(0)
Next g
End If
Dim beforePackSize As Integer = cd.getCDfile(Form1.UserPath.Text, files1(ID.Text).Sector, files1(ID.Text).Sizw).Count
Dim beforeSize As Integer = files1(ID.Text).Sizw
If finalPack.Count <= files1(ID.Text).Sizw Then
If finalPack.Count = beforePackSize Then
'If sizw matched
cd.saveCDfile(Form1.UserPath.Text, files1(ID.Text).Sector, finalPack.Count, finalPack.ToArray)
MsgBox("Succesfully Saved!" & vbCrLf & "Bofore: " & before & vbCrLf & "Afta: " & after & vbCrLf & after - before & "b.")
Exit Sub
End If
If MsgBox("finalPack is Bigger than source :(" &
vbCrLf & "Bofore: " & before & vbCrLf & "Afta: " & after & vbCrLf & after - before & "b." &
vbCrLf & "Do you wanna save it to file?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
If Form1.SaveFileDialog1.ShowDialog <> DialogResult.OK Then Exit Sub
ElseIf MsgBox($"finalPack is not match source :( {vbCrLf} Source size {beforePackSize}{vbCrLf} Final Pack Size {finalPack.Count} {vbCrLf} Wanna save it to a file for inspect?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
My.Computer.FileSystem.WriteAllBytes(Form1.SaveFileDialog1.FileName, finalPack.ToArray, False)
End If
'My.Computer.FileSystem.WriteAllBytes("D:\Games\PSX\Persona.2.Innocent.Sin\Export\UnRLE\0097\EDITOR_TEST", CurFileUnrle, False)
End Sub
Public Sub MakeSaveRussianString(ByVal str As String, ByVal maxBytes As Integer, ByVal offs As String)
Dim a = New List(Of Byte)
If str = "0010" Then
For x = 0 To maxBytes - 1 Step 2
CurFileUnrle(offs + x) = 0
CurFileUnrle(offs + x + 1) = &H10
For zzz = 0 To maxBytes - 1 Step 2
CurFileUnrle(offs + zzz) = 0
CurFileUnrle(offs + zzz + 1) = &H10
Next
Exit Sub
@@ -254,15 +224,19 @@
a.Add(str.Length)
a.Add(&H20)
For x = 0 To str.Length - 1
a.Add(Asc(str(x)))
For zzz = 0 To str.Length - 1
a.Add(Asc(str(zzz)))
Next
For x = 0 To maxBytes - str.Length - 3
' a.Add(0)
' a.Add(&H10)
For zzz = 0 To maxBytes - str.Length - 3
a.Add(0)
Next
For x = 0 To maxBytes - 1
CurFileUnrle(x + offs) = a(x)
For zzz = 0 To maxBytes - 1
CurFileUnrle(zzz + offs) = a(zzz)
Next
End Sub
End Class

View File

@@ -23,6 +23,7 @@ Partial Class DungeonEditor
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Dim DataGridViewCellStyle1 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Dim DataGridViewCellStyle3 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Dim DataGridViewCellStyle2 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Me.ID = New System.Windows.Forms.TextBox()
Me.Label1 = New System.Windows.Forms.Label()
@@ -30,15 +31,15 @@ Partial Class DungeonEditor
Me.Button1 = New System.Windows.Forms.Button()
Me.Button2 = New System.Windows.Forms.Button()
Me.DataGridView1 = New System.Windows.Forms.DataGridView()
Me.Column1 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.Column2 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.Column3 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.STAT_E = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.EngTitle = New System.Windows.Forms.TextBox()
Me.SaveToISO = New System.Windows.Forms.Button()
Me.Button4 = New System.Windows.Forms.Button()
Me.ChrCount = New System.Windows.Forms.Label()
Me.AreaCount = New System.Windows.Forms.Label()
Me.Column1 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.Column2 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.Column3 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.STAT_E = New System.Windows.Forms.DataGridViewTextBoxColumn()
CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
@@ -89,53 +90,28 @@ Partial Class DungeonEditor
Me.DataGridView1.AllowUserToAddRows = False
Me.DataGridView1.AllowUserToDeleteRows = False
Me.DataGridView1.AllowUserToResizeRows = False
DataGridViewCellStyle1.Font = New System.Drawing.Font("Roboto Mono", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
Me.DataGridView1.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle1
Me.DataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.DataGridView1.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.Column1, Me.Column2, Me.Column3, Me.STAT_E})
DataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft
DataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Window
DataGridViewCellStyle1.Font = New System.Drawing.Font("Consolas", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
DataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.ControlText
DataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight
DataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText
DataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.[False]
Me.DataGridView1.DefaultCellStyle = DataGridViewCellStyle1
DataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft
DataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window
DataGridViewCellStyle3.Font = New System.Drawing.Font("Roboto Mono", 11.0!)
DataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.ControlText
DataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight
DataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText
DataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.[False]
Me.DataGridView1.DefaultCellStyle = DataGridViewCellStyle3
Me.DataGridView1.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter
Me.DataGridView1.Location = New System.Drawing.Point(12, 85)
Me.DataGridView1.MultiSelect = False
Me.DataGridView1.Name = "DataGridView1"
Me.DataGridView1.RowHeadersVisible = False
Me.DataGridView1.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing
DataGridViewCellStyle2.Font = New System.Drawing.Font("Lucida Sans Typewriter", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.DataGridView1.RowsDefaultCellStyle = DataGridViewCellStyle2
Me.DataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect
Me.DataGridView1.Size = New System.Drawing.Size(484, 675)
Me.DataGridView1.TabIndex = 4
'
'Column1
'
Me.Column1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill
Me.Column1.FillWeight = 10.0!
Me.Column1.HeaderText = "STATUS"
Me.Column1.Name = "Column1"
'
'Column2
'
Me.Column2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill
Me.Column2.HeaderText = "USER_TEXT"
Me.Column2.Name = "Column2"
'
'Column3
'
Me.Column3.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill
Me.Column3.HeaderText = "ENG_TEXT"
Me.Column3.Name = "Column3"
'
'STAT_E
'
Me.STAT_E.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill
Me.STAT_E.FillWeight = 15.0!
Me.STAT_E.HeaderText = "STAT_E"
Me.STAT_E.Name = "STAT_E"
'
'EngTitle
'
Me.EngTitle.Location = New System.Drawing.Point(300, 59)
@@ -181,6 +157,34 @@ Partial Class DungeonEditor
Me.AreaCount.TabIndex = 8
Me.AreaCount.Text = "0"
'
'Column1
'
Me.Column1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill
Me.Column1.FillWeight = 10.0!
Me.Column1.HeaderText = "STATUS"
Me.Column1.Name = "Column1"
'
'Column2
'
Me.Column2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill
DataGridViewCellStyle2.ForeColor = System.Drawing.Color.Black
Me.Column2.DefaultCellStyle = DataGridViewCellStyle2
Me.Column2.HeaderText = "USER_TEXT"
Me.Column2.Name = "Column2"
'
'Column3
'
Me.Column3.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill
Me.Column3.HeaderText = "ENG_TEXT"
Me.Column3.Name = "Column3"
'
'STAT_E
'
Me.STAT_E.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill
Me.STAT_E.FillWeight = 15.0!
Me.STAT_E.HeaderText = "STAT_E"
Me.STAT_E.Name = "STAT_E"
'
'DungeonEditor
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@@ -218,10 +222,10 @@ Partial Class DungeonEditor
Friend WithEvents EngTitle As TextBox
Friend WithEvents SaveToISO As Button
Friend WithEvents Button4 As Button
Friend WithEvents ChrCount As Label
Friend WithEvents AreaCount As Label
Friend WithEvents Column1 As DataGridViewTextBoxColumn
Friend WithEvents Column2 As DataGridViewTextBoxColumn
Friend WithEvents Column3 As DataGridViewTextBoxColumn
Friend WithEvents STAT_E As DataGridViewTextBoxColumn
Friend WithEvents ChrCount As Label
Friend WithEvents AreaCount As Label
End Class

View File

@@ -89,9 +89,9 @@
'int16 + int16 - Map width and (Heigth / 2) in words, or normal minimap by 1 byte
'int32 - FFFF0000
'int32 - Flood id
'int32 - User minimap offset
'int32 - Floor objects geometry offset
'int32 - User normal map offset
'int32 - Objects geometry offset
'int32 - Collisions & scripts attach map
'int32 - Map & labels offset
'int32 - Some vars offset 1
'int32 - Some vars offset 2 (coords??)
'int32 - Some vars offset 3
@@ -101,6 +101,15 @@
'84 - DUNGEON MAIN MAP offset
'88 - Dungeon normal usermap offset
'script attach table
' - script parameter int8 - ID, int 4 - type/collision, int4 - anim type
' - idC8/idCC - block and run object script
' - xx28/xx28 - execute on step trigger
' - id2C - show and run character script
' - 00A0 - show text window
' - idB0 - take item (item table = 800c692c)
End Sub
Public Function readEngText(ByVal Curbt As Integer)
@@ -149,6 +158,7 @@
End Sub
Private Sub DataGridView1_CurrentCellChanged(sender As Object, e As EventArgs) Handles DataGridView1.CurrentCellChanged
If IsNothing(DataGridView1.CurrentCell) Then Exit Sub
If IsNothing(DataGridView1.CurrentCell.Value) Then Exit Sub
Dim a = DataGridView1.CurrentCell.Value.ToString.Length
AreaCount.Text = a
If a > 20 Then

View File

@@ -155,9 +155,9 @@
Next
My.Computer.FileSystem.WriteAllBytes(Form1.WorkDir.Text & "/0059_00_0_0_U", newFont.ToArray, False)
My.Computer.FileSystem.WriteAllBytes(Form1.WorkDir.Text & "/0013_00_0_0_U", newFont.ToArray, False)
MsgBox("OK to /Export/0059_00_0_0_U", MsgBoxStyle.Information)
MsgBox("OK to /Export/0013_00_0_0_U", MsgBoxStyle.Information)
End Sub

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,5 @@
Imports System
Imports System.Linq
Imports System.ComponentModel
Imports System.IO
Imports System.Net.Mime.MediaTypeNames
@@ -541,7 +542,7 @@ Public Class Form1
filename = ExportBinPath.Text & Strings.Left(FilnamLabel.Text, 4) & "_" & SelBinFiles.SelectedIndex.ToString("D2") & "_" & r.SectorID & "_" & r.ID
filename = ExportBinPath.Text & Strings.Left(FilnamLabel.Text, 4) & "_" & SelBinFiles.SelectedIndex.ToString("D3") & "_" & r.SectorID & "_" & r.ID
If japRadio.Checked Then filename &= "_J"
If EngRadio.Checked Or KudosBtn.Checked Then filename &= "_E"
@@ -593,10 +594,11 @@ Public Class Form1
Next
Dim ls As fileInfo = GetLastSector()
Dim sectorSize = If(ls.FileID < 866, 2048, 2336)
Dim freespace = FileLen(filnam) - (ls.Sector * &H930 + ls.Sizw)
LastSectorLbl.Text = "Last Sector: " & ls.Sector + ls.Sizw / 2048
LastSectorLbl.Text = "Last Sector: " & ls.Sector + ls.Sizw / sectorSize
CDFreeSpaceLabel.Text = Math.Round(freespace / 1024) & " Kbytes / " & Math.Round(freespace / &H930) & " sectors"
@@ -947,54 +949,78 @@ newtest:
End Sub
Private Function ByteSearch(ByVal searchIn As Byte(), ByVal searchBytes As Byte()) As Integer
Dim f As Integer
For i As Integer = 0 To searchIn.Length - searchBytes.Length
If Not searchIn(i) = searchBytes(0) Then Continue For
f = searchBytes.Length - 1
While f >= 1 AndAlso searchIn(i + f) = searchBytes(f)
f -= 1
End While
If f = 0 Then Return i
Private Function ByteSearchAll(ByVal searchIn As Byte(), ByVal searchBytes As Byte()) As Integer()
Dim results As New List(Of Integer)()
Dim searchLength = searchBytes.Length
For i As Integer = 0 To searchIn.Length - searchLength
Dim match As Boolean = True
For j As Integer = 0 To searchLength - 1
If searchIn(i + j) <> searchBytes(j) Then
match = False
Exit For
End If
Next
Return -1
If match Then
results.Add(i)
i += searchLength - 1
End If
Next
Return results.ToArray()
End Function
Private Sub SearchHexPattern_Click(sender As Object, e As EventArgs) Handles SearchHexPattern.Click
If HexPatternBox.Text.Length Mod 2 > 0 Then Exit Sub
HexPatternBox.Text = Replace(HexPatternBox.Text, " ", "")
Dim searchBytes = SoapHexBinary.Parse(HexPatternBox.Text).Value
If HexPatternBox.Text.Length Mod 2 > 0 Then Exit Sub
Dim searchBytes() As Byte
Try
searchBytes = SoapHexBinary.Parse(HexPatternBox.Text).Value
Catch ex As Exception
MsgBox("Error Parsing HEX string!", MsgBoxStyle.Critical)
Exit Sub
End Try
Dim Str = String.Join(",", searchBytes)
Debug.WriteLine($"Searching bytes {Str} ....")
Dim cd = New ISOTools
Dim exeFile = cd.getCDfile(getFilnam, 27, 1812408)
'search in exe
Dim res = ByteSearch(exeFile.ToArray, searchBytes)
If res > -1 Then MsgBox("FOUND! IN SLPS!" & vbCrLf & "Offset: " & res) : Exit Sub
'Dim found = ByteSearch(fil, searchBytes)
'If found > -1 Then MsgBox("FOUND! " & vbCrLf & "OFFSET = " & found)
Dim searchRes = New List(Of String)
Dim jsonRes = New List(Of String)
'all files to video
For a = 0 To CDFileList.Items.Count - 1
Dim curFile = cd.getCDfile(getFilnam, files1(a).Sector, files1(a).Sizw)
'If curFile(0) = 1 Or curFile(0) = 2 Then Continue For 'IF ARCHIVE
'If curFile(1) = 1 Or curFile(1) = 2 Then Continue For
Debug.WriteLine("Searching... " & a)
res = ByteSearch(curFile.ToArray, searchBytes)
If res > -1 Then searchRes.Add("#" & a & " Offset: " & res)
'search in exe
Dim exeResults = ByteSearchAll(exeFile.ToArray, searchBytes)
For Each res In exeResults
searchRes.Add("#0000 Offset: " & res)
jsonRes.Add("{""id"":0000,""offset"":" & res & "}")
Next
'search in files
For a = 0 To CDFileList.Items.Count - 1
Dim curFile = cd.getCDfile(getFilnam, files1(a).Sector, files1(a).Sizw)
Dim fileResults = ByteSearchAll(curFile.ToArray, searchBytes)
For Each res In fileResults
searchRes.Add("#" & a & " Offset: " & res)
jsonRes.Add("{""id"":" & a & ",""offset"":" & res & "}")
Next
Next
Debug.WriteLine($"Found {searchRes.Count} times")
If searchRes.Count Then
MsgBox("FOUND: " & vbCrLf & (Join(searchRes.ToArray, vbCrLf)))
Else
MsgBox("NOT FOUND")
If MsgBox("FOUND: " & vbCrLf & Join(searchRes.ToArray, vbCrLf) & vbCrLf & vbCrLf & "Wanna save JSON?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
SaveFileDialog1.FileName = "searchResult.json"
If SaveFileDialog1.ShowDialog <> DialogResult.OK Then Exit Sub
Dim fileText = "[" & Join(jsonRes.ToArray, ",") & "]"
My.Computer.FileSystem.WriteAllText(SaveFileDialog1.FileName, fileText, False)
End If
Else
MsgBox("Not found")
End If
'5374617475733A2048756D616E
End Sub
Private Sub SaveShadowDisc_Click(sender As Object, e As EventArgs) Handles SaveShadowDisc.Click
@@ -1037,10 +1063,11 @@ newtest:
Dim curFileIndexInPack As Integer = fileInfo(1)
Dim curFileSector As Integer = fileInfo(2)
Dim curFileRleID As Integer = fileInfo(3)
Debug.WriteLine("Importing... " & Path.GetFileNameWithoutExtension(filee))
Debug.WriteLine("Importing... " & Path.GetFileName(filee) & " | InPackIndex=" & curFileIndexInPack)
If curFilePack <> CDFileList.SelectedIndex Then MsgBox("Select File From CD and Proper file to import! IDs not equal!" & vbCrLf & filee, MsgBoxStyle.Critical) : Exit Sub
Dim fil = My.Computer.FileSystem.ReadAllBytes(filee)
Dim r = New rleTools
Dim curfile As rleFile = binFile(curFileIndexInPack)
'Need To RLE?
@@ -1049,23 +1076,15 @@ newtest:
If curfile.Compr = 0 Then
If ForceRle.Checked Then
If MsgBox("Warning! Source File Is not Compressed! Continue??", MsgBoxStyle.YesNo) <> MsgBoxResult.Yes Then Exit Sub
Dim r = New rleTools
endfil = r.decodeRLEnew(fil, curfile)
GoTo rleEnd
End If
'making fileHeaderForNonCompressed
endfil.Add(curfile.Type)
endfil.Add(0) 'No compression
endfil.Add(BitConverter.GetBytes(curfile.ID)(0)) 'Convert ID
endfil.Add(BitConverter.GetBytes(curfile.ID)(1))
endfil.Add(BitConverter.GetBytes(fil.Count + 8)(0)) 'FileSize
endfil.Add(BitConverter.GetBytes(fil.Count + 8)(1)) 'FileSize
endfil.Add(BitConverter.GetBytes(fil.Count + 8)(2)) 'FileSize
endfil.Add(BitConverter.GetBytes(fil.Count + 8)(3)) 'FileSize
endfil.AddRange(fil.ToList)
endfil = r.attachNoCompressionHeader(curfile, fil)
rleEnd:
'adding bytes to read MOD4
Dim addedBytes = endfil.Count Mod 4
If addedBytes > 0 Then addedBytes = 4 - addedBytes
@@ -1074,12 +1093,8 @@ rleEnd:
Next
Else
Dim r = New rleTools
endfil = r.decodeRLEnew(fil, curfile)
End If
@@ -1135,8 +1150,8 @@ rleEnd:
finalPack.Add(0)
Next
If CDFileList.SelectedIndex = 735 Or CDFileList.SelectedIndex = 90 Or CDFileList.SelectedIndex = 1075 Then
'dungeons & summon text & battle contacts
If CDFileList.SelectedIndex = 735 Or CDFileList.SelectedIndex = 35 Or CDFileList.SelectedIndex = 1075 Then
'checking crazy last 20 bytes on sector for file IN SUUMON AND DUNGEON TEXTS
Dim ffff = 2048 - (finalPack.Count Mod 2048)
If ffff <= 20 And ffff > 0 Then
@@ -1174,8 +1189,21 @@ rleEnd:
'Updating fileTable in externalCode for DUNGEON DIALOGS in 0736
MakePointersTable(addresses, files1(736).Sector, files1(736).Sizw, 110548)
'city import
Case 713
MakePointersTable(addresses, 200 + 27, 4096, &H300) '200 sector of main exe + exe start sector + 0x300 bytes offset
Case 714
MakePointersTable(addresses, 200 + 27, 4096, &H300 + 152)
Case 715
MakePointersTable(addresses, 200 + 27, 4096, &H300 + 320)
Case 716
MakePointersTable(addresses, 200 + 27, 4096, &H300 + 488)
Case 717
MakePointersTable(addresses, 200 + 27, 4096, &H300 + 696)
Case 718
MakePointersTable(addresses, 200 + 27, 4096, &H300 + 856)
Case 719
MakePointersTable(addresses, 200 + 27, 4096, &H300 + 1000)
'IS old pointers
'Case 4
' 'Updating fileTable in BattleCode for DIALOGS in 0004
@@ -1187,20 +1215,6 @@ rleEnd:
' Update0073SummonScriptTable(addresses) 'summon scripts table in 0073
' 'city import
'Case 1112
' 'Updating fileTable in mainEXE for DIALOGS in 1112
' MakePointersTable(addresses, 225, 4096, 1148) 'if 1112
'Case 1113
' MakePointersTable(addresses, 225, 4096, 1148 + 136) 'if 1113
'Case 1114
' MakePointersTable(addresses, 225, 4096, 1148 + 352)
'Case 1115
' MakePointersTable(addresses, 225, 4096, 1148 + 544)
'Case 1116
' MakePointersTable(addresses, 225, 4096, 1148 + 720)
'Case 1117
' MakePointersTable(addresses, 225, 4096, 1148 + 888)
'Case 1075
' UpdateBattleContactFileTable(addresses) 'Updating BattleContacts
End Select
@@ -1501,8 +1515,9 @@ rleEnd:
Private Sub getFreeSector_Click(sender As Object, e As EventArgs) Handles getFreeSector.Click
Dim a As fileInfo = GetLastSector()
Dim sectorSize = If(a.FileID > 865, 2336, 2048) 'Video or not
importSector.Text = a.Sector + a.Sizw \ 2048 + 10
importSector.Text = a.Sector + a.Sizw \ sectorSize + 10
End Sub
@@ -1714,7 +1729,7 @@ rleEnd:
Dim curFileIndexInPack As Integer = fileInfo(1)
Dim curFileSector As Integer = fileInfo(2)
Dim curFileRleID As Integer = fileInfo(3)
Debug.WriteLine("Importing... " & Path.GetFileNameWithoutExtension(filee))
Debug.WriteLine("Importing... " & Path.GetFileName(filee))
If curFilePack <> CDFileList.SelectedIndex Then MsgBox("Select File From CD and Proper file to import! IDs not equal!" & vbCrLf & filee, MsgBoxStyle.Critical) : Exit Sub
@@ -1805,9 +1820,9 @@ rleEnd:
'UPDATING FILES TABLES
Select Case CDFileList.SelectedIndex
Case 682
'TITLE SCREENS IMPORT
MakePointersTable(addresses, files1(681).Sector, files1(681).Sizw, 50392)
'Case 682
' 'TITLE SCREENS IMPORT
' MakePointersTable(addresses, files1(681).Sector, files1(681).Sizw, 50392)
@@ -1832,51 +1847,81 @@ rleEnd:
MsgBox(String.Format("Imported {0} images in {1} - {2} bytes", UBound(OpenFileDialog1.FileNames) + 1, CDFileList.SelectedIndex, finalPack.Count), MsgBoxStyle.Exclamation)
End Sub
Private Sub BackgroundWorker1_ProgressChanged(sender As Object, e As ProgressChangedEventArgs) Handles BackgroundWorker1.ProgressChanged
End Sub
Private Sub TitlesLoad_Click(sender As Object, e As EventArgs) Handles TitlesLoad.Click
Dim iso = New ISOTools
Dim fil = iso.getCDfile(UserPath.Text, files1(1126).Sector, files1(1126).Sizw)
Dim reader As Integer = 13804
Dim lastByte = 16253
Dim fil = iso.getCDfile(UserPath.Text, files1(728).Sector, files1(728).Sizw).ToArray
Dim dataStart = 11188
Dim lastByte = 15708
TGrid.Rows.Clear()
Dim offsetTable = New List(Of Integer)
For a = 1 To BitConverter.ToInt32(fil, dataStart)
offsetTable.Add(BitConverter.ToInt32(fil, dataStart + a * 4) - 8)
Next
For Each offset In offsetTable
Dim reader = offset + dataStart
Dim accum = ""
Do
Select Case fil(reader)
Dim b = fil(reader)
Select Case b
Case 128
TGrid.Rows.Add(accum)
accum = ""
GoTo Endd
Exit Do
Case 129
accum &= " "
GoTo Endd
Case > 127
accum &= "[C=" & fil(reader) - 128 & "]"
GoTo Endd
Case <= 26
accum &= Chr(fil(reader) + 64)
GoTo Endd
Case <= 52
accum &= Chr(fil(reader) + 70)
Case 59
TGrid.Rows.Add("------")
Case Else
accum &= "[B=" & fil(reader) & "]"
End Select
Endd:
reader += 1
Loop While TGrid.Rows.Count < 172
Loop While fil(reader) <> 128
TGrid.Rows.Add(accum)
Next
' Do
' Select Case fil(reader)
' Case 128
' TGrid.Rows.Add(accum)
' accum = ""
' GoTo Endd
' Case 129
' accum &= " "
' GoTo Endd
' Case > 127
' accum &= "[C=" & fil(reader) - 128 & "]"
' GoTo Endd
' Case <= 26
' accum &= Chr(fil(reader) + 64)
' GoTo Endd
' Case <= 52
' accum &= Chr(fil(reader) + 70)
' Case 59
' TGrid.Rows.Add("------")
' Case Else
' accum &= "[B=" & fil(reader) & "]"
' End Select
'Endd:
' reader += 1
' Loop While TGrid.Rows.Count < 172
' 'TGrid.Rows.Add(accum)
End Sub
@@ -1977,7 +2022,7 @@ Endd:
For Each f In filesSorted
If f.FileID >= 865 And f.FileID <= 879 Then SectorType = 2352 Else SectorType = 2048
If f.FileID >= 865 And f.FileID <= 880 Then SectorType = 2336 Else SectorType = 2048
Dim sectSize As Integer = f.Sizw \ SectorType
Dim sizeadd = ""
@@ -2095,6 +2140,7 @@ Endd:
s.ParseScript(OpenFileDialog1.FileName)
End Sub
End Class

View File

@@ -82,10 +82,12 @@ Public Class ISOTools
Else ''''''''''READ RAW FILE WITH 2352 MODE!
'Todo - 2336 Mode Write
br.BaseStream.Position = StartSector * &H930
br.Write(bytes, 0, FileSize)
'br.BaseStream.Position = StartSector * &H930
'br.Write(bytes, 0, FileSize)
End If

View File

@@ -1,6 +1,7 @@
Imports System.IO
Imports System.Text
Imports System.Runtime.Remoting.Metadata.W3cXsd2001
Imports System.Diagnostics.Eventing
Public Class ScriptTools
@@ -160,6 +161,7 @@ Public Class ScriptTools
ScriptCodes.Add(New CodeObject With {.code = &H87, .value = "_getMney"})
ScriptCodes.Add(New CodeObject With {.code = &H91, .value = "IncMoney", .descr = "32bit signed"})
ScriptCodes.Add(New CodeObject With {.code = &H92, .value = "ScrnFade"})
@@ -172,10 +174,14 @@ Public Class ScriptTools
ScriptCodes.Add(New CodeObject With {.code = &HC3, .value = "SoundPly", .descr = "ID, Vol"})
ScriptCodes.Add(New CodeObject With {.code = &HD0, .value = "collLink", .descr = "Sub | bits | 1-act,2-touch | type | collId"})
ScriptCodes.Add(New CodeObject With {.code = &HD4, .value = "meshMove"})
ScriptCodes.Add(New CodeObject With {.code = &HD5, .value = "meshTurn"})
ScriptCodes.Add(New CodeObject With {.code = &HD6, .value = "meshWait"})
ScriptCodes.Add(New CodeObject With {.code = &HD6, .value = "meshHide", .descr = "objID"})
ScriptCodes.Add(New CodeObject With {.code = &HDC, .value = "FXSpLoad"})
ScriptCodes.Add(New CodeObject With {.code = &HDD, .value = "FXSprSet"})
@@ -939,8 +945,7 @@ endlineTest:
Public Function MakeExportFile(ByRef JFile As Byte(), ByRef EFile As Byte(), ByRef cnt As Integer)
Public Function MakeContactExportFile(ByRef JFile As Byte(), ByRef EFile As Byte(), ByRef cnt As Integer)
Dim retString = ""
Dim japPointers = New List(Of Integer)
Dim engPointers = New List(Of Integer)
@@ -948,103 +953,90 @@ endlineTest:
Dim EPointersPointer = BitConverter.ToUInt16(EFile, 4)
Dim JTextPointer = BitConverter.ToUInt16(JFile, 6)
Dim ETextPointer = BitConverter.ToUInt16(EFile, 6)
Dim fileHeader = New List(Of Byte)
Dim fileHeader = New List(Of Integer)
Dim engText = New List(Of String)
Dim japText = New List(Of String)
'Dim StrCount = (JTextPointer - JPointersPointer) / 2
'reading pointers
Dim pointersReader As Integer = JPointersPointer
For a = JPointersPointer To JTextPointer - 1 Step 2 : japPointers.Add(BitConverter.ToUInt16(JFile, a)) : Next a
For a = EPointersPointer To ETextPointer - 1 Step 2 : engPointers.Add(BitConverter.ToUInt16(EFile, a)) : Next a
'FormFileHeader
For a = 0 To ETextPointer - 1 : fileHeader.Add(JFile(a)) : Next
For a = 0 To JTextPointer - 1 Step 4 : fileHeader.Add(BitConverter.ToInt32(JFile, a)) : Next
'reading eng String
For a = 0 To engPointers.Count - 1
Dim accum = "\\"
'Pointer2PointerReading System
Dim reader As Integer = ETextPointer + engPointers(a)
Do
'If reader >= lastbyte Then Exit Do
Dim s = EFile(reader)
'If reader + 3 < EFile.Count - 1 Then
'If s = 6 And EFile(reader + 1) = 2 And EFile(reader + 2) = 3 Then Exit Do
If s = 8 Then accum &= "[sel=" & EFile(reader + 1) & "]" : reader += 2 : Continue Do
If s = 3 Then Exit Do
'End If
If s = 29 Then accum &= "[c=" & EFile(reader + 1) & "]" : reader += 2 : Continue Do
If s = 14 Then accum &= "[0e=" & EFile(reader + 1) & "]" : reader += 2 : Continue Do
If s = 30 Then accum &= "[1e=" & EFile(reader + 1) & "]" : reader += 2 : Continue Do
If s = 1 Then accum &= vbCrLf & "\\" : reader += 1 : Continue Do
If s < 32 Then
accum &= "[" & s & "]"
Else
accum &= Chr(s)
End If
reader += 1
Loop While reader < UBound(EFile)
Dim accum = ParseContactWindow(EFile, ETextPointer + engPointers(a), True)
engText.Add(accum)
Next
'reading jap String
For a = 0 To japPointers.Count - 1
Dim accum = ParseContactWindow(JFile, JTextPointer + japPointers(a), False)
japText.Add(accum)
Next
'writing header
For Each b In fileHeader
retString &= $"[" & b.ToString("X4") & "]"
Next
retString = retString.Substring(0, retString.Length - 1) & vbCrLf
For a = 0 To japPointers.Count - 1
retString &= engText(a) & vbCrLf
retString &= $"[{a}]" & vbCrLf
retString &= japText(a) & vbCrLf
cnt += 1
Next
Return retString
End Function
Public Function ParseContactWindow(ByRef f As Byte(), ByVal offset As Integer, ByVal isCommented As Boolean)
Dim accum = ""
'Pointer2PointerReading System
Dim lastbyte As Integer = 0
'If a = japPointers.Count - 1 Then
' lastbyte = JFile.ToList.Count - 1
'Else
' lastbyte = japPointers(a + 1) + JTextPointer
'End If
Dim reader As Integer = JTextPointer + japPointers(a)
Dim reader = offset
Do
'Dim s = JFile(reader)
Dim chrr = BitConverter.ToUInt16(JFile, reader) 'Reading 2 Bytes!
Dim chrr = BitConverter.ToUInt16(f, reader) 'Reading 2 Bytes!
If chrr = &H96E Then accum &= "[man]" : reader += 2 : Continue Do
If chrr = &H96F Then accum &= "[woman]" : reader += 2 : Continue Do
'english string
If chrr = &H1136 Then
reader += 2
Dim b = f(reader)
Do
accum &= Chr(b)
reader += 1
b = f(reader)
Loop While b <> 0
reader += 1
If reader And 1 Then reader += 1
Continue Do
End If
If chrr And &H1000 Then
'If reader + 7 <= UBound(JFile) - 1 Then
' If chrr = &H1101 And BitConverter.ToUInt16(JFile, reader + 2) = &H1106 And
' BitConverter.ToUInt16(JFile, reader + 4) = &H1101 And
' BitConverter.ToUInt16(JFile, reader + 6) = &H1103 Then accum &= "[END]" : Exit Do
'End If
'If reader + 5 <= lastbyte Then
' If chrr = &H1106 And BitConverter.ToUInt16(JFile, reader + 2) = &H1102 And
' BitConverter.ToUInt16(JFile, reader + 4) = &H1103 Then accum &= "[END623]" : Exit Do
'End If
If chrr = &H1103 Then accum &= "[0311]" : reader += 2 : Exit Do
If chrr = &H1205 Then accum &= "[p=" & BitConverter.ToUInt16(JFile, reader + 2) & "]" : reader += 4 : Continue Do
If chrr = &H120E Then accum &= "[0e=" & BitConverter.ToUInt16(JFile, reader + 2) & "]" : reader += 4 : Continue Do
If chrr = &H121E Then accum &= "[1e=" & BitConverter.ToUInt16(JFile, reader + 2) & "]" : reader += 4 : Continue Do
If chrr = &H121D Then accum &= "[c=" & BitConverter.ToUInt16(JFile, reader + 2) & "]" : reader += 4 : Continue Do
If chrr = &H1205 Then accum &= "[p=" & BitConverter.ToUInt16(f, reader + 2) & "]" : reader += 4 : Continue Do
If chrr = &H120E Then accum &= "[0e=" & BitConverter.ToUInt16(f, reader + 2) & "]" : reader += 4 : Continue Do
If chrr = &H121E Then accum &= "[1e=" & BitConverter.ToUInt16(f, reader + 2) & "]" : reader += 4 : Continue Do
If chrr = &H121D Then accum &= "[c=" & BitConverter.ToUInt16(f, reader + 2) & "]" : reader += 4 : Continue Do
If chrr = &H1101 Then accum &= vbCrLf : reader += 2 : Continue Do
If chrr = &H1120 Then accum &= vbTab : reader += 2 : Continue Do
If chrr = &H1121 Then accum &= vbTab : reader += 2 : Continue Do
If chrr = &H1131 Then accum &= vbTab : reader += 2 : Continue Do
Dim c1 = JFile(reader) : Dim c2 = JFile(reader + 1)
Dim c1 = f(reader) : Dim c2 = f(reader + 1)
Dim gg = c2 And 15
For byteskip = 1 To gg
accum &= "[" & c1.ToString("X2") & c2.ToString("X2") & "]"
reader += 2
c1 = JFile(reader) : c2 = JFile(reader + 1)
c1 = f(reader) : c2 = f(reader + 1)
Next
Continue Do
@@ -1054,38 +1046,21 @@ endlineTest:
Dim aaa = SpecialCodes.Find(Function(q) q.code = chrr)
If IsNothing(aaa) Then
chrr = chrr And 255 : If chrr < 32 Then chrr += 32
accum &= Chr(chrr)
accum &= Form1.chars(chrr)
Else
accum &= "[" & aaa.value & "]" 'Если есть специальный код
End If
reader += 2
Loop While reader < UBound(JFile)
For Each nm In Names
accum = accum.Replace(nm.Codes, nm.Dehash)
Next
Loop While reader < UBound(f)
japText.Add(accum)
Next
If isCommented Then
accum = "\\ " & accum
accum = Replace(accum, vbCrLf, vbCrLf & "\\ ")
End If
Return accum
For Each b In fileHeader
retString &= b & ","
Next
retString = retString.Substring(0, retString.Length - 1) & vbCrLf
For a = 0 To japPointers.Count - 1
retString &= "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" & vbCrLf
retString &= engText(a) & vbCrLf
retString &= "[" & a & "]" & vbCrLf
retString &= japText(a) & vbCrLf
cnt += 1
Next
Return retString
End Function
@@ -1280,133 +1255,58 @@ endlineTest:
Public Function MakeSummonExport(ByRef JFile As Byte(), ByRef EFile As Byte(), ByRef cnt As Integer)
Dim retString = ""
Dim engText = New List(Of String)
Dim japText = New List(Of String)
'Dim StrCount = (JTextPointer - JPointersPointer) / 2
'reading pointers
Dim accum = "\\"
'Pointer2PointerReading System
Dim reader As Integer = 0
Do
'If reader >= lastbyte Then Exit Do
Dim s = EFile(reader)
'If reader + 3 < EFile.Count - 1 Then
'If s = 6 And EFile(reader + 1) = 2 And EFile(reader + 2) = 3 Then Exit Do
If s = 8 Then accum &= "[sel=" & EFile(reader + 1) & "]" : reader += 2 : Continue Do
If s = 3 Then Exit Do
'End If
If s = 29 Then accum &= "[c=" & EFile(reader + 1) & "]" : reader += 2 : Continue Do
If s = 14 Then accum &= "[0e=" & EFile(reader + 1) & "]" : reader += 2 : Continue Do
If s = 30 Then accum &= "[1e=" & EFile(reader + 1) & "]" : reader += 2 : Continue Do
If s = 1 Then accum &= vbCrLf & "\\" : reader += 1 : Continue Do
If s < 32 Then
accum &= "[" & s & "]"
Else
accum &= Chr(s)
End If
reader += 1
Loop While reader < UBound(EFile)
engText.Add(accum)
'reading jap String
accum = ""
'Pointer2PointerReading System
Dim lastbyte As Integer = 0
'If a = japPointers.Count - 1 Then
' lastbyte = JFile.ToList.Count - 1
'Else
' lastbyte = japPointers(a + 1) + JTextPointer
'End If
reader = 0
Do
'Dim s = JFile(reader)
Dim chrr = BitConverter.ToUInt16(JFile, reader) 'Reading 2 Bytes!
If chrr = &H96E Then accum &= "[man]" : reader += 2 : Continue Do
If chrr = &H96F Then accum &= "[woman]" : reader += 2 : Continue Do
If chrr And &H1000 Then
If chrr = &H1103 Then accum &= "[311]" : reader += 2 : Exit Do
If chrr = &H1205 Then accum &= "[p=" & BitConverter.ToUInt16(JFile, reader + 2) & "]" : reader += 4 : Continue Do
If chrr = &H120E Then accum &= "[0e=" & BitConverter.ToUInt16(JFile, reader + 2) & "]" : reader += 4 : Continue Do
If chrr = &H121E Then accum &= "[1e=" & BitConverter.ToUInt16(JFile, reader + 2) & "]" : reader += 4 : Continue Do
If chrr = &H121D Then accum &= "[c=" & BitConverter.ToUInt16(JFile, reader + 2) & "]" : reader += 4 : Continue Do
If chrr = &H1101 Then accum &= vbCrLf : reader += 2 : Continue Do
If chrr = &H1120 Then accum &= vbTab : reader += 2 : Continue Do
If chrr = &H1121 Then accum &= vbTab : reader += 2 : Continue Do
Dim c1 = JFile(reader) : Dim c2 = JFile(reader + 1)
Dim gg = c2 And 15
For byteskip = 1 To gg
accum &= "[" & c1.ToString("X2") & c2.ToString("X2") & "]"
reader += 2
c1 = JFile(reader) : c2 = JFile(reader + 1)
Next
Continue Do
End If
Dim aaa = SpecialCodes.Find(Function(q) q.code = chrr)
If IsNothing(aaa) Then
chrr = chrr And 255 : If chrr < 32 Then chrr += 32
accum &= Chr(chrr)
Else
accum &= "[" & aaa.value & "]" 'Если есть специальный код
End If
reader += 2
Loop While reader < UBound(JFile)
For Each nm In Names
accum = accum.Replace(nm.Codes, nm.Dehash)
Next
japText.Add(accum)
' retString = retString.Substring(0, retString.Length - 1) & vbCrLf
retString &= "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" & vbCrLf
retString &= engText(0) & vbCrLf
retString &= "[0]" & vbCrLf
retString &= japText(0) & vbCrLf
cnt += 1
Replace(retString, "[0611][0211][311]", "[END623]")
Return retString
Return makeSummonUniversalLine(EFile, True) & vbCrLf & makeSummonUniversalLine(JFile, False)
End Function
Public Function makeSummonUniversalLine(ByVal inputBytes As Byte(), commented As Boolean)
Dim reader As Integer = 0
Dim str = If(commented, "// ", "")
Do While reader < UBound(inputBytes)
Dim code = BitConverter.ToInt16(inputBytes, reader)
reader += 2
If code = &H1136 Then
'reading english text
Do
Dim ch = inputBytes(reader)
If ch = 0 Then reader += 1 : Exit Do
str &= Chr(ch)
reader += 1
Loop
If reader And 1 Then reader += 1
Continue Do
End If
If code And &H1000 Then
If code = &H1101 Then str &= vbCrLf & If(commented, "// ", "") : Continue Do
If code = &H1131 Then str &= vbTab : Continue Do
Dim hex = code.ToString("X4")
str &= $"[{hex}]"
Dim cmdLength = (code And &HF00) >> 8
If cmdLength > 1 Then
For a = 1 To cmdLength - 1
code = BitConverter.ToInt16(inputBytes, reader)
hex = code.ToString("X4")
str &= $"[{hex}]"
reader += 2
Next
End If
Else
str &= Form1.chars(code)
End If
Loop
Return str
End Function
Public Sub convertSummonScript(ByVal inputJfile As String, ByRef DialCount As Integer)
@@ -1544,65 +1444,6 @@ endlineTest:
End Sub
Public Sub ConvertForEdit(srcFile As String, destFile As String)
Dim txt = My.Computer.FileSystem.ReadAllText(srcFile, Encoding.GetEncoding(1251))
Dim destText = ""
Dim accum = ""
Dim x = 0
Dim t As List(Of String) = Split(Split(txt, "-----TEXT SECTION" & vbCrLf)(1), vbCrLf).ToList
Dim idsection As Boolean = True
For Each tx In t
x = 0
If tx.Length < 2 Then Continue For
If tx(x) = "\" And tx(x + 1) = "\" Then
idsection = True
Continue For
End If
Do
If tx(x) = "[" Then
Dim skRes = getFromSkobki(tx, x)
If IsNumeric(skRes) And idsection Then
idsection = False
destText &= "[" & skRes & "]" & vbCrLf
Continue For 'its simple ID
End If
If skRes = "END623" Or skRes = "END" Or skRes = "311" Or skRes = "EOF" Or skRes = "EOD3" Or skRes = "EndSelection" Then
destText &= accum & vbCrLf
accum = ""
idsection = True
Continue For
End If
If skRes = "EOw" Then accum &= vbCrLf
If skRes = "SelectionMenu" Then accum &= " --[выбор]" & vbCrLf
If skRes = "name" Then destText &= "Тацуя"
If skRes = "surname" Then destText &= "Суоу"
Continue Do
End If
If tx(x) = vbTab Then accum &= " " : x += 1 : Continue Do
If tx(x) = "~" Then accum &= "..." : x += 1 : Continue Do
accum &= tx(x)
x = x + 1
Loop While x < tx.Length
destText &= accum & vbCrLf
accum = ""
Next
My.Computer.FileSystem.WriteAllText(destFile, destText, False)
End Sub
Public Function makeCRCString(ByRef bts As List(Of Byte))
Dim a = ""
@@ -1736,7 +1577,7 @@ endlineTest:
Dim d = New ScriptParserWin
d.Text = Path.GetFileNameWithoutExtension(inputJfile)
d.TextBox1.Text = ExportText
d.ShowDialog()
d.Show()
End Sub

View File

@@ -57,11 +57,11 @@ Partial Class StringsOffsetEditorvb
Me.patchFileID = New System.Windows.Forms.TextBox()
Me.PatchFileBtn = New System.Windows.Forms.Button()
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.ReplaceAll = New System.Windows.Forms.Button()
Me.PatchFileRadio = New System.Windows.Forms.RadioButton()
Me.PatchExeRadio = New System.Windows.Forms.RadioButton()
Me.patchOffset = New System.Windows.Forms.TextBox()
Me.Label7 = New System.Windows.Forms.Label()
Me.ReplaceAll = New System.Windows.Forms.Button()
Me.LineModeSimple = New System.Windows.Forms.RadioButton()
Me.GroupBox2 = New System.Windows.Forms.GroupBox()
Me.DontEnglish = New System.Windows.Forms.CheckBox()
@@ -70,11 +70,15 @@ Partial Class StringsOffsetEditorvb
Me.EngSave = New System.Windows.Forms.Button()
Me.EngOffset = New System.Windows.Forms.TextBox()
Me.Label8 = New System.Windows.Forms.Label()
Me.ListBox1 = New System.Windows.Forms.ListBox()
Me.LinkedFiles = New System.Windows.Forms.ListBox()
Me.KudosLoad = New System.Windows.Forms.CheckBox()
Me.Label9 = New System.Windows.Forms.Label()
Me.KUDOSpath = New System.Windows.Forms.TextBox()
Me.FindOffsetInJP = New System.Windows.Forms.Button()
Me.DisableCalc = New System.Windows.Forms.CheckBox()
Me.CopyTable = New System.Windows.Forms.Button()
Me.Label10 = New System.Windows.Forms.Label()
Me.unlink = New System.Windows.Forms.Button()
CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.GroupBox1.SuspendLayout()
Me.GroupBox2.SuspendLayout()
@@ -400,15 +404,6 @@ Partial Class StringsOffsetEditorvb
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "Patch Text Routine Call"
'
'ReplaceAll
'
Me.ReplaceAll.Location = New System.Drawing.Point(912, 128)
Me.ReplaceAll.Name = "ReplaceAll"
Me.ReplaceAll.Size = New System.Drawing.Size(246, 42)
Me.ReplaceAll.TabIndex = 22
Me.ReplaceAll.Text = "Search And Replace All Text Calls"
Me.ReplaceAll.UseVisualStyleBackColor = True
'
'PatchFileRadio
'
Me.PatchFileRadio.AutoSize = True
@@ -448,6 +443,15 @@ Partial Class StringsOffsetEditorvb
Me.Label7.TabIndex = 2
Me.Label7.Text = "Offset"
'
'ReplaceAll
'
Me.ReplaceAll.Location = New System.Drawing.Point(912, 128)
Me.ReplaceAll.Name = "ReplaceAll"
Me.ReplaceAll.Size = New System.Drawing.Size(246, 42)
Me.ReplaceAll.TabIndex = 22
Me.ReplaceAll.Text = "Search And Replace All Text Calls"
Me.ReplaceAll.UseVisualStyleBackColor = True
'
'LineModeSimple
'
Me.LineModeSimple.AutoSize = True
@@ -529,13 +533,13 @@ Partial Class StringsOffsetEditorvb
Me.Label8.TabIndex = 2
Me.Label8.Text = "ENGOffset"
'
'ListBox1
'LinkedFiles
'
Me.ListBox1.FormattingEnabled = True
Me.ListBox1.Location = New System.Drawing.Point(698, 92)
Me.ListBox1.Name = "ListBox1"
Me.ListBox1.Size = New System.Drawing.Size(179, 82)
Me.ListBox1.TabIndex = 26
Me.LinkedFiles.FormattingEnabled = True
Me.LinkedFiles.Location = New System.Drawing.Point(698, 101)
Me.LinkedFiles.Name = "LinkedFiles"
Me.LinkedFiles.Size = New System.Drawing.Size(179, 82)
Me.LinkedFiles.TabIndex = 26
'
'KudosLoad
'
@@ -573,18 +577,57 @@ Partial Class StringsOffsetEditorvb
Me.FindOffsetInJP.Text = "Find in JP"
Me.FindOffsetInJP.UseVisualStyleBackColor = True
'
'DisableCalc
'
Me.DisableCalc.AutoSize = True
Me.DisableCalc.Location = New System.Drawing.Point(391, 195)
Me.DisableCalc.Name = "DisableCalc"
Me.DisableCalc.Size = New System.Drawing.Size(125, 17)
Me.DisableCalc.TabIndex = 26
Me.DisableCalc.Text = "Disable Compile Calc"
Me.DisableCalc.UseVisualStyleBackColor = True
'
'CopyTable
'
Me.CopyTable.Location = New System.Drawing.Point(912, 191)
Me.CopyTable.Name = "CopyTable"
Me.CopyTable.Size = New System.Drawing.Size(179, 23)
Me.CopyTable.TabIndex = 9
Me.CopyTable.Text = "Copy HEX 32 bytes of offsettable"
Me.CopyTable.UseVisualStyleBackColor = True
'
'Label10
'
Me.Label10.AutoSize = True
Me.Label10.Location = New System.Drawing.Point(695, 85)
Me.Label10.Name = "Label10"
Me.Label10.Size = New System.Drawing.Size(63, 13)
Me.Label10.TabIndex = 31
Me.Label10.Text = "Linked Files"
'
'unlink
'
Me.unlink.Location = New System.Drawing.Point(698, 191)
Me.unlink.Name = "unlink"
Me.unlink.Size = New System.Drawing.Size(179, 23)
Me.unlink.TabIndex = 9
Me.unlink.Text = "Unlink All"
Me.unlink.UseVisualStyleBackColor = True
'
'StringsOffsetEditorvb
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.Color.Gray
Me.ClientSize = New System.Drawing.Size(1470, 1140)
Me.Controls.Add(Me.Label10)
Me.Controls.Add(Me.DisableCalc)
Me.Controls.Add(Me.FindOffsetInJP)
Me.Controls.Add(Me.ReplaceAll)
Me.Controls.Add(Me.Label9)
Me.Controls.Add(Me.KUDOSpath)
Me.Controls.Add(Me.KudosLoad)
Me.Controls.Add(Me.ListBox1)
Me.Controls.Add(Me.LinkedFiles)
Me.Controls.Add(Me.EngSave)
Me.Controls.Add(Me.GroupBox2)
Me.Controls.Add(Me.GroupBox1)
@@ -597,6 +640,8 @@ Partial Class StringsOffsetEditorvb
Me.Controls.Add(Me.RadioFile)
Me.Controls.Add(Me.DataGridView1)
Me.Controls.Add(Me.SaveBtn)
Me.Controls.Add(Me.unlink)
Me.Controls.Add(Me.CopyTable)
Me.Controls.Add(Me.SaveSettings)
Me.Controls.Add(Me.LoadSettings)
Me.Controls.Add(Me.LoadBtn)
@@ -674,7 +719,7 @@ Partial Class StringsOffsetEditorvb
Friend WithEvents EngOffset As TextBox
Friend WithEvents Label8 As Label
Friend WithEvents ReplaceAll As Button
Friend WithEvents ListBox1 As ListBox
Friend WithEvents LinkedFiles As ListBox
Friend WithEvents DontEnglish As CheckBox
Friend WithEvents ID As DataGridViewTextBoxColumn
Friend WithEvents JAP As DataGridViewTextBoxColumn
@@ -684,4 +729,8 @@ Partial Class StringsOffsetEditorvb
Friend WithEvents Label9 As Label
Friend WithEvents KUDOSpath As TextBox
Friend WithEvents FindOffsetInJP As Button
Friend WithEvents DisableCalc As CheckBox
Friend WithEvents CopyTable As Button
Friend WithEvents Label10 As Label
Friend WithEvents unlink As Button
End Class

View File

@@ -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
Select Case skRes
Case "END"
bts.AddRange({1, 17, 6, 17, 1, 17, 3, 17}) : Exit For
End If
If skRes = "end" Then
Case "end"
bts.AddRange({1, 17, 3, 17}) : Exit For
End If
If skRes = "END311" Then
Case "END311"
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
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
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

View File

@@ -16,24 +16,24 @@ FONTS
TXTIN_COD
GRF_TATSU
shopLDR
debug?
WEAPCODE
SELLCODE
EatKaori
CasMenCODE
TodorCODE
IgorCODE
IgorSwapCD
Igor3CODE
IgorCardCD
SearchCODE
CountCODE
JewelCODE
SomeCode
SomeCode
SomeCode
SUMMON_MSGS
@@ -43,7 +43,7 @@ GRF_TATSU
EVENTCODE
Loader93
@@ -314,6 +314,7 @@ EXTRASCR1
Mu1
@@ -323,6 +324,13 @@ EXTRASCR1
Slash
Kismet
@@ -332,15 +340,7 @@ EXTRASCR1
Maya
@@ -682,31 +682,31 @@ IntrFcTIM
TitleCode
TitleScrn
BattlTxt?
PlayerMenu
MenuTxt
Gfx_Avata
MenuDat
SPELLCODE
INVENCODE
EQUIPCODE
CARDSCODE
PSELCODE
FUSICODE
SETTCODE
MEMCARD
Gfx_Cards
Gfx_Crds2
Gfx_BGs
Gfx_BGs2
MEMCMSG
ItemsDESC
evItmDESC
cardsDESC
fsDESC
fs2DESC
@@ -719,14 +719,14 @@ CityPack5
CityPack6
CityPack7
CityBGs
CITYCODE
City_HUD
TitlsCODE
EndGamePk
@@ -735,7 +735,7 @@ Dung_HUD
Dung_TEXT
Dung_CODE
Dung2CODE
@@ -752,7 +752,7 @@ DungPack1
NICHIDUNG
@@ -787,7 +787,7 @@ DungPack1
DngPkLast
BattlMenu
BattlCODE
TxtBattl2
@@ -833,10 +833,10 @@ GrfDemons
PrsnSprts
battlecode2
BContTitl
@@ -854,6 +854,7 @@ PrtySprts
FX_SPR
BTalkCODE
@@ -861,8 +862,7 @@ FX_SPR
Btl_CONTC
Vid_Intro
@@ -879,247 +879,3 @@ Vid_Intro

Binary file not shown.

File diff suppressed because it is too large Load Diff

BIN
p2isPSX_CDToolkit/maya.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@@ -24,6 +24,7 @@
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>p2epPSX_CDToolkit.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -47,6 +48,9 @@
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>maya.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Free.Ports.libpng, Version=1.4.3.0, Culture=neutral, PublicKeyToken=7d9de98de58c9d35, processorArchitecture=MSIL">
<HintPath>..\packages\LibPngPort.0.3.1\lib\net45\Free.Ports.libpng.dll</HintPath>
@@ -57,6 +61,9 @@
<Reference Include="MadMilkman.Ini">
<HintPath>..\packages\Ini\MadMilkman.Ini.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
@@ -207,6 +214,9 @@
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="maya.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="LibPngPort" version="0.3.1" targetFramework="net461" />
<package id="Newtonsoft.Json" version="13.0.4" targetFramework="net48" />
<package id="Zlib.Portable.Signed" version="1.11.0" targetFramework="net461" />
</packages>

View File

@@ -260,6 +260,7 @@ LAB_80026510:
Select Case curFile.Type
Case 1 'FOR Type1(Data) - This
rleFile.AddRange({12, 0, 0, 0}) 'Compressed size here! At least 12 (rle, mode, I, D, Comprsize, OverallSize)
Case Else
MsgBox("Unsupported type :( - " & curFile.Type) : Return New List(Of Byte)
End Select
@@ -369,7 +370,7 @@ start4:
'My.Computer.FileSystem.WriteAllBytes("D:\Games\PSX\Persona.2.Innocent.Sin\Export\UnRLE\0181_ALL_SCENERY\1112.rle", rleFile.ToArray, False)
Debug.WriteLine(Microsoft.VisualBasic.DateAndTime.Timer - start)
Debug.WriteLine("File compressed. src_size=" & fil.Count & " | cmpr_size=" & rleFile.Count & " | Time=" & Microsoft.VisualBasic.DateAndTime.Timer - start)
@@ -631,7 +632,22 @@ refr:
Return newF
End Function
Public Function attachNoCompressionHeader(ByRef curfile As rleFile, ByRef bytes As Byte())
Dim file = New List(Of Byte) From {
curfile.Type,
0, 'No compression
BitConverter.GetBytes(curfile.ID)(0), 'Convert ID
BitConverter.GetBytes(curfile.ID)(1),
BitConverter.GetBytes(bytes.Count + 8)(0), 'FileSize
BitConverter.GetBytes(bytes.Count + 8)(1), 'FileSize
BitConverter.GetBytes(bytes.Count + 8)(2), 'FileSize
BitConverter.GetBytes(bytes.Count + 8)(3) 'FileSize
}
file.AddRange(bytes.ToList)
Return file
End Function
End Class

Binary file not shown.

View File

@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2007 James Newton-King
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,71 @@
# ![Logo](https://raw.githubusercontent.com/JamesNK/Newtonsoft.Json/master/Doc/icons/logo.jpg) Json.NET
[![NuGet version (Newtonsoft.Json)](https://img.shields.io/nuget/v/Newtonsoft.Json.svg?style=flat-square)](https://www.nuget.org/packages/Newtonsoft.Json/)
[![Build status](https://dev.azure.com/jamesnk/Public/_apis/build/status/JamesNK.Newtonsoft.Json?branchName=master)](https://dev.azure.com/jamesnk/Public/_build/latest?definitionId=8)
Json.NET is a popular high-performance JSON framework for .NET
## Serialize JSON
```csharp
Product product = new Product();
product.Name = "Apple";
product.Expiry = new DateTime(2008, 12, 28);
product.Sizes = new string[] { "Small" };
string json = JsonConvert.SerializeObject(product);
// {
// "Name": "Apple",
// "Expiry": "2008-12-28T00:00:00",
// "Sizes": [
// "Small"
// ]
// }
```
## Deserialize JSON
```csharp
string json = @"{
'Name': 'Bad Boys',
'ReleaseDate': '1995-4-7T00:00:00',
'Genres': [
'Action',
'Comedy'
]
}";
Movie m = JsonConvert.DeserializeObject<Movie>(json);
string name = m.Name;
// Bad Boys
```
## LINQ to JSON
```csharp
JArray array = new JArray();
array.Add("Manual text");
array.Add(new DateTime(2000, 5, 23));
JObject o = new JObject();
o["MyArray"] = array;
string json = o.ToString();
// {
// "MyArray": [
// "Manual text",
// "2000-05-23T00:00:00"
// ]
// }
```
## Links
- [Homepage](https://www.newtonsoft.com/json)
- [Documentation](https://www.newtonsoft.com/json/help)
- [NuGet Package](https://www.nuget.org/packages/Newtonsoft.Json)
- [Release Notes](https://github.com/JamesNK/Newtonsoft.Json/releases)
- [Contributing Guidelines](https://github.com/JamesNK/Newtonsoft.Json/blob/master/CONTRIBUTING.md)
- [License](https://github.com/JamesNK/Newtonsoft.Json/blob/master/LICENSE.md)
- [Stack Overflow](https://stackoverflow.com/questions/tagged/json.net)

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB