Trying to find Zero Mission's Intro and Credits Text location

Started by dingobat, October 04, 2011, 04:58:09 PM

Previous topic - Next topic

dingobat

Hello all! First post here, as you can probably tell.

I'm trying to find out where the intro text -  "Emergency Order" and the credits text - Producer, etc. - are stored in Zero Mission. I'm doing a translation of the game, using Tile Layer Pro for tileset editing, Double Helix for text insertion and whatever hex editor I can use for... Hex stuff! I thought I was going along pretty well but hit a snag. I've spotted the same typefonts in the ROM but can't quite see where they're stored or used. It may just be I'm searching for them in the wrong way.

I tried using DH for the intro bit but changing it in the program doesn't seem to have any effect (I've also found I can't edit Metroid Fusion's text with it, bummer).

Now, I'd appreciate any help if possible. Just asking for someone to point me in the right direction, no need to tell me how everything's done (that would be nice but I wouldn't learn anything from it :) ).

zephyrtronium

This might be useful to you. It demonstrates the internal values used to represent characters.

strcpy(table[0x0040]," ");
strcpy(table[0x0041],"!");
strcpy(table[0x0042],"\"");
strcpy(table[0x0043],"#");
strcpy(table[0x0044],"$");
strcpy(table[0x0045],"%");
strcpy(table[0x0046],"&");
strcpy(table[0x0047],"'");
strcpy(table[0x0048],"(");
strcpy(table[0x0049],")");
strcpy(table[0x004A],"*");
strcpy(table[0x004B],"+");
strcpy(table[0x004C],",");
strcpy(table[0x004D],"-");
strcpy(table[0x004E],".");
strcpy(table[0x004F],"/");
strcpy(table[0x0050],"0");
strcpy(table[0x0051],"1");
strcpy(table[0x0052],"2");
strcpy(table[0x0053],"3");
strcpy(table[0x0054],"4");
strcpy(table[0x0055],"5");
strcpy(table[0x0056],"6");
strcpy(table[0x0057],"7");
strcpy(table[0x0058],"8");
strcpy(table[0x0059],"9");
strcpy(table[0x005A],":");
strcpy(table[0x005B],";");
strcpy(table[0x005D],"=");
strcpy(table[0x005E],"1");
strcpy(table[0x005F],"?");
strcpy(table[0x0081],"A");
strcpy(table[0x0082],"B");
strcpy(table[0x0083],"C");
strcpy(table[0x0084],"D");
strcpy(table[0x0085],"E");
strcpy(table[0x0086],"F");
strcpy(table[0x0087],"G");
strcpy(table[0x0088],"H");
strcpy(table[0x0089],"I");
strcpy(table[0x008A],"J");
strcpy(table[0x008B],"K");
strcpy(table[0x008C],"L");
strcpy(table[0x008D],"M");
strcpy(table[0x008E],"N");
strcpy(table[0x008F],"O");
strcpy(table[0x0090],"P");
strcpy(table[0x0091],"Q");
strcpy(table[0x0092],"R");
strcpy(table[0x0093],"S");
strcpy(table[0x0094],"T");
strcpy(table[0x0095],"U");
strcpy(table[0x0096],"V");
strcpy(table[0x0097],"W");
strcpy(table[0x0098],"X");
strcpy(table[0x0099],"Y");
strcpy(table[0x009A],"Z");
strcpy(table[0x009B],"[");
strcpy(table[0x00C1],"a");
strcpy(table[0x00C2],"b");
strcpy(table[0x00C3],"c");
strcpy(table[0x00C4],"d");
strcpy(table[0x00C5],"e");
strcpy(table[0x00C6],"f");
strcpy(table[0x00C7],"g");
strcpy(table[0x00C8],"h");
strcpy(table[0x00C9],"i");
strcpy(table[0x00CA],"j");
strcpy(table[0x00CB],"k");
strcpy(table[0x00CC],"l");
strcpy(table[0x00CD],"m");
strcpy(table[0x00CE],"n");
strcpy(table[0x00CF],"o");
strcpy(table[0x00D0],"p");
strcpy(table[0x00D1],"q");
strcpy(table[0x00D2],"r");
strcpy(table[0x00D3],"s");
strcpy(table[0x00D4],"t");
strcpy(table[0x00D5],"u");
strcpy(table[0x00D6],"v");
strcpy(table[0x00D7],"w");
strcpy(table[0x00D8],"x");
strcpy(table[0x00D9],"y");
strcpy(table[0x00DA],"z");
strcpy(table[0x4601],"À");
strcpy(table[0x4701],"Á");
strcpy(table[0x4801],"Â");
strcpy(table[0x4901],"Ã");
strcpy(table[0x4A01],"Ç");
strcpy(table[0x4B01],"É");
strcpy(table[0x4C01],"Ê");
strcpy(table[0x4D01],"Í");
strcpy(table[0x4E01],"Ó");
strcpy(table[0x4F01],"Ô");
strcpy(table[0x5001],"Õ");
strcpy(table[0x5101],"Ú");
strcpy(table[0x5201],"Ü");
strcpy(table[0x5301],"à");
strcpy(table[0x5401],"á");
strcpy(table[0x5501],"â");
strcpy(table[0x5601],"ã");
strcpy(table[0x5701],"ç");
strcpy(table[0x5801],"é");
strcpy(table[0x5901],"ê");
strcpy(table[0x5A01],"í");
strcpy(table[0x5B01],"ó");
strcpy(table[0x5C01],"ô");
strcpy(table[0x5D01],"õ");
strcpy(table[0x5E01],"ú");
strcpy(table[0x5F01],"ü");
strcpy(table[0x02C8],"[Select]");
strcpy(table[0x02D2],"[LLSquare]");
strcpy(table[0x0300],"[UpArrow]");
strcpy(table[0x0302],"[DownArrow]");
strcpy(table[0x0304],"[LeftArrow]");
strcpy(table[0x0306],"[RightArrow]");
strcpy(table[0x0308],"[AButton]");
strcpy(table[0x030A],"[BButton]");
strcpy(table[0x030B],"[LButton]");
strcpy(table[0x030D],"[RButton]");
strcpy(table[0x8100],"[Color0]");
strcpy(table[0x8101],"[Color1]");
strcpy(table[0x8102],"[Color2]");
strcpy(table[0x8103],"[Color3]");
strcpy(table[0x8104],"[Color4]");
strcpy(table[0x8105],"[Color5]");
strcpy(table[0x8106],"[Color6]");
strcpy(table[0x8107],"[Color7]");
strcpy(table[0x8108],"[Color8]");
strcpy(table[0x8109],"[Color9]");
strcpy(table[0x810A],"[Color10]");
strcpy(table[0x810B],"[Color11]");
strcpy(table[0xFB00],"[FB]");
strcpy(table[0xFC00],"[FC]");
strcpy(table[0xFD00],"[FD]");
strcpy(table[0xFE00],"[NEWLINE]");
strcpy(table[0xFF00],"[END]");


Additionally, it may be useful to know that the Brinstar area popup is at 442e4a and that the others follow it. Most text should be in that general area.

dingobat

Ah, I see. I notice these correspond to DH's table (or should I say, DH's table uses these values). It's interesting because there are several typefonts. One used for the credits, which I believe is 8x8 (it's the very first set of letters that comes up in a tile viewer), then it's a mix of the usual font (16x8, if I'm not mixing my sizes), the one from the intro (which I *can* find, but only those apparently primed for foreign languages - "Á" instead of "A"), and hiragana and kanji.

