RickyHill18 Posted August 6, 2013 Posted August 6, 2013 I am trying to open and read .pkm files with php. But all i can find is visual basic source codes. Anyone know where to get this at?
evandixon Posted August 6, 2013 Posted August 6, 2013 codemonkey85 has C++ source code. http://projectpokemon.org/forums/showthread.php?20984-PKMDS-Code-Library-Gen-V If nothing else, you can look at the wiki and implement it yourself. http://projectpokemon.org/wiki/Pokemon_Black/White_NDS_Structure
RickyHill18 Posted August 6, 2013 Author Posted August 6, 2013 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); } ?>
RickyHill18 Posted August 7, 2013 Author Posted August 7, 2013 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.
Kaphotics Posted August 7, 2013 Posted August 7, 2013 are you uploading encrypted or decrypted pkms? if you have the decrypted hex, certain offsets are just indexes for different data tables. just separate out your hex string and then get out the data
RickyHill18 Posted August 7, 2013 Author Posted August 7, 2013 How would i do that could you give me a start or link. I am a good php programmer i learn stuff quick but never dealt with hex codes.
codemonkey85 Posted August 8, 2013 Posted August 8, 2013 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now