Skip to content

Commit

Permalink
check device id in header
Browse files Browse the repository at this point in the history
  • Loading branch information
Daft-Freak committed May 22, 2023
1 parent b151a27 commit ec3a515
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 @@ -126,7 +126,7 @@ static bool parse_file_metadata(FIL &fh, GameInfo &info) {
BlitGameHeader header;
f_read(&fh, &header, sizeof(header), &bytes_read);

if(header.magic != blit_game_magic)
if(header.magic != blit_game_magic || (header.device_id != BlitDevice::STM32BlitOld && header.device_id != BlitDevice::STM32Blit))
return false;

info.size = header.end - qspi_flash_address;
Expand Down Expand Up @@ -184,7 +184,7 @@ static bool read_flash_game_header(uint32_t offset, BlitGameHeader &header) {
if(qspi_read_buffer(offset, reinterpret_cast<uint8_t *>(&header), sizeof(header)) != QSPI_OK)
return false;

if(header.magic != blit_game_magic)
if(header.magic != blit_game_magic || (header.device_id != BlitDevice::STM32BlitOld && header.device_id != BlitDevice::STM32Blit))
return false;

// make sure end/size is sensible
Expand Down

0 comments on commit ec3a515

Please sign in to comment.