Skip to content

Commit 7c6052b

Browse files
committed
upd pokemon trading
1 parent e4dc07f commit 7c6052b

27 files changed

+1462
-409
lines changed

non_catalog_apps/gb-pokemon-trading/README.md

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,23 @@ This is a Pokemon exchange application from Flipper Zero to Game Boy [(Generacti
2020

2121
It currently trades a Pokemon based on your choice of Pokemon, Level, Stats and 4 Moves.
2222

23+
## Hardware Interface
24+
The Game Boy is connected to the Flipper Zero's GPIO pins via a GBC style Game Link Cable. The [Flipper GB Link module](https://www.tindie.com/products/kbembedded/game-link-gpio-module-for-flipper-zero-game-boy/) is an easy way to connect a Game Boy via a Game Link Cable to the Flipper Zero.
25+
<p align='center'>
26+
<a href="https://www.tindie.com/stores/kbembedded/?ref=offsite_badges&utm_source=sellers_kbembedded&utm_medium=badges&utm_campaign=badge_large"><img src="https://d2ss6ovg47m0r5.cloudfront.net/badges/tindie-larges.png" alt="I sell on Tindie" width="200" height="104"></a>
27+
</p>
28+
29+
Additionally, the [MALVEKE - GAME BOY Tools for Flipper Zero](https://www.tindie.com/products/efuentealba/malveke-game-boy-tools-for-flipper-zero/) is supported by this tool.
30+
31+
<p align='center'>
32+
<a href="https://www.tindie.com/stores/efuentealba/?ref=offsite_badges&utm_source=sellers_efuentealba&utm_medium=badges&utm_campaign=badge_large"><img src="https://d2ss6ovg47m0r5.cloudfront.net/badges/tindie-larges.png" alt="I sell on Tindie" width="200" height="104"></a>
33+
</p>
34+
35+
Details on the hardware interface, as well as how to create your own adapter board, can be found in the [How Does It Work](#how-does-it-work) section below.
36+
2337
## Installation Directions
2438

25-
This project is intended to be overlayed on top of an existing firmware repo, in my case the **Release 0.79.1** version.
39+
This project is intended to be overlaid on top of an existing firmware repo, in my case the **Release 0.79.1** version.
2640

2741
- Clone the [Flipper Zero firmware repository](https://github.com/flipperdevices/flipperzero-firmware). Refer to [this tutorial](https://github.com/jamisonderek/flipper-zero-tutorials/tree/main/firmware/updating/README.md) for updating the firmware.
2842
- Copy the "pokemon" folder into the `/applications_user/pokemon` folder in your firmware.
@@ -48,6 +62,7 @@ And use [**qFlipper**](https://flipperzero.one/update) to copy the generated **p
4862

4963
These instructions assume that you are starting at the Flipper Zero desktop. Otherwise, press the Back button until you are at the desktop.
5064

65+
- If using a MALVEKE board, plug it in to the GPIO header now. The app will auto-detect and select the correct pinout to support the MALVEKE EXT1 interface. If using the Flipper GB Link board, or any other pinout, they can be connected to the Flipper Zero now, or at any point in the future.
5166
- Press the `OK` button on the Flipper to open the main menu.
5267
- Choose `Applications` from the menu.
5368
- Choose `GPIO` from the submenu.
@@ -87,7 +102,7 @@ These instructions assume that you are starting at the Flipper Zero desktop. Oth
87102
<br />
88103
</p>
89104

90-
- 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` and `Default` can be quickliy selected. Note that any move after the first `No Move` is ignored.
105+
- 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` and `Default` can be quickly selected. Note that any move after the first `No Move` is ignored.
91106

92107
<p align='center'>
93108
<br />
@@ -115,7 +130,7 @@ These instructions assume that you are starting at the Flipper Zero desktop. Oth
115130
- The Pokemon's stats can also be influenced. The current settings are:
116131
- `Random IV, Zero EV` Mimics stats of a caught wild Pokemon.
117132
- `Random IV, Max EV / Level` IV is randomized, but EV is set to the maximum a trained Pokemon could be for its current level.
118-
- `Randon IV, Max EV` IV is randomized, EV is set to the abosolute max for a perfectly trained Pokemon.
133+
- `Randon IV, Max EV` IV is randomized, EV is set to the absolute max for a perfectly trained Pokemon.
119134
- `Max IV, Zero EV` Mimics stats of a caught wild Pokemon, but with the maximum IV possible.
120135
- `Max IV, Max EV / Level` IV is max, EV is set to the maximum a trained Pokemon could be for its current level.
121136
- `Max IV, Max EV` Absolutely perfect and overly powerful Pokemon.
@@ -126,7 +141,7 @@ These instructions assume that you are starting at the Flipper Zero desktop. Oth
126141
<br />
127142
</p>
128143

129-
- The `OT ID#` and `OT Name` of the Pokemon can also be set. The `OT ID#` must be between `0` and `65535`. Setting the `OT ID#` and `OT 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 Pokmon will still obey you without badges, but, will not get the experience boost of a traded Pokemon.
144+
- The `OT ID#` and `OT Name` of the Pokemon can also be set. The `OT ID#` must be between `0` and `65535`. Setting the `OT ID#` and `OT 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.
130145

131146
<p align='center'>
132147
<br />
@@ -220,6 +235,8 @@ These instructions assume that you are starting at the Flipper Zero desktop. Oth
220235
<img src="./docs/images/flipper-zero-flat-12.png" width="400" /><br />
221236
</p>
222237

238+
- Once the trade is complete, both the **Game Boy** and the **Flipper Zero** will return to the `WAITING` state. If the **Game Boy** selects `CANCEL`, the **Flipper Zero** will return to the `READY` state. The <img src="./docs/images/back.png" /> BACK 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.
239+
223240
If the Flipper Zero gets stuck at the end of the exchange, you must reboot it by pressing the <img src="./docs/images/left.png" /> LEFT + <img src="./docs/images/back.png" /> BACK key combination.
224241

225242
<p align='center'>
@@ -252,7 +269,7 @@ You can learn more about it in the following video. [**Analyzing the Different V
252269

253270
## Board for Flipper Zero with PortData EXT Link.
254271

255-
For the Flipper Zero board, a [PortData EXT Link](https://es.aliexpress.com/item/1005004116983895.html) and a 2x8 [prototype board](https://es.aliexpress.com/item/32478242317.html) were used.
272+
For the Flipper Zero board, a [PortData EXT Link](https://s.click.aliexpress.com/e/_Dm3EqlR) and a 2x8 [prototype board](https://s.click.aliexpress.com/e/_DETrjpL) were used.
256273

257274
<p align='center'>
258275
<br />
@@ -322,14 +339,13 @@ For each image, the color `#aaa` was transformed to `#fff` so that Flipper Zero
322339
- Game Boy Advance (GBA)
323340

324341
## Contributors
325-
<a href="https://github.com/EstebanFuentealba/Flipper-Zero-Game-Boy-Pokemon-Trading/">EstebanFuentealba</a><br />
326-
<a href="https://github.com/R4g3D/Flipper-Zero-Game-Boy-Pokemon-Trading/">R4g3D</a><br />
327-
<a href="https://github.com/kbembedded/Flipper-Zero-Game-Boy-Pokemon-Trading/">kbembedded</a>
342+
[![Contributors](https://contrib.rocks/image?repo=EstebanFuentealba/Flipper-Zero-Game-Boy-Pokemon-Trading)](https://github.com/EstebanFuentealba/Flipper-Zero-Game-Boy-Pokemon-Trading/graphs/contributors)
343+
328344

329345
## Links
330346

331347
- [Flipper Zero firmware source code](https://github.com/flipperdevices/flipperzero-firmware)
332-
- Adan Scotney's pokemon [trade protocol specification](http://www.adanscotney.com/2014/01/spoofing-pokemon-trades-with-stellaris.html) and implementation
348+
- Adan Scotney's Pokemon [trade protocol specification](http://www.adanscotney.com/2014/01/spoofing-pokemon-trades-with-stellaris.html) and implementation
333349
- Derek Jamison - [Youtube Channel](https://www.youtube.com/@MrDerekJamison)
334350
- Matt Penny - [GBPlay Blog](https://blog.gbplay.io/)
335351
- [Pokémon data structure (Generation I)](<https://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_data_structure_(Generation_I)>)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# 🐬 Flipper Zero - Pokemon Trading in Game Boy
2+
3+
## Introduction
4+
5+
Now supports MALVEKE board!
6+
7+
This is a Pokemon exchange application from Flipper Zero to Game Boy (Generación 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.
8+
9+
If a MALVEKE board is plugged in to GPIO before starting the app, the app will default to using the MALVEKE EXT1 interface.
10+
11+
12+
## Connection: Flipper Zero GPIO - Game Boy
13+
14+
The original pinout is as follows:
15+
16+
| Cable Game Link (Socket) | Flipper Zero GPIO |
17+
| ------------------------ | ----------------- |
18+
| 6 (GND) | 8 (GND) |
19+
| 5 (CLK) | 6 (B2) |
20+
| 3 (SI) | 7 (C3) |
21+
| 2 (SO) | 5 (B3) |
22+
23+
Using the "Select Pinout" option, the Original, MALVEKE, or any custom pin configuration can be selected.
24+
25+
26+
## How does it work?
27+
28+
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:
29+
30+
- A clock signal (CLK).
31+
- An output signal (Serial Out or SO).
32+
- An input signal (Serial In or SI).
33+
34+
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.
35+
36+
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.
37+
38+
39+
## Tested In
40+
- Game Boy Color (GBC)
41+
- Game Boy Advance (GBA)

0 commit comments

Comments
 (0)