ROM Hack Developing PHP-based open source PokéSAV script

MarkusE

Well-Known Member
OP
Newcomer
Joined
Aug 28, 2007
Messages
54
Trophies
0
XP
82
Country
United States
pokeencel6.jpg


The game still uses the ABCD structures as in Emerald, but I'm not sure what determines which order they go in. It's no longer attribute mod 24, as I had two Pokemon, both of which $att%24==14, but one was ordered ACBD while the other was Dxxx.

That's just one part of the puzzle. As for the encryption, it doesn't seem to be done via XOR's, either. If all 128 encrypted bytes were XOR'ed by the same value, all those 00's would get XORed to the same values. This was the case in Emerald; often, you'd have entire 4-byte blocks that were identical. I tried a full block of 00's from $08-$87 on a test Pokemon, and the encrypted bytes looked completely random.

It doesn't look like COM is responding, and searching on @wiki/Google hasn't really yielded much either. I don't know how you guys are going to provide it, but I'm really going to need some help. Either someone will have to reverse-engineer this from scratch, or someone who can will have to ask on Japanese forums like 2ch and hope to get a response.
 

MarkusE

Well-Known Member
OP
Newcomer
Joined
Aug 28, 2007
Messages
54
Trophies
0
XP
82
Country
United States
They don't do anything. Default is all zeroes.

Please don't turn this into an "Ask for basic PokeSAV help" topic.
 

MarkusE

Well-Known Member
OP
Newcomer
Joined
Aug 28, 2007
Messages
54
Trophies
0
XP
82
Country
United States
Here's what we do know:

1. The encryption has something to do with the checksum ($04-07). If you change any parameter that results in a new checksum (edit trainer IDs, date caught, etc. etc.), $08-87 have brand new values.

2. It's encrypted byte by byte, not in four-byte chunks (like in Emerald). If you look at my colour-coded image from a few posts ago, changing $43 in the encrypted code (which corresponds to $23 in the original: sheen), that's the only value affected.

3. It's not XOR encryption, because the bytes with the same value, e.g. 00 or ff in the original don't get mapped to the same value in the encrypted version. This wasn't the case in Emerald: if you had a row of 00's, all of them get XOR'ed to the same value in the encrypted data. I don't know if it's modular exponentiation, i.e. a^b mod c, but I'd imagine the game would use something more advanced than these basic encryption methods.

I really wish the creator of PokeSAV would just release his source code. What a waste of time for me to be trying to reverse-engineer this myself when someone else already has the answer...it's not like either of us is working for profit.
 

MarkusE

Well-Known Member
OP
Newcomer
Joined
Aug 28, 2007
Messages
54
Trophies
0
XP
82
Country
United States
Depends on both attribute and checksum.

Attribute: 01 00 00 00 (little endian, $00-03)
Checksum: 03 1f (little endian, $06-07)

$08-87:
d3 c8 19 e2 c4 0d 27 c5 e5 d8 08 0d 73 f6 7a b5 f4 73 f4 2b b3 34 35 56 e1 41 bd fd 08 bd ca 05 bb 1f 9a e0 9f 71 f4 79 43 e6 4f 90 6b f6 0c 0b ac 14 9e 93 91 a3 9b 60 a0 63 fe 0c 05 3a 2f 53 6c 84 68 e2 96 3e 93 17 f5 91 d9 71 87 1e 95 06 08 ee bb 3f 65 7c 57 97 be ab 2f 62 bb 79 fc 5d 70 95 1c 8a d4 4a d9 23 da 93 d1 ef 82 32 d7 95 17 01 db 7f e0 57 a6 f6 2c 16 56 34 4c 9f 3d 29

Attribute: 0a 96 21 8b (little endian, $00-03)
Checksum: 03 1f (little endian, $06-07)

$08-87:
30 c8 fb e2 26 0d c5 c5 07 d8 ea 0d 91 f6 98 b5 16 73 16 2b 4c cb 35 56 e1 41 bd fd 08 bd ca 05 ba 1f 9a e0 9f 71 f4 79 43 e6 4f 90 6b f6 0c 0b ac 14 9e 93 91 a3 9b 60 a2 63 fe 0c 05 3a 2f 53 8e 84 8a e2 74 3e 71 17 17 91 3b 71 65 1e 77 06 ea ee 59 3f 9a 83 57 97 bc ab 2f 62 bb 79 fc 5d 70 95 1c 8a d4 4a d9 23 da 93 d1 ef 82 32 d7 95 17 01 db 7f e0 57 a6 f6 2c 16 56 34 4c 9f 3d 29

Notice the similarity.

So...anyone think he can crack this?
 

MarkusE

Well-Known Member
OP
Newcomer
Joined
Aug 28, 2007
Messages
54
Trophies
0
XP
82
Country
United States
Att=0, Chksum=0, $08-87 = 0 => $08-87 (encrypted):
7e e9 71 52 b0 31 42 8e cc e2 c5 af db 67 33 fc 2c ef 5e fc c5 ca d6 eb 3d 99 bc 7a a7 cb d6 5d 78 91 a6 27 8d 61 92 16 b8 cf 5d 37 80 30 7c 40 fb 48 13 32 e7 fe a3 df 69 3d 9e 63 29 1d 8d ea 96 62 68 92 97 a3 49 1c 03 6e aa 31 89 aa c5 d3 ea c3 d9 82 c6 e0 5c 94 3b 4e 5f 5a 28 24 b3 fb e1 bf 8e 7b 7f 00 c4 40 48 c8 d1 bf b6 38 3b 90 23 fb 23 7d 34 be 00 da 6a 70 c5 df 84 ba

I really don't know how to make sense out of this. :'(
 

HellishINC

New Member
Newbie
Joined
Sep 10, 2007
Messages
4
Trophies
0
Age
38
Location
hell
Website
Visit site
XP
52
Country
United States
I applaud your attempts but mac users have bootcamp and linux users have wine. Theres also always VMware.

By all means continue, I just hope your ready for such a big and costly project.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    SylverReZ @ SylverReZ: https://www.youtube.com/watch?v=ftyFz0yBxj8