mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-12 19:04:38 +00:00
Merge branch 'master' into doc_pause_menu
This commit is contained in:
commit
eb75e00f91
94 changed files with 583 additions and 450 deletions
|
@ -1172,7 +1172,7 @@ SampleCacheEntry* AudioHeap_AllocTemporarySampleCacheEntry(u32 size) {
|
|||
index = -1;
|
||||
for (i = 0; i < gAudioCtx.preloadSampleStackTop; i++) {
|
||||
preload = &gAudioCtx.preloadSampleStack[i];
|
||||
if (preload->isFree == false) {
|
||||
if (!preload->isFree) {
|
||||
startRamAddr = preload->ramAddr;
|
||||
endRamAddr = preload->ramAddr + preload->sample->size - 1;
|
||||
|
||||
|
@ -1408,7 +1408,7 @@ void AudioHeap_ApplySampleBankCacheInternal(s32 apply, s32 sampleBankId) {
|
|||
}
|
||||
|
||||
fakematch = &change.oldAddr;
|
||||
if ((apply != false) && (apply == true)) {
|
||||
if (apply && (apply == true)) {
|
||||
u32 temp = change.newAddr;
|
||||
|
||||
change.newAddr = *fakematch; // = change.oldAddr
|
||||
|
|
|
@ -192,8 +192,8 @@ void* AudioLoad_DmaSampleData(u32 devAddr, u32 size, s32 arg2, u8* dmaIndexRef,
|
|||
dma->ttl = 3;
|
||||
dma->devAddr = dmaDevAddr;
|
||||
dma->sizeUnused = transfer;
|
||||
AudioLoad_Dma(&gAudioCtx.currAudioFrameDmaIoMsgBuf[gAudioCtx.curAudioFrameDmaCount++], OS_MESG_PRI_NORMAL, OS_READ,
|
||||
dmaDevAddr, dma->ramAddr, transfer, &gAudioCtx.currAudioFrameDmaQueue, medium, "SUPERDMA");
|
||||
AudioLoad_Dma(&gAudioCtx.curAudioFrameDmaIoMsgBuf[gAudioCtx.curAudioFrameDmaCount++], OS_MESG_PRI_NORMAL, OS_READ,
|
||||
dmaDevAddr, dma->ramAddr, transfer, &gAudioCtx.curAudioFrameDmaQueue, medium, "SUPERDMA");
|
||||
*dmaIndexRef = dmaIndex;
|
||||
return (devAddr - dmaDevAddr) + dma->ramAddr;
|
||||
}
|
||||
|
@ -1166,8 +1166,8 @@ void AudioLoad_Init(void* heap, u32 heapSize) {
|
|||
gAudioCtx.rspTask[0].task.t.data_size = 0;
|
||||
gAudioCtx.rspTask[1].task.t.data_size = 0;
|
||||
osCreateMesgQueue(&gAudioCtx.syncDmaQueue, &gAudioCtx.syncDmaMesg, 1);
|
||||
osCreateMesgQueue(&gAudioCtx.currAudioFrameDmaQueue, gAudioCtx.currAudioFrameDmaMsgBuf,
|
||||
ARRAY_COUNT(gAudioCtx.currAudioFrameDmaMsgBuf));
|
||||
osCreateMesgQueue(&gAudioCtx.curAudioFrameDmaQueue, gAudioCtx.curAudioFrameDmaMsgBuf,
|
||||
ARRAY_COUNT(gAudioCtx.curAudioFrameDmaMsgBuf));
|
||||
osCreateMesgQueue(&gAudioCtx.externalLoadQueue, gAudioCtx.externalLoadMsgBuf,
|
||||
ARRAY_COUNT(gAudioCtx.externalLoadMsgBuf));
|
||||
osCreateMesgQueue(&gAudioCtx.preloadSampleQueue, gAudioCtx.preloadSampleMsgBuf,
|
||||
|
@ -1824,7 +1824,7 @@ s32 AudioLoad_ProcessSamplePreloads(s32 resetStatus) {
|
|||
preloadIndex >>= 24;
|
||||
preload = &gAudioCtx.preloadSampleStack[preloadIndex];
|
||||
|
||||
if (preload->isFree == false) {
|
||||
if (!preload->isFree) {
|
||||
sample = preload->sample;
|
||||
key = (u32)sample->sampleAddr + sample->size + sample->medium;
|
||||
if (key == preload->endAndMediumKey) {
|
||||
|
|
|
@ -1326,7 +1326,7 @@ Acmd* AudioSynth_ApplyHaasEffect(Acmd* cmd, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
aDMEMMove(cmd++, DMEM_TEMP, DMEM_HAAS_TEMP + haasEffectDelaySize, size);
|
||||
}
|
||||
|
||||
if (haasEffectDelaySize) { // != 0
|
||||
if ((u32)haasEffectDelaySize != 0) {
|
||||
// Save excessive samples for next iteration
|
||||
aSaveBuffer(cmd++, DMEM_HAAS_TEMP + size, synthState->synthesisBuffers->haasEffectDelayState,
|
||||
ALIGN16(haasEffectDelaySize));
|
||||
|
|
|
@ -27,7 +27,7 @@ void func_800AD950(struct_80166500* this) {
|
|||
void func_800AD958(struct_80166500* this, Gfx** gfxp) {
|
||||
Gfx* gfx = *gfxp;
|
||||
u16* tex = D_0E000000;
|
||||
s32 fmt = this->useRgba == false ? G_IM_FMT_IA : G_IM_FMT_RGBA;
|
||||
s32 fmt = !this->useRgba ? G_IM_FMT_IA : G_IM_FMT_RGBA;
|
||||
s32 y;
|
||||
s32 height = 6;
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ AudioTask* func_800E5000(void) {
|
|||
s32 pad;
|
||||
s32 j;
|
||||
s32 sp5C;
|
||||
s16* currAiBuffer;
|
||||
s16* curAiBuffer;
|
||||
OSTask_t* task;
|
||||
s32 index;
|
||||
u32 sp4C;
|
||||
|
@ -88,21 +88,21 @@ AudioTask* func_800E5000(void) {
|
|||
|
||||
sp5C = gAudioCtx.curAudioFrameDmaCount;
|
||||
for (i = 0; i < gAudioCtx.curAudioFrameDmaCount; i++) {
|
||||
if (osRecvMesg(&gAudioCtx.currAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK) == 0) {
|
||||
if (osRecvMesg(&gAudioCtx.curAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK) == 0) {
|
||||
sp5C--;
|
||||
}
|
||||
}
|
||||
|
||||
if (sp5C != 0) {
|
||||
for (i = 0; i < sp5C; i++) {
|
||||
osRecvMesg(&gAudioCtx.currAudioFrameDmaQueue, NULL, OS_MESG_BLOCK);
|
||||
osRecvMesg(&gAudioCtx.curAudioFrameDmaQueue, NULL, OS_MESG_BLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
sp48 = MQ_GET_COUNT(&gAudioCtx.currAudioFrameDmaQueue);
|
||||
sp48 = MQ_GET_COUNT(&gAudioCtx.curAudioFrameDmaQueue);
|
||||
if (sp48 != 0) {
|
||||
for (i = 0; i < sp48; i++) {
|
||||
osRecvMesg(&gAudioCtx.currAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK);
|
||||
osRecvMesg(&gAudioCtx.curAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ AudioTask* func_800E5000(void) {
|
|||
gAudioCtx.curAbiCmdBuf = gAudioCtx.abiCmdBufs[gAudioCtx.rspTaskIndex];
|
||||
|
||||
index = gAudioCtx.curAiBufIndex;
|
||||
currAiBuffer = gAudioCtx.aiBuffers[index];
|
||||
curAiBuffer = gAudioCtx.aiBuffers[index];
|
||||
|
||||
gAudioCtx.aiBufLengths[index] =
|
||||
(s16)((((gAudioCtx.audioBufferParameters.samplesPerFrameTarget - samplesRemainingInAi) +
|
||||
|
@ -162,7 +162,7 @@ AudioTask* func_800E5000(void) {
|
|||
}
|
||||
|
||||
gAudioCtx.curAbiCmdBuf =
|
||||
AudioSynth_Update(gAudioCtx.curAbiCmdBuf, &abiCmdCnt, currAiBuffer, gAudioCtx.aiBufLengths[index]);
|
||||
AudioSynth_Update(gAudioCtx.curAbiCmdBuf, &abiCmdCnt, curAiBuffer, gAudioCtx.aiBufLengths[index]);
|
||||
|
||||
// Update audioRandom to the next random number
|
||||
gAudioCtx.audioRandom = (gAudioCtx.audioRandom + gAudioCtx.totalTaskCount) * osGetCount();
|
||||
|
|
|
@ -140,7 +140,7 @@ void Audio_RemoveMatchingSfxRequests(u8 aspect, SfxBankEntry* cmp) {
|
|||
break;
|
||||
}
|
||||
if (remove) {
|
||||
req->sfxId = 0;
|
||||
req->sfxId = NA_SE_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -158,9 +158,11 @@ void Audio_ProcessSfxRequest(void) {
|
|||
|
||||
req = &sSfxRequests[gSfxRequestReadIndex];
|
||||
evictIndex = 0x80;
|
||||
if (req->sfxId == 0) {
|
||||
|
||||
if (req->sfxId == NA_SE_NONE) {
|
||||
return;
|
||||
}
|
||||
|
||||
bankId = SFX_BANK(req->sfxId);
|
||||
if ((1 << bankId) & D_801333F0) {
|
||||
AudioDebug_ScrPrt("SE", req->sfxId);
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#include "global.h"
|
||||
|
||||
s32 Overlay_Load(uintptr_t vRomStart, uintptr_t vRomEnd, void* vRamStart, void* vRamEnd, void* allocatedVRamAddr) {
|
||||
s32 Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd, void* allocatedRamAddr) {
|
||||
s32 pad[3];
|
||||
uintptr_t end;
|
||||
OverlayRelocationSection* ovl;
|
||||
u32 ovlOffset;
|
||||
OverlayRelocationSection* ovlRelocs;
|
||||
u32 relocSectionOffset;
|
||||
size_t size;
|
||||
|
||||
size = vRomEnd - vRomStart;
|
||||
end = (uintptr_t)allocatedVRamAddr + size;
|
||||
size = vromEnd - vromStart;
|
||||
end = (uintptr_t)allocatedRamAddr + size;
|
||||
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
// "Start loading dynamic link function"
|
||||
|
@ -17,44 +17,52 @@ s32 Overlay_Load(uintptr_t vRomStart, uintptr_t vRomEnd, void* vRamStart, void*
|
|||
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
// "DMA transfer of TEXT, DATA, RODATA + rel (%08x-%08x)"
|
||||
osSyncPrintf("TEXT,DATA,RODATA+relをDMA転送します(%08x-%08x)\n", allocatedVRamAddr, end);
|
||||
osSyncPrintf("TEXT,DATA,RODATA+relをDMA転送します(%08x-%08x)\n", allocatedRamAddr, end);
|
||||
}
|
||||
|
||||
DmaMgr_RequestSync(allocatedVRamAddr, vRomStart, size);
|
||||
// DMA the overlay, wait until transfer completes
|
||||
DmaMgr_RequestSync(allocatedRamAddr, vromStart, size);
|
||||
|
||||
ovlOffset = ((s32*)end)[-1];
|
||||
// The overlay file is expected to contain a 32-bit offset from the end of the file to the start of the
|
||||
// relocation section.
|
||||
relocSectionOffset = ((s32*)end)[-1];
|
||||
ovlRelocs = (OverlayRelocationSection*)(end - relocSectionOffset);
|
||||
|
||||
ovl = (OverlayRelocationSection*)(end - ovlOffset);
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
osSyncPrintf("TEXT(%08x), DATA(%08x), RODATA(%08x), BSS(%08x)\n", ovl->textSize, ovl->dataSize, ovl->rodataSize,
|
||||
ovl->bssSize);
|
||||
osSyncPrintf("TEXT(%08x), DATA(%08x), RODATA(%08x), BSS(%08x)\n", ovlRelocs->textSize, ovlRelocs->dataSize,
|
||||
ovlRelocs->rodataSize, ovlRelocs->bssSize);
|
||||
}
|
||||
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
osSyncPrintf("リロケーションします\n"); // "Relocate"
|
||||
}
|
||||
|
||||
Overlay_Relocate(allocatedVRamAddr, ovl, vRamStart);
|
||||
// Relocate pointers in overlay code and data
|
||||
Overlay_Relocate(allocatedRamAddr, ovlRelocs, vramStart);
|
||||
|
||||
if (ovl->bssSize != 0) {
|
||||
// Clear bss if present, bss is located immediately following the relocations
|
||||
if (ovlRelocs->bssSize != 0) {
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
// "Clear BSS area (% 08x-% 08x)"
|
||||
osSyncPrintf("BSS領域をクリアします(%08x-%08x)\n", end, end + ovl->bssSize);
|
||||
osSyncPrintf("BSS領域をクリアします(%08x-%08x)\n", end, end + ovlRelocs->bssSize);
|
||||
}
|
||||
bzero((void*)end, ovl->bssSize);
|
||||
bzero((void*)end, ovlRelocs->bssSize);
|
||||
}
|
||||
|
||||
size = (uintptr_t)&ovl->relocations[ovl->nRelocations] - (uintptr_t)ovl;
|
||||
size = (uintptr_t)&ovlRelocs->relocations[ovlRelocs->nRelocations] - (uintptr_t)ovlRelocs;
|
||||
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
// "Clear REL area (%08x-%08x)"
|
||||
osSyncPrintf("REL領域をクリアします(%08x-%08x)\n", ovl, (uintptr_t)ovl + size);
|
||||
osSyncPrintf("REL領域をクリアします(%08x-%08x)\n", ovlRelocs, (uintptr_t)ovlRelocs + size);
|
||||
}
|
||||
|
||||
bzero(ovl, size);
|
||||
// Clear relocations, this space remains allocated and goes unused
|
||||
bzero(ovlRelocs, size);
|
||||
|
||||
size = (uintptr_t)vRamEnd - (uintptr_t)vRamStart;
|
||||
osWritebackDCache(allocatedVRamAddr, size);
|
||||
osInvalICache(allocatedVRamAddr, size);
|
||||
// Manually flush caches
|
||||
size = (uintptr_t)vramEnd - (uintptr_t)vramStart;
|
||||
osWritebackDCache(allocatedRamAddr, size);
|
||||
osInvalICache(allocatedRamAddr, size);
|
||||
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
// "Finish loading dynamic link function"
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
#include "global.h"
|
||||
|
||||
void* Overlay_AllocateAndLoad(uintptr_t vRomStart, uintptr_t vRomEnd, void* vRamStart, void* vRamEnd) {
|
||||
void* allocatedVRamAddr = SystemArena_MallocRDebug((s32)vRamEnd - (s32)vRamStart, "../loadfragment2.c", 31);
|
||||
void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd) {
|
||||
void* allocatedRamAddr = SystemArena_MallocRDebug((s32)vramEnd - (s32)vramStart, "../loadfragment2.c", 31);
|
||||
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
osSyncPrintf("OVL:SPEC(%08x-%08x) REAL(%08x-%08x) OFFSET(%08x)\n", vRamStart, vRamEnd, allocatedVRamAddr,
|
||||
((uintptr_t)vRamEnd - (uintptr_t)vRamStart) + (uintptr_t)allocatedVRamAddr,
|
||||
(uintptr_t)vRamStart - (uintptr_t)allocatedVRamAddr);
|
||||
osSyncPrintf("OVL:SPEC(%08x-%08x) REAL(%08x-%08x) OFFSET(%08x)\n", vramStart, vramEnd, allocatedRamAddr,
|
||||
((uintptr_t)vramEnd - (uintptr_t)vramStart) + (uintptr_t)allocatedRamAddr,
|
||||
(uintptr_t)vramStart - (uintptr_t)allocatedRamAddr);
|
||||
}
|
||||
|
||||
if (allocatedVRamAddr != NULL) {
|
||||
Overlay_Load(vRomStart, vRomEnd, vRamStart, vRamEnd, allocatedVRamAddr);
|
||||
if (allocatedRamAddr != NULL) {
|
||||
Overlay_Load(vromStart, vromEnd, vramStart, vramEnd, allocatedRamAddr);
|
||||
}
|
||||
|
||||
return allocatedVRamAddr;
|
||||
return allocatedRamAddr;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,44 @@
|
|||
/**
|
||||
* @file relocation.c
|
||||
*
|
||||
* This file contains the routine responsible for runtime relocation of dynamically loadable code segments (overlays),
|
||||
* see the description of Overlay_Relocate for details.
|
||||
*
|
||||
* @see Overlay_Relocate
|
||||
*/
|
||||
#include "global.h"
|
||||
|
||||
void Overlay_Relocate(void* allocatedVRamAddress, OverlayRelocationSection* overlayInfo, void* vRamStart) {
|
||||
u32 sections[4];
|
||||
// Extract MIPS register rs from an instruction word
|
||||
#define MIPS_REG_RS(insn) (((insn) >> 0x15) & 0x1F)
|
||||
|
||||
// Extract MIPS register rt from an instruction word
|
||||
#define MIPS_REG_RT(insn) (((insn) >> 0x10) & 0x1F)
|
||||
|
||||
// Extract MIPS jump target from an instruction word
|
||||
#define MIPS_JUMP_TARGET(insn) (((insn)&0x03FFFFFF) << 2)
|
||||
|
||||
/**
|
||||
* Performs runtime relocation of overlay files, loadable code segments.
|
||||
*
|
||||
* Overlays are expected to be loadable anywhere in direct-mapped cached (KSEG0) memory, with some appropriate
|
||||
* alignment requirements; memory addresses in such code must be updated once loaded in order to execute properly.
|
||||
* When compiled, overlays are given 'fake' KSEG0 RAM addresses larger than the total possible available main memory
|
||||
* (>= 0x80800000), such addresses are referred to as Virtual RAM (VRAM) to distinguish them. When loading the overlay
|
||||
* the relocation table produced at compile time is consulted to determine where and how to update these VRAM addresses
|
||||
* to correct RAM addresses based on the location the overlay was loaded at, enabling the code to execute at this
|
||||
* address as if it were compiled to run at this address.
|
||||
*
|
||||
* Each relocation is represented by a packed 32-bit value, formatted in the following way:
|
||||
* - [31:30] 2-bit section id, taking values from the `RelocSectionId` enum.
|
||||
* - [29:24] 6-bit relocation type describing which relocation operation should be performed. Same as ELF32 MIPS.
|
||||
* - [23: 0] 24-bit section-relative offset indicating where in the section to apply this relocation.
|
||||
*
|
||||
* @param allocatedRamAddress Memory address the binary was loaded at.
|
||||
* @param ovlRelocs Overlay relocation section containing overlay section layout and runtime relocations.
|
||||
* @param vramStart Virtual RAM address that the overlay was compiled at.
|
||||
*/
|
||||
void Overlay_Relocate(void* allocatedRamAddress, OverlayRelocationSection* ovlRelocs, void* vramStart) {
|
||||
uintptr_t sections[RELOC_SECTION_MAX];
|
||||
u32 relocatedValue;
|
||||
u32 dbg;
|
||||
u32 relocOffset;
|
||||
|
@ -9,12 +46,18 @@ void Overlay_Relocate(void* allocatedVRamAddress, OverlayRelocationSection* over
|
|||
uintptr_t unrelocatedAddress;
|
||||
u32 i;
|
||||
u32* relocDataP;
|
||||
//! MIPS ELF relocation does not generally require tracking register values, so at first glance it appears this
|
||||
//! register tracking was an unnecessary complication. However there is a bug in the IDO compiler that can cause
|
||||
//! relocations to be emitted in the wrong order under rare circumstances when the compiler attempts to reuse a
|
||||
//! previous HI16 relocation for a different LO16 relocation as an optimization. This register tracking is likely
|
||||
//! a workaround to prevent improper matching of unrelated HI16 and LO16 relocations that would otherwise arise
|
||||
//! due to the incorrect ordering.
|
||||
u32* luiRefs[32];
|
||||
u32 luiVals[32];
|
||||
uintptr_t relocatedAddress;
|
||||
u32 reloc;
|
||||
u32* luiInstRef;
|
||||
uintptr_t allocu32 = (uintptr_t)allocatedVRamAddress;
|
||||
uintptr_t allocu32 = (uintptr_t)allocatedRamAddress;
|
||||
u32* regValP;
|
||||
u32 isLoNeg;
|
||||
s32 pad;
|
||||
|
@ -25,18 +68,21 @@ void Overlay_Relocate(void* allocatedVRamAddress, OverlayRelocationSection* over
|
|||
relocatedAddress = 0;
|
||||
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
osSyncPrintf("DoRelocation(%08x, %08x, %08x)\n", allocatedVRamAddress, overlayInfo, vRamStart);
|
||||
osSyncPrintf("text=%08x, data=%08x, rodata=%08x, bss=%08x\n", overlayInfo->textSize, overlayInfo->dataSize,
|
||||
overlayInfo->rodataSize, overlayInfo->bssSize);
|
||||
osSyncPrintf("DoRelocation(%08x, %08x, %08x)\n", allocatedRamAddress, ovlRelocs, vramStart);
|
||||
osSyncPrintf("text=%08x, data=%08x, rodata=%08x, bss=%08x\n", ovlRelocs->textSize, ovlRelocs->dataSize,
|
||||
ovlRelocs->rodataSize, ovlRelocs->bssSize);
|
||||
}
|
||||
|
||||
sections[0] = 0;
|
||||
sections[1] = allocu32;
|
||||
sections[2] = allocu32 + overlayInfo->textSize;
|
||||
sections[3] = sections[2] + overlayInfo->dataSize;
|
||||
sections[RELOC_SECTION_NULL] = 0;
|
||||
sections[RELOC_SECTION_TEXT] = allocu32;
|
||||
sections[RELOC_SECTION_DATA] = allocu32 + ovlRelocs->textSize;
|
||||
sections[RELOC_SECTION_RODATA] = sections[RELOC_SECTION_DATA] + ovlRelocs->dataSize;
|
||||
|
||||
for (i = 0; i < overlayInfo->nRelocations; i++) {
|
||||
reloc = overlayInfo->relocations[i];
|
||||
for (i = 0; i < ovlRelocs->nRelocations; i++) {
|
||||
reloc = ovlRelocs->relocations[i];
|
||||
// This will always resolve to a 32-bit aligned address as each section containing code or pointers must be
|
||||
// aligned to at least 4 bytes and the MIPS ABI defines the offset of both 16-bit and 32-bit relocations to
|
||||
// be the start of the 32-bit word containing the target.
|
||||
relocDataP = (u32*)(sections[RELOC_SECTION(reloc)] + RELOC_OFFSET(reloc));
|
||||
relocData = *relocDataP;
|
||||
|
||||
|
@ -47,7 +93,7 @@ void Overlay_Relocate(void* allocatedVRamAddress, OverlayRelocationSection* over
|
|||
|
||||
// Check address is valid for relocation
|
||||
if ((*relocDataP & 0x0F000000) == 0) {
|
||||
relocOffset = *relocDataP - (uintptr_t)vRamStart;
|
||||
relocOffset = *relocDataP - (uintptr_t)vramStart;
|
||||
relocatedValue = relocOffset + allocu32;
|
||||
relocatedAddress = relocatedValue;
|
||||
unrelocatedAddress = relocData;
|
||||
|
@ -60,10 +106,10 @@ void Overlay_Relocate(void* allocatedVRamAddress, OverlayRelocationSection* over
|
|||
// Extract the address from the target field of the J-type MIPS instruction.
|
||||
// Relocate the address and update the instruction.
|
||||
|
||||
unrelocatedAddress = PHYS_TO_K0((*relocDataP & 0x03FFFFFF) << 2);
|
||||
relocOffset = unrelocatedAddress - (uintptr_t)vRamStart;
|
||||
unrelocatedAddress = PHYS_TO_K0(MIPS_JUMP_TARGET(*relocDataP));
|
||||
relocOffset = unrelocatedAddress - (uintptr_t)vramStart;
|
||||
relocatedValue = (*relocDataP & 0xFC000000) | (((allocu32 + relocOffset) & 0x0FFFFFFF) >> 2);
|
||||
relocatedAddress = PHYS_TO_K0((relocatedValue & 0x03FFFFFF) << 2);
|
||||
relocatedAddress = PHYS_TO_K0(MIPS_JUMP_TARGET(relocatedValue));
|
||||
*relocDataP = relocatedValue;
|
||||
break;
|
||||
|
||||
|
@ -72,8 +118,8 @@ void Overlay_Relocate(void* allocatedVRamAddress, OverlayRelocationSection* over
|
|||
// Store the reference to the LUI instruction (hi) using the `rt` register of the instruction.
|
||||
// This will be updated later in the `R_MIPS_LO16` section.
|
||||
|
||||
luiRefs[(*relocDataP >> 0x10) & 0x1F] = relocDataP;
|
||||
luiVals[(*relocDataP >> 0x10) & 0x1F] = *relocDataP;
|
||||
luiRefs[MIPS_REG_RT(*relocDataP)] = relocDataP;
|
||||
luiVals[MIPS_REG_RT(*relocDataP)] = *relocDataP;
|
||||
break;
|
||||
|
||||
case R_MIPS_LO16 << RELOC_TYPE_SHIFT:
|
||||
|
@ -83,13 +129,13 @@ void Overlay_Relocate(void* allocatedVRamAddress, OverlayRelocationSection* over
|
|||
// If the lo part is negative, add 1 to the LUI value.
|
||||
// Note: The lo instruction is assumed to have a signed immediate.
|
||||
|
||||
luiInstRef = luiRefs[(*relocDataP >> 0x15) & 0x1F];
|
||||
regValP = &luiVals[(*relocDataP >> 0x15) & 0x1F];
|
||||
luiInstRef = luiRefs[MIPS_REG_RS(*relocDataP)];
|
||||
regValP = &luiVals[MIPS_REG_RS(*relocDataP)];
|
||||
|
||||
// Check address is valid for relocation
|
||||
if ((((*regValP << 0x10) + (s16)*relocDataP) & 0x0F000000) == 0) {
|
||||
relocOffset = ((*regValP << 0x10) + (s16)*relocDataP) - (uintptr_t)vRamStart;
|
||||
isLoNeg = (((relocOffset + allocu32) & 0x8000) ? 1 : 0);
|
||||
relocOffset = ((*regValP << 0x10) + (s16)*relocDataP) - (uintptr_t)vramStart;
|
||||
isLoNeg = ((relocOffset + allocu32) & 0x8000) ? 1 : 0; // adjust for signed immediate
|
||||
unrelocatedAddress = (*luiInstRef << 0x10) + (s16)relocData;
|
||||
*luiInstRef =
|
||||
(*luiInstRef & 0xFFFF0000) | ((((relocOffset + allocu32) >> 0x10) & 0xFFFF) + isLoNeg);
|
||||
|
@ -101,18 +147,18 @@ void Overlay_Relocate(void* allocatedVRamAddress, OverlayRelocationSection* over
|
|||
break;
|
||||
}
|
||||
|
||||
dbg = 0x10;
|
||||
dbg = 16;
|
||||
switch (RELOC_TYPE_MASK(reloc)) {
|
||||
case R_MIPS_32 << RELOC_TYPE_SHIFT:
|
||||
dbg = 0x16;
|
||||
dbg += 6;
|
||||
FALLTHROUGH;
|
||||
case R_MIPS_26 << RELOC_TYPE_SHIFT:
|
||||
dbg += 0xA;
|
||||
dbg += 10;
|
||||
FALLTHROUGH;
|
||||
case R_MIPS_LO16 << RELOC_TYPE_SHIFT:
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
osSyncPrintf("%02d %08x %08x %08x ", dbg, relocDataP, relocatedValue, relocatedAddress);
|
||||
osSyncPrintf(" %08x %08x %08x %08x\n", (uintptr_t)relocDataP + (uintptr_t)vRamStart - allocu32,
|
||||
osSyncPrintf(" %08x %08x %08x %08x\n", (uintptr_t)relocDataP + (uintptr_t)vramStart - allocu32,
|
||||
relocData, unrelocatedAddress, relocOffset);
|
||||
}
|
||||
// Adding a break prevents matching
|
||||
|
|
|
@ -1610,7 +1610,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader
|
|||
customNodeListMax = sceneSubdivisionList[i].nodeListMax;
|
||||
}
|
||||
}
|
||||
if (useCustomSubdivisions == false) {
|
||||
if (!useCustomSubdivisions) {
|
||||
colCtx->subdivAmount.x = 16;
|
||||
colCtx->subdivAmount.y = 4;
|
||||
colCtx->subdivAmount.z = 16;
|
||||
|
@ -2296,7 +2296,7 @@ s32 BgCheck_CheckLineImpl(CollisionContext* colCtx, u16 xpFlags1, u16 xpFlags2,
|
|||
sectorMin.z += colCtx->subdivLength.z;
|
||||
sectorMax.z += colCtx->subdivLength.z;
|
||||
}
|
||||
} else if (BgCheck_PosInStaticBoundingBox(colCtx, posA) == false) {
|
||||
} else if (!BgCheck_PosInStaticBoundingBox(colCtx, posA)) {
|
||||
return false;
|
||||
} else {
|
||||
result =
|
||||
|
@ -2722,7 +2722,7 @@ s32 DynaPoly_SetBgActor(PlayState* play, DynaCollisionContext* dyna, Actor* acto
|
|||
}
|
||||
}
|
||||
|
||||
if (foundSlot == false) {
|
||||
if (!foundSlot) {
|
||||
osSyncPrintf(VT_FGCOL(RED));
|
||||
osSyncPrintf("DynaPolyInfo_setActor():ダイナミックポリゴン 空きインデックスはありません\n");
|
||||
osSyncPrintf(VT_RST);
|
||||
|
@ -2788,7 +2788,7 @@ void DynaPoly_DeleteBgActor(PlayState* play, DynaCollisionContext* dyna, s32 bgI
|
|||
osSyncPrintf(VT_FGCOL(GREEN));
|
||||
osSyncPrintf("DynaPolyInfo_delReserve():index %d\n", bgId);
|
||||
osSyncPrintf(VT_RST);
|
||||
if (DynaPoly_IsBgIdBgActor(bgId) == false) {
|
||||
if (!DynaPoly_IsBgIdBgActor(bgId)) {
|
||||
|
||||
if (bgId == -1) {
|
||||
osSyncPrintf(VT_FGCOL(GREEN));
|
||||
|
@ -3178,8 +3178,8 @@ f32 BgCheck_RaycastDownDyna(DynaRaycastDown* dynaRaycastDown) {
|
|||
|
||||
if (dynaRaycastDown->actor == dynaRaycastDown->colCtx->dyna.bgActors[i].actor ||
|
||||
dynaRaycastDown->pos->y < dynaRaycastDown->colCtx->dyna.bgActors[i].minY ||
|
||||
Math3D_XZInSphere(&dynaRaycastDown->colCtx->dyna.bgActors[i].boundingSphere, dynaRaycastDown->pos->x,
|
||||
dynaRaycastDown->pos->z) == false) {
|
||||
!Math3D_XZInSphere(&dynaRaycastDown->colCtx->dyna.bgActors[i].boundingSphere, dynaRaycastDown->pos->x,
|
||||
dynaRaycastDown->pos->z)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -3537,7 +3537,7 @@ s32 CollisionCheck_CylSideVsLineSeg(f32 radius, f32 height, f32 offset, Vec3f* a
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (intersect2 == false) {
|
||||
if (!intersect2) {
|
||||
if (frac1 < 0.0f || 1.0f < frac1) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -3564,7 +3564,7 @@ s32 CollisionCheck_CylSideVsLineSeg(f32 radius, f32 height, f32 offset, Vec3f* a
|
|||
((frac2 * itemStep.y + actorToItem.y < 0.0f) || (height < frac2 * itemStep.y + actorToItem.y))) {
|
||||
intersect2 = false;
|
||||
}
|
||||
if (intersect1 == false && intersect2 == false) {
|
||||
if (!intersect1 && !intersect2) {
|
||||
return 0;
|
||||
} else if ((intersect1 == true) && (intersect2 == true)) {
|
||||
out1->x = frac1 * itemStep.x + actorToItem.x + actorPos->x;
|
||||
|
|
|
@ -109,7 +109,7 @@ void Effect_Add(PlayState* play, s32* pIndex, s32 type, u8 arg3, u8 arg4, void*
|
|||
switch (type) {
|
||||
case EFFECT_SPARK:
|
||||
for (i = 0; i < SPARK_COUNT; i++) {
|
||||
if (sEffectContext.sparks[i].status.active == false) {
|
||||
if (!sEffectContext.sparks[i].status.active) {
|
||||
slotFound = true;
|
||||
*pIndex = i;
|
||||
effect = &sEffectContext.sparks[i].effect;
|
||||
|
@ -121,7 +121,7 @@ void Effect_Add(PlayState* play, s32* pIndex, s32 type, u8 arg3, u8 arg4, void*
|
|||
case EFFECT_BLURE1:
|
||||
case EFFECT_BLURE2:
|
||||
for (i = 0; i < BLURE_COUNT; i++) {
|
||||
if (sEffectContext.blures[i].status.active == false) {
|
||||
if (!sEffectContext.blures[i].status.active) {
|
||||
slotFound = true;
|
||||
*pIndex = i + SPARK_COUNT;
|
||||
effect = &sEffectContext.blures[i].effect;
|
||||
|
@ -132,7 +132,7 @@ void Effect_Add(PlayState* play, s32* pIndex, s32 type, u8 arg3, u8 arg4, void*
|
|||
break;
|
||||
case EFFECT_SHIELD_PARTICLE:
|
||||
for (i = 0; i < SHIELD_PARTICLE_COUNT; i++) {
|
||||
if (sEffectContext.shieldParticles[i].status.active == false) {
|
||||
if (!sEffectContext.shieldParticles[i].status.active) {
|
||||
slotFound = true;
|
||||
*pIndex = i + SPARK_COUNT + BLURE_COUNT;
|
||||
effect = &sEffectContext.shieldParticles[i].effect;
|
||||
|
|
|
@ -183,7 +183,7 @@ void Message_CloseTextbox(PlayState* play) {
|
|||
msgCtx->stateTimer = 2;
|
||||
msgCtx->msgMode = MSGMODE_TEXT_CLOSING;
|
||||
msgCtx->textboxEndType = TEXTBOX_ENDTYPE_DEFAULT;
|
||||
Audio_PlaySfxGeneral(0, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
|
||||
Audio_PlaySfxGeneral(NA_SE_NONE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultReverb);
|
||||
}
|
||||
}
|
||||
|
@ -743,10 +743,9 @@ u16 Message_DrawItemIcon(PlayState* play, u16 itemId, Gfx** p, u16 i) {
|
|||
MessageContext* msgCtx = &play->msgCtx;
|
||||
|
||||
// clang-format off
|
||||
if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Audio_PlaySfxGeneral(0, &gSfxDefaultPos, 4,
|
||||
&gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultReverb);
|
||||
if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { \
|
||||
Audio_PlaySfxGeneral(NA_SE_NONE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultReverb);
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
|
@ -860,7 +859,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) {
|
|||
|
||||
play->msgCtx.textPosX = R_TEXT_INIT_XPOS;
|
||||
|
||||
if (sTextIsCredits == false) {
|
||||
if (!sTextIsCredits) {
|
||||
msgCtx->textPosY = R_TEXT_INIT_YPOS;
|
||||
} else {
|
||||
msgCtx->textPosY = YREG(1);
|
||||
|
@ -898,7 +897,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) {
|
|||
case MESSAGE_BOX_BREAK:
|
||||
if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) {
|
||||
if (!sTextboxSkipped) {
|
||||
Audio_PlaySfxGeneral(0, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
Audio_PlaySfxGeneral(NA_SE_NONE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
msgCtx->msgMode = MSGMODE_TEXT_AWAIT_NEXT;
|
||||
Font_LoadMessageBoxIcon(font, TEXTBOX_ICON_TRIANGLE);
|
||||
|
@ -916,7 +915,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) {
|
|||
case MESSAGE_TEXTID:
|
||||
msgCtx->textboxEndType = TEXTBOX_ENDTYPE_HAS_NEXT;
|
||||
if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) {
|
||||
Audio_PlaySfxGeneral(0, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
Audio_PlaySfxGeneral(NA_SE_NONE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
msgCtx->msgMode = MSGMODE_TEXT_DONE;
|
||||
Font_LoadMessageBoxIcon(font, TEXTBOX_ICON_TRIANGLE);
|
||||
|
@ -948,6 +947,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) {
|
|||
|
||||
if (character) {}
|
||||
}
|
||||
FALLTHROUGH;
|
||||
case MESSAGE_QUICKTEXT_DISABLE:
|
||||
break;
|
||||
case MESSAGE_AWAIT_BUTTON_PRESS:
|
||||
|
@ -996,10 +996,9 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) {
|
|||
break;
|
||||
case MESSAGE_BACKGROUND:
|
||||
// clang-format off
|
||||
if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Audio_PlaySfxGeneral(0, &gSfxDefaultPos, 4,
|
||||
&gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultReverb);
|
||||
if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { \
|
||||
Audio_PlaySfxGeneral(NA_SE_NONE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
}
|
||||
// clang-format on
|
||||
gDPPipeSync(gfx++);
|
||||
|
@ -1113,7 +1112,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) {
|
|||
return;
|
||||
case MESSAGE_PERSISTENT:
|
||||
if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) {
|
||||
Audio_PlaySfxGeneral(0, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
Audio_PlaySfxGeneral(NA_SE_NONE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
msgCtx->msgMode = MSGMODE_TEXT_DONE;
|
||||
msgCtx->textboxEndType = TEXTBOX_ENDTYPE_PERSISTENT;
|
||||
|
@ -1133,7 +1132,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) {
|
|||
default:
|
||||
if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING && i + 1 == msgCtx->textDrawPos &&
|
||||
msgCtx->textDelayTimer == msgCtx->textDelay) {
|
||||
Audio_PlaySfxGeneral(0, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
Audio_PlaySfxGeneral(NA_SE_NONE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
}
|
||||
Message_DrawTextChar(play, &font->charTexBuf[charTexIdx], &gfx);
|
||||
|
@ -1755,7 +1754,7 @@ void Message_StartOcarinaImpl(PlayState* play, u16 ocarinaActionId) {
|
|||
s32 textId;
|
||||
s16 j;
|
||||
s16 i;
|
||||
s16 noStop;
|
||||
s16 noStopDoAction;
|
||||
s32 k;
|
||||
|
||||
osSyncPrintf(VT_FGCOL(GREEN));
|
||||
|
@ -1781,7 +1780,7 @@ void Message_StartOcarinaImpl(PlayState* play, u16 ocarinaActionId) {
|
|||
|
||||
// "Ocarina Number"
|
||||
osSyncPrintf(VT_FGCOL(RED) "☆☆☆☆☆ オカリナ番号=%d(%d) ☆☆☆☆☆\n" VT_RST, ocarinaActionId, 2);
|
||||
noStop = false;
|
||||
noStopDoAction = false;
|
||||
if (ocarinaActionId >= 0x893) {
|
||||
Message_OpenText(play, ocarinaActionId); // You played the [song name]
|
||||
textId = ocarinaActionId + 0x86E;
|
||||
|
@ -1805,7 +1804,7 @@ void Message_StartOcarinaImpl(PlayState* play, u16 ocarinaActionId) {
|
|||
}
|
||||
} else {
|
||||
msgCtx->ocarinaAction = ocarinaActionId;
|
||||
noStop = true;
|
||||
noStopDoAction = true;
|
||||
if (ocarinaActionId >= OCARINA_ACTION_PLAYBACK_MINUET) {
|
||||
osSyncPrintf("222222222\n");
|
||||
Message_OpenText(play, 0x86D); // Play using [A] and [C].
|
||||
|
@ -1835,11 +1834,11 @@ void Message_StartOcarinaImpl(PlayState* play, u16 ocarinaActionId) {
|
|||
msgCtx->msgMode = MSGMODE_TEXT_CONTINUING;
|
||||
}
|
||||
msgCtx->textboxColorAlphaCurrent = msgCtx->textboxColorAlphaTarget;
|
||||
if (noStop == false) {
|
||||
if (!noStopDoAction) {
|
||||
Interface_LoadActionLabelB(play, DO_ACTION_STOP);
|
||||
noStop = gSaveContext.hudVisibilityMode;
|
||||
noStopDoAction = gSaveContext.hudVisibilityMode;
|
||||
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_B_ALT);
|
||||
gSaveContext.hudVisibilityMode = noStop;
|
||||
gSaveContext.hudVisibilityMode = noStopDoAction;
|
||||
}
|
||||
// "Music Performance Start"
|
||||
osSyncPrintf("演奏開始\n");
|
||||
|
@ -2091,7 +2090,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
msgCtx->stateTimer = 20;
|
||||
msgCtx->msgMode = MSGMODE_SONG_DEMONSTRATION_SELECT_INSTRUMENT;
|
||||
} else {
|
||||
AudioOcarina_Start((1 << (msgCtx->ocarinaAction + 0x11)) + 0x8000);
|
||||
AudioOcarina_Start((1 << (msgCtx->ocarinaAction - OCARINA_ACTION_PLAYBACK_MINUET)) + 0x8000);
|
||||
// "Performance Check"
|
||||
osSyncPrintf("演奏チェック=%d\n", msgCtx->ocarinaAction - OCARINA_ACTION_PLAYBACK_MINUET);
|
||||
msgCtx->msgMode = MSGMODE_SONG_PLAYBACK;
|
||||
|
@ -2470,9 +2469,9 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
case MSGMODE_SONG_PLAYED_ACT:
|
||||
msgCtx->stateTimer--;
|
||||
if (msgCtx->stateTimer == 0) {
|
||||
if (msgCtx->lastPlayedSong < OCARINA_SONG_SARIAS &&
|
||||
(msgCtx->ocarinaAction < OCARINA_ACTION_PLAYBACK_MINUET ||
|
||||
msgCtx->ocarinaAction >= OCARINA_ACTION_PLAYBACK_SARIA)) {
|
||||
if ((msgCtx->lastPlayedSong <= OCARINA_SONG_PRELUDE) &&
|
||||
!(msgCtx->ocarinaAction >= OCARINA_ACTION_PLAYBACK_MINUET &&
|
||||
msgCtx->ocarinaAction <= OCARINA_ACTION_PLAYBACK_PRELUDE)) {
|
||||
if (msgCtx->disableWarpSongs || interfaceCtx->restrictions.warpSongs == 3) {
|
||||
Message_StartTextbox(play, 0x88C, NULL); // "You can't warp here!"
|
||||
play->msgCtx.ocarinaMode = OCARINA_MODE_04;
|
||||
|
@ -2500,7 +2499,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
osSyncPrintf(VT_FGCOL(YELLOW));
|
||||
osSyncPrintf("Ocarina_PC_Wind=%d(%d) ☆☆☆ ", OCARINA_ACTION_CHECK_MINUET,
|
||||
msgCtx->ocarinaAction - OCARINA_ACTION_CHECK_MINUET);
|
||||
if (msgCtx->lastPlayedSong + OCARINA_ACTION_CHECK_MINUET == msgCtx->ocarinaAction) {
|
||||
if (msgCtx->lastPlayedSong == (msgCtx->ocarinaAction - OCARINA_ACTION_CHECK_MINUET)) {
|
||||
play->msgCtx.ocarinaMode = OCARINA_MODE_03;
|
||||
} else {
|
||||
play->msgCtx.ocarinaMode = msgCtx->lastPlayedSong - 1;
|
||||
|
@ -2509,7 +2508,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
osSyncPrintf(VT_FGCOL(GREEN));
|
||||
osSyncPrintf("Ocarina_C_Wind=%d(%d) ☆☆☆ ", OCARINA_ACTION_PLAYBACK_MINUET,
|
||||
msgCtx->ocarinaAction - OCARINA_ACTION_PLAYBACK_MINUET);
|
||||
if (msgCtx->lastPlayedSong + OCARINA_ACTION_PLAYBACK_MINUET == msgCtx->ocarinaAction) {
|
||||
if (msgCtx->lastPlayedSong == (msgCtx->ocarinaAction - OCARINA_ACTION_PLAYBACK_MINUET)) {
|
||||
play->msgCtx.ocarinaMode = OCARINA_MODE_03;
|
||||
} else {
|
||||
play->msgCtx.ocarinaMode = OCARINA_MODE_04;
|
||||
|
@ -2535,7 +2534,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
if (sOcarinaButtonIndexBufPos != 0 && msgCtx->ocarinaStaff->pos == 1) {
|
||||
sOcarinaButtonIndexBufPos = 0;
|
||||
}
|
||||
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
|
||||
if (((u32)msgCtx->ocarinaStaff->pos != 0) &&
|
||||
(sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) {
|
||||
msgCtx->lastOcarinaButtonIndex = sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] =
|
||||
msgCtx->ocarinaStaff->buttonIndex;
|
||||
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_BTN_INVALID;
|
||||
|
@ -2548,7 +2548,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
break;
|
||||
case MSGMODE_SONG_PLAYBACK:
|
||||
msgCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff();
|
||||
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
|
||||
if (((u32)msgCtx->ocarinaStaff->pos != 0) &&
|
||||
(sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) {
|
||||
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->buttonIndex;
|
||||
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_BTN_INVALID;
|
||||
sOcarinaButtonIndexBufPos++;
|
||||
|
@ -2595,7 +2596,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
case MSGMODE_SCARECROW_LONG_RECORDING_ONGOING:
|
||||
msgCtx->ocarinaStaff = AudioOcarina_GetRecordingStaff();
|
||||
osSyncPrintf("\nonpu_pt=%d, locate=%d", sOcarinaButtonIndexBufPos, msgCtx->ocarinaStaff->pos);
|
||||
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
|
||||
if (((u32)msgCtx->ocarinaStaff->pos != 0) &&
|
||||
(sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) {
|
||||
if (sOcarinaButtonIndexBufLen >= 8) {
|
||||
for (buttonIndexPos = sOcarinaButtonIndexBufLen - 8, i = 0; i < 8; i++, buttonIndexPos++) {
|
||||
sOcarinaButtonIndexBuf[buttonIndexPos] = sOcarinaButtonIndexBuf[buttonIndexPos + 1];
|
||||
|
@ -2646,7 +2648,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
case MSGMODE_SCARECROW_LONG_PLAYBACK:
|
||||
case MSGMODE_SCARECROW_SPAWN_PLAYBACK:
|
||||
msgCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff();
|
||||
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
|
||||
if (((u32)msgCtx->ocarinaStaff->pos != 0) &&
|
||||
(sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) {
|
||||
if (sOcarinaButtonIndexBufLen >= 8) {
|
||||
for (buttonIndexPos = sOcarinaButtonIndexBufLen - 8, i = 0; i < 8; i++, buttonIndexPos++) {
|
||||
sOcarinaButtonIndexBuf[buttonIndexPos] = sOcarinaButtonIndexBuf[buttonIndexPos + 1];
|
||||
|
@ -2681,7 +2684,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
break;
|
||||
case MSGMODE_SCARECROW_SPAWN_RECORDING_ONGOING:
|
||||
msgCtx->ocarinaStaff = AudioOcarina_GetRecordingStaff();
|
||||
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
|
||||
if (((u32)msgCtx->ocarinaStaff->pos != 0) &&
|
||||
(sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) {
|
||||
msgCtx->lastOcarinaButtonIndex = sOcarinaButtonIndexBuf[sOcarinaButtonIndexBufPos] =
|
||||
msgCtx->ocarinaStaff->buttonIndex;
|
||||
sOcarinaButtonIndexBufPos++;
|
||||
|
@ -2738,7 +2742,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
Audio_PlaySfxGeneral(NA_SE_SY_METRONOME_LV - SFX_FLAG, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
msgCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff();
|
||||
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
|
||||
if (((u32)msgCtx->ocarinaStaff->pos != 0) &&
|
||||
(sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) {
|
||||
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->buttonIndex;
|
||||
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_BTN_INVALID;
|
||||
sOcarinaButtonIndexBufPos++;
|
||||
|
@ -2761,7 +2766,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
case MSGMODE_MEMORY_GAME_LEFT_SKULLKID_WAIT:
|
||||
case MSGMODE_MEMORY_GAME_RIGHT_SKULLKID_WAIT:
|
||||
msgCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff();
|
||||
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
|
||||
if (((u32)msgCtx->ocarinaStaff->pos != 0) &&
|
||||
(sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) {
|
||||
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->buttonIndex;
|
||||
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_BTN_INVALID;
|
||||
sOcarinaButtonIndexBufPos++;
|
||||
|
@ -2771,7 +2777,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
Audio_PlaySfxGeneral(NA_SE_SY_METRONOME_LV - SFX_FLAG, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
msgCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff();
|
||||
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
|
||||
if (((u32)msgCtx->ocarinaStaff->pos != 0) &&
|
||||
(sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) {
|
||||
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->buttonIndex;
|
||||
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_BTN_INVALID;
|
||||
sOcarinaButtonIndexBufPos++;
|
||||
|
@ -2796,7 +2803,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
break;
|
||||
case MSGMODE_MEMORY_GAME_ROUND_SUCCESS:
|
||||
msgCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff();
|
||||
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
|
||||
if (((u32)msgCtx->ocarinaStaff->pos != 0) &&
|
||||
(sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) {
|
||||
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->buttonIndex;
|
||||
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_BTN_INVALID;
|
||||
sOcarinaButtonIndexBufPos++;
|
||||
|
@ -2835,7 +2843,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
break;
|
||||
case MSGMODE_FROGS_PLAYING:
|
||||
msgCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff();
|
||||
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
|
||||
if (((u32)msgCtx->ocarinaStaff->pos != 0) &&
|
||||
(sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) {
|
||||
msgCtx->lastOcarinaButtonIndex = msgCtx->ocarinaStaff->buttonIndex;
|
||||
msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos = 0;
|
||||
Message_ResetOcarinaNoteState();
|
||||
|
@ -3318,7 +3327,7 @@ void Message_Update(PlayState* play) {
|
|||
// Later, if the ocarina has not been played and another textbox is closed, this handling
|
||||
// for Saria's song will be carried out.
|
||||
player->naviTextId = -0xE0;
|
||||
player->naviActor->flags |= 0x10000;
|
||||
player->naviActor->flags |= ACTOR_FLAG_16;
|
||||
}
|
||||
if (msgCtx->ocarinaAction == OCARINA_ACTION_FREE_PLAY_DONE &&
|
||||
(play->msgCtx.ocarinaMode == OCARINA_MODE_01 || play->msgCtx.ocarinaMode == OCARINA_MODE_0B)) {
|
||||
|
|
|
@ -514,7 +514,7 @@ void Play_Update(PlayState* this) {
|
|||
}
|
||||
}
|
||||
|
||||
if (this->transitionMode) { // != TRANS_MODE_OFF
|
||||
if ((u32)this->transitionMode != TRANS_MODE_OFF) {
|
||||
switch (this->transitionMode) {
|
||||
case TRANS_MODE_SETUP:
|
||||
if (this->transitionTrigger != TRANS_TRIGGER_END) {
|
||||
|
|
|
@ -1322,7 +1322,7 @@ void func_80090A28(Player* this, Vec3f* vecs) {
|
|||
D_8012608C.x = D_80126080.x;
|
||||
|
||||
if (this->unk_845 >= 3) {
|
||||
this->unk_845 += 1;
|
||||
this->unk_845++;
|
||||
D_8012608C.x *= 1.0f + ((9 - this->unk_845) * 0.1f);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue