Zophar's Message Domain

Zophar's Message Domain (http://www.zophar.net/forums/index.php)
-   Rom Hack (http://www.zophar.net/forums/forumdisplay.php?f=8)
-   -   Sorcerer's Kingdom: Where to find "dictionary"? (http://www.zophar.net/forums/showthread.php?t=11053)

InVerse 05-28-2009 02:35 AM

Quote:

Originally Posted by Maximum Potion (Post 89383)
It would be cool if this thread were made into some sort of tutorial or something, or stickied as some kind of FAQ... There's alot of cool stuff that is adressed here that alot of people ask frequently on the forum.

I was thinking the same thing about a thread from a few months ago on a different board that's gone similarly to this one.

Quite some time ago (like, around 5 years ago) I started working on a tutorial that followed every step of a translation project I was working on. Unfortunately, it never got beyond the initial stages. I really should pick it up again.

I've also been toying with the idea of making a few YouTube videos that demonstrate the most basic of hacking skills, such as hex editing, because I'm sure several people would get a much better grasp on exactly what certain things were if they could see them, rather than just reading about them.

Kilyle 05-28-2009 06:32 AM

Next step...
 
That would definitely be useful. Sometimes it's very hard to catch a little mistake in what you're trying to do, a little way in which you misunderstood the directions. I encountered similar stuff when I tutored VB, and ended up writing a "Common Errors in Visual Basic" to pass out (in part because it seems that the teachers never approached troubleshooting until it was past the point you really needed it).

At any rate, thanks for the compliment! I'm trying hard to do this mostly on my own, because it's fun to stretch my limits a little, but it's also nice to be able to get as much personal help as I've been getting here. I have to tell you, I wasn't at all expecting this level of response.

So, what I've uncovered so far:

1. The entire table, at least for chat windows.

Interesting thing here: 02, 03, and 04 are the names of the other characters you encounter; 01, 05, and 06 are all codes for NAME (whatever name you put in for the character). Why there are three separate codes for this kind of mystifies me.

Then, code 08 says "Squire," but given the way this is used in the text, I'm assuming it gets overwritten with later titles. Otherwise "You're only a Squire, whereas I'm a Knight" and later "You really are a Squire now? How did you manage to get that high?" kind of comments don't make any sense.

I've found three codes (17, 18, 19) to pause the text for a short time before printing the next part. Again, the three-codes part mystifies me, but it's useful to have this code available. I even confirmed this usage by finding it in spots that I recall to have this kind of pausing.

Other than that:

1. A giant block that appears to contain all the text in the game, character by character.

2. A spot, roughly from 000EECD0 to 000EF140, which looks interesting because it seems a little more organized, like there's part of an alphabet there. I plan to look at this a little closer soon.

Aside from that specific section, I haven't found anything that looks like the dictionary I'm expecting to find. So I wanted to run my expectations by you to see if I'm even close.

I was expecting something like this:

Astina A st in a
Elrad E l r a d
Midi M i d i
Squire S q u i re
King K in g
monster m on st er

...that is, having the code for the full word, and then the code for the individual parts, in close proximity, and in order.

Am I barking up the wrong tree?

InVerse 05-29-2009 12:15 AM

If you want to send me a copy of your table file, I'd be willing to take a look at it and see if I can figure anything out in relation to the dictionary entries.

As for the multiple codes that appear to do the same thing... It's possible that there are minor differences that you haven't encountered yet. Maybe each one triggers something different in regards to music or portraits or any number of things that might not be present at the beginning of the game. (For instance, one RPG that I've done some preliminary hacking on contains like a dozen portraits of each character, each depicting a different mood, and there are a dozen different control codes that cause their name and one of the 12 portraits to appear.) Then again, it may not mean anything at all. (See previous reference to game programmers and crack cocaine.) At any rate, I would recommend staying with the lowest value byte until you determine what the differences (if any) are, since the lowest numbered byte is the one most likely to be "normal" if the other values do trigger some sort of change.

Not entirely sure what you're referring to about the bit that looks "a little more organized" but keep in mind that just because (for example) A=41, not all bytes with the value of 41 are going to be printing out the letter A. It's entirely common to see a spot in a ROM that says ABCDEFGHIJKLMNOPQRSTUVWXYZ in the text area, simply because some bit of data happens to have all of the values in a row. This may or may not mean anything at all. (Think about it this way... if there was a graphic that happened to take up the exact same dimensions as your alphabet, and said graphic happened to be in the same area of memory when loaded, the location where the layout of that graphic is stored in the ROM would look like ABCDEFGHIJKLMNOPQRSTUVWXYZ in the text area.)

And as for the level of response... I have a tendency towards teaching, so when someone has intelligent questions and shows initiative learning, I'm more than happy to offer as much help as possible. (Plus, if you become a master ROM hacker and decide to venture into the realm of Japanese-to-English translation, maybe you'll pick up one of the games I'm too lazy to do and then I can just play the thing instead. :D)

Kilyle 05-29-2009 12:44 AM

SorKing Table
 
1 Attachment(s)
Okay, I attached the table file. (I had to change it to a .txt file for the attachment window to accept it.)

Let's see, the "code" I used there: Mostly, if it's not an actual character that I can type, it's in parentheses. There's a list of icons with names like (swrd) and (glv) etc.; should be easy enough to figure out. For the quotes, I used _ to indicate which way they're pointing (because they're backwards from what I'd expect, and going 9B9C or 9D9E doesn't make a matching pair). The (up) and (dn) are arrows, as is (>). The tilde (~) indicates a code that produces a block; two tildes is the second type of block. There's a tiny check mark, a tiny E; I put the slash in parentheses because I read somewhere that a plain / symbol indicates a newline or something to some hex editors. The (nl) code is a newline.

There are control codes (or errors of some sort) that close the window immediately; I used ~---~ for these so they'd be obvious in the code. And if there's two question marks after anything, it's because I didn't go back and confirm it (generally because I was testing more than one code at the time).

There's a set of spaces with the code (_) to indicate that they're not the normal space used everywhere, and they're the spot I was thinking might be related to the extra spots in the font area.

Anyway, there you go.

InVerse 05-29-2009 03:10 AM

Okay... where exactly are you seeing these "dictionary" entries used? I tried using D0 (which, according to your table is the value of 'King') at a random point in the introduction but all I got were a couple of boxes.

I thought maybe they only worked in the dialogue. So I started the game up and named my character and got to the king and the first bit of dialogue, but searching in the ROM using your table, I can't seem to locate any of that dialogue. (And for a further test, I exited the castle and spoke to someone in the town, but wasn't able to find their dialogue, either.)

