mirror of
https://github.com/zeldaret/ss
synced 2026-05-25 15:25:13 -04:00
snd_NandSoundArchive OK
This commit is contained in:
@@ -25310,17 +25310,17 @@ Open__Q34nw4r3snd16NandSoundArchiveFPCc = .text:0x8046F930; // type:function siz
|
||||
Close__Q34nw4r3snd16NandSoundArchiveFv = .text:0x8046FAF0; // type:function size:0x4C
|
||||
OpenStream__Q34nw4r3snd16NandSoundArchiveCFPviUlUl = .text:0x8046FB40; // type:function size:0xB8
|
||||
OpenExtStream__Q34nw4r3snd16NandSoundArchiveCFPviPCcUlUl = .text:0x8046FC00; // type:function size:0xDC
|
||||
__dt__Q44nw4r3snd16NandSoundArchive14NandFileStreamFv = .text:0x8046FCE0; // type:function size:0x58
|
||||
__dt__Q44nw4r3snd16NandSoundArchive14NandFileStreamFv = .text:0x8046FCE0; // type:function size:0x58 scope:weak
|
||||
detail_GetRequiredStreamBufferSize__Q34nw4r3snd16NandSoundArchiveCFv = .text:0x8046FD40; // type:function size:0x8
|
||||
LoadFileHeader__Q34nw4r3snd16NandSoundArchiveFv = .text:0x8046FD50; // type:function size:0xBC
|
||||
LoadHeader__Q34nw4r3snd16NandSoundArchiveFPvUl = .text:0x8046FE10; // type:function size:0xB0
|
||||
LoadLabelStringData__Q34nw4r3snd16NandSoundArchiveFPvUl = .text:0x8046FEC0; // type:function size:0xB0
|
||||
Read__Q44nw4r3snd16NandSoundArchive14NandFileStreamFPvUl = .text:0x8046FF70; // type:function size:0x84
|
||||
Seek__Q44nw4r3snd16NandSoundArchive14NandFileStreamFlUl = .text:0x80470000; // type:function size:0x80
|
||||
GetSize__Q44nw4r3snd16NandSoundArchive14NandFileStreamCFv = .text:0x80470080; // type:function size:0x8
|
||||
Tell__Q44nw4r3snd16NandSoundArchive14NandFileStreamCFv = .text:0x80470090; // type:function size:0x10
|
||||
detail_GetWaveDataFileAddress__Q34nw4r3snd16NandSoundArchiveCFUl = .text:0x804700A0; // type:function size:0x8
|
||||
detail_GetFileAddress__Q34nw4r3snd16NandSoundArchiveCFUl = .text:0x804700B0; // type:function size:0x8
|
||||
GetSize__Q44nw4r3snd16NandSoundArchive14NandFileStreamCFv = .text:0x80470080; // type:function size:0x8 scope:weak
|
||||
Tell__Q44nw4r3snd16NandSoundArchive14NandFileStreamCFv = .text:0x80470090; // type:function size:0x10 scope:weak
|
||||
detail_GetWaveDataFileAddress__Q34nw4r3snd16NandSoundArchiveCFUl = .text:0x804700A0; // type:function size:0x8 scope:weak
|
||||
detail_GetFileAddress__Q34nw4r3snd16NandSoundArchiveCFUl = .text:0x804700B0; // type:function size:0x8 scope:weak
|
||||
__ct__Q44nw4r3snd6detail10PlayerHeapFv = .text:0x804700C0; // type:function size:0x30
|
||||
__dt__Q44nw4r3snd6detail10PlayerHeapFv = .text:0x804700F0; // type:function size:0xC4
|
||||
Create__Q44nw4r3snd6detail10PlayerHeapFPvUl = .text:0x804701C0; // type:function size:0x30
|
||||
@@ -38599,8 +38599,8 @@ __vt__Q34nw4r3snd18MemorySoundArchive = .data:0x8056DCF8; // type:object size:0x
|
||||
__vt__Q44nw4r3snd6detail9MmlParser = .data:0x8056DF38; // type:object size:0x10
|
||||
__vt__Q44nw4r3snd6detail11MmlSeqTrack = .data:0x8056DF48; // type:object size:0x10
|
||||
__vt__Q44nw4r3snd6detail20MmlSeqTrackAllocator = .data:0x8056DF58; // type:object size:0x18
|
||||
lbl_8056DF70 = .data:0x8056DF70; // type:object size:0x60
|
||||
lbl_8056DFD0 = .data:0x8056DFD0; // type:object size:0x20
|
||||
__vt__Q44nw4r3snd16NandSoundArchive14NandFileStream = .data:0x8056DF70; // type:object size:0x5C
|
||||
__vt__Q34nw4r3snd16NandSoundArchive = .data:0x8056DFD0; // type:object size:0x20
|
||||
__vt__Q44nw4r3snd6detail10PlayerHeap = .data:0x8056DFF0; // type:object size:0x10
|
||||
@4081 = .data:0x8056E000; // type:object size:0xC scope:local data:4byte
|
||||
@4096 = .data:0x8056E00C; // type:object size:0xC scope:local data:4byte
|
||||
@@ -42427,8 +42427,8 @@ typeInfo__Q44nw4r3snd6detail10BasicSound = .sbss:0x80576678; // type:object size
|
||||
@GUARD@GetInstance__Q44nw4r3snd6detail14ChannelManagerFv@instance = .sbss:0x80576680; // type:object size:0x1 scope:weak data:byte
|
||||
@GUARD@GetInstance__Q44nw4r3snd6detail22DisposeCallbackManagerFv@instance = .sbss:0x80576688; // type:object size:0x1 scope:weak data:byte
|
||||
mPrintVarEnabledFlag__Q44nw4r3snd6detail9MmlParser = .sbss:0x80576690; // type:object size:0x1 data:byte
|
||||
lbl_80576698 = .sbss:0x80576698; // type:object size:0x4 data:4byte
|
||||
lbl_8057669C = .sbss:0x8057669C; // type:object size:0x1 data:byte
|
||||
@LOCAL@LoadFileHeader__Q34nw4r3snd16NandSoundArchiveFv@headerAlignSize = .sbss:0x80576698; // type:object size:0x4 scope:weak data:4byte
|
||||
@GUARD@LoadFileHeader__Q34nw4r3snd16NandSoundArchiveFv@headerAlignSize = .sbss:0x8057669C; // type:object size:0x1 scope:weak data:byte
|
||||
@GUARD@GetInstance__Q44nw4r3snd6detail20RemoteSpeakerManagerFv@instance = .sbss:0x805766A0; // type:object size:0x1 scope:weak data:byte
|
||||
typeInfo__Q44nw4r3snd6detail8SeqSound = .sbss:0x805766A8; // type:object size:0x4 data:4byte
|
||||
@GUARD@detail_SortPriorityList__Q34nw4r3snd11SoundPlayerFv@tmplist = .sbss:0x805766B0; // type:object size:0x1 scope:weak data:byte
|
||||
|
||||
+1
-1
@@ -1043,7 +1043,7 @@ config.libs = [
|
||||
Object(Matching, "nw4r/snd/snd_MmlParser.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_MmlSeqTrack.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_MmlSeqTrackAllocator.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_NandSoundArchive.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_NandSoundArchive.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_PlayerHeap.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_RemoteSpeaker.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_RemoteSpeakerManager.cpp"),
|
||||
|
||||
@@ -47,22 +47,48 @@ bool NandSoundArchive::Open(const char* pPath) {
|
||||
return false;
|
||||
}
|
||||
|
||||
char currentDir[64];
|
||||
NANDGetCurrentDir(currentDir);
|
||||
u32 currDirLen = std::strlen(currentDir);
|
||||
|
||||
char extRoot[FILE_PATH_MAX];
|
||||
std::strncpy(extRoot, currentDir, currDirLen + 1);
|
||||
|
||||
for (int i = std::strlen(pPath) - 1; i >= 0; i--) {
|
||||
if (pPath[i] == '/' || pPath[i] == '\\') {
|
||||
// @bug Long path can overflow extRoot buffer
|
||||
std::strncat(extRoot, pPath, i);
|
||||
extRoot[currDirLen + i] = '\0';
|
||||
break;
|
||||
char *pExtRoot = extRoot;
|
||||
// UB: (?) Array index 256 is past the end of the array
|
||||
char *pEnd = &extRoot[FILE_PATH_MAX + 1];
|
||||
if (pPath[0] != '/' && pPath[0] != '\\') {
|
||||
char currentDir[64];
|
||||
if (NANDGetCurrentDir(currentDir) != NAND_RESULT_OK) {
|
||||
return false;
|
||||
}
|
||||
|
||||
char *pCurrentDir = currentDir;
|
||||
while (*pCurrentDir != '\0') {
|
||||
if (pExtRoot >= pEnd) {
|
||||
return false;
|
||||
}
|
||||
*pExtRoot++ = *pCurrentDir++;
|
||||
}
|
||||
if (pExtRoot >= pEnd) {
|
||||
return false;
|
||||
}
|
||||
*pExtRoot++ = '/';
|
||||
}
|
||||
|
||||
const char *pPath2 = pPath;
|
||||
const char *p3 = pPath;
|
||||
while (*pPath2 != '\0') {
|
||||
if (*pPath2 == '/' || *pPath2 == '\\') {
|
||||
while (p3 < pPath2) {
|
||||
if (pExtRoot >= pEnd) {
|
||||
return false;
|
||||
}
|
||||
*pExtRoot++ = *p3++;
|
||||
}
|
||||
}
|
||||
pPath2++;
|
||||
}
|
||||
|
||||
|
||||
if (pExtRoot >= pEnd) {
|
||||
return false;
|
||||
}
|
||||
*pExtRoot = '\0';
|
||||
SetExternalFileRoot(extRoot);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user