Jump to content

suloku

Innovator
  • Posts

    731
  • Joined

  • Last visited

  • Days Won

    21

Posts posted by suloku

  1. Thank you very much, I'll take a look at pk2pk.cs. I guess this allows us to use pkhex as an alternative to pokemon bank, and also making generation transfers much less time consuming.

    Do you have a donation page? I'd rather donate my next's years pokemon bank suscription than paying for a service I think should only be payed once and have offline functionality, moreover, I've only used it for Y<->OR transfers rather than actually storing pokemon...

    EDIT: I've been looking at the sources, and I wonder why hasn't the improvements made in pkhex regarding geneartion conversion been commited to pk2pk standalone program? I think a tool to convert between gents 100% as the official way is very interesting, not only to import to gen VI, but also between the other generations.

    Instead of keeping two apps, maybe puting a "Time Capsule" menu entry in pkhex that acts like pk2pk would be great. I think it is a pitty a 100% accurate converter is only used for gen VI.

    I think that I can pull it off myself even if I only know very little C#, since both pk2pk and pkhex are open source. Unless you are going to do it yourself expect a pull request with that (if I manage, I don't think it will be too difficult since the function calls are the same ones, updates only affect the funcitons inner works so...)

  2. @ArmoredGuns

    Why don't you post the files? There's a flag searcher in pkhex, and other people could help locate where the flags are; I only have OR, so I can't test this. Flags should be next to one another probably.

    You should post 4 files:

    - Save wihtout any song

    - Save with lugia song

    - save with ho-ho song

    - save with both songs

  3. Thank you very much, I didn't actually notice pokedex entries are set when importing individual pokemon files or importing folder to box. I was copying a full pokedex and 719+formes to another savefile, and drag and drop those many files would be tiring.

    You may nbe thinking, why not use the Load/Dump boxes feature? Becuase that feature for some reason fails on my latias. Then it failed on my unown box (but didn't fail on the unown I have in my sorted pokedex boxes, which should be the same as the other unown), then it fails with some vivillion...

    I'm trying to locate all the pokemon from my save that trigger the problem.

    This is the exception error:

    Consulte el final de este mensaje para obtener más detalles sobre cómo invocar a la depuración 
    Just-In-Time (JIT) en lugar de a este cuadro de diálogo.
    
    ************** Texto de la excepción **************
    System.ArgumentException: Caracteres no válidos en la ruta de acceso.
      en System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
      en System.IO.Path.Combine(String path1, String path2)
      en PKHeX.Form1.mainMenuBoxDumpLoad(Object sender, EventArgs e)
      en System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
      en System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
      en System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
      en System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
      en System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
      en System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
      en System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
      en System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
      en System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
      en System.Windows.Forms.Control.WndProc(Message& m)
      en System.Windows.Forms.ScrollableControl.WndProc(Message& m)
      en System.Windows.Forms.ToolStrip.WndProc(Message& m)
      en System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
      en System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
      en System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
      en System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    
    
    ************** Ensamblados cargados **************
    mscorlib
       Versión del ensamblado: 4.0.0.0
       Versión Win32: 4.6.81.0 built by: NETFXREL2
       Código base: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
    ----------------------------------------
    PKHeX
       Versión del ensamblado: 1.0.0.0
       Versión Win32: 1.0.0.0
       Código base: file:///C:/Users/sergi/Dropbox/Personal/Savegames/3ds/Pok%EF%BF%A9mon%20X%20-%20Diego/PKHeX.exe
    ----------------------------------------
    System.Core
       Versión del ensamblado: 4.0.0.0
       Versión Win32: 4.6.81.0 built by: NETFXREL2
       Código base: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
    ----------------------------------------
    System
       Versión del ensamblado: 4.0.0.0
       Versión Win32: 4.6.81.0 built by: NETFXREL2
       Código base: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
    ----------------------------------------
    System.Windows.Forms
       Versión del ensamblado: 4.0.0.0
       Versión Win32: 4.6.81.0 built by: NETFXREL2
       Código base: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    ----------------------------------------
    System.Drawing
       Versión del ensamblado: 4.0.0.0
       Versión Win32: 4.6.81.0 built by: NETFXREL2
       Código base: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    ----------------------------------------
    System.Configuration
       Versión del ensamblado: 4.0.0.0
       Versión Win32: 4.6.81.0 built by: NETFXREL2
       Código base: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
    ----------------------------------------
    System.Xml
       Versión del ensamblado: 4.0.0.0
       Versión Win32: 4.6.81.0 built by: NETFXREL2
       Código base: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
    ----------------------------------------
    System.Windows.Forms.resources
       Versión del ensamblado: 4.0.0.0
       Versión Win32: 4.0.30319.34209 built by: FX452RTMGDR
       Código base: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.resources/v4.0_4.0.0.0_es_b77a5c561934e089/System.Windows.Forms.resources.dll
    ----------------------------------------
    System.Data
       Versión del ensamblado: 4.0.0.0
       Versión Win32: 4.6.81.0 built by: NETFXREL2
       Código base: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
    ----------------------------------------
    mscorlib.resources
       Versión del ensamblado: 4.0.0.0
       Versión Win32: 4.0.30319.34209 built by: FX452RTMGDR
       Código base: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/mscorlib.resources/v4.0_4.0.0.0_es_b77a5c561934e089/mscorlib.resources.dll
    ----------------------------------------
    System.Numerics
       Versión del ensamblado: 4.0.0.0
       Versión Win32: 4.6.81.0 built by: NETFXREL2
       Código base: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll
    ----------------------------------------
    
    ************** Depuración JIT **************
    Para habilitar la depuración Just In Time (JIT), el archivo de configuración de esta
    aplicación o equipo (machine.config) debe tener el
    valor jitDebugging establecido en la sección system.windows.forms.
    La aplicación también se debe compilar con la depuración
    habilitada
    
    Por ejemplo:
    
    <configuration>
       <system.windows.forms jitDebugging="true" />
    </configuration>
    
    Cuando esté habilitada la depuración JIT, cualquier excepción no controlada
    se enviará al depurador JIT registrado en el equipo
    en lugar de controlarlo mediante el cuadro de diálogo.
    
    

    System.ArgumentException: Caracteres no válidos en la ruta de acceso. --> Invalid characters in access path

    I can send you my save file if you want to try yourself. I'm gonna try pinpoint the problematic pokemon, see if they have something in common.

    Also, why are pk6 files exported with load/dump boxes (or drag and drop to a folder) 232 bytes while manually "saving as" a pk6 file outputs 260 bytes?

    While I personally feel that the last 3 should never be used (the others are much more convenient), they should set the Pokédex data regardless.

    May I know the reasoning behind that? Since you said it is a personal feel, it makes me think there's no actual difference from importing a full box and adding 30 pkm files manually?

    The only reason I can think of is that a box bin file has more data than just the 30 pkm entries it stores, but maybe it is just that importing a box overwrites everything there is inside the current box?

    EDIT: just checked, a boxdata.bin is only a concatenation of 232bytes pk6 files.

    Which leds me to another (simple) suggestion: could the export box feature prompt if we want to export the files in separate folders when not exporting to pkhex database? Each folder would be a box (Box-XX-TID for example, or without TID), This only makes sense if a box bin file holds more data than the concatenated pk6 files, but it may be useful for managing big amount of pokemon.

    UPDATE: I have found the 4 pokemon that made load/dump boxes crash, I'm attaching a box bin file with the 4 of them. Latias and both vivillion I got them from GTS, but the Celebi is a 100% legit celebi I myself got from pokemon colosseum bonus disk and transfered the official way trough retail cartridges and finally to gen VI with poke transfer and pokemon bank.

    Only think I see they have in common is that they have nicknames (should the japanesse celebi be marked as having a nickname? I guess since gen VI region for it is mine, instead of keeping it a japanesse one.

    bugged.zip

    bugged.zip

  4. Pokedex entries are not updated when importing pokemon, and the only way to do it in game is trough daycare or with pokemon bank.

    What I'm asking for is a button at the pokedex editor that would itterate trough every pokemon in the boxes, team, daycare, gts, old man and fused and add that specific pokemon's entry to pokedex (forme, gender, shinyness, kalos or non kalos...) to the corresponding encounter, owned and language fields.

    I don't really need this feature myself, but I think it is a not very hard to code feature that would be very cool for pkhex to have.

  5. I was wondering, is this tool's conversion process 1:1 of what one would get from doing it with pal park, poke-transfer etc?

    Also, I've for for curiosity, but I can't seem to find information on what exactly the official conversion process does, anyone has a link?

    Anyways, thanks for your great tools!

  6. I've just noticed that the file in the first post doesn't have the pokemon bank Johto starters distribution pokemon link file: http://projectpokemon.org/forums/showthread.php?44652-Pokemon-Bank-Celebi-and-other-Pokemon-Link-Injection!-(using-pkhex)&p=199849&viewfull=1#post199849

    edit: Question....when I inject a poke, can I then use PKhex to get the proper region tag on it?

    Good question, I've made that myself in the past. Any region for a given country is valid?

  7. If anyone wants to research, here's my rubi savegame before capturing Latios and an unretrieved street pass eon ticket. I can't use ram2sav right now anymore, but I haven't retrieved the eon ticket yet on my current savegame (I catched everything but latias). If I access another 3ds and can backup my save I can upload it too.

    https://www.dropbox.com/s/p91cewm8e3kpz1f/ORAS_ramsav_6marz2015_latios.bin?dl=0

    note: the save was dumped without any firmware updates (1.0) installed (the fw update was already out when I dumped and couldn't download it) , Spanish console and cartridge.

  8. Ok, I've gotten the pokemon link bin file for pokemon bank pokemiles.

    I've also found that it is a very simple file, there's only the title of the pokemon bank app and the number of pokemiles to be received. The value is at 0x4A3 (on the 2631 byte long bin files we are using) and is probably two bytes long (or else the maximum number would be 255).

    The last two bytes (again, on the 2631 byte long bin files we are using) are a CRC16/CCITT checksum. I don't know if you already knew that, but with this information editing these pokemon link files is possible.

    If someone is willing to test I can upload a file with 3000 pokemiles (for example) to look for the correct offsets.

    I'll get some ramsavs for battle points and check the offset were they are stored on the link files.

    EDIT: it probably is only one byte after all, it seems that the maximum number of pokemiles per day obtainable if the bank has 3000 pokemon is 99 (or 10 battle points), but trying might be worth it (nintendo tends to use 4 byte variables for 32 byte aligment)

    EDIT2: seems I can't get pokemiles/BP until tomorrow, if someone dumps his ramsav after collecting battle points and posts it it'd be great.

    EDIT3: battle points are stored at 0x4A1, I still don't know if the variable is 1, 2, 3 or 4 bytes long, as I'm not willing to mingle with my cartridges since ram2sav isn't a 1:1 copy and restore of the cartridge's savegame. If someone offers to test I can provide some injection files for testing the Battle Points / Pokemiles. This is more out of curiosity than usefulness, since pkhex can directly edit the battle points/ pokemiles.

    EDIT4: Here's a link to the files for battlepoints/pokemiles injection if someone is interested. http://www.mediafire.com/download/bjgnae7gyykd159/BP_PM_injection.zip

  9. Box 18, Slot 30--make sure there's no PKMN in that slot otherwise it will be overwritten. Press Select.

    Code is for Platinum.

    Code for a legally obtained Mew from my pokemon ranch (spanish)

    [HGSSSPRITE]151[/HGSSSPRITE]

    94000130 FFFB0000
    B21C4D28 00000000
    B0000004 00000000
    E001E1C8 00000088
    BF97264C D2C40000
    50A608BE 25BAD46A
    D7AB888F 89C35ED7
    467157FF 0F7FB85F
    0AD547E8 73B47A53
    5136C27A 81BD4C68
    4FCC0B44 DBA2D603
    52BADD65 13A7B9B1
    9C011FA6 79435033
    0FAA5A59 BFFB40F7
    5229A7A9 22526D8C
    E3C22340 DD99CCA4
    45583ABB 60DE732E
    E4FFE482 E4296736
    9B07422B 65C98505
    DF37DF7D FCB7C175
    E9A38854 68F84223
    D2000000 00000000

    Code for a legally obtained Mew from my pokemon ranch (spanish)

    Diamond/Pearl code:

    94000130 FFFB0000
    B21C4D28 00000000
    B0000004 00000000
    E001E1C8 00000088
    BF97264C D2C40000
    50A608BE 25BAD46A
    D7AB888F 89C35ED7
    467157FF 0F7FB85F
    0AD547E8 73B47A53
    5136C27A 81BD4C68
    4FCC0B44 DBA2D603
    52BADD65 13A7B9B1
    9C011FA6 79435033
    0FAA5A59 BFFB40F7
    5229A7A9 22526D8C
    E3C22340 DD99CCA4
    45583ABB 60DE732E
    E4FFE482 E4296736
    9B07422B 65C98505
    DF37DF7D FCB7C175
    E9A38854 68F84223
    D2000000 00000000

    If you have a diamond, you can install my pokemon ranch on your wii and transfer 1000 pokemon to the ranch, then deposit an egg and you will be asked for the trade. You can modify the wii's clock so you don't have to wait 6 days for the ranch to reach level 25.

    RanchMew.pkm

    RanchMew.pkm

  10. It seems you missed this thread: http://projectpokemon.org/forums/showthread.php?44253-My-Pokemon-Ranch-Savedata-Exctractor-0-1

    Use the extractor, the .pkm filenames contain the trainer id and secret id of the trainer that deposited the pokemon in the ranch. If you need the name, open the .pkm file with pokegen.

    For extracting the ranch savefile use savegame manager gx on your wii. You will need hombrew channel on your wii to use savegame manager gx, there are plenty of tutorials out there.

    As another option dolphin emulator can "install" savefiles copied to the sd from the system menu, the you can get savedata.bin in you computer, but since the savefile is protected you still need a homebrew enabled wii to do so and run an app like "banana saves".

  11. Thank you, I've looked at it, but I don't know visual basic (in fact, I know very little programming).

    I've taken advantage of MPKR making a backup of the savefile to compare what happens when I withdraw a pokemon and deposit a different one. The result was that the only changes to the file are the ones shown in the following image (and obviously the 136 bytes correponding to the pokemon I deposited, which now take the place of the one I withdrawed):

    ranchheader.png

    EDIT: I also tried to just enter the ranch and save 2 times in a row, then extract the savedata. The only difference between the two savedata were the bytes marked in red in the image (0x00-0x19 and 0x63).

    I also tried withdrawing the first pokemon deposited at the ranch, then depositing a different one, which shifts the whole pokemon data 164 bytes. But same result. Removing a pokemon has the same changes to the header (well, the pokemon start offset is updated, as stated below).

    The checksum is definitely one of those, maybe 0x60-0x63 is the header checksum and 0x00-0x19 is the savedata header.

    Also, I noticed some values in the header are offsets in the file:

    - Underlined in the image, they seem to be just some index values

    - In a black square I've marked the values of the offsets of different sections in the savegame:

    0x00-0x19: SHA-1 hash of all the following data in the file

    0x24-0x27: start offset of mii data entries in the ranch

    0x2C-0x2F: start offset of "mii-trainer" data entries in the ranch

    0x34-0x37: start offset of pokemon data

    0x3C-0x3F: ending offset of pokemon data (after this the savegame is all 0x00)

    [ATTACH=CONFIG]11917[/ATTACH]

    UPDATE: found it! 0x00-0x19 is a SHA-1 checksum of the rest of the savedata. 0x60-0x63 might be a time value, since in subsecuent savefiles it only increases.

    Thankully this is a very common checksum, so I will be able to update the id changer app myself!

    UPDATE_2: I successfully edited my pokemon ranch savefile and could download all pokemon to a different diamond/pearl savegame, without modifying the nds savegame.

    It required some extra tweaking, like adding TID, SID, Name to one of the mii-trainer entries (this one was expected). I need more testing, because in my successful attemp i just changed all the trainer data existing in the savefile (which only had had one trainer ever) to the new one and I don't know if changing them all is required, as my save had 3 consecutive TID, SID, Name for no apparent reason. Maybe it is a log of the last trainers that connected to the ranch for the ranch and wiiconnect features?

    I'll do more testing tomorrow, but the big part is done.

    UPDATE_3: The process is now automatic. I updated the id-changer and coded a program that updates the hash. I coded it as a separate application because that way one can manually modify the savefile, for example, to change a pokemon for other, and add event pokemon to the ranch for example.

    With the information in this thread one could write a full save editor, that changes the trainers in the ranch and the pokemon they have stored. It would be nice for people who don't have access to AR or nds flashcarts to mingle with pearl/diamond savegames, but I'm not going to code it, and since my pokemon ranch is only for diamond/pearl I doubt anyone will take that much interest as to code it.

    I'll update first post with new binaries and the info I've gathered later.

    UPDATE_4: First post updated. I doubt I will work on this anymore, source and all the information I gathered is available in the rar attached to the first post.

    UPDATE_5: updated first post with new information and a tool to change the savegame region/language setting

    ranchheader.png.250fecb04bc39fb26ebdbfda

    • Like 1
    • Thanks 1
  12. UPDATE 4: About Japanesse My Pokemon Ranch:

    - Region code seems to be 0x00 for normal japanesse my pokemon ranch. Seems totally compatible with the other versions (NTSC and PAL using regionchanger).

    About the Platinum update savegame:

    - savedata.bin is bigger, seems that space was added for 500 player pokemon and 500 hayley's pokemon (a total of 3000 pokemon in the ranch). Some more Ranch data is added as well (for the new features I guess, like song changing, that setting may be saved as well).

    - The start offset of mii data has changed, since some more data for the ranch save was added, the start offset of mii data has changed. Since I wrote these tools with a hardcoded offset instead of reading the offset from the header (because I discovered that later) the only tools that will work with the platinum update savegame are hashupdater and regionchanger. I may rewrite my tools to clean the code and add compatibility with the platinum update savegame.

    - For platinum update the region code seems to be 0x40. I think that these region codes are actually only bitmasks, since my pal savegame was updated to 0x60 (bit 6 was enabled) and not 0x40.

    - A platinum update savegame will NOT work on any non platinum update game. The game will say the save is corrupted (but it is not, it must make some kind of filesize check).

    UPDATE 3: I tested a little with dolphin and found the header value that defines de region/language of the savegame. I've updated the post with the new information, and I've also attached a new file with the updated information and a new app: PR-regionchanger.exe, which has a region selector (jap, NTSC-U, PAL: english, dutch, french, german, spanish, italian) and also updates the file's hash.

    UPDATE 2: I made a quick test with a pal savedata I found. The PAL ranch save seems to be language locked and the "connect to wii" option will only appear in the DS games of the same language (english, deutch, french, italian and spanish). I couldn't find any obvious value in the savefile storing the language setting. The lack of a language setting in the NTSC-U savefile might be what prevents the save from loading on the PAL game. I could create several new savefiles in different languages and compare them, but as I said I'm not working on this anymore.

    UPDATE: Released extractor, id changer and hash updater!

    Only tested with PAL and NTSC-U savefiles.

    FAQ:

    - What are these for?

    With these tools you can extract the .pkm files from My Pokemon Ranch savedata and take ownership of all the pokemon in the ranch, so you can withdraw them with any NDS cart.

    - How do I get the savefile from my wii?

    You will need a homebrew enabled wii (aka Homebrew Channel) and you'll need to use Savegame Manager Gx.

    - Can I use the savegame copied from the system menu?

    No, you can't. Either way, if you can copy it it means your wii is homebrew enabled, since you aren't supposed to be able to copy that savegame.

    - Can I know my secret trainer ID with these tools?

    Yes you can. Each .pkm file extracted with PR-extractor contains in its filename the TID and SID of the trainer that deposited the pokemon in decimal (normal numbers, not hex like the .tnr files).

    Alternative method for pokemon extracting:

    If you use PR-extractor, you can check data of the trainer that deposited the pokemon (TID and SID). You can check the name at My pokemon Ranch screen or using pokegen and opening the .pkm file (only if the pokemon belonged to this same trainer).

    If you edit your NDS savegame so it matches the TID, SID and name of the trainer that deposited the pokemon, you can withdraw them.

    Quick Instructions:

    I'll briefly explain the process of changing all pokemon from a savefile to a specified trainer.

    0.- Connect to My Pokemon Ranch with your DS trainer and deposit a pokemon. If the ranch is full see side notes*

    1.- Use Savegame Manager Gx to extract your savegame (extract, not copy).

    2.- Put savedata.bin in the same folder as the PR tools.

    3.- Run PR-extractor.exe. Sort by number.

    4.- Get the .tnr file of the LAST pokemon extracted. This file contains the hex data from your trainer (TID, SID and Name).

    5.- Drag and drop your .tnr file to "Insert_tnr_and_update_hash.bat". The file "savedata_hashed.bin" will be created. The program will ask you if the trainer had connected to the ranch, select YES if the new trainer information matches any of the ranch trainers.

    6.- Delete savedata.bin inside the folder you extracted with Savegame Manager Gx (0001000157424d50 for PAL savefile, 0001000157424d45 for NTSC-U savefile).

    7.- Copy savedata_hashed.bin to that folder and rename it as savedata.bin.

    8.- Restore your savegame to your wii with Savegame Manager Gx.

    9.- You should now be able to extract all the pokemon with the specified trainer

    -----------

    Side notes:

    *: if the ranch is full, backup the savefile, then erase it and start a new game in my pokemon ranch, deposit a pokemon and extract this new savefile (in another location, don't overwrite the save with the pokemon you want to obtan!). The use this savefile to obtain your .tnr file. If you do that, select NO in step 5.

    If you want to change the savegame's region/language, drag and drop savedata_hashed.bin on PR-regionchange.exe after step 5 and use the new created file instead in further steps.

    Savedata structure information:

    Savedata header information.png

    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

    Structure of My pokemon ranch savegame file (pal and usa, japanesse version unknown).

    (I know this information is poorly written)

    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

    1.- The savefile starts with a header of unknown size (probably 0x108 or 0x112 bytes), the following information is knwon:

    0x00-0x19: SHA-1 hash of all the following data in the file

    0x24-0x27: start offset of mii data entries in the ranch

    0x2C-0x2F: start offset of "mii-trainer" data entries in the ranch

    0x34-0x37: start offset of pokemon data

    0x3C-0x3F: ending offset of pokemon data (after this the savegame is all 0x00)

    0x53: language setting. Single language games (NTSC) seem to ignore this setting. More information in the side notes.*

    0x60-0x63: unknown, maybe date/time? Value increases everytime the game saves.

    2.- From 0x070 to 0x22A8 all is 0x00 on a new savefile, with never connected DS trainers or deposited pokemon. In used savefiles one can find a register of ds trainer names (ascii, not hex) and other data, which I think it may be visitors, maybe somewhere is the ranch's level... On two different savegames I also found 3 trainer entries (TID, SID, Name), but these didn't seem to affect editing the savegame in any way (maybe it is a register of last connected trainers, I don't have 2 game cartriges, so I can't test).

    3.-

    0x22A8-0x22AB: 00 00 00 28 , seems a marker that the previous section of the savefile has ended.

    0x22AC-0x22AF: number of mii stored

    Variable size: mii data, each mii takes 40 bytes. These are the Mii available at the ranch.

    4 bytes: 00 00 00 2C in various savefiles, again it seems a marker that the data ended.

    4 bytes: number of trainer-Mii links

    Variable size: trainer-mii entries, 44 bytes long each entry (each mii in the Ranch is assigned a trainer)

    4 bytes: unknown data; 00 00 00 A4 in several savegames, seems the end of data marker/marker of start of pokemon data

    4 bytes: total number of pokemon in the ranch (includes Hayleys pokemon)

    4.- POKEMON ENTRIES (164 bytes each), structured as following:

    -136 bytes: encrypted .pkm file (readable by pokegen)

    -28 bytes: 4 bytes (**read below), then TID (2 bytes), SID (two bytes), trainer name (16 bytes) and 4 more unknown bytes. This data is unencrypted.

    ** These value seems to be 01 00 00 00 for trainers, 05 00 00 00 for pokemon traded to Hayley, 04 00 00 00 for Hayley's pokemon, and 04 00 00 02 for pokemon that are tradeable with the player and are currently at the ranch (check here for those pokemon: http://bulbapedia.bulbagarden.net/wiki/Hayley%27s_trades).

    I have found 01 00 00 01 on one ocasion, I think that this is used to indicate to differentiate between two trainers with the same TID, SID and NAME, as it happened to me that I added my trainer TID, SID and NAME to all pokemon in the game and changed the one in the mii-trainer entry, and still my game was recognized as a different trainer. That might have been because I edited a NTSC-U savefile and I was using it on my PAL system. This can probably be changed in the mii-trainer entry, but I couldn't the value (if it was there). It maybe have been also an unfortunate outcome of using a converted savegame. (By the way, PAL saves work on NTSC-U version of My Pokemon Ranch, but NTSC-U pokemon ranch saves don't seem to work directly on the PAL version).

    5.- End of data mark? (4 bytes): 00 00 00 28. From this point until the end of the file everything is 0x00, because of the file size I suspect that the savefile has room for 20 mii entries, 8 mii-trainer entries (as stated in wikipedia, only eight carts can connect to the ranch, I can't test what happens when a 9th cart tries to connect), 1000 hayley pokemon and 1000 trainer pokemon (from those 8 allowed carts).

    ......................

    Side notes:

    TID: trainer ID

    SID: secret trainer ID

    Name: the trainer name (not in ascii, but as hex values for the game's character mapping)

    *The language setting is 1 byte at 0x53 in savedata.bin file. These are the language values:

    NTSC

    --------------------

    0x00 - English (NTSC-U?, maybe NTSC-J too)

    0x02 - English (NTSC-U)

    I found 0x02 on a NTSC-U savegame I downloaded and 0x00 on a savegame created on Dolphin running the NTSC-U "My Pokemon Ranch". Both load fine on the NTSC-U as is, probably because the single language games don't really have a language setting, as PAL savegames load fine on the NTSC-U version (on a PAL wii at least), so it doesn't really matter. I don't have a NTSC system for confirming, but I suspect 0x00 for NTSC-J and 0x02 for NTSC-U are the correct values.

    PAL

    --------------------

    0x08 - English (PAL) and Dutch (PAL). Text is displayed in english for Dutch.

    0x10 - German (PAL)

    0x18 - French (PAL)

    0x20 - Spanish (PAL)

    0x28 - Italian (PAL)

    On dolphin emulator, if the Language is set to Japanesse, Simplified Chinese, Traditional chinese or Korean the japanesse Safety Screen appears and the language defaults to English (PAL), meaning that My Pokemon Ranch will load English (PAL) savegames.

    note: entering the DS link on dolphin will corrupt the savegmae

    ::::::::::::::::::::

    Best Regards, suloku

    This is the thread that originated it all: http://projectpokemon.org/forums/showthread.php?28382-Reading-My-Pokemon-Ranch-save)

    Original post:

    Hello, after reding this thread (http://projectpokemon.org/forums/showthread.php?28382-Reading-My-Pokemon-Ranch-save) and seeing that the offsets didn't match I looked at some savefiles and decided to code my own pokemon ranch extractor. It seems to work fine in several PAL and USA savefiles, japanesse are untested (with and without the platinum update).

    I've also been coding an app that changes the owner of the pokemon in the ranch, but a problem arised: the savegame header seems to have a checksum of the file, and I don't know how to recalculate it, so the edited file won't work.

    Also, I would almost surely need to delete all "mii-trainer" entries but one and change the trainer associated to that mii. That can be easily done, but until the cehcksum problem is solved, using and edited savegame can't be done.

    Any help with that checksum will be appreciated.

    UPDATE: it seems that deleting the "mii-trainer" entries is not necessary, the mii linked to a trainer remains even when no pokemon are stored in the ranch. I've attached my current code for the Ranch ID changer, it accepts manual entry of the TID, SID and name (in hex) or it can use a .tnr file generated by PR Extractor. The "only" thing it misses is updating the ranch's checksum, either someone updates my code or writes a separate app that calculates and writes the new checksum.

    As an alternative method to get the pokemon in the ranch, since with the extractor we can know the TID, SID and Name, with an action replay device or editing the savegame the pokemon in the ranch can be retrieved. There's tutorials for that elsewhere.

    Readme:

    My Pokemon Ranch Exctractor v0.1 by suloku December 2014

    ------------------------------------------------------------

    Copyright 2014 suloku <sulokutdcmago@gmail.com>

    Licensed under the terms of the GNU GPL, version 2

    http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt

    ------------------------------------------------------------

    Usage:

    1.- Extract my pokemon ranch savegame using Savegame Manager Gx (or any alternative) from your wii. You will need a soft-moded wii for that (aka homebrew channel).

    2.- Place savedata.bin from the savedata you just extracted in the same folder as PR-extractor.exe

    3.- Execute the Pr-extractor.exe

    The pokemon are extracted as encrypted .pkm files compatible with latest pokegen. The filename includes the number of the pokemon in order it was deposited in the ranch, the trainer ID and secret trainer ID.

    You will be asked if you want to sort the extracted pokemon by trainer ID or by deposition order (it just changes the way the files are named, useful if there are many pokemon from different trainers).

    Hayleys pokemon are also extracted (with a different filename). Pokemon traded with Hayley are also extracted and the filename has the "traded" tag.

    Some of Hayleys pokemon have the "tradeable" tag, wich only means that Hayley may ask to trade that pokemon for one of the wanted pokemon in the ranch, the .pkm file is as any other pokemon.

    The extractor will create .tnr files, whichs filenames include the trainer ID, secret ID and trainer name in hexadecimal. De file itself contains that very same data. They have no use as of now (27th december 2014), but they are intended to be used by My Pokemon Ranch ID changer to make all the pokemon in the ranch belong to the specified TID, SID and name.

    My Pokemon Ranch ID changer is an application under development, stalled because the header of My pokemon ranch savefile has a checksum and I don't know how to recalculate it.

    -----------

    Changelog:

    +V0.1: initial release

    -----------

    Developer notes:

    - The source is very ugly and poorly written, I know and I made what I could. It works, so meh.

    - Any help with updating the checksum at the savefile header will be appreciated.

    Savedata file structure information

    (I know this information is poorly written)

    The savefile has a header with some kind of checksum that prevents directly editing it. Any help would be appreciated.

    Structure of My pokemon ranch savegame file (pal and usa, japanesse version unknown).

    0x22AC-0x22AF: number of mii stored

    Variable size: mii data, each mii takes 40 bytes. These are the Mii available at the ranch.

    4 bytes: 00 00 00 2C in various savefiles

    4 bytes: number of trainer-Mii links

    Variable size: trainer-mii entries, 44 bytes long each entry (each mii in the Ranch is assigned a trainer)

    4 bytes: unknown data; 00 00 00 A4 in two different savegames

    4 bytes: number of pokemon in the ranch

    POKEMON ENTRIES (164 bytes each), structured as following:

    -136 bytes: encrypted .pkm file (readable by pokegen)

    -28 bytes: 4 bytes (*read below), then TID (2 bytes), SID (two bytes), trainer name (16 bytes) and 4 more unknown bytes. This data is unencrypted.

    End of file mark? (4 bytes): 00 00 00 28

    * These value seems to be 01 00 00 00 for trainers, 05 00 00 00 for pokemon traded to Hayley, 04 00 00 00 for Hayley's pokemon, and 04 00 00 02 for pokemon that are tradeable with the player and are currently at the ranch (check here for those pokemon: http://bulbapedia.bulbagarden.net/wiki/Hayley%27s_trades).

    PR-tools_v2.zip

    PR-tools_v2.zip

    583dd01c3cca9_Savedataheaderinformation.

    • Like 3
  13. I've looked at 3 different ranch savedata.bin files and in each file the stored pokemon start at different offsets. This seems to be because of the amount of Mii in the savefile doesn't have a constant allocated space.

    The actual data starts at 0x22AC, and each Mii takes up 40 bytes. 0x22AF value indicates how many Mii are registered (probably it is a 4 byte variable, taking from 0x22AC to 0x22AF). After the mii data there are 8 bytes more of data, here's data from two different save files:

    Savefile 1: 00 00 00 2C 00 00 00 01
    Savefile 2: 00 00 00 2C 00 00 00 01
    

    After this come the entries linking the Mii's and the trainers, I think the 00 00 00 01 is a 4-byte value indicating how many trainer id's follow. The two savefiles I have only have one trainer, I may check later to confirm this. Each entry is 44 bytes long, then, 4 unknown bytes and then 4 bytes which value is the number of pokemon stored. Then the pokemon start.

    I think it is worth mentioning that the 0x1C (28 in decimal) bytes that follow the 136 byte pokemon are 4 bytes, then TID (2 bytes), SID (two bytes), trainer name (16 bytes) and 4 more unknown bytes. All this data is unencrypted.

    First come Hayley's pokemon, including the ones that may have been traded with her. You can identify them because the 0x1C bytes that follow them are blank, they don't have any trainer ID assigned (so you can't take them out of the ranch). Any pokemon traded with hayley are here too, even eggs.

    I don't know how many pokemon can Hayley take to the ranch. Because of the amount of blank savedata after my last pokemon (and I have 990+ in this savefile) I pressume that this number is as high as 1000 more pokemon brought in by hayley. I guess nobody got that far to confirm.

    Then come the pokemon stored at the ranch by DS cartriges.

    I have found the end of the pokemon in the ranch marked by "00 00 00 28" in two different save files.

    Summary:

    - My goal is to code an app that can extract all pokemon into .pkm files

    - Extracting Hayley's pokemon will be optional

    - Another use of the app will be to change the TID, SID and Name of all stored pokemon, so instead of editing the diamond/pearl savegame the pokemon ranch savegame is edited.

    Information so far:

    0x22AC-0x22AF: number of mii stored
    Variable: mii data, each mii takes 40 bytes.
    4 bytes:  00 00 00 2C
    4 bytes: number of trainer-Mii links
    Variable: trainer-mii entries, 44 bytes long each entry
    4 bytes: unknown data; 00 00 00 A4 in two different savegames
    4 bytes: number of pokemon in the ranch
    
    POKEMON ENTRIES (164 bytes each), structured as following:
    -136 bytes: encrypted .pkm file (readable by pokegen)
    -28 bytes: 4 bytes (*read below), then TID (2 bytes), SID (two bytes), trainer name (16 bytes) and 4 more unknown bytes. This data is unencrypted.
    
    End of file mark? (4 bytes): 00 00 00 28
    
    * These value seems to be 01 00 00 00 for trainers, 05 00 00 00 for pokemon traded to Hayley, 04 00 00 00 for Hayley's pokemon, and 04 00 00 02 for pokemon that are tradeable with the player (check here for those pokemon: http://bulbapedia.bulbagarden.net/wiki/Hayley%27s_trades).
    

    EDIT:

    I have already coded a program that extracts all pokemon and should work with all pokemon ranch savefiles (well, maybe it doesn't with the japanesse platinum update).

    I also coded a program that changes the trainer of every pokemon in the ranch (except Hayley's) to the inputed TID, SID and trainer name. This needs testing and I can't do it right now, so we'll have to wait some hours to see if it works (if there's no checksums it should work).

    EDIT2: As expected, the ranch savefile seems to have a header with a checksum for the savefile, so changing the data without recalculating the checksum won't work. I don't know how checksums work, anyone would lend a hand?

×
×
  • Create New...