Romhacking.net

Romhacking => ROM Hacking Discussion => Topic started by: paranvoi on February 03, 2012, 04:39:36 pm

Title: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 03, 2012, 04:39:36 pm
So I'm using Scizz's Advance Text (http://www.romhacking.net/utilities/427/) to translate Pokémon Fire Red. Not all in-game text is editable with that program, however, so to find the rest I need to use relative searching. The program I'm using is WindHex, and I'm trying my best to follow this tutorial (http://www.romhacking.net/documents/68/) by Jair. But try as I might, I can't seem to find ANY in-game text. :laugh:

Okay, so in Jair's tutorial he gives this table to use when searching for words:
Quote
1 A   2 B   3 C   4 D   5 E
 6 F   7 G   8 H   9 I  10 J
11 K  12 L  13 M  14 N  15 O
16 P  17 Q  18 R  19 S  20 T
21 U  22 V  23 W  24 X  25 Y
26 Z

(that table is probably going to show up badly mutilated here but hopefully you all get the point :D )

So OK. Let's say I want to find the line "your foe is weak". Out of those 4 words I decide to go with "weak", which according to that table should be rendered 23 5 1 11. So I search for this. What happens then? :

Quote
Sorry ... The string was not found.

Okayyy...
I read in a couple other threads that the first letter of a word should be left out for some reason (???) (something about capital letters?), so, okay, fine. I'll search for "eak", in other words "5 1 11". The result:

Quote
Sorry ... The string was not found.

D: Help? Am I doing something wrong? Do I need to "make a table" first?(seen talk of making tables on here even though I don't really get what a table is...?) ?????  :-X And YES, I am making sure to click "relative search" in WindHex, not any of the others (text, hex and kana search).

EDIT: wait!!! OK, I think I figured out the table!! So in Windhex I noticed "pokemon red version" on the right side of the screen:
(http://i10.aijaa.com/b/00557/9495645.jpg)

...and based on that I was able to come up with this table:
Quote
61 A   62 B  63 C   64 D   65 E
 66 F   67 G   68 H   69 I  6A J
6B K  6C L  6D M  6E N  6F O
70 P  71 Q  72 R  73 S  74 T
75 U  76 V  77 W  78 X  79 Y
7A Z

(lower case letters of course)

..BUT! Even using that table I still can't find anything. I tried searching for "weak" again, this time with string "77 65 61 6B" but still got the error message "the string was not found". What in the world is wrong? Also, there is no English at all visible on the right side of the screen in WindHex.. it's all garbled gibberish like "@.B..H..J.." etc D: Is it supposed to be like that? That little bit of text that I used to make that table, "pokemon red version" is literally the only English text I can see (aside from that "POKEMON FIREBEPRE" or whatever right above it)... where is all the dialogue and stuff???
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Vehek on February 03, 2012, 05:46:30 pm
You say you're doing a relative search, but it sounds like you're doing a search for a bunch of numbers (the places of the letters in the alphabet). That's not how Windhex works. Windhex already knows where all the letters of the alphabet are in relation to each other. You do a relative search for "weak" without the quote marks, not on the numerical values of their places in the alphabet.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: LostTemplar on February 03, 2012, 06:03:46 pm
Vehek is right. Also, what you are looking at in the screenshot is the file header (which contains the game name); this is also the reason why it's in plain ASCII (A=41... a=61... is just ASCII). It has nothing to do with the text within the game. So there are two possibilities I guess - the text within the game is not in ASCII, or it is compressed. In the latter case using a hex editor won't really work.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 03, 2012, 07:02:54 pm
You say you're doing a relative search, but it sounds like you're doing a search for a bunch of numbers (the places of the letters in the alphabet). That's not how Windhex works. Windhex already knows where all the letters of the alphabet are in relation to each other. You do a relative search for "weak" without the quote marks, not on the numerical values of their places in the alphabet.

... oh.  :laugh: Of course I'd go and make a mistake like that! Haha ::)

Okay, so this time I did a real relative search in the way you described.

(First of all, let me ask. Are you not able to do a relative search with spaces?? Because for example when I searched for "weak" I got 52 matches, and to lower that number I tried to search for the exact line I am looking for: "your foe is weak". But I got the "string not found" error again. And everytime I tried to search for more than one word (i.e. multiple words with spaces in between), I got that error. But if I removed the spaces and limited the search to just a single word, it worked fine. What gives?)

Anyway, I did a search for "flinched" and got 1 result:
(http://i6.aijaa.com/b/00332/9495919.jpg)

My question is what to do from here if I want to edit that text? Furthermore, how do I expand that so that I get the entire line, not just a single word from it? The whole line should be "[insert pokémon name] flinched". No idea how to search for the slot where the pokémon name goes. Anyway, I tried the options in that drop-down menu. "Create table" opens up a table editor with tons of what I'm guessing are ASCII characters, mostly Japanese kanji. O_O Useful in that on the left side of the table is all the characters used in the game as well as their corresponding symbol (e.g a=D5, b=D6, c=D7 ... in other words my table in the first post was way off :laugh: ) but I don't really know how I would use this to permanently edit the text. ????

"Dump data" gives me the option to save something to my computer. I tried it and ended up saving some sort of file to a folder... I opened it with Notepad and inside it read: [$003FB917] flinched        | A=B5 a=D5 0=A4

"Jump to starting/ending offset" don't seem to do anything...

What do I do? :0
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 03, 2012, 08:16:30 pm
(First of all, let me ask. Are you not able to do a relative search with spaces?? Because for example when I searched for "weak" I got 52 matches, and to lower that number I tried to search for the exact line I am looking for: "your foe is weak". But I got the "string not found" error again. And everytime I tried to search for more than one word (i.e. multiple words with spaces in between), I got that error. But if I removed the spaces and limited the search to just a single word, it worked fine. What gives?)

Relative search is based on the ASCII values of the characters provided. Spaces are characters. If the game's encoding scheme doesn't happen to have spaces in the exact same relative position to lowercase letters as ASCII, searching for a string with spaces won't work. You can, however, use wildcards (usually asterisks) if available. The same applies to uppercase characters.

Quote
Anyway, I did a search for "flinched" and got 1 result:
(http://i6.aijaa.com/b/00332/9495919.jpg)

My question is what to do from here if I want to edit that text? Furthermore, how do I expand that so that I get the entire line, not just a single word from it? The whole line should be "[insert pokémon name] flinched". No idea how to search for the slot where the pokémon name goes. Anyway, I tried the options in that drop-down menu. "Create table" opens up a table editor with tons of what I'm guessing are ASCII characters, mostly Japanese kanji. O_O Useful in that on the left side of the table is all the characters used in the game as well as their corresponding symbol (e.g a=D5, b=D6, c=D7 ... in other words my table in the first post was way off :laugh: ) but I don't really know how I would use this to permanently edit the text. ????

This is going to take a while, so sit back and listen.

Yes, you need to create a table. It's easiest to do in Notepad. Now that you have the hex values corresponding to the letters in "flinched," you can make a start on one. Since we have enough letters to confirm the encoding uses alphabetical order, we can fill in the blanks easily:

Code: [Select]
AB=!
D5=a
D6=b
D7=c
D8=d
D9=e
DA=f
DB=g
DC=h
DD=i
DE=j
DF=k
E0=l
E1=m
E2=n
E3=o
E4=p
E5=q
E6=r
E7=s
E8=t
E9=u
EA=v
EB=w
EC=x
ED=y
EE=z

I threw in "AB=!" as a freebie - I've played the game myself, so I know the sentence is actually "[name] flinched!" You'll have to figure out the uppercase letters and the rest of the punctuation on your own, but they should be easy now. For things like the Pokémon name placeholder, you'll have to figure those out through context - they'll be in the strings, right where you'll expect them to be.

Anyway. The next step is to find the pointer table - the block of ROM addresses which points to the individual strings. For a GBA game, it should be easy: find the starting address of a string, convert it to little-endian format (i.e. reverse the bytes: DEADBEEF becomes EFBEADDE), then search the ROM for that particular hex value. If you do have a 32-bit (four-byte) address, only search for the last 24 bits (3 bytes) - GBA ROM addressing maps almost perfectly to the file addressing without any conversion, but the most significant bit will have 08 added to it. Once you've found the pointer table, you can use Cartographer to dump the game's script to a text file, which you can then edit and reinsert using Atlas.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 03, 2012, 08:44:44 pm
Anyway. The next step is to find the pointer table - the block of ROM addresses which points to the individual strings. For a GBA game, it should be easy: find the starting address of a string, convert it to little-endian format (i.e. reverse the bytes: DEADBEEF becomes EFBEADDE), then search the ROM for that particular hex value. If you do have a 32-bit (four-byte) address, only search for the last 24 bits (3 bytes) - GBA ROM addressing maps almost perfectly to the file addressing without any conversion, but the most significant bit will have 08 added to it. Once you've found the pointer table, you can use Cartographer to dump the game's script to a text file, which you can then edit and reinsert using Atlas.

Sorry... I understood everything up until this last paragraph. Ok, so I need to find the pointer table. Got it. What do you mean by the starting address of a string? Using "flinched!" as an example. The string is DAE0DDE2D7DCD9D8AB, correct? But what is the starting address...?
Also regarding that little-endian format... when you went from DEADBEEF to EFBEADDE. For the word "DEAD" you moved the characters one letter ahead in the alphabet (e.g. D>E), but with "BEEF" you moved them one letter back (e.g. B>A). I'm confused...?
And what do you mean by 32-bit address? What address?
Could you also explain exactly what a pointer table is? Do you just mean a table where all the characters used in-game and their corresponding values are provided? At least when I click "create table with selected values" I get this window:

(http://i5.aijaa.com/b/00909/9495997.jpg)

Seems like the table is already there made for me? That's not the pointer table, is it?

You'll have to excuse my stupid questions. Totally new to this but willing to learn!

edit: Well one inconsistency I noticed with that table in that screenshot is that "!" is attributed to value 95, whereas when I did that search for "flinched!" there's clearly an AB after the string for "flinched". AB in the table editor however is assigned to the number 7. :\ But those lowercase letters (like a=D5 etc.) match up fine! Confusing....
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 03, 2012, 09:13:45 pm
Okay, computer math time.

Each hex code is one byte. Each byte is eight bits. So when I say "a 16-bit value," that's the same as saying a "two-byte value." 24 bits is three bytes, 32 bits is four bytes, and so on.

GBA uses little-endian values - the least-significant byte comes first. So DEADBEEF - that's DE AD BE EF - becomes EF BE AD DE; that is, the four bytes comprising the number are reversed.

Anyways, would the term "address" make any more sense to you if I said "memory offset" instead? In the screenshot, you've got the byte at file address 3FB917 highlighted; the GBA would map that to 083FB917. However, since it uses little-endian formatting, it would be stored internally as 17B93F08. That's what I meant when I said "if you have a 32-bit address, it'll be easier to search for the last 24 bits" (that is, if the data were at DEADBEEF in the ROM, you should search for just ADBEEF, or EFBEAD).

To reiterate: the pointer table is a list of all the starting addresses. It is different from the encoding table that tells the hex editor and script dumper how to convert the game's hex into human-readable text. It will be stored somewhere in the ROM, and if you want to edit the game's text, you'll need to locate it so you can either 1. modify it by hand (insanely tedious) or 2. tell Atlas how to modify it for you when you reinsert the script.

The table that WindHex has generated for you automatically is, again, based off of the assumption that the game uses an encoding analogous to ASCII - that is, it's wrong and should be ignored altogether. Seriously, it's easier to just type up the damn thing in Notepad than fiddle with WindHex. Make the partial table using the information you have, load it into WindHex, and you should be able to figure out more.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 04, 2012, 01:29:56 am
Okay Ryusui, I've followed your instructions carefully. :) I think I made some progress...

Well first of all I've advanced a little with the table... this is what I have so far:
Code: [Select]
94=
95=
96=
97=
98=
99=
9A=
9B=
9C=
9D=
9E=
9F=
A0=
A1=0
A2=1
A3=2
A4=3
A5=4
A6=5
A7=6
A8=7
A9=8
AA=9
AB=!
AC=?
AD=.
AE=
AF=
B0=
B1=
B2=
B3=
B4=
B5=
B6=
B7=
B8=, (comma)
B9=’ (apostrophe)
BA=
BB=A
BC=B
BD=C
BE=D
BF=E
C0=F
C1=G
C2=H
C3=I
C4=J
C5=K
C6=L
C7=M
C8=N
C9=O
C0=
C1=
C2=
C3=
C4=
C5=
C6=
C7=
C8=
C9=
CA=P
CB=Q
CC=R
CD=S
CE=T
CF=U
D0=V
D1=W
D2=X
D3=Y
D4=Z
D5=a
D6=b
D7=c
D8=d
D9=e
DA=f
DB=g
DC=h
DD=i
DE=j
DF=k
E0=l
E1=m
E2=n
E3=o
E4=p
E5=q
E6=r
E7=s
E8=t
E9=u
EA=v
EB=w
EC=x
ED=y
EE=z
EF=
F0=
F1=
F2=

Couple questions regarding that though. Is it absolutely necessary to find the corresponding character for every single one of those values? I mean, in the table editor it shows a lot of symbols like # and + that never once show up in the game, to my knowledge. Is it absolutely necessary to find out what value such characters correspond to?

Also, is it okay to add new values to my table? The values I quoted above are just what were listed in the table editor. But for example I've noticed that space is 00. Also either FB or FF (seen both) seem to be acting as some kind of line breaker. And the é in POKéMON corresponds to value 1B which also isn't in the table editor.

Basically I'm asking how much of the table do I actually need to fill in?

Next up, I tried hex searching based on the instructions you gave. First I tried with the 083FB917 -string that you listed for "flinched!" which gave me the "string was not found" error. So I tried with a different word. I did a relative search for "aquatic" and found its address to be 1922E6. I add 08- to the beginning and get 081922E6. Then with little endian-formatting I get 1908E622. When I search for this hex: "Sorry ... The string was not found". And yes I am selecting "hex search" and not "relative search".

Also, tell me please, if the pointer table is the list of all the starting addresses, does this mean I have to manually find the starting address for every word in the game? And what exactly does it mean to find the pointer table? Do I copy all of the starting addresses I find to a notepad document and just keep collecting them until I have them all...? Still a bit confused really as to what this pointer table thing actually is...
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: KingMike on February 04, 2012, 01:44:07 am
I add 08- to the beginning and get 081922E6. Then with little endian-formatting I get 1908E622.
The 32-bit little-endian value would be E6 22 19 08.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 04, 2012, 10:14:44 am
The 32-bit little-endian value would be E6 22 19 08.

Still not working. I tried E6221908 and got the "string not found" message. I then tried that same value with spaces (E6 22 19 08) and then asterisks (E6*22*19*08) (with "use * for wildcards" checked) and both gave me a message "hex string is missing one digit". And again, I am selecting "hex search" and not "relative search".

Help? D:
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 04, 2012, 11:28:41 am
The pointer table is a big directory of every single string the game uses. The fun part is, if you find one pointer, odds are you've found them all - they should be collected in a neat, if massive, block. Once you've found it, you'll need to find its start and end addresses (that is, the addresses of the first and last bytes of the pointer table), so you can feed that information into Cartographer.

I said it once and I'll say it again: FORGET WINDHEX'S TABLE EDITOR. It's easier to just type the thing out manually in Notepad, or whatever plain text editor you prefer.

Now. Yes, not all hex codes represent characters - that should have been obvious already. Some are control codes which handle formatting, like line breaks. The most important one you need to figure out is the end code, which looks to be either FF or FFFD - I can't be sure without more context (in a similar vein, I can't figure out if the "Pokémon name" code should be FD0F or just 0F).

When I say "the start address of a string," I don't mean "the start address of just any plain old word" - what use is "flinched!" to the game? You need the whole string, which includes the placeholder code. The actual start of the "X flinched!" string should be either 3FB914 or 3FB915 - again, I don't know whether the placeholder code is FD0F or just 0F, so be sure to try both.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 04, 2012, 11:44:13 am
When I say "the start address of a string," I don't mean "the start address of just any plain old word" - what use is "flinched!" to the game? You need the whole string, which includes the placeholder code. The actual start of the "X flinched!" string should be either 3FB914 or 3FB915 - again, I don't know whether the placeholder code is FD0F or just 0F, so be sure to try both.

I see! So, when I do a hex search, I need the address of the start of the sentence, not just a single word in the sentence, correct? I'm guessing that's how you got 3FB914 and 3FB915 from 3FB917 ; you just moved the final digit back to accomodate for the "pokemon name" code, which is either going to be 1-2 bytes (+ the space in between, which is another byte). Got it!

I converted 3FB914 to little-endian and got 14B93F08. Did a hex search and got a match! I tried the same with 15B93F08 and got an error message, so 14B93F08 should be right. I guess that also means the pokémon name code is FD0F and not just 0F, right?

Anyway, here's what the hex search returned:
(http://i4.aijaa.com/b/00168/9500283.jpg)

Now, how do I read this result? I mean, what do I do with it?
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 04, 2012, 01:04:27 pm
High five, man. That's the pointer table.

Now, like I said before, the pointer table tells the game where to look for each of its myriad strings. You might have figured this out already, but by default, you're restricted to however much space each original string had allotted to it - for example, you could change the string to "[NAME] winced!" (which is shorter) but not "[NAME] was momentarily cowed by the blow!" (which is much longer). But knowing where the pointer table is allows us to change that - by changing it. If we need more space for a string, we can tweak the string pointers so we have more space to work with. On GBA, we can even go as far as to relocate the entire script block if we need to, since the pointers can indicate any location in the ROM.

There are two ways you can go about this.

1. The manual approach: ferret out every single pointer and change them by hand as necessary. If you plan on changing the entire game's script, THIS. IS. MADNESS.

2. The automatic approach: dump the script with Cartographer and reinsert it with Atlas. Atlas can automatically change the pointers as necessary, though it needs special formatting to do so. Cartographer can actually be set up to insert that formatting while it dumps the script, though you'll need the start and end addresses of the pointer table.

So yeah. #2 requires a lot more effort to set up, but it'll save you ten times as much tedium in the long run.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 04, 2012, 01:46:24 pm
Oh great! I found the pointer table, excellent!

You said in an earlier post that the step to take after finding the pointer table is to dump the script using cartographer. But... how? Okay, you said I need the start and end addresses of the pointer table. How do I know where the pointer table starts and where it ends, though? Because it WindHex it looks huge, I can't make heads or tails out of where it starts and where it stops.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 04, 2012, 02:49:22 pm
Believe me, it stops eventually. See the pattern? "XX XX XX 08" over and over? Scroll up until it stops. That's the start of the pointer table. Now scroll down until it stops. That's the end.

Okay. Now, when you download Cartographer, it's already got an example setup: a command file, which tells Cartographer what to dump and how, a table file, and a batch file that automates the dumping process. All are set up with the original Final Fantasy for NES in mind. You'll need to create a command file for FireRed.

Here's a sample I created for Breath of Fire for GBA.

Code: [Select]
#GAME NAME: Breath of Fire (GBA)

#BLOCK NAME: Credits
#TYPE: NORMAL
#METHOD: POINTER_RELATIVE
#POINTER ENDIAN: LITTLE
#POINTER TABLE START: $FDD40
#POINTER TABLE STOP: $FDE08
#POINTER SIZE: $03
#POINTER SPACE: $01
#ATLAS PTRS: Yes
#BASE POINTER: $00
#TABLE: bof1e_dump.tbl
#COMMENTS: Yes
#END BLOCK

Now, since this is for a GBA game, it's already set up to recognize GBA pointers - you just need to change the game name, set the start and end of the pointer table to their appropriate values, and change the table file. "Atlas Ptrs" will automatically insert the formatting Atlas needs to update the pointers, and "Comments" will comment out the script - that way, you'll have the original English script for reference without having to delete or overwrite it.

You'll also need to add some extra formatting to the file to make Atlas recognize it, mind. Here's another BoF1 sample:

Code: [Select]
#VAR(MyTable, TABLE)
#ADDTBL("bof1e.tbl", MyTable)
#ACTIVETBL(MyTable)
#JMP($3A0000)

Again, you'll need to change the table file to whatever's appropriate, and change the address in the #JMP instruction to the start of the script block (or wherever you want to insert your script).

Finally, Cartographer and Atlas are both command-line programs - you'll need to run them from a command prompt. You can automate the process a bit with batch files, however. Cartographer comes with one you can customize: right-click on Cartographer.bat and select "edit" in order to modify the batch file to your liking. For Atlas, you'll probably need to create one, but the usage is simple:

Code: [Select]
atlas rom.gba script.txt
Just replace "rom.gba" and "script.txt" with the appropriate filenames. To make a batch file of this, type the command up in Notepad and save the file with a .bat extension.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 04, 2012, 04:01:15 pm
Okay!

I think I found the start and end of the pointer table:

(http://i1.aijaa.com/b/00705/9502389.jpg)
(turns out kinda small in this post, here's the direct link: http://i1.aijaa.com/b/00705/9502389.jpg)

In other words, the table starts at 003FDF40 and ends at 003FE500. Based on the example command file you posted, I made this. I wasn't sure if the 00 at the beginning of those strings needed to be removed, or if the dollar sign you have at the beginning of your strings needs to be added or not, but this is what I came up with:

Code: [Select]
#GAME NAME: Pokemon - Fire Red.GBA

#BLOCK NAME: Credits
#TYPE: NORMAL
#METHOD: POINTER_RELATIVE
#POINTER ENDIAN: LITTLE
#POINTER TABLE START: $3FDF40
#POINTER TABLE STOP: $3FE500
#POINTER SIZE: $03
#POINTER SPACE: $01
#ATLAS PTRS: Yes
#BASE POINTER: $00
#TABLE: bof1e_dump.tbl
#COMMENTS: Yes
#END BLOCK

Nothing else needs to be changed then? Pointer size, pointer space, etc?

Regarding that extra formatting you also posted, where does that go? I'm guessing it needs to come in between #COMMENTS and #END BLOCK, like this maybe? :

Code: [Select]
#GAME NAME: Pokemon - Fire Red.GBA

#BLOCK NAME: Credits
#TYPE: NORMAL
#METHOD: POINTER_RELATIVE
#POINTER ENDIAN: LITTLE
#POINTER TABLE START: $3FDF40
#POINTER TABLE STOP: $3FE500
#POINTER SIZE: $03
#POINTER SPACE: $01
#ATLAS PTRS: Yes
#BASE POINTER: $00
#TABLE: bof1e_dump.tbl
#COMMENTS: Yes

#VAR(MyTable, TABLE)
#ADDTBL("bof1e.tbl", MyTable)
#ACTIVETBL(MyTable)
#JMP($3A0000)

#END BLOCK

Also, I was reading another thread where you were helping someone do this same exact thing, and you said something about making sure to include the symbol "/" somewhere, because otherwise Cartographer won't know when to stop dumping the script, my computer will slow to a crawl and I'll end up with a gigantic text file etc. Is that backslash important here in any way?

edit: Okay, I missed the part in your post where you said the values in this part:
Code: [Select]
#VAR(MyTable, TABLE)
#ADDTBL("bof1e.tbl", MyTable)
#ACTIVETBL(MyTable)
#JMP($3A0000)

...also need to be edited. I'm guessing for #ADDTBL I need to include the script table that I make in Note Pad? What goes next to #VAR and #ACTIVETBL, then? And is the string that goes into #JMP the same as the starting string for the pointer table?

And again, regarding the actual text table. Is it okay to have an incomplete table like the one I posted on the first page, or is it imperative that I find the corresponding value for every single character used in the game?
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 04, 2012, 04:25:17 pm
Pay a bit closer attention. The start of the pointer table is actually on the line above, at 3FDF3C. The end is at 3FE514. (Also, you'll want to change the "Block Name" to something appropriate, like "Script". Not strictly necessary, but just letting you know.) You were close, mind, but you'd be missing a couple of strings if you dumped using those erroneously rounded addresses.

That last bit of formatting I mentioned doesn't go in the command file - it goes at the top of your script file, after you've dumped it. Now, it looks to me as though the pointers are in consecutive order, so if I'm right, you'll want to change the address in the #JMP instruction to 3FB219 (and yes, the dollar signs are important).

As for your last question, I double-checked, and your "end line" character should be marked with a forward slash so that Cartographer recognizes it as such. From the looks of things, that'd be FF, so your table file should include:

Code: [Select]
/FF=<END>
"<END>" is just an example - if you'd prefer some other marker, feel free to change it to whatever suits your fancy. Also, be sure to change the table file entry in the command file to the filename of your table file. You did complete the table file, right? Be sure to view the script in the hex editor using your table: if any known text characters show up blank in the right-hand side, then you're not done.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Normmatt on February 04, 2012, 06:22:43 pm
Code: [Select]
#GAME NAME: Breath of Fire (GBA)

#BLOCK NAME: Credits
#TYPE: NORMAL
#METHOD: POINTER_RELATIVE
#POINTER ENDIAN: LITTLE
#POINTER TABLE START: $FDD40
#POINTER TABLE STOP: $FDE08
#POINTER SIZE: $03
#POINTER SPACE: $01
#ATLAS PTRS: Yes
#BASE POINTER: $00
#TABLE: bof1e_dump.tbl
#COMMENTS: Yes
#END BLOCK

Your code only works on GBA games where the strings are within the first 16MB of the rom

you should be using:

Code: [Select]
#POINTER SIZE: $04
#POINTER SPACE: $00
#BASE POINTER: $F8000000

instead as it allows you to dump from anywhere within the whole 32MB GBA rom area.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 04, 2012, 07:01:25 pm
Okay, thanks! :3
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 05, 2012, 11:25:28 am
Okay, I just tried dumping the script with Cartographer and it didn't work. Cartographer opened and closed instantly (I know it's supposed to do that) and didn't create any file or anything with the text in it.

Before I get into that, where did you get the start address 3FDF3C? I can understand 3FE514 because you just counted 4 to the right, but where did the C in the start address come from?

Here's the command file I made for Fire Red, based on you guys's instructions:

Code: [Select]
#GAME NAME: Pokemon - Fire Red.GBA

#BLOCK NAME: Script
#TYPE: NORMAL
#METHOD: POINTER_RELATIVE
#POINTER ENDIAN: LITTLE
#POINTER TABLE START: $3FDF3C
#POINTER TABLE STOP: $3FE514
#POINTER SIZE: $04
#POINTER SPACE: $00
#ATLAS PTRS: Yes
#BASE POINTER: $F8000000
#TABLE: table.tbl
#COMMENTS: Yes

/FF=<END>

#END BLOCK

(wasn't sure where to put the /FF=<END>)

I then edited the .bat file in this way:
Code: [Select]
cartographer firered.GBA firered_commands.txt firered_script -m

pause

I wasn't sure about that "firered_script -m" part... it was originally "ff1_script -m" and I just changed the "ff1" to "fire red". There was no ff1_script.txt or any file like that in the folder so I assumed that whatever I put there doesn't actually have to correspond to any actual file. ?

I have both the ROM and the .tbl table file in the same folder as Cartographer.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 05, 2012, 01:30:57 pm
I said it quite clearly: your table file should include "/FF=<END>". It doesn't belong in the command file. Good catch on the pointers, though.

Anyways. If your ROM is "firered.GBA" and your command file is "firered_commands.txt," then yes, your batch file should be good to go. The "-m" tag at the end means "multiple" - if you had multiple blocks defined, they would each have been dumped to a separate text file (without it, everything would've been dumped to just the one). The output should be "firered_script_000.txt".

But what about your table file? You have finished filling that out, right? Capital letters, punctuation, and whatnot? Don't forget to identify the "placeholder" tags and things like linebreak codes.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 05, 2012, 02:19:32 pm
Quote
But what about your table file? You have finished filling that out, right? Capital letters, punctuation, and whatnot? Don't forget to identify the "placeholder" tags and things like linebreak codes.

Not yet. I've hit (almost) all the symbols that show up in the "what's your name?" -window in the beginning of the game (upper and lower case letters, numbers, punctuation) as well as the dollar sign. I'm just missing the backslash, which I can't find anywhere in the dialogue and can't figure out where it should go in the table. It could be B9, as I'm missing that value, but I'm also missing BA (and BB is capital A, and I can't figure out for the life of me what should come before capital A).

Regarding the placeholder tags and what not, how do I represent those in the table? The "pokémon name" tag is apparently FD02 (in the battle screen however it appears to be FD0F...), but how do I specify in the table what it is for? For example for capital letters A, B, and C, I have them represented with their values using an equal sign (BB=A, BC=B, BD=C, etc.) but what do I put next to FD02? "FD02=????" Or is it okay to just put FD02 in the table by itself without specifying what it does?

Also, I haven't found these symbols in the dialogue so I can't be sure if this has an effect or not, but the game also includes the symbols ♂ and ♀, for which I have found (read:made an educated guess) the corresponding values (B5 and B6), but when I put them in the .tbl file notepad complains that in order for these characters to be displayed properly, I need to save the file using Unicode instead of ANSI, but if I do that, WindHex isn't able to read the table (and instead displays everything as a period). If I save the file with ANSI however those symbols turn into question marks. What do I do about this...?

Also, is it possible that there is more than one linebreak code? Usually I see FB, but I could have sworn I saw FE being used for the same purpose somewhere...
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 05, 2012, 02:41:10 pm
Put down special codes in the table as tags, like with "<END>". Just make sure there's something descriptive between the pointy brackets, like "<NAME>" or something. If you have multiple that do similar things, you might use, say, "<LINE1>" and "<LINE2>".

WindHex is a little stupid when it comes to Unicode characters - it's not your fault, it's the program's. You can use a workaround, though, like marking them as "<MALE>" and "<FEMALE>" in the table.

Finally, if you're still having trouble figuring out all the character codes, try opening the ROM in a graphics editor like Tile Layer Pro or Tile Molester and searching for the game's font. It should - should - be arranged in the same pattern as the table.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 05, 2012, 03:48:08 pm
Um... I kind of have an extremely odd problem that I have no idea how to account for. :laugh:

(http://i3.aijaa.com/b/00120/9511811.jpg)

I've already established FD01 is the "player name" tag and the above screenshot demonstrates that. However, in battle, this same tag is used where the enemy trainer's pokémon's name should go:

(http://i11.aijaa.com/b/00811/9511812.jpg)

...  :o
(you can also see the "rival name" tag (RNAME) being used where a safari zone pokémon's name should go)

Well, I've already kind of noticed that tags used in battle and tags used outside of battle are independent of each other (or something like that). The (player's) pokémon name code for example is FD02 outside of battle, while in battle it is FD11 in most instances, otherwise FD0F (I think). So even though it looks like the same FD01 for example is being used for 2 different things, we're really looking at 2 different tags... one for battle and one for other dialogue, FD01* and FD01** perhaps. Is there any way though to indicate this difference in the .tbl though? Or is it okay to have this sort of mix-up in the sense that I can fix it manually after the text has been dumped (don't know how I would do that though)?
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 05, 2012, 05:34:57 pm
The actual meanings of the placeholders might be contextual - they might print different things depending on what's supposed to be displayed on screen. At any rate, as long as they're consistent between your translated script and the original script, you shouldn't have any trouble, regardless of what you actually label them.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 05, 2012, 07:14:06 pm
Hmm... I don't know what to say, but Cartographer still won't dump the script. I double-click the .exe and get this window for a split second:

(http://i4.aijaa.com/b/00793/9512532.jpg)

But nothing! Is it possible the firered_script_000.txt is being dumped in some other folder? That'd be really bizarre... my computer doesn't have a working search feature either (yay Windows 7) meaning I can't search for any scripts that have possibly been dumped elsewhere.

I did take /FF=<END> out of the command file and put it in the table. Here's my command file again:

Code: [Select]
#GAME NAME: Pokemon - Fire Red.GBA

#BLOCK NAME: Script
#TYPE: NORMAL
#METHOD: POINTER_RELATIVE
#POINTER ENDIAN: LITTLE
#POINTER TABLE START: $3FDF3C
#POINTER TABLE STOP: $3FE514
#POINTER SIZE: $04
#POINTER SPACE: $00
#ATLAS PTRS: Yes
#BASE POINTER: $F8000000
#TABLE: table.tbl
#COMMENTS: Yes

#END BLOCK

And the .bat file:
Code: [Select]
cartographer firered.GBA fr_commands.txt firered_script -m

pause

(I changed the name of the command file, even though in the screenshot it still shows up as firered_commands)

And yes, the name of the ROM and the command file match up with what's in the .bat .

I put /FF=<END> at the very end of the table, like this:
Code: [Select]
... ... ...
FD20=<FOENAME2>
FD21=<FOENAMETWIN>
FD23=<PLAYERB>
FE=<LINEB2>
/FF=<END>

Ideas...?
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 05, 2012, 07:23:28 pm
You're double-clicking the .exe, which is the same as trying to run it from the command prompt without arguments.

Double-click the .bat.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 05, 2012, 08:16:40 pm
You're double-clicking the .exe, which is the same as trying to run it from the command prompt without arguments.

Double-click the .bat.

WOWWW what a blonde thing to do  :laugh: And I'm not even blonde.

Okay, well I just ran the .bat and Cartographer barely dumped anything, in fact it dumped only the battle text and nothing else. It went all the way from $3FDF3C to $3FE510 but didn't get any dialogue, just stuff like //<PONAME2> is paralyzed!<LINEB2>It can’t move!<END> , etc.

Is it possible for there to be more than one pointer table? One for battle text, one for dialogue, etc?
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 05, 2012, 10:15:13 pm
Oh definitely yes. Breath of Fire's got six that I've found; Sylvanian Families had something on the order of fourteen.

For each of 'em, you'll set up a block in the command file, like you've got already: just copy everything from the "#BLOCK NAME" directive to the "#END BLOCK" (inclusive) and tweak the block name, pointer start, and pointer end as necessary. Might want to change "Script" in your current block to "Battle Text" or something similar, too.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 06, 2012, 11:29:37 pm
I found another pointer table, which appears to be quite huge. Start value 00012B, end value 1E9F5F. Trying to dump the script with the table causes Cartographer to crash. :\ Is it possible that I might have accidentally included 2 pointer tables in this....? Or is it possible for a pointer table to be this big? I found this table by searching for the hex code of a string in the dialogue, which is of course going to be a lot more expansive than the battle text, which would explain the size...

Start and end strings:

(http://i6.aijaa.com/b/00282/9518521.jpg)
Direct link: http://i6.aijaa.com/b/00282/9518521.jpg

Command file:

Code: [Select]
#GAME NAME: Pokemon - Fire Red.GBA

#BLOCK NAME: Battle text
#TYPE: NORMAL
#METHOD: POINTER_RELATIVE
#POINTER ENDIAN: LITTLE
#POINTER TABLE START: $3FDF3C
#POINTER TABLE STOP: $3FE514
#POINTER SIZE: $04
#POINTER SPACE: $00
#ATLAS PTRS: Yes
#BASE POINTER: $F8000000
#TABLE: table.tbl
#COMMENTS: Yes

#END BLOCK

#BLOCK NAME: Dialogue
#TYPE: NORMAL
#METHOD: POINTER_RELATIVE
#POINTER ENDIAN: LITTLE
#POINTER TABLE START: $00012B
#POINTER TABLE STOP: $1E9F5F
#POINTER SIZE: $04
#POINTER SPACE: $00
#ATLAS PTRS: Yes
#BASE POINTER: $F8000000
#TABLE: table.tbl
#COMMENTS: Yes

#END BLOCK
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 06, 2012, 11:47:17 pm
You need to pay a bit closer attention to what you're doing - you're finding numbers and going off half-cocked. Kudos for taking my lesson to heart regarding finding the actual start of the pointer table, but take a close look at what comes after: the table in the top screenshot starts at 128 (remember, pointers are little-endian - the telltale "08" comes at the end of each four-byte sequence!) and ends at 150 (the final pointer starts at 14B). There's also a second short one in there running from 1BB to 1D0.

The second screenshot's table starts at 1E9F28 and runs to 1E9F60, as you discovered, though there are a fair number of duplicates: you might want to double-check what's actually stored at those addresses.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 07, 2012, 01:40:20 pm
You need to pay a bit closer attention to what you're doing - you're finding numbers and going off half-cocked. Kudos for taking my lesson to heart regarding finding the actual start of the pointer table, but take a close look at what comes after: the table in the top screenshot starts at 128 (remember, pointers are little-endian - the telltale "08" comes at the end of each four-byte sequence!) and ends at 150 (the final pointer starts at 14B). There's also a second short one in there running from 1BB to 1D0.

The second screenshot's table starts at 1E9F28 and runs to 1E9F60, as you discovered, though there are a fair number of duplicates: you might want to double-check what's actually stored at those addresses.

I'm not sure I quite understand... are you saying that in those 2 screenshots I'm not looking at one big pointer table, but rather a whole bunch of different, tiny ones? Regarding the first screenshot, are you saying I would need to add 2 different end blocks to my command file, one for the table that runs from 128 to 150 and another for the table that runs from 1BB to 1D0? And then a separate end block for every short table I find in that huge gap from 00012B all the way down to 1E9F5F?

How exactly can you tell that in the first screenshot we are looking at 2 different pointer tables? Okay, so, at line 00000120 (in the top screenshot) the first 08 is the 5th from the right (sorry I don't know the string that would correspond to, I'm at school now and can't open WindHex to check). Because the 08 comes at the end of a 4-byte sequence, I need to count 4 bytes to the left (including the 08) and that would give me the start address for this table. The last 08 is situated 3rd from the right at line 00000160 and this would be the end address. Correct? Then you're saying we have another table start at line 000001B0, 4th from the right. This 2nd table ends at 000001D0 3rd from the right.
My question is, how do you know those are 2 different tables and not one same table? Why do we have one that runs from 128 to 150, and another that runs from 1BB to 1D0, instead of having just one table that runs from 128 to 1D0? How can you tell?
And what about the random 08's floating around in between those 2 tables? There's two at line 00000180, one being 2nd from the left and the other being 4th from the left (unless those are B's? can't tell). Why do those not belong to either of the 2 pointer tables you just pointed out in that screenshot?

If pointer tables are of such small sizes like this, doesn't that mean there are going to be about 500 of them total? D:
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 07, 2012, 03:00:59 pm
The pointers all have to "start" (or end, from our human-readable perspective) in "08." You're right that there does seem to be a stray pointer at 180; however, it's the only one between the two blocks, and feeding Cartographer a non-pointer to dump from will cause it to crash. You'd have to set it to dump as a block in and of itself.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 07, 2012, 07:03:07 pm
The pointers all have to "start" (or end, from our human-readable perspective) in "08." You're right that there does seem to be a stray pointer at 180; however, it's the only one between the two blocks, and feeding Cartographer a non-pointer to dump from will cause it to crash. You'd have to set it to dump as a block in and of itself.

I still don't get how to tell where one table ends and another begins? How did you know just by looking at that top screenshot that there were 2 tables there? I'm guessing this is what you are trying to tell me is there:
(http://i4.aijaa.com/b/00547/9525259.jpg)

But how did you know that those are 2 separate tables and not just one table? Is it because of the "gaps" in between? By that I mean there's no 08's at all on lines 00000170 and 00000190. And those 3 stray 08's that I circled (one of those might be a B actually)... okay, you know they're not part of a table because...? What do you mean "it's the only one between the two blocks"? Sorry, totally lost again...
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 07, 2012, 07:27:38 pm
You got it. They can't be pointers because they're not GBA ROM addresses. And if you try to dump them, Cartographer will crash.

Just FYI, the pointers will also be aligned on multiples of four, so not just any 08 will denote a pointer. So the four bytes starting at 180 are likely a pointer; the sequence starting at 1A4 definitely isn't.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 07, 2012, 10:30:15 pm
NOOOOO! I just wrote a long message and accidentally backspaced out of the window, and it got deleted. D:

Okay in short, I was asking what you do when the pointer table for something just doesn't seem to exist? D: The problem is this block of text here:

(http://i42.tinypic.com/2yufrrq.jpg)

Starting with "OAK: Oh, for Pete's sake..."
(The "I'll do my best!" line before that is part of the battle text block that I already dumped)
Whenever I search for the start address of any of the strings in this part of the dialogue ("OAK:", "the TRAINER", "But rather", etc.), I get taken to a "table" that looks like this:
(http://i41.tinypic.com/spf53q.jpg)

As you can see, there's a handful of 08's floating around there, but they're all stranded from one another and have no other 08's in their immediate environment. For example, the 08 I have highlighted has 1 line above it with no 08 in it and 4 below it with no 08. And we just established that it's not a pointer table if it has gaps in it like that, right? :\ But whenever I search for the start address of any string in Oak's dialogue here, I get taken to a table like that.

What do I do? There's got to be a working pointer table somewhere where this text is stored, right?

Also, can you explain why, when I try to dump this table, Cartographer crashes:
(http://i43.tinypic.com/elejc3.jpg)

This is one of the few strings in Oak's dialogue there in the first screenshot up top that seemed to return a valid table. There's an 08 on every line and they're aligned in multiples of four. Yet this table crashes Cartographer. What gives?

Here's the block code for that table:
Code: [Select]
#BLOCK NAME: oak1
#TYPE: NORMAL
#METHOD: POINTER_RELATIVE
#POINTER ENDIAN: LITTLE
#POINTER TABLE START: $E8580
#POINTER TABLE STOP: $E85BF
#POINTER SIZE: $04
#POINTER SPACE: $00
#ATLAS PTRS: Yes
#BASE POINTER: $F8000000
#TABLE: table.tbl
#COMMENTS: Yes

#END BLOCK
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Normmatt on February 07, 2012, 11:11:35 pm
Also, can you explain why, when I try to dump this table, Cartographer crashes:
(http://i43.tinypic.com/elejc3.jpg)

This is one of the few strings in Oak's dialogue there in the first screenshot up top that seemed to return a valid table. There's an 08 on every line and they're aligned in multiples of four. Yet this table crashes Cartographer. What gives?

Here's the block code for that table:
Code: [Select]
#BLOCK NAME: oak1
#TYPE: NORMAL
#METHOD: POINTER_RELATIVE
#POINTER ENDIAN: LITTLE
#POINTER TABLE START: $E8580
#POINTER TABLE STOP: $E85BF
#POINTER SIZE: $04
#POINTER SPACE: $00
#ATLAS PTRS: Yes
#BASE POINTER: $F8000000
#TABLE: table.tbl
#COMMENTS: Yes

#END BLOCK

That would be because after the first pointer the next 4 bytes aren't a pointer and cause reads outside the rom to occur aka crashing cartographer. You need to seperate the dump into 4 seperate blocks each one 4 bytes long just enough for each pointer nothing more.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 07, 2012, 11:15:31 pm
Normmatt's got it summed up. The pointers are "stranded," if you will, in the middle of other data - quite possibly ASM code, in fact. You'll need to either define these as separate blocks, or else dump the script in "raw" mode (which requires you to provide the start and end addresses of the text to be dumped, rather than the pointers to it) and insert the pointers into the dumped script manually.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 07, 2012, 11:57:09 pm
That would be because after the first pointer the next 4 bytes aren't a pointer and cause reads outside the rom to occur aka crashing cartographer. You need to seperate the dump into 4 seperate blocks each one 4 bytes long just enough for each pointer nothing more.

Oh my gosh that's going to take foreverrrrrr if I have to make a separate block for every single stranded 08 in the dialogue.  :-\

Normmatt's got it summed up. The pointers are "stranded," if you will, in the middle of other data - quite possibly ASM code, in fact. You'll need to either define these as separate blocks, or else dump the script in "raw" mode (which requires you to provide the start and end addresses of the text to be dumped, rather than the pointers to it) and insert the pointers into the dumped script manually.

Dumping the script in raw mode sounds like a good idea. So I gather the start and end address of a single string, right? Then what do I do?
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 08, 2012, 12:12:47 am
Double-check the Cartographer readme. You'll have to change the settings listed in the block. Alternately, open up the FF1 command file that came with it; there are two example blocks, one pointer-relative (like you've been using) and one raw.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: C_CliFF on February 08, 2012, 02:57:24 pm

Also, can you explain why, when I try to dump this table, Cartographer crashes:
(http://i43.tinypic.com/elejc3.jpg)

This is one of the few strings in Oak's dialogue there in the first screenshot up top that seemed to return a valid table. There's an 08 on every line and they're aligned in multiples of four. Yet this table crashes Cartographer. What gives?

Here's the block code for that table:
Code: [Select]
#BLOCK NAME: oak1
#TYPE: NORMAL
#METHOD: POINTER_RELATIVE
#POINTER ENDIAN: LITTLE
#POINTER TABLE START: $E8580
#POINTER TABLE STOP: $E85BF
#POINTER SIZE: $04
#POINTER SPACE: $00
#ATLAS PTRS: Yes
#BASE POINTER: $F8000000
#TABLE: table.tbl
#COMMENTS: Yes

#END BLOCK

From what I can see, the reason Cartographer is crashing is the POINTER SPACE. Since the table separates 17 bytes between each pointer, try and put $11 instead of $00.

-C_CliFF
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 08, 2012, 05:18:56 pm
Hmmm... I noticed in the FF1 blocks that came with Cartographer, that in the RAW blocks there was a different .tbl file than in the POINTER_RELATIVE blocks. Is it necessary to make a whole new table file specifically for raw blocks? Because I just dumped the table starting at E8580 using the raw method and got this:

Code: [Select]
//GAME NAME: Pokemon - Fire Red.GBA

//BLOCK #004 NAME: oak1
//Block Range: $E8580 - $E85BF

//<$58>h<$3F><$08> <MALE><$03><$48><$40><$21> :<$23><$F8><$01>B <$47>  <$95>h<$3F><$08>
<MALE><$03><$48><$01><$21> :<$19><$F8><$01>B <$47>  <$23>i<$3F><$08> <MALE><$03><$48><$40><$21> :<$0F><$F8><$01>B <$47>  <$64>i<$3F>

I'm guessing that's not supposed to look like that...

From what I can see, the reason Cartographer is crashing is the POINTER SPACE. Since the table separates 17 bytes between each pointer, try and put $11 instead of $00.

-C_CliFF

Crashed unfortunately. D: This was what my block looks like with that $11 added in:

Code: [Select]
#BLOCK NAME: oak1
#TYPE: NORMAL
#METHOD: POINTER_RELATIVE
#POINTER ENDIAN: LITTLE
#POINTER TABLE START: $E8580
#POINTER TABLE STOP: $E85BF
#POINTER SIZE: $04
#POINTER SPACE: $11
#ATLAS PTRS: Yes
#BASE POINTER: $F8000000
#TABLE: table.tbl
#COMMENTS: Yes

#END BLOCK
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 08, 2012, 07:29:18 pm
Try $10 instead of $11.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: C_CliFF on February 08, 2012, 08:17:17 pm
I think the problem here is actually the BASE POINTER. Are you sure you want to add $F8000000 to each pointer to get to the right adress where the text is stored?

Correct me if I'm wrong but the first line where the text is stored is at adress $3FDAE2? And the first pointer that the text points to is at $E8580?

If that's the case, replace the BASE POINTER from $F8000000 to -$FFC06426. ($3F08 - FFC06426 =  $3FDAE2)

-C_CliFF
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 08, 2012, 08:37:56 pm
No no no no no. #BASE POINTER is the address added to the pointer value that Cartographer reads from the ROM. In this case, it rolls over and cancels out the leading 08 when translating from the GBA address to the actual ROM address.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: C_CliFF on February 09, 2012, 03:36:54 pm
Yes, you're right.

This works:

Code: [Select]
#GAME NAME: Pokemon Fire Red (GBA)

// Start Adress: $3FDAE2

#BLOCK NAME: oak1
#TYPE: NORMAL
#METHOD: POINTER_RELATIVE
#POINTER ENDIAN: LITTLE
#POINTER TABLE START: $E8580
#POINTER TABLE STOP: $E85BF
#POINTER SIZE: $04
#POINTER SPACE: $10
#ATLAS PTRS: Yes
#BASE POINTER: $F8000000
#TABLE: firered.tbl
#COMMENTS: Yes

#END BLOCK

Output:

Code: [Select]
//GAME NAME: Pokemon Fire Red (GBA)

//BLOCK #000 NAME: oak1

//POINTER #0 @ $E8580 - STRING #0 @ $3FDC58

#W32($E8580)
//OAK: Inflicting damage on the foe<LINE2>
//is the key to any battle.<LINE1>
//<END>


//POINTER #1 @ $E8594 - STRING #1 @ $3FDC95

#W32($E8594)
//OAK: Lowering the foe's stats<LINE2>
//will put you at an advantage.<LINE1>
//<END>


//POINTER #2 @ $E85A8 - STRING #2 @ $3FDD23

#W32($E85A8)
//OAK: No! There's no running away<LINE2>
//from a TRAINER POKéMON battle!<LINE1>
//<END>


//POINTER #3 @ $E85BC - STRING #3 @ $3FDD64

#W32($E85BC)
//OAK: Hm! Excellent!<LINE1>
//If you win, you earn prize money,<LINE2>
//and your POKéMON will grow!<LINE1>
//Battle other TRAINERS and make<LINE2>
//your POKéMON strong!<LINE1>
//<END>

-C_CliFF
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 09, 2012, 03:53:08 pm
Ah-ha!

There's only one linebreak command after all! <LINE2> should be <LINE>, and <LINE1> should be <PAGE>.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 09, 2012, 04:33:26 pm
That does work, but where does the 10$ come from? I get that that's the "pointer space", but what exactly does that mean? Because there's 16 bytes in between the end of one pointer and the start of another... (in the screenshot)

Is there any way to dump multiple tables at once btw? Instead of doing all these tiny tables one by one? How is it that the script of the FF1 that came with Cartographer was able to be dumped to just 2 text files that contain everything?
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 09, 2012, 04:52:13 pm
That does work, but where does the 10$ come from? I get that that's the "pointer space", but what exactly does that mean? Because there's 16 bytes in between the end of one pointer and the start of another... (in the screenshot)

10 hex = 16 dec. Don't tell me you've gotten this far without knowing hex? >_>

Is there any way to dump multiple tables at once btw? Instead of doing all these tiny tables one by one? How is it that the script of the FF1 that came with Cartographer was able to be dumped to just 2 text files that contain everything?
[/quote]

Remove the "-m" option from the end of the command string.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 09, 2012, 06:25:41 pm
Is there any way to dump multiple tables at once btw? Instead of doing all these tiny tables one by one? How is it that the script of the FF1 that came with Cartographer was able to be dumped to just 2 text files that contain everything?


Remove the "-m" option from the end of the command string.

Doesn't the -m just force Cartographer to dump everything into the same text file? I still would have to make an individual end block for every single pointer table, for which I'd have to find the start and end address for every one, right? :\
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 09, 2012, 06:51:39 pm
Ah. Sorry, I misunderstood.

Believe it or not, FF1's a much simpler game - there's just one pointer table for all the game's dialogue. For Pokémon, there's a lot of different little specialized dialogue blocks each with their own pointer tables.

So yeah, there's really no way around it - except maybe choose a game with less text. >_>
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 11, 2012, 06:32:01 pm
Ah. Sorry, I misunderstood.

Believe it or not, FF1's a much simpler game - there's just one pointer table for all the game's dialogue. For Pokémon, there's a lot of different little specialized dialogue blocks each with their own pointer tables.

So yeah, there's really no way around it - except maybe choose a game with less text. >_>

I think what I'm gonna do is use Advance Text to edit what I can (=99% of the dialogue) and hit the rest using Windhex/Cartographer/Atlas (=battle text, menu text, etc.)

But arghhhh I'm having a problem again. =_= Can someone explain why I keep getting a "string not found" error when I try to do a hex search here:

(http://i40.tinypic.com/14c62v7.png)

The start of the string OLD COUPLE is at 23E809. In little endian formatting this should be 09E82308, right? Why does that value return an error when I do a hex search for it? D: And yes, I have "start search from the beginning" checked. And I get the same error when I search for the the start address of any of those trainer names.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 11, 2012, 08:35:30 pm
Well, I can add two more values to your table: 53=PK and 54=MN.

So. I'm...at a loss here. That should be the address, but then the formatting here is very, very odd - there's a lot of zero-padding in all the other strings. Try searching for another string address: if the actual start of the string doesn't work, try the start of the zero-padding.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 12, 2012, 12:00:55 am
Well, I can add two more values to your table: 53=PK and 54=MN.

So. I'm...at a loss here. That should be the address, but then the formatting here is very, very odd - there's a lot of zero-padding in all the other strings. Try searching for another string address: if the actual start of the string doesn't work, try the start of the zero-padding.

Hehe, good eye with those 2 new values, totally missed those :D

But yeah, still can't get the hex search to work. I'm trying both the start of the string and the start of the 0-padding, but I keep getting the same error message with every trainer name.

OH WAIT! I decided to try searching for the start address of the very first string in this collection of trainer names:
(http://i44.tinypic.com/wa1po7.png)

I did a hex search for the PK in PKMN TRAINER and got a match. I got excited thinking I found the pointer table where all the names were stored, like "yes, I found the motherload!" but whaddaya know, the pointer table was pitiful in size.

(http://i40.tinypic.com/idvd04.png)

When I dumped it, this is all I got:
Code: [Select]
//GAME NAME: Pokemon - Fire Red.GBA

//BLOCK #005 NAME: trainer_names

//POINTER #0 @ $D809C - STRING #0 @ $23EAC8

#W32($D809C)
//    <END>
//POINTER #1 @ $D80A0 - STRING #1 @ $23E558

#W32($D80A0)
//PKMN TRAINER<END>

I... kinda need to be able to translate more than just 1 out of all the trainer names in the game. :huh:

Any idea where those others might be stored? The start address of PKMN TRAINER is literally the only one that returns any match. Even if I search for the start address of the 2nd PKMN TRAINER (I have no idea why there are 2 back-to-back like that in the first screenshot?) then I still get the "string not found" message. :| Same thing happens if I search for the 0-padding. Helppp.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 12, 2012, 12:04:55 am
What does the other pointer point to? What's at 23EAC8?
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 12, 2012, 12:36:20 pm
What does the other pointer point to? What's at 23EAC8?

Oho, nice one, I didn't even notice that value there. This is what's at 23EAC8:

(http://i39.tinypic.com/25z110j.png)

It's the very end of the list of trainer names. Doing a hex search for it actually did return a match, but it wasn't very fruitful. Just a couple stranded 08's. There was what looked like a potential pointer table at the top:

(http://i41.tinypic.com/15wc7rk.png)

But I dumped it and got this:

Code: [Select]
//GAME NAME: Pokemon - Fire Red.GBA

//BLOCK #006 NAME: trainer_names2

In other words it was totally empty. :D

Here's a message someone else sent me about this problem. I already asked him to explain what he meant a bit clearer but maybe you can look at it too Ryusui and get something out of it  :P
Quote from: Tauwasser
Well, anyway, your current problem seems to be not finding pointers to the individual trainer data.
The reason for this is simple: There are none.
IIRC, all Pokemon games so far (at least GB/C + GBA) have always counted trainers from the start of the respective trainer class. So basically, you will need to find the first "Cooltrainer" on that list and look for a pointer to his data. All other Cooltrainers' data is then computed by counting 0xFF bytes, which end one trainer's data. You can go look for the start of the list. There should be a pointer to it regardless of me being correct or not. That way, you should find the master pointer table and find all sub table-entries from there. You will of course have to repoint the whole table for a sub-trainer type.

I don't really get what Tauwasser means here by "look for a pointer to his data". Is that something different from the start address to the string?
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 12, 2012, 01:06:33 pm
Okay, this is gonna be kinda funky: what he's saying is that the game doesn't have pointers to each individual string in this case. What it does instead is iterate through the list until it finds the string it wants.

Say the game tries to look up String #36 for a particular event. In normal cases, it would take the start of the pointer table and do a little math to get the address of Pointer #36, which would point to the string the game wants. In this case, it instead goes through the list and identifies each string ending by the telltale FF byte at the end.

The upshot of all this: good news! You don't need a pointer table, because the game just looks through the whole block for the string it wants! Horribly inefficient, but there you go. You can just dump the whole block in raw mode and reinsert it without any trouble.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 12, 2012, 02:02:01 pm
Okay, this is gonna be kinda funky: what he's saying is that the game doesn't have pointers to each individual string in this case. What it does instead is iterate through the list until it finds the string it wants.

Say the game tries to look up String #36 for a particular event. In normal cases, it would take the start of the pointer table and do a little math to get the address of Pointer #36, which would point to the string the game wants. In this case, it instead goes through the list and identifies each string ending by the telltale FF byte at the end.

The upshot of all this: good news! You don't need a pointer table, because the game just looks through the whole block for the string it wants! Horribly inefficient, but there you go. You can just dump the whole block in raw mode and reinsert it without any trouble.

Oh, cool! Good to know :laugh:

Well I've gotta be doing something wrong. I dumped the block in raw mode and got this:
Code: [Select]
//GAME NAME: Pokemon - Fire Red.GBA

//BLOCK #007 NAME: trainer_names (raw)
//Block Range: $FB93 - $FC03

//<$08><$80><$20><$40><$02><$08><$40> <$28><$03>V <$20><END>

Aiyaiyai...

Here's the end block I made for that:
Code: [Select]
#BLOCK NAME: trainer_names (raw)
#TYPE: NORMAL
#METHOD: RAW
#SCRIPT START: $FB93
#SCRIPT STOP: $FC03
#TABLE: table.tbl
#COMMENTS: Yes
#END BLOCK

I wasn't really sure where to stop the script. I did a hex search for that 23EAC8 value and just picked the position of the 08 at the end of the string that came up.

EDIT: I just tried it again with this block:
Code: [Select]
#BLOCK NAME: trainer_names (raw)
#TYPE: NORMAL
#METHOD: RAW
#SCRIPT START: $23E588
#SCRIPT STOP: $23EAC8
#TABLE: table.tbl
#COMMENTS: Yes
#END BLOCK

In other words I'm using the start and end of the block of trainer names itself and not doing any hex searches. But this too resulted in a super small amount of dumped material:

Code: [Select]
//GAME NAME: Pokemon - Fire Red.GBA

//BLOCK #007 NAME: trainer_names (raw)
//Block Range: $23E588 - $23EAC8

//<END> FOUR<END>OLLECTOR<END>   POKéMANIAC<END>IST<END> RANGER<END>
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 12, 2012, 02:54:02 pm
Make an alternate version of your table, and remove the "/" from the start of the end tag. That should work.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 12, 2012, 03:05:50 pm
Make an alternate version of your table, and remove the "/" from the start of the end tag. That should work.

Just tried that. Dumped the same exact thing :\

This is what the end of my alternate table looks like:
Code: [Select]
FF=<END>
Didn't change anything else in it. And yes I did remember to go into the command file and change the text in the #TABLE slot of the end block to match the file name of the alternate table.

? D:
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 12, 2012, 03:59:56 pm
Okay, silly suggestion. Open up your Cartographer.bat file (the one you double-click to dump the script) and add one line to the end, if it's not there already:

Code: [Select]
pause
This means that the batch file will pause after running Cartographer instead of vanishing into the ether, so you can actually read what it has to say. If Cartographer's throwing up some kind of error, this is how you can find out.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 12, 2012, 04:05:31 pm
Okay, silly suggestion. Open up your Cartographer.bat file (the one you double-click to dump the script) and add one line to the end, if it's not there already:

Code: [Select]
pause
This means that the batch file will pause after running Cartographer instead of vanishing into the ether, so you can actually read what it has to say. If Cartographer's throwing up some kind of error, this is how you can find out.

"Pause" was already there, unfortunately... :\ Still no dice. Here's what my .bat file looks like:

Code: [Select]
cartographer firered.GBA frcommands.txt firered_script -m

pause

?

February 14, 2012, 04:58:17 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
Bumping this in hopes that maybe someone has a solution to the above conundrum...
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 14, 2012, 07:13:21 pm
I'm stumped here, too.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Darkdata on February 14, 2012, 07:47:32 pm
Hey! I gave you that table file a while ago, you can just load it and search normally.

You should read the threads that you make before! LOOK! (http://www.romhacking.net/forum/index.php/topic,13825.msg201280.html#msg201280) It even tells you how to re-point strings that are too long!

You asked the same question on the pokecommunity too! With the same answer.

I'll go grumble in a corner now...
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: Ryusui on February 14, 2012, 09:05:33 pm
He's past that point. Now he's having trouble getting it to dump the trainer names.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 14, 2012, 09:51:21 pm
Hey! I gave you that table file a while ago, you can just load it and search normally.

You should read the threads that you make before! LOOK! (http://www.romhacking.net/forum/index.php/topic,13825.msg201280.html#msg201280) It even tells you how to re-point strings that are too long!

You asked the same question on the pokecommunity too! With the same answer.

I'll go grumble in a corner now...

Ok, I admit I forgot I made another thread here, thank you for answering to it. It was very helpful. Your table is also much more complete than mine, I appreciate that too! :) The part about replacing pointers went a bit over my head but that's okay... As for the pokemon community or whatever if I recall correctly they require new threads to be approved before they appear, I made 2 and they both never seemed to go through the filter so I gave up, I can't help it if the mods decided to accept one thread ages after I wrote it at a time when I've long forgotten about it. :P

But maybe you have an idea how to get the trainer names to be dumped? :\ Go a couple posts back and you'll see the problem there.
Title: Re: Windhex - Sorry ... The string was not found. (Help!!!)
Post by: paranvoi on February 22, 2012, 04:59:41 pm
Ok, I've got to be doing something wrong. D: I just tried to raw dump a different block of text and got the same problem I've been having repeatedly, i.e. ended up with a super short text file that contains almost nothing. Just to be clear: when you raw dump, you don't do any hex searches, right? You just add the start and end addresses of the text block itself, NOT its pointer table, right? Here's the text I'm trying to dump:

(http://oi40.tinypic.com/jr6ulk.jpg)

I tried to raw dump that using this end block:

Code: [Select]
#BLOCK NAME: menu_pok(raw)
#TYPE: NORMAL
#METHOD: RAW
#SCRIPT START: $1B7CC1
#SCRIPT STOP: $1B7E14
#TABLE: table_raw.tbl
#COMMENTS: Yes

#END BLOCK

And the result was this:
Code: [Select]
//GAME NAME: Pokemon - Fire Red.GBA

//BLOCK #008 NAME: menu_pok(raw)
//Block Range: $1B7CC1 - $1B7E14

//HPENDMODEEND

Does anyone have any idea what I'm doing wrong here? :| Is there something special I need to take into consideration when dumping text raw?