Library that injects distribution event pokémon and reads (some) metadata and pokémon front sprites from the Gen 1 and Gen 2 Pokémon games
Go to file
risingPhil 5b85c04b5a Fix gen1 bug reported by /u/imranFZakhaev
When adding a pokémon to a save with a full party, the behaviour is completely broken.

Not only did we add a pokémon to every box, but it also would be a completely different one or even crash the game when trying to access the box.

Fixes:

- Stop after adding a pokemon to a box. Don't add it to all.
- In commit 77d5d15 I added a ::setPokemon function and reworked the Gen1Box::add() function to use it. That's where it went wrong:

in the add() function, we would modify the number_of_pokemon counter of the box, but not manipulate the species list and write it.
Then in the setPokemon() function, we would read the box metadata and correct it because the number did not match the species list. This is what went wrong.

To fix it, I just had to modify the species list in the add() function as well again.
2024-07-26 21:49:39 +02:00
docs Initial import 2024-06-11 21:45:59 +02:00
examples Fix bug gen2 addItem 2024-07-19 21:31:16 +02:00
include Add list of Pokémon moves in Moves.h alongside a function to convert the enum to string 2024-07-23 22:46:44 +02:00
src Fix gen1 bug reported by /u/imranFZakhaev 2024-07-26 21:49:39 +02:00
CREDITS.md Try again formatting the titles 2024-06-11 21:59:03 +02:00
LICENSE Update LICENSE 2024-06-11 21:47:38 +02:00
Makefile Initial import 2024-06-11 21:45:59 +02:00
README.md More README.md 2024-06-11 22:14:34 +02:00

Introduction

This project implements functionality to read stats, front sprites, Trainers' party/PC boxes and other various properties either from the ROM or from a save file of Gen 1 and Gen 2 Pokémon games. It also has support and data to inject the Distribution event pokémon into gen 1 and gen 2 pokémon save files.

I'm happy to accept pull requests if the community wants to do them.

Features

  • Decode front sprites from Gen 1 and Gen 2 Pokémon games
  • Read Trainers' party and PC boxes from Gen 1 and 2
  • Inject Pokémon from past distribution events into your Gen 1/Gen 2 game save
  • Inject other pokémon into your Gen 1/Gen 2 game save

Limitations

  • Right now, this library only supports the international versions of the games.

Dependencies

This library only depends on libc. I specifically wanted to avoid the bloat of libstdc++ or any other library. This choice is to keep this library small and portable.

The library was developed on Linux. I haven't tried building it on Windows or WSL yet, so let me know how that goes :)

Build

To build it, you can do this:

#Build with 12 threads (Change the thread number to what you want):

make -j 12

Usage

You can add the library to your project and use either the Gen1GameReader or Gen2GameReader alongside an instance of the BufferBasedRomReader and BufferBasedSaveManager.

There are also a few standalone example applications that are being built while building this project.

The most interesting one of those for most will probably be the addDistributionPoke application:

It gives you a menu in the terminal to select a distribution event pokémon into your save file.

Goal

This project was built as a stepping stone for the next project I want to do: To experiment with the N64 transfer pak with libdragon. In that project, I want to be able to inject Distribution pokémon into a cartridge using the N64 transfer pak. That's why the initial feature set is what it is.

I also hope that if someone else wants to work on something similar, that he/she finds the functionality they want or inspiration to implement it themselves. I tried to document the resources I used during development in the code.

Future potential improvements

  • Add support for gen 3
  • Possibly other additions if the community wants them?