I've finally decided to publicly release my PKMDS code library! It is attached to this post. Feel free to ask any questions you might have about how to use it.
Please note that this library was written in VB.Net and compiled on / for a Windows machine. To use it you need the latest .Net framework from Microsoft.
SOURCE: See attachment. For all imagery used in the software, see here.
If you would like the entire Visual Studio Solution, you can find it here.
Code:WHAT IS THIS? It has been a goal of mine for some time to create a code library for people to write their own Pokémon DS save file / PKM file viewing and editing software. What does this mean to you? See the below image: http://i162.photobucket.com/albums/t...ry_Preview.png In theory, any person who writes Windows applications in VB.Net or Visual C# should be able to import my .DLL file into their project and recreate the above program (and many others) with minimal coding and without the use of any other external files. As evandixon from the Project Pokémon forums said, "When this is finished, nearly everyone can make a PokeMod [Pokémon save hacking program] themselves". CURRENT FEATURES: -The ability to open and read any Pokémon DS save file (in raw 512kb format) created by Diamond, Pearl, or Platinum. -The ability to open and read any PKM file, or any encrypted and shuffled Pokémon BIN file (136 byte storage or 236 byte party format). -The ability to make some edits in the aforementioned files. -A full collection of Platinum front sprites and box icons for representing the Pokémon being read (including shiny and all alternate formes). -Some other Pokémon DS imagery, including PC storage wallpapers, status symbols, type symbols, etc. -Foreign character support for in-game names. MORE TO COME: -Eventually full unrestricted editing of PKM files and save files... right now a lot of properties of the various classes / structures are read only, because it seemed like less of a headache to code at the time. In retrospect that was not a perfect plan. -There's more, which will be added to this readme as I think of it. FAQ: Please see the thread at Project Pokémon. http://projectpokemon.org/forums/sho...0202#post40202 SPECIAL THANKS: COM - For creating Pokesav and inspiring everyone to do better than him. Sabresite - For helping me get started and giving me an endless supply of helpful advice. Also the PKM character to Unicode conversion table, and basically the entire structure of PKM data. SCV - For dedicated patience and problem solving ability, not to mention encouragement. Also thanks to the above for the handy save block checksum algorithm. Jiggy-Ninja - For hard work and unrelenting help, specifically the Pokédex and Trainer Card signature data structures. Also for pointing out stupid mistakes. Poryhack - For, among other things, the ribbon images. Kazumi - For the Pokémon DP font (which I still can't seem to use right...) mingot - For basically giving me the PID / IV relationship code, YOU SAVED MY LIFE. fenzo and coolbho3000 - For creating and maintaining an awesome Pokémon community. damio - For helping tremendously with Friend Codes and general questions here and there. loadingNOW - What doesn't this guy do? Thanks for the save file documentation, and thanks for whatever else I got from you directly or indirectly. Bulbapedia & Serebii - For being handy reference. Legendary Pokémon - For being a source of data. X-Act and really Smogon in general - For answering some questions, and providing the stat formula. GatorShark - For demystifying the Spinda spot rendering process. Mastermind_X - For the Platinum sprites. Also you're basically all awesome. So cheers! DISCLAIMER: Pokémon and all respective names & images are trademark & copyright of Nintendo & Game Freak 1995 - 2009
Last edited by codemonkey85; Feb 24th, 2010 at 01:50 AM.
Why not just put the readme file onto the post?
Ahhh... I like the display
Something's not called a miracle because it doesn't happen. It's called a miracle because once in a while, it does happen.
It seemed like a good idea for it to be immediately visible, since there is a disclaimer in there to keep me / us from getting sued.
That almost looks like a jab at COM...
Gen IV's Gym Leader Castle Project -- Pokemon Showdown Version 1 Released! Feb 15
Black & White Pokemon Global Link Eeveelution Event -- Pokemon Labyrinth All collected!
PokeGen - Pokesav replacement
Project Pokémon Event Gallery
"Now that I've had my coffee..."
Now I just have to find some use for it.
[Edit]: I know! Something Impractical!
Last edited by evandixon; Jul 19th, 2009 at 04:16 PM.
This is nice, but documentation will make this .dll more beautiful..
why? .dll can be used by any application in the world *as long as it run on windows, i think.. don't know about linux and mac, never build app on linux, and building for mac is 3x harder because using Objective C*
if you use Visual Studio family it's just "Add Existing Item" -> browse -> bla.. bla.. bla.. and all the function is showed up.. how bout the other that doesn't used Visual Studio family.. i think a documentation would be very nice to them.. *No offense, just suggestion..*
A function documentation, how to used it, what parameter, just function listing, that would be enough.. *just assume that everybody here at least know how to use .dll, don't care if they don't*
my regards, and thanks
P.S. It's a cool .dll
Overloaded functions cannot differ by only return types, so I will have to name it as a separate function if I want to do it that way.
So ASP.Net cannot read files using streams? That seems like an odd limitation.
evandixon, do you mind pasting the specific code you used to open the save file?
As for documentation within the .DLL, that is something I plan to do. I will document it using commentation and XML tagging. However, there are thousands of lines of code to go through, so it will take me a while.
The specific errordetails/line of code...
There was a security exeption when trying to read a save file (PokemonLib.OpenDPSav(filename)), even though I gave everything full control of the directory the save file was in.
In other applications, I have successfully read all the bytes of a file, so a fix on that part should fix the problem.
Well, like I said, I suppose I will just write a function to return a byte array instead of a DPSaveFile or PtSaveFile. Hopefully that byte array can be serialized into one of those structures; if not, I suppose you could always work with the data manually.
I just uploaded the latest build of my library. I made some changes that I think will help quite a bit with readability and usage of the library. For instance, several of the dictionaries are no longer declared with "Byte" or "UInt16" keys, but rather with enumerations of the aforementioned types that use proper names. I have also used those enumerations elsewhere in the code. So in other words, if you want to see if a Pokémon is a Bulbasaur, you used to do this:
And now you can do it this way instead:Code:If PKM.Species.ID = 1 Then [...]
The same goes with item index values, move index values, etc. That should help a lot, I think.Code:If PKM.Species.ID = Species.Bulbasaur Then [...]
Unofficial Upload Bin, although it is not live at the time of posting, with no trouble.
Btw, I don't see the attribute for Pokerus (I looked throughout,even with the .Net Reflector, but it should be in .Stats, shouldn't it?), and it would be nice if the Origins.Location would automatic, so I don't have to write a chuink of code...:
...in order to display the Location met.Code:Dim Pokemon As PokemonDSLib.PokemonLib.Pokemon PublicFunction AreaMet() AsString If Pokemon.Origins.Hometown.Name = "Platinum"Then Return Pokemon.Origins.Location.Platinum.Name Else Return Pokemon.Origins.Location.DiamondPearl.Name EndIf EndFunction
A few more suggestions:
-Pokemon Output to a Byte Array (Both PC and Party), so it might work better in my ASP.Net application (Writing the Output directly to the output stream, rather than saving it to a file)
-Reform on RawDeserialize, because it is causing Security Exceptions when run out of the DLL
-Auto-Detect for Encrypted Pokemon (right now, I have the application assuming that the pokemon is un-encrypted, and that might cause a major problem in the future.)
If you wish to see the source for my ASP.Net application, I can PM it to you, CodeMonkey85.