New summon script support

This commit is contained in:
sShemet
2026-01-20 12:53:32 +05:00
parent cbad01271c
commit e8f00fef4d
6 changed files with 36 additions and 110 deletions

View File

@@ -539,7 +539,7 @@ Partial Class Form1
Private Sub Convert_Summon_Click(sender As Object, e As EventArgs) Handles Convert_Summon.Click
Dim Japfiles = IO.Directory.GetFiles("D:\Games\PSX\Persona.2.Innocent.Sin\Export\0077_Summon_Text\Processing\", "*.txt").ToList
Dim Japfiles = IO.Directory.GetFiles("D:\Games\PSX\Persona 2 - Batsu (NTSC-J) [SLPS-02825]\Export\UnRLE\0035_SUMMON_MSGS\Processing", "*.txt").ToList
DialogCounter = 0

View File

@@ -1210,9 +1210,9 @@ rleEnd:
' 'If binFile.Count <> 153 Then MsgBox("WRONG0004 FILE!!! (files count not 152)") : Exit Sub
' Update0004ScriptTable()
'Case 77
' If binFile.Count <> 150 Then MsgBox("WRONG 0077 FILE!!! (files count not 150)") : Exit Sub
' Update0073SummonScriptTable(addresses) 'summon scripts table in 0073
Case 35
If binFile.Count <> 164 Then MsgBox("WRONG 0035 FILE!!! (files count not 164)") : Exit Sub
Update0032SummonScriptTable(addresses) 'summon scripts table in 0032 & 33. Summon and mutation code
'Case 1075
@@ -1316,46 +1316,32 @@ rleEnd:
End Sub
Public Sub Update0073SummonScriptTable(ByRef addr As List(Of Integer))
Public Sub Update0032SummonScriptTable(ByRef addr As List(Of Integer))
Dim cd = New ISOTools
Dim fTable = cd.getCDfile(UserPath.Text, files1(73).Sector, files1(73).Sizw)
Dim fTable2 = cd.getCDfile(UserPath.Text, files1(74).Sector, files1(74).Sizw)
Dim fTable = cd.getCDfile(UserPath.Text, files1(32).Sector, files1(32).Sizw) 'Summon Code
Dim fTable2 = cd.getCDfile(UserPath.Text, files1(33).Sector, files1(33).Sizw) 'Mutation Code
Dim lastSize = 0
For a = 0 To 149
Dim curAddr = a * 8 + 16324
Dim curAddr2 = a * 8 + 15120
Dim cursect As Int16 = addr(a) \ 2048
Dim modSect As Int16 = addr(a) Mod 2048
fTable(curAddr) = BitConverter.GetBytes(modSect)(0)
fTable(curAddr + 1) = BitConverter.GetBytes(modSect)(1) 'BE or LE???
fTable(curAddr + 2) = BitConverter.GetBytes(cursect)(0)
fTable(curAddr + 3) = BitConverter.GetBytes(cursect)(1) 'BE or LE???
fTable2(curAddr2) = BitConverter.GetBytes(modSect)(0)
fTable2(curAddr2 + 1) = BitConverter.GetBytes(modSect)(1) 'BE or LE???
fTable2(curAddr2 + 2) = BitConverter.GetBytes(cursect)(0)
fTable2(curAddr2 + 3) = BitConverter.GetBytes(cursect)(1) 'BE or LE???
Dim sectorsToRead = 1
If modSect + binFile(a).Size > 2048 Then sectorsToRead = 2
fTable(curAddr + 4) = sectorsToRead
fTable(curAddr + 5) = 0
fTable(curAddr + 6) = 1
fTable(curAddr + 7) = 0
fTable2(curAddr2 + 4) = sectorsToRead
fTable2(curAddr2 + 5) = 0
fTable2(curAddr2 + 6) = 1
fTable2(curAddr2 + 7) = 0
For a = 0 To 163
Dim curAddr = a * 4 + &H35BC
Dim curAddr2 = a * 4 + &H2D8C
Dim offset = BitConverter.GetBytes(addr(a))
fTable(curAddr) = offset(0)
fTable(curAddr + 1) = offset(1)
fTable(curAddr + 2) = offset(2)
fTable(curAddr + 3) = 2
fTable2(curAddr2) = offset(0)
fTable2(curAddr2 + 1) = offset(1)
fTable2(curAddr2 + 2) = offset(2)
fTable2(curAddr2 + 3) = 2
Next
cd.saveCDfile(UserPath.Text, files1(73).Sector, files1(73).Sizw, fTable.ToArray)
cd.saveCDfile(UserPath.Text, files1(74).Sector, files1(74).Sizw, fTable2.ToArray)
cd.saveCDfile(UserPath.Text, files1(32).Sector, files1(32).Sizw, fTable.ToArray)
cd.saveCDfile(UserPath.Text, files1(33).Sector, files1(33).Sizw, fTable2.ToArray)
End Sub

View File

@@ -1262,7 +1262,7 @@ endlineTest:
Public Function makeSummonUniversalLine(ByVal inputBytes As Byte(), commented As Boolean)
Dim reader As Integer = 0
Dim str = If(commented, "// ", "")
Dim str = If(commented, "\\ ", "")
Do While reader < UBound(inputBytes)
Dim code = BitConverter.ToInt16(inputBytes, reader)
@@ -1282,7 +1282,7 @@ endlineTest:
If code And &H1000 Then
If code = &H1101 Then str &= vbCrLf & If(commented, "// ", "") : Continue Do
If code = &H1101 Then str &= vbCrLf & If(commented, "\\ ", "") : Continue Do
If code = &H1131 Then str &= vbTab : Continue Do
Dim hex = code.ToString("X4")
@@ -1323,91 +1323,37 @@ endlineTest:
Dim x = 0
Dim accum = New List(Of Byte)
Dim linesAccum = New List(Of String)
Dim currentDialog As Integer
Do
'Comments to end of line!
If tx(x) = "\" And tx(x + 1) = "\" Then
getEndOfLine(tx, x)
idsection = True
Continue Do
End If
If tx(x) = "#" Then TextPointers.Add(accum.Count) : x += 3 : currentDialog += 1 : Continue Do 'SimpleClose
'SPEC_CODES
If tx(x) = "[" Then
Dim skRes = getFromSkobki(tx, x)
If IsNumeric(skRes) And idsection Then
idsection = False
DialCount += 1
x = x + 2
Continue Do 'its simple ID
End If
If skRes = "END623" Or skRes = "END" Or skRes = "311" Then
Dim curCount = accum.Count
currentDialog += 1
x += 2
Select Case skRes
Case "END623"
accum.AddRange({&H6, &H11, &H2, &H11, &H3, &H11})
Case "END"
accum.AddRange({&H6, &H11, &H3, &H11})
Case "311"
accum.AddRange({&H3, &H11})
End Select
Exit Do
End If
Dim spl = Split(skRes, "=")
If UBound(spl) = 1 Then 'Code = parsing
Select Case spl(0)
Case "0e"
accum.AddRange({&HE, &H12, spl(1), 0})
Case "1e"
accum.AddRange({&H1E, &H12, spl(1), 0})
Case "p"
accum.AddRange({&H5, &H12, spl(1), 0})
Case "c"
accum.AddRange({&H1D, &H12, spl(1), 0})
Case "col"
Dim ind = ColorCodes.Find(Function(q) q.value = spl(1)).code 'old style color
accum.AddRange({&H1D, &H12, ind, 0})
End Select
Continue Do
Else '2 hex codes parsing
'test specCodes
If Len(skRes) > 4 Then
Dim spec As CodeObject = SpecialCodes.Find(Function(q) q.value = skRes) 'Special code convert IF
If Not IsNothing(spec) Then
accum.AddRange(BitConverter.GetBytes(Convert.ToInt16(spec.code)).ToList)
Continue Do
End If
End If
If skRes = "col=pink" Then accum.AddRange({&H2E, &H12, 5, 0}) : Continue Do
If skRes = "col=white" Then accum.AddRange({&H2E, &H12, 1, 0}) : Continue Do
Dim code = SoapHexBinary.Parse(skRes).Value.ToList
accum.AddRange({code(1), code(0)})
If skRes.Length = 4 Then 'Try to parse other hex codes
accum.AddRange(SoapHexBinary.Parse(skRes).Value.ToList)
'x += 2
If code(1) = 3 & code(0) = &H11 Then Exit Do
Continue Do
End If
End If
End If
If tx(x) = vbTab Then accum.AddRange({&H20, &H11}) : x += 1 : Continue Do 'Tab and enter
If tx(x) & tx(x + 1) = vbCrLf Then accum.AddRange({&H1, &H11}) : x += 2 : Continue Do
If tx(x) = vbLf Then accum.AddRange({&H1, &H11}) : x += 1 : Continue Do
'SIMPLE TEXT ADDING
Dim SimpleTextAccum = New List(Of Byte)
@@ -1428,15 +1374,9 @@ endlineTest:
accum.AddRange(SimpleTextAccum) 'attach textline
If SimpleTextAccum.Count And 1 Then accum.Add(0) ' if and 1 - add empty byte
x += 1
Loop While x < tx.Length - 1
'TextPointers.RemoveAt(TextPointers.Count - 1) 'Remove Last Pointer
'updateing text pointers
'Сохраняем выходной файл
My.Computer.FileSystem.WriteAllBytes(inputJfile & ".SummonTRNSL", accum.ToArray, False)

Binary file not shown.

View File

@@ -30,9 +30,9 @@ IgorCardCD
SearchCODE
CountCODE
JewelCODE
SomeCode
SomeCode
SomeCode
SummoCODE
MutatCODE
CPantCODE
SUMMON_MSGS
@@ -372,7 +372,7 @@ Maya
Trish1
@@ -709,8 +709,8 @@ fsDESC
fs2DESC
PersData
DemonData
CityPack1
CityPack2
CityPack3