ROM Hack Negima!? Chou Mahora Taisen Chuu (fantranslation)

suruz

Well-Known Member
Member
Joined
Oct 1, 2007
Messages
607
Trophies
0
Website
Visit site
XP
338
Country
Wowow those screens make me so happyy :3 I just hope you guys collaborate and figure it out, lol.

As for the script, I wouldn't mind proof-reading/editing scenes if thats okay. I think I know enough about the characters and Chupacabras to understand what they're talking about
tongue.gif


Oh and I'll keep the -san suffixes and all those if you let me do it xD

QUOTE said:
Then also need to adjust the FPAK offset for the NFTR file. You can then import any NFTR from any other games you have. The one I used here is from Ouran Host Club's font.

Ohh that's awesome.. Looks a hell of a lot better than the previous one, and it can fit a LOT more text.
And it looks like there's enough space to fit the proper meaning too, which is also good.

QUOTEso i can do inserting translated text, and release a menu, item, battle menu patch.

Again, awesome news.. I've wanted to know what the items/battle moves mean for a while now... I kinda stopped playing until I know, lol.
 

jjjewel

Well-Known Member
Member
Joined
Dec 17, 2009
Messages
1,010
Trophies
0
XP
522
Country
United States
The main concept to make the translated file work is that you need to adjust the FPAK offsets whenever the new file size gets bigger than the original.

The main packfile.pak has one main FPAK at byte 0000. Then the FPAK at 0000 has another 100 sub-FPAKs. Each sub-FPAK contains other sub-sub-FPAKs, and so on. So if you take a look at the sub-FPAK files that you can extract from FPAK at 0000 you'll get the files listed below (without indent.) Then if you extract sub-sub-FPAKs from the sub-FPAK files, you'll get the file lists with indents. (Think of them as folder/subfolder.)



Code:
0000019C
ÂÂÂÂ000000A4
ÂÂÂÂ0000ABB8
ÂÂÂÂ0000D920
ÂÂÂÂ0000DD2C
ÂÂÂÂ0000DE10
ÂÂÂÂ0000DFD0
ÂÂÂÂ0000E298
ÂÂÂÂ0000EC30* This contains figthing dialogs
ÂÂÂÂ00014C38
ÂÂÂÂ00015CC4
ÂÂÂÂ0006D124
ÂÂÂÂ00094F48
ÂÂÂÂ000CBF1C
ÂÂÂÂ000CD18C
ÂÂÂÂ00B60FD8
ÂÂÂÂ0102FA88
ÂÂÂÂ0103681C
ÂÂÂÂ010439B8
ÂÂÂÂ01044AFC
ÂÂÂÂ01046324
ÂÂÂÂ01049C3C
ÂÂÂÂ0104A790
ÂÂÂÂ01052478
ÂÂÂÂ01074D34
ÂÂÂÂ01077284
ÂÂÂÂ01081610
ÂÂÂÂ0110F56C
ÂÂÂÂ011711C4
ÂÂÂÂ0117D224
ÂÂÂÂ01182EB8
ÂÂÂÂ01184C9C
ÂÂÂÂ01185040
ÂÂÂÂ01185050
ÂÂÂÂ01190F90
ÂÂÂÂ01191938
ÂÂÂÂ011CCB28
ÂÂÂÂ011CD8C0
ÂÂÂÂ011D0EF8
ÂÂÂÂ011D1E34
011D1FD0
ÂÂÂÂ00000020
ÂÂÂÂ00012194
ÂÂÂÂ00094044
ÂÂÂÂ000BBBCC
ÂÂÂÂ000C229C
ÂÂÂÂ000C3F08
01295ED8
ÂÂÂÂ00000058
ÂÂÂÂ00020798
ÂÂÂÂ000867F8
ÂÂÂÂ0008A070* This contains main dialogs
ÂÂÂÂ000A7304
ÂÂÂÂ000A80B4
ÂÂÂÂ002888D4
ÂÂÂÂ00289800* This contains main NFTR font
ÂÂÂÂ002A28B8
ÂÂÂÂ002B5968
ÂÂÂÂ002D3320
ÂÂÂÂ00384FE0
ÂÂÂÂ0039614C
ÂÂÂÂ003C61DC
ÂÂÂÂ003D4CF8
ÂÂÂÂ003DA1B4
ÂÂÂÂ003E68B8
ÂÂÂÂ00412234
ÂÂÂÂ00416840
ÂÂÂÂ0041D718
016B35F0
016B3600
016B3610
016B3620
016B3630
016B3640
016B3650
016B3660
016B3670
016B3680
016B3690
016B36A0
016B36B0
016B36C0
016B36D0
016B36E0
016B36F0
016B3700
016B3710
016B3720
016B3730
016B3740
016B3750
016B3760
016B3770
016B3780
016B3790
016B37A0
016B37B0
016B37C0
016B37D0
016B37E0
016B37F0
016B3800
016B3810
016B3820
016B3830
016B3840
016B3850
016B3860
016B3870
016B3880
016B3890
016B38A0
016B38B0
016B38C0
016B38D0
016B38E0
016B38F0
016B3900
016B3910
016B3920
016B3930
016B3940
016B3950
016B3960
016B3970
016B3980
016B3990
016B39A0
016B39B0
016B39C0
016B39D0
016B39E0
016B39F0
016B3A00
016B3A10
016B3A20
016B3A30
016B3A40
016B3A50
016B3A60
016B3A70
016B3A80
016B3A90
016B3AA0
016B3AB0
016B3AC0
016B3AD0
016B3AE0
016B3AF0
016B3B00
016B3B10
016B3B20
016B3B30
016B3B40
016B3B50
016B3B60
016B3B70
016B3B80
016B3B90
016B3BA0
016B3BB0
016B3BC0
016B3BD0
016B3BE0
016B3BF0

