Skip to content

Commit

Permalink
Fixed RAW score length
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Zoppi <[email protected]>
  • Loading branch information
TexZK committed Mar 14, 2024
1 parent 805ff60 commit a8a7bc2
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/aymo_score_dro.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ int aymo_score_dro_load(
if (size < sizeof(struct aymo_score_dro_header)) {
return 1;
}
const uint8_t* ptr = (const uint8_t*)data;
const uint8_t* ptr = data;
const struct aymo_score_dro_header* header = NULL;
header = (const struct aymo_score_dro_header*)(const void*)ptr;
ptr += sizeof(struct aymo_score_dro_header);
Expand Down
2 changes: 1 addition & 1 deletion src/aymo_score_imf.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ int aymo_score_imf_load_specific(
score->type = type;

if (type) {
const uint8_t* ptr = (const uint8_t*)data;
const uint8_t* ptr = data;
uint32_t length_by_header = (ptr[0] | ((uint16_t)ptr[1] << 8u));
length_by_header /= sizeof(struct aymo_score_imf_event);
score->length = length_by_header;
Expand Down
8 changes: 3 additions & 5 deletions src/aymo_score_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static void aymo_score_raw_update_clock(
)
{
score->clock += (uint16_t)(score->clock == 0u);
score->raw_rate = (AYMO_SCORE_RAW_REFCLK / score->clock);
score->raw_rate = (AYMO_SCORE_RAW_REFCLK / score->clock); // TODO: improve resolution via fixed point 24.8
score->division = (AYMO_SCORE_OPL_RATE_DEFAULT / score->raw_rate); // TODO: improve resolution via fixed point 24.8
score->division += (uint32_t)(score->division == 0u);
}
Expand Down Expand Up @@ -89,7 +89,7 @@ int aymo_score_raw_load(
if (size < sizeof(struct aymo_score_raw_header)) {
return 1;
}
const uint8_t* ptr = (const uint8_t*)data;
const uint8_t* ptr = data;

if (((ptr[0] != 'R') ||
(ptr[1] != 'A') ||
Expand All @@ -106,9 +106,7 @@ int aymo_score_raw_load(

uint32_t length_by_size = (uint32_t)(size - sizeof(struct aymo_score_raw_header));
length_by_size /= sizeof(struct aymo_score_raw_event);
if (score->length > length_by_size) {
score->length = length_by_size;
}
score->length = length_by_size;

aymo_score_raw_restart(score);
return 0;
Expand Down
6 changes: 3 additions & 3 deletions tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,10 @@ endforeach

# [[format, path], ...]
aymo_ymf262_compare_suite = [
# ['raw', '../contrib/adplug/test/testmus/crusader.raw'],
['dro', '../contrib/adplug/test/testmus/doofus.dro'],
['raw', '../contrib/adplug/test/testmus/crusader.raw'],
# ['dro', '../contrib/adplug/test/testmus/doofus.dro'], # FIXME:
['dro', '../contrib/adplug/test/testmus/dro_v2.dro'],
# ['raw', '../contrib/adplug/test/testmus/inc.raw'],
# ['raw', '../contrib/adplug/test/testmus/inc.raw'], # FIXME:
['dro', '../contrib/adplug/test/testmus/samurai.dro'],
['imf', '../contrib/adplug/test/testmus/WONDERIN.WLF'],
]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_convert_prologue_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ const float* compare_f32(const float* bufp, const float* refp, size_t len, float

const void* compare_dirty(const void* bufp, uint8_t refv, size_t size)
{
const uint8_t* sp = (const uint8_t*)bufp;
const uint8_t* sp = bufp;
const uint8_t* ep = (sp + size);
while (sp != ep) {
if (*sp != refv) {
Expand Down

0 comments on commit a8a7bc2

Please sign in to comment.