Git Product home page Git Product logo

pksploit's Introduction


WARNING: UNDER HEAVY DEVELOPMENT!

BOOTLEG FLASH FUNCTION SOMEWHAT UNTESTED BECAUSE I WRECKED MINE WHILE TRYING TO SOLDER A BATTERY TO IT. WORKED BEFORE I KILLED IT THO :P


TL;DR

This is a suite of tools allowing you to dump rom/save data and reflash save data on any GB and GBC cartridge using nothing but a Pokemon Gen 1 cart, a link cable and an Arduino compatible microcontroller (e.g. Arduino Nano or any ATmega368p board).

Exploit and some arduino code based on: https://github.com/vaguilar/pokemon-red-cable-club-hack

Features

  • All Gen 1 carts supported (I think): Tested on US Pokemon Red, German Pokemon Blue, French Pokemon Yellow.
  • ROM dumping: Play those classic games on an emulator without relying on virus-riddled (and illegal) ROM download sites.
  • SRAM dumping: Save your childhood save games from imminent battery doom.
  • SRAM writing: Ever wanted to try out someone else's save game?
  • Write and execute code: Try out your small gameboy programs on actual hardware!
  • Quick start without trading: The included build script generates save files that directly jump into PkSploit's main routine after loading. Have your link up and running in only a few seconds! Those can (of course) be uploaded via PkSploit itself.

... And here's where it gets interesting ...

  • Erase/Rewrite ROM on flash based bootlegs/flashcarts! Replace the game completely with whatever ROM you want. (Special patches to support saving on carts without battery soon(TM))

Yes that means you can replace that crappy bootleg romhack with Pokemon Prism, LSDj, Nanoloop or whatever you want!

Did i mention those bootlegs cost like 4 USD and basically replace a flashcart!? Did i also mention that the required hardware to do all of this costs less than 2 USD and is easy to build!?

How?

  • The Arduino communicates with the Gameboy using the Link Port. It pretends to be another Gameboy running a Pokemon Gen 1 game, willing to trade.
  • When entering the trade, it sends corrupted party data which causes the gameboy to execute a chunk of the party data as code.
  • The code can be made to do pretty much anything that fits in ~192 byte, but in this instance it's a routine that reopens the serial link to provide a interface that can be used to read/write to any part of memory within the Gameboy's limitations.
  • Since the code is running in WRAM, you can cartswap to read/write to any gameboy cartridge. This works best on a Gameboy Color or Pocket, but should work on all gameboy platforms (better results when using a cheat device as passthrough. See FAQ)
  • Overwriting the bootleg works because it uses flash memory instead of ROM. These flash chips have a special command interface allowing to erase sectors and reprogram them. I discovered that this interface is accessable within the gameboy when i was debugging/reverse engineering how my Pokemon bootleg could save without a battery. (Hint: The rom is hacked to save to flash instead of SRAM ;))

Hardware Prerequisites

  • Arduino compatible microcontroller, preferably one with 5V logic and >16Mhz clock speed. (E.g. an Atmega326p)
  • Gameboy DMG, Color, Pocket, Light, GBA, GBA SP... Basically any Gameboy with a link port.
  • Link Cable or any other way to connect the Arduino to the Gameboy's Link Interface

Software Prerequisites

  • Python 2.7
  • PySerial
  • Arduino IDE
  • RGBDS (Included)

Hardware Build

TODO. Basically cut a link cable in half and wire up 4 pins from it to the arduino.

Software Build

