Crystal Caves – Progress on the Script Extractor

A cool guy called DDS has sent some info and prompted me to work back on the project, it seems he’s gone so far as to hack the game to use single sprites as letters instead of 4 sprites kanji, which is something extremely important for the translation.

Intanya speaks english
Intanya speaks english

I have updated the Script extractor based on DDS’s findings:

  • Marking back newlines, which I had removed
  • Subroutines
    • 0x8C (jump to)
    • 0xC0 (set flag)
    • 0x88 ~ 0xDO, unidentified
  • Grouping subroutines calls in groups of three bytes

Still figuring out the usage of 00 as a dialog termination sequence. Some times it’s there, some times it’s not. There are also some stranded bytes, probably some subroutines use a single byte or 3 bytes (?)

Also, the byte sequence after the charset is probably data instead of code, may be the dialog options are there (?)

I’m also integrating with Google Translate API to provide a rough translation, mainly to detect the point where the first dialog ends and nonsense starts.

Here’s the output so far:

<dialog id = '16'>
<charset> ����はいえ熱夢アイエラフキンジミーディスナウトヨルリテム名前仕事治す部族さようならおかり、バタ。ニャの魔法がにオド谷言葉を話力与た長間冒れてだもっくこやろる決し手放で弟子ち大き傷負倒発見へ連来ばわ中と呼んまず彼探出帰酋本当感謝ぞ村戦士総娘東あそ者耳入ほ仲精霊不思議居場所知教遠住石都西クカ恐ぬ道沿行け通じ南隠里約束誰突止め助ロ会聞チョコパ捧げ物強授ポ私目戻自分生ッ祈師つ今使必要ぐ我!ズ苦痛取除…機嫌丈夫ど友み報告加護</charset>
<94 '0226'>0B <8D 'B18D'><90 'B8AB'><BC 'BD02'>02 <BE 'BF02'>02 <flag 'C102'/>02 <C2 'C302'>02 <C4 'B942'><C5 'C602'>82 <C7 'C882'>02 <C9 'CA82'><C2 'A9C4'>10 <96 '8D4D'><9A '00AD'>
<text>おかえり、アバタール。<jumpTo '8E2F'/>インターニャの魔法が、お前にイーオドンの谷の言葉を話す力を与えた。<br/><br/>アバタールよ。お前は長い間、熱に冒されていたのだ。だが、もう、すっかりよくなった。<br/>お前に、このトーテムをやろう。この谷にいる間は、決して手放すでない。<flag '10A9'/></text>
<engrish>Welcome back, Avatar. Magic of the inter-Nha is, given the power to speak the word of you to Iodon of the valley. Avatar. You are he a long time, it had been affected by the heat. But, the other, I became completely well. To you, to try to do this totem. While in the valley, and are not let go any way.</engrish>
<BE '818A'>00 <C9 'BCB6'>82 <96 '8EF0'><BE '8201'>00 
<text>インターニャの弟子たちが、大きな傷を負って倒れているお前を発見して、ここへ連れて来た。<br/>インターニャ、お前の傷を治した。だが、しばらくは熱に冒されて、うわ言を言っていた。夢の話だ。<jumpTo '8E2F'/></text>
<engrish>Disciples of the inter-Nha is, to discover you have fallen owed a large scratch, was brought here. Inter Nha, it cures you of scratches. But it had been a while been affected by the heat, saying delirium. It is a dream of the story.</engrish>
<B6 '82BD'><96 '8F59'><BE '8302'>84 85 00 
<text>お前は夢の中で、アイエラとラフキンとジミーの名を呼んでいた。まずは、彼らを探し出すことだ。<jumpTo '8E2F'/></text>
<engrish>You are in a dream, was calling Aiera and Lufkin and Jimmy's name. First of all, you can find them.</engrish>
<B6 '82BE'><96 '902E'><BE '0003'><9B '0087'><96 '8FBB'>
<text>お前がアイエラを連れて帰ってくれたことを、酋長は本当によろこんで感謝していたぞ。<jumpTo '902B'/>この村の戦士たちが、総出でアイエラを探している。アイエラは酋長の娘なのだ。<br/>アイエラをさらったのはウラリ族だ。</text>
<engrish>that you has me back brought Aiera, chief was grateful Do really pleased. Warriors of this village, looking for a Aiera in full force. Aiera's the daughter of the chief. It was kidnapped Aiera It 's Urari group.</engrish>
<BE '0089'><jumpTo '8E2F'/><B6 '82BF'><96 '90DC'><BE '8804'>00 
<text>この村の東にある、ヨラルー族の村に、そのような名前の者がいると、インターニャの耳に入っている。<br/>ラフキン、ほかの仲間を探すのに、とても力になると、精霊たちは言う。<jumpTo '8E2F'/></text>
<engrish>To the east of this village, in the village of Yoraru group, and there are such name who, I have entered into the ears of the inter-Nha. Lufkin, and to look for the other fellow, and so become a force, spirits say.</engrish>
<B6 '82C0'><96 '9144'><BE '0005'>
<text>インターニャ、不思議な夢を見た。夢は、ラフキンが、ジミーの居場所を知っていると教えてくれた。<jumpTo '8E2F'/></text>
<engrish>I saw Inter Nha, a strange dream. Dream, Lufkin has taught me to know the whereabouts of Jimmy.</engrish>
<B6 '82C1'><96 '9186'><BE '0006'>
<text>とても遠くに住んでいる部族だ。石の都ナウアトラの西だ。<jumpTo '8E2F'/></text>
<engrish>It is a tribe who live in very far away. It is west of the stone city Nauatora.</engrish>
<B6 '82C2'><96 '91FD'><BE '8607'>00 
<text>ナウアトラ族は、彼らの石の都を、ティクティカトルと呼んでいる。<br/><br/>ナウアトラの西には、ディスキキの村がある。<jumpTo '8E2F'/></text>
<engrish>Nauatora family, is the capital of their stone, is called Thich Thi Quatre. To the west of Nauatora, there is a village of Disukiki.</engrish>
<B6 '82C3'><96 '927A'><BE '8708'>00 
<text>恐れを知らぬ戦士の部族だ。この村から道に沿って東へ行け。<br/><br/>道はヨラルーの村に通じている。その南が、ナウアトラだ。<jumpTo '8E2F'/></text>
<engrish>It is a warrior tribe that fearless. And go to the east from the village along the road. Road leads to the village of Yoraru. The south, but Nauatora.</engrish>
<B6 '82C4'><96 '935E'><BE '0009'>
<text>ウラリ族は隠れ里に住んでいる。精霊たちも、その場所を教えてはくれない。<br/>だが、精霊は約束してくれた。ぐかがかならず、ウラリの村を我き!ズ、アイエラを苦け出すとな。<br/>アイエラを苦けたければ酋長のア痛痛ンに取って話を除け。<jumpTo '8E2F'/></text>
<engrish>Urari family lives in Kakurezato. Spirits also, do not you tell me the location. But, Spirit was promised. Ingredients or not always, we-out of the village of Urari! Figure, Issuing only click the Aiera. If longer Nigake the Aiera and except for the story to take to the A pain pain down chief.</engrish>
<B6 '82C5'><96 '9427'><BE '000A'>
<text>このトーテムに…機嫌ラトルか丈インドを夫ど友にすると、み力な魔法の力をお前に報けてくれる。<br/>ヨ告を夫ど友にすると、お前を加の護の前に?してくれる。<br/><br/>このほかのトーテムは、??の力で探すのだ。<jumpTo '8E2F'/></text>
<engrish>If you are etc. husband ... mood Rattle or length India in this totem friend, can you Hoke the power of attractive magic to you. When Yo told the husband etc. friend, can you in front of Mamoru of pressure to you. This addition to the totem, it looks at the power of.</engrish>
<B6 '82C6'><96 '9467'><BE '000B'>
<text>?まれたときから、ずっとインターニャと呼ばれている。<jumpTo '8E2F'/></text>
<engrish>From the time Mareta, it has been much called inter Nha.</engrish>
<B6 '82C7'><96 '94D5'><BE '000C'>
<text>クーラ?ク族の?とう?をしている。精霊の言葉を除き、傷?いた者や、熱に冒された者を治す。</text>
<engrish>We have a party of family Kuraku. Except for the words of the spirit, to heal wounds have a person or a person who is affected by heat.</engrish>
<9B '00AD'><96 '94D2'><BE '818D'>00 <jumpTo '8E2F'/><B6 '82C8'><96 '963A'><BE '000D'><AE '1D24'>1D 25 1D <96 '95A2'>
<text>加には、なんでも治す、大きな力がある。さいわい、?のお前には、その力を?う??がない。<br/>もし、インターニャの苦けがいるときは、お前にやったトーテムを?い、す?に帰ってくるのだ。</text>
<engrish>In addition, the cure anything, there is a large force. Fortunately, you in the, and there is no cormorant its power. If, when there are only bitter inter Nha, the stomach totem've done to you, you come back to the nest.</engrish>
<9B '00AD'><96 '959F'><BE '008A'><jumpTo '9637'/><A2 '1D1D'>25 1D 
<text>精霊よ、?に力を与えたまえ?<br/><br/><br/>クク?の精霊よ、これなるアバタールの??を?り?き、その傷をいやしたまえ??<br/>精霊の??はよかった。もう大??だ。<jumpTo '8E2F'/></text>
<engrish>Spirit by, in due spirits before Kuku gave a force, which made the Avatar of the Riki, was good for spirits before you have healed the wound. It is already large.</engrish>
<B6 '82C9'><96 '96F7'><BE '000E'>
<text>インターニャは、?の部族にも?だちがいる。?んな、インターニャにいろいろ??してくれる。<br/>ここはクーラ?ク族の村だ。酋長はア痛痛ン。まだ取ってないなら、あいさ??らいしておけよ。<jumpTo '8E2F'/></text>
<engrish>Inter Nha is, there are Modachi to tribes. Do such, I me lot to Inter Nha. Here is the village of Kuraku group. Chief nitrous pain pain down. If you have not taken yet, and Oke was Aisarai.</engrish>
<B6 '82CA'><96 '9729'>
<text>精霊の??を?っているぞ、アバータール。</text>
<engrish>Gonna have Tsu that the spirits, Abataru.</engrish>
<9A '00AD'><88 'CBB8'>82 <CC 'CD82'><C2 'CEB9'>02 <CF 'D002'>02 D1 02 D2 02 D3 <C2 '819B'>00 <96 '9746'><BE '0088'><9B '00B5'><96 '98C9'><9B '00B6'><9B '00B7'><AB '9600'><97 '0597'>20 
<text>仕事治す部族さ<br/>ィようナなはらいおいおかり、ムバタウ。ームニ<jumpTo '98C6'/></text>
<engrish>Tribe of ~I so na as to pay nephew borrow cure work, Mubatau. Muni</engrish>
<C2 '10B0'><96 '981F'>
<text>ャの魔法よがムにィなオド谷ムさ<br/>テウ言葉をキ話タウ。ーさ<br/><br/>ャの魔法ラはら前仕事治す部族、力与ムたバ長らな与間。ーな谷ーいニ</text>
<engrish>· The story tau magic excess of catcher is the ~I of Odo Tanimu of Tae Woo words to nothing. Magic La La before work cure tribe of over of catcher, force Azukamu was bus length from a Azukama. Over a Taniini</engrish>
<9A '00B7'><9A '00B6'><jumpTo '98C6'/><9B '00B6'><96 '98A8'>
<text>がムにィよフキン冒いキれてら間だもンミ名話族ナっいくこバ間谷ニ<br/><br/>ううはやナンら前仕事治す部族、ろる葉をタ名ド族ナら決バ間谷ーいニ<jumpTo '98C6'/>う話はう話はら前仕事治す部族さ<jumpTo '990D'/>部よエラよしナタ手ウテウ、放もでミいー。間谷弟らテキ放いなム谷葉ーニ</text>
<engrish>There tribe to cure ~I by butterbur adventure breath Re Nmi name talk group also a between the temple became Ikukoba ticks two uhh Hayate Nan et al before work to nothing, others Rolle leaves name de group Nara Kebba ticks over initiative Cormorants story is cormorants story original before work cure tribe of part I gills good thou hand Uteu, also in Mii release. Ticks Mutani leaf over two such not release his brother from enemy</engrish>
<C9 'CBB6'>82 <96 '9943'><BE '0001'>
<text>子話ち名大よャのき治さ傷負よャのき治倒</text>
<engrish>Child talk Chi name sized by catcher eaves cured and yellow scratch negative by catcher Chi倒</engrish>
<9A '00B5'><jumpTo '990D'/><B6 '82CC'><96 '9AE7'><BE '0002'>
<text>ャの魔法ラよ発見なオド谷ニタウへ話う話連来ばわ部ら発見て言葉ナバ間谷ニ<br/></text>
<engrish>Catcher magic La'll discover that Odo valley Nitau words Nava Te limbus et al discovered if come cormorant talk communication talk to tick two</engrish>
<9B '00B6'><9B '00B7'><AB '9600'>39 <9A '3405'>
<text>のき治よ発見ナ。をよ中とよ力アイはら呼力ムにんら前仕事治す部族よ放へまならずイ、谷彼タウ。ーニャの魔法よがムにィらャの魔法よ探出よ帰、放酋バム谷葉ーニ<jumpTo '9AE4'/>本弟当て感与ら放い部族よ謝ぞて村彼戦族だなオド谷ニ<br/><br/>放い部族よ謝ぞはらャの魔法よ発見て言葉ナバ間。ーニ<br/><br/>士よ総ナらジミーデ弟がムにフキン間なよれてら娘リいな。間い。ーニ</text>
<engrish>Eaves Osamu discovered Na. It forces love and in good to the Manara Zu Lee to release good tribe cure et al call force Muninra before work, the valley he tau. Nya magic excess is ~I-ra~ya magic good probe leaving attributed to nothing, Ho酋 Bam TaniYo over double this brother against feeling Azuka-ra Hoi tribe by Xie each to the village Odo Tanini Na's his battle group Hoi tribe between I words Nava Xie each Te discovered by magic of Hara~ya. Over two-mechanic Yeah Nara Jimide butterbur between a According to Li et al daughter whether his brother to nothing. Between physicians. Over two</engrish>
<BE '0084'><jumpTo '990D'/><B6 '82CE'><96 '9CAB'><BE '8704'>00 
<text>ャの魔法よ東よ大葉ナあ、らがムにフキン弟総バ間谷ニ<br/><br/>ジミーデ弟れて娘リそ夢へ名ら士う冒は見い見い者な総バタウ。ーニ<br/><br/>スナウトは士うなら耳入よりてっいータ族な谷ニ長葉を族らスナウトタらほ族な。間いタウ。ーニ<br/></text>
<engrish>Catcher of magic by east by macrophyll Naa, and near the brother total server ticks Nijimide brother is in name from mechanic cormorant adventure will not look not look a person such total Batau to Musumeriso dream to Ragamu. Nisunauto to wow Te~tsuita group of Tanini length leaves family from Sunautota et al ho group I the from the ear input. Between I have tau. Over two</engrish>
<9B '00B7'><96 '9BC7'><jumpTo '990D'/>
<text>士う、はらャの魔法ラよ仲精弟総バ間谷ニ士話はがムにィ、ら霊与戦間話を放によな谷ニ<br/>長葉を族らンいうよ夢ようナな谷ニ本弟ジミーデて感与不。をらフキン間なよれて娘リいな。間い間。ーニタウらだ話タがムにィてもにうナ弟な与間思族ニ</text>
<engrish>Judges cormorants, Naka by magic La Hara~ya Seiototo total server ticks two mechanic story is-free in ~I, dream so na'll say family from down the Na Tanini length leaf by the release of the story between et spirits given against valley not given a sense of Te double this brother Jimide. La butterbur between a According to daughter re not. Between I have between. ~I Even Niu Na brother to Nitau et al.'s Hanashitagamu a Azukama 思族 two</engrish>
<BE '8685'>00 <jumpTo '990D'/><B6 '82D1'><96 '9D15'><BE '0007'>
<text>議はらスナウトは放バ間。居族ニ本よ耳入弟場バム
---

