Skip to content

Commit 320af36

Browse files
committed
reimplement: SHC_3BB0A8C1_0x00479B70 experiment with bitfields
1 parent c6647a9 commit 320af36

2 files changed

Lines changed: 11 additions & 13 deletions

File tree

src/OpenSHC/Audio/SoundSystem/meth_0x479b70.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,15 @@ namespace Audio {
1111
return;
1212
}
1313

14-
if ((*((unsigned int*)&this->streamFlagsUnkAndLoopCount_0x34[3]) & 0x20000000)
15-
&& this->streamActiveUnk_0x20[3] && AIL_stream_status(this->stream_0xc[3]) != SMP_PLAYING) {
16-
unsigned int const copyWithoutFlag
17-
= *((unsigned int*)&this->streamFlagsUnkAndLoopCount_0x34[3]) & 0xdfffffff;
18-
this->streamFlagsUnkAndLoopCount_0x34[3] = *((UnkSoundFlagsAndLoopCount*)&copyWithoutFlag);
14+
if (this->streamFlagsUnkAndLoopCount_0x34[3].unknownFlag1 && this->streamActiveUnk_0x20[3]
15+
&& AIL_stream_status(this->stream_0xc[3]) != SMP_PLAYING) {
16+
this->streamFlagsUnkAndLoopCount_0x34[3].unknownFlag1 = false;
1917
AIL_set_sample_volume(
2018
this->musicSampleUnk_0x170, (this->streamVolume[0] * this->streamFileVolumeNextUnk_0x48[0]) / 100);
2119
}
22-
if ((*((unsigned int*)&this->streamFlagsUnkAndLoopCount_0x34[4]) & 0x20000000)
23-
&& this->streamActiveUnk_0x20[4] && AIL_stream_status(this->stream_0xc[4]) != SMP_PLAYING) {
24-
unsigned int const copyWithoutFlag
25-
= *((unsigned int*)&this->streamFlagsUnkAndLoopCount_0x34[4]) & 0xdfffffff;
26-
this->streamFlagsUnkAndLoopCount_0x34[4] = *((UnkSoundFlagsAndLoopCount*)&copyWithoutFlag);
20+
if (this->streamFlagsUnkAndLoopCount_0x34[4].unknownFlag1 && this->streamActiveUnk_0x20[4]
21+
&& AIL_stream_status(this->stream_0xc[4]) != SMP_PLAYING) {
22+
this->streamFlagsUnkAndLoopCount_0x34[4].unknownFlag1 = false;
2723
AIL_set_sample_volume(
2824
this->musicSampleUnk_0x170, (this->streamVolume[0] * this->streamFileVolumeNextUnk_0x48[0]) / 100);
2925
}

src/OpenSHC/Audio/mss/UnkSoundFlagsAndLoopCount.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ namespace Audio {
1616
// SIZE: 0x00000004
1717
typedef struct UnkSoundFlagsAndLoopCount {
1818

19-
ushort loopCount; // 0x00000000 length: 2
20-
undefined1 padding_0x2[1]; // 0x00000002 length: 1
21-
byte flagsUnk; // 0x00000003 length: 1
19+
int loopCount : 16;
20+
int reserved : 13;
21+
int unknownFlag1 : 1;
22+
int unknownFlag2 : 1;
23+
int uninterruptable : 1;
2224

2325
} UnkSoundFlagsAndLoopCount;
2426
#pragma pack(pop)

0 commit comments

Comments
 (0)