snd_DvdSoundArchive OK

This commit is contained in:
robojumper
2025-05-25 22:26:16 +02:00
parent e16b0e7289
commit 5a7083ddba
4 changed files with 18 additions and 19 deletions
+1
View File
@@ -2939,6 +2939,7 @@ nw4r/snd/snd_DisposeCallbackManager.cpp:
nw4r/snd/snd_DvdSoundArchive.cpp:
.text start:0x8046BB60 end:0x8046C1C8 align:16
.data start:0x8056DBE8 end:0x8056DC70
nw4r/snd/snd_EnvGenerator.cpp:
.text start:0x8046C1D0 end:0x8046C5A0 align:16
+7 -7
View File
@@ -25209,11 +25209,11 @@ LoadHeader__Q34nw4r3snd15DvdSoundArchiveFPvUl = .text:0x8046BF60; // type:functi
LoadLabelStringData__Q34nw4r3snd15DvdSoundArchiveFPvUl = .text:0x8046BFF0; // type:function size:0x88
Read__Q44nw4r3snd15DvdSoundArchive13DvdFileStreamFPvUl = .text:0x8046C080; // type:function size:0x2C
Seek__Q44nw4r3snd15DvdSoundArchive13DvdFileStreamFlUl = .text:0x8046C0B0; // type:function size:0x80
GetSize__Q44nw4r3snd15DvdSoundArchive13DvdFileStreamCFv = .text:0x8046C130; // type:function size:0x8
Tell__Q44nw4r3snd15DvdSoundArchive13DvdFileStreamCFv = .text:0x8046C140; // type:function size:0x10
detail_GetWaveDataFileAddress__Q34nw4r3snd15DvdSoundArchiveCFUl = .text:0x8046C150; // type:function size:0x8
detail_GetFileAddress__Q34nw4r3snd15DvdSoundArchiveCFUl = .text:0x8046C160; // type:function size:0x8
__dt__Q44nw4r3snd15DvdSoundArchive13DvdFileStreamFv = .text:0x8046C170; // type:function size:0x58
GetSize__Q44nw4r3snd15DvdSoundArchive13DvdFileStreamCFv = .text:0x8046C130; // type:function size:0x8 scope:weak
Tell__Q44nw4r3snd15DvdSoundArchive13DvdFileStreamCFv = .text:0x8046C140; // type:function size:0x10 scope:weak
detail_GetWaveDataFileAddress__Q34nw4r3snd15DvdSoundArchiveCFUl = .text:0x8046C150; // type:function size:0x8 scope:weak
detail_GetFileAddress__Q34nw4r3snd15DvdSoundArchiveCFUl = .text:0x8046C160; // type:function size:0x8 scope:weak
__dt__Q44nw4r3snd15DvdSoundArchive13DvdFileStreamFv = .text:0x8046C170; // type:function size:0x58 scope:weak
__ct__Q44nw4r3snd6detail12EnvGeneratorFv = .text:0x8046C1D0; // type:function size:0x44
Init__Q44nw4r3snd6detail12EnvGeneratorFf = .text:0x8046C220; // type:function size:0x40
Reset__Q44nw4r3snd6detail12EnvGeneratorFf = .text:0x8046C260; // type:function size:0x18
@@ -38591,8 +38591,8 @@ __vt__Q44nw4r3snd6detail19BiquadFilterBpf1024 = .data:0x8056DBA8; // type:object
__vt__Q44nw4r3snd6detail18BiquadFilterBpf512 = .data:0x8056DBB8; // type:object size:0x10
__vt__Q44nw4r3snd6detail15BiquadFilterHpf = .data:0x8056DBC8; // type:object size:0x10
__vt__Q44nw4r3snd6detail15BiquadFilterLpf = .data:0x8056DBD8; // type:object size:0x10
lbl_8056DBE8 = .data:0x8056DBE8; // type:object size:0x68
lbl_8056DC50 = .data:0x8056DC50; // type:object size:0x20
__vt__Q44nw4r3snd15DvdSoundArchive13DvdFileStream = .data:0x8056DBE8; // type:object size:0x64
__vt__Q34nw4r3snd15DvdSoundArchive = .data:0x8056DC50; // type:object size:0x20
lbl_8056DC70 = .data:0x8056DC70; // type:object size:0x28
lbl_8056DC98 = .data:0x8056DC98; // type:object size:0x60
lbl_8056DCF8 = .data:0x8056DCF8; // type:object size:0x20
+1 -1
View File
@@ -1025,7 +1025,7 @@ config.libs = [
Object(NonMatching, "nw4r/snd/snd_Channel.cpp"),
Object(Matching, "nw4r/snd/snd_DisposeCallbackManager.cpp"),
Object(NonMatching, "nw4r/snd/snd_debug.cpp"),
Object(NonMatching, "nw4r/snd/snd_DvdSoundArchive.cpp"),
Object(Matching, "nw4r/snd/snd_DvdSoundArchive.cpp"),
Object(NonMatching, "nw4r/snd/snd_EnvGenerator.cpp"),
Object(NonMatching, "nw4r/snd/snd_ExternalSoundPlayer.cpp"),
Object(NonMatching, "nw4r/snd/snd_FrameHeap.cpp"),
+9 -11
View File
@@ -56,8 +56,10 @@ bool DvdSoundArchive::Open(const char* pPath) {
char extRoot[FILE_PATH_MAX];
for (int i = std::strlen(pPath) - 1; i >= 0; i--) {
if (pPath[i] == '/' || pPath[i] == '\\') {
// @bug Long path can overflow extRoot buffer
if ((pPath[i] == '/' || pPath[i] == '\\')) {
if (i >= FILE_PATH_MAX + 1) {
return false;
}
std::strncpy(extRoot, pPath, i);
extRoot[i] = '\0';
@@ -70,8 +72,10 @@ bool DvdSoundArchive::Open(const char* pPath) {
}
void DvdSoundArchive::Close() {
DVDClose(&mFileInfo);
mOpen = false;
if (mOpen) {
DVDClose(&mFileInfo);
mOpen = false;
}
Shutdown();
}
@@ -115,7 +119,7 @@ bool DvdSoundArchive::LoadFileHeader() {
u8 headerArea[detail::SoundArchiveFile::HEADER_AREA_SIZE];
static const u32 headerAlignSize =
ut::RoundUp(sizeof(detail::SoundArchiveFile::Header), 32);
ROUND_UP(sizeof(detail::SoundArchiveFile::Header), 32);
void* pFile = ut::RoundUp<u8>(headerArea, 32);
@@ -173,9 +177,6 @@ bool DvdSoundArchive::LoadLabelStringData(void* pBuffer, u32 size) {
DvdSoundArchive::DvdFileStream::DvdFileStream(const DVDFileInfo* pFileInfo,
u32 offset, u32 size)
: DvdLockedFileStream(pFileInfo, false), mOffset(offset), mSize(size) {
if (mSize == 0) {
mSize = ut::DvdFileStream::GetSize();
}
ut::DvdFileStream::Seek(mOffset, SEEKORG_BEG);
}
@@ -183,9 +184,6 @@ DvdSoundArchive::DvdFileStream::DvdFileStream(const DVDFileInfo* pFileInfo,
DvdSoundArchive::DvdFileStream::DvdFileStream(s32 entrynum, u32 offset,
u32 size)
: DvdLockedFileStream(entrynum), mOffset(offset), mSize(size) {
if (mSize == 0) {
mSize = ut::DvdFileStream::GetSize();
}
ut::DvdFileStream::Seek(mOffset, SEEKORG_BEG);
}