Skip to content

Commit

Permalink
Merge pull request #278 from DigiDwrf/develop
Browse files Browse the repository at this point in the history
SMCONV fix
  • Loading branch information
alekmaul authored Apr 10, 2024
2 parents f39d91d + bce77f3 commit 5f7d0e2
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 5f7d0e2

Please sign in to comment.