Moved

This blog has moved to http://blog.slashie.net/category/ultima/savage-empire-snes/

Sakkhra Caves

Further work on the script extractor, thanks again to Vehek for his tips to transform font table indexes into ShiftJIS characters.

Tasks now:

  • Find out the routine termination sequence for the dialog codes
  • Extract dialog options from the dialog code, and find out how they are mapped to each conversation

This is the output for dialog 16, somewhere within the hex there should be a meaningful termination sequence

Dialog 16

Charset:  ????はいえ熱夢アイエラフキンジミーディスナウトヨルリテム名前仕事治す部族さようならおかり、バタ。ニャの魔法がにオド谷言葉を話力与た長間冒れてだもっくこやろる決し手放で弟子ち大き傷負倒発見へ連来ばわ中と呼んまず彼探出帰酋本当感謝ぞ村戦士総娘東あそ者耳入ほ仲精霊不思議居場所知教遠住石都西クカ恐ぬ道沿行け通じ南隠里約束誰突止め助ロ会聞チョコパ捧げ物強授ポ私目戻自分生ッ祈師つ今使必要ぐ我!ズ苦痛取除…機嫌丈夫ど友み報告加護

94 26 02 0B 8D 8D B1 90 AB B8 BC 02 BD 02 BE 02 BF 02 C0 02 C1 02 C2 02 C3 02 C4 42 B9 C5 02 C6 82 C7 82 C8 02 C9 82 CA C2 C4 A9 10 96 4D 8D 9A AD 00

おかえり、アバタール。

8C 2F 8E

インターニャの魔法が、お前にイーオドンの谷の言葉を話す力を与えた。

01 01

アバタールよ。お前は長い間、熱に冒されていたのだ。だが、もう、すっかりよくなった。

01

お前に、このトーテムをやろう。この谷にいる間は、決して手放すでない。

C0 A9 10 BE 8A 81 00 C9 B6 BC 82 96 F0 8E BE 01 82 00

インターニャの弟子たちが、大きな傷を負って倒れているお前を発見して、ここへ連れて来た。

01

インターニャ、お前の傷を治した。だが、しばらくは熱に冒されて、うわ言を言っていた。夢の話だ。

8C 2F 8E B6 BD 82 96 59 8F BE 02 83 84 85 00

お前は夢の中で、アイエラとラフキンとジミーの名を呼んでいた。まずは、彼らを探し出すことだ。

8C 2F 8E B6 BE 82 96 2E 90 BE 03 00 9B 87 00 96 BB 8F

お前がアイエラを連れて帰ってくれたことを、酋長は本当によろこんで感謝していたぞ。

8C 2B 90

この村の戦士たちが、総出でアイエラを探している。アイエラは酋長の娘なのだ。

01

アイエラをさらったのはウラリ族だ。

BE 89 00 8C 2F 8E B6 BF 82 96 DC 90 BE 04 88 00

この村の東にある、ヨラルー族の村に、そのような名前の者がいると、インターニャの耳に入っている。

01

ラフキン、ほかの仲間を探すのに、とても力になると、精霊たちは言う。

8C 2F 8E B6 C0 82 96 44 91 BE

?インターニャ、不思議な夢を見た。夢は、ラフキンが、ジミーの居場所を知っていると教えてくれた。

8C 2F 8E B6 C1 82 96 86 91 BE 06 00

とても遠くに住んでいる部族だ。石の都ナウアトラの西だ。

8C 2F 8E B6 C2 82 96 FD 91 BE 07 86 00

ナウアトラ族は、彼らの石の都を、ティクティカトルと呼んでいる。

01 01

ナウアトラの西には、ディスキキの村がある。

8C 2F 8E B6 C3 82 96 7A 92 BE 08 87 00

恐れを知らぬ戦士の部族だ。この村から道に沿って東へ行け。

01 01

道はヨラルーの村に通じている。その南が、ナウアトラだ。

8C 2F 8E B6 C4 82 96 5E 93 BE 09 00

ウラリ族は隠れ里に住んでいる。精霊たちも、その場所を教えてはくれない。

01

だが、精霊は約束してくれた。ぐかがかならず、ウラリの村を我き!ズ、アイエラを苦け出すとな。

01

アイエラを苦けたければ酋長のア痛痛ンに取って話を除け。

