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

jjjewel

Well-Known Member
Member
Joined
Dec 17, 2009
Messages
1,010
Trophies
0
XP
522
Country
United States
I'm not sure if I can help much with this game. I just browsed the forum and found this thread so I thought I'd give this one a try
smile.gif
.

Anyway, I got some more info for this game. If you search the main .pak file, you'll see some occurrences of "RTFN"+"FINF" pairs which indicated that this game used NFTR fonts. But you'll need a way to unpack and decompress them if you need to change the font, and then find a way to compress and correctly pack the file(s) back to .pak file. I'm not sure how the whole .PAK file work. You might want to separate all the FPAK into individual files and decompress only the ones you want to edit and put them back together.

By the way, azerty1, can you write a tool that include a compression/decompression routines in your text extractor/inserter too? If so, do you write your own LZ compression codes or you use an external tool? (I'm just curious. If you can do so, I'll probably need your help with some of my projects.
happy.gif
)
 

azerty1

Well-Known Member
Member
Joined
Mar 22, 2009
Messages
160
Trophies
0
Age
29
Website
Visit site
XP
99
Country
Canada
oh, i got the lz77 comp/decomp methods and libraries from Darthnemesis' BatchLZ77, which was basically a batch version of Nintenlord's LZ77 tool.
But yeah, i can use them in my extractors and inserters.

this game, however, i can't really figure out how to work with it since all the FPAKs have similar headers yet the only pattern i have noticed is that all the dialogue text ones have 16 FFs prior to the compressed text. That's not enough to help me find the font, though, so even if it is NTFR, we still need to find it...
 

jjjewel

Well-Known Member
Member
Joined
Dec 17, 2009
Messages
1,010
Trophies
0
XP
522
Country
United States
azerty1 said:
oh, i got the lz77 comp/decomp methods and libraries from Darthnemesis' BatchLZ77, which was basically a batch version of Nintenlord's LZ77 tool.
But yeah, i can use them in my extractors and inserters.
Wow, that's so cool. I'll PM you later about the helps I need. Thank you in advance.
happy.gif


QUOTE(azerty1 @ Apr 3 2010, 06:09 PM) this game, however, i can't really figure out how to work with it since all the FPAKs have similar headers yet the only pattern i have noticed is that all the dialogue text ones have 16 FFs prior to the compressed text. That's not enough to help me find the font, though, so even if it is NTFR, we still need to find it...
I don't really understand the FPAK pattern either. But seemed like for some regular, uncompressed files, you can just extract the parts and do something with them and then pasted them back. NFTR files are one of those. There are 2 NFTR files and the one that the main dialog used is from Hex Address 151F6E8 - 1538790 in packfile.pak. (Here's the link to this NFTR file if anyone needs it. http://www.mediafire.com/file/e0qmvzahwlo/...ile.pak2d.nftr) You can load this file in CrystalTile2 to view the tiles or use NFTRedit program to change the width of Shift-Jis's English alphabets. Here's a pic of what I changed. (I messed up the color a bit so it looked quite ugly.
tongue.gif
The fonts I changed are the first 3 characters, A a b)

41537127.png


So the font now isn't much of a problem. But to make a successful text insertion in this case, you'll probably have to figure out the pointers and how to compress the uncompressed texts back to the file and won't mess up anything else in the packfile.pak.


- More info about FPAK
Some of the FPAK files have LZ compression indications before the magic stamp FPAK. If you search for the word FPAK and see 5 bytes before the word FPAK in this pattern:
10 xx xx 00 00 (and then follow by 46 50 41 4B for the word FPAK), you can decompress the file starting from the byte with value 10. I've tried a few places and got a few graphic files.
 

azerty1

Well-Known Member
Member
Joined
Mar 22, 2009
Messages
160
Trophies
0
Age
29
Website
Visit site
XP
99
Country
Canada
one last thing. do you happen to know how to find the end of each FPAK file? I've tried looking for 000000, but that sometimes shows up in the middle of the file, and just looking for the next FPAK gives me some weird crap that won't get decompressed.
 

jjjewel

