+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  I got a few questions
Pages: 1 [2]
Author Topic: I got a few questions  (Read 1196 times)
Nightcrawler
Guest
« Reply #15 on: February 22, 2007, 10:34:16 am »

The only difference between DTE and MTE is the fact that MTE has an end entry character so it can be variable in length.

What does that mean for your routine? Not much. It's simple. When your code jumps to what would have been a DTE entry writes two characters and returns, you'll change that bit of code to write characters until it hits the end entry character and then return.

That's why I never understood why anyone uses DTE anymore. MTE is compatible with DTE and encompasses so much more. And it barely takes anymore code to do.


As for how to implement it in your game. Take a step back and think about what you're doing. Forget about individual lines of code. What are you doing on a conceptual level? The details of your text engine don't really matter.

1. You need to recognize an MTE entry. If the game already does this, you can work with it, or you can make the game recognize a new value for MTE entries. Let's say it's 0x45. So anytime, you see a value 0x45 in the text routine, you best be jumping out to the MTE routine.

2. In the MTE routine, you'll load the next value after 0x45 which is your MTE entry. You'll use that as an index to a table(or as an entry counter if you want to do lookup that way). You'll find the MTE entry in the table. You'll print characters in that entry until you hit an end entry byte which can be whatever you want it to be.

3. Now you return back to the original routine make sure your text pointer is at the correct entry and go on as normal.

That's all you're doing. The only real work is figuring out where to insert your code into the existing game routines. Any decent debugger will help you figure that out. You'll want to start by inserting your MTE byte recognition in the main text routine after it loads the character. You'll want to stick your main MTE routine anywhere there is accessible free space.

As for finding the existing MTE tables. Well, you can take the information I just gave you and use a debugger and trace the code. Should be VERY easy that way if your skilled enough to use one. The other way is to examine the text. Figure out what a specific MTE entry is and search for it in the ROM. If you've got the right location, you can edit that text and see it change in the game everywhere it's used.

Then you know you've found your table. The you can examine it and see how it is set up. Each entry probably has an end entry marker. There may or may not be a master pointer table. It will be something along those lines. If you can find where the table is, you'll understand how it works with a bit of investigation.
Kagemusha
Guest
« Reply #16 on: February 22, 2007, 06:43:46 pm »

Thanks for information. I'm not sure how to trace the code to find the existing tables though. FCE UXD has a trace logger and code/data logger. Would one of those be what I would want to trace the code?
RedComet
Guest
« Reply #17 on: February 22, 2007, 07:13:50 pm »

You'll want to use the trace logger.
Kagemusha
Guest
« Reply #18 on: March 04, 2007, 03:28:25 pm »

Well I've got a trace logger file, but I am somewhat uncertain on how to find what I want and what I want to look for. What I think I want to find is the code that loads the first dakuten. I'm uncertain right now and so far I've turned up no results. So could somebody point me in the right direction. Also since someday I might alter the MTE code to load to different characters, is it possible or very easy to add more characters to a MTE value? Thanks
Nightcrawler
Guest
« Reply #19 on: March 04, 2007, 04:31:33 pm »

Take a step back. Think about what you're doing. What do you already know? Use that information and proceed from there.

Find a known string offset where an MTE entry is used. You should already know this.

In your trace dump, you'll want to search for this offset. This will be the point where the MTE control byte is loaded from the script.

Just follow it from there. The game's MTE routine will execute then.

You know where the font is stored in the ROM, right? So, if you see the game has loaded the first font letter of the MTE entry, you know you've gone too far and the information you're looking for has happened before that. That will help you narrow down the code space you're interested in looking at.
Pages: 1 [2]  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC