Jump to content

Recommended Posts

Posted

I can see the hex codes from this but can't decode them.

<?php

$handle = @fopen("Emboar.pkm", "r");

if ($handle) {

while (!feof($handle)) {

$hex = bin2hex(fread ($handle , 4 ));

print $hex."\n";

}

fclose($handle);

}

?>

Posted

Nvm that code has no use. I want to decode the .pkm using php nothing more. I created a site and hoping to upload and decode and add to database for personal use only.

Posted

I'm not a PHP programmer, but I have heard that PHP and C++ are pretty similar in terms of syntax at least. If you're a good PHP programmer, I expect you should be able to figure out the logic from my library and implement it your own way... assuming PHP doesn't have any annoying problems in dealing with binary data. FYI, I don't iterate over the bytes from a file or array or anything like that; I have a well-defined structure inheriting from some nested structures, and I essentially read the binary data right into them, filling the members with the values I need. I won't lie, I think it's pretty cool.

EDIT: I suggest you start from here and work your way up the file: https://github.com/codemonkey85/PKMDS-G5/blob/087c26260d07df756ff719e6e34df2471dbad7fb/include/pkmds/pkmds_g5.h#L3001

tldr; if PHP does object serialization I would do it that way.

EDIT 2: I've also heard python is pretty similar as it is a scripted language with similar functionality. You should check out the source code tsanth posts here: http://bulbapedia.bulbagarden.net/wiki/Talk:Pok%C3%A9mon_data_structure_in_Generation_IV#Checksum

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...