The file at 0000EC30 within the sub-FPAK 0000019C is the one that contains fighting dialogs. If we translate the sub files within EC30 and repack them and the filesize gets bigger, it will affect the offsets of all the files that come after EC30. (Which are 00014C38, 000015CC4, and so on.) So you will need to recalculate and adjust the offsets of these files which will be listed at the beginning of FPAK at 0000019C. Then, if file at EC30 gets bigger, it will cause the whole 0000019C to be bigger too. So the offsets of subfiles after that (011D1FD0, 01295ED8, and so on.) will need to be changed too. (This change will be listed at the offsets at the beginning of the main FPAK at 0000)

So although we don't have to mess with the size and the packing of the sub-sub-files except the ones we need to translate, we still have to recalculate and adjust most of the FPAK offsets. I'm not sure how difficult this recalculation/updating new offset is. But if it's too difficult or too complicated, we can work around the problem by creating a new packfile.pak with some padding zero bytes for the files we need to change. (Which are the one with fighting dialogs, one with main dialogs, and one with NFTR font.) Then recalculate/update offsets for the whole packfile.pak once, and after that just use this new packfile.pak instead of the original one to make text extraction/insertion. (Just make sure that the new file size is big enough that no matter how you translate or change the sub files, the overall size will never exceed the current padded size.)

