Skip to content

Commit

Permalink
Merge pull request #475 from Daft-Freak/patch-2
Browse files Browse the repository at this point in the history
Fix free space check
  • Loading branch information
Gadgetoid authored Dec 19, 2020
2 parents 9c0c82d + 4e7e6d5 commit 824f7af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions firmware/firmware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ void scan_flash() {
} else {
// fallback "title"
game.title.resize(20);
snprintf(game.title.data(), 20, "game@%i", int(game.offset / qspi_flash_sector_size));
game.title.resize(snprintf(game.title.data(), 20, "game@%i", int(game.offset / qspi_flash_sector_size)));
}

game_list.push_back(game);
Expand Down Expand Up @@ -595,7 +595,7 @@ uint32_t get_flash_offset_for_file(uint32_t file_size) {
int file_blocks = calc_num_blocks(file_size);

for(auto space : free_space) {
if(std::get<1>(space) <= file_blocks)
if(std::get<1>(space) >= file_blocks)
return std::get<0>(space) * qspi_flash_sector_size;
}

Expand Down

0 comments on commit 824f7af

Please sign in to comment.