But then I realized that you'd clearly made too much progress on your table file to be on the wrong track, and based on the things you'd said you'd found, either I was missing something or you were hallucinating, and it seemed unlikely that you would be having completely logical hallucinations. So I scrolled through the ROM until I found the text.

And... I'd say that Reaper man's initial instincts were right and what you have is MTE, not dictionary compression. Still pretty easy to deal with. Unfortunately, I've only hacked MTE on a couple of occasions, so it's not something I can spout off instructions for from memory. And.... I can't seem to find whatever document it was that I originally learned how to hack DTE on myself. (DTE is Dual Tile Encoding, whereas MTE is Multi Tile Encoding. The difference is.... nothing, it was just originally called DTE because the first ROM anyone encountered it in (Final Fantasy II, I believe) only used 2 characters per byte. Once people started discovering ROMs that utilized more than two characters, the name was switched to MTE, but you'll still encounter old timers that use the term DTE.) Searching Google for DTE/MTE yields a bunch of documents on how to add MTE to a ROM, but nothing on how to hack existing MTE.

And then something that I saw in the ROM when I was first poking around it it comes to mind.... something that I thought I recognized but then thought I was wrong... because I was poking around in that something before finding the dialogue, and since the MTE doesn't actually work in the intro, my poking around in the other thing obviously had no affect... (Can you tell that I'm extremely tired at this point? It's not *actually* past my bedtime yet, I have another 30 minutes before I need to go to bed and still get a full night's sleep before I have to go to work in the morning, but for some reason I'm more exhausted than usual, so forgive the rambling (I realize that a good 90% of this post is going to be completely useless, but since I've now solved the problem (even though I haven't actually *revealed* the solution yet), I'm sure you'll live with it.)) (Note: Even when I'm exhausted, my grammar is still near perfect and I can properly close triple nested parentheses! Also, when I get tired, I tend to amuse myself by talking to myself in msgboard posts that are actually directed at someone else. Also, I think it's been over an hour since I started typing this reply.)

Anywayz... What we have is MTE. So... somewhere in the ROM is a table of those MTE values. What you want to do is take a fairly unique entry from your list of MTE variables (in your case, I'd recommend going with your first entry, 'King') and do a search for it in the ROM. Just do a basic text search (with your table loaded) for the word King. Nothing fancy about it at all, just the word King. In the case of your chosen game, I'm pretty sure you're going to recognize something familiar about the very first result.

Now, I can already envision certain questions you're immediately going to have. Unfortunately, I'm almost positive that there's no way my sleep starved brain is going to be able to remember the answers to them tonight. So, I'll leave you to play around with it in hopes that you'll uncover most of those answers yourself. If not, I'll try to find that aforementioned document tomorrow. Though now that I think about it, I don't think I actually was able to find that document whenever it came time for me to hack the MTE in Ultraman Ball, I think I just pestered someone (Gideon Zhi, possibly) until they explained it to me on AIM. (And, now that I think of it, maybe the document I'm thinking of never actually existed, maybe that was just an IRC conversation or messageboard post I read 10 years ago and just retconned it into being an actual tutorial.)

Wow. 7 (I suppose 8, now) paragraphs all just to state one fact. And I haven't even had a drink in several weeks. *Wanders off in the direction of his Jagermeister*

Kilyle 05-29-2009 06:42 AM

Quote:

Originally Posted by InVerse (Post 89441)
(Can you tell that I'm extremely tired at this point? ...for some reason I'm more exhausted than usual, so forgive the rambling (I realize that a good 90% of this post is going to be completely useless.... (Note: Even when I'm exhausted, my grammar is still near perfect and I can properly close triple nested parentheses! Also, when I get tired, I tend to amuse myself by talking to myself in msgboard posts that are actually directed at someone else.

Also, I think it's been over an hour since I started typing this reply.)

I sense a kindred spirit XD

Quote:

Okay... where exactly are you seeing these "dictionary" entries used? I tried using D0 (which, according to your table is the value of 'King') at a random point in the introduction but all I got were a couple of boxes.

I thought maybe they only worked in the dialogue. So I started the game up and named my character and got to the king and the first bit of dialogue, but searching in the ROM using your table, I can't seem to locate any of that dialogue. (And for a further test, I exited the castle and spoke to someone in the town, but wasn't able to find their dialogue, either.)
000F 4800, which starts with "You do not have a conquest marker" - what the guards say if you talk with them right after exiting the King's throne room (the moment you first get control of your character).

The guys I've been using to test my table are: the little girl running around (000F 67F0; she says they can't play on the hill anymore since monsters moved in), the kids' mother (000F 6420; she says pretty much the same thing), and the guards (000F 4800). They're right next to where you start.

Note: I've located things said in the throne room, and IIRC that included the intro of the King going "Yeah, okay, you can be an adventurer, get to it" (not in those words, of course), but I don't think I've located the game's intro, where it says stuff about your father Kanan and how you want to follow in his footsteps and whatnot. Since that's put in the middle of the screen instead of in a dialogue box, it might be a different font or table (etc.), so I haven't been too worried about finding it (yet).

Quote:

What we have is MTE. So... somewhere in the ROM is a table of those MTE values. What you want to do is take a fairly unique entry from your list of MTE variables (in your case, I'd recommend going with your first entry, 'King') and do a search for it in the ROM. Just do a basic text search (with your table loaded) for the word King. Nothing fancy about it at all, just the word King. In the case of your chosen game, I'm pretty sure you're going to recognize something familiar about the very first result.
I got this, at 0000 EFD0:

King monster the and you have a to ing ill an in on is er re ou st th he me en ed be e t s d y I the

Oddly enough, that looks like all the multi-character values I have on my chart. So I think we found the right spot.

Question is, what to do with it? Hmm hmm hmm.

Pattern-wise, I see that they've put the letters up, together with any spaces, between 00's. That... doesn't tell me much.

Should I be scanning through it with Tile Molester now, or is there more code stuff to be done first?

Quote:

(And, now that I think of it, maybe the document I'm thinking of never actually existed, maybe that was just an IRC conversation or messageboard post I read 10 years ago and just retconned it into being an actual tutorial.)
Did I tell you I sensed a kindred spirit? :D

EDIT: I just found this, seconds after I made my last reply:

The intro: 0001 A030, starting "For ages, the crown has been held". Done entirely in single-letter text, without any of the MTE's, apparently. Followed shortly by "Astina joined" then "Elrad" and "Midi" and then the names of several enemies (Bugbear, Goblin, etc.). A quick search also turns up "Elrad joined" and "Midi joined" in different spots.

Oh, also found 0001 F4A0, where the tables of character titles and spells are stored.

Also, Reaper man, I have to apologize. I made the same mistake with you that I just almost made with InVerse here:

You say "do a search for King" and I think "okay, King means D0, so... that's like everywhere in the entire game, and you're asking me to hunt through every single entry - it's like asking me to look for the word "the" in War and Peace!" But in fact you both meant "find the string K-i-n-g, which has four hex values totally different from D0" and it took me a while to realize that.

But once I got past that mental block: Instant results! So thank you both for being patient with me :)

InVerse 05-29-2009 12:02 PM

Quote:

Originally Posted by Kilyle (Post 89447)
I got this, at 0000 EFD0:

King monster the and you have a to ing ill an in on is er re ou st th he me en ed be e t s d y I the

Oddly enough, that looks like all the multi-character values I have on my chart. So I think we found the right spot.

Question is, what to do with it? Hmm hmm hmm.

Pattern-wise, I see that they've put the letters up, together with any spaces, between 00's. That... doesn't tell me much.

Should I be scanning through it with Tile Molester now, or is there more code stuff to be done first?

Edit one of those and then insert the value into an easily accessible text block and you'll see that editing that table you found (in this case, by table, I'm referring to the table that lists all of the words assigned to individual byte values) will change the text in the game. (For instance, I randomly changed one byte in the girl's text to D0, which printed out the word 'King' in place of one letter of her original text. Then I edited the word 'King' in the aforementioned table and changed it to 'Ring', loaded up the game again and lo-and-behold, the girl was now saying Ring instead of King.

Depending on how the game is coded, you may simply be able to short/lengthen the words used, as long as you don't use more total space than already allotted to the entire table and place a 00 between each word. If that doesn't work, then there is likely a pointer table that specifies the length of each word.

To learn about pointers, your best bet is probably The Mad Hacker's Guide to Pointers which is horribly formatted and really old yet still contains valid, useful information. I've been meaning to write an updated pointer guide, but haven't gotten around to doing so yet. But, basically, play around with that MTE table and see what happens.

Kilyle 05-29-2009 02:55 PM

Update
 
Well, that was an interesting experiment.

I changed "King" to "Butler" and "monster" to "alien", stuck 00's between them to separate them, and made sure the girl was talking about monsters/aliens.

I then played the game.

The King is now the Butler, and does things in the name of the Butler, and asks me to save the Butlerdom (a bit I knew was coming).

The girl says her line, then the second line of her text starts shifting through all the code of the game from "aliens" onward, interpreting it as text code. All the extra words in the dictionary, then various symbols and those funny blocks. One line displayed, then overwritten with another line, infinite loop until something I'm sure would go horribly wrong, so I stopped it.

I take it the pointers is something I must now embrace (unless I decide to limit myself to words only as long as those already there).

Next thing I'm thinking of trying, though, is the use of dictionary elements within dictionary elements. I mean, if I can define "ut" and "er" before I go defining "King" as "Butler" then I might still be able to make a four-letter definition....

ETA: I made a switch that left "aliens" fine yet left "King" one letter bigger than normal. It stopped the "overwriting text" error but I don't know if this will have other errors.

The thing is, the dictionary used to be this: King 00 00 monster

I had changed it to this: Butler 00 alien

Now I've changed it to this: Butle 00 alien 00

So... I guess the game has problems if it meant to point to a string but ends up pointing at a 00. I'm assuming from that Pointers guide that this means "Sequential Pointers" (the kind you say to run away from) but that's just a hunch from the behavior of the game.

Anyway, as regards the Pointers guide: What to change if it's not NES? Do I still account for a header, and if so, of the same size? Do the pointer addresses work in the same fashion as the NES ones? Or are we back to "experiment until you stop messing things up"? (I'm not against that, but information is usually a plus.)

ETA: Wow. This has got to be the coolest first choice in hacking projects EVAR.

'Cuz apparently the pointers are the hex values, no tinkering needed.

And they're like five lines above the dictionary anyway.

I am so hyped.

InVerse 05-29-2009 11:51 PM

Quote:

Originally Posted by Kilyle (Post 89456)
Anyway, as regards the Pointers guide: What to change if it's not NES? Do I still account for a header, and if so, of the same size? Do the pointer addresses work in the same fashion as the NES ones? Or are we back to "experiment until you stop messing things up"? (I'm not against that, but information is usually a plus.)

ETA: Wow. This has got to be the coolest first choice in hacking projects EVAR.

'Cuz apparently the pointers are the hex values, no tinkering needed.

And they're like five lines above the dictionary anyway.

I am so hyped.

In regards to Genesis pointers, I don't believe Genesis ROMs have headers (or, perhaps, all Genesis ROMs have headers) so you shouldn't have to do any calculations, as evidenced by the fact that you've already found the pointers. I think it's routine for the pointers to a MTE table to appear shortly before the table itself (at least, the two times I've hacked MTE, that's how it appeared) but for standard text pointers, they could be shortly before the main text block, shortly after the main text block or scrambled all to hell and back. (The original Dragon Ball game for NES has pointers that are about as organized as an earthquake. Oftentimes, pointers for two lines of text that are on the same screen may 50 lines apart.)

Congrats on finding the pointers so easily, a lot of people have trouble with pointers when they first start trying to hack them.

If you need any additional suggestions over the weekend, I may be a bit slow in replying. I have an 8 hour drive to a wrestling show tomorrow and an 8 hour drive home on Sunday, so my access to the Internet may be a bit erratic. (But I'll be bringing my laptop and it seems like even McDonalds offers free wireless Internet these days.)

One question, though... You're making a lot of progress in figuring out how the game works, but do you have any particular goal in mind for once you've got the system under your control? (Not that it's really necessary, hacking for the sake of hacking is a very honorable undertaking, and fully documenting a ROM can payoff handily when someone else uses your information to create their own ROM hack that you can enjoy.)

Kilyle 05-30-2009 01:18 AM

Quite the question, that....
 
Actually, although I tested some of the NES-style techniques for pointers, I ended up finding the Genesis key ("don't mess with it, just look for it" advice) on a forum in a quick search. So no extra points there (except perhaps for search-fu).

As to goals... well, after I finally got all this power in my hands, I totally blanked on what to do with it. I was thinking of doing an English-only hack of some sort before moving in to the translations I was thinking of (since Spanish, Esperanto, and Norwegian all require me to craft new letters, thus spending more time figuring out how to use those extra spaces). Whether I actually complete any hack... who knows?

I think it'd be cool to see someone else take up this project thanks to the info I provide. I don't think this game has gotten the press it ought to have gotten (possibly because of the name trouble, possibly because the translation to English is a bit flawed... who knows). It's got fun mechanics as far as combat.

Anyhoo... yeah, the basic idea was to figure out how to hack. I lucked out to get an easy game and competent and willing help right off the bat. I think the knowledge I gleaned from this little journey will help me program in the future, but as yet I'm not sure how.

If I end up continuing to hack ROMs (which seems likely), I'll be moving toward some translations of Dragon Warriors III and IV and Ultima: Quest of the Avatar (NES version), and perhaps some other games that I think get a little overlooked in the retro-gaming world.

Anyway, yeah, have a great weekend and thank you greatly for the help! I'll try to remember to come back and tell you how far I get :D


All times are GMT. The time now is 03:14 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.