Reputation: 129
I am Programming on Mac OS X 10.6 with XCode. Im trying to make a Programm that "decrypts" a Pokemon GBA game so that you can read the dialogs of the game with any Text Editor.
I already got a programm finished witch does that, so I can read all Text Data.
My problem is, that I need to change the clear Text back to Hex after editing it, but I have no Idea what im making wrong.
string PathDE;
string PathGBA;
string Zeichen;
int kontrolle = 0;
int current = 0;
char buffer1[3] = "00";
char buffer2[3] = "a1";
...
schreiben.open(PathGBA.c_str(), ios::out | ios::binary); //writes out the edited hex
lesen.open(PathDE.c_str(), ios::in); //reads in the plain text
while(current <= kontrolle){
lesen.read(reinterpret_cast<char*>(&a), 1);
converter << a;
converter >> Zeichen;
if(Zeichen == "_"){
schreiben.write(buffer1,3);
}
else if(Zeichen == "0"){
schreiben.write(buffer2,3);
}
...
I Tryed that, but when I open the result in a Hex Editor, the ASCII code is only a8.a8.a8.a8... and so on till eof, and the Hex code is 61 38 00 ... till eof.
I also tryed other methods, but all with the same result, I cant write the decoded GBA as Hex so I can play it with edited Text.
Upvotes: 0
Views: 1944
Reputation: 35
You will want to convert your string into a byte[] with the correct encoding. Here is the Gen3 text table for Pokemon http://datacrystal.romhacking.net/wiki/Pok%C3%A9mon_FireRed_-_TBL
Once converted correctly you will simply just insert it into your rom.
Sorry if this doesnt help much but I only have made c# Pokemon tools, not c++.
And btw pokemon doesnt use a ascii hex encryption it uses a form of utf8.
Upvotes: 0