Well-Known Member
Member
Joined
Dec 17, 2009
Messages
1,010
Trophies
0
XP
522
Country
United States
suruz said:
EDIT: Just to clarify for anyone reading, this is an actual strategy/fighting game as far as I know, not just a typical text-based anime game. So its well worth translating
smile.gif
Urgh... I just noticed this. Actually I enjoy playing a typical text-based anime game but I really hate the strategy/fighting game. So I just spent a few minutes playing this game and found it super boring for me. T_T So don't count on me much on this project. (Really sorry. I expected that this would be more of a text-based game. I lost my interest in this game when I reached the fighting part.)

Anyway, I might still help azerty1 figure out the FPAK pattern. (Yep, to me, finding patterns in game files is a lot more fun than actually playing this game.
happy.gif
) So far, I can see the different patterns for how to locate the next FPAK files. Here's what I got

(It's a pretty long explanation so I put it in a spoiler tag.)
Strategy 01
===========
For FPAK followed by 00

At 0000 you got FPAK followed by 00 (So your Hex are 46 50 41 4B 00). The next FPAK offset is located at the next 8 bytes, so at 0008-0009 you get hex value 9C01. Switch byte to get 019C and add to the start Hex which is 0000, so 019C+0000 = 019C. That's the next occurrence of FPAK.

At 019C, you get 00 after your FPAK again. So the next FPAK offset is also at the next 8 bytes (019C + 8 = 01A4). Switch A400 there to get 00A4. Your next FPAK occurrence is at 019C+00A4= 0240.

Then at 0240, you'll see FPAK followed by 01. You'll need a new strategy to determine the next FPAK.

----------------
Strategy 02
===========
For FPAK followed by 01

At 0240, you got FPAK followed by 01 (46 50 41 4B 01). For example, at this location the bytes after FPAK will be 01 00 42 00 90 00 F8 01...

01 00 means the files in this FPAK are compressed. (I guess, but it seems to apply well.)

42 00, switched bytes to 0042, is the hex number of total files. In this case 42 hex = 66 dec. So you'll have 66 compressed files packed inside this file.

9000 (switched to get 0090), F801 (01F8), and so on, will be the offsets of you compressed files. (And if you count them, you get a total of 66 values which is equal to the number of files indicated from the above step.) The first location is 0240+0090 = 02D0. You'll see the byte starts with 10. Next is 0240+01F8= 0438. Another one starting with 10. So you'll need to separately extract and decompress these files if you need to do something with them.

The last one in the offset series will indicate your next FPAK. Ex. you know you have 66 offsets and each offset requires 2 bytes. So 66*2 = 132. Change 132 to hex = 84. The first offset location is 8 bytes after 0240, so the last offset will be at 84+8+0240 = 02CC. At 02CC you get value of 14AB, switch them to get AB14. Your next FPAK is at 0240+AB14 = AD54.

---------------------
Strategy 03
===========
When things start to get weird

At 15E60, you got FPAK00. The next 8 bytes gives you 0058 which gives you all FFFFFFFF bytes.

In this case, from 15E60 read the next 4 bytes each for each pointer to the next LZ compression indication before each FPAK. (You'll get 0068, 8618, AB8C, 0127CC, ...)

If you read the bytes that follow FPAK, you'll see 00 00 13 00.
00 00 means this file itself is not compressed.
13 00, switched it to get 0013 is again the total number of offsets within this FPAK. (13 Hex = 19 Dec) so you'll get 19 FPAK offsets from this file.

Follow the offsets and you'll get the LZ compression indication followed by FPAK. (The format is 10 | xx xx 00 00 | 46 50 41 4B | 01 00). So for these FPAK files, you need to decompress from the leading byte with value "10".

Then, locate the last offset for the offset of the new main FPAK file. In this case, the 4 bytes right before you reach FFFFFF... bytes, which is at 15EB4 with value of 60740500. Switch bytes to get 00057460. (You can also calculate it based on number of offsets and that each offset requires 4 bytes, blah blah... I'm just too lazy to put a formula here.) Then 15E60+057460 = 6D2C0.

At 6D2C0 you'll get another FPAK that contain FFFFFF, so you'll probably have to appy this Strategy 03 to find the next FPAK's. (I just quit testing here.)

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

So that's all I figured out so far, if you find any patterns not covered in these strategies, please give me the hex address of the FPAK files, so I can take a look.
happy.gif
 

suruz

Well-Known Member
Member
Joined
Oct 1, 2007
Messages
607
Trophies
0
Website
Visit site
XP
338
Country
Ahh okay. I love text based games too but I actually found it refreshing to see an anime game that isn't just a story/visual novel type game.

There does seem to be a lot of text and narrative though, which is good for negima fans
smile.gif
(but hard work for the translator... xD)

I'll leave the technical stuff to you gaiz, as I have no idea what any of that lengthy explanation meant...
 

azerty1

Well-Known Member
Member
Joined
Mar 22, 2009
Messages
160
Trophies
0
Age
29
Website
Visit site
XP
99
Country
Canada
i'm starting to get a bit busy lately, so it'll take me some time to finish this thing. I'll post here if i run into any more potholes...
 

jjjewel

Well-Known Member
Member
Joined
Dec 17, 2009
Messages
1,010
Trophies
0
XP
522
Country
United States
dnniwa485 said:
ohhhh... nice move guys, keep it up.. im counting on you guys on hacking
happy.gif

Well, there are something you need to take care of or at least find someone who can do these for you.

- Edit the NFTR Font
---Check whether you can import other games' NFTR to this game or not. (I tried but I only had a few NFTR fonts stored in my computer and I didn't have the one with the same tile size so none of them worked.)
---Check whether you can map the ASCII English alphabets to your NFTR or not. (Currently, one possible way to display English alphabet in this game is to alter the Shift-Jis English Alphabets since there is no ASCII font in the game's NFTR file.)
---If you can map ASCII English alphabet, then it shouldn't be much of a problem. If you can't, you'll need to redraw the English alphabets in your NFTR File and rewrite the width and offset. (NFTRedit program works well for this task. The program is available in this forum.) You'll also have to ask azerty1 to convert the character code to Shift-Jis characters in the text inserter program too. (Also, be careful with the text length. Shift-Jis font requires 2 bytes each (compared to 1 byte each for ASCII) so there may be cases that you have to shorten your translation to fit in the available space.)
 

azerty1

Well-Known Member
Member
Joined
Mar 22, 2009
Messages
160
Trophies
0
Age
29
Website
Visit site
XP
99
Country
Canada
jjjewel said:
dnniwa485 said:
ohhhh... nice move guys, keep it up.. im counting on you guys on hacking
happy.gif

Well, there are something you need to take care of or at least find someone who can do these for you.

- Edit the NFTR Font
---Check whether you can import other games' NFTR to this game or not. (I tried but I only had a few NFTR fonts stored in my computer and I didn't have the one with the same tile size so none of them worked.)
---Check whether you can map the ASCII English alphabets to your NFTR or not. (Currently, one possible way to display English alphabet in this game is to alter the Shift-Jis English Alphabets since there is no ASCII font in the game's NFTR file.)
---If you can map ASCII English alphabet, then it shouldn't be much of a problem. If you can't, you'll need to redraw the English alphabets in your NFTR File and rewrite the width and offset. (NFTRedit program works well for this task. The program is available in this forum.) You'll also have to ask azerty1 to convert the character code to Shift-Jis characters in the text inserter program too. (Also, be careful with the text length. Shift-Jis font requires 2 bytes each (compared to 1 byte each for ASCII) so there may be cases that you have to shorten your translation to fit in the available space.)
yeah...that stuff i can't do. I have no experience with graphics and have no intention on getting any because it hurts my eyes and is rather difficult because i'm colour blind.

I can convert the ascii characters into 2-byte ones, if needed, but if we're going to do that, then we are definitely going to need to be able to expand the files, which means a 1:1 ratio japanese character to english character...try to translate ?? in two letters? not gonna happen.
 

suruz

Well-Known Member
Member
Joined
Oct 1, 2007
Messages
607
Trophies
0
Website
Visit site
XP
338
Country
I tried using Darth's NFTR editor, and I could open the NFTR file, but I don't think his program has support for actually adding new characters yet.. Not like there's blank spaces for the ASCII letters which I can just edit.

Also I have a 15x15 font I found lying around but
1) Its not even the right size
2) It uses a different pallette (this one is grey text with black shadows i think.)

Anyway the latest version of his editor is here: http://gbatemp.net/index.php?showtopic=105060&hl=NFTR
Don't know if it will help in this case, but its a great tool :/

EDIT: The font also doesnt have any Greek/Cyrillic characters which we could change to ASCII... like what had to be done for Summon Night X. So I dunno...

The idea of converting the J-ASCII characters to ASCII is okay, but then there would be a severe lack of space.. And I'd hate for this to be an "engrish" translation @_@
 

azerty1

Well-Known Member
Member
Joined
Mar 22, 2009
Messages
160
Trophies
0
Age
29
Website
Visit site
XP
99
Country
Canada
suruz said:
I tried using Darth's NFTR editor, and I could open the NFTR file, but I don't think his program has support for actually adding new characters yet.. Not like there's blank spaces for the ASCII letters which I can just edit.

Also I have a 15x15 font I found lying around but
1) Its not even the right size
2) It uses a different pallette (this one is grey text with black shadows i think.)

