diff options
| author | briaguya <briaguya@alice> | 2023-03-14 00:29:30 -0400 |
|---|---|---|
| committer | briaguya <briaguya@alice> | 2023-03-14 00:29:30 -0400 |
| commit | 2bd8316d5492521711be7f10d54e174c3371c06d (patch) | |
| tree | 4aadc5dd363f495a5b5c1f667e31f9f812855e8f /soh/src/code | |
| parent | 866882e4c6c931065c646f3b279f2ac204f54b0d (diff) | |
| parent | 264623f40ac2a79fe7afd7818266a8f0f55ec2c2 (diff) | |
Merge remote-tracking branch 'hm/develop-khan' into khan-to-dev
Diffstat (limited to 'soh/src/code')
| -rw-r--r-- | soh/src/code/audio_heap.c | 2 | ||||
| -rw-r--r-- | soh/src/code/audio_load.c | 12 | ||||
| -rw-r--r-- | soh/src/code/audio_seqplayer.c | 2 | ||||
| -rw-r--r-- | soh/src/code/z_sram.c | 4 |
4 files changed, 11 insertions, 9 deletions
diff --git a/soh/src/code/audio_heap.c b/soh/src/code/audio_heap.c index 72c1c8870..8d0e97fa3 100644 --- a/soh/src/code/audio_heap.c +++ b/soh/src/code/audio_heap.c @@ -53,7 +53,7 @@ void AudioHeap_ResetLoadStatus(void) { } } - for (i = 0; i < MAX_SEQUENCES; i++) { + for (i = 0; i < sequenceMapSize; i++) { if (gAudioContext.seqLoadStatus[i] != 5) { gAudioContext.seqLoadStatus[i] = 0; } diff --git a/soh/src/code/audio_load.c b/soh/src/code/audio_load.c index 81d395a81..eb788fd0c 100644 --- a/soh/src/code/audio_load.c +++ b/soh/src/code/audio_load.c @@ -77,7 +77,8 @@ void* sUnusedHandler = NULL; s32 gAudioContextInitalized = false; -char* sequenceMap[MAX_SEQUENCES]; +char** sequenceMap; +size_t sequenceMapSize; // A map of authentic sequence IDs to their cache policies, for use with sequence swapping. u8 seqCachePolicyMap[MAX_AUTHENTIC_SEQID]; char* fontMap[256]; @@ -488,7 +489,7 @@ u8* AudioLoad_GetFontsForSequence(s32 seqId, u32* outNumFonts) { return NULL; u16 newSeqId = AudioEditor_GetReplacementSeq(seqId); - if (newSeqId > MAX_SEQUENCES || !sequenceMap[newSeqId]) { + if (newSeqId > sequenceMapSize || !sequenceMap[newSeqId]) { return NULL; } SequenceData sDat = ResourceMgr_LoadSeqByName(sequenceMap[newSeqId]); @@ -1342,7 +1343,12 @@ void AudioLoad_Init(void* heap, size_t heapSize) { AudioHeap_ResetStep(); int seqListSize = 0; + int customSeqListSize = 0; char** seqList = ResourceMgr_ListFiles("audio/sequences*", &seqListSize); + char** customSeqList = ResourceMgr_ListFiles("custom/music/*", &customSeqListSize); + sequenceMapSize = (size_t)(seqListSize + customSeqListSize); + sequenceMap = malloc(sequenceMapSize * sizeof(char*)); + gAudioContext.seqLoadStatus = malloc(sequenceMapSize * sizeof(char*)); for (size_t i = 0; i < seqListSize; i++) { @@ -1357,9 +1363,7 @@ void AudioLoad_Init(void* heap, size_t heapSize) { free(seqList); - int customSeqListSize = 0; int startingSeqNum = MAX_AUTHENTIC_SEQID; // 109 is the highest vanilla sequence - char** customSeqList = ResourceMgr_ListFiles("custom/music/*", &customSeqListSize); qsort(customSeqList, customSeqListSize, sizeof(char*), strcmp_sort); for (size_t i = startingSeqNum; i < startingSeqNum + customSeqListSize; i++) { diff --git a/soh/src/code/audio_seqplayer.c b/soh/src/code/audio_seqplayer.c index 0b5192b0b..9e9ee645c 100644 --- a/soh/src/code/audio_seqplayer.c +++ b/soh/src/code/audio_seqplayer.c @@ -3,7 +3,7 @@ #include <libultraship/libultra.h> #include "global.h" -extern char* sequenceMap[MAX_SEQUENCES]; +extern char** sequenceMap; #define PORTAMENTO_IS_SPECIAL(x) ((x).mode & 0x80) #define PORTAMENTO_MODE(x) ((x).mode & ~0x80) diff --git a/soh/src/code/z_sram.c b/soh/src/code/z_sram.c index 101cd7d03..3c8b0e74c 100644 --- a/soh/src/code/z_sram.c +++ b/soh/src/code/z_sram.c @@ -299,9 +299,7 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) { gSaveContext.playerName[offset] = Save_GetSaveMetaInfo(fileChooseCtx->buttonIndex)->playerName[offset]; } - if (fileChooseCtx->questType[fileChooseCtx->buttonIndex] == 2 && strnlen(CVarGetString("gSpoilerLog", ""), 1) != 0 && - !((Save_GetSaveMetaInfo(fileChooseCtx->buttonIndex)->requiresMasterQuest && !ResourceMgr_GameHasMasterQuest()) || - (Save_GetSaveMetaInfo(fileChooseCtx->buttonIndex)->requiresMasterQuest && !ResourceMgr_GameHasOriginal()))) { + if (fileChooseCtx->questType[fileChooseCtx->buttonIndex] == 2 && strnlen(CVarGetString("gSpoilerLog", ""), 1) != 0) { // Set N64DD Flags for save file fileChooseCtx->n64ddFlags[fileChooseCtx->buttonIndex] = 1; fileChooseCtx->n64ddFlag = 1; |