8C 2F 8E B6 C5 82 96 27 94 BE 0A 00

このトーテムに…機嫌ラトルか丈インドを夫ど友にすると、み力な魔法の力をお前に報けてくれる。

01

ヨ告を夫ど友にすると、お前を加の護の前に?してくれる。

01 01

このほかのトーテムは、??の力で探すのだ。

8C 2F 8E B6 C6 82 96 67 94 BE 0B 00

?まれたときから、ずっとインターニャと呼ばれている。

8C 2F 8E B6 C7 82 96 D5 94 BE 0C 00

クーラ?ク族の?とう?をしている。精霊の言葉を除き、傷?いた者や、熱に冒された者を治す。

9B AD 00 96 D2 94 BE 8D 81 00 8C 2F 8E B6 C8 82 96 3A 96 BE 0D 00 AE 24 1D 1D 25 1D 96 A2 95

加には、なんでも治す、大きな力がある。さいわい、?のお前には、その力を?う??がない。

01

もし、インターニャの苦けがいるときは、お前にやったトーテムを?い、す?に帰ってくるのだ。

9B AD 00 96 9F 95 BE 8A 00 8C 37 96 A2 1D 1D 25 1D

精霊よ、?に力を与えたまえ?

01 01 01

クク?の精霊よ、これなるアバタールの??を?り?き、その傷をいやしたまえ??

01

精霊の??はよかった。もう大??だ。

8C 2F 8E B6 C9 82 96 F7 96 BE 0E 00

インターニャは、?の部族にも?だちがいる。?んな、インターニャにいろいろ??してくれる。

01

ここはクーラ?ク族の村だ。酋長はア痛痛ン。まだ取ってないなら、あいさ??らいしておけよ。

8C 2F 8E B6 CA 82 96 29 97

精霊の??を?っているぞ、アバータール。

9A AD 00 88 B8 CB 82 CC 82 CD C2 B9 CE 02 CF 02 D0 02 D1 02 D2 02 D3 C2 9B 81 00 96 46 97 BE 88 00 9B B5 00 96 C9 98 9B B6 00 9B B7 00 AB 00 96 97 97

前仕事治す部族さ

01

ィようナなはらいおいおかり、ムバタウ。ームニ

8C C6 98 C2 B0 10 96 1F 98

ャの魔法よがムにィなオド谷ムさ

01

テウ言葉をキ話タウ。ーさ

01 01

ャの魔法ラはら前仕事治す部族、力与ムたバ長らな与間。ーな谷ーいニ

9A B7 00 9A B6 00 8C C6 98 9B B6 00 96 A8 98

がムにィよフキン冒いキれてら間だもンミ名話族ナっいくこバ間谷ニ

01 01

ううはやナンら前仕事治す部族、ろる葉をタ名ド族ナら決バ間谷ーいニ

8C C6 98

う話はう話はら前仕事治す部族さ

8C 0D 99

部よエラよしナタ手ウテウ、放もでミいー。間谷弟らテキ放いなム谷葉ーニ

C9 B6 CB 82 96 43 99 BE 01 00

子話ち名大よャのき治さ傷負よャのき治倒

9A B5 00 8C 0D 99 B6 CC 82 96 E7 9A BE 02 00

ャの魔法ラよ発見なオド谷ニタウへ話う話連来ばわ部ら発見て言葉ナバ間谷ニ

01 9B B6 00 9B B7 00 AB 00 96 39 9A

ャのき治よ発見ナ。をよ中とよ力アイはら呼力ムにんら前仕事治す部族よ放へまならずイ、谷彼タウ。ーニャの魔法よがムにィらャの魔法よ探出よ帰、放酋バム谷葉ーニ

8C E4 9A

本弟当て感与ら放い部族よ謝ぞて村彼戦族だなオド谷ニ

01 01

放い部族よ謝ぞはらャの魔法よ発見て言葉ナバ間。ーニ

01 01

士よ総ナらジミーデ弟がムにフキン間なよれてら娘リいな。間い。ーニ

BE 84 00 8C 0D

—

Barrab

I started working on the Script Extractor with the knowledge we have so far…

Screen Shot 2013-08-03 at 10.18.52 AM

Found out the conversation options are inside the same piece of code that the dialog text, which is nice.

Must find out the correct termination sequence for each dialog (I guess it will be some sort of return command) and also the commands which structure the dialog options

