mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-14 10:18:35 -07:00
Move jetpack joyride save
This commit is contained in:
10
applications/external/jetpack_joyride/jetpack.c
vendored
10
applications/external/jetpack_joyride/jetpack.c
vendored
@@ -18,8 +18,7 @@
|
|||||||
#include "includes/game_state.h"
|
#include "includes/game_state.h"
|
||||||
|
|
||||||
#define TAG "Jetpack Joyride"
|
#define TAG "Jetpack Joyride"
|
||||||
#define SAVING_DIRECTORY "/ext/apps/Games"
|
#define SAVING_FILENAME APP_DATA_PATH("jetpack.save")
|
||||||
#define SAVING_FILENAME SAVING_DIRECTORY "/jetpack.save"
|
|
||||||
static GameState* global_state;
|
static GameState* global_state;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@@ -41,6 +40,7 @@ static SaveGame save_game;
|
|||||||
|
|
||||||
static bool storage_game_state_load() {
|
static bool storage_game_state_load() {
|
||||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||||
|
storage_common_migrate(storage, EXT_PATH("apps/Games/jetpack.save"), SAVING_FILENAME);
|
||||||
File* file = storage_file_alloc(storage);
|
File* file = storage_file_alloc(storage);
|
||||||
|
|
||||||
uint16_t bytes_readed = 0;
|
uint16_t bytes_readed = 0;
|
||||||
@@ -55,12 +55,6 @@ static bool storage_game_state_load() {
|
|||||||
static void storage_game_state_save() {
|
static void storage_game_state_save() {
|
||||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
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);
|
File* file = storage_file_alloc(storage);
|
||||||
if(storage_file_open(file, SAVING_FILENAME, FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
|
if(storage_file_open(file, SAVING_FILENAME, FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
|
||||||
storage_file_write(file, &save_game, sizeof(SaveGame));
|
storage_file_write(file, &save_game, sizeof(SaveGame));
|
||||||
|
|||||||
Reference in New Issue
Block a user