Anyway the latest version of his editor is here: http://gbatemp.net/index.php?showtopic=105060&hl=NFTR
Don't know if it will help in this case, but its a great tool :/

EDIT: The font also doesnt have any Greek/Cyrillic characters which we could change to ASCII... like what had to be done for Summon Night X. So I dunno...

The idea of converting the J-ASCII characters to ASCII is okay, but then there would be a severe lack of space.. And I'd hate for this to be an "engrish" translation @_@
ok...then the font makes a second problem. and it wouldn't be engrish. It would be lolspeak. Lolspeak without vowels.

The extractor is working, yes, i can pull stuff out and decompress them correctly better than crystal tile can, with some small bugs that i will fix...someday...soon, hopefully...
Problem? There are a lot of files. Most of them are less than a kilobyte and whatever, but there is no consistent way to run through them to find all the graphics files, much less all the text files. There is nothing consistent in the headers, nothing consistent in the files to distinguish anything from anything.
even though we can find and unpack all those FPAKs, it's useless if the crap that comes out of them are nothing but raw data.
 

suruz

Well-Known Member
Member
Joined
Oct 1, 2007
Messages
607
Trophies
0
Website
Visit site
XP
338
Country
Yeah... I decompressed all the files using CT2 into a folder, but you're right.. there's LOAAADS of them and don't know which ones contain text, graphics or anything.

I edited all the J-ASCII characters in the NFTR file to be smaller in width... If the size can somehow be expanded to fit more dual-byte characters then problem solved.. I couldn't even find the text in the pakfile so I have no idea how to insert anything @_@

My NFTR: http://www.mediafire.com/?qnznmymtzyq

Preview:
33u52pw.png
 

dnniwa485

Well-Known Member
OP
Member
Joined
Oct 4, 2009
Messages
458
Trophies
0
XP
13
Country
thanks suruz... for working in the font...
biggrin.gif


now the 2nd prob is.. theres a bunch of files, that scenario is similar with RF2 which consists of 10k files if im not mistaken.
 

jjjewel

Well-Known Member
Member
Joined
Dec 17, 2009
Messages
1,010
Trophies
0
XP
522
Country
United States
suruz, you can check DarthNemesis's NFTR Edit thread. He explained something about CMAP there. The CMAP is what you need to change to remap the current font to ASCII alphabets.

Or if you want to try it yourself, use Crystaltile2's Tools--> NFTR editor. There's a little triangle at the bottom. Click it and open your NFTR file from NFTR button. There you'll see lists of CWDH and CMAP. (CWDH is like a collection of width/offset for each font and CMAP is how to map the fonts to your character encoding.) Then try checking these values when you open other NFTR files that support ASCII. You'll see some differences. Note the differences. Then open the NFTR Files in Hex Editor and search for "PAMC" which is your CMAP section. Try to figure out the relationship between the information you got from NFTR Editor and the Hex values you see in HexEditor. Then try changing some values and open the file in DarthNemesis's NFTR Edit and type something to check how your remapping works. (Kind of a delicate process and this will take sometimes. I can confirm that it's possible to map the current font to ASCII code but I still couldn't map it correctly.)