Well, the padding concept seemed to work well when I tested it. (It would be easier to understand when you actually did it. It's pretty difficult to explain.
tongue.gif
) I got the file with padding for the dialogs and font and it seemed to work. You can test it if you like. (Just change packfileOuranFont.bin to packfile.pak and replace it with the game's packfile.pak.)

http://www.mediafire.com/file/zgmtgmjeltw/...leOuranFont.bin

Anyway, the main dialog's address is now shifted to Hex address 1321AC0 instead of the old one at 131FF48. So azerty1, could you change your program to extract/insert text at 1321AC0 instead? (The first one is still the same at Hex EDCC.)

P.S. This concept only "seems to work." I can't guarantee that it really works with no flaws. There might be some errors that I haven't encountered yet.
tongue.gif


P.S. 2 If this doesn't work, then I can't help with anything else at least for a while. (I will have to work on my other project's patch and some other personal stuff this week.)
 

azerty1

Well-Known Member
Member
Joined
Mar 22, 2009
Messages
160
Trophies
0
Age
29
Website
Visit site
XP
99
Country
Canada
i won't be able to download that from home (slow internet), so i probably can't do much until after the weekend...

i changed the constants in the tool as per jjewel's request.
*snip*
messed up the extraction changes a bit...i'll go fix those while i work on the pointer resetting method.

concerning the first solution to the problem, it's perfectly feasible, though i'll probably need to know the locations and how many parent fpaks there are to each of the files we're editing.

here's what i understand and have checked so far (with the original packfile.pak. i can change it to work with jjewel's new font after i make sure it works.). i'll start writing a method to make the appropriate changes.
FPAK "1" @ offset 0
--> FPAK "2" @ 19C
--> 8th FPAK @ 19C+EC30
= EDCC --> size changes.
-->Every pointer in "2" after the eigth must have the size difference added to it.
Every pointer in "1" after the first one (0000019C) must have size difference added to it.

-->FPAK "4", third offset in master parent fpak (01295ED8)
-->FPAK "4" @ 01295ED8. Fourth FPAK 01295ED8+08A070 gives us 131FF48, the dialogue text
--> 131FF48 --> size changes.
--> Every pointer in "4" after the fourth one must have the size difference added to them.
-->Every pointer in the master parent fpak after the third one (01295ED8) must have the size difference added to them.


The fpaks we care about are only second generation children of the main fpak, which makes things much less confusing.
 

jjjewel

Well-Known Member
Member
Joined
Dec 17, 2009
Messages
1,010
Trophies
0
XP
522
Country
United States
azerty1, if it gets complicated, will it be easier if you change the program to output to 2 separate files first? Like one for the combined dialog files, and the other for the combined fighting dialog files. Then maybe make an inserter to just copy the output files to certain addresses in my new packfile.pak. Because when I tested the game with new font and dnniwa485's translation, I just ran your program first and then manually copy the main dialog part from your packfile.pak output and insert to my new file, and it worked just fine.

Anyway, I made a VB program to extract/combine Fpak files but I only made it for the first 2 tiers of Fpak. (The files listed in my previous post.) After the first 2 tiers, the Fpak gets more complicated (with compression and stuff.) I'll post my program script here just in case you can adapt it to handle other Fpak files. (I think it works fine but there may be some errors somewhere.)

(I could only make program to extract or insert one file at a time. Like in case of repacking, I just repacked each folder first and manually copied the output Fpak to another folder. Once I got Fpaks from all the folders, I ran the repacking script for this new folder to combine the files to the main Fpak. Not quite convenient but I couldn't handle complicated scripts yet.
tongue.gif
)

Fpak extractor (Just list the sub-Fpak addresses. Then you can make a script to extract files from these addresses.)
(This only extracts files. It has nothing to do with extracting/inserting text.)
Code:
Private Function UnpackFpak01(myFpakFile as String) As String
' Get a list of sub Fpaks within Fpak file
' Then you can use the hex address list to extract each sub fpak file
ÂÂÂÂDim myBytes() As Byte = My.Computer.FileSystem.ReadAllBytes(myFpakFile)
ÂÂÂÂÂÂÂÂDim numFile As Integer = Hex2Dec(GetEndianHex(myBytes, 6))
ÂÂÂÂÂÂÂÂDim numStep As Integer
ÂÂÂÂÂÂÂÂIf myBytes(4) = 0 Then
ÂÂÂÂÂÂÂÂÂÂÂÂnumStep = 4 ' If &H04 = 00, read every 4 bytes
ÂÂÂÂÂÂÂÂElse
ÂÂÂÂÂÂÂÂÂÂÂÂnumStep = 2 ' If &H04 = 01, read every 2 bytes
ÂÂÂÂÂÂÂÂEnd If
ÂÂÂÂÂÂÂÂDim fileOffsets(numFile) As String
ÂÂÂÂÂÂÂÂDim byteStart As Long = 8 ' Where the offset list starts

ÂÂÂÂÂÂÂÂDim sb As New System.Text.StringBuilder
ÂÂÂÂÂÂÂÂFor i As Integer = 0 To numFile
ÂÂÂÂÂÂÂÂÂÂÂÂfileOffsets(i) = GetEndianHex(myBytes, byteStart, numStep)
ÂÂÂÂÂÂÂÂÂÂÂÂsb.AppendLine(fileOffsets(i))
ÂÂÂÂÂÂÂÂÂÂÂÂbyteStart += numStep
ÂÂÂÂÂÂÂÂNext
ÂÂÂÂÂÂÂÂReturn sb.ToString
End Function

Repacking Fpaks.
CODEPrivate Sub btnRepackFpak_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnRepackFpak.Click
' Repacking sub-Fpak files to one main Fpak file

' ---- Select a folder (with extracted sub-Fpak files)
ÂÂÂÂÂÂÂÂIf FolderBrowserDialog1.ShowDialog Windows.Forms.DialogResult.OK Then
ÂÂÂÂÂÂÂÂÂÂÂÂExit Sub
ÂÂÂÂÂÂÂÂEnd If
ÂÂÂÂÂÂÂÂDim folderName As String = FolderBrowserDialog1.SelectedPath

' ---- Read files
ÂÂÂÂÂÂÂÂDim fileOffset(0) As Long ' Equals to size of each sub-Fpak file
ÂÂÂÂÂÂÂÂDim subFileName(0) As String
ÂÂÂÂÂÂÂÂDim count As Integer = 0
ÂÂÂÂÂÂÂÂFor Each oneFile As String In _
ÂÂÂÂÂÂÂÂÂÂÂÂMy.Computer.FileSystem.GetFiles(folderName, _
ÂÂÂÂÂÂÂÂÂÂÂÂFileIO.SearchOption.SearchTopLevelOnly, "*.*")
ÂÂÂÂÂÂÂÂÂÂÂÂReDim Preserve fileOffset(count)
ÂÂÂÂÂÂÂÂÂÂÂÂReDim Preserve subFileName(count)
ÂÂÂÂÂÂÂÂÂÂÂÂfileOffset(count) = GetFileSize(oneFile)
ÂÂÂÂÂÂÂÂÂÂÂÂsubFileName(count) = oneFile
ÂÂÂÂÂÂÂÂÂÂÂÂcount += 1
ÂÂÂÂÂÂÂÂNext

' ---- Join files
ÂÂÂÂÂÂÂÂDim byteStart As Integer = 12 + (count * 4) ' Create space for the header
ÂÂÂÂÂÂÂÂDim newStart As Integer = 8 ' Starting address for offset list
ÂÂÂÂÂÂÂÂDim outputBytes(byteStart) As Byte
ÂÂÂÂÂÂÂÂDim hexOffset As String

ÂÂÂÂÂÂÂÂFor i As Integer = 0 To UBound(fileOffset)
ÂÂÂÂÂÂÂÂ' Read and join files
ÂÂÂÂÂÂÂÂÂÂÂÂDim currentSize As Long = UBound(outputBytes)
ÂÂÂÂÂÂÂÂÂÂÂÂReDim Preserve outputBytes(currentSize + fileOffset(i))
ÂÂÂÂÂÂÂÂÂÂÂÂDim tempBytes() As Byte = My.Computer.FileSystem.ReadAllBytes(subFileName(i))
ÂÂÂÂÂÂÂÂÂÂÂÂArray.Copy(tempBytes, 0, outputBytes, currentSize, UBound(tempBytes))
ÂÂÂÂÂÂÂÂ' Add offset to header
ÂÂÂÂÂÂÂÂÂÂÂÂhexOffset = currentSize.ToString("X8")
ÂÂÂÂÂÂÂÂÂÂÂÂInsertEndianHex2(outputBytes, newStart, hexOffset)
ÂÂÂÂÂÂÂÂÂÂÂÂnewStart += 4
ÂÂÂÂÂÂÂÂNext
ÂÂÂÂÂÂÂÂInsertEndianHex2(outputBytes, newStart, UBound(outputBytes).ToString("X8"))

' ---- Delete trailing zero byte
ÂÂÂÂÂÂÂÂReDim Preserve outputBytes(UBound(outputBytes) - 1)

' ---- Add headers to output file
ÂÂÂÂÂÂÂÂDim FpakBytes() As Byte = {70, 80, 65, 75, 0, 0} ' The word FPAK at the first 4 bytes and 0, 0
ÂÂÂÂÂÂÂÂArray.Copy(FpakBytes, outputBytes, UBound(FpakBytes))
ÂÂÂÂÂÂÂÂDim numOfFile As String = count.ToString("X4")
ÂÂÂÂÂÂÂÂInsertEndianHex(outputBytes, 6, numOfFile)

' ---- Output file
ÂÂÂÂÂÂÂÂDim outputFile As String = "C:/testPackingFpak.bin"
ÂÂÂÂÂÂÂÂMy.Computer.FileSystem.WriteAllBytes(outputFile, outputBytes, False)

End Sub


Misc functions & procedures
CODEÂÂÂÂPrivate Function GetFileSize(ByVal myFile As String) As Long
ÂÂÂÂÂÂÂÂDim fileDetail As IO.FileInfo = My.Computer.FileSystem.GetFileInfo(myFile)
ÂÂÂÂÂÂÂÂReturn fileDetail.Length
ÂÂÂÂEnd Function

ÂÂÂÂPrivate Sub InsertEndianHex(ByVal oriBytes() As Byte, ByVal pointer As Long, _
ÂÂÂÂÂÂÂÂByVal hexVal As String)
ÂÂÂÂÂÂÂÂ' To insert 4-digit hex value into a byte array in reversing order

ÂÂÂÂÂÂÂÂ' Check for length of hex value
ÂÂÂÂÂÂÂÂIf hexVal.Length 4 Then
ÂÂÂÂÂÂÂÂÂÂÂÂMessageBox.Show("Hex value for " & hexVal & " must be formatted to" & _
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ" 4 digits")
ÂÂÂÂÂÂÂÂÂÂÂÂExit Sub
ÂÂÂÂÂÂÂÂEnd If

ÂÂÂÂÂÂÂÂ' Put reversed values in to byte array
ÂÂÂÂÂÂÂÂDim val1 As String = Hex2Dec(hexVal.Substring(0, 2))
ÂÂÂÂÂÂÂÂDim val2 As String = Hex2Dec(hexVal.Substring(2, 2))
ÂÂÂÂÂÂÂÂoriBytes(pointer) = val2
ÂÂÂÂÂÂÂÂoriBytes(pointer + 1) = val1
ÂÂÂÂEnd Sub

ÂÂÂÂPrivate Sub InsertEndianHex2(ByVal oriBytes() As Byte, ByVal pointer As Long, _
ÂÂÂÂ ByVal hexVal As String)
ÂÂÂÂÂÂÂÂ' To insert 8-digit hex value into a byte array in reversing order

ÂÂÂÂÂÂÂÂDim formattedHex As String = Format(Hex2Dec(hexVal), "X8")

ÂÂÂÂÂÂÂÂ' Put reversed values in to byte array
ÂÂÂÂÂÂÂÂDim val1 As String = Hex2Dec(formattedHex.Substring(0, 2))
ÂÂÂÂÂÂÂÂDim val2 As String = Hex2Dec(formattedHex.Substring(2, 2))
ÂÂÂÂÂÂÂÂDim val3 As String = Hex2Dec(formattedHex.Substring(4, 2))
ÂÂÂÂÂÂÂÂDim val4 As String = Hex2Dec(formattedHex.Substring(6, 2))

ÂÂÂÂÂÂÂÂoriBytes(pointer) = val4
ÂÂÂÂÂÂÂÂoriBytes(pointer + 1) = val3
ÂÂÂÂÂÂÂÂoriBytes(pointer + 2) = val2
ÂÂÂÂÂÂÂÂoriBytes(pointer + 3) = val1
ÂÂÂÂEnd Sub

ÂÂÂÂPrivate Function Hex2Dec(ByVal myHex As String) As Long
ÂÂÂÂÂÂÂÂ' Convert hexadecimal to decimal
ÂÂÂÂÂÂÂÂReturn Convert.ToInt32(myHex, 16)
ÂÂÂÂEnd Function
 

azerty1

Well-Known Member
Member
Joined
Mar 22, 2009
Messages
160
Trophies
0
Age
29
Website
Visit site
XP
99
Country
Canada
jjjewel said:
azerty1, if it gets complicated, will it be easier if you change the program to output to 2 separate files first? Like one for the combined dialog files, and the other for the combined fighting dialog files. Then maybe make an inserter to just copy the output files to certain addresses in my new packfile.pak. Because when I tested the game with new font and dnniwa485's translation, I just ran your program first and then manually copy the main dialog part from your packfile.pak output and insert to my new file, and it worked just fine.

Anyway, I made a VB program to extract/combine Fpak files but I only made it for the first 2 tiers of Fpak. (The files listed in my previous post.) After the first 2 tiers, the Fpak gets more complicated (with compression and stuff.) I'll post my program script here just in case you can adapt it to handle other Fpak files. (I think it works fine but there may be some errors somewhere.)

(I could only make program to extract or insert one file at a time. Like in case of repacking, I just repacked each folder first and manually copied the output Fpak to another folder. Once I got Fpaks from all the folders, I ran the repacking script for this new folder to combine the files to the main Fpak. Not quite convenient but I couldn't handle complicated scripts yet.
tongue.gif
)

Fpak extractor (Just list the sub-Fpak addresses. Then you can make a script to extract files from these addresses.)
(This only extracts files. It has nothing to do with extracting/inserting text.)
Code:
Private Function UnpackFpak01(myFpakFile as String) As String
' Get a list of sub Fpaks within Fpak file
' Then you can use the hex address list to extract each sub fpak file
ÂÂÂÂDim myBytes() As Byte = My.Computer.FileSystem.ReadAllBytes(myFpakFile)
ÂÂÂÂÂÂÂÂDim numFile As Integer = Hex2Dec(GetEndianHex(myBytes, 6))
ÂÂÂÂÂÂÂÂDim numStep As Integer
ÂÂÂÂÂÂÂÂIf myBytes(4) = 0 Then
ÂÂÂÂÂÂÂÂÂÂÂÂnumStep = 4 ' If &H04 = 00, read every 4 bytes
ÂÂÂÂÂÂÂÂElse
ÂÂÂÂÂÂÂÂÂÂÂÂnumStep = 2 ' If &H04 = 01, read every 2 bytes
ÂÂÂÂÂÂÂÂEnd If
ÂÂÂÂÂÂÂÂDim fileOffsets(numFile) As String
ÂÂÂÂÂÂÂÂDim byteStart As Long = 8 ' Where the offset list starts

ÂÂÂÂÂÂÂÂDim sb As New System.Text.StringBuilder
ÂÂÂÂÂÂÂÂFor i As Integer = 0 To numFile
ÂÂÂÂÂÂÂÂÂÂÂÂfileOffsets(i) = GetEndianHex(myBytes, byteStart, numStep)
ÂÂÂÂÂÂÂÂÂÂÂÂsb.AppendLine(fileOffsets(i))
ÂÂÂÂÂÂÂÂÂÂÂÂbyteStart += numStep
ÂÂÂÂÂÂÂÂNext
ÂÂÂÂÂÂÂÂReturn sb.ToString
End Function

Repacking Fpaks.
CODEPrivate Sub btnRepackFpak_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnRepackFpak.Click
' Repacking sub-Fpak files to one main Fpak file

' ---- Select a folder (with extracted sub-Fpak files)
ÂÂÂÂÂÂÂÂIf FolderBrowserDialog1.ShowDialog Windows.Forms.DialogResult.OK Then
ÂÂÂÂÂÂÂÂÂÂÂÂExit Sub
ÂÂÂÂÂÂÂÂEnd If
ÂÂÂÂÂÂÂÂDim folderName As String = FolderBrowserDialog1.SelectedPath

' ---- Read files
ÂÂÂÂÂÂÂÂDim fileOffset(0) As Long ' Equals to size of each sub-Fpak file
ÂÂÂÂÂÂÂÂDim subFileName(0) As String
ÂÂÂÂÂÂÂÂDim count As Integer = 0
ÂÂÂÂÂÂÂÂFor Each oneFile As String In _
ÂÂÂÂÂÂÂÂÂÂÂÂMy.Computer.FileSystem.GetFiles(folderName, _
ÂÂÂÂÂÂÂÂÂÂÂÂFileIO.SearchOption.SearchTopLevelOnly, "*.*")
ÂÂÂÂÂÂÂÂÂÂÂÂReDim Preserve fileOffset(count)
ÂÂÂÂÂÂÂÂÂÂÂÂReDim Preserve subFileName(count)
ÂÂÂÂÂÂÂÂÂÂÂÂfileOffset(count) = GetFileSize(oneFile)
ÂÂÂÂÂÂÂÂÂÂÂÂsubFileName(count) = oneFile
ÂÂÂÂÂÂÂÂÂÂÂÂcount += 1
ÂÂÂÂÂÂÂÂNext

' ---- Join files
ÂÂÂÂÂÂÂÂDim byteStart As Integer = 12 + (count * 4) ' Create space for the header
ÂÂÂÂÂÂÂÂDim newStart As Integer = 8 ' Starting address for offset list
ÂÂÂÂÂÂÂÂDim outputBytes(byteStart) As Byte
ÂÂÂÂÂÂÂÂDim hexOffset As String

ÂÂÂÂÂÂÂÂFor i As Integer = 0 To UBound(fileOffset)
ÂÂÂÂÂÂÂÂ' Read and join files
ÂÂÂÂÂÂÂÂÂÂÂÂDim currentSize As Long = UBound(outputBytes)
ÂÂÂÂÂÂÂÂÂÂÂÂReDim Preserve outputBytes(currentSize + fileOffset(i))
ÂÂÂÂÂÂÂÂÂÂÂÂDim tempBytes() As Byte = My.Computer.FileSystem.ReadAllBytes(subFileName(i))
ÂÂÂÂÂÂÂÂÂÂÂÂArray.Copy(tempBytes, 0, outputBytes, currentSize, UBound(tempBytes))
ÂÂÂÂÂÂÂÂ' Add offset to header
ÂÂÂÂÂÂÂÂÂÂÂÂhexOffset = currentSize.ToString("X8")
ÂÂÂÂÂÂÂÂÂÂÂÂInsertEndianHex2(outputBytes, newStart, hexOffset)
ÂÂÂÂÂÂÂÂÂÂÂÂnewStart += 4
ÂÂÂÂÂÂÂÂNext
ÂÂÂÂÂÂÂÂInsertEndianHex2(outputBytes, newStart, UBound(outputBytes).ToString("X8"))

' ---- Delete trailing zero byte
ÂÂÂÂÂÂÂÂReDim Preserve outputBytes(UBound(outputBytes) - 1)

' ---- Add headers to output file
ÂÂÂÂÂÂÂÂDim FpakBytes() As Byte = {70, 80, 65, 75, 0, 0} ' The word FPAK at the first 4 bytes and 0, 0
ÂÂÂÂÂÂÂÂArray.Copy(FpakBytes, outputBytes, UBound(FpakBytes))
ÂÂÂÂÂÂÂÂDim numOfFile As String = count.ToString("X4")
ÂÂÂÂÂÂÂÂInsertEndianHex(outputBytes, 6, numOfFile)

' ---- Output file
ÂÂÂÂÂÂÂÂDim outputFile As String = "C:/testPackingFpak.bin"
ÂÂÂÂÂÂÂÂMy.Computer.FileSystem.WriteAllBytes(outputFile, outputBytes, False)

End Sub


Misc functions & procedures
CODEÂÂÂÂPrivate Function GetFileSize(ByVal myFile As String) As Long
ÂÂÂÂÂÂÂÂDim fileDetail As IO.FileInfo = My.Computer.FileSystem.GetFileInfo(myFile)
ÂÂÂÂÂÂÂÂReturn fileDetail.Length
ÂÂÂÂEnd Function

ÂÂÂÂPrivate Sub InsertEndianHex(ByVal oriBytes() As Byte, ByVal pointer As Long, _
ÂÂÂÂÂÂÂÂByVal hexVal As String)
ÂÂÂÂÂÂÂÂ' To insert 4-digit hex value into a byte array in reversing order

ÂÂÂÂÂÂÂÂ' Check for length of hex value
ÂÂÂÂÂÂÂÂIf hexVal.Length 4 Then
ÂÂÂÂÂÂÂÂÂÂÂÂMessageBox.Show("Hex value for " & hexVal & " must be formatted to" & _
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ" 4 digits")
ÂÂÂÂÂÂÂÂÂÂÂÂExit Sub
ÂÂÂÂÂÂÂÂEnd If

ÂÂÂÂÂÂÂÂ' Put reversed values in to byte array
ÂÂÂÂÂÂÂÂDim val1 As String = Hex2Dec(hexVal.Substring(0, 2))
ÂÂÂÂÂÂÂÂDim val2 As String = Hex2Dec(hexVal.Substring(2, 2))
ÂÂÂÂÂÂÂÂoriBytes(pointer) = val2
ÂÂÂÂÂÂÂÂoriBytes(pointer + 1) = val1
ÂÂÂÂEnd Sub

ÂÂÂÂPrivate Sub InsertEndianHex2(ByVal oriBytes() As Byte, ByVal pointer As Long, _
ÂÂÂÂ ByVal hexVal As String)
ÂÂÂÂÂÂÂÂ' To insert 8-digit hex value into a byte array in reversing order

ÂÂÂÂÂÂÂÂDim formattedHex As String = Format(Hex2Dec(hexVal), "X8")

ÂÂÂÂÂÂÂÂ' Put reversed values in to byte array
ÂÂÂÂÂÂÂÂDim val1 As String = Hex2Dec(formattedHex.Substring(0, 2))
ÂÂÂÂÂÂÂÂDim val2 As String = Hex2Dec(formattedHex.Substring(2, 2))
ÂÂÂÂÂÂÂÂDim val3 As String = Hex2Dec(formattedHex.Substring(4, 2))
ÂÂÂÂÂÂÂÂDim val4 As String = Hex2Dec(formattedHex.Substring(6, 2))

ÂÂÂÂÂÂÂÂoriBytes(pointer) = val4
ÂÂÂÂÂÂÂÂoriBytes(pointer + 1) = val3
ÂÂÂÂÂÂÂÂoriBytes(pointer + 2) = val2
ÂÂÂÂÂÂÂÂoriBytes(pointer + 3) = val1
ÂÂÂÂEnd Sub

ÂÂÂÂPrivate Function Hex2Dec(ByVal myHex As String) As Long
ÂÂÂÂÂÂÂÂ' Convert hexadecimal to decimal
ÂÂÂÂÂÂÂÂReturn Convert.ToInt32(myHex, 16)
ÂÂÂÂEnd Function

i can easily make it output the two text fpak files. it already does them separately and repacks everything like that anyway, so i just need to add a line or two to it....

edit:
http://www.mediafire.com/download.php?0cttzwgmujn

the only difference is that the decompression offsets are being asked for and it writes those two files out. it doesn't deal with the parent fpak pointers yet.
 

dnniwa485

Well-Known Member
OP
Member
Joined
Oct 4, 2009
Messages
458
Trophies
0
XP
13
Country
lol i dunno what ill do on the latest program now.. it ask for offsets and im totally clueless about those.. xD
 

jjjewel

Well-Known Member
Member
Joined
Dec 17, 2009
Messages
1,010
Trophies
0
XP
522
Country
United States
I'll have time to test azerty1's program next week. (Thanks so much azerty1.
wub.gif
)

dnniwa485, for now, maybe you can continue with the translation first. At least I'm pretty sure we can solve the font problem so there's not much to worry about.
biggrin.gif
By the way, you may want to check the punctuations. In the translation you posted previously, you used Japanese punctuations like "?" instead of "." or "?" instead of "," etc. Usually the Japanese punctuations take bigger space than the English ones, so you'll have to consider that when you calculate text length and line break.)
 

azerty1

Well-Known Member
Member
Joined
Mar 22, 2009
Messages
160
Trophies
0
Age
29
Website
Visit site
XP
99
Country
Canada
dnniwa485 said:
lol i dunno what ill do on the latest program now.. it ask for offsets and im totally clueless about those.. xD
If you're extracting from jjewel's packfile, type EDCC for the first one, then hit enter. then type 1321AC0 then hit enter and then the rest will be the same.
if you're using the original packfile, use EDCC and then 131FF48.
 

jjjewel

Well-Known Member
Member
Joined
Dec 17, 2009
Messages
1,010
Trophies
0
XP
522
Country
United States
Hey, dnniwa485, so do you still need my help for this? Does everything work okay with azerty1's program? My notebook broke and I lost all the info I worked for this game so far. (Anyway, I'm glad at least I posted some codes in this forum or I'll never be able to remake my program ever again.
happy.gif
)

