Skip to content

Commit

Permalink
Adjust the rules of the song scanner for GAX 2.2 (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
loveemu committed Jun 12, 2021
1 parent 3a3fba8 commit d6a5598
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/gaxtapper/gax_song_header_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ std::optional<GaxSongHeaderV2> GaxSongHeaderV2::TryParse(std::string_view rom, s
const agbsize_t sample_offset = to_offset(sample_address);
if (sample_offset + 8 >= rom.size())
return std::nullopt;
if (const agbptr_t sample_ptr = ReadInt32L(&rom[sample_offset]); !is_romptr(sample_ptr))
return std::nullopt;
if (const agbsize_t sample_size = ReadInt32L(&rom[sample_offset + 4]); sample_size != 0)
return std::nullopt;
if (const agbptr_t sample_ptr = ReadInt32L(&rom[sample_offset]); sample_ptr != 0) {
if (!is_romptr(sample_ptr)) return std::nullopt;
if (const agbsize_t sample_size = ReadInt32L(&rom[sample_offset + 4]);
sample_size != 0)
return std::nullopt;
}

const std::uint16_t num_rows_per_pattern = ReadInt16L(&rom[offset + 2]);
const std::uint16_t num_patterns_per_channel = ReadInt16L(&rom[offset + 4]);
Expand Down

0 comments on commit d6a5598

Please sign in to comment.