Skip to content

Commit

Permalink
B4DS: Read music pack from fat:/_nds/nds-bootstrap/musicPacks/
Browse files Browse the repository at this point in the history
Filename must have the TID and CRC from ROM's header

Example name: `KS3E-57FE.pck`
  • Loading branch information
RocketRobz committed Sep 16, 2022
1 parent 93b9528 commit 079dfc9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions retail/arm9/source/conf_sd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,11 +424,6 @@ int loadFromSD(configuration* conf, const char *bootstrapPath) {
mkdir("fat:/_nds/nds-bootstrap/patchOffsetCache", 0777);
}

if (!dsiFeatures() || (conf->b4dsMode && conf->gameOnFlashcard)) {
musicsFilePath = "fat:/_nds/nds-bootstrap/music.pck";
conf->musicsSize = getFileSize(musicsFilePath.c_str());
}

pageFilePath = "sd:/_nds/pagefile.sys";
if (conf->b4dsMode || !conf->sdFound) {
pageFilePath = "fat:/_nds/pagefile.sys";
Expand Down Expand Up @@ -1340,6 +1335,11 @@ int loadFromSD(configuration* conf, const char *bootstrapPath) {
} else {
toncset16((u16*)IMAGES_LOCATION, 0, 256*192);
}

sprintf(patchOffsetCacheFilePath, "fat:/_nds/nds-bootstrap/musicPacks/%s-%04X.pck", romTid, headerCRC);

musicsFilePath = patchOffsetCacheFilePath;
conf->musicsSize = getFileSize(patchOffsetCacheFilePath);
}

const char *typeToReplace = ".nds";
Expand Down
4 changes: 2 additions & 2 deletions retail/bootloader/source/arm7/main.arm7.c
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ int arm7_main(void) {
}

aFile musicsFile = getFileFromCluster(musicCluster);
if (musicCluster != 0 && memcmp(romTid, "KS3", 3) == 0) {
if (musicCluster != 0) {
dbg_printf("Music pack found!\n");
}

Expand Down Expand Up @@ -1060,7 +1060,7 @@ int arm7_main(void) {
tonccpy((u32*)fatTableAddr, (u32*)0x037F8000, savFile.fatTableCacheSize);
savFile.fatTableCache = (u32*)fatTableAddr;
}
if (musicCluster != 0 && memcmp(romTid, "KS3", 3) == 0) {
if (musicCluster != 0) {
lastClusterCacheUsed = (u32*)0x037F8000;
clusterCache = 0x037F8000;
clusterCacheSize = (startMem ? 0x4000 : 0x1A000)-savFile.fatTableCacheSize;
Expand Down

0 comments on commit 079dfc9

Please sign in to comment.