Skip to content

Conversation

@JuanJakobo
Copy link

What's new

Verification

  • Open App and close it after moving a little bit around, reopen it and the state should be as before.
  • Close the App when GameOver Screen is shown. The Game should restart normal.
  • Crash the snake and see if the highscore is shown. Do it again with an higher score and see if it increased, further do it with a lower score to verify if it stays the same.

Checklist (For Reviewer)

  • PR has description of feature/bug or link to Confluence/Jira task
  • Description contains actions to verify feature/bugfix
  • I've built this code, uploaded it to the device and verified feature/bugfix

@skotopes
Copy link
Contributor

@DrZlo13 is currently formalizing rules for ext apps storage layout. He'll be reviewer for this PR

@skotopes skotopes added Applications Non-core applications New Feature Contains an IMPLEMENTATION of a new feature labels Oct 28, 2022
@DrZlo13
Copy link
Member

DrZlo13 commented Nov 8, 2022

@JuanJakobo Hello!
I am now busy formalizing the rules for placing user files and supporting these rules in the firmware. It's enough for me for now if you put this file in "/ext/apps_data/snake_game".

@JuanJakobo
Copy link
Author

@DrZlo13 Hi,
I moved the file storage to "/ext/apps_data/snake_game".

@skotopes
Copy link
Contributor

@DrZlo13 please review.

} else {
if(storage_common_stat(storage, APPS_DATA, NULL) == FSE_NOT_EXIST) {
if(!storage_simply_mkdir(storage, APPS_DATA)) {
return NULL;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to leak file if something will go wrong here.
Whole way of working with file looks quite dangerous, please check how it's done in other apps.

}

static FlipperFormat* snake_game_open_file() {
Storage* storage = furi_record_open(RECORD_STORAGE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opening and closing storage record doesn't looks good here. The best option is to do it in allocator/deallocator of snake app itself and then pass it here.

}
if(storage_common_stat(storage, SNAKE_GAME_FILE_DIR_PATH, NULL) == FSE_NOT_EXIST) {
if(!storage_simply_mkdir(storage, SNAKE_GAME_FILE_DIR_PATH)) {
return NULL;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leak here too

if(!flipper_format_read_header(file, file_type, &version)) {
furi_string_free(file_type);
snake_game_close_file(file);
return false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually do {} while(0) and break. Please check how other apps do that

@skotopes skotopes marked this pull request as draft December 12, 2022 17:50
@skotopes
Copy link
Contributor

Please un-draft when ready ;-) And let me know if you need any help

@JuanJakobo JuanJakobo closed this by deleting the head repository Jan 9, 2023
@fennectech
Copy link

I can't tell whether this means it was merged or is dead.

@skotopes
Copy link
Contributor

@fennectech dead, PR was closed before merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Applications Non-core applications New Feature Contains an IMPLEMENTATION of a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants