jblanked 11 hónapja
szülő
commit
fadb9785db
3 módosított fájl, 6 hozzáadás és 24 törlés
  1. 4 0
      assets/CHANGELOG.md
  2. 1 1
      callback/callback.c
  3. 1 23
      game/game.c

+ 4 - 0
assets/CHANGELOG.md

@@ -1,3 +1,7 @@
+## 0.5 (2025-01-27)
+- Fixed saving errors.
+- Improved memory allocation.
+
 ## 0.4 (2025-01-23)
 - Added an In-Game menu.
 - Added New controls (HOLD OK to access the In-Game menu, PRESS BACK to exit the menu, and HOLD BACK to leave the game).

+ 1 - 1
callback/callback.c

@@ -1166,7 +1166,7 @@ void callback_submenu_choices(void *context, uint32_t index)
     {
     case FlipWorldSubmenuIndexRun:
         free_all_views(app, true, true);
-        if (!is_enough_heap(50000))
+        if (!is_enough_heap(60000))
         {
             easy_flipper_dialog("Error", "Not enough heap memory.\nPlease restart your Flipper.");
             return;

+ 1 - 23
game/game.c

@@ -20,9 +20,7 @@ static void game_start(GameManager *game_manager, void *ctx)
 
     // set all levels to NULL
     for (int i = 0; i < MAX_LEVELS; i++)
-    {
         game_context->levels[i] = NULL;
-    }
 
     // attempt to allocate all levels
     for (int i = 0; i < MAX_LEVELS; i++)
@@ -38,9 +36,7 @@ static void game_start(GameManager *game_manager, void *ctx)
             break;
         }
         else
-        {
             game_context->level_count++;
-        }
     }
 
     // imu
@@ -55,36 +51,18 @@ static void game_start(GameManager *game_manager, void *ctx)
 */
 static void game_stop(void *ctx)
 {
-    if (!ctx)
-    {
-        FURI_LOG_E("Game", "Invalid game context");
-        return;
-    }
-
+    furi_check(ctx);
     GameContext *game_context = ctx;
-    if (!game_context)
-    {
-        FURI_LOG_E("Game", "Game context is NULL");
-        return;
-    }
-
     imu_free(game_context->imu);
     game_context->imu = NULL;
 
     if (game_context->player_context)
     {
-        FURI_LOG_I("Game", "Game ending");
         if (!game_context->ended_early)
-        {
             easy_flipper_dialog("Game Over", "Thanks for playing FlipWorld!\nHit BACK then wait for\nthe game to save.");
-        }
         else
-        {
             easy_flipper_dialog("Game Over", "Ran out of memory so the\ngame ended early.\nHit BACK to exit.");
-        }
-        FURI_LOG_I("Game", "Saving player context");
         save_player_context_api(game_context->player_context);
-        FURI_LOG_I("Game", "Player context saved");
         easy_flipper_dialog("Game Saved", "Hit BACK to exit.");
     }
 }