nds fonts

Discussion in 'NDS - ROM Hacking and Translations' started by rastsan, Jun 15, 2010.

Jun 15, 2010

nds fonts by rastsan at 12:07 AM (5,208 Views / 0 Likes) 2 replies

  1. rastsan

    Member rastsan 8 baller, Death Wizard

    May 28, 2008
    So working on a couple translation projects, I stumble upon a font buried logically in a file that describes it Menufont.dat
    Now according to the one chinese wiki this is just another way to put a font in game... the problem though as compared to the .nftr style fonts is that this is much harder to change. As in an nftr most everything you need to change is in that file (if you wanted to change it)
    the difference being that in the .dat format all you might come across is the raw image and the stuff you need to change to change this font (width height offset, etc.) can quite literally be any where in any other file in game.
    The problem with that is- is that it makes it much harder to change things without some advanced knowledge of programming and assembly.

    Whats the point of this...
    Well now I have seen fonts in nftr's in dat's and buried within other files that needed custom tables made for them (like an after thought needed when developing).

    And now I just found another one in an overlay file (in zoids baltte coliseum, I knew it had to be somewhere other than the one nftr in game - but the overlay why?)
    Now I know that the overlays can be used to store pretty much anything the game may need, but why keep it there after having the nftr?
    I know that nftr's can't have different size of letters inside (side by side). they have to use a a different nftr for the bigger or smaller font.
    So after this I decided to start a thread asking any hackers translators and such about the strange places where they found fonts- nds wise?
    Well speak up I want to investigate the strange places they are in... and the possible ways top change them.
  2. azure0wind

    Member azure0wind 7 years flew so fast.

    May 24, 2009
    i dont hink they found the font in the NDS system...
    i think they just use the game font. i mean, they just edit the text like:
    Start, if i want to edit it to Pause i can. But using the game font, so i think you can't change the DS Game font...
  3. rastsan

    Member rastsan 8 baller, Death Wizard

    May 28, 2008
    Taken without permission, (thanks Kohos and whomever) it seems to talk about how to track a font...
    What I do not understand how to do is - how to change the asm instructions? or what with?

    <!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->With NO $ GBA to track and obtain the font address 来源: NdsBBS.COM 时间: 2008-10-15 进入论坛讨论 我要评论 Source: NdsBBS.COM Time: 2008-10-15 enter the forum I want to comment -
    地址:http://www.ndsbbs.com/read.php?tid=199678 Address: <a href="http://www.ndsbbs.com/read.php?tid=199678" target="_blank">http://www.ndsbbs.com/read.php?tid=199678</a>

    原作者:落木孤叶 Author: Fall on isolated leaves

    该篇主要讲述如何利用NO$GBA进行跟踪并获取字库地址,找到字库的地址可以说是汉化步骤的第一步。 The article mainly describes how to use NO $ GBA and get character address tracking to find the font of the address can be said that the first step of localization.

    根据GBA的图像系统篇的介绍我们知道,游戏要显示图片或者文字,都是向VRAM区写入数据然后交给显示回路处理。 GBA image system according to the introduction chapter we know that the game to display pictures or text, is to write data to the VRAM area and then to the display processing circuit. 要显示文字,当然就得从游戏的字库区中读取字模信息并传输进VRAM去。 To display the text, of course, the character from the game area would have to read font information and transfer into the VRAM to go. 各种游戏都有各自不同的传输方式,有的使用CPU方式传输、有的使用DMA进行传输、有的先将字串集中传输到一个临时内存区再统一传输到VRAM。 All games have different transmission, and some way of using the CPU transfer, and some use DMA to transfer some focus first string to a temporary memory area transmission and then transmitted to the unity of VRAM. 有繁杂一点的游戏还对字库信息进行压缩,在显示文字时再解压缩到一个临时内存区后传输到VRAM。 A complicated little game character information is also compressed, in the display text and then extract it to a temporary memory area after the transfer to the VRAM.

    接下来我就以《阴阳大战记-零式(日)》(ROM编号1833)为例,演示如何利用NO$GBA跟踪获取字库地址: Then I turned to "Yin Yang World War in mind - Zero (Day)" (ROM No. 1833), for example, demonstrates how to use NO $ GBA to track access to font address:

    1.首先我们启动NO$GBA主程序,并按F12打开ROM,运行到如下画面时 1. First, we start the NO $ GBA the main program, press F12 to open ROM, run the following screen

    中断游戏的运行,并按F5打开VRAM查看器,查看BG2(背景层2),这时我们就可以只看到游戏中显示的文字,将鼠标移动到“名”字的左上角第一个TILE上,可以在Details栏中看到这个TILE的地址是06008020。 Interrupt the game to run, and press F5 Dakai VRAM viewer, view BG2 (the background layer 2), then we can only see the text displayed in the game, move the mouse to the "name"字upper left corner of the first one TILE Shang can be seen in the Details column of the TILE address is 06008020.

    2.接下来,我们就要利用这个地址引出字模的真正地址,关闭VRAM查看器后按Ctrl+B设定内存断点“[06008020]!” ,然后按“*” 键重新启动。 2. Next, we'll use this address leads to the real address of font, close VRAM viewer and press Ctrl + B to set the memory breakpoint "[06008020]!", Then press "*" key to restart.

    3.在游戏运行过程中,可能会有多次中断,因为VRAM内存区是共用的,在不同的时候有不同的作用,向06008020这个地址写入数据的不只是在显示文字时,我们只要跳过,按F9让文字继续运行。 3. In the course of the game is running, may be interrupted several times because of VRAM memory area is shared, at different times have different functions, to 06,008,020 this address to write data, not just display text, we would just jump However, press F9 to continue running text.

    最后在我们选择了主菜单的第一个选项时,游戏会在这里中断: Finally, the main menu we selected the first option, the game will be interrupted here:

    ldrh r3,[r0,r5] ; 将地址r0加偏移r5的内存的半字读到r3 ldrh r3, [r0, r5]; will address offset add r0 r5 semi-word memory read r3
    strh r3,[r1,r5] ; 将r3的低16位写入内存地址r1加偏移r5 strh r3, [r1, r5]; the low-r3 16-bit write to memory address plus offset r5 r1

    从上面这段程序及寄存器r0的值我们可以知道,在显示“名”这个字时,程序从地址0821AFF4h处向06008020h传输数据。 This process and register from above the value of r0, we can know in the show, "Name" is the word, the program office from the address 0821AFF4h transfer data to 06008020h. 我们就可以猜测0821AFF4这个地址就是“名”字的字模地址。 We can guess 0821AFF4 this address is the "name" character font address.

    4.我们用TLP打开ROM,按Ctrl+G跳转到0021AFF4 ,就可以清楚地看到“名”的字模了。 4. We use TLP to open ROM, press Ctrl + G Jump to 0021AFF4, you can clearly see the "name" of the font was. 如果你有CtystalTile的话就更方便了,在导航栏中把宽度跟高度都设成16,然后点“间隔16/32”调整一下就可以非常地看清字模了。 If you have CtystalTile if more convenient, in the navigation bar to the width with the height set to 16, then "interval 16/32" adjustments can be great to see the font the.

    接下来我们只要将滚动条向上滚动就可以找到字库区的首地址了001B4E74。 Then we just scroll up scroll to find the first address of a font area 001B4E74.

    另一种获取字库的方法: Another way to obtain the font:

    如果说我们是根据自己的眼睛查看判断才知道字库的地址的,那反过来想一想,游戏程序是怎么得到这个地址的呢? If we are to judge according to their own eyes see only the address of that character, that in turn think about games is how to get this address it? 这个地址是以一个常量的形式存在于ROM的某个地方吗? This address is a constant presence in the ROM in the form of some place?

    那么我们就来试试用另一种比较准备的方法来找出字库的首地址,也可以找出存储字库首地址的地址(会不会有点晕呢?指针,在C语言里面就是一个比较难的部分)。 Then we'll try to use another method of preparation compared to the first address to find fonts, font storage, you can find the address of the first address (will not be a bit dizzy it? Pointer in C language which is a more the hard part).

    从中断处开始,仔细看看指令的地址,00000B92h,回顾一下内存篇讲的,这个内存处于系统ROM区,也就是说目前在执行的是系统的一个功能调用,猜测可能是CpuSet或CpuFastSet子程序。 Starting from the left off, look at instruction address, 00000B92h, review articles about memory, this memory is the system ROM area that is currently running a system function calls, guess could be CpuSet or CpuFastSet subroutine .

    先在断点窗口删除掉我们刚才设定的内存断点,然后按F8跳出当前子程序,这时会回到这个地址0803A1DEh(在这行调用了0812414Ch跟踪进去可以发现其实刚才那个是CpuSet)。 In the Breakpoints window, first delete the memory we have set the breakpoint, and then press F8 out of the current subroutine, then will return to this address 0803A1DEh (called in this line can be found inside 0812414Ch track that is actually just CpuSet).

    我在汉化教程里有不明白的地方,所以我问了BeQ,以下是BeQ对我的详细回答。 I finished the tutorial did not understand the place, so I asked BeQ, the following is a detailed answer to my BeQ.

    我问;“在“跟踪获取取字库地址”一文中,你提到 I asked; "in the" tracking obtain access font address "the article, you mentioned
    ldrh r3,[r0,r5] ; 将地址r0加偏移r5的内存的半字读到r3 ldrh r3, [r0, r5]; will address offset add r0 r5 semi-word memory read r3
    strh r3,[r1,r5] ; 将r3的低16位写入内存地址r1加偏移r5 strh r3, [r1, r5]; the low-r3 16-bit write to memory address plus offset r5 r1
    我不明白这是甚么意思。 I do not understand what this means.
    回答; Answer;
    首先r0+r5计算出一个内存地址,然后读取这个内存地址的值(半字,也就是两个字节),将这个值存入寄存器r3。 First of all, r0 + r5 calculate a memory address, then read the memory address value (half-word, which is two bytes), this value into register r3. 当然,strh就是反过来,把寄存器的值存入内存。 Of course, strh is, in turn, the register values into memory.
    比如,当前r0的值是08004630h,r5的值是16h For example, the current value of r0 is 08004630h, r5 value is 16h
    r3的值是00000000h r3 value is 00000000h
    而当前部分内存状态如下:(08004620h-0800464F) The current part of the memory state as follows: (08004620h-0800464F)
    08004620 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08004620 0,000,000,000,000,000 0,000,000,000,000,000
    08004630 6B 5E 30 31 48 FF 00 2E 26 37 45 00 00 00 00 00 08004630 6B 5E 30 31 48 FF 00 2E 26 37 45 00 00 00 00 00
    08004640 18 66 41 4C 87 1A 12 34 56 78 9A CE 67 39 81 33 08004640 18 66 41 4C 87 1A 12 34 56 78 9A CE 67 39 81 33
    在执行ldrh r3,[r0,r5]的时候,首先计算r0+r5,也就是08004630h + 00000016h = 08004646h In the implementation of ldrh r3, [r0, r5], the first calculation of r0 + r5, that is, 08004630h + 00000016h = 08004646h
    08004646h这个说是源地址,程序会把这个地址的值读出来,你自己找找这个地址在哪里吧是不是这里 08004646h that is the source address, the program will read out the value of this address, you Zhaozhao this address where it is not here
    12 34 56 78 12,345,678
    这一段 This section

    但ldrh,注意后面的h,表示只读半字,也就是两个字节,只读出12 34 这两个字节, But ldrh, pay attention to the back of the h, that read-only half-word, which is two bytes, read out the 1234 two-byte,
    所以读出来的值就是“3412”,为什么会反过来? Therefore, the value read out is "3412," Why turn? ? ? ? ? ? ?
    这是因为存储方式都是低位在前高位在后,先34再12,组合起来就是3412h This is because the stored high in the former are low after the first 34, then 12, combined to 3412h

    Author: kohos

    在网上逛了,没发现哪里有描述NDS文件格式的教程,所以趁着有点时间,就写了这篇文章。 Online shopping, and did not see where there is a tutorial describing NDS file format, so take advantage of a bit of time on writing this article.<!--QuoteEnd--></div><!--QuoteEEnd-->

    I know left me confused but it also helps in a way...

Share This Page