Explorar el Código

scenes: Cleanup/refactor

Now using the existing Flipper paradigm for specifying scenes
view macro hell. It will add some ballooned code since exit/event
scenes can no longer be generic/repeated, but should make overall
scene handling less convoluted and should be easier to approach
for new players.

Signed-off-by: Kris Bahnsen <Kris@KBEmbedded.com>
Kris Bahnsen hace 1 año
padre
commit
8a0c3487f9

+ 4 - 2
src/pokemon_app.c

@@ -8,6 +8,8 @@
 #include <src/views/select_pokemon.h>
 #include <src/views/select_pokemon.h>
 #include <src/include/pokemon_char_encode.h>
 #include <src/include/pokemon_char_encode.h>
 
 
+#include <src/scenes/pokemon_scene.h>
+
 PokemonFap* pokemon_alloc() {
 PokemonFap* pokemon_alloc() {
     PokemonFap* pokemon_fap = (PokemonFap*)malloc(sizeof(PokemonFap));
     PokemonFap* pokemon_fap = (PokemonFap*)malloc(sizeof(PokemonFap));
 
 
@@ -40,10 +42,10 @@ PokemonFap* pokemon_alloc() {
     pokemon_fap->dialog_ex = dialog_ex_alloc();
     pokemon_fap->dialog_ex = dialog_ex_alloc();
 
 
     // Set up menu scene
     // Set up menu scene
-    pokemon_fap->scene_manager = scene_manager_alloc(&pokemon_scene_manager_handlers, pokemon_fap);
+    pokemon_fap->scene_manager = scene_manager_alloc(&pokemon_scene_handlers, pokemon_fap);
     view_dispatcher_add_view(
     view_dispatcher_add_view(
         pokemon_fap->view_dispatcher, AppViewMainMenu, submenu_get_view(pokemon_fap->submenu));
         pokemon_fap->view_dispatcher, AppViewMainMenu, submenu_get_view(pokemon_fap->submenu));
-    scene_manager_next_scene(pokemon_fap->scene_manager, MainMenuScene);
+    scene_manager_next_scene(pokemon_fap->scene_manager, PokemonSceneMainMenu);
 
 
     return pokemon_fap;
     return pokemon_fap;
 }
 }

+ 17 - 8
src/scenes/pokemon_exit_confirm.c

@@ -1,26 +1,27 @@
 #include <gui/modules/dialog_ex.h>
 #include <gui/modules/dialog_ex.h>
 
 
 #include <pokemon_icons.h>
 #include <pokemon_icons.h>
-#include <src/scenes/pokemon_menu.h>
 #include <src/include/pokemon_app.h>
 #include <src/include/pokemon_app.h>
 #include <src/include/pokemon_data.h>
 #include <src/include/pokemon_data.h>
 
 
+#include <src/scenes/pokemon_scene.h>
+
 #include <src/views/select_pokemon.h>
 #include <src/views/select_pokemon.h>
 #include <src/views/trade.h>
 #include <src/views/trade.h>
 
 
-static bool pokemon_exit_confirm_back_event_callback(void* context) {
+static bool pokemon_scene_exit_confirm_back_event_callback(void* context) {
     UNUSED(context);
     UNUSED(context);
 
 
     return true;
     return true;
 }
 }
 
 
-void pokemon_exit_confirm_dialog_callback(DialogExResult result, void* context) {
+static void pokemon_scene_exit_confirm_dialog_callback(DialogExResult result, void* context) {
     PokemonFap* pokemon_fap = context;
     PokemonFap* pokemon_fap = context;
 
 
     scene_manager_handle_custom_event(pokemon_fap->scene_manager, result);
     scene_manager_handle_custom_event(pokemon_fap->scene_manager, result);
 }
 }
 
 
-void pokemon_exit_confirm_on_enter(void* context) {
+void pokemon_scene_exit_confirm_on_enter(void* context) {
     PokemonFap* pokemon_fap = context;
     PokemonFap* pokemon_fap = context;
     DialogEx* dialog_ex = pokemon_fap->dialog_ex;
     DialogEx* dialog_ex = pokemon_fap->dialog_ex;
 
 
@@ -39,21 +40,21 @@ void pokemon_exit_confirm_on_enter(void* context) {
         AlignTop);
         AlignTop);
     dialog_ex_set_icon(dialog_ex, 44, 32, &I_surprised_pika);
     dialog_ex_set_icon(dialog_ex, 44, 32, &I_surprised_pika);
     dialog_ex_set_context(dialog_ex, pokemon_fap);
     dialog_ex_set_context(dialog_ex, pokemon_fap);
-    dialog_ex_set_result_callback(dialog_ex, pokemon_exit_confirm_dialog_callback);
+    dialog_ex_set_result_callback(dialog_ex, pokemon_scene_exit_confirm_dialog_callback);
 
 
     /* Disable the existing navigation event handler to prevent handling further
     /* Disable the existing navigation event handler to prevent handling further
      * back events. Going back to the main menu as well as going back to the
      * back events. Going back to the main menu as well as going back to the
      * gen menu will re-enable the proper navigation handler.
      * gen menu will re-enable the proper navigation handler.
      */
      */
     view_dispatcher_set_navigation_event_callback(
     view_dispatcher_set_navigation_event_callback(
-        pokemon_fap->view_dispatcher, pokemon_exit_confirm_back_event_callback);
+        pokemon_fap->view_dispatcher, pokemon_scene_exit_confirm_back_event_callback);
 
 
     view_dispatcher_add_view(
     view_dispatcher_add_view(
         pokemon_fap->view_dispatcher, AppViewOpts, dialog_ex_get_view(pokemon_fap->dialog_ex));
         pokemon_fap->view_dispatcher, AppViewOpts, dialog_ex_get_view(pokemon_fap->dialog_ex));
     view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewOpts);
     view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewOpts);
 }
 }
 
 