(Feel free to ask for more details if you're really trying to do it. I don't want to type a very long explanation when I know no one will follow.
tongue.gif
)

Anyway, you might want to check with DarthNemesis and see if he has made anything that could help you deal with the CMAP.
-------------------------------

For the text, I believe you'll get one file at FPAK at Hex EDCC, then another at 0131FF48. The one at 0131FF48 seems to contain all the dialog text. So you might want to decompress the sub-files there and put them in separate folder or something so you know they are text and will need to be edited. (FPAK at EDCC contains dialogs when you fight, I guess.) You also have some text to translate in Arm9.bin too. (More like system dialogs, ex. Confirm saving, confirm deleting files, etc.)

Other FPAKs mostly contain graphics. (I just randomly check them so I can't confirm, but most of them are graphics.) Some of them contain "RECN," "LBAL," "RGCN," "RAHC,", etc. These are animation graphics (including buttons, texts that are stored as graphics, etc.) Then there are some files that don't have any of these magic stamps, but you can view them in Tile editor and see graphics. (Most of the latter case are backgrounds and special CGs.) I don't know any easy way to check for these except to really open them in TileEditor and check one by one.
wacko.gif
 

azerty1

Well-Known Member
Member
Joined
Mar 22, 2009
Messages
160
Trophies
0
Age
29
Website
Visit site
XP
99
Country
Canada
jjjewel said:
For the text, I believe you'll get one file at FPAK at Hex EDCC, then another at 0131FF48. The one at 0131FF48 seems to contain all the dialog text. So you might want to decompress the sub-files there and put them in separate folder or something so you know they are text and will need to be edited. (FPAK at EDCC contains dialogs when you fight, I guess.) You also have some text to translate in Arm9.bin too. (More like system dialogs, ex. Confirm saving, confirm deleting files, etc.)

Other FPAKs mostly contain graphics. (I just randomly check them so I can't confirm, but most of them are graphics.) Some of them contain "RECN," "LBAL," "RGCN," "RAHC,", etc. These are animation graphics (including buttons, texts that are stored as graphics, etc.) Then there are some files that don't have any of these magic stamps, but you can view them in Tile editor and see graphics. (Most of the latter case are backgrounds and special CGs.) I don't know any easy way to check for these except to really open them in TileEditor and check one by one.
wacko.gif
If those two files are all that i need to worry about, then that simplifies things a lot.
In that case, I won't bother with the graphics and stuff, and just focus on figuring out how to insert and extract the dialogue text.
With luck, the only pointers i will need to care about are the ones in the main FPAK header.
 

suruz

Well-Known Member
Member
Joined
Oct 1, 2007
Messages
607
Trophies
0
Website
Visit site
XP
338
Country
About the font, DarthNemesis replied to a PM that I sent him just now and he (somehow) added spaces for ASCII characters in the Negima font!

I tweaked it as much as I could, like I had done for the J-ASCII letters..

The font is here: New font with ASCII

Preview:
9u83eo.png



So HOPEFULLY, there won't be a problem with the game showing ASCII letters now.
However, he did say this, which worries me a little...
QUOTE said:
I can't guarantee that the game will support single-byte characters even if you add them to the font
 

jjjewel

Well-Known Member
Member
Joined
Dec 17, 2009
Messages
1,010
Trophies
0
XP
522
Country
United States
suruz said:
However, he did say this, which worries me a little...
QUOTE said:
I can't guarantee that the game will support single-byte characters even if you add them to the font

I think it will work. I tried changing the CMAP once and got the game to display Ascii font with no problem. (My problem back then was the CMAP itself because I couldn't map the alphabets correctly. When I typed Ascii "a b c" in hex Editor, it was displayed as "p q r" in the game.)

Anyway, you will need a proper way to put this new NFTR back in the file. (The size is different from the old NFTR so it can't be simply copy-pasted into the fpak.)
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    SylverReZ @ SylverReZ: @OctoAori20, Cool. Same here.