Well, just let me know if you need my help for anything else. (I don't think there's anything much I can do though. Things should go smoothly after you got the insertion to work, I guess.)
 

dnniwa485

Well-Known Member
OP
Member
Joined
Oct 4, 2009
Messages
458
Trophies
0
XP
13
Country
well the scripts are ready but, it seems that the inserter somehow doesnt work properly.

i got black screen, when i inserted some translated text, but somehow it hangs when i select new game or load game, i tried not making some changes and repacking it and the blackscreen is not encountered.

and also i used your ouran packfile and used those addresses but weird it doesnt extract all of the files, and thats not all, when i attempt to insert some textand insert it, the inserter hangs and showing a "an error has been encountered" and this is what it shown on the error window:

QUOTE said:
Description:
Stopped working

Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01: negitool.exe
Problem Signature 02: 1.0.3772.39330
Problem Signature 03: 4bdb9715
Problem Signature 04: mscorlib
Problem Signature 05: 2.0.0.0
Problem Signature 06: 4a275af7
Problem Signature 07: 344b
Problem Signature 08: 119
Problem Signature 09: System.IO.DirectoryNotFound
OS Version: 6.1.7600.2.0.0.256.1
Locale ID: 1124

Read our privacy statement online:
http://go.microsoft.com/fwlink/?linkid=104...mp;clcid=0x0409

If the online privacy statement is not available, please read our privacy statement offline:
C:\Windows\system32\en-US\erofflps.txt

so far im still working on it. im not used to bumping the thread a lot, and im not rushing on it, as long as you guys work on the inserter, ill go continue translating the game.
 

jjjewel

Well-Known Member
Member
Joined
Dec 17, 2009
Messages
1,010
Trophies
0
XP
522
Country
United States
Okay, dnniwa485, please try this method.

1- Rename my packfile with Ouran font to packfile.pak
2- Put the file in the same directory as azerty1's negitool v. 1.2
3- Run negitool v. 1.2 using EC4C for the first value and 1321AC0 for the second value.
4- Decompress the file, then extract.

I got it to decompress and extract the files to .txt scripts just fine. I think the problem is with the 2 values that got changed. I haven't tried the inserter part yet though.

Okay, tried the inserter already. The packfile.pak.new doesn't work. But you can work around the problem by insert the other outputs, FPAK_BattleText.fpak and FPAK_DialogueText.fpak, at their corresponding addresses (EC4C, and 1321AC0) in the packfile.pak. I don't know if other HexEditors can do it or not. (You just need to copy one file at paste to another file.) But you can use CrystalTile2's Edit-->Import Image to do this. (Let me know if you need more instructions on this importing step.
happy.gif
)
 

