News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Looking for specific hex editor  (Read 9919 times)

Klarth

  • Sr. Member
  • ****
  • Posts: 494
    • View Profile
Re: Looking for specific hex editor
« Reply #20 on: June 18, 2011, 01:54:42 am »
There is one part I'm not sure how to handle though, which is the questions. In the two-person dialogue there will occasionally be questions, when answered it uses the pointers at top to determine which block of dialogue it sends you to. The problem is that the encoding switches here. The choices you're given are encoded in sjis instead of the remapped sjis used in the rest of the dialogue.

There is a control code for when these question blocks appear, but I'm unsure if there's any good way to handle this. The only thing I could think of would be to have two table files loaded and for that control code to switch table files in the dumper/inserter. Is there any reasonable way to handle this?
So to dump this script, you'll have three main parts.  A hex "parser" to peek and see if you need to switch to a new table (or write commands for the inserter) and one table object for each of the two different encodings.  At least that's what I do.

To insert, I'd suggest you look into Atlas...even if it's just for ideas.  We were talking about embedded pointers above and what they can do.  Atlas can likely save you from creating an inserter, but at the cost of having a messier script.  You can get Atlas from the link below to check out (it's a command-line tool, so it's perfect for .bat insertion of tons of files/scripts) and look at example #4 for a simplistic embedded pointer.

http://www.romhacking.net/utils/224/

Nightcrawler

  • Hero Member
  • *****
  • Posts: 5787
    • View Profile
    • Nightcrawler's Translation Corporation
Re: Looking for specific hex editor
« Reply #21 on: June 22, 2011, 08:14:43 pm »
Klarth/Gideon:

I understand the concept as Klarth explained, but I'm still a little unclear on how you get these defined to output in a dumper. What have you done in the dumpers for the games mentioned that use it? I have definitely handled this type of thing before, but not exactly sure how to do it in the manner Atlas prescribes.
TransCorp - Over 20 years of community dedication.
Dual Orb 2, Wozz, Emerald Dragon, Tenshi No Uta, Glory of Heracles IV SFC/SNES Translations

Klarth

  • Sr. Member
  • ****
  • Posts: 494
    • View Profile
Re: Looking for specific hex editor
« Reply #22 on: June 22, 2011, 10:05:07 pm »
I understand the concept as Klarth explained, but I'm still a little unclear on how you get these defined to output in a dumper. What have you done in the dumpers for the games mentioned that use it?
Guest is probably the guy to ask when it comes to this since he wrote (AFAIK) all of the custom dumpers involving nasty embedded pointers.  I think Gideon did some scripts by hand too...probably searching control codes and script dump addresses.

If I made the dumper, I'd make a two pass parser.  First pass would strictly be for embedded pointer logic, second is to write out commands while dumping text.  You need to do a double pass because text can come after pointers and vice-versa.  If every string (or section of a string), had a unique id (like what could be done with XML), it could probably be done with a single pass.  It wouldn't be too bad to create a generic dumper for control code pointers, but there's a lot more complexity when embedded pointers are used to define structures (contiguous blocks of text with pointer blocks in between, trees, etc) as we discussed before.

Nightcrawler

  • Hero Member
  • *****
  • Posts: 5787
    • View Profile
    • Nightcrawler's Translation Corporation
Re: Looking for specific hex editor
« Reply #23 on: June 23, 2011, 09:50:56 am »
What's the best way to get a hold a Guest? I'm interested in how when using the dumper, the user defines what control codes will translate into embedded pointers and how it is done. I wonder if he'd send me over some course code or some of the dumpers.

We're getting there with the complexity issue. I have made a good deal of progress including a TreeView/Property Grid interface in TextAngel similar to what we previously spoke about. That would allow for handling of much more complex situations by allowing manual editing of the tree. It would also open up easy transfer to XML, as well as possibility to actually do the translation in-program since the strings are in the tree. Some interesting things are possible. I should have new screens to show soon. :)
TransCorp - Over 20 years of community dedication.
Dual Orb 2, Wozz, Emerald Dragon, Tenshi No Uta, Glory of Heracles IV SFC/SNES Translations

Gideon Zhi

  • Discord Staff
  • Hero Member
  • *****
  • Posts: 3532
    • View Profile
    • Aeon Genesis
Re: Looking for specific hex editor
« Reply #24 on: June 23, 2011, 01:49:04 pm »
Yeah, I tend to add in my EMBs after the fact, by hand. It's a huge chore, especially for games like Mystic Ark or Gun Hazard which, as mentioned, have thousands of the things. (GH's total was around 3000, Mystic Ark's around 6000.)

I also tend use embedded pointers to create easily-movable pointer tables. I know that's not what they're originally meant to do, but it's a quick-and-dirty hack that makes a lot of sense for games that have a lot of small blocks stacked one after the other. Basically, I figure out how the game gets the address of the pointer table - whether it's through another 24bit table or some LDAs or whatever - and rig up a write to that address. Then I set up an embedded pointer for each pointer in the table, and map it to the corresponding string later in the block.