I want to make a "team checker" fifth generation physical tournament but there is a part that does not work well. The part of the block itself, but to decrypt the .sav file doesn't work.
First I want to try a pkm extracted directly from the .sav and then adapt it to the file
I followed this guide but for some reason I'm god at the result, for example bit 8 = c8 (encrypted) would have to get out 83 (decryption) but does not give me that number.
Link of source code and reshiram (encrypted and decrypted with pokegen):
http://www.mediafire.com/?8oti8m294z0sjr5
Anyone know what is wrong? I want to learn how it works
-----------
public class PokemonTeamCheck5Gen {
public static void main(String[] args)throws Exception{
//block a-b-c-d (0-24)
Long pid = 3621399865L;
int a = Math.round(((pid & 0x3E000) >> 0xD) % 24);
System.out.println(a);
//Read encrypted pkm extracted from .sav (0x18E08 - 0x18E0B = pid poke 1)
JFileChooser fileopen = new JFileChooser();
fileopen.setDialogTitle("Team Checker (Written by marcos91)");
if (fileopen.showOpenDialog(null) == JFileChooser.APPROVE_OPTION){
File file = fileopen.getSelectedFile();
FileInputStream fis = new FileInputStream(file);
DataInputStream input = new DataInputStream(fis);
int[] pkm = new int[136];
for (int i=0; i<136; i++){
pkm = input.read();
}
//checksum = 0x27dd (dd27 in little endian)
//Decrypt data
//x[i+1] = x ^ Math.round((0x41C64E6D * 0xdd27 + 0x6073));
int[] x = new int[136];
for (int j=8; j<136; j++){
x[j] = x[j] ^ Math.round((0x41C64E6D * 0x27dd + 0x6073));
System.out.println(x[j]);
}
}
}
}
First I want to try a pkm extracted directly from the .sav and then adapt it to the file
I followed this guide but for some reason I'm god at the result, for example bit 8 = c8 (encrypted) would have to get out 83 (decryption) but does not give me that number.
Link of source code and reshiram (encrypted and decrypted with pokegen):
http://www.mediafire.com/?8oti8m294z0sjr5
Anyone know what is wrong? I want to learn how it works
-----------
public class PokemonTeamCheck5Gen {
public static void main(String[] args)throws Exception{
//block a-b-c-d (0-24)
Long pid = 3621399865L;
int a = Math.round(((pid & 0x3E000) >> 0xD) % 24);
System.out.println(a);
//Read encrypted pkm extracted from .sav (0x18E08 - 0x18E0B = pid poke 1)
JFileChooser fileopen = new JFileChooser();
fileopen.setDialogTitle("Team Checker (Written by marcos91)");
if (fileopen.showOpenDialog(null) == JFileChooser.APPROVE_OPTION){
File file = fileopen.getSelectedFile();
FileInputStream fis = new FileInputStream(file);
DataInputStream input = new DataInputStream(fis);
int[] pkm = new int[136];
for (int i=0; i<136; i++){
pkm = input.read();
}
//checksum = 0x27dd (dd27 in little endian)
//Decrypt data
//x[i+1] = x ^ Math.round((0x41C64E6D * 0xdd27 + 0x6073));
int[] x = new int[136];
for (int j=8; j<136; j++){
x[j] = x[j] ^ Math.round((0x41C64E6D * 0x27dd + 0x6073));
System.out.println(x[j]);
}
}
}
}