Author Topic: nTrade Advanced - An on-calc trading tool for 3. Gen Pokemon games  (Read 3598 times)

0 Members and 1 Guest are viewing this topic.

Offline CiriousJoker

  • LV2 Member (Next: 40)
  • **
  • Posts: 34
  • Rating: +1/-0
    • View Profile
A friend of mine asked me to code some sort of tool to trade Pokémon with friends while in school,
and here it is:

nTrade Advanced


It's a small application which allows you to trade Pokemon between third gen Pokemon games.
Note that it may fail with modded ROMs if they use another structure for the savefile.
Yes, I'm looking at you, Pokémon Glazed O.O


It works the way that your friend sends you his savefile, nTrade trades the Pokémon and you send back the changed save file.
This way you still have the ability to clone your Pokémons.



I also included the functionality to repair savefiles.
Note that this only works, if the save file is corrupt because of incorrect checksums.
Spoiler For Long Explanation:
A savefile contains 2 savestates, so that if your newest is broken, it loads the backup.

A savestate is divided into 14 sections, each 4096 bytes big.
The last few bytes of every section are reserved for a section number, the time code (to decide which savestate it belongs to) and a checksum.

If the checksums are correct, the game will always attempt to load the game.

My application recalculates the checksums, so you can always load the save file.

This will not recover bad eggs, as each Pokémon has its own checksum.
If the checksum is wrong, it shows up as a bad egg.


=> Give it a try if you want, but don't expect magic


~CiriousJoker

edit: all bugs should be fixed now
« Last Edit: September 12, 2016, 05:47:51 pm by CiriousJoker »

Offline sid8911

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 5
  • Rating: +0/-0
    • View Profile
Re: nTrade - An on-calc trading tool for 3. Gen Pokemon games
« Reply #1 on: July 25, 2014, 05:30:44 pm »
i'm guessing you would need to use a cable to connect both nspires together or would a wireless network adapter somehow work?

Offline CiriousJoker

  • LV2 Member (Next: 40)
  • **
  • Posts: 34
  • Rating: +1/-0
    • View Profile
Re: nTrade - An on-calc trading tool for 3. Gen Pokemon games
« Reply #2 on: July 25, 2014, 05:35:49 pm »
I don't know about wireless adapters, but ofc you have to send the savegame to a friend.
I don't know how to make use of the cable for a permanent connection like on the real gameboy.
This way was the easiest because its my first project for ndless  :D

Offline xlibman

  • Now active at https://codewalr.us
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55807
  • Rating: +3148/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • CodeWalrus
Re: nTrade - An on-calc trading tool for 3. Gen Pokemon games
« Reply #3 on: July 25, 2014, 11:56:34 pm »
Does this work with Pokémon via gpSP-Nspire emulator or does it actually connect to a real GBA?
In case you are wondering where I went, I am still active in the TI community, but I left Omni back in 2015 for various  reasons. I might come back one day, depending of certain circumstances, but my new online home (despite me being Omnimaga founder in 2001) is now CodeWalrus ( https://codewalr.us ). Sorry for the inconveniences.

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline CiriousJoker

  • LV2 Member (Next: 40)
  • **
  • Posts: 34
  • Rating: +1/-0
    • View Profile
Re: nTrade - An on-calc trading tool for 3. Gen Pokemon games
« Reply #4 on: July 26, 2014, 08:52:41 am »
I think I have to explain this a little better...


It does NOT connect to an emulator, another ti nspire or anything
It DOES switch Pokemon between two save files:
To trade, do it like this:
1) your friend sends you his savefile
2) You put both your and your friend's savestate in your "My Documents" folder and name them 1.sav and 2.sav
3) start my tool, select which Pokémons you want to trade and click trade
4) send 2_after.sav to your friend


Of course, this isn't the fastest way ever, but it's made for school and there you have time enough.
Also, you must know that this is a) the first c program I wrote and b) the first for a calculator


Normally I code with c# and java (i hate it but in school, we have to do some stupid stuff in a stupid way with it)
edit (years later): Seems like Java is actually pretty cool and the teacher was a retard

Hope it's clearer now, if not, just ask me  :D
« Last Edit: September 12, 2016, 05:45:29 pm by CiriousJoker »

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: nTrade - An on-calc trading tool for 3. Gen Pokemon games
« Reply #5 on: July 26, 2014, 08:56:45 am »
That is sweet :D
I can't test it since among my Nspires only one can run gpSP but I still approve the idea ;D
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline xlibman

  • Now active at https://codewalr.us
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55807
  • Rating: +3148/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • CodeWalrus
Re: nTrade - An on-calc trading tool for 3. Gen Pokemon games
« Reply #6 on: July 26, 2014, 12:39:59 pm »
Ah I see now. Pretty interesting tool :D
In case you are wondering where I went, I am still active in the TI community, but I left Omni back in 2015 for various  reasons. I might come back one day, depending of certain circumstances, but my new online home (despite me being Omnimaga founder in 2001) is now CodeWalrus ( https://codewalr.us ). Sorry for the inconveniences.

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: nTrade - An on-calc trading tool for 3. Gen Pokemon games
« Reply #7 on: July 26, 2014, 12:42:04 pm »
Now that I think of it, I don't even need two Nspires to test that, I can trade Pokémons from two different versions on one calc (or twice the same version too in fact).
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline CiriousJoker

  • LV2 Member (Next: 40)
  • **
  • Posts: 34
  • Rating: +1/-0
    • View Profile
Re: nTrade - An on-calc trading tool for 3. Gen Pokemon games
« Reply #8 on: July 26, 2014, 12:53:46 pm »
The problem between firered and emerald should be fixed now.


This tool isn't supposed to be THE tool that has to be on EVERY calculator, was just bored for some time and wanted to improve my c/c++ skills  ;)
If you find any bug, please tell me, i don't bite  :3