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.