Font table

This one is a bit tedious but has to be done, gotta map the font table…

File Offset File Offset Pointer Glyphs
0x11051d 1115421 $A4:B440 Hiragana
0x110700 1115904 $A4:C900 Katakana
0x11171d 1120029 $A5:8300 Kanji, Part 1, 93 kanji (?)
0x111834 1120308 $A5:9A40
0x111900 1120512 $A5:9A80 Kanji, Part 2, 188 kanji
0x111b34 1121076 $A5:C940
0x111c00 1121280 $A5:C980 Kanji, Part 3, 188 kanji
0x111e34 1121844 $A5:F840

As noted already, japanese character are in Shift-JIS order in their respective groups in the tileset. HOWEVER, this is not completely true in the font table, specially for kanji which seems to be grouped on groups of 93 or 188 kanji.

Another issue to make a Shift-JIS mapping apart from the gaps, is the fact that the mapping seems to have two blank spaces between kanji “groups” (http://www.rikai.com/library/kanjitables/kanji_codes.sjis.shtml ).

Tichticatl

Looking for pointer tables:

* Pointer table for mini character sets: 0x118000, 3 byte pointers (4 bytes? but the last one is always 00) to:

0x108000

0x1081be

0x108306

[…]

0x1095fe <—- Charset for Intanya’s dialog

This table goes all the way to 0x11808c for individual charsets, then it seems to begin using shared charsets (0x10ce6a, 0x10cfce for instance). It ends at 0x1181f0 (125 entries)

Screen Shot 2013-08-02 at 6.42.32 PM

We may end up replacing pointers on all entries for an unified roman charset, or otherwise hacking the place where this is used in order to reference the charset directly instead of using the table (?).

So, this gives us an indication there *might* be 125 dialogs in total, probably.

* “Pointers” to the actual dialogs

Now I’m not entirely sure we’ll find pointers, since the dialogs seem to be code instead of raw data… however there should be some sort of jumptable somewhere

Barako

Not a mockup

Screen Shot 2013-08-01 at 8.56.30 PM

So, the general plan is

  • Get to know the structure of the ROM and document it
  • Build a script extractor
  • Translate to English
  • Build a script injector
  • Perform necessary hacks
  • Playtest

We are still at step one, and the following questions are still up:

  • Where does the game store the list of conversations and their corresponding character sets
  • Where are the dialog options. and do they use the same schema as the dialog text
  • Where is the intro and title screen text
  • User interface and in-game messages

To recap everything so far:

  • 0x013ea0 – English text for the intro, encoded in ASCII
  • 0x01457d – English text for the End Credits, encoded in ASCII
  • 0x1095fe – Characters to be loaded for the First Intanya Dialog, represented as (little endian) offsets from 0x110100 (the font table)
    • A value of 0360 here points to address 0x110460 (Uppercase A)
  • 0x110100 – Font table. 24 bits pointer table, pointing to sprites over 0x120000
    • 0x110424 – Numbers
    • 0x110460 – Uppercase
    • 0x1104c3 – Lowercase
  • 0x120000 – Font Sprites in 2bpp mode, roman, hiragana, katakana and kanji, with symbols mixed in-between.
  • 0x160d4d – First Intanya dialog code, sequence of character loading commands (05) followed with an offset of the tile in VRAM. (01) displays a clear line

Pindiro

Many thanks to Vehek again, who has been giving us some very important indications! Before going on I’d like to point out that I haven’t been able to figure out much myself… I’m mostly trying to illustrate and understand what Vehek says 🙂

So, based on his comments…

Dialogs

So, at ox160d4d, we have the following (Removing the character usage value 05)

0B 10 31 13 33 34 35 36 37 38 2F 2C 20 39 0B 13 3A 3B 10 35 3C 35 3D 3E 3F 40 24 41 3F 42 07 43 32

In which the 1st and 15th bytes match (0B), indicating they correspond to イ, same goes for the 4th and 16th bytes (13 = ー (the ~ like symbol)) . 0B means the 12th character of the set loaded for this dialog.

Likewise, 32 = 。11 = 、

Then comes another probable command at 0x160D8F (Probably an indicator of end of dialog, which makes sense, since this first dialog has 33 characters).

Note: This turned out to be a line break comand

01 01

And then the next one

0A 30 31 13 1B 28 32 2C 20 05 44 06 45 2F 08 39 46 27 47 48 06 43 35 49 32 49 38 2F 4A 29 2F 24 4B 2D 2E 28 4C 2A 4B 43 32.

In this one, the 24th and 26th = 49 = だ (hiragana) and the ~ like one = 13 (same as above… hmm..) 、and 。are also the same. So maybe they share the same loaded characters. ダ is also the same == 31

01

2C 20 39 2F 4D 35 19 13 1D 1E 3F 4E 4F 29 32 4D 35 3C 39 06 50 […]

So, several dialogues in a same conversation might share loaded characters…

Back to the tables pointed by Vehek at 0x110100 (Font, 24 bits pointer table) and 0x1095FE (Character Selection, (for the Intanya dialog?))

Font table

The font table basically starts with value A48000 and sums 64 for each entry, pointing to 63 characters before having a blank space (0x000000) at 0x1101BD. Then a short section (4 entries) adding from A28000, then blank space up to 0x1102f2, where it starts summing from A4A000 to A4A4C0. It goes like that, and seems to have its last entry (AAFFC0) at 0x1147b6.

Question: How to map these addresses to the actual offsets of the tiles in the ROM, which start from 0x120000

Character Set selection table

Determines what characters to load on VRAM.

This table seems to be 2 byte offsets, and judging from that VRAM screenshot I can see 4 close values (0183, 0186, 0189 and 018C), which are likely to be the up, down, left and right “characters”. That’d mean that the next one, 04A7 is what represents the “2U” tile I was referring to on my previous post, and since it’s followed by other two kana, it seems that kana are on the 04 range, then come 2 kanji (3927 and 4056) followed by more kana (this time in the 06 range). These character loading sections seem to be separated by a FF FF mark.

Question: How to map conversations to the set of preloaded characters they use

 

Yolaru

Back when trying relative search, I marked the kana characters with roman letters to find sequences, since characters are 4 sprites big, I began the first sequence changing the first tile of the character, and the next sequence changing the second tile and so on.

When the first dialog is shown, the following tiles are loaded into VRAM (at offset 21504):

2U 1D 1H (Kanji) (Kanji) 4G 4I 4M 2z 2f 4R

(2U is the Kana which has an “U” on its second sprite)

Following Vehek’s input, I’m hoping to find a relative sequence for this somewhere in the ROM; what I’m thinking now is that there should be some sort of table which indicates what sprites to load for each dialog, and another one which says what actual sprites to use based on the ones that were loaded already.

If this is true and I manage to find both, I’ll be able to make a program to extract the script.

Kurak

Tried to do some relative searching by assigning numbers to some of the kana sprites, then firing the game and trying to spot some amidst the kanji, then tried the relative search (Not much luck)

Examined the ROM a bit using a “simple” hex editor, without table support and using Shift-JIS standard encoding (Havent found an hex editor with table support for mac so far). Found english text for credits (83326) and title (81568). There’s also a ORIGIN at 1044403, probably mixed with japanese around it (might help)

Played around a lot with relsearch, no more interesting results found, probably because the relsearch tools I’m using suck at wildcards (and text is likely to be encoded in 2 bytes)

 

Avatar’s dream

I reconstructed the first portion of the kanji font

kanjiOrder

Again, as Vehek pointed out, this seems to be Shift-JIS ordered.

Screen Shot 2013-07-29 at 12.40.25 PM

I’m hoping to find at least some leads using relative searching, not that I’m very hopeful but I have to do it

The Story So Far…

So, based on what we know so far… (thanks to Vehek from romhacking.net)

Font is stored in GB format (2bpp); roman characters + japanese kana begin at 0x00122480

roman_kana

And then comes kanji (in-game dialog is in Kanji, kana is only used for some texts)

kanji

Vehek says the text doesn’t seem to be stored as simple indexes (perhaps due to the the fact that characters are composed of 4 sprites? or that there are so many kanji, or both). Nonetheless, I think knowing the order the font is on will help figure out where sprites are loaded in memory.

My (first) plan is to eventually replace kanji tiles with 2 roman letter combinations, that may make things easier IF we manage to build equivalence table(s) in some way.

Thoughts? corrections? comment!

Create your own website, free on WordPress.com.Create your own website.
Start free