dnniwa485

Well-Known Member
OP
Member
Joined
Oct 4, 2009
Messages
458
Trophies
0
XP
13
Country
@jjjewel

thank you for the reply, as you see im really bad at hex editors, but ill be pleased if you PM me the detailed steps how to do it.

With ScreenShots or not, its fine for me, as long as its detailed.
 

jjjewel

Well-Known Member
Member
Joined
Dec 17, 2009
Messages
1,010
Trophies
0
XP
522
Country
United States
dnniwa485 said:
@jjjewel

thank you for the reply, as you see im really bad at hex editors, but ill be pleased if you PM me the detailed steps how to do it.

With ScreenShots or not, its fine for me, as long as its detailed.

Here's a zip file with instructions and some screenshots.
http://www.mediafire.com/file/mzwjhxzgrzm/...ileTutorial.zip

*Forgot to add in the instruction that in step 1, the packfile.pak is the one with Ouran font.

(The instructions above, I assumed that you already figured out how to use azerty1's negitool v.1.2 and you have a copy of CrystalTile2 with English user interface.)

Let me know if you have any questions.
 

dnniwa485

Well-Known Member
OP
Member
Joined
Oct 4, 2009
Messages
458
Trophies
0
XP
13
Country
testnegi.jpg


thanks I got it now.. just re-aligning the text for now, its kinda messy when i inserted it on the game, causing the text between words to break another line.. xD

anyway getting ready for beta patch, and it might gonna take for a while.

Thanks jjjewel, azerty. I owe you for your contribution in this project..
happy.gif


** anyway can we do something on the Prologue of the game, its kinda semi centered as I see it on the game.
 

jjjewel

Well-Known Member
Member
Joined
Dec 17, 2009
Messages
1,010
Trophies
0
XP
522
Country
United States
dnniwa485 said:
** anyway can we do something on the Prologue of the game, its kinda semi centered as I see it on the game.

The prologue text is in arm9.bin. I don't know if I can do anything with the alignment. Anyway, I extract it for you here;
http://www.mediafire.com/file/w5jnzbnt0cb/arm9.txt

I also included other texts like names and stuff from arm9.bin that you need to translate as well. Some are game credits so I don't know if you want to translate them but I extracted them anyway.
If you can translate these and upload the file for me, I can try to see if I can do anything with the insertion. (Just put translation after the "," for each line.) The prologue is the bottommost part. Somehow the lines didn't appear in order as they are shown in the game. You can translate the text based on what appears in the game first but when you put the translation in this arm9.txt, you will have to arrange it according to the order in arm9.txt.

P.S. The names in the first part are probably the names appear in dialog box. If so, there will be a limit for the text length you can use. (I guess it's 12 characters but I'm not sure.) So try to translate them as short as possible. In some cases where the character has a long name and you can fit the whole name in a dialog box, you will have to choose whether you want to use the first name or the last name.
 

dnniwa485

Well-Known Member
OP
Member
Joined
Oct 4, 2009
Messages
458
Trophies
0
XP
13
Country
maybe try inserting it now..
QUOTE said:
000AD228 (probably some character names from the game)
-------------
Takahata-sensei,
Negi Springfield,
Kamo-kun,
Seinen, (maybe we can call it Young Boy, but lets leave it as is)
Zazie Rainyday,
Oni,
Ku Fei, (///)
Kaede Nagase, (nagaze?)
Kugumiya Madoka,
Evangeline A.K. McDowell, (Eva in short... just in case that it wont fit)
Suzune,
Ryugu Mana, (who the heck is this)
Naba Chizuru,
Yukihiro Ayaka,
Yuuna Akashi, (in case the font support some characters, change Yuuna to Y?na)
Sayo Aisaka,
Asakura Kazumi,
Kakizaki Misa,
Izumi Ako,
Yotsuba Satsuki,
Murakami Natsumi,
Ayase Yue,
Narutaki Fuka,
Sakurazaki Setsuna,
Shiina Sakurako,
Kasuga Misora,
Black Robe Man, (the heck can we have some decent name)
Hakase Satomi,
No Name, (fuck? maybe we can use Inai no Nama-e or Nanashi-san)
Hasegawa Chizuru,
Miyazaki Nodoka,
No Name, (same as above)
Yukihiro Ayaka,
No Name, (....)
Karakuri Chachamaru,
Konoe Konoka,
No Name, (hu?)
No Name, (ok how many people doesnt have name here)
Okochi Akira,
Kagurazaka Asuna,
Saotome Haruna,
Sasaki Makie,

000AD838 (some save dialogues? hmm weird)
-------------
Save the game from this slot?,
Load the Save game from this slot?,
The Slot will replace with a New Save.,
The Slot is not used.,
Saving the game,
The game has been saved,

000AD9C0 (some menus?)
-------------
The occha? and the kono kaze,@that came from the mist country. (sorry its kinda twisted, dunno what does this means)
Our precious Black Rose Baron@the Hero of Goodwill, Love and courage, (dunno, there might be another meaning though)
..it's the casino.,

000ADC20 (battle? maybe incomplete)
-------------
Set the items.@,
Choose a Character.@,

000B0C20 (the casino)
-------------
Set your BET.,
You dont have enough money.,
You dont have enough money.,

000B0E20 (baron's shop)
-------------
Welcome to the Item Shop., (maybe. we can call it Black Rose Shop, but were using item shop on this matter)
How much you want?,
Is this OK with you?,
Thank you..,
You dont have enough money.,
You cant have more., (maybe the shop keeper tells me that my item slot is full so i cant buy anymore.)
Buy, (maybe this is better)
Exit,

000B0F14 (the ZOO park, aka training ground)
-------------
Choose the level of your training.@,
You dont have enough money.,
Is it too easy for you?@There a new level preapred for you.,

000B15F8 (it might be credits)
-------------
??,
??,
??,
???,
???,
???,
????,
????,
????,
????,
????,
????,
????,
????,
????,
????,
????,
????,
????,
????,
????,
????,
????,
????,
????,
????,
????,
????,
????,
????,
????,
????,
????,
????,
????,
????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,
?????,

000B2110 (credits part2)
-------------
??????,
??????,
??????,
??????,
??????,
??????,
??????,
??????,
??????,
??????,
??????,
??????,
??????,
??????,
??????,
??????,
???????,
???????,
???????,
???????,
???????,
???????,
???????,
????????,
????????,
????????,
?????????,
?????????,
?????????,
?????????,
?????????,
?????????,
??????????,
??????????,
???????????,
???????????,
???????????,
???????????,
???????????,
?????????????,
??????????????,
??????????????,
????????????????,
????????????????,
????????????????,

000B2664 (The prolugue) (17lines)
-------------
Negi Springfield, a 10 year old boy who graduated from the
Magic School of wales.

He was assigned to be a teacher in Mahora Academy in Japan.
The class he assigned to has a full of unique(atrashi?) students.

Though he used to be teased with his students, but he still trying his best
for he to become a Full Fledge Mage, just like his father.

But incidents is keep coming from around them.!?

the credit is not translated though..
biggrin.gif
or maybe include our names on the credits for the translation
biggrin.gif
 

jjjewel

Well-Known Member
Member
Joined
Dec 17, 2009
Messages
1,010
Trophies
0
XP
522
Country
United States
For the prologue part, can you try making it in this format;

Negi Springfield,
a 10 year old boy who graduated
from the Magic School of wales.

He was assigned to be a teacher
in Mahora Academy in Japan.

The class he assigned to
has a full of unique students.

Though he used to be teased
with his students, but he still
trying his best for he to become
a Full Fledge Mage,
just like his father.

But incidents is keep
coming from around them.!?

Just make the line breaks in the way you want them to appear in the game. I can manually insert and change the alignment for you. (It will take me forever to write a program for this. It's a lot easier for me to do it manually.)

The original text is here;
(Just ignore the numbers and stuff before them.)
0028,00C0,020B26F0,11,???????????
0030,00E0,020B26C0,10,??????????
0010,0100,020B27AC,14,??????????????

0018,0140,020B2790,13,?????????????
0028,0160,020B2708,11,???????????
0040,0180,020B2664,08,????????

0028,01C0,020B26D8,11,???????????
0030,01E0,020B2678,10,??????????
0030,0200,020B26A8,10,??????????

0030,0240,020B2690,10,??????????
0020,0260,020B273C,12,????????????
0018,0280,020B2774,13,?????????????
0010,02A0,020B27CC,14,??????????????

0020,02E0,020B2758,12,????????????
0048,0300,020B2530,07,???????
0020,0320,020B2720,12,?????????…??

You don't have to make line breaks the same as the Japanese though. Just try to keep number of lines to be 16 or less and each line shouldn't have more than 36 characters (including punctuations.)

I'm pretty sure I can take care of the alignment, so take your time to translate the lines and you can give it to me later. No need to hurry. (Since I'll have to insert it manually, it'd better be the finalized translation.)
 

dnniwa485

Well-Known Member
OP
Member
Joined
Oct 4, 2009
Messages
458
Trophies
0
XP
13
Country
hmmm. maybe the last line need to be re-phrase.

oh well ill give it a shot later on, playing another game though, hahaha (kinda offtopic but im playing Hayate no Gotoku - Gakkou hen)

anyway, thanks for the hardwork, just give me a hit if there are some text that needs to be translated again.
 

suruz

Well-Known Member
Member
Joined
Oct 1, 2007
Messages
607
Trophies
0
Website
Visit site
XP
338
Country
Looking through the names, most of them are fine but some are the wrong way round..

Not trying to be picky - just saying you should name people consistently (all in the same way)

You can see what I mean on this page:
List of Negima characters

Also there are a few slight strange bits...

Like Black Robe Man should be Black Rose Baron (He's in the second anime... this game is based on that, so it makes sense)

Sorry for being picky, but it would be more annoying to go back and change all the stuff later right?
tongue.gif

-------------

Aside from that, good luck with the translation! I'm happy you guys are making progress
wink.gif
 

dnniwa485

Well-Known Member
OP
Member
Joined
Oct 4, 2009
Messages
458
Trophies
0
XP
13
Country
well sorry about that, and as i said earlier on this discussion, i didnt watch the animation yet, and i dont know who is that anyway.

anyway ill take note on that, and i hope you guide me along way with this one. As i dont know who are them. (i have my own wiki about negima so i dont relay too much on them)

Format about the name translation (or rather i just did some Romanization on it)

--

note:well theres one exemption on this, which is involvement of Eva-chan's name ... which we know that her name was based on english/roman name
note2: we know that some character in negima, some of them were called on their first name, and some of them on their last name, so I decided to include the whole name instead.
note3: the format of the names were based according to negi's student book list . In my Memory (according what i read on manga) if you want, read the manga around chapter 20 or something, they released the full student list of class 2-A, though i didnt see the official class 3-A list yet(why? well follow the story the manga, and somehow the school life genre on the manga was put aside "temporarily" until the arc is finished)
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    SylverReZ @ SylverReZ: https://www.youtube.com/watch?v=L4mQnp4H0fk