Currently only builds on Windows, but there's no reason it shouldn't work on other OS (I'm just lazy)

  1. Install Prerequisites
  2. Clone: git clone http://github.com/binarycounter/pksploit (Or just download the repository as a zip)
  3. Enter build directory: cd PkSploit/build/
  4. Copy sample_config.ini to config.ini and edit your path, board name and port.
  5. Build: py build.py
  6. Enter python directory: cd ../python/
  7. Run: py pksploit.py

FAQ

Q: My bootleg doesn't save when i write to SRAM!

A: Your bootleg likely doesn't include a battery and instead relies on patching the ROM to backup SRAM into flash. In some Pokemon bootlegs you can call $3FA6 to trigger the routine that does this. For other bootleg games... I don't know. If you send me a tracelog or a romdump/patch i'll let you know if i can support it!

Q: My gameboy keeps crashing or restarting when I attempt cartswapping!

A: How many times did you try it? It can take me up to 10 times (on a bad day) before i successfully cartswap. Use the hacked save files to make attempts faster!

Q: My gameboy still keeps crashing!

A: Try a cheat device (e.g. Action Replay) as passthrough adapter. Those don't connect the RESET line between gameboy and cartridge. This prevents the gameboy from attempting to restart. You can also try putting tape over the 3rd Pin from the right, if you have more patience than me.

Q: I looked into your code and.... what the....

A: Yes, i know. Bare with me, this is my first serious python project. Feel free to refactor this mess...;)

Planned Features

  • Find and Port Code to other Link Cable related ACE exploits
  • Make GBA version (exploiting multiboot) to allow dump/write/flash of GBA bootlegs.

DISCLAIMER: I AM NOT RESPONSIBLE FOR ANYTHING, INCLUDING LOSS OF DATA, BROKEN GAMEBOYS, OR TEARS BECAUSE YOU ACCIDENTALLY OVERWRITE YOUR CHILDHOOD SAVE FILE WITH YOUR SICK 3 STARTER TEAM

I AM NOT AFFILIATED OR ENDORSED BY NINTENDO. THIS REPOSITORY DOES NOT CONTAIN NINTENDO OR GAMEFREAK CODE OR DATA

pksploit's People

Contributors

binarycounter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

ykankaya

pksploit's Issues

Pokemon Blue (USA) Hangs when attempting to initiate trade

Hello, using this tool as described, I am able to proceed up to the menu where you choose between trade center and colosseum, however at this point I am unable to move the cursor or make a selection. Has anybody else encountered this issue?

Hangs on bufferoverflow

Hey there. Cool tool!
I'm using a Pokémon Blue cartridge - "DMG-APEU-EUR" and on the trade centre screen I see player "2" who has a list of Mews, but after that the GB stops responding. I've tried on both AGS and GBC, neither seem to execute the payload. I just get a screen that slowly fills with "." (periods) and nothing seems to happen, no matter what option i choose in the python script.
Have you tried on this version of cartridge before? Or do you think I've another issue?
Thanks!

Pokemon yellow (english-EU) not working

After entering the trade the screen goes white and it doesn't matter what i select, the only thing i see are dots............
im using a gbc with an english (uk i think) legit yellow cartridge and an arduino uno r3.

Is this project still alive?

Does not work on european/french pokemon red/yellow

Hi,i'm using Uno R3 and european/french pokemon red and yellow.On red,it gives blank screen after payload is injected and when selecting option.it only gives dots "." forever.On yelleow,it just freeze with glitchy trade menu and the lowHP bip forever and Gives also dots forever.Really need help cause i don't know if this only work on usa version.Thanks

Can't write to SRAM

Hello, I can't write to SRAM, after selecting option 5 and a file, it just either appears some dots and a inifinte loop of blank spaces or it just gets a loop on no, I have tried to inject my own dumped save file but I still get the same error, I can't write to SRAM at all.
Everything else seems to work fine, any idea why I can't write to SRAM at all? thanks
I'm using an arduino uno if that helps, I have checked many times my inputs and it's okay

Pksploit stuck waiting for StatusMQ from Arduino when writing to SRAM

I tested this on my two GBA SPs with a German pokemon blue and a bootleg "cock" version that is based on the American red version.
The arduino I use is an Uno R3.
When I select to restore a save, the program gets stuck at line 666 and only prints "no" a lot of times to bash.
After commenting that part out it writes a garbled save that doesn't trigger the exploit on startup.
Could you also add on the readme, that you need to hold down the mode switch of the GBA with some sort of cardboard?
Otherwise you can't switch games after triggering the exploit as it reboots to GBA mode then.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.