|
|
@@ -24,7 +24,7 @@
|
|
|
#define FRAME_TOP 1
|
|
|
#define FRAME_SIZE 61
|
|
|
|
|
|
-#define SAVING_DIRECTORY "/ext/apps/Games"
|
|
|
+#define SAVING_DIRECTORY STORAGE_APP_DATA_PATH_PREFIX
|
|
|
#define SAVING_FILENAME SAVING_DIRECTORY "/game_2048.save"
|
|
|
|
|
|
typedef enum {
|
|
|
@@ -301,6 +301,7 @@ void init_game(GameState* const game_state, bool clear_top_score) {
|
|
|
|
|
|
bool load_game(GameState* game_state) {
|
|
|
Storage* storage = furi_record_open(RECORD_STORAGE);
|
|
|
+ storage_common_migrate(storage, EXT_PATH("apps/Games/game_2048.save"), SAVING_FILENAME);
|
|
|
|
|
|
File* file = storage_file_alloc(storage);
|
|
|
uint16_t bytes_readed = 0;
|
|
|
@@ -318,12 +319,6 @@ bool load_game(GameState* game_state) {
|
|
|
void save_game(GameState* game_state) {
|
|
|
Storage* storage = furi_record_open(RECORD_STORAGE);
|
|
|
|
|
|
- if(storage_common_stat(storage, SAVING_DIRECTORY, NULL) == FSE_NOT_EXIST) {
|
|
|
- if(!storage_simply_mkdir(storage, SAVING_DIRECTORY)) {
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
File* file = storage_file_alloc(storage);
|
|
|
if(storage_file_open(file, SAVING_FILENAME, FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
|
|
|
storage_file_write(file, game_state, sizeof(GameState));
|
|
|
@@ -401,7 +396,7 @@ int32_t game_2048_app() {
|
|
|
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
|
|
|
|
|
|
// Call dolphin deed on game start
|
|
|
- DOLPHIN_DEED(DolphinDeedPluginGameStart);
|
|
|
+ dolphin_deed(DolphinDeedPluginGameStart);
|
|
|
|
|
|
bool is_finished = false;
|
|
|
while(!is_finished) {
|