7 thoughts on “Crystal Caves – Progress on the Script Extractor

  1. I messed around a bit more to see how hard it’d be to get dialogue options working, and it seems like it wouldn’t be too much trouble. They are located around $14BB0, and are preceded by a byte that acts as a counter. So these can be modified to allow for longer or shorter names, but it doesn’t seem to work 100% of the time (for some reason, I couldn’t change the one for “Jimmy”). I’ll try to figure out why, though it may be easier to just move all of these out to a wider blank space to work with and change how it indexes them. They also seem to be unique to a character. Talking to someone else with “Job” or “Name” has it untranslated.

    Here’s a better version of the first pic from my last post.

    And here’s a zip file with an IPS of what I’ve done so far.

    http://www.mediafire.com/download/88s2nb22oav033z/ultima.zip

    In your EUC charset for Dialog 16, the values from “誰” onward seem to be set to 20h bytes higher than they should be. So for example, where you have “ぐかが”, it should say “誰かが”. It ended up making the second half of the Japanese text look scrambled.

    The text that follows the “96 97 97” seems to be more sequenced characters, that likely depend on another charset being loaded. Maybe it’s someone else’s dialogue?

    I’m looking into the dialogue system more so that you can continue on the extractor tool. I’ve mostly just been trying to decode the commands in this same speech dialogue, and here’s what I can tell.

    88 = Blank out RAM?

    8C yy xx = Jump to address $xxyy in the current bank.

    8D zz yy xx = Long jump to address $xxyyzz.

    94 yy xx bb aa = A conditional jump? It checks the value at $xxyy and if it’s zero, jump to $aabb. Example: 94 26 02 0B 8D 8D B1 90 AB = check if $0226 is zero (looks like it’s related to if you beat the game or not?). In my case, it was zero, so jump to $8D0B. When I forced it to one, it skipped that and read the following “8D B1 90 AB” command as documented above, which made Intanya give some end-game speech with all the other characters there.

    96 yy xx = Jump to address $xxyy, not sure what makes this different from 8C.

    9A xx yy … 00 = Some sort of bit setting? Ends when it encounters a 00.

    9B xx yy … 00 = Some sort of bit checking? Ends when it encounters a 00.

    AB xx = Skip the following xx bytes.

    B6 bb aa = A conditional jump for dialogue options? It ANDs aabb with #$3FFF, then compares to $1D0F. (Example: B6 BC 82 96 F0 8E BE … = take 82BC, AND with 3FFF to get 02BC, compare $02BC’s value to $1D0F’s value. They were equal, so it skipped the “96 F0 8E” jump and went to the BE command as documented below)

    B8 bb aa dd cc … yy 4x = Store values aabb, ccdd, etc. in memory starting at $7E:FC7C. Will continue to read until it finds a pair of bytes that has the 7th bit set. (i.e. returns a non-zero number when ANDed with #$4000). This is for loading dialogue options into memory.

    B9 bb aa dd cc … yy 4x = Same as above, but does not initialize address index back to zero and instead continues where the above left off.

    BE aa bb … 00 = Display or hide dialogue options. If the highest bit is set (8x), then display it. If not set, then hide the option. These are indexed relative to the order they were loaded in by a B8 or B9 command.

    C0 yy xx = Set a flag of value xxyy in RAM around $7E:FE78.

    C2 yy xx = Check if any flags in $7E:FE78 are greater than xxyy? And then OR xxyy with $8000 and check again.

    C4 yy xx = Check a flag of value xxyy in RAM.

    C9 = A wait or handing control over to player?

    Hopefully this helps with the script tools. Let me know if I can do anything else.

    1. unfortunately no progress yet on it… I’ll make some time for it on November once I manage to finish some projects I’m currently working on :/

Leave a Reply to slash Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s