From that list, I think the first set of capitals is the regular, ingame text, whereas the text between 0x4601 and 0x5F01 is the one I'm looking for, but it's only the diacritic version.

Imma investigate this further. Thanks, zephyrtronium :)

dingobat

Right, found it. I trailed that offset first, 442e4a. The first line, as mentioned, is Brinstar's "pop-up area ad", as I like to call it.

82 00 92 00 89 00 83 00 93 00 94 00 81 00 92 00 00 ff
82 = B, 92 = R, etc. The 00's, I reckon may just be values either regarding letter position or some other indexing parameter.

I kept going, jotting down hex values and corresponding character values, and out of curiosity, began wondering why DH didn't update that line while it managed to alter every single bit of text otherwise. Of course, it was obvious - since the fonts are different, then they're using other values (RAWs in DH). I'll try editing it directly later tonight through a hex editor, but my guess is it might work just the same if I used a series of RAWs in DH. Nonetheless, for those interested, the intro text begins at 446160, as DH makes it clear as well.

85 00 cd 00 c5 00 d2 00 c7 00 c5 00 ce 00 c3 00 d9 00 40 00
is basically:
E     M     E     R     G     E     N     C     Y     _, where the "_" is a space (hex value of 40). The next two blocks are at 446180 ("Exterminate...") and 4461EA ("And defeat...").

