Explorar el Código

Merge pull request #13 from kbembedded/cleanup-data-struct

Cleanup data structs
Esteban Fuentealba hace 2 años
padre
commit
c09a0e3a1b
Se han modificado 6 ficheros con 486 adiciones y 115 borrados
  1. 154 65
      pokemon_app.cpp
  2. 8 4
      pokemon_app.h
  3. 312 32
      pokemon_data.h
  4. 9 11
      views/select_pokemon.cpp
  5. 1 1
      views/trade.cpp
  6. 2 2
      views/trade.hpp

+ 154 - 65
pokemon_app.cpp

@@ -1,70 +1,159 @@
 #include "pokemon_app.h"
 
-const char* pokemon_names[] = {
-    "bulbasaur",  "ivysaur",   "venusaur",   "charmander", "charmeleon", "charizard",
-    "squirtle",   "wartortle", "blastoise",  "caterpie",   "metapod",    "butterfree",
-    "weedle",     "kakuna",    "beedrill",   "pidgey",     "pidgeotto",  "pidgeot",
-    "rattata",    "raticate",  "spearow",    "fearow",     "ekans",      "arbok",
-    "pikachu",    "raichu",    "sandshrew",  "sandslash",  "nidoran ♀",  "nidorina",
-    "nidoqueen",  "nidoran ♂", "nidorino",   "nidoking",   "clefairy",   "clefable",
-    "vulpix",     "ninetales", "jigglypuff", "wigglytuff", "zubat",      "golbat",
-    "oddish",     "gloom",     "vileplume",  "paras",      "parasect",   "venonat",
-    "venomoth",   "diglett",   "dugtrio",    "meowth",     "persian",    "psyduck",
-    "golduck",    "mankey",    "primeape",   "growlithe",  "arcanine",   "poliwag",
-    "poliwhirl",  "poliwrath", "abra",       "kadabra",    "alakazam",   "machop",
-    "machoke",    "machamp",   "bellsprout", "weepinbell", "victreebel", "tentacool",
-    "tentacruel", "geodude",   "graveler",   "golem",      "ponyta",     "rapidash",
-    "slowpoke",   "slowbro",   "magnemite",  "magneton",   "farfetchd",  "doduo",
-    "dodrio",     "seel",      "dewgong",    "grimer",     "muk",        "shellder",
-    "cloyster",   "gastly",    "haunter",    "gengar",     "onix",       "drowzee",
-    "hypno",      "krabby",    "kingler",    "voltorb",    "electrode",  "exeggcute",
-    "exeggutor",  "cubone",    "marowak",    "hitmonlee",  "hitmonchan", "lickitung",
-    "koffing",    "weezing",   "rhyhorn",    "rhydon",     "chansey",    "tangela",
-    "kangaskhan", "horsea",    "seadra",     "goldeen",    "seaking",    "staryu",
-    "starmie",    "mr. mime",  "scyther",    "jynx",       "electabuzz", "magmar",
-    "pinsir",     "tauros",    "magikarp",   "gyarados",   "lapras",     "ditto",
-    "eevee",      "vaporeon",  "jolteon",    "flareon",    "porygon",    "omanyte",
-    "omastar",    "kabuto",    "kabutops",   "aerodactyl", "snorlax",    "articuno",
-    "zapdos",     "moltres",   "dratini",    "dragonair",  "dragonite",  "mewtwo",
-    "mew"};
-const Icon* pokemon_icons[] = {
-    &I_bulbasaur,  &I_ivysaur,   &I_venusaur,   &I_charmander, &I_charmeleon, &I_charizard,
-    &I_squirtle,   &I_wartortle, &I_blastoise,  &I_caterpie,   &I_metapod,    &I_butterfree,
-    &I_weedle,     &I_kakuna,    &I_beedrill,   &I_pidgey,     &I_pidgeotto,  &I_pidgeot,
-    &I_rattata,    &I_raticate,  &I_spearow,    &I_fearow,     &I_ekans,      &I_arbok,
-    &I_pikachu,    &I_raichu,    &I_sandshrew,  &I_sandslash,  &I_nidoranf,   &I_nidorina,
-    &I_nidoqueen,  &I_nidoranm,  &I_nidorino,   &I_nidoking,   &I_clefairy,   &I_clefable,
-    &I_vulpix,     &I_ninetales, &I_jigglypuff, &I_wigglytuff, &I_zubat,      &I_golbat,
-    &I_oddish,     &I_gloom,     &I_vileplume,  &I_paras,      &I_parasect,   &I_venonat,
-    &I_venomoth,   &I_diglett,   &I_dugtrio,    &I_meowth,     &I_persian,    &I_psyduck,
-    &I_golduck,    &I_mankey,    &I_primeape,   &I_growlithe,  &I_arcanine,   &I_poliwag,
-    &I_poliwhirl,  &I_poliwrath, &I_abra,       &I_kadabra,    &I_alakazam,   &I_machop,
-    &I_machoke,    &I_machamp,   &I_bellsprout, &I_weepinbell, &I_victreebel, &I_tentacool,
-    &I_tentacruel, &I_geodude,   &I_graveler,   &I_golem,      &I_ponyta,     &I_rapidash,
-    &I_slowpoke,   &I_slowbro,   &I_magnemite,  &I_magneton,   &I_farfetchd,  &I_doduo,
-    &I_dodrio,     &I_seel,      &I_dewgong,    &I_grimer,     &I_muk,        &I_shellder,
-    &I_cloyster,   &I_gastly,    &I_haunter,    &I_gengar,     &I_onix,       &I_drowzee,
-    &I_hypno,      &I_krabby,    &I_kingler,    &I_voltorb,    &I_electrode,  &I_exeggcute,
-    &I_exeggutor,  &I_cubone,    &I_marowak,    &I_hitmonlee,  &I_hitmonchan, &I_lickitung,
-    &I_koffing,    &I_weezing,   &I_rhyhorn,    &I_rhydon,     &I_chansey,    &I_tangela,
-    &I_kangaskhan, &I_horsea,    &I_seadra,     &I_goldeen,    &I_seaking,    &I_staryu,
-    &I_starmie,    &I_mr_mime,   &I_scyther,    &I_jynx,       &I_electabuzz, &I_magmar,
-    &I_pinsir,     &I_tauros,    &I_magikarp,   &I_gyarados,   &I_lapras,     &I_ditto,
-    &I_eevee,      &I_vaporeon,  &I_jolteon,    &I_flareon,    &I_porygon,    &I_omanyte,
-    &I_omastar,    &I_kabuto,    &I_kabutops,   &I_aerodactyl, &I_snorlax,    &I_articuno,
-    &I_zapdos,     &I_moltres,   &I_dratini,    &I_dragonair,  &I_dragonite,  &I_mewtwo,
-    &I_mew};
-const unsigned char pokemon_hex_codes[] = {
-    0x99, 0x09, 0x9A, 0xB0, 0xB2, 0xB4, 0xB1, 0xB3, 0x1C, 0x7B, 0x7C, 0x7D, 0x70, 0x71, 0x72, 0x24,
-    0x96, 0x97, 0xA5, 0xA6, 0x05, 0x23, 0x6C, 0x2D, 0x54, 0x55, 0x60, 0x61, 0x0F, 0xA8, 0x10, 0x03,
-    0xA7, 0x07, 0x04, 0x8E, 0x52, 0x53, 0x64, 0x65, 0x6B, 0x82, 0xB9, 0xBA, 0xBB, 0x6D, 0x2E, 0x41,
-    0x77, 0x3B, 0x76, 0x4D, 0x90, 0x2F, 0x80, 0x39, 0x75, 0x21, 0x14, 0x47, 0x6E, 0x6F, 0x94, 0x26,
-    0x95, 0x6A, 0x29, 0x7E, 0xBC, 0xBD, 0xBE, 0x18, 0x9B, 0xA9, 0x27, 0x31, 0xA3, 0xA4, 0x25, 0x08,
-    0xAD, 0x36, 0x40, 0x46, 0x74, 0x3A, 0x78, 0x0D, 0x88, 0x17, 0x8B, 0x19, 0x93, 0x0E, 0x22, 0x30,
-    0x81, 0x4E, 0x8A, 0x06, 0x8D, 0x0C, 0x0A, 0x11, 0x91, 0x2B, 0x2C, 0x0B, 0x37, 0x8F, 0x12, 0x01,
-    0x28, 0x1E, 0x02, 0x5C, 0x5D, 0x9D, 0x9E, 0x1B, 0x98, 0x2A, 0x1A, 0x48, 0x35, 0x33, 0x1D, 0x3C,
-    0x85, 0x16, 0x13, 0x4C, 0x66, 0x69, 0x68, 0x67, 0xAA, 0x62, 0x63, 0x5A, 0x5B, 0xAB, 0x84, 0x4A,
-    0x4B, 0x49, 0x58, 0x59, 0x42, 0x83, 0x15};
+struct pokemon_lut pokemon_table[] = {
+	{ "Bulbasaur",	&I_bulbasaur,	0x99 },
+	{ "Ivysaur",	&I_ivysaur,	0x09 },
+	{ "Venusaur",	&I_venusaur,	0x9A },
+	{ "Charmander",	&I_charmander,	0xB0 },
+	{ "Charmeleon",	&I_charmeleon,	0xB2 },
+	{ "Charizard",	&I_charizard,	0xB4 },
+	{ "Squirtle",	&I_squirtle,	0xB1 },
+	{ "Wartortle",	&I_wartortle,	0xB3 },
+	{ "Blastoise",	&I_blastoise,	0x1C },
+	{ "Caterpie",	&I_caterpie,	0x7B },
+	{ "Metapod",	&I_metapod,	0x7C },
+	{ "Butterfree",	&I_butterfree,	0x7D },
+	{ "Weedle",	&I_weedle,	0x70 },
+	{ "Kakuna",	&I_kakuna,	0x71 },
+	{ "Beedrill",	&I_beedrill,	0x72 },
+	{ "Pidgey",	&I_pidgey,	0x24 },
+	{ "Pidgeotto",	&I_pidgeotto,	0x96 },
+	{ "Pidgeot",	&I_pidgeot,	0x97 },
+	{ "Rattata",	&I_rattata,	0xA5 },
+	{ "Raticate",	&I_raticate,	0xA6 },
+	{ "Spearow",	&I_spearow,	0x05 },
+	{ "Fearow",	&I_fearow,	0x23 },
+	{ "Ekans",	&I_ekans,	0x6C },
+	{ "Arbok",	&I_arbok,	0x2D },
+	{ "Pikachu",	&I_pikachu,	0x54 },
+	{ "Raichu",	&I_raichu,	0x55 },
+	{ "Sandshrew",	&I_sandshrew,	0x60 },
+	{ "Sandslash",	&I_sandslash,	0x61 },
+	{ "Nidoran ♀",	&I_nidoranf,	0x0F },
+	{ "Nidorina",	&I_nidorina,	0xA8 },
+	{ "Nidoqueen",	&I_nidoqueen,	0x10 },
+	{ "Nidoran ♂",	&I_nidoranm,	0x03 },
+	{ "Nidorino",	&I_nidorino,	0xA7 },
+	{ "Nidoking",	&I_nidoking,	0x07 },
+	{ "Clefairy",	&I_clefairy,	0x04 },
+	{ "Clefable",	&I_clefable,	0x8E },
+	{ "Vulpix",	&I_vulpix,	0x52 },
+	{ "Ninetales",	&I_ninetales,	0x53 },
+	{ "Jigglypuff",	&I_jigglypuff,	0x64 },
+	{ "Wigglytuff",	&I_wigglytuff,	0x65 },
+	{ "Zubat",	&I_zubat,	0x6B },
+	{ "Golbat",	&I_golbat,	0x82 },
+	{ "Oddish",	&I_oddish,	0xB9 },
+	{ "Gloom",	&I_gloom,	0xBA },
+	{ "Vileplume",	&I_vileplume,	0xBB },
+	{ "Paras",	&I_paras,	0x6D },
+	{ "Parasect",	&I_parasect,	0x2E },
+	{ "Venonat",	&I_venonat,	0x41 },
+	{ "Venomoth",	&I_venomoth,	0x77 },
+	{ "Diglett",	&I_diglett,	0x3B },
+	{ "Dugtrio",	&I_dugtrio,	0x76 },
+	{ "Meowth",	&I_meowth,	0x4D },
+	{ "Persian",	&I_persian,	0x90 },
+	{ "Psyduck",	&I_psyduck,	0x2F },
+	{ "Golduck",	&I_golduck,	0x80 },
+	{ "Mankey",	&I_mankey,	0x39 },
+	{ "Primeape",	&I_primeape,	0x75 },
+	{ "Growlithe",	&I_growlithe,	0x21 },
+	{ "Arcanine",	&I_arcanine,	0x14 },
+	{ "Poliwag",	&I_poliwag,	0x47 },
+	{ "Poliwhirl",	&I_poliwhirl,	0x6E },
+	{ "Poliwrath",	&I_poliwrath,	0x6F },
+	{ "Abra",	&I_abra,	0x94 },
+	{ "Kadabra",	&I_kadabra,	0x26 },
+	{ "Alakazam",	&I_alakazam,	0x95 },
+	{ "Machop",	&I_machop,	0x6A },
+	{ "Machoke",	&I_machoke,	0x29 },
+	{ "Machamp",	&I_machamp,	0x7E },
+	{ "Bellsprout",	&I_bellsprout,	0xBC },
+	{ "Weepinbell",	&I_weepinbell,	0xBD },
+	{ "Victreebel",	&I_victreebel,	0xBE },
+	{ "Tentacool",	&I_tentacool,	0x18 },
+	{ "Tentacruel",	&I_tentacruel,	0x9B },
+	{ "Geodude",	&I_geodude,	0xA9 },
+	{ "Graveler",	&I_graveler,	0x27 },
+	{ "Golem",	&I_golem,	0x31 },
+	{ "Ponyta",	&I_ponyta,	0xA3 },
+	{ "Rapidash",	&I_rapidash,	0xA4 },
+	{ "Slowpoke",	&I_slowpoke,	0x25 },
+	{ "Slowbro",	&I_slowbro,	0x08 },
+	{ "Magnemite",	&I_magnemite,	0xAD },
+	{ "Magneton",	&I_magneton,	0x36 },
+	{ "Farfetch'd",	&I_farfetchd,	0x40 },
+	{ "Doduo",	&I_doduo,	0x46 },
+	{ "Dodrio",	&I_dodrio,	0x74 },
+	{ "Seel",	&I_seel,	0x3A },
+	{ "Dewgong",	&I_dewgong,	0x78 },
+	{ "Grimer",	&I_grimer,	0x0D },
+	{ "Muk",	&I_muk,	        0x88 },
+	{ "Shellder",	&I_shellder,	0x17 },
+	{ "Cloyster",	&I_cloyster,	0x8B },
+	{ "Gastly",	&I_gastly,	0x19 },
+	{ "Haunter",	&I_haunter,	0x93 },
+	{ "Gengar",	&I_gengar,	0x0E },
+	{ "Onix",	&I_onix,	0x22 },
+	{ "Drowzee",	&I_drowzee,	0x30 },
+	{ "Hypno",	&I_hypno,	0x81 },
+	{ "Krabby",	&I_krabby,	0x4E },
+	{ "Kingler",	&I_kingler,	0x8A },
+	{ "Voltorb",	&I_voltorb,	0x06 },
+	{ "Electrode",	&I_electrode,	0x8D },
+	{ "Exeggcute",	&I_exeggcute,	0x0C },
+	{ "Exeggutor",	&I_exeggutor,	0x0A },
+	{ "Cubone",	&I_cubone,	0x11 },
+	{ "Marowak",	&I_marowak,	0x91 },
+	{ "Hitmonlee",	&I_hitmonlee,	0x2B },
+	{ "Hitmonchan",	&I_hitmonchan,	0x2C },
+	{ "Lickitung",	&I_lickitung,	0x0B },
+	{ "Koffing",	&I_koffing,	0x37 },
+	{ "Weezing",	&I_weezing,	0x8F },
+	{ "Rhyhorn",	&I_rhyhorn,	0x12 },
+	{ "Rhydon",	&I_rhydon,	0x01 },
+	{ "Chansey",	&I_chansey,	0x28 },
+	{ "Tangela",	&I_tangela,	0x1E },
+	{ "Kangaskhan",	&I_kangaskhan,	0x02 },
+	{ "Horsea",	&I_horsea,	0x5C },
+	{ "Seadra",	&I_seadra,	0x5D },
+	{ "Goldeen",	&I_goldeen,	0x9D },
+	{ "Seaking",	&I_seaking,	0x9E },
+	{ "Staryu",	&I_staryu,	0x1B },
+	{ "Starmie",	&I_starmie,	0x98 },
+	{ "Mr. Mime",	&I_mr_mime,	0x2A },
+	{ "Scyther",	&I_scyther,	0x1A },
+	{ "Jynx",	&I_jynx,	0x48 },
+	{ "Electabuzz",	&I_electabuzz,	0x35 },
+	{ "Magmar",	&I_magmar,	0x33 },
+	{ "Pinsir",	&I_pinsir,	0x1D },
+	{ "Tauros",	&I_tauros,	0x3C },
+	{ "Magikarp",	&I_magikarp,	0x85 },
+	{ "Gyarados",	&I_gyarados,	0x16 },
+	{ "Lapras",	&I_lapras,	0x13 },
+	{ "Ditto",	&I_ditto,	0x4C },
+	{ "Eevee",	&I_eevee,	0x66 },
+	{ "Vaporeon",	&I_vaporeon,	0x69 },
+	{ "Jolteon",	&I_jolteon,	0x68 },
+	{ "Flareon",	&I_flareon,	0x67 },
+	{ "Porygon",	&I_porygon,	0xAA },
+	{ "Omanyte",	&I_omanyte,	0x62 },
+	{ "Omastar",	&I_omastar,	0x63 },
+	{ "Kabuto",	&I_kabuto,	0x5A },
+	{ "Kabutops",	&I_kabutops,	0x5B },
+	{ "Aerodactyl",	&I_aerodactyl,	0xAB },
+	{ "Snorlax",	&I_snorlax,	0x84 },
+	{ "Articuno",	&I_articuno,	0x4A },
+	{ "Zapdos",	&I_zapdos,	0x4B },
+	{ "Moltres",	&I_moltres,	0x49 },
+	{ "Dratini",	&I_dratini,	0x58 },
+	{ "Dragonair",	&I_dragonair,	0x59 },
+	{ "Dragonite",	&I_dragonite,	0x42 },
+	{ "Mewtwo",	&I_mewtwo,	0x83 },
+	{ "Mew",	&I_mew,	        0x15 },
+	{ },
+};
 
 uint32_t pokemon_exit_confirm_view(void* context) {
     UNUSED(context);

+ 8 - 4
pokemon_app.h

@@ -15,6 +15,12 @@
 
 #define TAG "Pokemon"
 
+struct pokemon_lut {
+	const char *name;
+	const Icon *icon;
+	const uint8_t hex;
+};
+
 typedef struct App App;
 typedef enum {
     GAMEBOY_INITIAL,
@@ -54,8 +60,6 @@ typedef struct SelectPokemonModel {
     void* callback_context;
 } SelectPokemonModel;
 
-extern const char* pokemon_names[];
-extern const Icon* pokemon_icons[];
-extern const unsigned char pokemon_hex_codes[];
+extern struct pokemon_lut pokemon_table[];
 
-#endif /* POKEMON_APP_H */
+#endif /* POKEMON_APP_H */

+ 312 - 32
pokemon_data.h

@@ -3,37 +3,317 @@
 
 #pragma once
 
-unsigned char INPUT_BLOCK[405];
-unsigned char DATA_BLOCK[405] = {
-    //  Flipper
-    //[        TRAINER NAME                 ]                              
-    0x85, 0xAB, 0xA8, 0xAF, 0xAF, 0xA4, 0xB1, 0x50, 0x00, 0x00, 0x00, 
-    //    [MEW]
-    0x1,  0x15, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 
-    // 6 pokemon
-    //spc curr  HP    lvl   sts   typ1  typ2  cr    mv1   mv2   mv3   mv4   OT   experience         HP EV       att EV      def EV      speed EV    Speci EV    IV          mvPP  mvPP  mvPP  mvPP  Lvl   max HP      attack      defense     speed       special
-    0x4A, 0x1,  0x2c, 0x4a, 0x00, 0x14, 0x08, 0x1F, 0x7E, 0x38, 0x09, 0x19, 0x4, 0xd2, 0x3,  0xd,   0x40, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xc0, 0xc0, 0xc0, 0x4a, 0x1,  0x2c, 0x0,  0x96, 0x0,  0x97, 0x0,  0x98, 0x0,  0x99, 
-    0x4A, 0x1,  0x2c, 0x4a, 0x00, 0x14, 0x08, 0x1F, 0x7E, 0x38, 0x09, 0x19, 0x4, 0xd2, 0x3,  0xd,   0x40, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xc0, 0xc0, 0xc0, 0x4a, 0x1,  0x2c, 0x0,  0x96, 0x0,  0x97, 0x0,  0x98, 0x0,  0x99, 
-    0x4A, 0x1,  0x2c, 0x4a, 0x00, 0x14, 0x08, 0x1F, 0x7E, 0x38, 0x09, 0x19, 0x4, 0xd2, 0x3,  0xd,   0x40, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xc0, 0xc0, 0xc0, 0x4a, 0x1,  0x2c, 0x0,  0x96, 0x0,  0x97, 0x0,  0x98, 0x0,  0x99, 
-    0x4A, 0x1,  0x2c, 0x4a, 0x00, 0x14, 0x08, 0x1F, 0x7E, 0x38, 0x09, 0x19, 0x4, 0xd2, 0x3,  0xd,   0x40, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xc0, 0xc0, 0xc0, 0x4a, 0x1,  0x2c, 0x0,  0x96, 0x0,  0x97, 0x0,  0x98, 0x0,  0x99, 
-    0x4A, 0x1,  0x2c, 0x4a, 0x00, 0x14, 0x08, 0x1F, 0x7E, 0x38, 0x09, 0x19, 0x4, 0xd2, 0x3,  0xd,   0x40, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xc0, 0xc0, 0xc0, 0x4a, 0x1,  0x2c, 0x0,  0x96, 0x0,  0x97, 0x0,  0x98, 0x0,  0x99, 
-    0x4A, 0x1,  0x2c, 0x4a, 0x00, 0x14, 0x08, 0x1F, 0x7E, 0x38, 0x09, 0x19, 0x4, 0xd2, 0x3,  0xd,   0x40, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xc0, 0xc0, 0xc0, 0x4a, 0x1,  0x2c, 0x0,  0x96, 0x0,  0x97, 0x0,  0x98, 0x0,  0x99, 
-    //  6 trainer names
-    0x85, 0xAB, 0xA8, 0xAF, 0xAF, 0xA4, 0xB1, 0x50, 0x00, 0x00, 0x00, 
-    0xFF, 0x50, 0x80, 0x92, 0x87, 0x50, 0x89, 0x80, 0x82,
-    0xFF, 0x50, 0x80, 0x92, 0x87, 0x50, 0x89, 0x80, 0x82,
-    0xFF, 0x50, 0x80, 0x92, 0x87, 0x50, 0x89, 0x80, 0x82,
-    0xFF, 0x50, 0x80, 0x92, 0x87, 0x50, 0x89, 0x80, 0x82,
-    0xFF, 0x50, 0x80, 0x92, 0x87, 0x50, 0x89, 0x80, 0x82,
-    // // 6 nicknames
-    0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 
-    0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 
-    0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 
-    0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 
-    0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 
-    0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50
-    // // 2 useless bytes??
-    // 0x00, 0x00, 0x00}
+/* NOTE: These map to the Gen 1 character set! */
+/* TODO: It may make more sense to put this in a const array as a LUT,
+ * e.g. t['F'], t['l'], t['i'], t['p'], t['e'], t['r'], t['\0']
+ * As this could be an easier translation for each letter to build a string
+ * to set names and things on the fly in the flipper. Need to explore that.
+ * once I get to that point.
+ */
+#define TERM_		0x50
+#define SPACE_		0x7f
+#define A_		0x80
+#define B_		0x81
+#define C_		0x82
+#define D_		0x83
+#define E_		0x84
+#define F_		0x85
+#define G_		0x86
+#define H_		0x87
+#define I_		0x88
+#define J_		0x89
+#define K_		0x8a
+#define L_		0x8b
+#define M_		0x8c
+#define N_		0x8d
+#define O_		0x8e
+#define P_		0x8f
+#define Q_		0x90
+#define R_		0x91
+#define S_		0x92
+#define T_		0x93
+#define U_		0x94
+#define V_		0x95
+#define W_		0x96
+#define X_		0x97
+#define Y_		0x98
+#define Z_		0x99
+#define O_PAREN_	0x9a
+#define C_PAREN_	0x9b
+#define COLON_		0x9c
+#define SEMI_		0x9d
+#define O_BRACKET_	0x9e
+#define C_BRACKET_	0x9f
+#define a_		0xa0
+#define b_		0xa1
+#define c_		0xa2
+#define d_		0xa3
+#define e_		0xa4
+#define f_		0xa5
+#define g_		0xa6
+#define h_		0xa7
+#define i_		0xa8
+#define j_		0xa9
+#define k_		0xaa
+#define l_		0xab
+#define m_		0xac
+#define n_		0xad
+#define o_		0xae
+#define p_		0xaf
+#define q_		0xb0
+#define r_		0xb1
+#define s_		0xb2
+#define t_		0xb3
+#define u_		0xb4
+#define v_		0xb5
+#define w_		0xb6
+#define x_		0xb7
+#define y_		0xb8
+#define z_		0xb9
+#define e_ACCENT_	0xba
+#define d_TICK_		0xbb
+#define l_TICK_		0xbc
+#define s_TICK_		0xbd
+#define t_TICK_		0xbe
+#define v_TICK_		0xbf
+#define S_QUOTE_	0xe0
+#define PK_		0xe1
+#define MN_		0xe2
+#define DASH_		0xe3
+#define r_TICK_		0xe4
+#define m_TICK_		0xe5
+#define QUESTION_	0xe6
+#define EXCLAIM_	0xe7
+#define PERIOD_		0xe8
+#define R_ARR_		0xec
+#define D_ARR_		0xee
+#define MALE_		0xef
+#define FEMALE_		0xf5
+#define _0_		0xf6
+#define _1_		0xf7
+#define _2_		0xf8
+#define _3_		0xf9
+#define _4_		0xfa
+#define _5_		0xfb
+#define _6_		0xfc
+#define _7_		0xfd
+#define _8_		0xfe
+#define _9_		0xff
+
+
+/* XXX: These are all opposite endianness on the flipper than they are in the
+ * GB/Z80. e.g. a uint16_t value of 0x2c01 translates to 0x012c. Does flipper
+ * API have calls to swap endianness?
+ */
+struct __attribute__((__packed__)) pokemon_structure {
+	uint8_t species;
+	uint16_t hp;
+	uint8_t level;
+	uint8_t status_condition;
+	uint8_t type[2];
+	uint8_t catch_held;
+	uint8_t move[4];
+	uint16_t orig_trainer;
+	uint8_t exp[3];
+	uint16_t hp_ev;
+	uint16_t atk_ev;
+	uint16_t def_ev;
+	uint16_t spd_ev;
+	uint16_t special_ev;
+	uint16_t iv;
+	uint8_t move_pp[4];
+	uint8_t level_again;
+	uint16_t max_hp;
+	uint16_t atk;
+	uint16_t def;
+	uint16_t spd;
+	uint16_t special;
+};
+
+struct __attribute__((__packed__)) name {
+	unsigned char str[11];
+};
+
+struct __attribute__((__packed__)) trade_data_block {
+	unsigned char trainer_name[11];
+	uint8_t party_cnt;
+	uint8_t party_members[7]; // Unsure if last byte always needs to be 0xff for terminator
+	struct pokemon_structure party[6];
+	struct name ot_name[6];
+	struct name nickname[6];
+};
+
+struct trade_data_block DATA_BLOCK2 = {
+	.trainer_name = { F_, l_, i_, p_, p_, e_, r_, TERM_, 0x00, 0x00, 0x00 },
+	.party_cnt = 1,
+	.party_members = { 0x15, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
+	.party = {
+		{
+			.species = 0x4a,
+			.hp = 0x2c01,
+			.level = 0x4a,
+			.status_condition = 0x0,
+			.type = { 0x14, 0x08 },
+			.catch_held = 0x1f,
+			.move = { 0x7e, 0x38, 0x09, 0x19 },
+			.orig_trainer = 0xd204,
+			.exp = { 0x3, 0xd, 0x40 },
+			.hp_ev = 0xffff,
+			.atk_ev = 0xffff,
+			.def_ev = 0xffff,
+			.spd_ev = 0xffff,
+			.special_ev = 0xffff,
+			.iv = 0xffff,
+			.move_pp = { 0xc0, 0xc0, 0xc0, 0xc0 },
+			.level_again = 0x4a,
+			.max_hp = 0x2c01,
+			.atk = 0x9600,
+			.def = 0x9700,
+			.spd = 0x9800,
+			.special = 0x9900
+		},
+		{
+			.species = 0x4a,
+			.hp = 0x2c01,
+			.level = 0x4a,
+			.status_condition = 0x0,
+			.type = { 0x14, 0x08 },
+			.catch_held = 0x1f,
+			.move = { 0x7e, 0x38, 0x09, 0x19 },
+			.orig_trainer = 0xd204,
+			.exp = { 0x3, 0xd, 0x40 },
+			.hp_ev = 0xffff,
+			.atk_ev = 0xffff,
+			.def_ev = 0xffff,
+			.spd_ev = 0xffff,
+			.special_ev = 0xffff,
+			.iv = 0xffff,
+			.move_pp = { 0xc0, 0xc0, 0xc0, 0xc0 },
+			.level_again = 0x4a,
+			.max_hp = 0x2c01,
+			.atk = 0x9600,
+			.def = 0x9700,
+			.spd = 0x9800,
+			.special = 0x9900
+		},
+		{
+			.species = 0x4a,
+			.hp = 0x2c01,
+			.level = 0x4a,
+			.status_condition = 0x0,
+			.type = { 0x14, 0x08 },
+			.catch_held = 0x1f,
+			.move = { 0x7e, 0x38, 0x09, 0x19 },
+			.orig_trainer = 0xd204,
+			.exp = { 0x3, 0xd, 0x40 },
+			.hp_ev = 0xffff,
+			.atk_ev = 0xffff,
+			.def_ev = 0xffff,
+			.spd_ev = 0xffff,
+			.special_ev = 0xffff,
+			.iv = 0xffff,
+			.move_pp = { 0xc0, 0xc0, 0xc0, 0xc0 },
+			.level_again = 0x4a,
+			.max_hp = 0x2c01,
+			.atk = 0x9600,
+			.def = 0x9700,
+			.spd = 0x9800,
+			.special = 0x9900
+		},
+		{
+			.species = 0x4a,
+			.hp = 0x2c01,
+			.level = 0x4a,
+			.status_condition = 0x0,
+			.type = { 0x14, 0x08 },
+			.catch_held = 0x1f,
+			.move = { 0x7e, 0x38, 0x09, 0x19 },
+			.orig_trainer = 0xd204,
+			.exp = { 0x3, 0xd, 0x40 },
+			.hp_ev = 0xffff,
+			.atk_ev = 0xffff,
+			.def_ev = 0xffff,
+			.spd_ev = 0xffff,
+			.special_ev = 0xffff,
+			.iv = 0xffff,
+			.move_pp = { 0xc0, 0xc0, 0xc0, 0xc0 },
+			.level_again = 0x4a,
+			.max_hp = 0x2c01,
+			.atk = 0x9600,
+			.def = 0x9700,
+			.spd = 0x9800,
+			.special = 0x9900
+		},
+		{
+			.species = 0x4a,
+			.hp = 0x2c01,
+			.level = 0x4a,
+			.status_condition = 0x0,
+			.type = { 0x14, 0x08 },
+			.catch_held = 0x1f,
+			.move = { 0x7e, 0x38, 0x09, 0x19 },
+			.orig_trainer = 0xd204,
+			.exp = { 0x3, 0xd, 0x40 },
+			.hp_ev = 0xffff,
+			.atk_ev = 0xffff,
+			.def_ev = 0xffff,
+			.spd_ev = 0xffff,
+			.special_ev = 0xffff,
+			.iv = 0xffff,
+			.move_pp = { 0xc0, 0xc0, 0xc0, 0xc0 },
+			.level_again = 0x4a,
+			.max_hp = 0x2c01,
+			.atk = 0x9600,
+			.def = 0x9700,
+			.spd = 0x9800,
+			.special = 0x9900
+		},
+		{
+			.species = 0x4a,
+			.hp = 0x2c01,
+			.level = 0x4a,
+			.status_condition = 0x0,
+			.type = { 0x14, 0x08 },
+			.catch_held = 0x1f,
+			.move = { 0x7e, 0x38, 0x09, 0x19 },
+			.orig_trainer = 0xd204,
+			.exp = { 0x3, 0xd, 0x40 },
+			.hp_ev = 0xffff,
+			.atk_ev = 0xffff,
+			.def_ev = 0xffff,
+			.spd_ev = 0xffff,
+			.special_ev = 0xffff,
+			.iv = 0xffff,
+			.move_pp = { 0xc0, 0xc0, 0xc0, 0xc0 },
+			.level_again = 0x4a,
+			.max_hp = 0x2c01,
+			.atk = 0x9600,
+			.def = 0x9700,
+			.spd = 0x9800,
+			.special = 0x9900
+		},
+	},
+	/* NOTE: I think this shouldn't exceed 7 chars */
+	.ot_name = {
+		{ .str = { F_, l_, i_, p_, p_, e_, r_, TERM_, 0x00, 0x00 } },
+		{ .str = { F_, l_, i_, p_, p_, e_, r_, TERM_, 0x00, 0x00 } },
+		{ .str = { F_, l_, i_, p_, p_, e_, r_, TERM_, 0x00, 0x00 } },
+		{ .str = { F_, l_, i_, p_, p_, e_, r_, TERM_, 0x00, 0x00 } },
+		{ .str = { F_, l_, i_, p_, p_, e_, r_, TERM_, 0x00, 0x00 } },
+		{ .str = { F_, l_, i_, p_, p_, e_, r_, TERM_, 0x00, 0x00 } },
+	},
+	.nickname = {
+		{ .str = { F_, l_, o_, p_, p_, e_, r_, TERM_, 0x00, 0x00 } },
+		{ .str = { F_, l_, o_, p_, p_, e_, r_, TERM_, 0x00, 0x00 } },
+		{ .str = { F_, l_, o_, p_, p_, e_, r_, TERM_, 0x00, 0x00 } },
+		{ .str = { F_, l_, o_, p_, p_, e_, r_, TERM_, 0x00, 0x00 } },
+		{ .str = { F_, l_, o_, p_, p_, e_, r_, TERM_, 0x00, 0x00 } },
+		{ .str = { F_, l_, o_, p_, p_, e_, r_, TERM_, 0x00, 0x00 } },
+	}
 };
 
-#endif /* POKEMON_DATA_H */
+
+unsigned char INPUT_BLOCK[405];
+unsigned char *DATA_BLOCK = (unsigned char *)&DATA_BLOCK2;
+
+#endif /* POKEMON_DATA_H */

+ 9 - 11
views/select_pokemon.cpp

@@ -5,10 +5,10 @@ static void select_pokemon_render_callback(Canvas* canvas, void* context) {
     canvas_clear(canvas);
 
     SelectPokemonModel* model = (SelectPokemonModel*)context;
-    const int current_index = model->current_pokemon;
-    const char* current_name = pokemon_names[current_index];
-    char hex_str[5];
-    snprintf(hex_str, sizeof(hex_str), "0x%02X", pokemon_hex_codes[current_index]);
+    const uint8_t current_index = model->current_pokemon;
+    char pokedex_num[5];
+
+    snprintf(pokedex_num, sizeof(pokedex_num), "#%03d", current_index+1);
     canvas_set_font(canvas, FontPrimary);
     canvas_draw_str_aligned(
         canvas,
@@ -16,18 +16,16 @@ static void select_pokemon_render_callback(Canvas* canvas, void* context) {
         54 / 2,
         AlignLeft,
         AlignTop,
-        ("#" + std::to_string(current_index + 1) + " " + current_name).c_str());
+	pokemon_table[current_index].name);
 
     canvas_set_font(canvas, FontSecondary);
-    canvas_draw_str_aligned(canvas, 55, 37, AlignLeft, AlignTop, hex_str);
-    canvas_draw_icon(canvas, 0, 0, pokemon_icons[current_index]);
+    canvas_draw_str_aligned(canvas, 55, 38, AlignLeft, AlignTop, pokedex_num);
+    canvas_draw_icon(canvas, 0, 0, pokemon_table[current_index].icon);
     canvas_draw_icon(canvas, 128 - 80, 0, &I_Space_80x18);
     canvas_draw_str_aligned(canvas, (128 - 40), 5, AlignCenter, AlignTop, "Select Pokemon");
 
     canvas_set_font(canvas, FontPrimary);
-    elements_button_left(canvas, "Prev");
     elements_button_center(canvas, "OK");
-    elements_button_right(canvas, "Next");
 }
 
 static bool select_pokemon_input_callback(InputEvent* event, void* context) {
@@ -42,7 +40,7 @@ static bool select_pokemon_input_callback(InputEvent* event, void* context) {
             model,
             {
                 select_pokemon->app->current_pokemon = model->current_pokemon;
-                select_pokemon->app->pokemon_hex_code = pokemon_hex_codes[model->current_pokemon];
+                select_pokemon->app->pokemon_hex_code = pokemon_table[model->current_pokemon].hex;
             },
             false);
         view_dispatcher_switch_to_view(select_pokemon->app->view_dispatcher, AppViewTrade);
@@ -164,4 +162,4 @@ void select_pokemon_free(App* app) {
 View* select_pokemon_get_view(App* app) {
     furi_assert(app->select_pokemon);
     return app->select_pokemon->view;
-}
+}

+ 1 - 1
views/trade.cpp

@@ -60,7 +60,7 @@ static void trade_draw_callback(Canvas* canvas, void* context) {
         } else if(
             model->gameboy_status == GAMEBOY_READY || model->gameboy_status == GAMEBOY_WAITING ||
             model->gameboy_status == GAMEBOY_SEND) {
-            canvas_draw_icon(canvas, 38, 11, pokemon_icons[model->current_pokemon]);
+            canvas_draw_icon(canvas, 38, 11, pokemon_table[model->current_pokemon].icon);
         }
         canvas_draw_icon(canvas, 0, 53, &I_Background_128x11);
 

+ 2 - 2
views/trade.hpp

@@ -67,6 +67,6 @@ void trade_free(App* app);
 View* trade_get_view(App* app);
 
 extern unsigned char INPUT_BLOCK[405];
-extern unsigned char DATA_BLOCK[405];
+extern unsigned char *DATA_BLOCK;
 
-#endif /* TRADE_HPP */
+#endif /* TRADE_HPP */