Overlord: Music tweak struct. (#509)

This commit is contained in:
Ziemas 2021-05-21 00:10:27 +02:00 committed by GitHub
parent 0c751dd13e
commit 62877ed4f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 7 deletions

View file

@ -354,10 +354,10 @@ void LoadMusicTweaks(u8* buffer) {
MakeISOName(iso_name, "TWEAKVAL.MUS");
FileRecord* fr = FS_FindIN(iso_name);
if (!fr || !ReadSectorsNow(fr->location, 1, buffer)) {
*(s32*)gMusicTweakInfo = 0;
gMusicTweakInfo.TweakCount = 0;
lg::warn("[OVERLORD ISO CD] Failed to load music tweaks!");
} else {
memcpy(gMusicTweakInfo, buffer, MUSIC_TWEAK_SIZE);
memcpy((void*)&gMusicTweakInfo, buffer, sizeof(MusicTweaks));
}
}

View file

@ -1,8 +1,8 @@
#include <cstring>
#include "srpc.h"
u8 gMusicTweakInfo[0x204];
MusicTweaks gMusicTweakInfo;
void srpc_init_globals() {
memset(gMusicTweakInfo, 0, sizeof(gMusicTweakInfo));
}
memset((void*)&gMusicTweakInfo, 0, sizeof(gMusicTweakInfo));
}

View file

@ -7,7 +7,17 @@
void srpc_init_globals();
constexpr int MUSIC_TWEAK_SIZE = 0x204;
extern u8 gMusicTweakInfo[MUSIC_TWEAK_SIZE];
constexpr int MUSIC_TWEAK_COUNT = 32;
struct MusicTweaks {
u32 TweakCount;
struct {
char MusicName[12];
u32 VolumeAdjust;
} MusicTweak[MUSIC_TWEAK_COUNT];
};
extern MusicTweaks gMusicTweakInfo;
#endif // JAK_V2_SRPC_H