-bool pokemon_exit_confirm_on_event(void* context, SceneManagerEvent event) {
+bool pokemon_scene_exit_confirm_on_event(void* context, SceneManagerEvent event) {
     PokemonFap* pokemon_fap = context;
     PokemonFap* pokemon_fap = context;
     bool consumed = false;
     bool consumed = false;
 
 
@@ -62,7 +63,7 @@ bool pokemon_exit_confirm_on_event(void* context, SceneManagerEvent event) {
             consumed = scene_manager_previous_scene(pokemon_fap->scene_manager);
             consumed = scene_manager_previous_scene(pokemon_fap->scene_manager);
         } else if(event.event == DialogExResultLeft) {
         } else if(event.event == DialogExResultLeft) {
             consumed = scene_manager_search_and_switch_to_previous_scene(
             consumed = scene_manager_search_and_switch_to_previous_scene(
-                pokemon_fap->scene_manager, MainMenuScene);
+                pokemon_fap->scene_manager, PokemonSceneMainMenu);
             /* NOTE: The above should never fail */
             /* NOTE: The above should never fail */
             furi_check(consumed);
             furi_check(consumed);
 
 
@@ -88,3 +89,11 @@ bool pokemon_exit_confirm_on_event(void* context, SceneManagerEvent event) {
 
 
     return consumed;
     return consumed;
 }
 }
+
+void pokemon_scene_exit_confirm_on_exit(void* context) {
+    PokemonFap* pokemon_fap = (PokemonFap*)context;
+
+    view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewMainMenu);
+    view_dispatcher_remove_view(pokemon_fap->view_dispatcher, AppViewOpts);
+}
+

+ 0 - 15
src/scenes/pokemon_exit_confirm.h

@@ -1,15 +0,0 @@
-#ifndef POKEMON_EXIT_CONFIRM_H
-#define POKEMON_EXIT_CONFIRM_H
-
-#pragma once
-
-#include <gui/modules/dialog_ex.h>
-#include <gui/scene_manager.h>
-
-void pokemon_exit_confirm_dialog_callback(DialogExResult result, void* context);
-
-void pokemon_exit_confirm_on_enter(void* context);
-
-bool pokemon_exit_confirm_on_event(void* context, SceneManagerEvent event);
-
-#endif // POKEMON_EXIT_CONFIRM_H

+ 45 - 34
src/scenes/pokemon_gen.c

@@ -7,8 +7,9 @@
 #include <src/views/trade.h>
 #include <src/views/trade.h>
 #include <src/views/select_pokemon.h>
 #include <src/views/select_pokemon.h>
 
 
+#include <src/scenes/pokemon_scene.h>
+
 #include <src/scenes/pokemon_menu.h>
 #include <src/scenes/pokemon_menu.h>
-#include <src/scenes/pokemon_stats.h>
 #include <src/scenes/pokemon_shiny.h>
 #include <src/scenes/pokemon_shiny.h>
 #include <src/scenes/pokemon_gender.h>
 #include <src/scenes/pokemon_gender.h>
 #include <src/scenes/pokemon_pokerus.h>
 #include <src/scenes/pokemon_pokerus.h>
@@ -19,16 +20,16 @@ static void scene_change_from_main_cb(void* context, uint32_t index) {
 
 
     /* Reuse of scenes to allow for using the same functions to set names */
     /* Reuse of scenes to allow for using the same functions to set names */
     switch(index) {
     switch(index) {
-    case SelectNicknameScene:
-    case SelectOTNameScene:
-    case SelectUnownFormScene:
-        scene_manager_set_scene_state(pokemon_fap->scene_manager, SelectNicknameScene, index);
+    case PokemonSceneNickname:
+    case PokemonSceneOTName:
+    case PokemonSceneUnownForm:
+        scene_manager_set_scene_state(pokemon_fap->scene_manager, PokemonSceneNickname, index);
         break;
         break;
-    case SelectLevelScene:
-    case SelectOTIDScene:
-        scene_manager_set_scene_state(pokemon_fap->scene_manager, SelectLevelScene, index);
+    case PokemonSceneLevel:
+    case PokemonSceneOTID:
+        scene_manager_set_scene_state(pokemon_fap->scene_manager, PokemonSceneLevel, index);
         break;
         break;
-    case SelectGenderScene:
+    case PokemonSceneGender:
         if(select_gender_is_static(
         if(select_gender_is_static(
                pokemon_fap->pdata,
                pokemon_fap->pdata,
                table_stat_base_get(
                table_stat_base_get(
@@ -50,7 +51,7 @@ static void scene_change_from_main_cb(void* context, uint32_t index) {
     /* Set scene state to the current index so we can have that element highlighted when
     /* Set scene state to the current index so we can have that element highlighted when
      * we return.
      * we return.
      */
      */
-    scene_manager_set_scene_state(pokemon_fap->scene_manager, GenITradeScene, index);
+    scene_manager_set_scene_state(pokemon_fap->scene_manager, PokemonSceneGenITrade, index);
     scene_manager_next_scene(pokemon_fap->scene_manager, index);
     scene_manager_next_scene(pokemon_fap->scene_manager, index);
 }
 }
 
 
@@ -58,11 +59,11 @@ bool gen_back_event_callback(void* context) {
     furi_assert(context);
     furi_assert(context);
     PokemonFap* pokemon_fap = context;
     PokemonFap* pokemon_fap = context;
 
 
-    scene_manager_next_scene(pokemon_fap->scene_manager, ConfirmExitScene);
+    scene_manager_next_scene(pokemon_fap->scene_manager, PokemonSceneExitConfirm);
     return true;
     return true;
 }
 }
 
 
-void gen_scene_on_enter(void* context) {
+void pokemon_scene_gen_on_enter(void* context) {
     char buf[32];
     char buf[32];
     char name_buf[11]; // All name buffers are 11 bytes at most, including term
     char name_buf[11]; // All name buffers are 11 bytes at most, including term
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
@@ -71,12 +72,12 @@ void gen_scene_on_enter(void* context) {
 
 
     // Set up trade party struct
     // Set up trade party struct
     if(!pokemon_fap->pdata) {
     if(!pokemon_fap->pdata) {
-        state = scene_manager_get_scene_state(pokemon_fap->scene_manager, GenITradeScene);
+        state = scene_manager_get_scene_state(pokemon_fap->scene_manager, PokemonSceneGenITrade);
         switch(state) {
         switch(state) {
-        case GenITradeScene:
+        case PokemonSceneGenITrade:
             state = GEN_I;
             state = GEN_I;
             break;
             break;
-        case GenIITradeScene:
+        case PokemonSceneGenIITrade:
             state = GEN_II;
             state = GEN_II;
             break;
             break;
         default:
         default:
@@ -88,7 +89,7 @@ void gen_scene_on_enter(void* context) {
         /* Clear the scene state as this is the first entry in to this scene
         /* Clear the scene state as this is the first entry in to this scene
 	 * we definitely want to be completely reset.
 	 * we definitely want to be completely reset.
 	 */
 	 */
-        scene_manager_set_scene_state(pokemon_fap->scene_manager, GenITradeScene, 0);
+        scene_manager_set_scene_state(pokemon_fap->scene_manager, PokemonSceneGenITrade, 0);
 
 
         /* Allocate select and trade views */
         /* Allocate select and trade views */
         /* Allocates its own view and adds it to the main view_dispatcher */
         /* Allocates its own view and adds it to the main view_dispatcher */
@@ -112,8 +113,8 @@ void gen_scene_on_enter(void* context) {
      * which is fine but would just waste a few more bytes compared to us handling
      * which is fine but would just waste a few more bytes compared to us handling
      * it here.
      * it here.
      */
      */
-    scene_manager_set_scene_state(pokemon_fap->scene_manager, SelectMoveScene, 0);
-    scene_manager_set_scene_state(pokemon_fap->scene_manager, SelectItemSetScene, 0);
+    scene_manager_set_scene_state(pokemon_fap->scene_manager, PokemonSceneMove, 0);
+    scene_manager_set_scene_state(pokemon_fap->scene_manager, PokemonSceneItemSet, 0);
 
 
     submenu_reset(pokemon_fap->submenu);
     submenu_reset(pokemon_fap->submenu);
 
 
@@ -123,12 +124,12 @@ void gen_scene_on_enter(void* context) {
         "Pokemon:   %s",
         "Pokemon:   %s",
         table_stat_name_get(pokemon_fap->pdata->pokemon_table, pkmn_num));
         table_stat_name_get(pokemon_fap->pdata->pokemon_table, pkmn_num));
     submenu_add_item(
     submenu_add_item(
-        pokemon_fap->submenu, buf, SelectPokemonScene, scene_change_from_main_cb, pokemon_fap);
+        pokemon_fap->submenu, buf, PokemonSceneSelect, scene_change_from_main_cb, pokemon_fap);
 
 
     pokemon_name_get(pokemon_fap->pdata, STAT_NICKNAME, name_buf, sizeof(name_buf));
     pokemon_name_get(pokemon_fap->pdata, STAT_NICKNAME, name_buf, sizeof(name_buf));
     snprintf(buf, sizeof(buf), "Nickname:  %s", name_buf);
     snprintf(buf, sizeof(buf), "Nickname:  %s", name_buf);
     submenu_add_item(
     submenu_add_item(
-        pokemon_fap->submenu, buf, SelectNicknameScene, scene_change_from_main_cb, pokemon_fap);
+        pokemon_fap->submenu, buf, PokemonSceneNickname, scene_change_from_main_cb, pokemon_fap);
 
 
     snprintf(
     snprintf(
         buf,
         buf,
@@ -136,7 +137,7 @@ void gen_scene_on_enter(void* context) {
         "Level:           %d",
         "Level:           %d",
         pokemon_stat_get(pokemon_fap->pdata, STAT_LEVEL, NONE));
         pokemon_stat_get(pokemon_fap->pdata, STAT_LEVEL, NONE));
     submenu_add_item(
     submenu_add_item(
-        pokemon_fap->submenu, buf, SelectLevelScene, scene_change_from_main_cb, pokemon_fap);
+        pokemon_fap->submenu, buf, PokemonSceneLevel, scene_change_from_main_cb, pokemon_fap);
 
 
     if(pokemon_fap->pdata->gen == GEN_II) {
     if(pokemon_fap->pdata->gen == GEN_II) {
         snprintf(
         snprintf(
@@ -147,13 +148,13 @@ void gen_scene_on_enter(void* context) {
                 pokemon_fap->pdata->item_list,
                 pokemon_fap->pdata->item_list,
                 pokemon_stat_get(pokemon_fap->pdata, STAT_HELD_ITEM, NONE)));
                 pokemon_stat_get(pokemon_fap->pdata, STAT_HELD_ITEM, NONE)));
         submenu_add_item(
         submenu_add_item(
-            pokemon_fap->submenu, buf, SelectItemScene, scene_change_from_main_cb, pokemon_fap);
+            pokemon_fap->submenu, buf, PokemonSceneItem, scene_change_from_main_cb, pokemon_fap);
     }
     }
 
 
     submenu_add_item(
     submenu_add_item(
         pokemon_fap->submenu,
         pokemon_fap->submenu,
         "Select Moves",
         "Select Moves",
-        SelectMoveScene,
+        PokemonSceneMove,
         scene_change_from_main_cb,
         scene_change_from_main_cb,
         pokemon_fap);
         pokemon_fap);
 
 
@@ -161,7 +162,7 @@ void gen_scene_on_enter(void* context) {
         submenu_add_item(
         submenu_add_item(
             pokemon_fap->submenu,
             pokemon_fap->submenu,
             "Select Types",
             "Select Types",
-            SelectTypeScene,
+            PokemonSceneType,
             scene_change_from_main_cb,
             scene_change_from_main_cb,
             pokemon_fap);
             pokemon_fap);
     }
     }
@@ -170,7 +171,7 @@ void gen_scene_on_enter(void* context) {
         pokemon_fap->submenu,
         pokemon_fap->submenu,
         namedlist_name_get_index(
         namedlist_name_get_index(
             pokemon_fap->pdata->stat_list, pokemon_stat_get(pokemon_fap->pdata, STAT_SEL, NONE)),
             pokemon_fap->pdata->stat_list, pokemon_stat_get(pokemon_fap->pdata, STAT_SEL, NONE)),
-        SelectStatsScene,
+        PokemonSceneStats,
         scene_change_from_main_cb,
         scene_change_from_main_cb,
         pokemon_fap);
         pokemon_fap);
 
 
@@ -181,22 +182,22 @@ void gen_scene_on_enter(void* context) {
             "Shiny:             %s",
             "Shiny:             %s",
             select_shiny_is_shiny(pokemon_fap->pdata) ? "Yes" : "No");
             select_shiny_is_shiny(pokemon_fap->pdata) ? "Yes" : "No");
         submenu_add_item(
         submenu_add_item(
-            pokemon_fap->submenu, buf, SelectShinyScene, scene_change_from_main_cb, pokemon_fap);
+            pokemon_fap->submenu, buf, PokemonSceneShiny, scene_change_from_main_cb, pokemon_fap);
 
 
         snprintf(buf, sizeof(buf), "Gender:         %s", select_gender_get(pokemon_fap->pdata));
         snprintf(buf, sizeof(buf), "Gender:         %s", select_gender_get(pokemon_fap->pdata));
         submenu_add_item(
         submenu_add_item(
-            pokemon_fap->submenu, buf, SelectGenderScene, scene_change_from_main_cb, pokemon_fap);
+            pokemon_fap->submenu, buf, PokemonSceneGender, scene_change_from_main_cb, pokemon_fap);
 
 
         snprintf(buf, sizeof(buf), "Pokerus:       %s", select_pokerus_status(pokemon_fap));
         snprintf(buf, sizeof(buf), "Pokerus:       %s", select_pokerus_status(pokemon_fap));
         submenu_add_item(
         submenu_add_item(
-            pokemon_fap->submenu, buf, SelectPokerusScene, scene_change_from_main_cb, pokemon_fap);
+            pokemon_fap->submenu, buf, PokemonScenePokerus, scene_change_from_main_cb, pokemon_fap);
 
 
         if(pokemon_stat_get(pokemon_fap->pdata, STAT_NUM, NONE) == 0xC8) { // Unown
         if(pokemon_stat_get(pokemon_fap->pdata, STAT_NUM, NONE) == 0xC8) { // Unown
             snprintf(buf, sizeof(buf), "Unown Form: %c", unown_form_get(pokemon_fap->pdata));
             snprintf(buf, sizeof(buf), "Unown Form: %c", unown_form_get(pokemon_fap->pdata));
             submenu_add_item(
             submenu_add_item(
                 pokemon_fap->submenu,
                 pokemon_fap->submenu,
                 buf,
                 buf,
-                SelectUnownFormScene,
+                PokemonSceneUnownForm,
                 scene_change_from_main_cb,
                 scene_change_from_main_cb,
                 pokemon_fap);
                 pokemon_fap);
         }
         }
@@ -208,25 +209,35 @@ void gen_scene_on_enter(void* context) {
         "OT ID#:          %05d",
         "OT ID#:          %05d",
         pokemon_stat_get(pokemon_fap->pdata, STAT_OT_ID, NONE));
         pokemon_stat_get(pokemon_fap->pdata, STAT_OT_ID, NONE));
     submenu_add_item(
     submenu_add_item(
-        pokemon_fap->submenu, buf, SelectOTIDScene, scene_change_from_main_cb, pokemon_fap);
+        pokemon_fap->submenu, buf, PokemonSceneOTID, scene_change_from_main_cb, pokemon_fap);
 
 
     pokemon_name_get(pokemon_fap->pdata, STAT_OT_NAME, name_buf, sizeof(name_buf));
     pokemon_name_get(pokemon_fap->pdata, STAT_OT_NAME, name_buf, sizeof(name_buf));
     snprintf(buf, sizeof(buf), "OT Name:      %s", name_buf);
     snprintf(buf, sizeof(buf), "OT Name:      %s", name_buf);
     submenu_add_item(
     submenu_add_item(
-        pokemon_fap->submenu, buf, SelectOTNameScene, scene_change_from_main_cb, pokemon_fap);
+        pokemon_fap->submenu, buf, PokemonSceneOTName, scene_change_from_main_cb, pokemon_fap);
 
 
     submenu_add_item(
     submenu_add_item(
-        pokemon_fap->submenu, "Trade PKMN", TradeScene, scene_change_from_main_cb, pokemon_fap);
+        pokemon_fap->submenu, "Trade PKMN", PokemonSceneTrade, scene_change_from_main_cb, pokemon_fap);
 
 
     /* TODO: Add Save pokemon option here */
     /* TODO: Add Save pokemon option here */
 
 
-    /* HACK: No matter what gen were in, we just store the scene state in GenITradeScene */
+    /* HACK: No matter what gen were in, we just store the scene state in PokemonSceneGenITrade */
     submenu_set_selected_item(
     submenu_set_selected_item(
         pokemon_fap->submenu,
         pokemon_fap->submenu,
-        scene_manager_get_scene_state(pokemon_fap->scene_manager, GenITradeScene));
+        scene_manager_get_scene_state(pokemon_fap->scene_manager, PokemonSceneGenITrade));
 
 
     view_dispatcher_set_navigation_event_callback(
     view_dispatcher_set_navigation_event_callback(
         pokemon_fap->view_dispatcher, gen_back_event_callback);
         pokemon_fap->view_dispatcher, gen_back_event_callback);
 
 
     view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewMainMenu);
     view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewMainMenu);
 }
 }
+
+bool pokemon_scene_gen_on_event(void* context, SceneManagerEvent event) {
+    UNUSED(context);
+    UNUSED(event);
+    return false;
+}
+
+void pokemon_scene_gen_on_exit(void* context) {
+    UNUSED(context);
+}

+ 0 - 8
src/scenes/pokemon_gen.h

@@ -1,8 +0,0 @@
-#ifndef POKEMON_GEN_H
-#define POKEMON_GEN_H
-
-#pragma once
-
-void gen_scene_on_enter(void* context);
-
-#endif // POKEMON_GEN_H

+ 15 - 2
src/scenes/pokemon_gender.c

@@ -2,7 +2,8 @@
 
 
 #include <src/include/pokemon_app.h>
 #include <src/include/pokemon_app.h>
 #include <src/include/pokemon_data.h>
 #include <src/include/pokemon_data.h>
-#include <src/scenes/pokemon_menu.h>
+
+#include <src/scenes/pokemon_scene.h>
 
 
 static const char* gender_str[] = {
 static const char* gender_str[] = {
     "Unknown",
     "Unknown",
@@ -91,7 +92,7 @@ static void select_gender_selected_callback(void* context, uint32_t index) {
     scene_manager_previous_scene(pokemon_fap->scene_manager);
     scene_manager_previous_scene(pokemon_fap->scene_manager);
 }
 }
 
 
-void select_gender_scene_on_enter(void* context) {
+void pokemon_scene_select_gender_on_enter(void* context) {
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
 
 
     submenu_reset(pokemon_fap->submenu);
     submenu_reset(pokemon_fap->submenu);
@@ -102,3 +103,15 @@ void select_gender_scene_on_enter(void* context) {
     submenu_add_item(
     submenu_add_item(
         pokemon_fap->submenu, "Male", 1, select_gender_selected_callback, pokemon_fap);
         pokemon_fap->submenu, "Male", 1, select_gender_selected_callback, pokemon_fap);
 }
 }
+
+bool pokemon_scene_select_gender_on_event(void* context, SceneManagerEvent event)
+{
+	UNUSED(event);
+	UNUSED(context);
+
+	return false;
+}
+
+void pokemon_scene_select_gender_on_exit(void* context) {
+    UNUSED(context);
+}

+ 0 - 2
src/scenes/pokemon_gender.h

@@ -17,6 +17,4 @@ const char* select_gender_is_static(PokemonData* pdata, uint8_t ratio);
 /* This will return a pointer to a string of the pokemon's current gender */
 /* This will return a pointer to a string of the pokemon's current gender */
 char* select_gender_get(PokemonData* pdata);
 char* select_gender_get(PokemonData* pdata);
 
 
-void select_gender_scene_on_enter(void* context);
-
 #endif // POKEMON_GENDER_H
 #endif // POKEMON_GENDER_H

+ 33 - 10
src/scenes/pokemon_item.c

@@ -6,11 +6,12 @@
 
 
 #include <src/include/pokemon_app.h>
 #include <src/include/pokemon_app.h>
 #include <src/include/pokemon_data.h>
 #include <src/include/pokemon_data.h>
-#include <src/scenes/pokemon_menu.h>
+
+#include <src/scenes/pokemon_scene.h>
 
 
 static void select_item_selected_callback(void* context, uint32_t index) {
 static void select_item_selected_callback(void* context, uint32_t index) {
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
-    uint32_t item = scene_manager_get_scene_state(pokemon_fap->scene_manager, SelectItemSetScene);
+    uint32_t item = scene_manager_get_scene_state(pokemon_fap->scene_manager, PokemonSceneItemSet);
 
 
     pokemon_stat_set(pokemon_fap->pdata, STAT_HELD_ITEM, item, index);
     pokemon_stat_set(pokemon_fap->pdata, STAT_HELD_ITEM, item, index);
 
 
@@ -22,18 +23,18 @@ static void select_item_selected_callback(void* context, uint32_t index) {
             pokemon_stat_get(pokemon_fap->pdata, STAT_HELD_ITEM, item)));
             pokemon_stat_get(pokemon_fap->pdata, STAT_HELD_ITEM, item)));
 
 
     /* Move back to Gen menu. This assumes this submenu is only ever used in Gen II */
     /* Move back to Gen menu. This assumes this submenu is only ever used in Gen II */
-    scene_manager_search_and_switch_to_previous_scene(pokemon_fap->scene_manager, GenIITradeScene);
+    scene_manager_search_and_switch_to_previous_scene(pokemon_fap->scene_manager, PokemonSceneGenIITrade);
 }
 }
 
 
 static void select_item_index_callback(void* context, uint32_t index) {
 static void select_item_index_callback(void* context, uint32_t index) {
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
 
 
     /* Move to next scene */
     /* Move to next scene */
-    scene_manager_set_scene_state(pokemon_fap->scene_manager, SelectItemSetScene, index);
-    scene_manager_next_scene(pokemon_fap->scene_manager, SelectItemSetScene);
+    scene_manager_set_scene_state(pokemon_fap->scene_manager, PokemonSceneItemSet, index);
+    scene_manager_next_scene(pokemon_fap->scene_manager, PokemonSceneItemSet);
 }
 }
 
 
-void select_item_scene_on_enter(void* context) {
+void pokemon_scene_select_item_on_enter(void* context) {
     furi_assert(context);
     furi_assert(context);
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     int i;
     int i;
@@ -64,16 +65,26 @@ void select_item_scene_on_enter(void* context) {
 
 
     submenu_set_selected_item(
     submenu_set_selected_item(
         pokemon_fap->submenu,
         pokemon_fap->submenu,
-        scene_manager_get_scene_state(pokemon_fap->scene_manager, SelectItemSetScene));
-    scene_manager_set_scene_state(pokemon_fap->scene_manager, SelectItemSetScene, 0);
+        scene_manager_get_scene_state(pokemon_fap->scene_manager, PokemonSceneItemSet));
+    scene_manager_set_scene_state(pokemon_fap->scene_manager, PokemonSceneItemSet, 0);
+}
+
+bool pokemon_scene_select_item_on_event(void* context, SceneManagerEvent event) {
+    UNUSED(context);
+    UNUSED(event);
+    return false;
+}
+
+void pokemon_scene_select_item_on_exit(void* context) {
+    UNUSED(context);
 }
 }
 
 
-void select_item_set_scene_on_enter(void* context) {
+void pokemon_scene_select_item_set_on_enter(void* context) {
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     int i;
     int i;
     const char* name;
     const char* name;
     char letter =
     char letter =
-        (char)scene_manager_get_scene_state(pokemon_fap->scene_manager, SelectItemSetScene);
+        (char)scene_manager_get_scene_state(pokemon_fap->scene_manager, PokemonSceneItemSet);
 
 
     /* Populate submenu with all items that start with `letter` */
     /* Populate submenu with all items that start with `letter` */
     /* NOTE! Start with pos of 1 in the item list since 0 should always be no item! */
     /* NOTE! Start with pos of 1 in the item list since 0 should always be no item! */
@@ -92,3 +103,15 @@ void select_item_set_scene_on_enter(void* context) {
         }
         }
     }
     }
 }
 }
+
+bool pokemon_scene_select_item_set_on_event(void* context, SceneManagerEvent event)
+{
+	UNUSED(event);
+	UNUSED(context);
+
+	return false;
+}
+
+void pokemon_scene_select_item_set_on_exit(void* context) {
+    UNUSED(context);
+}

+ 0 - 10
src/scenes/pokemon_item.h

@@ -1,10 +0,0 @@
-#ifndef POKEMON_ITEM_H
-#define POKEMON_ITEM_H
-
-#pragma once
-
-void select_item_scene_on_enter(void* context);
-
-void select_item_set_scene_on_enter(void* context);
-
-#endif // POKEMON_ITEM_H

+ 10 - 113
src/scenes/pokemon_menu.c

@@ -2,21 +2,7 @@
 #include <src/include/pokemon_data.h>
 #include <src/include/pokemon_data.h>
 #include <src/include/pokemon_char_encode.h>
 #include <src/include/pokemon_char_encode.h>
 
 
-#include <src/scenes/pokemon_menu.h>
-#include <src/scenes/pokemon_gen.h>
-#include <src/scenes/pokemon_select.h>
-#include <src/scenes/pokemon_name_input.h>
-#include <src/scenes/pokemon_number_input.h>
-#include <src/scenes/pokemon_move.h>
-#include <src/scenes/pokemon_item.h>
-#include <src/scenes/pokemon_type.h>
-#include <src/scenes/pokemon_stats.h>
-#include <src/scenes/pokemon_shiny.h>
-#include <src/scenes/pokemon_gender.h>
-#include <src/scenes/pokemon_pokerus.h>
-#include <src/scenes/pokemon_trade.h>
-#include <src/scenes/pokemon_pins.h>
-#include <src/scenes/pokemon_exit_confirm.h>
+#include <src/scenes/pokemon_scene.h>
 
 
 static void scene_change_from_main_cb(void* context, uint32_t index) {
 static void scene_change_from_main_cb(void* context, uint32_t index) {
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
@@ -24,12 +10,12 @@ static void scene_change_from_main_cb(void* context, uint32_t index) {
     /* The same trade scene is used for both gen i and ii. Set the real index to
     /* The same trade scene is used for both gen i and ii. Set the real index to
      * scene's state.
      * scene's state.
      */
      */
-    scene_manager_set_scene_state(pokemon_fap->scene_manager, GenITradeScene, index);
+    scene_manager_set_scene_state(pokemon_fap->scene_manager, PokemonSceneGenITrade, index);
 
 
     /* Set scene state to the current index so we can have that element highlighted when
     /* Set scene state to the current index so we can have that element highlighted when
      * we return.
      * we return.
      */
      */
-    scene_manager_set_scene_state(pokemon_fap->scene_manager, MainMenuScene, index);
+    scene_manager_set_scene_state(pokemon_fap->scene_manager, PokemonSceneMainMenu, index);
     scene_manager_next_scene(pokemon_fap->scene_manager, index);
     scene_manager_next_scene(pokemon_fap->scene_manager, index);
 }
 }
 
 
@@ -39,7 +25,7 @@ bool main_menu_back_event_callback(void* context) {
     return scene_manager_handle_back_event(pokemon_fap->scene_manager);
     return scene_manager_handle_back_event(pokemon_fap->scene_manager);
 }
 }
 
 
-void main_menu_scene_on_enter(void* context) {
+void pokemon_scene_main_menu_on_enter(void* context) {
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
 
 
     submenu_reset(pokemon_fap->submenu);
     submenu_reset(pokemon_fap->submenu);
@@ -48,25 +34,25 @@ void main_menu_scene_on_enter(void* context) {
     submenu_add_item(
     submenu_add_item(
         pokemon_fap->submenu,
         pokemon_fap->submenu,
         "Gen I    (R/B/Y non-JPN)",
         "Gen I    (R/B/Y non-JPN)",
-        GenITradeScene,
+        PokemonSceneGenITrade,
         scene_change_from_main_cb,
         scene_change_from_main_cb,
         pokemon_fap);
         pokemon_fap);
     submenu_add_item(
     submenu_add_item(
         pokemon_fap->submenu,
         pokemon_fap->submenu,
         "Gen II   (G/S/C non-JPN)",
         "Gen II   (G/S/C non-JPN)",
-        GenIITradeScene,
+        PokemonSceneGenIITrade,
         scene_change_from_main_cb,
         scene_change_from_main_cb,
         pokemon_fap);
         pokemon_fap);
     submenu_add_item(
     submenu_add_item(
         pokemon_fap->submenu,
         pokemon_fap->submenu,
         "Select EXT Pinout",
         "Select EXT Pinout",
-        SelectPinsScene,
+        PokemonScenePins,
         scene_change_from_main_cb,
         scene_change_from_main_cb,
         pokemon_fap);
         pokemon_fap);
 
 
     submenu_set_selected_item(
     submenu_set_selected_item(
         pokemon_fap->submenu,
         pokemon_fap->submenu,
-        scene_manager_get_scene_state(pokemon_fap->scene_manager, MainMenuScene));
+        scene_manager_get_scene_state(pokemon_fap->scene_manager, PokemonSceneMainMenu));
 
 
     view_dispatcher_set_navigation_event_callback(
     view_dispatcher_set_navigation_event_callback(
         pokemon_fap->view_dispatcher, main_menu_back_event_callback);
         pokemon_fap->view_dispatcher, main_menu_back_event_callback);
@@ -74,101 +60,12 @@ void main_menu_scene_on_enter(void* context) {
     view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewMainMenu);
     view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewMainMenu);
 }
 }
 
 
-bool null_scene_on_event(void* context, SceneManagerEvent event) {
+bool pokemon_scene_main_menu_on_event(void* context, SceneManagerEvent event) {
     UNUSED(context);
     UNUSED(context);
     UNUSED(event);
     UNUSED(event);
     return false;
     return false;
 }
 }
 
 
-void null_scene_on_exit(void* context) {
+void pokemon_scene_main_menu_on_exit(void* context) {
     UNUSED(context);
     UNUSED(context);
 }
 }
-
-void generic_scene_on_exit(void* context) {
-    PokemonFap* pokemon_fap = (PokemonFap*)context;
-
-    view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewMainMenu);
-    view_dispatcher_remove_view(pokemon_fap->view_dispatcher, AppViewOpts);
-}
-
-void (*const pokemon_scene_on_enter_handlers[])(void*) = {
-    main_menu_scene_on_enter, //MainMenuScene,
-    gen_scene_on_enter, //GenITradeScene,
-    gen_scene_on_enter, //GenIITradeScene,
-    select_pokemon_scene_on_enter, //SelectPokemonScene,
-    select_name_scene_on_enter, //SelectNicknameScene,
-    select_number_scene_on_enter, //SelectLevelScene,
-    select_move_scene_on_enter, //SelectMoveScene,
-    select_move_index_scene_on_enter, //SelectMoveIndexScene,
-    select_move_set_scene_on_enter, //SelectMoveSetScene,
-    select_item_scene_on_enter, //SelectItemScene,
-    select_item_set_scene_on_enter, //SelectItemSetScene,
-    select_type_scene_on_enter, //SelectTypeScene,
-    select_stats_scene_on_enter, //SelectStatsScene,
-    select_shiny_scene_on_enter, //SelectShinyScene,
-    select_gender_scene_on_enter, //SelectGenderScene,
-    select_pokerus_scene_on_enter, //SelectPokerusScene,
-    select_name_scene_on_enter, //SelectUnownFormScene,
-    select_number_scene_on_enter, //SelectOTIDScene,
-    select_name_scene_on_enter, //SelectOTNameScene,
-    trade_scene_on_enter, //TradeScene,
-    select_pins_scene_on_enter, //SelectPinsScene,
-    pokemon_exit_confirm_on_enter, //ConfirmExitScene,
-};
-
-void (*const pokemon_scene_on_exit_handlers[])(void*) = {
-    null_scene_on_exit, //MainMenuScene,
-    null_scene_on_exit, //GenITradeScene,
-    null_scene_on_exit, //GenIITradeScene,
-    null_scene_on_exit, //SelectPokemonScene,
-    generic_scene_on_exit, //SelectNicknameScene,
-    generic_scene_on_exit, //SelectLevelScene,
-    null_scene_on_exit, //SelectMoveScene,
-    null_scene_on_exit, //SelectMoveIndexScene,
-    null_scene_on_exit, //SelectMoveSetScene,
-    null_scene_on_exit, //SelectItemScene,
-    null_scene_on_exit, //SelectItemSetScene,
-    generic_scene_on_exit, //SelectTypeScene,
-    null_scene_on_exit, //SelectStatsScene,
-    null_scene_on_exit, //SelectShinyScene,
-    null_scene_on_exit, //SelectGenderScene,
-    generic_scene_on_exit, //SelectPokerusScene,
-    generic_scene_on_exit, //SelectUnownFormScene,
-    generic_scene_on_exit, //SelectOTIDScene,
-    generic_scene_on_exit, //SelectOTNameScene,
-    null_scene_on_exit, //TradeScene,
-    generic_scene_on_exit, //SelectPinsScene,
-    generic_scene_on_exit, //ConfirmExitScene,
-};
-
-bool (*const pokemon_scene_on_event_handlers[])(void*, SceneManagerEvent) = {
-    null_scene_on_event, //MainMenuScene,
-    null_scene_on_event, //GenITradeScene,
-    null_scene_on_event, //GenIITradeScene,
-    null_scene_on_event, //SelectPokemonScene,
-    null_scene_on_event, //SelectNicknameScene,
-    null_scene_on_event, //SelectLevelScene,
-    null_scene_on_event, //SelectMoveScene,
-    null_scene_on_event, //SelectMoveIndexScene,
-    null_scene_on_event, //SelectMoveSetScene,
-    null_scene_on_event, //SelectItemScene,
-    null_scene_on_event, //SelectItemSetScene,
-    null_scene_on_event, //SelectTypeScene,
-    null_scene_on_event, //SelectStatsScene,
-    null_scene_on_event, //SelectShinyScene,
-    null_scene_on_event, //SelectGenderScene,
-    null_scene_on_event, //SelectPokerusScene,
-    null_scene_on_event, //SelectUnownFormScene,
-    null_scene_on_event, //SelectOTIDScene,
-    null_scene_on_event, //SelectOTNameScene,
-    null_scene_on_event, //TradeScene,
-    null_scene_on_event, //SelectPinsScene,
-    pokemon_exit_confirm_on_event, //ConfirmExitScene,
-};
-
-const SceneManagerHandlers pokemon_scene_manager_handlers = {
-    .on_enter_handlers = pokemon_scene_on_enter_handlers,
-    .on_exit_handlers = pokemon_scene_on_exit_handlers,
-    .on_event_handlers = pokemon_scene_on_event_handlers,
-    .scene_num = SceneCount,
-};

+ 0 - 28
src/scenes/pokemon_menu.h

@@ -5,34 +5,6 @@
 
 
 #include <gui/scene_manager.h>
 #include <gui/scene_manager.h>
 
 
-typedef enum {
-    MainMenuScene,
-    GenITradeScene, // Formerly main menu scene
-    GenIITradeScene,
-    SelectPokemonScene,
-    SelectNicknameScene,
-    SelectLevelScene,
-    SelectMoveScene,
-    SelectMoveIndexScene,
-    SelectMoveSetScene,
-    SelectItemScene,
-    SelectItemSetScene,
-    SelectTypeScene,
-    SelectStatsScene,
-    SelectShinyScene,
-    SelectGenderScene,
-    SelectPokerusScene,
-    SelectUnownFormScene,
-    SelectOTIDScene,
-    SelectOTNameScene,
-    TradeScene,
-    SelectPinsScene,
-    ConfirmExitScene,
-    SceneCount,
-} AppScene;
-
-extern const SceneManagerHandlers pokemon_scene_manager_handlers;
-
 bool main_menu_back_event_callback(void* context);
 bool main_menu_back_event_callback(void* context);
 
 
 #endif // POKEMON_MENU_H
 #endif // POKEMON_MENU_H

+ 53 - 15
src/scenes/pokemon_move.c

@@ -6,11 +6,12 @@
 
 
 #include <src/include/pokemon_app.h>
 #include <src/include/pokemon_app.h>
 #include <src/include/pokemon_data.h>
 #include <src/include/pokemon_data.h>
-#include <src/scenes/pokemon_menu.h>
+
+#include <src/scenes/pokemon_scene.h>
 
 
 static void select_move_selected_callback(void* context, uint32_t index) {
 static void select_move_selected_callback(void* context, uint32_t index) {
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
-    uint32_t move = scene_manager_get_scene_state(pokemon_fap->scene_manager, SelectMoveScene);
+    uint32_t move = scene_manager_get_scene_state(pokemon_fap->scene_manager, PokemonSceneMove);
     uint8_t num = pokemon_stat_get(pokemon_fap->pdata, STAT_NUM, NONE);
     uint8_t num = pokemon_stat_get(pokemon_fap->pdata, STAT_NUM, NONE);
 
 
     if(index == UINT32_MAX) {
     if(index == UINT32_MAX) {
@@ -30,15 +31,15 @@ static void select_move_selected_callback(void* context, uint32_t index) {
         (int)move);
         (int)move);
 
 
     /* Move back to move menu */
     /* Move back to move menu */
-    scene_manager_search_and_switch_to_previous_scene(pokemon_fap->scene_manager, SelectMoveScene);
+    scene_manager_search_and_switch_to_previous_scene(pokemon_fap->scene_manager, PokemonSceneMove);
 }
 }
 
 
 static void select_move_index_callback(void* context, uint32_t index) {
 static void select_move_index_callback(void* context, uint32_t index) {
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
 
 
     /* Move to next scene */
     /* Move to next scene */
-    scene_manager_set_scene_state(pokemon_fap->scene_manager, SelectMoveIndexScene, index);
-    scene_manager_next_scene(pokemon_fap->scene_manager, SelectMoveSetScene);
+    scene_manager_set_scene_state(pokemon_fap->scene_manager, PokemonSceneMoveIndex, index);
+    scene_manager_next_scene(pokemon_fap->scene_manager, PokemonSceneMoveSet);
 }
 }
 
 
 static void select_move_number_callback(void* context, uint32_t index) {
 static void select_move_number_callback(void* context, uint32_t index) {
@@ -47,11 +48,11 @@ static void select_move_number_callback(void* context, uint32_t index) {
     /* Move to move index scene, save which move number we're selecting,
     /* Move to move index scene, save which move number we're selecting,
      * This doubles as the move slot we're going to write to later.
      * This doubles as the move slot we're going to write to later.
      */
      */
-    scene_manager_set_scene_state(pokemon_fap->scene_manager, SelectMoveScene, index);
-    scene_manager_next_scene(pokemon_fap->scene_manager, SelectMoveIndexScene);
+    scene_manager_set_scene_state(pokemon_fap->scene_manager, PokemonSceneMove, index);
+    scene_manager_next_scene(pokemon_fap->scene_manager, PokemonSceneMoveIndex);
 }
 }
 
 
-void select_move_scene_on_enter(void* context) {
+void pokemon_scene_select_move_on_enter(void* context) {
     furi_assert(context);
     furi_assert(context);
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     char buf[64];
     char buf[64];
@@ -75,19 +76,29 @@ void select_move_scene_on_enter(void* context) {
 
 
     submenu_set_selected_item(
     submenu_set_selected_item(
         pokemon_fap->submenu,
         pokemon_fap->submenu,
-        scene_manager_get_scene_state(pokemon_fap->scene_manager, SelectMoveScene));
+        scene_manager_get_scene_state(pokemon_fap->scene_manager, PokemonSceneMove));
 
 
     /* Clear cursor position on MoveIndex */
     /* Clear cursor position on MoveIndex */
-    scene_manager_set_scene_state(pokemon_fap->scene_manager, SelectMoveIndexScene, 0);
+    scene_manager_set_scene_state(pokemon_fap->scene_manager, PokemonSceneMoveIndex, 0);
+}
+
+bool pokemon_scene_select_move_on_event(void* context, SceneManagerEvent event) {
+    UNUSED(context);
+    UNUSED(event);
+    return false;
+}
+
+void pokemon_scene_select_move_on_exit(void* context) {
+    UNUSED(context);
 }
 }
 
 
-void select_move_index_scene_on_enter(void* context) {
+void pokemon_scene_select_move_index_on_enter(void* context) {
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     int i;
     int i;
     char letter[2] = {'\0'};
     char letter[2] = {'\0'};
     char buf[32];
     char buf[32];
     const char* name;
     const char* name;
-    uint32_t move_num = scene_manager_get_scene_state(pokemon_fap->scene_manager, SelectMoveScene);
+    uint32_t move_num = scene_manager_get_scene_state(pokemon_fap->scene_manager, PokemonSceneMove);
 
 
     submenu_reset(pokemon_fap->submenu);
     submenu_reset(pokemon_fap->submenu);
     /* The move list should always start with No Move, put that at the start
     /* The move list should always start with No Move, put that at the start
@@ -132,15 +143,25 @@ void select_move_index_scene_on_enter(void* context) {
 
 
     submenu_set_selected_item(
     submenu_set_selected_item(
         pokemon_fap->submenu,
         pokemon_fap->submenu,
-        scene_manager_get_scene_state(pokemon_fap->scene_manager, SelectMoveIndexScene));
+        scene_manager_get_scene_state(pokemon_fap->scene_manager, PokemonSceneMoveIndex));
+}
+
+bool pokemon_scene_select_move_index_on_event(void* context, SceneManagerEvent event) {
+    UNUSED(context);
+    UNUSED(event);
+    return false;
+}
+
+void pokemon_scene_select_move_index_on_exit(void* context) {
+    UNUSED(context);
 }
 }
 
 
-void select_move_set_scene_on_enter(void* context) {
+void pokemon_scene_select_move_set_on_enter(void* context) {
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     int i;
     int i;
     const char* name;
     const char* name;
     char letter =
     char letter =
-        (char)scene_manager_get_scene_state(pokemon_fap->scene_manager, SelectMoveIndexScene);
+        (char)scene_manager_get_scene_state(pokemon_fap->scene_manager, PokemonSceneMoveIndex);
 
 
     /* Populate submenu with all moves that start with `letter` */
     /* Populate submenu with all moves that start with `letter` */
     /* NOTE! Start with index of 1 in the move list since 0 should always be no move! */
     /* NOTE! Start with index of 1 in the move list since 0 should always be no move! */
@@ -159,3 +180,20 @@ void select_move_set_scene_on_enter(void* context) {
         };
         };
     }
     }
 }
 }
+
+bool pokemon_scene_select_move_set_on_event(void* context, SceneManagerEvent event) {
+    UNUSED(context);
+    UNUSED(event);
+    return false;
+}
+
+void pokemon_scene_select_move_set_on_exit(void* context) {
+    UNUSED(context);
+}
+
+void generic_scene_on_exit(void* context) {
+    PokemonFap* pokemon_fap = (PokemonFap*)context;
+
+    view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewMainMenu);
+    view_dispatcher_remove_view(pokemon_fap->view_dispatcher, AppViewOpts);
+}

+ 0 - 12
src/scenes/pokemon_move.h

@@ -1,12 +0,0 @@
-#ifndef POKEMON_MOVE_H
-#define POKEMON_MOVE_H
-
-#pragma once
-
-void select_move_scene_on_enter(void* context);
-
-void select_move_index_scene_on_enter(void* context);
-
-void select_move_set_scene_on_enter(void* context);
-
-#endif // POKEMON_MOVE_H

+ 27 - 13
src/scenes/pokemon_name_input.c

@@ -7,9 +7,10 @@
 #include <src/include/pokemon_app.h>
 #include <src/include/pokemon_app.h>
 #include <src/include/pokemon_data.h>
 #include <src/include/pokemon_data.h>
 #include <src/include/pokemon_char_encode.h>
 #include <src/include/pokemon_char_encode.h>
-#include <src/scenes/pokemon_menu.h>
 #include <src/scenes/unown_form.h>
 #include <src/scenes/unown_form.h>
 
 
+#include <src/scenes/pokemon_scene.h>
+
 static char name_buf[LEN_NAME_BUF];
 static char name_buf[LEN_NAME_BUF];
 
 
 /* NOTE:
 /* NOTE:
@@ -24,11 +25,11 @@ static char name_buf[LEN_NAME_BUF];
 static bool select_name_input_validator(const char* text, FuriString* error, void* context) {
 static bool select_name_input_validator(const char* text, FuriString* error, void* context) {
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     uint32_t state =
     uint32_t state =
-        scene_manager_get_scene_state(pokemon_fap->scene_manager, SelectNicknameScene);
+        scene_manager_get_scene_state(pokemon_fap->scene_manager, PokemonSceneNickname);
     unsigned int i;
     unsigned int i;
 
 
     /* A blank field for the pokemon nickname means revert to default name */
     /* A blank field for the pokemon nickname means revert to default name */
-    if(text[0] == '\0' && state == SelectNicknameScene) {
+    if(text[0] == '\0' && state == PokemonSceneNickname) {
         /* Get the pokemon's name and populate our buffer with it */
         /* Get the pokemon's name and populate our buffer with it */
         /* TODO: Nidoran M/F are still a problem with this. */
         /* TODO: Nidoran M/F are still a problem with this. */
         pokemon_default_nickname_set(name_buf, pokemon_fap->pdata, sizeof(name_buf));
         pokemon_default_nickname_set(name_buf, pokemon_fap->pdata, sizeof(name_buf));
@@ -44,7 +45,7 @@ static bool select_name_input_validator(const char* text, FuriString* error, voi
     }
     }
 
 
     /* Check for Unown setting is a character */
     /* Check for Unown setting is a character */
-    if(state == SelectUnownFormScene) {
+    if(state == PokemonSceneUnownForm) {
         if(!isalpha((int)text[0])) {
         if(!isalpha((int)text[0])) {
             furi_string_printf(error, "Form must\nbe a single\nletter!");
             furi_string_printf(error, "Form must\nbe a single\nletter!");
             return false;
             return false;
@@ -52,13 +53,13 @@ static bool select_name_input_validator(const char* text, FuriString* error, voi
     }
     }
 
 
     switch(state) {
     switch(state) {
-    case SelectNicknameScene:
+    case PokemonSceneNickname:
         pokemon_name_set(pokemon_fap->pdata, STAT_NICKNAME, (char*)text);
         pokemon_name_set(pokemon_fap->pdata, STAT_NICKNAME, (char*)text);
         break;
         break;
-    case SelectOTNameScene:
+    case PokemonSceneOTName:
         pokemon_name_set(pokemon_fap->pdata, STAT_OT_NAME, (char*)text);
         pokemon_name_set(pokemon_fap->pdata, STAT_OT_NAME, (char*)text);
         break;
         break;
-    case SelectUnownFormScene:
+    case PokemonSceneUnownForm:
         unown_form_set(pokemon_fap->pdata, text[0]);
         unown_form_set(pokemon_fap->pdata, text[0]);
         break;
         break;
     default:
     default:
@@ -75,26 +76,26 @@ static void select_name_input_callback(void* context) {
     scene_manager_previous_scene(pokemon_fap->scene_manager);
     scene_manager_previous_scene(pokemon_fap->scene_manager);
 }
 }
 
 
-void select_name_scene_on_enter(void* context) {
+void pokemon_scene_select_name_on_enter(void* context) {
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     uint32_t state =
     uint32_t state =
-        scene_manager_get_scene_state(pokemon_fap->scene_manager, SelectNicknameScene);
+        scene_manager_get_scene_state(pokemon_fap->scene_manager, PokemonSceneNickname);
     char* header;
     char* header;
     int len;
     int len;
     DataStat stat;
     DataStat stat;
 
 
     switch(state) {
     switch(state) {
-    case SelectNicknameScene:
+    case PokemonSceneNickname:
         header = "Nickname (none for default)";
         header = "Nickname (none for default)";
         len = LEN_NICKNAME;
         len = LEN_NICKNAME;
         stat = STAT_NICKNAME;
         stat = STAT_NICKNAME;
         break;
         break;
-    case SelectOTNameScene:
+    case PokemonSceneOTName:
         header = "Enter OT Name";
         header = "Enter OT Name";
         len = LEN_OT_NAME;
         len = LEN_OT_NAME;
         stat = STAT_OT_NAME;
         stat = STAT_OT_NAME;
         break;
         break;
-    case SelectUnownFormScene:
+    case PokemonSceneUnownForm:
         header = "Enter Unown Letter Form";
         header = "Enter Unown Letter Form";
         len = 2;
         len = 2;
         stat = STAT_OT_NAME;
         stat = STAT_OT_NAME;
@@ -104,7 +105,7 @@ void select_name_scene_on_enter(void* context) {
         break;
         break;
     }
     }
 
 
-    if(state == SelectUnownFormScene) {
+    if(state == PokemonSceneUnownForm) {
         /* Put the current letter in the buffer */
         /* Put the current letter in the buffer */
         name_buf[0] = unown_form_get(pokemon_fap->pdata);
         name_buf[0] = unown_form_get(pokemon_fap->pdata);
         name_buf[1] = '\0';
         name_buf[1] = '\0';
@@ -122,3 +123,16 @@ void select_name_scene_on_enter(void* context) {
         pokemon_fap->view_dispatcher, AppViewOpts, text_input_get_view(pokemon_fap->text_input));
         pokemon_fap->view_dispatcher, AppViewOpts, text_input_get_view(pokemon_fap->text_input));
     view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewOpts);
     view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewOpts);
 }
 }
+
+bool pokemon_scene_select_name_on_event(void* context, SceneManagerEvent event) {
+    UNUSED(context);
+    UNUSED(event);
+    return false;
+}
+
+void pokemon_scene_select_name_on_exit(void* context) {
+    PokemonFap* pokemon_fap = (PokemonFap*)context;
+
+    view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewMainMenu);
+    view_dispatcher_remove_view(pokemon_fap->view_dispatcher, AppViewOpts);
+}

+ 0 - 8
src/scenes/pokemon_name_input.h

@@ -1,8 +0,0 @@
-#ifndef POKEMON_NAME_H
-#define POKEMON_NAME_H
-
-#pragma once
-
-void select_name_scene_on_enter(void* context);
-
-#endif // POKEMON_NAME_H

+ 22 - 8
src/scenes/pokemon_number_input.c

@@ -5,13 +5,14 @@
 
 
 #include <src/include/pokemon_app.h>
 #include <src/include/pokemon_app.h>
 #include <src/include/pokemon_data.h>
 #include <src/include/pokemon_data.h>
-#include <src/scenes/pokemon_menu.h>
+
+#include <src/scenes/pokemon_scene.h>
 
 
 static char number_buf[LEN_NUM_BUF];
 static char number_buf[LEN_NUM_BUF];
 
 
 static bool select_number_input_validator(const char* text, FuriString* error, void* context) {
 static bool select_number_input_validator(const char* text, FuriString* error, void* context) {
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
-    uint32_t state = scene_manager_get_scene_state(pokemon_fap->scene_manager, SelectLevelScene);
+    uint32_t state = scene_manager_get_scene_state(pokemon_fap->scene_manager, PokemonSceneLevel);
     int number;
     int number;
     char* error_str;
     char* error_str;
     int min;
     int min;
@@ -21,13 +22,13 @@ static bool select_number_input_validator(const char* text, FuriString* error, v
     unsigned int i;
     unsigned int i;
 
 
     switch(state) {
     switch(state) {
-    case SelectLevelScene:
+    case PokemonSceneLevel:
         error_str = "Level must\nbe a number\nbetween\n2-100!";
         error_str = "Level must\nbe a number\nbetween\n2-100!";
         min = 2;
         min = 2;
         max = 100;
         max = 100;
         stat = STAT_LEVEL;
         stat = STAT_LEVEL;
         break;
         break;
-    case SelectOTIDScene:
+    case PokemonSceneOTID:
         error_str = "OT ID must\nbe between\n0-65535!";
         error_str = "OT ID must\nbe between\n0-65535!";
         min = 0;
         min = 0;
         max = 65535;
         max = 65535;
@@ -65,20 +66,20 @@ static void select_number_input_callback(void* context) {
     scene_manager_previous_scene(pokemon_fap->scene_manager);
     scene_manager_previous_scene(pokemon_fap->scene_manager);
 }
 }
 
 
-void select_number_scene_on_enter(void* context) {
+void pokemon_scene_select_number_on_enter(void* context) {
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     char* header;
     char* header;
-    uint32_t state = scene_manager_get_scene_state(pokemon_fap->scene_manager, SelectLevelScene);
+    uint32_t state = scene_manager_get_scene_state(pokemon_fap->scene_manager, PokemonSceneLevel);
     int len;
     int len;
     DataStat stat;
     DataStat stat;
 
 
     switch(state) {
     switch(state) {
-    case SelectLevelScene:
+    case PokemonSceneLevel:
         header = "Enter level (numbers only)";
         header = "Enter level (numbers only)";
         len = LEN_LEVEL;
         len = LEN_LEVEL;
         stat = STAT_LEVEL;
         stat = STAT_LEVEL;
         break;
         break;
-    case SelectOTIDScene:
+    case PokemonSceneOTID:
         header = "Enter OT ID (numbers only)";
         header = "Enter OT ID (numbers only)";
         len = LEN_OT_ID;
         len = LEN_OT_ID;
         stat = STAT_OT_ID;
         stat = STAT_OT_ID;
@@ -100,3 +101,16 @@ void select_number_scene_on_enter(void* context) {
         pokemon_fap->view_dispatcher, AppViewOpts, text_input_get_view(pokemon_fap->text_input));
         pokemon_fap->view_dispatcher, AppViewOpts, text_input_get_view(pokemon_fap->text_input));
     view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewOpts);
     view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewOpts);
 }
 }
+
+bool pokemon_scene_select_number_on_event(void* context, SceneManagerEvent event) {
+    UNUSED(context);
+    UNUSED(event);
+    return false;
+}
+
+void pokemon_scene_select_number_on_exit(void* context) {
+    PokemonFap* pokemon_fap = (PokemonFap*)context;
+
+    view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewMainMenu);
+    view_dispatcher_remove_view(pokemon_fap->view_dispatcher, AppViewOpts);
+}

+ 0 - 8
src/scenes/pokemon_number_input.h

@@ -1,8 +0,0 @@
-#ifndef POKEMON_NUMBER_INPUT_H
-#define POKEMON_NUMBER_INPUT_H
-
-#pragma once
-
-void select_number_scene_on_enter(void* context);
-
-#endif // POKEMON_NUMBER_INPUT_H

+ 16 - 2
src/scenes/pokemon_pins.c

@@ -2,7 +2,8 @@
 #include <furi.h>
 #include <furi.h>
 
 
 #include <src/include/pokemon_app.h>
 #include <src/include/pokemon_app.h>
-#include <src/scenes/pokemon_menu.h>
+
+#include <src/scenes/pokemon_scene.h>
 
 
 /* This is a bit of a hack to save some space and not have to refactor this scene.
 /* This is a bit of a hack to save some space and not have to refactor this scene.
  * We re-use the name and pin from the global gpio pin definition, but need to
  * We re-use the name and pin from the global gpio pin definition, but need to
@@ -143,7 +144,7 @@ static void select_pins_rebuild_list(PokemonFap* pokemon_fap) {
     variable_item_set_current_value_text(builder.clk, named_pins[builder.clk_index]->name);
     variable_item_set_current_value_text(builder.clk, named_pins[builder.clk_index]->name);
 }
 }
 
 
-void select_pins_scene_on_enter(void* context) {
+void pokemon_scene_select_pins_on_enter(void* context) {
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
 
 
     select_pins_rebuild_list(pokemon_fap);
     select_pins_rebuild_list(pokemon_fap);
@@ -154,3 +155,16 @@ void select_pins_scene_on_enter(void* context) {
         variable_item_list_get_view(pokemon_fap->variable_item_list));
         variable_item_list_get_view(pokemon_fap->variable_item_list));
     view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewOpts);
     view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewOpts);
 }
 }
+
+bool pokemon_scene_select_pins_on_event(void* context, SceneManagerEvent event) {
+    UNUSED(context);
+    UNUSED(event);
+    return false;
+}
+
+void pokemon_scene_select_pins_on_exit(void* context) {
+    PokemonFap* pokemon_fap = (PokemonFap*)context;
+
+    view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewMainMenu);
+    view_dispatcher_remove_view(pokemon_fap->view_dispatcher, AppViewOpts);
+}

+ 0 - 8
src/scenes/pokemon_pins.h

@@ -1,8 +0,0 @@
-#ifndef POKEMON_PINS_H
-#define POKEMON_PINS_H
-
-#pragma once
-
-void select_pins_scene_on_enter(void* context);
-
-#endif // POKEMON_PINS_H

+ 16 - 2
src/scenes/pokemon_pokerus.c

@@ -2,7 +2,8 @@
 #include <furi.h>
 #include <furi.h>
 
 
 #include <src/include/pokemon_app.h>
 #include <src/include/pokemon_app.h>
-#include <src/scenes/pokemon_menu.h>
+
+#include <src/scenes/pokemon_scene.h>
 
 
 static const char* pokerus_states[] = {
 static const char* pokerus_states[] = {
     "Clean",
     "Clean",
@@ -159,7 +160,7 @@ static void select_pokerus_rebuild_list(PokemonFap* pokemon_fap) {
     furi_string_free(daystring);
     furi_string_free(daystring);
 }
 }
 
 
-void select_pokerus_scene_on_enter(void* context) {
+void pokemon_scene_select_pokerus_on_enter(void* context) {
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
 
 
     select_pokerus_rebuild_list(pokemon_fap);
     select_pokerus_rebuild_list(pokemon_fap);
@@ -170,3 +171,16 @@ void select_pokerus_scene_on_enter(void* context) {
         variable_item_list_get_view(pokemon_fap->variable_item_list));
         variable_item_list_get_view(pokemon_fap->variable_item_list));
     view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewOpts);
     view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewOpts);
 }
 }
+
+bool pokemon_scene_select_pokerus_on_event(void* context, SceneManagerEvent event) {
+    UNUSED(context);
+    UNUSED(event);
+    return false;
+}
+
+void pokemon_scene_select_pokerus_on_exit(void* context) {
+    PokemonFap* pokemon_fap = (PokemonFap*)context;
+
+    view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewMainMenu);
+    view_dispatcher_remove_view(pokemon_fap->view_dispatcher, AppViewOpts);
+}

+ 0 - 1
src/scenes/pokemon_pokerus.h

@@ -5,7 +5,6 @@
 
 
 #pragma once
 #pragma once
 
 
-void select_pokerus_scene_on_enter(void* context);
 const char* select_pokerus_status(PokemonFap* pokemon_fap);
 const char* select_pokerus_status(PokemonFap* pokemon_fap);
 
 
 #endif // POKEMON_POKERUS_H
 #endif // POKEMON_POKERUS_H

+ 30 - 0
src/scenes/pokemon_scene.c

@@ -0,0 +1,30 @@
+#include "pokemon_scene.h"
+
+// Generate scene on_enter handlers array
+#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter,
+void (*const pokemon_on_enter_handlers[])(void*) = {
+#include "pokemon_scene_config.h"
+};
+#undef ADD_SCENE
+
+// Generate scene on_event handlers array
+#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_event,
+bool (*const pokemon_on_event_handlers[])(void* context, SceneManagerEvent event) = {
+#include "pokemon_scene_config.h"
+};
+#undef ADD_SCENE
+
+// Generate scene on_exit handlers array
+#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_exit,
+void (*const pokemon_on_exit_handlers[])(void* context) = {
+#include "pokemon_scene_config.h"
+};
+#undef ADD_SCENE
+
+// Initialize scene handlers configuration structure
+const SceneManagerHandlers pokemon_scene_handlers = {
+    .on_enter_handlers = pokemon_on_enter_handlers,
+    .on_event_handlers = pokemon_on_event_handlers,
+    .on_exit_handlers = pokemon_on_exit_handlers,
+    .scene_num = PokemonSceneNum,
+};

+ 45 - 0
src/scenes/pokemon_scene.h

@@ -0,0 +1,45 @@
+#ifndef POKEMON_SCENE_H
+#define POKEMON_SCENE_H
+
+#pragma once
+
+#include <gui/scene_manager.h>
+
+// Generate scene id and total number
+#define ADD_SCENE(prefix, name, id) PokemonScene##id,
+typedef enum {
+#include "pokemon_scene_config.h"
+    PokemonSceneNum,
+} PokemonScene;
+#undef ADD_SCENE
+
+extern const SceneManagerHandlers pokemon_scene_handlers;
+
+/* Disable redundant declarations for this.
+ * Normally not something we would want, however, this codebase does reuse
+ * functions (using different scene IDs) to handle what would otherwise be
+ * the same (or very similar) code. e.g. OT Name, nickname, and unown form use
+ * the same name select scene with a different ID. Similar for OT ID and level.
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wredundant-decls"
+
+// Generate scene on_enter handlers declaration
+#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_enter(void*);
+#include "pokemon_scene_config.h"
+#undef ADD_SCENE
+
+// Generate scene on_event handlers declaration
+#define ADD_SCENE(prefix, name, id) \
+    bool prefix##_scene_##name##_on_event(void* context, SceneManagerEvent event);
+#include "pokemon_scene_config.h"
+#undef ADD_SCENE
+
+// Generate scene on_exit handlers declaration
+#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_exit(void* context);
+#include "pokemon_scene_config.h"
+#undef ADD_SCENE
+
+#pragma GCC diagnostic pop
+
+#endif // POKEMON_SCENE_H

+ 22 - 0
src/scenes/pokemon_scene_config.h

@@ -0,0 +1,22 @@
+ADD_SCENE(pokemon,	main_menu,		MainMenu)
+ADD_SCENE(pokemon,	gen,			GenITrade)
+ADD_SCENE(pokemon,	gen,			GenIITrade)
+ADD_SCENE(pokemon,	select_pokemon,		Select)
+ADD_SCENE(pokemon,	select_name,		Nickname)
+ADD_SCENE(pokemon,	select_number,		Level)
+ADD_SCENE(pokemon,	select_move,		Move)
+ADD_SCENE(pokemon,	select_move_index,	MoveIndex)
+ADD_SCENE(pokemon,	select_move_set,	MoveSet)
+ADD_SCENE(pokemon,	select_item,		Item)
+ADD_SCENE(pokemon,	select_item_set,	ItemSet)
+ADD_SCENE(pokemon,	select_type,		Type)
+ADD_SCENE(pokemon,	select_stats,		Stats)
+ADD_SCENE(pokemon,	select_shiny,		Shiny)
+ADD_SCENE(pokemon,	select_gender,		Gender)
+ADD_SCENE(pokemon,	select_pokerus,		Pokerus)
+ADD_SCENE(pokemon,	select_name,		UnownForm)
+ADD_SCENE(pokemon,	select_number,		OTID)
+ADD_SCENE(pokemon,	select_name,		OTName)
+ADD_SCENE(pokemon,	trade,			Trade)
+ADD_SCENE(pokemon,	select_pins,		Pins)
+ADD_SCENE(pokemon,	exit_confirm,		ExitConfirm)

+ 11 - 1
src/scenes/pokemon_select.c

@@ -1,9 +1,19 @@
 #include <src/include/pokemon_app.h>
 #include <src/include/pokemon_app.h>
 
 
-void select_pokemon_scene_on_enter(void* context) {
+void pokemon_scene_select_pokemon_on_enter(void* context) {
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     // switch to select pokemon scene
     // switch to select pokemon scene
     // Note for the future, this might make sense to setup and teardown each view
     // Note for the future, this might make sense to setup and teardown each view
     // at runtime rather than at the start of the whole application
     // at runtime rather than at the start of the whole application
     view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewSelectPokemon);
     view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewSelectPokemon);
 }
 }
+
+bool pokemon_scene_select_pokemon_on_event(void* context, SceneManagerEvent event) {
+    UNUSED(context);
+    UNUSED(event);
+    return false;
+}
+
+void pokemon_scene_select_pokemon_on_exit(void* context) {
+    UNUSED(context);
+}

+ 0 - 8
src/scenes/pokemon_select.h

@@ -1,8 +0,0 @@
-#ifndef POKEMON_SELECT_H
-#define POKEMON_SELECT_H
-
-#pragma once
-
-void select_pokemon_scene_on_enter(void* context);
-
-#endif // POKEMON_SELECT_H

+ 12 - 2
src/scenes/pokemon_shiny.c

@@ -2,7 +2,7 @@
 
 
 #include <src/include/pokemon_app.h>
 #include <src/include/pokemon_app.h>
 
 
-#include <src/scenes/pokemon_menu.h>
+#include <src/scenes/pokemon_scene.h>
 
 
 /* This just assumes gen ii for now */
 /* This just assumes gen ii for now */
 /* For a Gen II pokemon to be shiny, the following must be met:
 /* For a Gen II pokemon to be shiny, the following must be met:
@@ -67,7 +67,7 @@ static void select_shiny_selected_callback(void* context, uint32_t index) {
     scene_manager_previous_scene(pokemon_fap->scene_manager);
     scene_manager_previous_scene(pokemon_fap->scene_manager);
 }
 }
 
 
-void select_shiny_scene_on_enter(void* context) {
+void pokemon_scene_select_shiny_on_enter(void* context) {
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
 
 
     submenu_reset(pokemon_fap->submenu);
     submenu_reset(pokemon_fap->submenu);
@@ -78,3 +78,13 @@ void select_shiny_scene_on_enter(void* context) {
     submenu_add_item(
     submenu_add_item(
         pokemon_fap->submenu, "Not Shiny", 0, select_shiny_selected_callback, pokemon_fap);
         pokemon_fap->submenu, "Not Shiny", 0, select_shiny_selected_callback, pokemon_fap);
 }
 }
+
+bool pokemon_scene_select_shiny_on_event(void* context, SceneManagerEvent event) {
+    UNUSED(context);
+    UNUSED(event);
+    return false;
+}
+
+void pokemon_scene_select_shiny_on_exit(void* context) {
+    UNUSED(context);
+}

+ 0 - 1
src/scenes/pokemon_shiny.h

@@ -3,7 +3,6 @@
 
 
 #pragma once
 #pragma once
 
 
-void select_shiny_scene_on_enter(void* context);
 bool select_shiny_is_shiny(PokemonData* pdata);
 bool select_shiny_is_shiny(PokemonData* pdata);
 
 
 #endif // POKEMON_SHINY_H
 #endif // POKEMON_SHINY_H

+ 13 - 2
src/scenes/pokemon_stats.c

@@ -4,7 +4,8 @@
 
 
 #include <src/include/pokemon_app.h>
 #include <src/include/pokemon_app.h>
 #include <src/include/pokemon_data.h>
 #include <src/include/pokemon_data.h>
-#include <src/scenes/pokemon_menu.h>
+
+#include <src/scenes/pokemon_scene.h>
 
 
 static void select_stats_selected_callback(void* context, uint32_t index) {
 static void select_stats_selected_callback(void* context, uint32_t index) {
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
@@ -14,7 +15,7 @@ static void select_stats_selected_callback(void* context, uint32_t index) {
     scene_manager_previous_scene(pokemon_fap->scene_manager);
     scene_manager_previous_scene(pokemon_fap->scene_manager);
 }
 }
 
 
-void select_stats_scene_on_enter(void* context) {
+void pokemon_scene_select_stats_on_enter(void* context) {
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     int i;
     int i;
 
 
@@ -29,3 +30,13 @@ void select_stats_scene_on_enter(void* context) {
             pokemon_fap);
             pokemon_fap);
     }
     }
 }
 }
+
+bool pokemon_scene_select_stats_on_event(void* context, SceneManagerEvent event) {
+    UNUSED(context);
+    UNUSED(event);
+    return false;
+}
+
+void pokemon_scene_select_stats_on_exit(void* context) {
+    UNUSED(context);
+}

+ 0 - 8
src/scenes/pokemon_stats.h

@@ -1,8 +0,0 @@
-#ifndef POKEMON_STATS_H
-#define POKEMON_STATS_H
-
-#pragma once
-
-void select_stats_scene_on_enter(void* context);
-
-#endif // POKEMON_STATS_H

+ 13 - 1
src/scenes/pokemon_trade.c

@@ -1,9 +1,21 @@
 #include <src/include/pokemon_app.h>
 #include <src/include/pokemon_app.h>
 
 
-void trade_scene_on_enter(void* context) {
+#include <src/scenes/pokemon_scene.h>
+
+void pokemon_scene_trade_on_enter(void* context) {
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     // switch to select pokemon scene
     // switch to select pokemon scene
     // Note for the future, this might make sense to setup and teardown each view
     // Note for the future, this might make sense to setup and teardown each view
     // at runtime rather than at the start?
     // at runtime rather than at the start?
     view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewTrade);
     view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewTrade);
 }
 }
+
+bool pokemon_scene_trade_on_event(void* context, SceneManagerEvent event) {
+    UNUSED(context);
+    UNUSED(event);
+    return false;
+}
+
+void pokemon_scene_trade_on_exit(void* context) {
+    UNUSED(context);
+}

+ 0 - 8
src/scenes/pokemon_trade.h

@@ -1,8 +0,0 @@
-#ifndef POKEMON_TRADE_H
-#define POKEMON_TRADE_H
-
-#pragma once
-
-void trade_scene_on_enter(void* context);
-
-#endif // POKEMON_TRADE_H

+ 16 - 2
src/scenes/pokemon_type.c

@@ -4,7 +4,8 @@
 
 
 #include <src/include/pokemon_app.h>
 #include <src/include/pokemon_app.h>
 #include <src/include/pokemon_data.h>
 #include <src/include/pokemon_data.h>
-#include <src/scenes/pokemon_menu.h>
+
+#include <src/scenes/pokemon_scene.h>
 
 
 struct type_cb {
 struct type_cb {
     DataStatSub type;
     DataStatSub type;
@@ -39,7 +40,7 @@ static void select_type_callback(VariableItem* item) {
         namedlist_index_get(context->pokemon_fap->pdata->type_list, pos));
         namedlist_index_get(context->pokemon_fap->pdata->type_list, pos));
 }
 }
 
 
-void select_type_scene_on_enter(void* context) {
+void pokemon_scene_select_type_on_enter(void* context) {
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     PokemonFap* pokemon_fap = (PokemonFap*)context;
     VariableItem* vitype[2];
     VariableItem* vitype[2];
     char* strings[2] = {"Type 1:", "Type 2:"};
     char* strings[2] = {"Type 1:", "Type 2:"};
@@ -74,3 +75,16 @@ void select_type_scene_on_enter(void* context) {
         variable_item_list_get_view(pokemon_fap->variable_item_list));
         variable_item_list_get_view(pokemon_fap->variable_item_list));
     view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewOpts);
     view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewOpts);
 }
 }
+
+bool pokemon_scene_select_type_on_event(void* context, SceneManagerEvent event) {
+    UNUSED(context);
+    UNUSED(event);
+    return false;
+}
+
+void pokemon_scene_select_type_on_exit(void* context) {
+    PokemonFap* pokemon_fap = (PokemonFap*)context;
+
+    view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewMainMenu);
+    view_dispatcher_remove_view(pokemon_fap->view_dispatcher, AppViewOpts);
+}

+ 0 - 8
src/scenes/pokemon_type.h

@@ -1,8 +0,0 @@
-#ifndef POKEMON_TYPE_H
-#define POKEMON_TYPE_H
-
-#pragma once
-
-void select_type_scene_on_enter(void* context);
-
-#endif // POKEMON_TYPE_H