snd_SoundArchivePlayer not OK (instruction scheduling)

This commit is contained in:
robojumper
2025-05-26 23:50:15 +02:00
parent 62b35d8629
commit b4a79946bf
4 changed files with 42 additions and 6 deletions
+2
View File
@@ -3060,6 +3060,8 @@ nw4r/snd/snd_SoundArchiveLoader.cpp:
nw4r/snd/snd_SoundArchivePlayer.cpp:
.text start:0x80478560 end:0x8047B018 align:16
.data start:0x8056E1B0 end:0x8056E200
.sdata2 start:0x8057F138 end:0x8057F148
nw4r/snd/snd_SoundHandle.cpp:
.text start:0x8047B020 end:0x8047B110 align:16
+2 -2
View File
@@ -21804,8 +21804,8 @@ fn_803A18B0 = .text:0x803A18B0; // type:function size:0xF0
fn_803A19A0 = .text:0x803A19A0; // type:function size:0x2B0
fn_803A1C50 = .text:0x803A1C50; // type:function size:0xC
fn_803A1C60 = .text:0x803A1C60; // type:function size:0xC
fn_803A1C70 = .text:0x803A1C70; // type:function size:0xC
fn_803A1C80 = .text:0x803A1C80; // type:function size:0x14
AXFXSetHooks = .text:0x803A1C70; // type:function size:0xC
AXFXGetHooks = .text:0x803A1C80; // type:function size:0x14
PPCMfmsr = .text:0x803A1CA0; // type:function size:0x8 scope:global
PPCMtmsr = .text:0x803A1CB0; // type:function size:0x8 scope:global
PPCMfhid0 = .text:0x803A1CC0; // type:function size:0x8 scope:global
+6 -2
View File
@@ -55,8 +55,8 @@ namespace nw4r { namespace snd
public:
// virtual function ordering
// vtable SoundArchivePlayer_FileManager
virtual void const *at_0x08(int) = 0;
virtual void const *at_0x0c(int) = 0;
virtual void const *GetFileAddress(u32) = 0;
virtual void const *GetFileWaveDataAddress(u32) = 0;
// members
private:
@@ -98,6 +98,8 @@ namespace nw4r { namespace snd
{
}
virtual ~SeqNoteOnCallback() {}
// virtual function ordering
// vtable NoteOnCallback
virtual detail::Channel *NoteOn(
@@ -176,6 +178,8 @@ namespace nw4r { namespace snd
return LoadGroup(static_cast<u32>(id), pAllocatable, blockSize);
}
bool IsLoadedGroup(u32 groupId) const;
SoundArchive const &GetSoundArchive() const;
u32 GetSoundPlayerCount() const { return mSoundPlayerCount; }
SoundPlayer &GetSoundPlayer(u32 playerId);
+32 -2
View File
@@ -517,16 +517,18 @@ SoundPlayer &SoundArchivePlayer::GetSoundPlayer(u32 playerId)
return mSoundPlayers[playerId];
}
#if 0
/* SoundArchivePlayer::GetSoundPlayer(char const *)
* ([R89JEL]:/bin/RVL/Debug/mainD.MAP:14216)
*/
DECOMP_FORCE(NW4RAssertPointerNonnull_String(mSoundArchive));
#endif
void const *SoundArchivePlayer::detail_GetFileAddress(u32 fileId) const
{
if (mFileManager)
{
if (void const *addr = mFileManager->at_0x08(fileId))
if (void const *addr = mFileManager->GetFileAddress(fileId))
return addr;
}
@@ -567,7 +569,7 @@ void const *SoundArchivePlayer::detail_GetFileWaveDataAddress(u32 fileId) const
{
if (mFileManager)
{
if (void const *addr = mFileManager->at_0x0c(fileId))
if (void const *addr = mFileManager->GetFileWaveDataAddress(fileId))
return addr;
}
@@ -621,9 +623,19 @@ void const *SoundArchivePlayer::GetGroupAddress(u32 groupId) const
return mGroupTable->item[groupId].address;
}
#if 0
// SoundArchivePlayer::SetGroupAddress ([R89JEL]:/bin/RVL/Debug/mainD.MAP:14220)
DECOMP_FORCE("Failed to SoundArchivePlayer::SetGroupAddress because group "
"table is not allocated.\n");
#endif
void SoundArchivePlayer::SetGroupAddress(u32 id, const void* pAddr)
{
if (mGroupTable == NULL)
return;
mGroupTable->item[id].address = pAddr;
}
void const *SoundArchivePlayer::GetGroupWaveDataAddress(u32 groupId) const
{
@@ -643,6 +655,15 @@ void const *SoundArchivePlayer::GetGroupWaveDataAddress(u32 groupId) const
return mGroupTable->item[groupId].waveDataAddress;
}
void SoundArchivePlayer::SetGroupWaveDataAddress(u32 id, const void* pAddr)
{
if (mGroupTable == NULL)
return;
mGroupTable->item[id].waveDataAddress = pAddr;
}
#if 0
/* SoundArchivePlayer::SetGroupWaveDataAddress
* ([R89JEL]:/bin/RVL/Debug/mainD.MAP:14222)
*/
@@ -660,6 +681,7 @@ DECOMP_FORCE("Failed to SoundArchivePlayer::SetFileAddress because file table "
DECOMP_FORCE(NW4RAssertHeaderClampedLValue_String(fileId));
DECOMP_FORCE("Failed to SoundArchivePlayer::SetFileWaveDataAddress because "
"file table is not allocated.\n");
#endif
void const *SoundArchivePlayer::GetFileAddress(u32 fileId) const
{
@@ -1323,10 +1345,12 @@ void SoundArchivePlayer::UpdateCommonSoundParam(
sound->SetPanCurve(commonInfo->panCurve);
}
#if 0
/* SoundArchivePlayer::LoadGroup(u32, SoundMemoryAllocatable *, u32)
* ([R89JEL]:/bin/RVL/Debug/mainD.MAP:14234)
*/
DECOMP_FORCE(NW4RAssertAligned_String(loadBlockSize, 32));
#endif
bool SoundArchivePlayer::LoadGroup(u32 id, SoundMemoryAllocatable* pAllocatable,
u32 blockSize) {
@@ -1373,6 +1397,12 @@ bool SoundArchivePlayer::LoadGroup(const char* pLabel,
return LoadGroup(id, pAllocatable, blockSize);
}
bool SoundArchivePlayer::IsLoadedGroup(u32 groupId) const
{
void const *groupAddress = GetGroupAddress(groupId);
return groupAddress != NULL;
}
void SoundArchivePlayer::InvalidateData(void const *start, void const *end)
{
if (mFileTable)