Thanks once again :yay:

zephyrtronium

The 00s are there because the game uses 16-bit wide chars rather than 8-bit chars for strings. I believe many of the RAW values are spacers. Hex editing likely would be the safest option for editing the game's strings for a number of reasons.

dingobat

Ah, that makes sense. I actually prefer direct hex editing, though, even if programs DH offer some advantages.

In any case, finding out the intro text is both a blessing and a curse since altering it has... no effect whatsoever. I'm guessing there's some other values in the ROM which are tied to its use. Gotta catch'em all, so onward!

dingobat

Before:



After:



And that's that! Pay no mind to the second text, it's a private joke and I couldn't figure out what to write so I could test it. Long story short: five days of searching and one day of luck.

Short story long, here's some copy pasta from an email I sent to interdpth:

Quote"What I did do this time was to search for LZ77 through SWI and DMAs with VBA's logging, and used both it and no$gba's tools to see image values. I wasn't sure I was getting it right so I tried VBA's VRAM viewer, since it can show in real time what's happening. I found several strings like this, which appeared and disappeared with each section of the intro text:

48 80 30 00 03 00 00 00 48 80 38 00 08 00 00 00

By comparison with the next strings, I assumed that the 48 80 pairs were related to size or screen position, the 30 and 38 (followed by 40 48, 50 58, etc. in the next strings) might be the order, and the 03 and 08 - being different but having repeated instances - corresponded to letters. I was right, at least regarding the values for the characters in that specific tilemap (I'm still unsure about the other values now, but will get into them later on).

VBA's DMA traces produced a number of offsets being called into memory. Some were the image maps for the intro, with Samus and her ship, and the other was 45FDB4. A quick browsing through the files I extracted with NLZ-GBA's revealed this was the offset where the intro text tile map begins. It helps saving NLZ's images with the image number and offsets in their names :)

I suppose this could have been done much faster and efficiently by someone with more experience in this (I thought about using breakpoints, but I admit I'm still not very proficient at using them in no$, though I've done so with Gameboy games in BGB), but in my case, what I did was investigate all offsets printed in VBA's log, and then individually examine those offsets with Hex Workshop - including some not mentioned by the emulator. I suspected the text might be in the same offset range, and it was.

The intro text begins at 45F462. It's all there:

      ...03 10 C8 80 C0 01 08 10 C8 80 C8 01 0E 10
C8 80 D0 01 08 10 C8 80 D8 01 12 10 C8 80 E0 01
0A 10 C8 80 E8 01 08 10 C8 80 F0 01 0F 10 C8 80
F8 01 06 10 C8 80 00 00 17 10 C8 80 08 00...

with the 08 being the "E", 0E being the "M", and so on, in the "Emergency Order" text.

All else just follows. At this point, I still have no idea what the 10 C8 80 C0 bytes are doing, though they maintain part of what I saw in VBA's VRAM viewer - between the first character and the second, it's C0; between the second and third it's C8; and so on. I'm assuming these dictate the sequence to follow? I did a quick edit - just changing the base values, which worked! - and those others seem to operate individually, so... It's something I'll try to investigate later, then, much like why there is a part of the game with the same intro text using the ingame text (it's the offset you included in Double Helix, but doesn't change anything) since it's never used to my knowledge.

I actually got in touch with interdpth and Odin, author of MetroID. Both of their suggestions were very useful and they did what I was hoping - no outright answer, just pointed me in the right direction, in the sense that they led me to explore all I could in no$gba and VBA.

If I find the time, I'll gather my notes and post some more info on this, namely the characters used and their values, if anyone's interested.



interdpth

03 10 C8 80 C0 01 08 10 C8 80 C8 01 0E 10
C8 80 D0 01 08 10 C8 80 D8 01 12 10 C8 80 E0 01
0A 10 C8 80 E8 01 08 10 C8 80 F0 01 0F 10 C8 80
F8 01 06 10 C8 80 00 00 17 10 C8 80 08 00

is better seen as
1003 80c8 01c0 1008 80c8 and so forth.
You then break them up by their bits
Just follow this http://nocash.emubase.de/gbatek.htm#lcdobjoamattributes each 2 bytes = 1 unsigned short = 1 OAM Entry