This is a Pokemon exchange application from Flipper Zero to Game Boy (Generaction I). Flipper Zero emulates a "Slave" Game Boy connected to a Game Link Cable to be able to exchange any Pokemon from the First Generation (Red, Blue, Yellow) to a real Game Boy.
It currently trades a Pokemon based on your choice of Pokemon, Level, Stats and 4 Moves.
The Game Boy is connected to the Flipper Zero's GPIO pins via a GBC style Game Link Cable. The Flipper GB Link module is an easy way to connect a Game Boy via a Game Link Cable to the Flipper Zero.
Additionally, the MALVEKE - GAME BOY Tools for Flipper Zero is supported by this tool.
Details on the hardware interface, as well as how to create your own adapter board, can be found in the How Does It Work section below.
This project is intended to be overlaid on top of an existing firmware repo, in my case the Release 0.79.1 version.
- Clone the Flipper Zero firmware repository. Refer to this tutorial for updating the firmware.
- Copy the "pokemon" folder into the
/applications_user/pokemon
folder in your firmware. - Run the command
fbt launch
to run it on your Flipper Zero.
./fbt launch APPSRC=pokemon
- NOTE: If you only want to generate the fap file, you must run the following command.
./fbt fap_pokemon
And use qFlipper to copy the generated pokemon.fap file to the SD Card/apps/Game Boy
folder.
These instructions assume that you are starting at the Flipper Zero desktop. Otherwise, press the Back button until you are at the desktop.
-
If you're using a MALVEKE PCB version, verify the Pinout configuration:
-
Press the
OK
button on the Flipper to open the main menu. -
Choose
Applications
from the menu. -
Choose
GPIO
from the submenu. -
Choose
Pokemon Trading
-
The Flipper Zero will show the main menu of the application. The first option is to select the Pokemon to trade.
-
Press the
LEFT
/RIGHT
buttons to paginate the selection of Pokemon by 1. -
Press the
UP
/DOWN
buttons to paginate the selection of Pokemon by 10. -
Press the
OK
button to select the Pokemon to trade and return to the main menu -
The traded Pokemon's nickname can be set. When a Pokemon is selected, the nickname defaults to the species name in all caps. This mimics a Pokemon without a customized nickname. In order to reset this nickname to its default, clear the text entry field, press
OK
on theSave
button. This will fill the text box with the default name. PressSave
again to set this name.-
Note: The Nidoran♀ and Nidoran♂ names will not properly render. This is because the Flipper currently cannot print unicode characters to screen. Following the above instructions will fill the text entry field with
NIDORAN
with a space after it. This space is the unrenderable ♀/♂ symbol. Once traded, it will be correctly named. -
Note: Only alphanumeric characters are supported in the Pokemon's nickname at this time.
-
-
The Pokemon's level can be adjusted as well by hitting
OK
on the level option. The minimum level is2
and the maximum is100
. The level is input via a text box. (Levels below 2 cause an underflow glitch in Gen I games that would cause the level to jump to 100, so if you want this just set the Pokemon's level to 100) -
The
Select Moves
menu is used to pick the set the traded Pokemon's moves. They are pre-populated with the moveset that the Pokemon would know at level 1. Selecting a move slot will bring up an alphabetical index of moves. Additionally,No Move
andDefault
can be quickly selected. Note that any move after the firstNo Move
is ignored. -
The
Select Types
menu can change the traded Pokemon's types. The type(s) are pre-set to what the selected Pokemon normally is.-
Pokemon with a single type will have the same type set for both types.
-
Note: Unlike other menus, changing either type immediately saves it. Pressing
Back
will keep any changes. This will be addressed in a later version. If you need to revert to the default types, a different Pokemon can be selected and the desired Pokemon re-selected. -
Note: When changing the type(s), the Pokemon's in-game stats will NOT reflect the chosen type(s). Additionally, these may be overwritten back to default in-game if the Pokemon uses a move that affects types (e.g.
Transform
) or the Pokemon evolves.
-
-
The Pokemon's stats can also be influenced. The current settings are:
-
Random IV, Zero EV
Mimics stats of a caught wild Pokemon. -
Random IV, Max EV / Level
IV is randomized, but EV is set to the maximum a trained Pokemon could be for its current level. -
Random IV, Max EV
IV is randomized, EV is set to the absolute max for a perfectly trained Pokemon. -
Max IV, Zero EV
Mimics stats of a caught wild Pokemon, but with the maximum IV possible. -
Max IV, Max EV / Level
IV is max, EV is set to the maximum a trained Pokemon could be for its current level. -
Max IV, Max EV
Absolutely perfect and overly powerful Pokemon.
-
-
The
OT ID#
andOT Name
of the Pokemon can also be set. TheOT ID#
must be between0
and65535
. Setting theOT ID#
andOT Name
to the same as your current trainer's causes the game to believe it was a wild caught Pokemon and not one that was traded. This means high level Pokemon will still obey you without badges, but, will not get the experience boost of a traded Pokemon. -
Finally, select
Trade PKMN
to start the trade process. -
On your Game Boy, you should connect the Game Link Cable to the Game Boy and in the game, go to the nearest Pokemon Center.
-
Talk to the girl at the counter on the right. The girl will tell us that we have to save the game before playing, we will answer YES by pressing the A button.
-
The Flipper Zero will show that we are connected.
-
On the Game Boy, we will be asked which option we want, and we select TRADE CENTER.
-
You will enter the Trade Center where you must press the A button on the Game Boy on your side of the table.
-
Flipper Zero will remain on a waiting screen with the Pokemon you selected.
-
You will see your Pokemon and the Pokemon you selected on the Flipper Zero, in this case,
Mew
. You must select the Pokemon you want to trade and press TRADE. -
You must confirm the selected trade by selecting TRADE.
-
Flipper Zero will remain on a waiting screen with the Pokemon you selected.
-
Finally, the Pokemon exchange will start from Flipper Zero to the Game Boy.
-
Once the trade is complete, both the Game Boy and the Flipper Zero will return to the
WAITING
state. If the Game Boy selectsCANCEL
, the Flipper Zero will return to theREADY
state. TheBACK button can be pressed to return to the main menu. The traded Pokemon can be modified, or completely changed, if desired. Once the Flipper Zero Re-enters the Trade screen, and the Game Boy re-selects the trade table in-game, another trade can be completed. This allows for trading multiple Pokemon without having to reset the Game Boy each time.
If the Flipper Zero gets stuck at the end of the exchange, you must reboot it by pressing the
LEFT +
BACK key combination.
The method used to communicate 2 Game Boys is based on the SPI protocol, which is a very simple serial communication protocol in which a master device communicates with one or more slave devices. The protocol is bidirectional and synchronous, and uses three basic signals:
- A clock signal (CLK).
- An output signal (Serial Out or SO).
- An input signal (Serial In or SI).
In the Game Boy, games store data in an internal shift register that is used to send and receive information. The SPI protocol used by the Game Boy uses the clock signal to indicate when data is being transferred.
The Game Boy link protocol is synchronous and requires the slave device to respond at the same rate as the master device. The master device supplies an 8KHz clock (data transfer rate of 1KB/s). The time window for responding is only ~120μs. However, the slave device has no restrictions and can respond when it receives data. The clock can vary and there is no lower limit.
An example GB SPI transfer. Here, the master sends 0xD9 (217) and the slave sends 0x45 (69).
You can learn more about it in the following video. Analyzing the Different Versions of the Link Cable.
For the Flipper Zero board, a PortData EXT Link and a 2x8 prototype board were used.
PortData EXT Link for Game Boy Color, Game Boy Pocket, GBC, GBP, GBL.
I used 33kΩ resistor on CLK, but it's optional, it can be connected directly.The pins should be connected as follows:
![Connect Flipper Zero GPIO to Game Boy Pins](./docs/images/GPIO-GBPIN-v2.png)
Cable Game Link (Socket) | Flipper Zero GPIO |
---|---|
6 (GND) | 8 (GND) |
5 (CLK) | 6 (B2) |
3 (SI) | 7 (C3) |
2 (SO) | 5 (B3) |
It's possible to cut a cable directly without using a socket, but it's important to note that the cable is a crossover cable SI-SO.
"Cable Game Link" cut and directly connected to the Flipper Zero pins.
NOTE: Don't rely on the cable colors as they may vary depending on the manufacturer. Use a multimeter to measure continuity and identify which cable corresponds to each pin.
To generate the graphical interface, the FUI-Editor tool was used. Additionally, the original sprites from the game Pokemon Yellow, which are found in the Disassembly of Pokemon Yellow repository, were used.
For each image, the color #aaa
was transformed to #fff
so that Flipper Zero would render it correctly. To do this, a batch process was used in Photopea, the online image editor.
- Game Boy Color (GBC)
- Game Boy Advance (GBA)
- Flipper Zero firmware source code
- Adan Scotney's Pokemon trade protocol specification and implementation
- Derek Jamison - Youtube Channel
- Matt Penny - GBPlay Blog
- Pokémon data structure (Generation I)
- Disassembly of Pokemon Yellow
- Arduino-Spoofing-Gameboy-Pokemon-Trades
- 🎮 Gameboy link cable breakout PCB
From Talcahuano 🇨🇱 with ❤