Skip to content

Commit 2c83a70

Browse files
committed
Revert "Added stats selection"
This reverts commit 80e3bb4.
1 parent a6d35f1 commit 2c83a70

14 files changed

Lines changed: 326 additions & 276 deletions

README_catalog.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# 🐬 Flipper Zero - Pokemon Trading in Game Boy
2+
3+
## Introduction
4+
5+
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.
6+
7+
It is a Proof of Concept (POC) for using views, GPIO, and FURI (Flipper Universal Registry Implementation).
8+
9+
10+
## Connection: Flipper Zero GPIO - Game Boy
11+
12+
The pins should be connected as follows:
13+
14+
| Cable Game Link (Socket) | Flipper Zero GPIO |
15+
| ------------------------ | ----------------- |
16+
| 6 (GND) | 8 (GND) |
17+
| 5 (CLK) | 6 (B2) |
18+
| 3 (SI) | 7 (C3) |
19+
| 2 (SO) | 5 (B3) |
20+
21+
## How does it work?
22+
23+
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:
24+
25+
- A clock signal (CLK).
26+
- An output signal (Serial Out or SO).
27+
- An input signal (Serial In or SI).
28+
29+
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.
30+
31+
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.
32+
33+
34+
## Tested In
35+
- Game Boy Color (GBC)
36+
- Game Boy Advance (GBA)
37+
38+

README_es.md

