Skip to content

Commit

Permalink
SMCONV fix
Browse files Browse the repository at this point in the history
soundbank.asm now fill banks with HiROM mapping, following -i usage. This is necessary or sound will be broken.
  • Loading branch information
DigiDwrf committed Apr 10, 2024
1 parent 47e194d commit bce77f3
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions tools/smconv/it2spc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,14 @@ namespace IT2SPC
"\n",
size);

if (size <= 32768)
int banksize;

if (HiROM)
banksize = 65536;
else
banksize = 32768;

if (size <= banksize)
{
fprintf(f,
".BANK %i\n"
Expand All @@ -1035,7 +1042,7 @@ namespace IT2SPC
}
else
{
u32 lastbank = size / 32768;
u32 lastbank = size / banksize;
for (u32 j = 0; j <= lastbank; j++)
{
fprintf(f,
Expand All @@ -1057,12 +1064,22 @@ namespace IT2SPC
// if( ffo != std::string::npos )
// foo = foo.substr( ffo + 1 );

if (j == 0)
fprintf(f, ".incbin \"%s\" read $8000\n", foo.c_str());
else if (j == lastbank)
fprintf(f, ".incbin \"%s\" skip $%x\n", foo.c_str(), j * 0x8000);
else
fprintf(f, ".incbin \"%s\" skip $%x read $8000\n", foo.c_str(), j * 0x8000);
if (HiROM) {
if (j == 0)
fprintf(f, ".incbin \"%s\" read $10000\n", foo.c_str());
else if (j == lastbank)
fprintf(f, ".incbin \"%s\" skip $%x\n", foo.c_str(), j * 0x10000);
else
fprintf(f, ".incbin \"%s\" skip $%x read $10000\n", foo.c_str(), j * 0x10000);
}
else {
if (j == 0)
fprintf(f, ".incbin \"%s\" read $8000\n", foo.c_str());
else if (j == lastbank)
fprintf(f, ".incbin \"%s\" skip $%x\n", foo.c_str(), j * 0x8000);
else
fprintf(f, ".incbin \"%s\" skip $%x read $8000\n", foo.c_str(), j * 0x8000);
}

fprintf(f, ".ENDS\n\n");
}
Expand Down

0 comments on commit bce77f3

Please sign in to comment.