+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  [Cartographer] Overlapping strings
Pages: [1]
Author Topic: [Cartographer] Overlapping strings  (Read 2 times)
abw
Guest
« on: August 23, 2009, 09:47:26 pm »

If I have two pointers pointing to the same string, Cartographer gives me two copies of the string. If I have one pointer pointing to a string and a second pointer pointing to a word within that string, Cartographer gives me the entire string from the first pointer and then an extra copy of the same string starting from the second pointer. I can sort of detect the first case by examining the comments (e.g. //POINTER #0 @ $0 - STRING #0 @ $0 and //POINTER #1 @ $2 - STRING #1 @ $0 are clearly two pointers pointing to the same string), but if the source text is compressed in any way (even just DTE) there's no reliable way to detect the second case from the output.

UHR (which rather spectacularly fails to install on my new computer) uses different syntax but does essentially this for the first case:

#W16($0)
#W16($2)
This is a string.<END>

and this for the second case:

#W16($4)
This is a string that says
#W16($6)
"BOO!"<END>

On the other side of the coin, is there any way to show gaps in an otherwise continuous block of text? I have at least one string that appears to have been prematurely terminated, and the extra bits don't show up in the output. UHR does that case something like this:

#W16($8)
This is a string that ends.<END> But there's still extra text that's just sitting here without anything pointing to it!<END>

Are these things that Cartographer can do? #METHOD: POINTER and related all seem to start from the pointer table and add the text, so I'm guessing the answer is no. I'm looking for something that starts from the text and adds pointers. I haven't seen Cartographer's code, but I suspect that kind of a change would be fairly fundamental. If they turn out to be easy to add, does anyone else think these would be useful features? If not, does anyone know of another utility that will do what I want? Or maybe I should just spend more time convincing UHR that my computer isn't that bad a place to hang out?

(Yeah, I know I can just RAW dump the pointer table and text in straight hex and then do the string length comparisons myself, but that's annoying. Also, I like Cartographer enough to want it to be even better  Smiley)
RedComet
Guest
« Reply #1 on: August 28, 2009, 11:03:04 pm »

Sorry for the delayed response. I saw this the other night but didn't have a chance to reply.

To answer your first question, no, there's no way for Cartographer to detect pointers that point to the same string. The way it works, is it reads through the pointer table and dumps the string referenced by each pointer separately. So if a string is pointed to by two or more different pointers, it's printed in two or more different places in the script. I could probably add some code to read through the pointer table and check for duplicate pointers. Hmm. That'll have to wait until later in the year when I get some free time from school.

As for your second question, no, Cartographer won't dump a string that has two separate end tokens. The way the pointer dump method works is it gets the pointer, goes to the address it references and then dumps the string until one of the specified end tokens is found, at which point it returns from the dumping function and moves on to the next pointer.

These are actually some really good ideas, though. I'm gonna save this for when I get back to working on Cartographer. Smiley
kingofcrusher
Guest
« Reply #2 on: August 28, 2009, 11:16:07 pm »

Those would be awesome additions. It would be kinda cool if it also could detect pointers that pointed to separate but identical strings and let you know. The program is amazingly helpful though, I love it and use it all the time.
abw
Guest
« Reply #3 on: August 30, 2009, 10:33:28 pm »

Hey, no problem. Those who expect instant gratification, even on the internet, are doomed to disappointment Tongue

That's pretty much what I figured your answer would be, but I thought it was worth checking just to make sure I hadn't somehow skipped over the section of the readme detailing how to do exactly what I want or done something stupid like that.

I can't really take credit for the ideas, either, only for pointing them out. If I hadn't been messing around with a pre-existing UHR dump, I never would have even noticed the difference. I'm glad to hear you think they're worth implementing, though, and I'll look forward to their eventual release Wink
Pages: [1]  


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