Lines changed: 249 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,249 @@
1+
# 🐬 Flipper Zero - Pokemon Trading in Game Boy
2+
3+
<p align="center">
4+
<a target="_blank" href="https://www.reddit.com/r/flipperzero/comments/121ncot/flipper_zero_game_boy_pokemon_trading/">
5+
<img align="center" alt="Flipper Zero - Pokemon Trading Game Boy" src="./docs/images/youtube.png" />
6+
<br />
7+
</p>
8+
<div align="center">
9+
10+
**FW Official** | **FW Unleashed** | **FW RogueMaster**
11+
:- | :- | :-
12+
[![FlipC.org](https://flipc.org/EstebanFuentealba/Flipper-Zero-Game-Boy-Pokemon-Trading/badge?branch=main)](https://flipc.org/EstebanFuentealba/Flipper-Zero-Game-Boy-Pokemon-Trading?branch=main)|[![FlipC.org](https://flipc.org/EstebanFuentealba/Flipper-Zero-Game-Boy-Pokemon-Trading/badge?branch=main&firmware=unleashed)](https://flipc.org/EstebanFuentealba/Flipper-Zero-Game-Boy-Pokemon-Trading?branch=main&firmware=unleashed)|[![FlipC.org](https://flipc.org/EstebanFuentealba/Flipper-Zero-Game-Boy-Pokemon-Trading/badge?branch=main&firmware=roguemaster)](https://flipc.org/EstebanFuentealba/Flipper-Zero-Game-Boy-Pokemon-Trading?branch=main&firmware=roguemaster)
13+
</div>
14+
15+
## Introducción
16+
17+
Esta es una aplicación de intercambio de Pokemon's desde de Flipper Zero a Game Boy [(Generación I)](https://bulbapedia.bulbagarden.net/wiki/Generation_I). Flipper Zero emula un Game Boy "Esclavo" conectado a **Cable Game Link** para poder intercambiar cualquier Pokemon de la Primera Generación (Red, Blue, Yellow) a un Game Boy Real.
18+
19+
Es una Prueba de concepto (POC) para utilizar vistas, GPIO y FURI (Flipper Universal Registry Implementation).
20+
21+
## Instrucciones de instalación
22+
23+
Este proyecto está destinado a ser superpuesto encima de un repositorio de firmware existente, en mi caso la versión **Release 0.79.1**.
24+
25+
- Clona el [Repositorio del firmware de Flipper Zero](https://github.com/flipperdevices/flipperzero-firmware). Consulta este [tutorial](https://github.com/jamisonderek/flipper-zero-tutorials/tree/main/firmware/updating/README.md) para actualizar el firmware.
26+
- Copia la [carpeta "pokemon"](..) en la carpeta `/applications_user/pokemon` del firmware que clonaste.
27+
- Corre el comando `fbt launch_app` para correr en tu Flipper Zero.
28+
29+
```bash
30+
./fbt launch_app APPSRC=pokemon
31+
```
32+
33+
- NOTA: Si sólo quieres generar el archivo `fap` debes correr el siguiente comando.
34+
35+
```bash
36+
./fbt fap_pokemon
37+
```
38+
39+
y usa [**qFlipper**](https://flipperzero.one/update) para copiar el archivo **pokemon.fap** generado a la carpeta `SD Card/apps/Game Boy`.
40+
41+
<p align='center'>
42+
<img src="./docs/images/qFlipper.png" width="400" /><br />
43+
</p>
44+
45+
## Instrucciones de Uso
46+
47+
Estas instrucciones asumen que está comenzando en el escritorio de Flipper Zero. De lo contrario, presione el botón Atrás hasta que esté en el escritorio.
48+
49+
- Presione el botón `OK` en el flipper para abrir el menú principal.
50+
- Elija `Aplicaciones` en el menú.
51+
- Elija `Game Boy` en el submenú.
52+
- Elija `Pokemon Trading`
53+
- El Flipper Zero debe mostrar la selección de Pokemon que se desea intercambiar y por defecto parece bulbasaur.
54+
55+
<p align='center'>
56+
<br />
57+
<img src="./docs/images/flipper-zero-flat-1.png" width="400" />
58+
<br />
59+
</p>
60+
61+
- Pulse los botones `IZQUIERDA`/`DERECHA` para paginar de 1 en 1 la selección de Pokemon.
62+
- Pulse los botones `ARRIBA`/`ABAJO` para paginar de 10 en 10 la selección de Pokemon.
63+
- Pulse el botón `OK` para seleccionar el Pokemon a Intercambiar.
64+
<p align='center'>
65+
<br />
66+
<img src="./docs/images/flipper-zero-flat-2.png" width="400" /><br />
67+
</p>
68+
- En el Flipper Zero se muestra la vista para conectar el Game Boy.
69+
<p align='center'>
70+
<br />
71+
<img src="./docs/images/flipper-zero-flat-3.png" width="400" /><br />
72+
</p>
73+
- En tu Game Boy debes conectar el **Cable Game Link** al Game Boy, en el juego dirigirte a un **Centro Pokémon** que tengas más cercano.
74+
<p align='center'>
75+
<br />
76+
<img src="./docs/images/game_boy_pokemon_center.png" width="400" /><br />
77+
</p>
78+
- Habla con la chica que está en el mostrador de la derecha. La chica nos dirá que para poder jugar antes tendremos que salvar el juego, le contestaremos que _SI_ pulsando el botón _A_.
79+
<p align='center'>
80+
<br />
81+
<img src="./docs/images/game_boy_save.png" width="400" /><br />
82+
</p>
83+
- El Flipper Zero nos mostrará que estámos conectados.
84+
<p align='center'>
85+
<br />
86+
<img src="./docs/images/flipper-zero-flat-4.png" width="400" /><br />
87+
</p>
88+
- En el Game Boy nos preguntará que opción queremos y Seleccionamos **CENT. CAMBIO**.
89+
<p align='center'>
90+
<br />
91+
<img src="./docs/images/game_boy_save_trade.png" width="400" /><br />
92+
</p>
93+
- Entrarás a la sala de Intercambio donde debes presionar el botón A del Game Boy en el lado de tu mesa.
94+
<p align='center'>
95+
<br />
96+
<img src="./docs/images/game_boy_trade_room_2.png" width="400" /><br />
97+
</p>
98+
- Flipper Zero quedará en una pantalla de espera con el Pokemon que seleccionaste.
99+
<p align='center'>
100+
<br />
101+
<img src="./docs/images/flipper-zero-flat-5.png" width="400" /><br />
102+
</p>
103+
- Se te mostrarán tus Pokemon y el Pokemon que seleccionaste en el Flipper Zero, en este Caso **Mew**. Debes seleccionar el pokemon que quieres intercambiar y presionar **TRATO**.
104+
<p align='center'>
105+
<br />
106+
<img src="./docs/images/game_boy_trade_list_select_trade.png" width="400" /><br />
107+
</p>
108+
- Debes confirmar el intercambio seleccionado **TRATO**.
109+
<p align='center'>
110+
<br />
111+
<img src="./docs/images/game_boy_trade_list_select_trade_confirm.png" width="400" /><br />
112+
</p>
113+
- Flipper Zero quedará en una pantalla de espera con el Pokemon que seleccionaste.
114+
<p align='center'>
115+
<br />
116+
<img src="./docs/images/flipper-zero-flat-6.png" width="400" /><br />
117+
</p>
118+
- Finalmente comenzará el intercambio de Pokemon desde **Flipper Zero** al **Game Boy**.
119+
<p align='center'>
120+
<br />
121+
<img src="./docs/images/flipper-zero-flat-7.png" width="400" /><br />
122+
</p>
123+
- **NOTA**: Si al final del Intercambio se te bloquea el Flipper Zero debes Rebootear presionando la combinación de teclas <img src="./docs/images/left.png" /> IZQUIERDA + <img src="./docs/images/back.png" /> ATRAS
124+
<p align='center'>
125+
<br />
126+
<img src="./docs/images/reboot.png" width="400" /><br />
127+
</p>
128+
129+
## ¿Cómo trabaja?
130+
131+
El método utilizado para comunicar 2 Game Boy se basa en el protocolo SPI, que es un protocolo de comunicación serial muy simple en el que un dispositivo maestro se comunica con uno o más dispositivos esclavos. El protocolo es bidireccional y sincrónico, y utiliza tres señales básicas:
132+
133+
- Una señal de reloj (CLK).
134+
- Una señal de salida (Serial Out o SO).
135+
- Una señal de entrada (Serial In o SI).
136+
137+
En el Game Boy, los juegos almacenan los datos en un registro de cambio interno que se utiliza para enviar y recibir información. El protocolo SPI utilizado por el Game Boy utiliza la señal de reloj para indicar cuándo se transfieren los datos.
138+
139+
El protocolo de enlace de Game Boy es síncrono y requiere que el dispositivo esclavo responda al mismo ritmo que el dispositivo maestro. El dispositivo maestro suministra un reloj de 8KHz (velocidad de transferencia de datos de 1KB/s). La ventana de tiempo para responder es de solo **~120μs**. Sin embargo, el dispositivo esclavo no tiene restricciones y puede responder cuando recibe los datos. El reloj puede variar y no hay un límite inferior.
140+
141+
<p align='center'>
142+
<br />
143+
<img src="./docs/images/gb_spi.png" width="400" /><br />
144+
</p>
145+
146+
_Una transferencia de ejemplo de GB SPI. Aquí, el maestro envía 0xD9 (217) y el esclavo envía 0x45 (69)._
147+
148+
<br />
149+
150+
Se puede conocer mas al respecto en el siguiente Video [**Analyzing the Different Versions of the Link Cable**](https://youtu.be/h1KKkCfzOws?t=151).
151+
152+
## Placa para Flipper Zero con Socket PortData EXT Link
153+
154+
Para la placa del Fipper Zero se utilizó un [PortData EXT Link](https://es.aliexpress.com/item/1005004116983895.html) y una [place de prototipo](https://es.aliexpress.com/item/32478242317.html) de 2x8.
155+
156+
<p align='center'>
157+
<br />
158+
<img src="./docs/images/EXT-Link.png" width="400" /><br />
159+
</p>
160+
161+
_PortData EXT Link para Game Boy Color, Game Boy Pocket, GBC, GBP, GBL._
162+
163+
<p align='center'>
164+
<br />
165+
<img src="./docs/images/pcb.png" width="400" /><br />
166+
</p>
167+
<p align='center'>
168+
<br />
169+
<img src="./docs/images/flipper-zero-pcb.png" width="400" /><br />
170+
</p>
171+
Usé una resistencia de 33kΩ en CLK, pero es opcional, se puede conectar directamente.
172+
173+
## Conexión: Flipper Zero GPIO - Game Boy
174+
175+
Se deben conectar los Pines de la siguiente manera
176+
177+
<p align='center'>
178+
<br />
179+
<img src="./docs/images/wgbl-0.png" width="400" /><br />
180+
</p>
181+
182+
<picture>
183+
<source media="(prefers-color-scheme: dark)" srcset="./docs/images/GPIO-GBPIN_light-v2.png">
184+
<source media="(prefers-color-scheme: light)" srcset="./docs/images/GPIO-GBPIN-v2.png">
185+
<img
186+
alt="Connect Flipper Zero GPIO to Game Boy Pins"
187+
src="./docs/images/GPIO-GBPIN-v2.png">
188+
</picture>
189+
190+
| Cable Game Link (Socket) | Flipper Zero GPIO |
191+
| ------------------------ | ----------------- |
192+
| 6 (GND) | 8 (GND) |
193+
| 5 (CLK) | 6 (B2) |
194+
| 3 (SI) | 7 (C3) |
195+
| 2 (SO) | 5 (B3) |
196+
197+
198+
## Conectar a Flipper Zero sin Socket PortData EXT Link
199+
200+
Pudes cortar un cable directamente sin usar el socket pero debes tener en cuenta que el es un cable cruzado SI-SO.
201+
202+
<p align='center'>
203+
<br />
204+
<img src="./docs/images/cut-cable-v3.png" width="400" /><br />
205+
</p>
206+
207+
*"Cable Game Link" cortado y conectado directamente a los pines de Flipper Zero.*
208+
209+
210+
**NOTA**: No guiarse por los colores porque dependiendo del fabricante estos pueden cambiar, con un multímetro medir continuidad e identificar que cable es de que pin
211+
212+
213+
## GUI
214+
215+
Para generar la Interfaz gráfica se utilizó la herramienta [**FUI-Editor**](https://ilin.pt/stuff/fui-editor/).
216+
Además se utilizaron los sprites originales del juego _Pokemon Yellow_ que se encuentran en el repositorio [**Disassembly of Pokemon Yellow**](https://github.com/pret/pokeyellow/tree/master/gfx/pokemon/front).
217+
218+
De cada imagen se transformó el color `#aaa` a `#fff` para que Flipper Zero la renderizara bien. Para eso se utilizó un **Batch** para [Photopea](https://www.photopea.com/), el editor de imagenes online.
219+
220+
## Implementado en
221+
- Game Boy Color (GBC)
222+
- Game Boy Advance (GBA)
223+
224+
## Implementado por
225+
<a href="https://github.com/EstebanFuentealba/Flipper-Zero-Game-Boy-Pokemon-Trading/issues?q=is%3Aissue+label%3AImplemented+is%3Aclosed+is%3Aopen+" target="_blank"><img src="./docs/images/implemented.svg" /></a>
226+
227+
## TODO
228+
229+
- [ ] Refactorizar el código
230+
- [ ] Al salir de la app el botón `OK` deja de funcionar por lo que hay que reiniciarlo 🤔
231+
- [ ] Setear a cada pokemon sus características, ataques, niveles por defecto
232+
- [ ] Mejorar animaciones
233+
234+
## Links
235+
236+
- [Flipper Zero firmware source code](https://github.com/flipperdevices/flipperzero-firmware)
237+
- Adan Scotney's pokemon [trade protocol specification](http://www.adanscotney.com/2014/01/spoofing-pokemon-trades-with-stellaris.html) and implementation
238+
- Derek Jamison - [Youtube Channel](https://www.youtube.com/@MrDerekJamison)
239+
- Matt Penny - [GBPlay Blog](https://blog.gbplay.io/)
240+
- [Pokémon data structure (Generation I)](<https://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_data_structure_(Generation_I)>)
241+
- [Disassembly of Pokemon Yellow](https://github.com/pret/pokeyellow)
242+
- [Arduino-Spoofing-Gameboy-Pokemon-Trades](https://github.com/EstebanFuentealba/Arduino-Spoofing-Gameboy-Pokemon-Trades)
243+
- [🎮 Gameboy link cable breakout PCB](https://github.com/Palmr/gb-link-cable)
244+
245+
<p align='center'>
246+
<br />
247+
<br />
248+
Desde Talcahuano 🇨🇱 con ❤
249+
</p>

changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog - Patch Notes
2+
3+
## Version 1.2.0
4+
- **Cleanup data structs:** This refactors the main data blocks for defining pokemon, the icon, their species/hex value, as well as the large trade array in to more human friendly structs. Laying some groundwork to be able to adjust pokemon details pre-trade by @kbembedded .
5+
- **Bug Fixes:** Fix furi crash, Fixes #9 by @kbembedded .

docs/images/implemented.svg

Lines changed: 15 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)