SM64 Segment 02 « 1 2
Users browsing this thread: 1 Guest(s)

I converted the SM64 segment 02 assembly to armips. There are several advantages to armips over bass, but one notable feature this uses is the string mapping to match words like "the" and "you" during the dialog encoding. This makes the strings easier to read and manipulate. For example, bass:

db "Hey! Knock it off! That's\n"
db "_ second time `'ve\n"
db "nailed me. Now `'re\n"
db "asking for it, linguine\n"
db "breath!", 0xFF

and armips:
.stringn "Hey! Knock it off! That's\n"
.stringn "the second time you've\n"
.stringn "nailed me. Now you're\n"
.stringn "asking for it, linguine\n"
.stringn "breath!", 0xFF

Attached to this post are an archive of the armips assembly, an updated bass assembly, and the texture files they reference. You can build them with:
$ armips segment02.armips.asm
$ bass -o segment02.bass.bin segment02.bass.asm


Attached Files
Size: 188.01 KB / Downloads: 33 .zip   sm64.segment02.zip


I've been looking at segment 02 in (J) and Shindou ROMs. Of course the major difference is the dialog font and text. The font itself is encoded as 1bpp instead of IA4. It includes numbers 0-9, uppercase Latin characters, hiragana, and katakana, as well as some punctuation. To add ten-ten or maru diacritics, 0xF0 or 0xF1 is prepended to the character byte. For example, the encoding of "ワープどかんを" is 9B 9F F1 8B F0 53 45 6D 6C. Newline is 0xFE, space is 0x9E, end of string is 0xFF, while full stop "。" is 0x6E (uses same 0xF1 texture as maru diacritic). Below is the full encoding table. Since not too much else is different, I will try to convert the segment 02 to assembly as well.
[Image: super_mario_64:dialog_table_j.png]
(This post was last modified: 23-06-2017, 07:53 PM by queueRAM. Edit Reason: wiki links )

I've deconstructed the (J) and Shindou segment 02 and dropped support of the bass version of (U). You can build with armips. File are UTF8 encoded. The string mapping in armips made this process relatively easy (see included sm64.j.dialog.tbl). This allows for human-readable strings to be used in the assembly file, such as:
.stringn "ろうかは しずかに\n"
.stringn "あるきましょう。", 0xFF

Build with armips:
$ armips sm64.j.segment02.asm
$ armips sm64.shindou.segment02.asm
$ armips sm64.u.segment02.asm
$ md5sum *.bin
59ab5326e2dfd5dff784fea6a342e623 *sm64.j.segment02.bin
ce8006d43a3d518c4430d8e229d7b59c *sm64.shindou.segment02.bin
b78d4f69ee2b872c2fa013d3f58344b7 *sm64.u.segment02.bin
(This post was last modified: 20-03-2017, 04:50 AM by queueRAM.)


Attached Files
Size: 212.41 KB / Downloads: 23 .zip   sm64.segment02.zip


David recently noticed that segment 02 in the European SM64 ROM was significantly smaller than the other ROMS. From his notes:
ROM     Offset            Decompressed
US      0x108A40-0x114750 0x18A0E
Europe  0x0DE190-0x0E49F0 0x0E0CE
Japan   0x1076D0-0x112B50 0x15BAE
Shindou 0x0E42F0-0x0EF770 0x15BAE

I looked into it and it turns out that since the European ROM contains translations for English, French, and German, the encoded dialog text is broken into three additional MIO0 blocks instead of being included in segment 02. Those blocks are:
Language Offset   Decompressed
English  0x0E49F0 0x9D24
French   0x0E9F50 0xB12C
German   0x0EF960 0xAD80

Looking at the segmented addresses contained within these blocks, it looks like they are loaded into segment 0x19.

It looks like the function at 8026B05C returns the selected language (halfword stored at 0x802030d2) and this is used to determine the correct base address of the dialog tables in segment 0x19. This is done many places throughout the code. One example, which uses 0x19009b9c for English, 0x1900a120 for French, or 0x19009cbc for Deutsch:
Code:
// 802B00DC / 06F8DC
proc_802B00DC:
 addiu $sp, $sp, -0x38
 sw    $ra, 0x1c($sp)
 jal   GetLanguage // 8026B05C
 sw    $s0, 0x18($sp)
 lui   $a0, 0x8030
 addiu $a0, $a0, -0x29b0
 beqz  $v0, @@IsEnglish
 sw    $v0, ($a0)
 addiu $at, $zero, 1
 beq   $v0, $at, @@IsFrench
 lui   $a0, 0x1901
 addiu $at, $zero, 2
 beq   $v0, $at, @@IsGerman
 lui   $a0, 0x1901
 b     @@LangSet
 nop  
@@IsEnglish:
 lui   $a0, 0x1901
 jal   SegmentedToVirtual // 802692F0
 addiu $a0, $a0, -0x7328
 b     @@LangSet
 sw    $v0, 0x30($sp)
@@IsFrench:
 jal   SegmentedToVirtual // 802692F0
 addiu $a0, $a0, -0x5ee0
 b     @@LangSet
 sw    $v0, 0x30($sp)
@@IsGerman:
 jal   SegmentedToVirtual // 802692F0
 addiu $a0, $a0, -0x6344
 sw    $v0, 0x30($sp)
@@LangSet:
 ...

SM64 Segment 02 « 1 2
Users browsing this thread: 1 Guest(s)


  EN ・日本語