Author
|
Topic: Need help with evil pointer! (Read 2 times)
|
Rappa
Guest
|
|
« on: March 31, 2009, 05:44:25 am » |
|
Hi
I've encountered such weird pointers and I want to ask for some advise. My Rom is HiRom. My text1 begins at $EE597, text2 begins at EE5AF
(Not the main text of the game, just what the characters speak when they die...)
In the Rom, there's a pointer table like this
...004EE30000410097E34000AFE34800EAE34D00...
Well, I don't know how much value do the pointers offsetted (add or subtract something to itself)? I don't know how many bytes do they, too.
But I just tested, the 97E340 and the AFE348 (I bolded them) are the pointers (I suppose). Well, I think it's 3 bytes pointer but when I changed the last bytes (40 for text 1 and 48 for text 2), nothing happens!
As you might notice, there's a 00 comes before each supposed-to-be-pointer. I changed the 00 (that comes before the pointer) and it did affect the text! The text doesn't appear! I've never seen any pointers table with a 00 seperates each pointer like this before!
So I wonder wethere it is 4 bytes pointer, including the 00 before, or just a 3 byte pointer without 00 but 00 is just code that seperates the pointers? And why the last byte (40, 48) don't affect the text? If so, why do they exist?
Have you ever seen these kind of evil pointers?
Thankyou everyone in advance.
|
|
|
|
RedComet
Guest
|
|
« Reply #1 on: March 31, 2009, 06:19:51 am » |
|
Try changing the 97 in the first pointer to 98 to make sure you've got the pointer. You could be corrupting the code, which would explain why the text doesn't appear when you alter the 00.
|
|
|
|
Rappa
Guest
|
|
« Reply #2 on: March 31, 2009, 06:38:16 am » |
|
I change 97 to anything else, and it does effects the text. That's why I think the pointer starts at 97, meaning 00 before it is somewhat an end/begin code, which is very odd.
Also, I don't know how to calculte these pointers, too. If you take 97E340, add 200 (for the header) and subtract the adress (EE597), the result is different than if you do with AFE348 and EE5AF.
This is my headache.
|
|
|
|
RedComet
Guest
|
|
« Reply #3 on: March 31, 2009, 06:50:02 am » |
|
Are you sure your rom even has a header?
|
|
|
|
Rappa
Guest
|
|
« Reply #4 on: March 31, 2009, 06:54:30 am » |
|
Yes yes I do.
As I said, these are not the main text of the game, but the text that characters speak when they die. I have no problem with the main text part, which uses 3 bytes pointer and add $800000 to itself.
I'm finding the value which these pointers (the one characters speak before dying) add to itself.
|
|
|
|
Nightcrawler
Guest
|
|
« Reply #5 on: March 31, 2009, 08:30:07 am » |
|
When you say 'affect the text', what does that mean? If you have the right pointers, changing it by one value will do exactly that. It will start the string one character forward. Is that what you see? If not, I don't think you have what you think you have. This applies to uncompressed text only of course.
|
|
|
|
Gideon Zhi
Guest
|
|
« Reply #6 on: March 31, 2009, 10:00:48 am » |
|
My best guess is that your pointers are actually two bytes apiece, and the 4000 4800 4D00 etc are separate controls for something else.
|
|
|
|
KaioShin
Guest
|
|
« Reply #7 on: March 31, 2009, 11:51:13 pm » |
|
This sounds like a perfect point to get started with debugging. Set a read breakpoint to those addresses in a debugger and look what the code does with these values. Shouldn't be too much voodoo for a beginner to understand.
|
|
|
|
hanhnn
Guest
|
|
« Reply #8 on: April 01, 2009, 03:32:35 am » |
|
0040: Gerrard 0048: Kinbois 004D: Gandolf
@rappa : how about this ?
|
|
|
|
Rappa
Guest
|
|
« Reply #9 on: April 01, 2009, 06:43:35 am » |
|
It will start the string one character forward. Is that what you see? Yes, it's exactly. Say, I suppose the pointer 1 is 97E340, text 1 is something like: cat and dog I changed the first byte (97) into 98 anc the result is : at and dog. So no doubt the pointer starts at 97. @KaioShin : Your suggestion is another way that I must check. I haven't seen any control code in pointer table like this. @hanhnn: Thank you very much. This might be a very big help.
|
|
|
|
Markliujy
Guest
|
|
« Reply #10 on: April 01, 2009, 08:06:02 am » |
|
Gideon's totally right.
EE597 - E397 = E0200
EE5AF - E3AF = E0200
So it's just double byte pointers, with a base of E0200.
|
|
|
|
|