mirror of https://github.com/zeldaret/mm.git
Enable `-Wint-conversion` warning (#1266)
* fixing some warnings * more pointer fixing * Use `-Wno-int-conversion` on audio files * more progress * fix * more pointer fixes * kinda progress * Fix remaining casts * Format * fix merge * fix warnings * fix parameter * use SEGMENT_ROM_START_OFFSET a bit more * format * fix audio warnings * some more fixes * fix en_go * review * review * whoops, missing cast * review * review * ->data * format * review * fix * asPtr * fix * Update src/code/sched.c Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * review * fix in EnDnh * improve format * engo * format * fix * format * Update include/z64.h Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * TexturePtr * fix warnings * fix warnings * format * fix * review --------- Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>
This commit is contained in:
parent
42e1c438e1
commit
f276d2b0e6
2
Makefile
2
Makefile
|
@ -108,7 +108,7 @@ endif
|
||||||
|
|
||||||
# Check code syntax with host compiler
|
# Check code syntax with host compiler
|
||||||
ifneq ($(RUN_CC_CHECK),0)
|
ifneq ($(RUN_CC_CHECK),0)
|
||||||
CHECK_WARNINGS := -Wall -Wextra -Wno-format-security -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-variable -Wno-missing-braces -Wno-int-conversion -Wno-unused-but-set-variable -Wno-unused-label -Wno-sign-compare -Wno-tautological-compare
|
CHECK_WARNINGS := -Wall -Wextra -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-variable -Wno-missing-braces -Wno-unused-but-set-variable -Wno-unused-label -Wno-sign-compare -Wno-tautological-compare
|
||||||
CC_CHECK := gcc -fno-builtin -fsyntax-only -funsigned-char -fdiagnostics-color -std=gnu89 -D _LANGUAGE_C -D NON_MATCHING $(IINC) -nostdinc $(CHECK_WARNINGS)
|
CC_CHECK := gcc -fno-builtin -fsyntax-only -funsigned-char -fdiagnostics-color -std=gnu89 -D _LANGUAGE_C -D NON_MATCHING $(IINC) -nostdinc $(CHECK_WARNINGS)
|
||||||
ifneq ($(WERROR), 0)
|
ifneq ($(WERROR), 0)
|
||||||
CC_CHECK += -Werror
|
CC_CHECK += -Werror
|
||||||
|
|
|
@ -248,7 +248,7 @@ typedef enum {
|
||||||
* @param sfxState
|
* @param sfxState
|
||||||
*/
|
*/
|
||||||
#define AUDIOCMD_CHANNEL_SET_SFX_STATE(seqPlayerIndex, channelIndex, sfxState) \
|
#define AUDIOCMD_CHANNEL_SET_SFX_STATE(seqPlayerIndex, channelIndex, sfxState) \
|
||||||
AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_CHANNEL_SET_SFX_STATE, seqPlayerIndex, channelIndex, 0), sfxState)
|
AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_CHANNEL_SET_SFX_STATE, seqPlayerIndex, channelIndex, 0), (s32)sfxState)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the reverb index.
|
* Set the reverb index.
|
||||||
|
@ -493,7 +493,7 @@ typedef enum {
|
||||||
* @param functionPtr
|
* @param functionPtr
|
||||||
*/
|
*/
|
||||||
#define AUDIOCMD_GLOBAL_SET_CUSTOM_FUNCTION(functionType, functionPtr) \
|
#define AUDIOCMD_GLOBAL_SET_CUSTOM_FUNCTION(functionType, functionPtr) \
|
||||||
AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_SET_CUSTOM_FUNCTION, 0, 0, functionType), functionPtr)
|
AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_SET_CUSTOM_FUNCTION, 0, 0, functionType), (s32)functionPtr)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do something related to the unloaded-type audio data in the heap.
|
* Do something related to the unloaded-type audio data in the heap.
|
||||||
|
@ -514,7 +514,7 @@ typedef enum {
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
#define AUDIOCMD_GLOBAL_SET_REVERB_DATA(reverbIndex, dataType, data) \
|
#define AUDIOCMD_GLOBAL_SET_REVERB_DATA(reverbIndex, dataType, data) \
|
||||||
AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_SET_REVERB_DATA, dataType, reverbIndex, 0), data)
|
AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_SET_REVERB_DATA, dataType, reverbIndex, 0), (s32)data)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the sound mode of audio
|
* Change the sound mode of audio
|
||||||
|
|
|
@ -541,8 +541,8 @@ void Color_RGB8_Lerp(Color_RGB8* from, Color_RGB8* to, f32 lerp, Color_RGB8* dst
|
||||||
void Lib_Nop801004FC(void);
|
void Lib_Nop801004FC(void);
|
||||||
void* Lib_SegmentedToVirtual(void* ptr);
|
void* Lib_SegmentedToVirtual(void* ptr);
|
||||||
void* Lib_SegmentedToVirtualNull(void* ptr);
|
void* Lib_SegmentedToVirtualNull(void* ptr);
|
||||||
void* Lib_VirtualToPhysical(void* ptr);
|
uintptr_t Lib_VirtualToPhysical(void* ptr);
|
||||||
void* Lib_PhysicalToVirtual(void* ptr);
|
void* Lib_PhysicalToVirtual(uintptr_t ptr);
|
||||||
void LifeMeter_Init(PlayState* play);
|
void LifeMeter_Init(PlayState* play);
|
||||||
void LifeMeter_UpdateColors(PlayState* play);
|
void LifeMeter_UpdateColors(PlayState* play);
|
||||||
s32 LifeMeter_SaveInterfaceHealth(PlayState* play);
|
s32 LifeMeter_SaveInterfaceHealth(PlayState* play);
|
||||||
|
|
|
@ -36,7 +36,7 @@ typedef struct OverlayRelocationSection {
|
||||||
} OverlayRelocationSection; // size >= 0x18
|
} OverlayRelocationSection; // size >= 0x18
|
||||||
|
|
||||||
// Fragment overlay load functions
|
// Fragment overlay load functions
|
||||||
size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart, uintptr_t vramEnd, void* allocatedRamAddr);
|
size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* ramStart, void* ramEnd, void* allocatedRamAddr);
|
||||||
void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart, uintptr_t vramEnd);
|
void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -9,7 +9,7 @@ extern s32 gScreenWidth;
|
||||||
extern s32 gScreenHeight;
|
extern s32 gScreenHeight;
|
||||||
extern size_t gSystemHeapSize;
|
extern size_t gSystemHeapSize;
|
||||||
|
|
||||||
extern u32 gSegments[NUM_SEGMENTS];
|
extern uintptr_t gSegments[NUM_SEGMENTS];
|
||||||
extern SchedContext gSchedContext;
|
extern SchedContext gSchedContext;
|
||||||
extern OSThread gGraphThread;
|
extern OSThread gGraphThread;
|
||||||
extern PadMgr gPadMgr;
|
extern PadMgr gPadMgr;
|
||||||
|
|
|
@ -24,9 +24,11 @@
|
||||||
#define SEGMENT_END(segment) (_ ## segment ## SegmentEnd)
|
#define SEGMENT_END(segment) (_ ## segment ## SegmentEnd)
|
||||||
#define SEGMENT_SIZE(segment) ((uintptr_t)SEGMENT_END(segment) - (uintptr_t)SEGMENT_START(segment))
|
#define SEGMENT_SIZE(segment) ((uintptr_t)SEGMENT_END(segment) - (uintptr_t)SEGMENT_START(segment))
|
||||||
|
|
||||||
#define SEGMENT_ROM_START(segment) (_ ## segment ## SegmentRomStart)
|
#define SEGMENT_ROM_START(segment) ((uintptr_t) _ ## segment ## SegmentRomStart)
|
||||||
#define SEGMENT_ROM_END(segment) (_ ## segment ## SegmentRomEnd)
|
#define SEGMENT_ROM_START_OFFSET(segment, offset) ((uintptr_t) (( _ ## segment ## SegmentRomStart ) + (offset)))
|
||||||
#define SEGMENT_ROM_SIZE(segment) ((uintptr_t)SEGMENT_ROM_END(segment) - (uintptr_t)SEGMENT_ROM_START(segment))
|
#define SEGMENT_ROM_END(segment) ((uintptr_t) _ ## segment ## SegmentRomEnd)
|
||||||
|
#define SEGMENT_ROM_SIZE(segment) (SEGMENT_ROM_END(segment) - SEGMENT_ROM_START(segment))
|
||||||
|
#define SEGMENT_ROM_SIZE_ALT(segment) ((size_t)( _ ## segment ## SegmentRomEnd - _ ## segment ## SegmentRomStart ))
|
||||||
|
|
||||||
#define SEGMENT_BSS_START(segment) (_ ## segment ## SegmentBssStart)
|
#define SEGMENT_BSS_START(segment) (_ ## segment ## SegmentBssStart)
|
||||||
#define SEGMENT_BSS_END(segment) (_ ## segment ## SegmentBssEnd)
|
#define SEGMENT_BSS_END(segment) (_ ## segment ## SegmentBssEnd)
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ s32 requestType;
|
/* 0x00 */ s32 requestType;
|
||||||
/* 0x04 */ OSMesg response;
|
/* 0x04 */ s32 response;
|
||||||
/* 0x08 */ void* addr;
|
/* 0x08 */ void* addr;
|
||||||
/* 0x0C */ s32 pageNum;
|
/* 0x0C */ s32 pageNum;
|
||||||
/* 0x10 */ s32 pageCount;
|
/* 0x10 */ s32 pageCount;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "ultra64.h"
|
#include "ultra64.h"
|
||||||
#include "libc/stdint.h"
|
#include "libc/stdint.h"
|
||||||
|
#include "libc/stddef.h"
|
||||||
|
|
||||||
typedef struct TwoHeadArena {
|
typedef struct TwoHeadArena {
|
||||||
/* 0x0 */ size_t size;
|
/* 0x0 */ size_t size;
|
||||||
|
@ -19,7 +20,7 @@ void* THA_AllocHeadByte(TwoHeadArena* tha);
|
||||||
void* THA_AllocTail(TwoHeadArena* tha, size_t size);
|
void* THA_AllocTail(TwoHeadArena* tha, size_t size);
|
||||||
void* THA_AllocTailAlign16(TwoHeadArena* tha, size_t size);
|
void* THA_AllocTailAlign16(TwoHeadArena* tha, size_t size);
|
||||||
void* THA_AllocTailAlign(TwoHeadArena* tha, size_t size, uintptr_t mask);
|
void* THA_AllocTailAlign(TwoHeadArena* tha, size_t size, uintptr_t mask);
|
||||||
s32 THA_GetRemaining(TwoHeadArena* tha);
|
ptrdiff_t THA_GetRemaining(TwoHeadArena* tha);
|
||||||
u32 THA_IsCrash(TwoHeadArena* tha);
|
u32 THA_IsCrash(TwoHeadArena* tha);
|
||||||
void THA_Reset(TwoHeadArena* tha);
|
void THA_Reset(TwoHeadArena* tha);
|
||||||
void THA_Init(TwoHeadArena* tha, void* start, size_t size);
|
void THA_Init(TwoHeadArena* tha, void* start, size_t size);
|
||||||
|
|
|
@ -597,6 +597,7 @@ typedef struct {
|
||||||
/* 0x4 */ s8 asSbyte;
|
/* 0x4 */ s8 asSbyte;
|
||||||
/* 0x4 */ u8 asUbyte;
|
/* 0x4 */ u8 asUbyte;
|
||||||
/* 0x4 */ u32 asUInt;
|
/* 0x4 */ u32 asUInt;
|
||||||
|
/* 0x4 */ void* asPtr;
|
||||||
};
|
};
|
||||||
} AudioCmd; // size = 0x8
|
} AudioCmd; // size = 0x8
|
||||||
|
|
||||||
|
@ -931,7 +932,7 @@ typedef struct {
|
||||||
|
|
||||||
typedef void (*AudioCustomUpdateFunction)(void);
|
typedef void (*AudioCustomUpdateFunction)(void);
|
||||||
typedef u32 (*AudioCustomSeqFunction)(s8 value, SequenceChannel* channel);
|
typedef u32 (*AudioCustomSeqFunction)(s8 value, SequenceChannel* channel);
|
||||||
typedef s32 (*AudioCustomReverbFunction)(Sample*, s32, s8, s32);
|
typedef void* (*AudioCustomReverbFunction)(Sample*, s32, s8, s32);
|
||||||
typedef Acmd* (*AudioCustomSynthFunction)(Acmd*, s32, s32);
|
typedef Acmd* (*AudioCustomSynthFunction)(Acmd*, s32, s32);
|
||||||
|
|
||||||
extern OSVoiceHandle gVoiceHandle;
|
extern OSVoiceHandle gVoiceHandle;
|
||||||
|
|
|
@ -199,8 +199,8 @@ typedef struct {
|
||||||
u16 wchar[640]; // msgBufWide
|
u16 wchar[640]; // msgBufWide
|
||||||
u64 force_structure_alignment_msg;
|
u64 force_structure_alignment_msg;
|
||||||
} msgBuf;
|
} msgBuf;
|
||||||
/* 0x11D80 */ u32 messageStart;
|
/* 0x11D80 */ uintptr_t messageStart;
|
||||||
/* 0x11D84 */ u32 messageEnd;
|
/* 0x11D84 */ uintptr_t messageEnd;
|
||||||
/* 0x11D88 */ u8 unk_11D88; // current Char Buffer ?
|
/* 0x11D88 */ u8 unk_11D88; // current Char Buffer ?
|
||||||
} Font; // size = 0x11D90
|
} Font; // size = 0x11D90
|
||||||
|
|
||||||
|
|
|
@ -1441,7 +1441,7 @@ void AudioHeap_ApplySampleBankCacheInternal(s32 apply, s32 sampleBankId) {
|
||||||
|
|
||||||
sampleBankTable = gAudioCtx.sampleBankTable;
|
sampleBankTable = gAudioCtx.sampleBankTable;
|
||||||
numFonts = gAudioCtx.soundFontTable->numEntries;
|
numFonts = gAudioCtx.soundFontTable->numEntries;
|
||||||
change.oldAddr = AudioHeap_SearchCaches(SAMPLE_TABLE, CACHE_EITHER, sampleBankId);
|
change.oldAddr = (uintptr_t)AudioHeap_SearchCaches(SAMPLE_TABLE, CACHE_EITHER, sampleBankId);
|
||||||
if (change.oldAddr == 0) {
|
if (change.oldAddr == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ typedef struct {
|
||||||
void AudioLoad_DiscardFont(s32 fontId);
|
void AudioLoad_DiscardFont(s32 fontId);
|
||||||
s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIndex, s32 seqId, s32 arg2);
|
s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIndex, s32 seqId, s32 arg2);
|
||||||
u8* AudioLoad_SyncLoadSeq(s32 seqId);
|
u8* AudioLoad_SyncLoadSeq(s32 seqId);
|
||||||
u32 AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad);
|
uintptr_t AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad);
|
||||||
SoundFontData* AudioLoad_SyncLoadFont(u32 fontId);
|
SoundFontData* AudioLoad_SyncLoadFont(u32 fontId);
|
||||||
void* AudioLoad_SyncLoad(s32 tableType, u32 id, s32* didAllocate);
|
void* AudioLoad_SyncLoad(s32 tableType, u32 id, s32* didAllocate);
|
||||||
u32 AudioLoad_GetRealTableIndex(s32 tableType, u32 id);
|
u32 AudioLoad_GetRealTableIndex(s32 tableType, u32 id);
|
||||||
|
@ -414,7 +414,7 @@ void AudioLoad_SyncLoadSeqParts(s32 seqId, s32 arg1, s32 arg2, OSMesgQueue* arg3
|
||||||
AudioLoad_SyncLoadSeq(seqId);
|
AudioLoad_SyncLoadSeq(seqId);
|
||||||
}
|
}
|
||||||
if (arg2 != 0) {
|
if (arg2 != 0) {
|
||||||
osSendMesg(arg3, arg2 << 0x18, OS_MESG_NOBLOCK);
|
osSendMesg(arg3, (OSMesg)(arg2 << 0x18), OS_MESG_NOBLOCK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -431,10 +431,10 @@ s32 AudioLoad_SyncLoadSample(Sample* sample, s32 fontId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sample->medium == MEDIUM_UNK) {
|
if (sample->medium == MEDIUM_UNK) {
|
||||||
AudioLoad_SyncDmaUnkMedium(sample->sampleAddr, sampleAddr, sample->size,
|
AudioLoad_SyncDmaUnkMedium((uintptr_t)sample->sampleAddr, sampleAddr, sample->size,
|
||||||
gAudioCtx.sampleBankTable->unkMediumParam);
|
gAudioCtx.sampleBankTable->unkMediumParam);
|
||||||
} else {
|
} else {
|
||||||
AudioLoad_SyncDma(sample->sampleAddr, sampleAddr, sample->size, sample->medium);
|
AudioLoad_SyncDma((uintptr_t)sample->sampleAddr, sampleAddr, sample->size, sample->medium);
|
||||||
}
|
}
|
||||||
sample->medium = MEDIUM_RAM;
|
sample->medium = MEDIUM_RAM;
|
||||||
sample->sampleAddr = sampleAddr;
|
sample->sampleAddr = sampleAddr;
|
||||||
|
@ -471,7 +471,7 @@ s32 AudioLoad_SyncLoadInstrument(s32 fontId, s32 instId, s32 drumId) {
|
||||||
|
|
||||||
void AudioLoad_AsyncLoad(s32 tableType, s32 id, s32 nChunks, s32 retData, OSMesgQueue* retQueue) {
|
void AudioLoad_AsyncLoad(s32 tableType, s32 id, s32 nChunks, s32 retData, OSMesgQueue* retQueue) {
|
||||||
if (AudioLoad_AsyncLoadInner(tableType, id, nChunks, retData, retQueue) == NULL) {
|
if (AudioLoad_AsyncLoadInner(tableType, id, nChunks, retData, retQueue) == NULL) {
|
||||||
osSendMesg(retQueue, 0xFFFFFFFF, OS_MESG_NOBLOCK);
|
osSendMesg(retQueue, (OSMesg)0xFFFFFFFF, OS_MESG_NOBLOCK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -632,11 +632,11 @@ u8* AudioLoad_SyncLoadSeq(s32 seqId) {
|
||||||
return AudioLoad_SyncLoad(SEQUENCE_TABLE, seqId, &didAllocate);
|
return AudioLoad_SyncLoad(SEQUENCE_TABLE, seqId, &didAllocate);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 AudioLoad_GetSampleBank(u32 sampleBankId, u32* outMedium) {
|
uintptr_t AudioLoad_GetSampleBank(u32 sampleBankId, u32* outMedium) {
|
||||||
return AudioLoad_TrySyncLoadSampleBank(sampleBankId, outMedium, true);
|
return AudioLoad_TrySyncLoadSampleBank(sampleBankId, outMedium, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad) {
|
uintptr_t AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad) {
|
||||||
void* addr;
|
void* addr;
|
||||||
AudioTable* sampleBankTable;
|
AudioTable* sampleBankTable;
|
||||||
u32 realTableId = AudioLoad_GetRealTableIndex(SAMPLE_TABLE, sampleBankId);
|
u32 realTableId = AudioLoad_GetRealTableIndex(SAMPLE_TABLE, sampleBankId);
|
||||||
|
@ -651,7 +651,7 @@ u32 AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad
|
||||||
}
|
}
|
||||||
|
|
||||||
*outMedium = MEDIUM_RAM;
|
*outMedium = MEDIUM_RAM;
|
||||||
return addr;
|
return (uintptr_t)addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
cachePolicy = sampleBankTable->entries[sampleBankId].cachePolicy;
|
cachePolicy = sampleBankTable->entries[sampleBankId].cachePolicy;
|
||||||
|
@ -664,7 +664,7 @@ u32 AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad
|
||||||
addr = AudioLoad_SyncLoad(SAMPLE_TABLE, sampleBankId, &noLoad);
|
addr = AudioLoad_SyncLoad(SAMPLE_TABLE, sampleBankId, &noLoad);
|
||||||
if (addr != NULL) {
|
if (addr != NULL) {
|
||||||
*outMedium = MEDIUM_RAM;
|
*outMedium = MEDIUM_RAM;
|
||||||
return addr;
|
return (uintptr_t)addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
*outMedium = sampleBankTable->entries[sampleBankId].medium;
|
*outMedium = sampleBankTable->entries[sampleBankId].medium;
|
||||||
|
@ -785,7 +785,7 @@ void* AudioLoad_SyncLoad(s32 tableType, u32 id, s32* didAllocate) {
|
||||||
size -= 0x10;
|
size -= 0x10;
|
||||||
}
|
}
|
||||||
|
|
||||||
bcopy(romAddr, ramAddr, size);
|
bcopy((void*)romAddr, ramAddr, size);
|
||||||
} else if (medium2 == mediumUnk) {
|
} else if (medium2 == mediumUnk) {
|
||||||
AudioLoad_SyncDmaUnkMedium(romAddr, ramAddr, size, (s16)table->unkMediumParam);
|
AudioLoad_SyncDmaUnkMedium(romAddr, ramAddr, size, (s16)table->unkMediumParam);
|
||||||
} else {
|
} else {
|
||||||
|
@ -867,7 +867,7 @@ AudioTable* AudioLoad_GetLoadTable(s32 tableType) {
|
||||||
* @param sampleBankReloc information on the sampleBank containing raw audio samples
|
* @param sampleBankReloc information on the sampleBank containing raw audio samples
|
||||||
*/
|
*/
|
||||||
void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, SampleBankRelocInfo* sampleBankReloc) {
|
void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, SampleBankRelocInfo* sampleBankReloc) {
|
||||||
uintptr_t soundOffset;
|
void* soundOffset;
|
||||||
uintptr_t soundListOffset;
|
uintptr_t soundListOffset;
|
||||||
Instrument* inst;
|
Instrument* inst;
|
||||||
Drum* drum;
|
Drum* drum;
|
||||||
|
@ -876,7 +876,7 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample
|
||||||
s32 numDrums = gAudioCtx.soundFontList[fontId].numDrums;
|
s32 numDrums = gAudioCtx.soundFontList[fontId].numDrums;
|
||||||
s32 numInstruments = gAudioCtx.soundFontList[fontId].numInstruments;
|
s32 numInstruments = gAudioCtx.soundFontList[fontId].numInstruments;
|
||||||
s32 numSfx = gAudioCtx.soundFontList[fontId].numSfx;
|
s32 numSfx = gAudioCtx.soundFontList[fontId].numSfx;
|
||||||
u32* fontData = (u32*)fontDataStartAddr;
|
uintptr_t* fontData = (uintptr_t*)fontDataStartAddr;
|
||||||
|
|
||||||
// Relocate an offset (relative to the start of the font data) to a pointer (a ram address)
|
// Relocate an offset (relative to the start of the font data) to a pointer (a ram address)
|
||||||
#define RELOC_TO_RAM(x) (void*)((uintptr_t)(x) + (uintptr_t)(fontDataStartAddr))
|
#define RELOC_TO_RAM(x) (void*)((uintptr_t)(x) + (uintptr_t)(fontDataStartAddr))
|
||||||
|
@ -889,7 +889,7 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample
|
||||||
// If the soundFont has drums
|
// If the soundFont has drums
|
||||||
if ((soundListOffset != 0) && (numDrums != 0)) {
|
if ((soundListOffset != 0) && (numDrums != 0)) {
|
||||||
|
|
||||||
fontData[0] = RELOC_TO_RAM(soundListOffset);
|
fontData[0] = (uintptr_t)RELOC_TO_RAM(soundListOffset);
|
||||||
|
|
||||||
// Loop through the drum offsets
|
// Loop through the drum offsets
|
||||||
for (i = 0; i < numDrums; i++) {
|
for (i = 0; i < numDrums; i++) {
|
||||||
|
@ -897,7 +897,7 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample
|
||||||
soundOffset = ((Drum**)fontData[0])[i];
|
soundOffset = ((Drum**)fontData[0])[i];
|
||||||
|
|
||||||
// Some drum data entries are empty, represented by an offset of 0 in the list of drum offsets
|
// Some drum data entries are empty, represented by an offset of 0 in the list of drum offsets
|
||||||
if (soundOffset == 0) {
|
if (soundOffset == NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
soundOffset = RELOC_TO_RAM(soundOffset);
|
soundOffset = RELOC_TO_RAM(soundOffset);
|
||||||
|
@ -925,7 +925,7 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample
|
||||||
// If the soundFont has sound effects
|
// If the soundFont has sound effects
|
||||||
if ((soundListOffset != 0) && (numSfx != 0)) {
|
if ((soundListOffset != 0) && (numSfx != 0)) {
|
||||||
|
|
||||||
fontData[1] = RELOC_TO_RAM(soundListOffset);
|
fontData[1] = (uintptr_t)RELOC_TO_RAM(soundListOffset);
|
||||||
|
|
||||||
// Loop through the sound effects
|
// Loop through the sound effects
|
||||||
for (i = 0; i < numSfx; i++) {
|
for (i = 0; i < numSfx; i++) {
|
||||||
|
@ -955,7 +955,7 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample
|
||||||
for (i = 2; i <= 2 + numInstruments - 1; i++) {
|
for (i = 2; i <= 2 + numInstruments - 1; i++) {
|
||||||
// Some instrument data entries are empty, represented by an offset of 0 in the list of instrument offsets
|
// Some instrument data entries are empty, represented by an offset of 0 in the list of instrument offsets
|
||||||
if (fontData[i] != 0) {
|
if (fontData[i] != 0) {
|
||||||
fontData[i] = RELOC_TO_RAM(fontData[i]);
|
fontData[i] = (uintptr_t)RELOC_TO_RAM(fontData[i]);
|
||||||
inst = (Instrument*)fontData[i];
|
inst = (Instrument*)fontData[i];
|
||||||
|
|
||||||
// The instrument may be in the list multiple times and already relocated
|
// The instrument may be in the list multiple times and already relocated
|
||||||
|
@ -1097,7 +1097,7 @@ void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData,
|
||||||
ramAddr = AudioLoad_SearchCaches(tableType, realId);
|
ramAddr = AudioLoad_SearchCaches(tableType, realId);
|
||||||
if (ramAddr != NULL) {
|
if (ramAddr != NULL) {
|
||||||
loadStatus = LOAD_STATUS_COMPLETE;
|
loadStatus = LOAD_STATUS_COMPLETE;
|
||||||
osSendMesg(retQueue, MK_ASYNC_MSG(retData, 0, 0, LOAD_STATUS_NOT_LOADED), OS_MESG_NOBLOCK);
|
osSendMesg(retQueue, (OSMesg)MK_ASYNC_MSG(retData, 0, 0, LOAD_STATUS_NOT_LOADED), OS_MESG_NOBLOCK);
|
||||||
} else {
|
} else {
|
||||||
table = AudioLoad_GetLoadTable(tableType);
|
table = AudioLoad_GetLoadTable(tableType);
|
||||||
size = table->entries[realId].size;
|
size = table->entries[realId].size;
|
||||||
|
@ -1376,7 +1376,7 @@ s32 AudioLoad_SlowLoadSample(s32 fontId, s32 instId, s8* isDone) {
|
||||||
slowLoad->status = LOAD_STATUS_START;
|
slowLoad->status = LOAD_STATUS_START;
|
||||||
slowLoad->bytesRemaining = ALIGN16(sample->size);
|
slowLoad->bytesRemaining = ALIGN16(sample->size);
|
||||||
slowLoad->ramAddr = slowLoad->curRamAddr;
|
slowLoad->ramAddr = slowLoad->curRamAddr;
|
||||||
slowLoad->curDevAddr = sample->sampleAddr;
|
slowLoad->curDevAddr = (uintptr_t)sample->sampleAddr;
|
||||||
slowLoad->medium = sample->medium;
|
slowLoad->medium = sample->medium;
|
||||||
slowLoad->seqOrFontId = fontId;
|
slowLoad->seqOrFontId = fontId;
|
||||||
slowLoad->instId = instId;
|
slowLoad->instId = instId;
|
||||||
|
@ -1464,7 +1464,7 @@ void AudioLoad_ProcessSlowLoads(s32 resetStatus) {
|
||||||
if (slowLoad->medium == MEDIUM_UNK) {
|
if (slowLoad->medium == MEDIUM_UNK) {
|
||||||
size_t size = slowLoad->bytesRemaining;
|
size_t size = slowLoad->bytesRemaining;
|
||||||
|
|
||||||
AudioLoad_DmaSlowCopyUnkMedium(slowLoad->curDevAddr, slowLoad->curRamAddr, size,
|
AudioLoad_DmaSlowCopyUnkMedium(slowLoad->curDevAddr, (uintptr_t)slowLoad->curRamAddr, size,
|
||||||
slowLoad->unkMediumParam);
|
slowLoad->unkMediumParam);
|
||||||
} else {
|
} else {
|
||||||
AudioLoad_DmaSlowCopy(slowLoad, slowLoad->bytesRemaining);
|
AudioLoad_DmaSlowCopy(slowLoad, slowLoad->bytesRemaining);
|
||||||
|
@ -1472,7 +1472,7 @@ void AudioLoad_ProcessSlowLoads(s32 resetStatus) {
|
||||||
slowLoad->bytesRemaining = 0;
|
slowLoad->bytesRemaining = 0;
|
||||||
} else {
|
} else {
|
||||||
if (slowLoad->medium == MEDIUM_UNK) {
|
if (slowLoad->medium == MEDIUM_UNK) {
|
||||||
AudioLoad_DmaSlowCopyUnkMedium(slowLoad->curDevAddr, slowLoad->curRamAddr, 0x400,
|
AudioLoad_DmaSlowCopyUnkMedium(slowLoad->curDevAddr, (uintptr_t)slowLoad->curRamAddr, 0x400,
|
||||||
slowLoad->unkMediumParam);
|
slowLoad->unkMediumParam);
|
||||||
} else {
|
} else {
|
||||||
AudioLoad_DmaSlowCopy(slowLoad, 0x400);
|
AudioLoad_DmaSlowCopy(slowLoad, 0x400);
|
||||||
|
@ -1671,7 +1671,7 @@ void AudioLoad_FinishAsyncLoad(AudioAsyncLoad* asyncLoad) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
doneMsg = asyncLoad->retMsg;
|
doneMsg = (OSMesg)asyncLoad->retMsg;
|
||||||
if (1) {}
|
if (1) {}
|
||||||
asyncLoad->status = LOAD_STATUS_WAITING;
|
asyncLoad->status = LOAD_STATUS_WAITING;
|
||||||
osSendMesg(asyncLoad->retQueue, doneMsg, OS_MESG_NOBLOCK);
|
osSendMesg(asyncLoad->retQueue, doneMsg, OS_MESG_NOBLOCK);
|
||||||
|
@ -1743,7 +1743,7 @@ void AudioLoad_AsyncDmaRamUnloaded(AudioAsyncLoad* asyncLoad, size_t size) {
|
||||||
size = ALIGN16(size);
|
size = ALIGN16(size);
|
||||||
Audio_InvalDCache(asyncLoad->curRamAddr, size);
|
Audio_InvalDCache(asyncLoad->curRamAddr, size);
|
||||||
osCreateMesgQueue(&asyncLoad->msgQueue, &asyncLoad->msg, 1);
|
osCreateMesgQueue(&asyncLoad->msgQueue, &asyncLoad->msg, 1);
|
||||||
bcopy(asyncLoad->curDevAddr, asyncLoad->curRamAddr, size);
|
bcopy((void*)asyncLoad->curDevAddr, asyncLoad->curRamAddr, size);
|
||||||
osSendMesg(&asyncLoad->msgQueue, NULL, OS_MESG_NOBLOCK);
|
osSendMesg(&asyncLoad->msgQueue, NULL, OS_MESG_NOBLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -500,12 +500,12 @@ Acmd* AudioSynth_SaveResampledReverbSamples(Acmd* cmd, SynthesisReverb* reverb,
|
||||||
aResample(cmd++, reverb->resampleFlags, entry->saveResamplePitch, reverb->leftSaveResampleBuf);
|
aResample(cmd++, reverb->resampleFlags, entry->saveResamplePitch, reverb->leftSaveResampleBuf);
|
||||||
|
|
||||||
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, DMEM_WET_SCRATCH, entry->size,
|
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, DMEM_WET_SCRATCH, entry->size,
|
||||||
&reverb->leftReverbBuf[entry->startPos]);
|
(uintptr_t)&reverb->leftReverbBuf[entry->startPos]);
|
||||||
|
|
||||||
if (entry->wrappedSize != 0) {
|
if (entry->wrappedSize != 0) {
|
||||||
// Ring buffer wrapped
|
// Ring buffer wrapped
|
||||||
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, entry->size + DMEM_WET_SCRATCH, entry->wrappedSize,
|
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, entry->size + DMEM_WET_SCRATCH, entry->wrappedSize,
|
||||||
reverb->leftReverbBuf);
|
(uintptr_t)reverb->leftReverbBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Right Resample
|
// Right Resample
|
||||||
|
@ -514,12 +514,12 @@ Acmd* AudioSynth_SaveResampledReverbSamples(Acmd* cmd, SynthesisReverb* reverb,
|
||||||
aResample(cmd++, reverb->resampleFlags, entry->saveResamplePitch, reverb->rightSaveResampleBuf);
|
aResample(cmd++, reverb->resampleFlags, entry->saveResamplePitch, reverb->rightSaveResampleBuf);
|
||||||
|
|
||||||
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, DMEM_WET_SCRATCH, entry->size,
|
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, DMEM_WET_SCRATCH, entry->size,
|
||||||
&reverb->rightReverbBuf[entry->startPos]);
|
(uintptr_t)&reverb->rightReverbBuf[entry->startPos]);
|
||||||
|
|
||||||
if (entry->wrappedSize != 0) {
|
if (entry->wrappedSize != 0) {
|
||||||
// Ring buffer wrapped
|
// Ring buffer wrapped
|
||||||
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, entry->size + DMEM_WET_SCRATCH, entry->wrappedSize,
|
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, entry->size + DMEM_WET_SCRATCH, entry->wrappedSize,
|
||||||
reverb->rightReverbBuf);
|
(uintptr_t)reverb->rightReverbBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cmd;
|
return cmd;
|
||||||
|
@ -716,16 +716,16 @@ Acmd* AudioSynth_SaveReverbSamples(Acmd* cmd, SynthesisReverb* reverb, s16 updat
|
||||||
|
|
||||||
if (entry->size != 0) {
|
if (entry->size != 0) {
|
||||||
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, DMEM_WET_LEFT_CH, entry->size,
|
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, DMEM_WET_LEFT_CH, entry->size,
|
||||||
&reverb->leftReverbBuf[entry->startPos]);
|
(uintptr_t)&reverb->leftReverbBuf[entry->startPos]);
|
||||||
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, DMEM_WET_RIGHT_CH, entry->size,
|
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, DMEM_WET_RIGHT_CH, entry->size,
|
||||||
&reverb->rightReverbBuf[entry->startPos]);
|
(uintptr_t)&reverb->rightReverbBuf[entry->startPos]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry->wrappedSize != 0) {
|
if (entry->wrappedSize != 0) {
|
||||||
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, entry->size + DMEM_WET_LEFT_CH, entry->wrappedSize,
|
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, entry->size + DMEM_WET_LEFT_CH, entry->wrappedSize,
|
||||||
reverb->leftReverbBuf);
|
(uintptr_t)reverb->leftReverbBuf);
|
||||||
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, entry->size + DMEM_WET_RIGHT_CH, entry->wrappedSize,
|
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, entry->size + DMEM_WET_RIGHT_CH, entry->wrappedSize,
|
||||||
reverb->rightReverbBuf);
|
(uintptr_t)reverb->rightReverbBuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1170,7 +1170,7 @@ Acmd* AudioSynth_ProcessSample(s32 noteIndex, NoteSampleState* sampleState, Note
|
||||||
} else {
|
} else {
|
||||||
// This medium is not in ram, so dma the requested sample into ram
|
// This medium is not in ram, so dma the requested sample into ram
|
||||||
samplesToLoadAddr =
|
samplesToLoadAddr =
|
||||||
AudioLoad_DmaSampleData(sampleAddr + (zeroOffset + sampleAddrOffset),
|
AudioLoad_DmaSampleData((uintptr_t)(sampleAddr + (zeroOffset + sampleAddrOffset)),
|
||||||
ALIGN16((numFramesToDecode * frameSize) + SAMPLES_PER_FRAME), flags,
|
ALIGN16((numFramesToDecode * frameSize) + SAMPLES_PER_FRAME), flags,
|
||||||
&synthState->sampleDmaIndex, sample->medium);
|
&synthState->sampleDmaIndex, sample->medium);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ AudioTask* AudioThread_UpdateImpl(void) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
osSendMesg(gAudioCtx.taskStartQueueP, gAudioCtx.totalTaskCount, OS_MESG_NOBLOCK);
|
osSendMesg(gAudioCtx.taskStartQueueP, (OSMesg)gAudioCtx.totalTaskCount, OS_MESG_NOBLOCK);
|
||||||
gAudioCtx.rspTaskIndex ^= 1;
|
gAudioCtx.rspTaskIndex ^= 1;
|
||||||
gAudioCtx.curAiBufferIndex++;
|
gAudioCtx.curAiBufferIndex++;
|
||||||
gAudioCtx.curAiBufferIndex %= 3;
|
gAudioCtx.curAiBufferIndex %= 3;
|
||||||
|
@ -96,7 +96,7 @@ AudioTask* AudioThread_UpdateImpl(void) {
|
||||||
if (gAudioCtx.resetStatus != 0) {
|
if (gAudioCtx.resetStatus != 0) {
|
||||||
if (AudioHeap_ResetStep() == 0) {
|
if (AudioHeap_ResetStep() == 0) {
|
||||||
if (gAudioCtx.resetStatus == 0) {
|
if (gAudioCtx.resetStatus == 0) {
|
||||||
osSendMesg(gAudioCtx.audioResetQueueP, gAudioCtx.specId, OS_MESG_NOBLOCK);
|
osSendMesg(gAudioCtx.audioResetQueueP, (OSMesg)(uintptr_t)gAudioCtx.specId, OS_MESG_NOBLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
sWaitingAudioTask = NULL;
|
sWaitingAudioTask = NULL;
|
||||||
|
@ -146,7 +146,7 @@ AudioTask* AudioThread_UpdateImpl(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gAudioSPDataPtr == (u64*)gAudioCtx.curAbiCmdBuf) {
|
if (gAudioSPDataPtr == (u64*)gAudioCtx.curAbiCmdBuf) {
|
||||||
return -1;
|
return (void*)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
gAudioCtx.curAbiCmdBuf =
|
gAudioCtx.curAbiCmdBuf =
|
||||||
|
@ -297,16 +297,16 @@ void AudioThread_ProcessGlobalCmd(AudioCmd* cmd) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AUDIOCMD_OP_GLOBAL_SET_CUSTOM_UPDATE_FUNCTION:
|
case AUDIOCMD_OP_GLOBAL_SET_CUSTOM_UPDATE_FUNCTION:
|
||||||
gAudioCustomUpdateFunction = cmd->asUInt;
|
gAudioCustomUpdateFunction = cmd->asPtr;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AUDIOCMD_OP_GLOBAL_SET_CUSTOM_FUNCTION:
|
case AUDIOCMD_OP_GLOBAL_SET_CUSTOM_FUNCTION:
|
||||||
if (cmd->arg2 == AUDIO_CUSTOM_FUNCTION_REVERB) {
|
if (cmd->arg2 == AUDIO_CUSTOM_FUNCTION_REVERB) {
|
||||||
gAudioCustomReverbFunction = cmd->asUInt;
|
gAudioCustomReverbFunction = cmd->asPtr;
|
||||||
} else if (cmd->arg2 == AUDIO_CUSTOM_FUNCTION_SYNTH) {
|
} else if (cmd->arg2 == AUDIO_CUSTOM_FUNCTION_SYNTH) {
|
||||||
gAudioCustomSynthFunction = cmd->asUInt;
|
gAudioCustomSynthFunction = cmd->asPtr;
|
||||||
} else {
|
} else {
|
||||||
gAudioCtx.customSeqFunctions[cmd->arg2] = cmd->asUInt;
|
gAudioCtx.customSeqFunctions[cmd->arg2] = cmd->asPtr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -314,7 +314,7 @@ void AudioThread_ProcessGlobalCmd(AudioCmd* cmd) {
|
||||||
case AUDIOCMD_OP_GLOBAL_SET_SFX_FONT:
|
case AUDIOCMD_OP_GLOBAL_SET_SFX_FONT:
|
||||||
case AUDIOCMD_OP_GLOBAL_SET_INSTRUMENT_FONT:
|
case AUDIOCMD_OP_GLOBAL_SET_INSTRUMENT_FONT:
|
||||||
if (AudioPlayback_SetFontInstrument(cmd->op - AUDIOCMD_OP_GLOBAL_SET_DRUM_FONT, cmd->arg1, cmd->arg2,
|
if (AudioPlayback_SetFontInstrument(cmd->op - AUDIOCMD_OP_GLOBAL_SET_DRUM_FONT, cmd->arg1, cmd->arg2,
|
||||||
cmd->asInt)) {}
|
cmd->asPtr)) {}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AUDIOCMD_OP_GLOBAL_DISABLE_ALL_SEQPLAYERS: {
|
case AUDIOCMD_OP_GLOBAL_DISABLE_ALL_SEQPLAYERS: {
|
||||||
|
@ -791,13 +791,13 @@ void AudioThread_ProcessChannelCmd(SequenceChannel* channel, AudioCmd* cmd) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AUDIOCMD_OP_CHANNEL_SET_SFX_STATE:
|
case AUDIOCMD_OP_CHANNEL_SET_SFX_STATE:
|
||||||
channel->sfxState = cmd->asUInt;
|
channel->sfxState = cmd->asPtr;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AUDIOCMD_OP_CHANNEL_SET_FILTER:
|
case AUDIOCMD_OP_CHANNEL_SET_FILTER:
|
||||||
filterCutoff = cmd->arg2;
|
filterCutoff = cmd->arg2;
|
||||||
if (cmd->asUInt != 0) {
|
if (cmd->asPtr != NULL) {
|
||||||
channel->filter = cmd->asUInt;
|
channel->filter = cmd->asPtr;
|
||||||
}
|
}
|
||||||
if (channel->filter != NULL) {
|
if (channel->filter != NULL) {
|
||||||
AudioHeap_LoadFilter(channel->filter, filterCutoff >> 4, filterCutoff & 0xF);
|
AudioHeap_LoadFilter(channel->filter, filterCutoff >> 4, filterCutoff & 0xF);
|
||||||
|
|
|
@ -135,10 +135,10 @@ void Fragment_Relocate(void* allocatedRamAddr, OverlayRelocationSection* ovlRelo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t Fragment_Load(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart, void* allocatedRamAddr,
|
size_t Fragment_Load(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* allocatedRamAddr,
|
||||||
size_t allocatedBytes) {
|
size_t allocatedBytes) {
|
||||||
size_t size = vromEnd - vromStart;
|
size_t size = vromEnd - vromStart;
|
||||||
void* end;
|
uintptr_t end;
|
||||||
s32 pad;
|
s32 pad;
|
||||||
OverlayRelocationSection* ovlRelocs;
|
OverlayRelocationSection* ovlRelocs;
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ size_t Fragment_Load(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart
|
||||||
end = (uintptr_t)allocatedRamAddr + size;
|
end = (uintptr_t)allocatedRamAddr + size;
|
||||||
DmaMgr_SendRequest0(allocatedRamAddr, vromStart, size);
|
DmaMgr_SendRequest0(allocatedRamAddr, vromStart, size);
|
||||||
|
|
||||||
ovlRelocs = (OverlayRelocationSection*)((uintptr_t)end - ((s32*)end)[-1]);
|
ovlRelocs = (OverlayRelocationSection*)(end - ((s32*)end)[-1]);
|
||||||
|
|
||||||
if (gLoadLogSeverity >= 3) {}
|
if (gLoadLogSeverity >= 3) {}
|
||||||
|
|
||||||
|
@ -161,11 +161,11 @@ size_t Fragment_Load(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart
|
||||||
|
|
||||||
if (gLoadLogSeverity >= 3) {}
|
if (gLoadLogSeverity >= 3) {}
|
||||||
|
|
||||||
Fragment_Relocate(allocatedRamAddr, ovlRelocs, vramStart);
|
Fragment_Relocate(allocatedRamAddr, ovlRelocs, (uintptr_t)vramStart);
|
||||||
|
|
||||||
if (ovlRelocs->bssSize != 0) {
|
if (ovlRelocs->bssSize != 0) {
|
||||||
if (gLoadLogSeverity >= 3) {}
|
if (gLoadLogSeverity >= 3) {}
|
||||||
bzero(end, ovlRelocs->bssSize);
|
bzero((void*)end, ovlRelocs->bssSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
osWritebackDCache(allocatedRamAddr, allocatedBytes);
|
osWritebackDCache(allocatedRamAddr, allocatedBytes);
|
||||||
|
@ -176,9 +176,9 @@ size_t Fragment_Load(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart
|
||||||
return allocatedBytes;
|
return allocatedBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* Fragment_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart) {
|
void* Fragment_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart) {
|
||||||
size_t size = vromEnd - vromStart;
|
size_t size = vromEnd - vromStart;
|
||||||
void* end;
|
uintptr_t end;
|
||||||
void* allocatedRamAddr;
|
void* allocatedRamAddr;
|
||||||
uintptr_t ovlOffset;
|
uintptr_t ovlOffset;
|
||||||
OverlayRelocationSection* ovlRelocs;
|
OverlayRelocationSection* ovlRelocs;
|
||||||
|
@ -195,8 +195,8 @@ void* Fragment_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t
|
||||||
|
|
||||||
if (gLoadLogSeverity >= 3) {}
|
if (gLoadLogSeverity >= 3) {}
|
||||||
|
|
||||||
ovlOffset = (uintptr_t)end - 4;
|
ovlOffset = end - sizeof(s32);
|
||||||
ovlRelocs = (OverlayRelocationSection*)((uintptr_t)end - ((s32*)end)[-1]);
|
ovlRelocs = (OverlayRelocationSection*)(end - ((s32*)end)[-1]);
|
||||||
|
|
||||||
if (1) {}
|
if (1) {}
|
||||||
|
|
||||||
|
@ -212,15 +212,15 @@ void* Fragment_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t
|
||||||
}
|
}
|
||||||
|
|
||||||
end = (uintptr_t)allocatedRamAddr + size;
|
end = (uintptr_t)allocatedRamAddr + size;
|
||||||
ovlRelocs = (OverlayRelocationSection*)((uintptr_t)end - *(uintptr_t*)ovlOffset);
|
ovlRelocs = (OverlayRelocationSection*)(end - *(uintptr_t*)ovlOffset);
|
||||||
|
|
||||||
if (gLoadLogSeverity >= 3) {}
|
if (gLoadLogSeverity >= 3) {}
|
||||||
|
|
||||||
Fragment_Relocate(allocatedRamAddr, ovlRelocs, vramStart);
|
Fragment_Relocate(allocatedRamAddr, ovlRelocs, (uintptr_t)vramStart);
|
||||||
|
|
||||||
if (ovlRelocs->bssSize != 0) {
|
if (ovlRelocs->bssSize != 0) {
|
||||||
if (gLoadLogSeverity >= 3) {}
|
if (gLoadLogSeverity >= 3) {}
|
||||||
bzero(end, ovlRelocs->bssSize);
|
bzero((void*)end, ovlRelocs->bssSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
osInvalICache(allocatedRamAddr, allocatedBytes);
|
osInvalICache(allocatedRamAddr, allocatedBytes);
|
||||||
|
|
|
@ -131,11 +131,11 @@ void Overlay_Relocate(void* allocatedRamAddr, OverlayRelocationSection* ovlReloc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart, uintptr_t vramEnd,
|
size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* ramStart, void* ramEnd, void* allocatedRamAddr) {
|
||||||
void* allocatedRamAddr) {
|
uintptr_t vramStart = (uintptr_t)ramStart;
|
||||||
s32 pad[2];
|
uintptr_t vramEnd = (uintptr_t)ramEnd;
|
||||||
s32 size = vromEnd - vromStart;
|
s32 size = vromEnd - vromStart;
|
||||||
void* end;
|
uintptr_t end;
|
||||||
OverlayRelocationSection* ovlRelocs;
|
OverlayRelocationSection* ovlRelocs;
|
||||||
|
|
||||||
if (gOverlayLogSeverity >= 3) {}
|
if (gOverlayLogSeverity >= 3) {}
|
||||||
|
@ -144,7 +144,7 @@ size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart,
|
||||||
end = (uintptr_t)allocatedRamAddr + size;
|
end = (uintptr_t)allocatedRamAddr + size;
|
||||||
DmaMgr_SendRequest0(allocatedRamAddr, vromStart, size);
|
DmaMgr_SendRequest0(allocatedRamAddr, vromStart, size);
|
||||||
|
|
||||||
ovlRelocs = (OverlayRelocationSection*)((uintptr_t)end - ((s32*)end)[-1]);
|
ovlRelocs = (OverlayRelocationSection*)(end - ((s32*)end)[-1]);
|
||||||
|
|
||||||
if (gOverlayLogSeverity >= 3) {}
|
if (gOverlayLogSeverity >= 3) {}
|
||||||
if (gOverlayLogSeverity >= 3) {}
|
if (gOverlayLogSeverity >= 3) {}
|
||||||
|
@ -153,7 +153,7 @@ size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart,
|
||||||
|
|
||||||
if (ovlRelocs->bssSize != 0) {
|
if (ovlRelocs->bssSize != 0) {
|
||||||
if (gOverlayLogSeverity >= 3) {}
|
if (gOverlayLogSeverity >= 3) {}
|
||||||
bzero(end, ovlRelocs->bssSize);
|
bzero((void*)end, ovlRelocs->bssSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
size = vramEnd - vramStart;
|
size = vramEnd - vramStart;
|
||||||
|
@ -166,8 +166,8 @@ size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart,
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart, uintptr_t vramEnd) {
|
void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd) {
|
||||||
void* allocatedRamAddr = SystemArena_MallocR(vramEnd - vramStart);
|
void* allocatedRamAddr = SystemArena_MallocR((uintptr_t)vramEnd - (uintptr_t)vramStart);
|
||||||
|
|
||||||
if (allocatedRamAddr != NULL) {
|
if (allocatedRamAddr != NULL) {
|
||||||
Overlay_Load(vromStart, vromEnd, vramStart, vramEnd, allocatedRamAddr);
|
Overlay_Load(vromStart, vromEnd, vramStart, vramEnd, allocatedRamAddr);
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "system_malloc.h"
|
#include "system_malloc.h"
|
||||||
|
|
||||||
typedef void (*BlockFunc)(void*);
|
typedef void (*BlockFunc)(uintptr_t);
|
||||||
typedef void (*BlockFunc1)(void*, u32);
|
typedef void (*BlockFunc1)(uintptr_t, u32);
|
||||||
typedef void (*BlockFunc8)(void*, u32, u32, u32, u32, u32, u32, u32, u32);
|
typedef void (*BlockFunc8)(uintptr_t, u32, u32, u32, u32, u32, u32, u32, u32);
|
||||||
|
|
||||||
typedef struct InitFunc {
|
typedef struct InitFunc {
|
||||||
/* 0x0 */ uintptr_t nextOffset;
|
/* 0x0 */ uintptr_t nextOffset;
|
||||||
|
@ -41,7 +41,7 @@ void SystemHeap_Free(void* ptr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemHeap_RunBlockFunc(void* blk, size_t nBlk, size_t blkSize, BlockFunc blockFunc) {
|
void SystemHeap_RunBlockFunc(void* blk, size_t nBlk, size_t blkSize, BlockFunc blockFunc) {
|
||||||
uintptr_t pos = blk;
|
uintptr_t pos = (uintptr_t)blk;
|
||||||
|
|
||||||
for (; pos < (uintptr_t)blk + (nBlk * blkSize); pos += (blkSize & ~0)) {
|
for (; pos < (uintptr_t)blk + (nBlk * blkSize); pos += (blkSize & ~0)) {
|
||||||
blockFunc(pos);
|
blockFunc(pos);
|
||||||
|
@ -49,7 +49,7 @@ void SystemHeap_RunBlockFunc(void* blk, size_t nBlk, size_t blkSize, BlockFunc b
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemHeap_RunBlockFunc1(void* blk, size_t nBlk, size_t blkSize, BlockFunc1 blockFunc) {
|
void SystemHeap_RunBlockFunc1(void* blk, size_t nBlk, size_t blkSize, BlockFunc1 blockFunc) {
|
||||||
uintptr_t pos = blk;
|
uintptr_t pos = (uintptr_t)blk;
|
||||||
|
|
||||||
for (; pos < (uintptr_t)blk + (nBlk * blkSize); pos += (blkSize & ~0)) {
|
for (; pos < (uintptr_t)blk + (nBlk * blkSize); pos += (blkSize & ~0)) {
|
||||||
blockFunc(pos, 2);
|
blockFunc(pos, 2);
|
||||||
|
@ -62,7 +62,7 @@ void* SystemHeap_RunBlockFunc8(void* blk, size_t nBlk, size_t blkSize, BlockFunc
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((blk != NULL) && (blockFunc != NULL)) {
|
if ((blk != NULL) && (blockFunc != NULL)) {
|
||||||
uintptr_t pos = blk;
|
uintptr_t pos = (uintptr_t)blk;
|
||||||
|
|
||||||
for (; pos < (uintptr_t)blk + (nBlk * blkSize); pos += (blkSize & ~0)) {
|
for (; pos < (uintptr_t)blk + (nBlk * blkSize); pos += (blkSize & ~0)) {
|
||||||
blockFunc(pos, 0, 0, 0, 0, 0, 0, 0, 0);
|
blockFunc(pos, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||||
|
@ -82,7 +82,7 @@ void SystemHeap_RunBlockFunc1Reverse(void* blk, size_t nBlk, size_t blkSize, Blo
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blockFunc != NULL) {
|
if (blockFunc != NULL) {
|
||||||
start = blk;
|
start = (uintptr_t)blk;
|
||||||
maskedBlkSize = (blkSize & ~0);
|
maskedBlkSize = (blkSize & ~0);
|
||||||
pos = (uintptr_t)start + (nBlk * blkSize);
|
pos = (uintptr_t)start + (nBlk * blkSize);
|
||||||
|
|
||||||
|
|
|
@ -68,8 +68,8 @@ void Main_Init(void) {
|
||||||
prevSize = gDmaMgrDmaBuffSize;
|
prevSize = gDmaMgrDmaBuffSize;
|
||||||
gDmaMgrDmaBuffSize = 0;
|
gDmaMgrDmaBuffSize = 0;
|
||||||
|
|
||||||
DmaMgr_SendRequestImpl(&dmaReq, SEGMENT_START(code), SEGMENT_ROM_START(code),
|
DmaMgr_SendRequestImpl(&dmaReq, SEGMENT_START(code), SEGMENT_ROM_START(code), SEGMENT_ROM_SIZE_ALT(code), 0, &mq,
|
||||||
SEGMENT_ROM_END(code) - SEGMENT_ROM_START(code), 0, &mq, NULL);
|
NULL);
|
||||||
Main_InitScreen();
|
Main_InitScreen();
|
||||||
Main_InitMemory();
|
Main_InitMemory();
|
||||||
osRecvMesg(&mq, NULL, OS_MESG_BLOCK);
|
osRecvMesg(&mq, NULL, OS_MESG_BLOCK);
|
||||||
|
|
|
@ -32,7 +32,7 @@ void* THA_GetTail(TwoHeadArena* tha) {
|
||||||
void* THA_AllocHead(TwoHeadArena* tha, size_t size) {
|
void* THA_AllocHead(TwoHeadArena* tha, size_t size) {
|
||||||
void* start = tha->head;
|
void* start = tha->head;
|
||||||
|
|
||||||
tha->head = (u8*)tha->head + size;
|
tha->head = (void*)((uintptr_t)tha->head + size);
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,8 +102,8 @@ void* THA_AllocTailAlign(TwoHeadArena* tha, size_t size, uintptr_t mask) {
|
||||||
*
|
*
|
||||||
* @return Remaining size. A negative number indicates an overflow.
|
* @return Remaining size. A negative number indicates an overflow.
|
||||||
*/
|
*/
|
||||||
s32 THA_GetRemaining(TwoHeadArena* tha) {
|
ptrdiff_t THA_GetRemaining(TwoHeadArena* tha) {
|
||||||
return (s32)((u8*)tha->tail - (u8*)tha->head);
|
return (uintptr_t)tha->tail - (uintptr_t)tha->head;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -115,7 +115,7 @@ u32 THA_IsCrash(TwoHeadArena* tha) {
|
||||||
|
|
||||||
void THA_Reset(TwoHeadArena* tha) {
|
void THA_Reset(TwoHeadArena* tha) {
|
||||||
tha->head = tha->start;
|
tha->head = tha->start;
|
||||||
tha->tail = (u8*)tha->start + tha->size;
|
tha->tail = (void*)((uintptr_t)tha->start + tha->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -44,7 +44,7 @@ void Graph_SetNextGfxPool(GraphicsContext* gfxCtx) {
|
||||||
GfxPool* pool = &gGfxPools[gfxCtx->gfxPoolIdx % 2];
|
GfxPool* pool = &gGfxPools[gfxCtx->gfxPoolIdx % 2];
|
||||||
|
|
||||||
gGfxMasterDL = &pool->master;
|
gGfxMasterDL = &pool->master;
|
||||||
gSegments[0x0E] = gGfxMasterDL;
|
gSegments[0x0E] = (uintptr_t)gGfxMasterDL;
|
||||||
|
|
||||||
pool->headMagic = GFXPOOL_HEAD_MAGIC;
|
pool->headMagic = GFXPOOL_HEAD_MAGIC;
|
||||||
pool->tailMagic = GFXPOOL_TAIL_MAGIC;
|
pool->tailMagic = GFXPOOL_TAIL_MAGIC;
|
||||||
|
@ -62,7 +62,7 @@ void Graph_SetNextGfxPool(GraphicsContext* gfxCtx) {
|
||||||
gfxCtx->debugBuffer = pool->debugBuffer;
|
gfxCtx->debugBuffer = pool->debugBuffer;
|
||||||
|
|
||||||
gfxCtx->curFrameBuffer = SysCfb_GetFramebuffer(gfxCtx->framebufferIndex % 2);
|
gfxCtx->curFrameBuffer = SysCfb_GetFramebuffer(gfxCtx->framebufferIndex % 2);
|
||||||
gSegments[0x0F] = gfxCtx->curFrameBuffer;
|
gSegments[0x0F] = (uintptr_t)gfxCtx->curFrameBuffer;
|
||||||
|
|
||||||
gfxCtx->zbuffer = SysCfb_GetZBuffer();
|
gfxCtx->zbuffer = SysCfb_GetZBuffer();
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ retry:
|
||||||
task->dramStack = (u64*)gGfxSPTaskStack;
|
task->dramStack = (u64*)gGfxSPTaskStack;
|
||||||
task->dramStackSize = sizeof(gGfxSPTaskStack);
|
task->dramStackSize = sizeof(gGfxSPTaskStack);
|
||||||
task->outputBuff = gGfxSPTaskOutputBufferPtr;
|
task->outputBuff = gGfxSPTaskOutputBufferPtr;
|
||||||
task->outputBuffSize = gGfxSPTaskOutputBufferEnd;
|
task->outputBuffSize = (void*)gGfxSPTaskOutputBufferEnd;
|
||||||
task->dataPtr = (u64*)gGfxMasterDL;
|
task->dataPtr = (u64*)gGfxMasterDL;
|
||||||
task->dataSize = 0;
|
task->dataSize = 0;
|
||||||
task->yieldDataPtr = (u64*)gGfxSPTaskYieldBuffer;
|
task->yieldDataPtr = (u64*)gGfxSPTaskYieldBuffer;
|
||||||
|
|
|
@ -53,10 +53,10 @@ void Main(void* arg) {
|
||||||
Check_RegionIsSupported();
|
Check_RegionIsSupported();
|
||||||
Check_ExpansionPak();
|
Check_ExpansionPak();
|
||||||
|
|
||||||
sysHeap = gSystemHeap;
|
sysHeap = (intptr_t)gSystemHeap;
|
||||||
fb = 0x80780000;
|
fb = 0x80780000;
|
||||||
gSystemHeapSize = fb - sysHeap;
|
gSystemHeapSize = fb - sysHeap;
|
||||||
SystemHeap_Init(sysHeap, gSystemHeapSize);
|
SystemHeap_Init((void*)sysHeap, gSystemHeapSize);
|
||||||
|
|
||||||
Regs_Init();
|
Regs_Init();
|
||||||
|
|
||||||
|
|
|
@ -95,8 +95,9 @@ void Sched_HandleAudioCancel(SchedContext* sched) {
|
||||||
// AUDIO SP seems to be stopped
|
// AUDIO SP seems to be stopped
|
||||||
osSyncPrintf("AUDIO SP止まっているようです\n");
|
osSyncPrintf("AUDIO SP止まっているようです\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
send_mesg:
|
send_mesg:
|
||||||
osSendMesg(&sched->interruptQ, RSP_DONE_MSG, OS_MESG_NOBLOCK);
|
osSendMesg(&sched->interruptQ, (OSMesg)RSP_DONE_MSG, OS_MESG_NOBLOCK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,8 +158,9 @@ void Sched_HandleGfxCancel(SchedContext* sched) {
|
||||||
// GRAPH SP seems to be stopped
|
// GRAPH SP seems to be stopped
|
||||||
osSyncPrintf("GRAPH SP止まっているようです\n");
|
osSyncPrintf("GRAPH SP止まっているようです\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
send_mesg:
|
send_mesg:
|
||||||
osSendMesg(&sched->interruptQ, RSP_DONE_MSG, OS_MESG_NOBLOCK);
|
osSendMesg(&sched->interruptQ, (OSMesg)RSP_DONE_MSG, OS_MESG_NOBLOCK);
|
||||||
goto halt_rdp;
|
goto halt_rdp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,8 +188,8 @@ halt_rdp:
|
||||||
if (dpTask->type == M_GFXTASK) {
|
if (dpTask->type == M_GFXTASK) {
|
||||||
// Try to stop DP
|
// Try to stop DP
|
||||||
osSyncPrintf("DP止めようとします\n");
|
osSyncPrintf("DP止めようとします\n");
|
||||||
bzero(dpTask->outputBuff, (u32)dpTask->outputBuffSize - (u32)dpTask->outputBuff);
|
bzero(dpTask->outputBuff, (uintptr_t)dpTask->outputBuffSize - (uintptr_t)dpTask->outputBuff);
|
||||||
osSendMesg(&sched->interruptQ, RDP_DONE_MSG, OS_MESG_NOBLOCK);
|
osSendMesg(&sched->interruptQ, (OSMesg)RDP_DONE_MSG, OS_MESG_NOBLOCK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -503,7 +505,7 @@ void Sched_HandleRDPDone(SchedContext* sched) {
|
||||||
* been sent down the command queue.
|
* been sent down the command queue.
|
||||||
*/
|
*/
|
||||||
void Sched_SendEntryMsg(SchedContext* sched) {
|
void Sched_SendEntryMsg(SchedContext* sched) {
|
||||||
osSendMesg(&sched->interruptQ, ENTRY_MSG, OS_MESG_BLOCK);
|
osSendMesg(&sched->interruptQ, (OSMesg)ENTRY_MSG, OS_MESG_BLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -511,7 +513,7 @@ void Sched_SendEntryMsg(SchedContext* sched) {
|
||||||
* to stop the last dispatched audio task.
|
* to stop the last dispatched audio task.
|
||||||
*/
|
*/
|
||||||
void Sched_SendAudioCancelMsg(SchedContext* sched) {
|
void Sched_SendAudioCancelMsg(SchedContext* sched) {
|
||||||
osSendMesg(&sched->interruptQ, RDP_AUDIO_CANCEL_MSG, OS_MESG_BLOCK);
|
osSendMesg(&sched->interruptQ, (OSMesg)RDP_AUDIO_CANCEL_MSG, OS_MESG_BLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -519,7 +521,7 @@ void Sched_SendAudioCancelMsg(SchedContext* sched) {
|
||||||
* to stop the last dispatched gfx task.
|
* to stop the last dispatched gfx task.
|
||||||
*/
|
*/
|
||||||
void Sched_SendGfxCancelMsg(SchedContext* sched) {
|
void Sched_SendGfxCancelMsg(SchedContext* sched) {
|
||||||
osSendMesg(&sched->interruptQ, RSP_GFX_CANCEL_MSG, OS_MESG_BLOCK);
|
osSendMesg(&sched->interruptQ, (OSMesg)RSP_GFX_CANCEL_MSG, OS_MESG_BLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -554,14 +556,14 @@ void Sched_FaultClient(void* param1, void* param2) {
|
||||||
* threads or the OS.
|
* threads or the OS.
|
||||||
*/
|
*/
|
||||||
void Sched_ThreadEntry(void* arg) {
|
void Sched_ThreadEntry(void* arg) {
|
||||||
OSMesg msg = NULL;
|
s32 msg = 0;
|
||||||
SchedContext* sched = (SchedContext*)arg;
|
SchedContext* sched = (SchedContext*)arg;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
osRecvMesg(&sched->interruptQ, &msg, OS_MESG_BLOCK);
|
osRecvMesg(&sched->interruptQ, (OSMesg*)&msg, OS_MESG_BLOCK);
|
||||||
|
|
||||||
// Check if it's a message from another thread or the OS
|
// Check if it's a message from another thread or the OS
|
||||||
switch ((s32)msg) {
|
switch (msg) {
|
||||||
case RDP_AUDIO_CANCEL_MSG:
|
case RDP_AUDIO_CANCEL_MSG:
|
||||||
Sched_HandleAudioCancel(sched);
|
Sched_HandleAudioCancel(sched);
|
||||||
continue;
|
continue;
|
||||||
|
@ -582,6 +584,7 @@ void Sched_ThreadEntry(void* arg) {
|
||||||
Sched_HandleRDPDone(sched);
|
Sched_HandleRDPDone(sched);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if it's a message from the IrqMgr
|
// Check if it's a message from the IrqMgr
|
||||||
switch (((OSScMsg*)msg)->type) {
|
switch (((OSScMsg*)msg)->type) {
|
||||||
case OS_SC_RETRACE_MSG:
|
case OS_SC_RETRACE_MSG:
|
||||||
|
@ -611,8 +614,8 @@ void Sched_Init(SchedContext* sched, void* stack, OSPri pri, u8 viModeType, UNK_
|
||||||
|
|
||||||
osCreateMesgQueue(&sched->interruptQ, sched->intBuf, ARRAY_COUNT(sched->intBuf));
|
osCreateMesgQueue(&sched->interruptQ, sched->intBuf, ARRAY_COUNT(sched->intBuf));
|
||||||
osCreateMesgQueue(&sched->cmdQ, sched->cmdMsgBuf, ARRAY_COUNT(sched->cmdMsgBuf));
|
osCreateMesgQueue(&sched->cmdQ, sched->cmdMsgBuf, ARRAY_COUNT(sched->cmdMsgBuf));
|
||||||
osSetEventMesg(OS_EVENT_SP, &sched->interruptQ, RSP_DONE_MSG);
|
osSetEventMesg(OS_EVENT_SP, &sched->interruptQ, (OSMesg)RSP_DONE_MSG);
|
||||||
osSetEventMesg(OS_EVENT_DP, &sched->interruptQ, RDP_DONE_MSG);
|
osSetEventMesg(OS_EVENT_DP, &sched->interruptQ, (OSMesg)RDP_DONE_MSG);
|
||||||
IrqMgr_AddClient(irqMgr, &sched->irqClient, &sched->interruptQ);
|
IrqMgr_AddClient(irqMgr, &sched->irqClient, &sched->interruptQ);
|
||||||
Fault_AddClient(&sSchedFaultClient, Sched_FaultClient, sched, NULL);
|
Fault_AddClient(&sSchedFaultClient, Sched_FaultClient, sched, NULL);
|
||||||
osCreateThread(&sched->thread, Z_THREAD_ID_SCHED, Sched_ThreadEntry, sched, stack, pri);
|
osCreateThread(&sched->thread, Z_THREAD_ID_SCHED, Sched_ThreadEntry, sched, stack, pri);
|
||||||
|
|
|
@ -43,9 +43,9 @@ void func_80178AC0(u16* src, void* dst, size_t size) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CmpDma_GetFileInfo(u8* segmentRom, s32 id, uintptr_t* outFileRom, size_t* size, s32* flag) {
|
void CmpDma_GetFileInfo(uintptr_t segmentRom, s32 id, uintptr_t* outFileRom, size_t* size, s32* flag) {
|
||||||
u32 dataStart;
|
uintptr_t dataStart;
|
||||||
u32 refOff;
|
uintptr_t refOff;
|
||||||
|
|
||||||
DmaMgr_DmaRomToRam(segmentRom, &sDmaBuffer.dataStart, sizeof(sDmaBuffer.dataStart));
|
DmaMgr_DmaRomToRam(segmentRom, &sDmaBuffer.dataStart, sizeof(sDmaBuffer.dataStart));
|
||||||
|
|
||||||
|
@ -53,12 +53,12 @@ void CmpDma_GetFileInfo(u8* segmentRom, s32 id, uintptr_t* outFileRom, size_t* s
|
||||||
refOff = id * sizeof(u32);
|
refOff = id * sizeof(u32);
|
||||||
|
|
||||||
// if id is >= idMax
|
// if id is >= idMax
|
||||||
if (refOff > (dataStart - 4)) {
|
if (refOff > (dataStart - sizeof(u32))) {
|
||||||
*outFileRom = segmentRom;
|
*outFileRom = segmentRom;
|
||||||
*size = 0;
|
*size = 0;
|
||||||
} else if (refOff == 0) {
|
} else if (refOff == 0) {
|
||||||
// get offset start of next file, i.e. size of first file
|
// get offset start of next file, i.e. size of first file
|
||||||
DmaMgr_DmaRomToRam(segmentRom + 4, &sDmaBuffer.dataSize, sizeof(sDmaBuffer.dataSize));
|
DmaMgr_DmaRomToRam(segmentRom + sizeof(u32), &sDmaBuffer.dataSize, sizeof(sDmaBuffer.dataSize));
|
||||||
*outFileRom = segmentRom + dataStart;
|
*outFileRom = segmentRom + dataStart;
|
||||||
*size = sDmaBuffer.dataSize;
|
*size = sDmaBuffer.dataSize;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -206,12 +206,12 @@ void SysFlashrom_ThreadEntry(void* arg) {
|
||||||
switch (req->requestType) {
|
switch (req->requestType) {
|
||||||
case FLASHROM_REQUEST_WRITE:
|
case FLASHROM_REQUEST_WRITE:
|
||||||
req->response = SysFlashrom_WriteData(req->addr, req->pageNum, req->pageCount);
|
req->response = SysFlashrom_WriteData(req->addr, req->pageNum, req->pageCount);
|
||||||
osSendMesg(&req->messageQueue, req->response, OS_MESG_BLOCK);
|
osSendMesg(&req->messageQueue, (OSMesg)req->response, OS_MESG_BLOCK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FLASHROM_REQUEST_READ:
|
case FLASHROM_REQUEST_READ:
|
||||||
req->response = SysFlashrom_ReadData(req->addr, req->pageNum, req->pageCount);
|
req->response = SysFlashrom_ReadData(req->addr, req->pageNum, req->pageCount);
|
||||||
osSendMesg(&req->messageQueue, req->response, OS_MESG_BLOCK);
|
osSendMesg(&req->messageQueue, (OSMesg)req->response, OS_MESG_BLOCK);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,15 +8,17 @@ void Overlay_LoadGameState(GameStateOverlay* overlayEntry) {
|
||||||
if (overlayEntry->loadedRamAddr != NULL) {
|
if (overlayEntry->loadedRamAddr != NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
vramStart = overlayEntry->vramStart;
|
vramStart = overlayEntry->vramStart;
|
||||||
if (vramStart == NULL) {
|
if (vramStart == NULL) {
|
||||||
overlayEntry->unk_28 = 0;
|
overlayEntry->unk_28 = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
overlayEntry->loadedRamAddr = Overlay_AllocateAndLoad(overlayEntry->vromStart, overlayEntry->vromEnd,
|
|
||||||
(uintptr_t)vramStart, (uintptr_t)overlayEntry->vramEnd);
|
|
||||||
if (overlayEntry->loadedRamAddr != NULL) {
|
|
||||||
|
|
||||||
|
overlayEntry->loadedRamAddr =
|
||||||
|
Overlay_AllocateAndLoad(overlayEntry->vromStart, overlayEntry->vromEnd, vramStart, overlayEntry->vramEnd);
|
||||||
|
|
||||||
|
if (overlayEntry->loadedRamAddr != NULL) {
|
||||||
overlayEntry->unk_14 = (void*)(uintptr_t)((overlayEntry->unk_14 != NULL)
|
overlayEntry->unk_14 = (void*)(uintptr_t)((overlayEntry->unk_14 != NULL)
|
||||||
? (void*)((uintptr_t)overlayEntry->unk_14 -
|
? (void*)((uintptr_t)overlayEntry->unk_14 -
|
||||||
(intptr_t)((uintptr_t)overlayEntry->vramStart -
|
(intptr_t)((uintptr_t)overlayEntry->vramStart -
|
||||||
|
@ -69,11 +71,11 @@ void Overlay_FreeGameState(GameStateOverlay* overlayEntry) {
|
||||||
(uintptr_t)overlayEntry->loadedRamAddr))
|
(uintptr_t)overlayEntry->loadedRamAddr))
|
||||||
: NULL);
|
: NULL);
|
||||||
|
|
||||||
overlayEntry->destroy = (uintptr_t)((overlayEntry->destroy != NULL)
|
overlayEntry->destroy = (void*)(uintptr_t)((overlayEntry->destroy != NULL)
|
||||||
? (void*)((uintptr_t)overlayEntry->destroy +
|
? (void*)((uintptr_t)overlayEntry->destroy +
|
||||||
(intptr_t)((uintptr_t)overlayEntry->vramStart -
|
(intptr_t)((uintptr_t)overlayEntry->vramStart -
|
||||||
(uintptr_t)overlayEntry->loadedRamAddr))
|
(uintptr_t)overlayEntry->loadedRamAddr))
|
||||||
: NULL);
|
: NULL);
|
||||||
|
|
||||||
overlayEntry->unk_20 = (void*)(uintptr_t)((overlayEntry->unk_20 != NULL)
|
overlayEntry->unk_20 = (void*)(uintptr_t)((overlayEntry->unk_20 != NULL)
|
||||||
? (void*)((uintptr_t)overlayEntry->unk_20 +
|
? (void*)((uintptr_t)overlayEntry->unk_20 +
|
||||||
|
|
|
@ -477,7 +477,7 @@ PlayerMeleeWeaponState func_800CBAAC(Camera* camera) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Camera_GetFocalActorPos(Vec3f* dst, Camera* camera) {
|
Vec3f* Camera_GetFocalActorPos(Vec3f* dst, Camera* camera) {
|
||||||
PosRot focalPosRot;
|
PosRot focalPosRot;
|
||||||
Actor* focalActor = camera->focalActor;
|
Actor* focalActor = camera->focalActor;
|
||||||
|
|
||||||
|
|
|
@ -9,13 +9,13 @@ void Font_LoadCharNES(PlayState* play, u8 codePointIndex, s32 offset) {
|
||||||
Font* font = &msgCtx->font;
|
Font* font = &msgCtx->font;
|
||||||
|
|
||||||
DmaMgr_SendRequest0(&font->charBuf[font->unk_11D88][offset],
|
DmaMgr_SendRequest0(&font->charBuf[font->unk_11D88][offset],
|
||||||
&((u8*)SEGMENT_ROM_START(nes_font_static))[(codePointIndex - ' ') * FONT_CHAR_TEX_SIZE],
|
SEGMENT_ROM_START_OFFSET(nes_font_static, (codePointIndex - ' ') * FONT_CHAR_TEX_SIZE),
|
||||||
FONT_CHAR_TEX_SIZE);
|
FONT_CHAR_TEX_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Font_LoadMessageBoxEndIcon(Font* font, u16 icon) {
|
void Font_LoadMessageBoxEndIcon(Font* font, u16 icon) {
|
||||||
DmaMgr_SendRequest0(&font->iconBuf,
|
DmaMgr_SendRequest0(&font->iconBuf,
|
||||||
&((u8*)SEGMENT_ROM_START(message_static))[5 * 0x1000 + icon * FONT_CHAR_TEX_SIZE],
|
SEGMENT_ROM_START_OFFSET(message_static, 5 * 0x1000 + icon * FONT_CHAR_TEX_SIZE),
|
||||||
FONT_CHAR_TEX_SIZE);
|
FONT_CHAR_TEX_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,8 +39,7 @@ void Font_LoadOrderedFont(Font* font) {
|
||||||
loadOffset = 0;
|
loadOffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DmaMgr_SendRequest0(writeLocation, (uintptr_t)SEGMENT_ROM_START(nes_font_static) + loadOffset,
|
DmaMgr_SendRequest0(writeLocation, SEGMENT_ROM_START(nes_font_static) + loadOffset, FONT_CHAR_TEX_SIZE);
|
||||||
FONT_CHAR_TEX_SIZE);
|
|
||||||
if (sFontOrdering[codePointIndex] == 0x8C) {
|
if (sFontOrdering[codePointIndex] == 0x8C) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -715,11 +715,11 @@ void* Lib_SegmentedToVirtualNull(void* ptr) {
|
||||||
* the NULL virtual address being 0x00000000 and not 0x80000000. Used by transition overlays, which store their
|
* the NULL virtual address being 0x00000000 and not 0x80000000. Used by transition overlays, which store their
|
||||||
* addresses in 24-bit fields.
|
* addresses in 24-bit fields.
|
||||||
*/
|
*/
|
||||||
void* Lib_VirtualToPhysical(void* ptr) {
|
uintptr_t Lib_VirtualToPhysical(void* ptr) {
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
return NULL;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return (void*)OS_K0_TO_PHYSICAL(ptr);
|
return OS_K0_TO_PHYSICAL(ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -728,8 +728,8 @@ void* Lib_VirtualToPhysical(void* ptr) {
|
||||||
* the NULL virtual address being 0x00000000 and not 0x80000000. Used by transition overlays, which store their
|
* the NULL virtual address being 0x00000000 and not 0x80000000. Used by transition overlays, which store their
|
||||||
* addresses in 24-bit fields.
|
* addresses in 24-bit fields.
|
||||||
*/
|
*/
|
||||||
void* Lib_PhysicalToVirtual(void* ptr) {
|
void* Lib_PhysicalToVirtual(uintptr_t ptr) {
|
||||||
if (ptr == NULL) {
|
if (ptr == 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
return OS_PHYSICAL_TO_K0(ptr);
|
return OS_PHYSICAL_TO_K0(ptr);
|
||||||
|
|
|
@ -2275,8 +2275,8 @@ void Message_Decode(PlayState* play) {
|
||||||
spC0 += playerNameLen * (16.0f * msgCtx->textCharScale);
|
spC0 += playerNameLen * (16.0f * msgCtx->textCharScale);
|
||||||
} else if (curChar == 0x201) {
|
} else if (curChar == 0x201) {
|
||||||
DmaMgr_SendRequest0(msgCtx->textboxSegment + 0x1000, SEGMENT_ROM_START(message_texture_static), 0x900);
|
DmaMgr_SendRequest0(msgCtx->textboxSegment + 0x1000, SEGMENT_ROM_START(message_texture_static), 0x900);
|
||||||
DmaMgr_SendRequest0(msgCtx->textboxSegment + 0x1900,
|
DmaMgr_SendRequest0(msgCtx->textboxSegment + 0x1900, SEGMENT_ROM_START(message_texture_static) + 0x900,
|
||||||
(uintptr_t)SEGMENT_ROM_START(message_texture_static) + 0x900, 0x900);
|
0x900);
|
||||||
spE0 = 2;
|
spE0 = 2;
|
||||||
spD2 = 2;
|
spD2 = 2;
|
||||||
msgCtx->unk12012 = msgCtx->textboxY + 8;
|
msgCtx->unk12012 = msgCtx->textboxY + 8;
|
||||||
|
@ -3049,7 +3049,7 @@ void func_80150A84(PlayState* play) {
|
||||||
|
|
||||||
if (D_801CFC78[textBoxType] != 14) {
|
if (D_801CFC78[textBoxType] != 14) {
|
||||||
DmaMgr_SendRequest0(msgCtx->textboxSegment,
|
DmaMgr_SendRequest0(msgCtx->textboxSegment,
|
||||||
&SEGMENT_ROM_START(message_static)[D_801CFC78[textBoxType] * 0x1000], 0x1000);
|
SEGMENT_ROM_START(message_static) + D_801CFC78[textBoxType] * 0x1000, 0x1000);
|
||||||
|
|
||||||
if (!play->pauseCtx.bombersNotebookOpen) {
|
if (!play->pauseCtx.bombersNotebookOpen) {
|
||||||
if ((textBoxType == TEXTBOX_TYPE_0) || (textBoxType == TEXTBOX_TYPE_6) || (textBoxType == TEXTBOX_TYPE_A) ||
|
if ((textBoxType == TEXTBOX_TYPE_0) || (textBoxType == TEXTBOX_TYPE_6) || (textBoxType == TEXTBOX_TYPE_A) ||
|
||||||
|
@ -3176,17 +3176,17 @@ void Message_OpenText(PlayState* play, u16 textId) {
|
||||||
if (msgCtx->textIsCredits) {
|
if (msgCtx->textIsCredits) {
|
||||||
Message_FindCreditsMessage(play, textId);
|
Message_FindCreditsMessage(play, textId);
|
||||||
msgCtx->msgLength = font->messageEnd;
|
msgCtx->msgLength = font->messageEnd;
|
||||||
DmaMgr_SendRequest0(&font->msgBuf, &SEGMENT_ROM_START(staff_message_data_static)[font->messageStart],
|
DmaMgr_SendRequest0(&font->msgBuf, SEGMENT_ROM_START(staff_message_data_static) + font->messageStart,
|
||||||
font->messageEnd);
|
font->messageEnd);
|
||||||
} else if (gSaveContext.options.language == LANGUAGE_JPN) {
|
} else if (gSaveContext.options.language == LANGUAGE_JPN) {
|
||||||
Message_FindMessage(play, textId);
|
Message_FindMessage(play, textId);
|
||||||
msgCtx->msgLength = font->messageEnd;
|
msgCtx->msgLength = font->messageEnd;
|
||||||
DmaMgr_SendRequest0(&font->msgBuf, &SEGMENT_ROM_START(message_data_static)[font->messageStart],
|
DmaMgr_SendRequest0(&font->msgBuf, SEGMENT_ROM_START(message_data_static) + font->messageStart,
|
||||||
font->messageEnd);
|
font->messageEnd);
|
||||||
} else {
|
} else {
|
||||||
Message_FindMessageNES(play, textId);
|
Message_FindMessageNES(play, textId);
|
||||||
msgCtx->msgLength = font->messageEnd;
|
msgCtx->msgLength = font->messageEnd;
|
||||||
DmaMgr_SendRequest0(&font->msgBuf, &SEGMENT_ROM_START(message_data_static)[font->messageStart],
|
DmaMgr_SendRequest0(&font->msgBuf, SEGMENT_ROM_START(message_data_static) + font->messageStart,
|
||||||
font->messageEnd);
|
font->messageEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3275,12 +3275,12 @@ void func_801514B0(PlayState* play, u16 arg1, u8 arg2) {
|
||||||
if (gSaveContext.options.language == LANGUAGE_JPN) {
|
if (gSaveContext.options.language == LANGUAGE_JPN) {
|
||||||
Message_FindMessage(play, arg1);
|
Message_FindMessage(play, arg1);
|
||||||
msgCtx->msgLength = font->messageEnd;
|
msgCtx->msgLength = font->messageEnd;
|
||||||
DmaMgr_SendRequest0(&font->msgBuf, &SEGMENT_ROM_START(message_data_static)[font->messageStart],
|
DmaMgr_SendRequest0(&font->msgBuf, SEGMENT_ROM_START(message_data_static) + font->messageStart,
|
||||||
font->messageEnd);
|
font->messageEnd);
|
||||||
} else {
|
} else {
|
||||||
Message_FindMessageNES(play, arg1);
|
Message_FindMessageNES(play, arg1);
|
||||||
msgCtx->msgLength = font->messageEnd;
|
msgCtx->msgLength = font->messageEnd;
|
||||||
DmaMgr_SendRequest0(&font->msgBuf, &SEGMENT_ROM_START(message_data_static)[font->messageStart],
|
DmaMgr_SendRequest0(&font->msgBuf, SEGMENT_ROM_START(message_data_static) + font->messageStart,
|
||||||
font->messageEnd);
|
font->messageEnd);
|
||||||
}
|
}
|
||||||
msgCtx->choiceNum = 0;
|
msgCtx->choiceNum = 0;
|
||||||
|
@ -3295,7 +3295,7 @@ void func_801514B0(PlayState* play, u16 arg1, u8 arg2) {
|
||||||
msgCtx->textBoxPos = arg2;
|
msgCtx->textBoxPos = arg2;
|
||||||
msgCtx->unk11F0C = msgCtx->unk11F08 & 0xF;
|
msgCtx->unk11F0C = msgCtx->unk11F08 & 0xF;
|
||||||
msgCtx->textUnskippable = true;
|
msgCtx->textUnskippable = true;
|
||||||
DmaMgr_SendRequest0(msgCtx->textboxSegment, &SEGMENT_ROM_START(message_static)[D_801CFC78[0] << 12], 0x1000);
|
DmaMgr_SendRequest0(msgCtx->textboxSegment, SEGMENT_ROM_START(message_static) + (D_801CFC78[0] << 12), 0x1000);
|
||||||
msgCtx->textboxColorRed = 0;
|
msgCtx->textboxColorRed = 0;
|
||||||
msgCtx->textboxColorGreen = 0;
|
msgCtx->textboxColorGreen = 0;
|
||||||
msgCtx->textboxColorBlue = 0;
|
msgCtx->textboxColorBlue = 0;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -19,7 +19,7 @@ void* TransitionOverlay_VramToRam(TransitionOverlay* overlayEntry, void* vramAdd
|
||||||
void* loadedRamAddr = Lib_PhysicalToVirtual(overlayEntry->loadInfo.addr);
|
void* loadedRamAddr = Lib_PhysicalToVirtual(overlayEntry->loadInfo.addr);
|
||||||
|
|
||||||
if ((loadedRamAddr != NULL) && (vramAddr >= overlayEntry->vramStart) && (vramAddr < overlayEntry->vramEnd)) {
|
if ((loadedRamAddr != NULL) && (vramAddr >= overlayEntry->vramStart) && (vramAddr < overlayEntry->vramEnd)) {
|
||||||
return ((uintptr_t)loadedRamAddr - (uintptr_t)overlayEntry->vramStart) + (uintptr_t)vramAddr;
|
return (void*)(((uintptr_t)loadedRamAddr - (uintptr_t)overlayEntry->vramStart) + (uintptr_t)vramAddr);
|
||||||
}
|
}
|
||||||
return vramAddr;
|
return vramAddr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -916,8 +916,8 @@ void Interface_NewDay(PlayState* play, s32 day) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loads day number from week_static for the three-day clock
|
// Loads day number from week_static for the three-day clock
|
||||||
DmaMgr_SendRequest0((u32)play->interfaceCtx.doActionSegment + 0x780,
|
DmaMgr_SendRequest0((void*)(play->interfaceCtx.doActionSegment + 0x780),
|
||||||
(u32)SEGMENT_ROM_START(week_static) + i * 0x510, 0x510);
|
SEGMENT_ROM_START_OFFSET(week_static, i * 0x510), 0x510);
|
||||||
|
|
||||||
// i is used to store sceneId
|
// i is used to store sceneId
|
||||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.save.saveInfo.permanentSceneFlags); i++) {
|
for (i = 0; i < ARRAY_COUNT(gSaveContext.save.saveInfo.permanentSceneFlags); i++) {
|
||||||
|
@ -7121,7 +7121,8 @@ void Interface_Init(PlayState* play) {
|
||||||
|
|
||||||
interfaceCtx->doActionSegment = THA_AllocTailAlign16(&play->state.tha, 0xC90);
|
interfaceCtx->doActionSegment = THA_AllocTailAlign16(&play->state.tha, 0xC90);
|
||||||
DmaMgr_SendRequest0(interfaceCtx->doActionSegment, SEGMENT_ROM_START(do_action_static), 0x300);
|
DmaMgr_SendRequest0(interfaceCtx->doActionSegment, SEGMENT_ROM_START(do_action_static), 0x300);
|
||||||
DmaMgr_SendRequest0(interfaceCtx->doActionSegment + 0x300, SEGMENT_ROM_START(do_action_static) + 0x480, 0x180);
|
DmaMgr_SendRequest0(interfaceCtx->doActionSegment + 0x300, SEGMENT_ROM_START_OFFSET(do_action_static, 0x480),
|
||||||
|
0x180);
|
||||||
|
|
||||||
Interface_NewDay(play, CURRENT_DAY);
|
Interface_NewDay(play, CURRENT_DAY);
|
||||||
|
|
||||||
|
|
|
@ -2329,7 +2329,10 @@ void Play_Init(GameState* thisx) {
|
||||||
THA_GetRemaining(&this->state.tha);
|
THA_GetRemaining(&this->state.tha);
|
||||||
zAllocSize = THA_GetRemaining(&this->state.tha);
|
zAllocSize = THA_GetRemaining(&this->state.tha);
|
||||||
zAlloc = (uintptr_t)THA_AllocTailAlign16(&this->state.tha, zAllocSize);
|
zAlloc = (uintptr_t)THA_AllocTailAlign16(&this->state.tha, zAllocSize);
|
||||||
ZeldaArena_Init(((zAlloc + 8) & ~0xF), (zAllocSize - ((zAlloc + 8) & ~0xF)) + zAlloc); //! @bug: Incorrect ALIGN16s
|
|
||||||
|
//! @bug: Incorrect ALIGN16s
|
||||||
|
ZeldaArena_Init((void*)((zAlloc + 8) & ~0xF), (zAllocSize - ((zAlloc + 8) & ~0xF)) + zAlloc);
|
||||||
|
|
||||||
Actor_InitContext(this, &this->actorCtx, this->linkActorEntry);
|
Actor_InitContext(this, &this->actorCtx, this->linkActorEntry);
|
||||||
|
|
||||||
while (!Room_HandleLoadCallbacks(this, &this->roomCtx)) {}
|
while (!Room_HandleLoadCallbacks(this, &this->roomCtx)) {}
|
||||||
|
|
|
@ -1037,7 +1037,7 @@ Gfx* sPlayerFirstPersonRightShoulderDLs[PLAYER_FORM_MAX] = {
|
||||||
Gfx* sPlayerFirstPersonRightHandDLs[PLAYER_FORM_MAX] = {
|
Gfx* sPlayerFirstPersonRightHandDLs[PLAYER_FORM_MAX] = {
|
||||||
gLinkFierceDeityRightHandDL,
|
gLinkFierceDeityRightHandDL,
|
||||||
//! @bug This is in the middle of a texture in the link_goron object. It has the same offset as a link_nuts dlist
|
//! @bug This is in the middle of a texture in the link_goron object. It has the same offset as a link_nuts dlist
|
||||||
0x060038C0,
|
(Gfx*)0x060038C0,
|
||||||
gLinkZoraRightHandOpenDL,
|
gLinkZoraRightHandOpenDL,
|
||||||
gLinkDekuRightHandDL,
|
gLinkDekuRightHandDL,
|
||||||
object_link_child_DL_018490,
|
object_link_child_DL_018490,
|
||||||
|
@ -1046,7 +1046,7 @@ Gfx* sPlayerFirstPersonRightHandDLs[PLAYER_FORM_MAX] = {
|
||||||
Gfx* sPlayerFirstPersonRightHandHookshotDLs[PLAYER_FORM_MAX] = {
|
Gfx* sPlayerFirstPersonRightHandHookshotDLs[PLAYER_FORM_MAX] = {
|
||||||
gLinkFierceDeityRightHandDL,
|
gLinkFierceDeityRightHandDL,
|
||||||
//! @bug This is in the middle of a texture in the link_goron object. It has the same offset as a link_nuts dlist
|
//! @bug This is in the middle of a texture in the link_goron object. It has the same offset as a link_nuts dlist
|
||||||
0x060038C0,
|
(Gfx*)0x060038C0,
|
||||||
gLinkZoraRightHandOpenDL,
|
gLinkZoraRightHandOpenDL,
|
||||||
gLinkDekuRightHandDL,
|
gLinkDekuRightHandDL,
|
||||||
object_link_child_DL_017B40,
|
object_link_child_DL_017B40,
|
||||||
|
|
|
@ -1449,8 +1449,8 @@ void func_8012CF0C(GraphicsContext* gfxCtx, s32 clearFb, s32 clearZb, u8 r, u8 g
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
gSegments[0x00] = 0;
|
gSegments[0x00] = 0;
|
||||||
gSegments[0x0F] = gfxCtx->curFrameBuffer;
|
gSegments[0x0F] = (uintptr_t)gfxCtx->curFrameBuffer;
|
||||||
gSegments[0x0E] = gGfxMasterDL;
|
gSegments[0x0E] = (uintptr_t)gGfxMasterDL;
|
||||||
|
|
||||||
zbuffer = gfxCtx->zbuffer;
|
zbuffer = gfxCtx->zbuffer;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ s32 Object_SpawnPersistent(ObjectContext* objectCtx, s16 id) {
|
||||||
|
|
||||||
if (objectCtx->numEntries < ARRAY_COUNT(objectCtx->slots) - 1) {
|
if (objectCtx->numEntries < ARRAY_COUNT(objectCtx->slots) - 1) {
|
||||||
objectCtx->slots[objectCtx->numEntries + 1].segment =
|
objectCtx->slots[objectCtx->numEntries + 1].segment =
|
||||||
ALIGN16((u32)objectCtx->slots[objectCtx->numEntries].segment + size);
|
(void*)ALIGN16((uintptr_t)objectCtx->slots[objectCtx->numEntries].segment + size);
|
||||||
}
|
}
|
||||||
|
|
||||||
objectCtx->numEntries++;
|
objectCtx->numEntries++;
|
||||||
|
|
|
@ -1007,11 +1007,11 @@ void AnimationContext_SetLoadFrame(PlayState* play, PlayerAnimationHeader* anima
|
||||||
|
|
||||||
if (entry != NULL) {
|
if (entry != NULL) {
|
||||||
PlayerAnimationHeader* playerAnimHeader = Lib_SegmentedToVirtual(animation);
|
PlayerAnimationHeader* playerAnimHeader = Lib_SegmentedToVirtual(animation);
|
||||||
void* ram = (void*)frameTable;
|
s32 pad;
|
||||||
|
|
||||||
osCreateMesgQueue(&entry->data.load.msgQueue, entry->data.load.msg, ARRAY_COUNT(entry->data.load.msg));
|
osCreateMesgQueue(&entry->data.load.msgQueue, entry->data.load.msg, ARRAY_COUNT(entry->data.load.msg));
|
||||||
DmaMgr_SendRequestImpl(
|
DmaMgr_SendRequestImpl(
|
||||||
&entry->data.load.req, ram,
|
&entry->data.load.req, frameTable,
|
||||||
LINK_ANIMETION_OFFSET(playerAnimHeader->linkAnimSegment, (sizeof(Vec3s) * limbCount + sizeof(s16)) * frame),
|
LINK_ANIMETION_OFFSET(playerAnimHeader->linkAnimSegment, (sizeof(Vec3s) * limbCount + sizeof(s16)) * frame),
|
||||||
sizeof(Vec3s) * limbCount + sizeof(s16), 0, &entry->data.load.msgQueue, NULL);
|
sizeof(Vec3s) * limbCount + sizeof(s16), 0, &entry->data.load.msgQueue, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ void osSpTaskLoad(OSTask* intp) {
|
||||||
intp->t.flags &= ~OS_TASK_YIELDED;
|
intp->t.flags &= ~OS_TASK_YIELDED;
|
||||||
|
|
||||||
if (tp->t.flags & OS_TASK_LOADABLE) {
|
if (tp->t.flags & OS_TASK_LOADABLE) {
|
||||||
tp->t.ucode = IO_READ((uintptr_t)intp->t.yieldDataPtr + OS_YIELD_DATA_SIZE - 4);
|
tp->t.ucode = (void*)IO_READ((uintptr_t)intp->t.yieldDataPtr + OS_YIELD_DATA_SIZE - 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,9 @@ void osCreateThread(OSThread* thread, OSId id, void* entry, void* arg, void* sp,
|
||||||
thread->next = NULL;
|
thread->next = NULL;
|
||||||
thread->queue = NULL;
|
thread->queue = NULL;
|
||||||
thread->context.pc = (u32)entry;
|
thread->context.pc = (u32)entry;
|
||||||
thread->context.a0 = arg;
|
thread->context.a0 = (intptr_t)arg;
|
||||||
thread->context.sp = (u64)(s32)sp - 16;
|
thread->context.sp = (u64)(s32)sp - 16;
|
||||||
thread->context.ra = __osCleanupThread;
|
thread->context.ra = (intptr_t)__osCleanupThread;
|
||||||
|
|
||||||
mask = OS_IM_ALL;
|
mask = OS_IM_ALL;
|
||||||
thread->context.sr = (mask & (SR_IMASK | SR_IE)) | SR_EXL;
|
thread->context.sr = (mask & (SR_IMASK | SR_IE)) | SR_EXL;
|
||||||
|
|
|
@ -14,7 +14,7 @@ typedef struct EnDnh {
|
||||||
/* 0x144 */ EnDnhActionFunc actionFunc;
|
/* 0x144 */ EnDnhActionFunc actionFunc;
|
||||||
/* 0x148 */ SkelAnime skelAnime;
|
/* 0x148 */ SkelAnime skelAnime;
|
||||||
/* 0x18C */ u16 unk18C;
|
/* 0x18C */ u16 unk18C;
|
||||||
/* 0x190 */ s32 msgEventScript;
|
/* 0x190 */ s32* msgEventScript;
|
||||||
/* 0x194 */ s32 unk194;
|
/* 0x194 */ s32 unk194;
|
||||||
/* 0x198 */ s16 unk198;
|
/* 0x198 */ s16 unk198;
|
||||||
/* 0x19A */ UNK_TYPE1 pad19A[0x2];
|
/* 0x19A */ UNK_TYPE1 pad19A[0x2];
|
||||||
|
|
|
@ -1112,15 +1112,15 @@ void func_80B2ADB0(EnFish2* this, Vec3f* vec, s16 arg2) {
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_COUNT(this->unk_3F8); i++, ptr++) {
|
for (i = 0; i < ARRAY_COUNT(this->unk_3F8); i++, ptr++) {
|
||||||
if (!ptr->unk_00) {
|
if (!ptr->unk_00) {
|
||||||
TexturePtr phi_v0;
|
TexturePtr texture;
|
||||||
|
|
||||||
if (Rand_ZeroOne() < 0.5f) {
|
if (Rand_ZeroOne() < 0.5f) {
|
||||||
phi_v0 = gEffBubble2Tex;
|
texture = gEffBubble2Tex;
|
||||||
} else {
|
} else {
|
||||||
phi_v0 = gEffBubble1Tex;
|
texture = gEffBubble1Tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr->unk_20 = OS_K0_TO_PHYSICAL(SEGMENTED_TO_K0(phi_v0));
|
ptr->unk_20 = (TexturePtr)OS_K0_TO_PHYSICAL(SEGMENTED_TO_K0(texture));
|
||||||
ptr->unk_00 = true;
|
ptr->unk_00 = true;
|
||||||
ptr->unk_04 = *vec;
|
ptr->unk_04 = *vec;
|
||||||
ptr->unk_04.x += Rand_CenteredFloat(ptr->unk_00 + (this->unk_330 * 4000.0f));
|
ptr->unk_04.x += Rand_CenteredFloat(ptr->unk_00 + (this->unk_330 * 4000.0f));
|
||||||
|
|
|
@ -15,7 +15,7 @@ typedef struct {
|
||||||
/* 0x14 */ f32 unk_14;
|
/* 0x14 */ f32 unk_14;
|
||||||
/* 0x18 */ f32 unk_18;
|
/* 0x18 */ f32 unk_18;
|
||||||
/* 0x1C */ s16 unk_1C;
|
/* 0x1C */ s16 unk_1C;
|
||||||
/* 0x20 */ void* unk_20;
|
/* 0x20 */ TexturePtr unk_20;
|
||||||
} EnFish2UnkStruct; // size = 0x24
|
} EnFish2UnkStruct; // size = 0x24
|
||||||
|
|
||||||
typedef struct EnFish2 {
|
typedef struct EnFish2 {
|
||||||
|
|
|
@ -2318,7 +2318,7 @@ void EnGo_Snowball(EnGo* this, PlayState* play) {
|
||||||
* Return the MsgEvent script appropriate for the actor.
|
* Return the MsgEvent script appropriate for the actor.
|
||||||
*/
|
*/
|
||||||
s32* EnGo_GetMsgEventScript(EnGo* this, PlayState* play) {
|
s32* EnGo_GetMsgEventScript(EnGo* this, PlayState* play) {
|
||||||
static s32 sMsgScriptGraveyard[] = {
|
static s32* sMsgScriptGraveyard[] = {
|
||||||
sMsgScriptGoronGravemaker,
|
sMsgScriptGoronGravemaker,
|
||||||
sMsgScriptGoronFrozen,
|
sMsgScriptGoronFrozen,
|
||||||
};
|
};
|
||||||
|
|
|
@ -155,7 +155,7 @@ void func_80BC1A68(EnJa* this) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 func_80BC1AE0(EnJa* this, PlayState* play) {
|
Actor* func_80BC1AE0(EnJa* this, PlayState* play) {
|
||||||
Actor* ja = SubS_FindNearestActor(&this->actor, play, ACTORCAT_NPC, ACTOR_EN_JA);
|
Actor* ja = SubS_FindNearestActor(&this->actor, play, ACTORCAT_NPC, ACTOR_EN_JA);
|
||||||
Vec3f sp30;
|
Vec3f sp30;
|
||||||
Vec3f sp24;
|
Vec3f sp24;
|
||||||
|
@ -256,7 +256,7 @@ void func_80BC1E40(EnJa* this, PlayState* play) {
|
||||||
s32 func_80BC1FC8(EnJa* this, PlayState* play, ScheduleOutput* scheduleOutput) {
|
s32 func_80BC1FC8(EnJa* this, PlayState* play, ScheduleOutput* scheduleOutput) {
|
||||||
s32 ret = false;
|
s32 ret = false;
|
||||||
|
|
||||||
if (func_80BC1AE0(this, play)) {
|
if (func_80BC1AE0(this, play) != NULL) {
|
||||||
SubS_SetOfferMode(&this->unk_340, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
|
SubS_SetOfferMode(&this->unk_340, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
|
||||||
this->unk_340 |= 0x10;
|
this->unk_340 |= 0x10;
|
||||||
EnJa_ChangeAnim(this, ENJA_ANIM_5);
|
EnJa_ChangeAnim(this, ENJA_ANIM_5);
|
||||||
|
@ -269,7 +269,7 @@ s32 func_80BC1FC8(EnJa* this, PlayState* play, ScheduleOutput* scheduleOutput) {
|
||||||
s32 func_80BC203C(EnJa* this, PlayState* play, ScheduleOutput* scheduleOutput) {
|
s32 func_80BC203C(EnJa* this, PlayState* play, ScheduleOutput* scheduleOutput) {
|
||||||
s32 ret = false;
|
s32 ret = false;
|
||||||
|
|
||||||
if (func_80BC1AE0(this, play)) {
|
if (func_80BC1AE0(this, play) != NULL) {
|
||||||
if (ENJA_GET_3(&this->actor) == 0) {
|
if (ENJA_GET_3(&this->actor) == 0) {
|
||||||
EnJa_ChangeAnim(this, ENJA_ANIM_1);
|
EnJa_ChangeAnim(this, ENJA_ANIM_1);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -556,7 +556,7 @@ void EnMag_DrawImageRGBA32(Gfx** gfxp, s16 centerX, s16 centerY, TexturePtr sour
|
||||||
|
|
||||||
Gfx_SetupDL56_Ptr(&gfx);
|
Gfx_SetupDL56_Ptr(&gfx);
|
||||||
|
|
||||||
curTexture = source;
|
curTexture = (uintptr_t)source;
|
||||||
rectLeft = centerX - (width / 2);
|
rectLeft = centerX - (width / 2);
|
||||||
rectTop = centerY - (height / 2);
|
rectTop = centerY - (height / 2);
|
||||||
textureHeight = TMEM_SIZE / (width << 2);
|
textureHeight = TMEM_SIZE / (width << 2);
|
||||||
|
|
|
@ -101,9 +101,10 @@ void EnRz_Init(Actor* thisx, PlayState* play) {
|
||||||
Actor_SetScale(&this->actor, 0.01f);
|
Actor_SetScale(&this->actor, 0.01f);
|
||||||
ActorShape_Init(&this->actor.shape, 0.0f, EnRz_ActorShadowFunc, 20.0f);
|
ActorShape_Init(&this->actor.shape, 0.0f, EnRz_ActorShadowFunc, 20.0f);
|
||||||
|
|
||||||
// @bug this alignment is because of player animations, but should be using ALIGN16
|
//! @bug this alignment is because of player animations, but should be using ALIGN16
|
||||||
SkelAnime_InitFlex(play, &this->skelAnime, &object_rz_Skel_00D8D8, &gRosaSistersStandingAnim,
|
SkelAnime_InitFlex(play, &this->skelAnime, &object_rz_Skel_00D8D8, &gRosaSistersStandingAnim,
|
||||||
(uintptr_t)this->jointTable & ~0xF, (uintptr_t)this->morphTable & ~0xF, OBJECT_RZ_LIMB_MAX);
|
(void*)((uintptr_t)this->jointTable & ~0xF), (void*)((uintptr_t)this->morphTable & ~0xF),
|
||||||
|
OBJECT_RZ_LIMB_MAX);
|
||||||
Animation_PlayLoop(&this->skelAnime, &gRosaSistersStandingAnim);
|
Animation_PlayLoop(&this->skelAnime, &gRosaSistersStandingAnim);
|
||||||
|
|
||||||
Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
|
Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
|
||||||
|
|
|
@ -87,9 +87,10 @@ void EnYb_Init(Actor* thisx, PlayState* play) {
|
||||||
Actor_SetScale(&this->actor, 0.01f);
|
Actor_SetScale(&this->actor, 0.01f);
|
||||||
ActorShape_Init(&this->actor.shape, 0.0f, EnYb_ActorShadowFunc, 20.0f);
|
ActorShape_Init(&this->actor.shape, 0.0f, EnYb_ActorShadowFunc, 20.0f);
|
||||||
|
|
||||||
// @bug this alignment is because of player animations, but should be using ALIGN16
|
//! @bug this alignment is because of player animations, but should be using ALIGN16
|
||||||
SkelAnime_InitFlex(play, &this->skelAnime, &gYbSkel, &object_yb_Anim_000200, (uintptr_t)this->jointTable & ~0xF,
|
SkelAnime_InitFlex(play, &this->skelAnime, &gYbSkel, &object_yb_Anim_000200,
|
||||||
(uintptr_t)this->morphTable & ~0xF, YB_LIMB_MAX);
|
(void*)((uintptr_t)this->jointTable & ~0xF), (void*)((uintptr_t)this->morphTable & ~0xF),
|
||||||
|
YB_LIMB_MAX);
|
||||||
|
|
||||||
Animation_PlayLoop(&this->skelAnime, &object_yb_Anim_000200);
|
Animation_PlayLoop(&this->skelAnime, &object_yb_Anim_000200);
|
||||||
|
|
||||||
|
|
|
@ -16715,9 +16715,9 @@ void func_80851F18(PlayState* play, Player* this) {
|
||||||
temp_v0 = &this->unk_B10[this->unk_B86[i]];
|
temp_v0 = &this->unk_B10[this->unk_B86[i]];
|
||||||
|
|
||||||
AnimationContext_SetLoadFrame(play, temp->unk_4, *temp_v0, this->skelAnime.limbCount,
|
AnimationContext_SetLoadFrame(play, temp->unk_4, *temp_v0, this->skelAnime.limbCount,
|
||||||
ALIGN16((uintptr_t)this->blendTableBuffer));
|
(void*)ALIGN16((uintptr_t)this->blendTableBuffer));
|
||||||
AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
|
AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
|
||||||
ALIGN16((uintptr_t)this->blendTableBuffer), D_8085BA20);
|
(void*)ALIGN16((uintptr_t)this->blendTableBuffer), D_8085BA20);
|
||||||
}
|
}
|
||||||
|
|
||||||
temp_v0 = this->unk_B10;
|
temp_v0 = this->unk_B10;
|
||||||
|
|
|
@ -34,7 +34,7 @@ u32 EffectSsBubble_Init(PlayState* play, u32 index, EffectSs* this, void* initPa
|
||||||
{
|
{
|
||||||
TexturePtr tex = (Rand_ZeroOne() < 0.5f) ? gEffBubble1Tex : gEffBubble2Tex;
|
TexturePtr tex = (Rand_ZeroOne() < 0.5f) ? gEffBubble1Tex : gEffBubble2Tex;
|
||||||
|
|
||||||
this->gfx = OS_K0_TO_PHYSICAL(SEGMENTED_TO_K0(tex));
|
this->gfx = (void*)OS_K0_TO_PHYSICAL(SEGMENTED_TO_K0(tex));
|
||||||
}
|
}
|
||||||
|
|
||||||
this->pos.x = ((Rand_ZeroOne() - 0.5f) * initParams->xzPosRandScale) + initParams->pos.x;
|
this->pos.x = ((Rand_ZeroOne() - 0.5f) * initParams->xzPosRandScale) + initParams->pos.x;
|
||||||
|
|
|
@ -50,7 +50,7 @@ u32 EffectSsDtBubble_Init(PlayState* play, u32 index, EffectSs* this, void* init
|
||||||
{
|
{
|
||||||
TexturePtr tex = (Rand_ZeroOne() < 0.5f) ? gEffBubble1Tex : gEffBubble2Tex;
|
TexturePtr tex = (Rand_ZeroOne() < 0.5f) ? gEffBubble1Tex : gEffBubble2Tex;
|
||||||
|
|
||||||
this->gfx = OS_K0_TO_PHYSICAL(SEGMENTED_TO_K0(tex));
|
this->gfx = (void*)OS_K0_TO_PHYSICAL(SEGMENTED_TO_K0(tex));
|
||||||
}
|
}
|
||||||
|
|
||||||
Math_Vec3f_Copy(&this->pos, &initParams->pos);
|
Math_Vec3f_Copy(&this->pos, &initParams->pos);
|
||||||
|
|
|
@ -34,8 +34,8 @@ u32 EffectSsExtra_Init(PlayState* play, u32 index, EffectSs* this, void* initPar
|
||||||
s32 objectSlot;
|
s32 objectSlot;
|
||||||
|
|
||||||
objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_YABUSAME_POINT);
|
objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_YABUSAME_POINT);
|
||||||
if ((objectSlot > OBJECT_SLOT_NONE) && (Object_IsLoaded(&play->objectCtx, objectSlot))) {
|
if ((objectSlot > OBJECT_SLOT_NONE) && Object_IsLoaded(&play->objectCtx, objectSlot)) {
|
||||||
void* segBackup = gSegments[6];
|
uintptr_t segBackup = gSegments[6];
|
||||||
|
|
||||||
gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment);
|
gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment);
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ u32 EffectSsSibuki_Init(PlayState* play, u32 index, EffectSs* this, void* initPa
|
||||||
{
|
{
|
||||||
TexturePtr tex = (KREG(2) != 0) ? gEffBubble2Tex : gEffBubble1Tex;
|
TexturePtr tex = (KREG(2) != 0) ? gEffBubble2Tex : gEffBubble1Tex;
|
||||||
|
|
||||||
this->gfx = OS_K0_TO_PHYSICAL(SEGMENTED_TO_K0(tex));
|
this->gfx = (void*)OS_K0_TO_PHYSICAL(SEGMENTED_TO_K0(tex));
|
||||||
}
|
}
|
||||||
|
|
||||||
this->life = ((s32)((Rand_ZeroOne() * (500.0f + KREG(64))) * 0.01f)) + KREG(65) + 10;
|
this->life = ((s32)((Rand_ZeroOne() * (500.0f + KREG(64))) * 0.01f)) + KREG(65) + 10;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "z_kaleido_scope.h"
|
#include "z_kaleido_scope.h"
|
||||||
#include "z64view.h"
|
#include "z64view.h"
|
||||||
#include "overlays/gamestates/ovl_opening/z_opening.h"
|
#include "overlays/gamestates/ovl_opening/z_opening.h"
|
||||||
|
|
||||||
#include "archives/icon_item_static/icon_item_static_yar.h"
|
#include "archives/icon_item_static/icon_item_static_yar.h"
|
||||||
#include "interface/icon_item_gameover_static/icon_item_gameover_static.h"
|
#include "interface/icon_item_gameover_static/icon_item_gameover_static.h"
|
||||||
#include "interface/icon_item_jpn_static/icon_item_jpn_static.h"
|
#include "interface/icon_item_jpn_static/icon_item_jpn_static.h"
|
||||||
|
@ -2858,7 +2859,7 @@ void KaleidoScope_Update(PlayState* play) {
|
||||||
|
|
||||||
pauseCtx->iconItemSegment = (void*)ALIGN16((uintptr_t)play->objectCtx.spaceStart);
|
pauseCtx->iconItemSegment = (void*)ALIGN16((uintptr_t)play->objectCtx.spaceStart);
|
||||||
size0 = SEGMENT_ROM_SIZE(icon_item_static_syms);
|
size0 = SEGMENT_ROM_SIZE(icon_item_static_syms);
|
||||||
CmpDma_LoadAllFiles((uintptr_t)SEGMENT_ROM_START(icon_item_static_yar), pauseCtx->iconItemSegment, size0);
|
CmpDma_LoadAllFiles(SEGMENT_ROM_START(icon_item_static_yar), pauseCtx->iconItemSegment, size0);
|
||||||
|
|
||||||
gSegments[0x08] = OS_K0_TO_PHYSICAL(pauseCtx->iconItemSegment);
|
gSegments[0x08] = OS_K0_TO_PHYSICAL(pauseCtx->iconItemSegment);
|
||||||
|
|
||||||
|
@ -2870,8 +2871,7 @@ void KaleidoScope_Update(PlayState* play) {
|
||||||
|
|
||||||
pauseCtx->iconItem24Segment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemSegment + size0);
|
pauseCtx->iconItem24Segment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemSegment + size0);
|
||||||
size1 = SEGMENT_ROM_SIZE(icon_item_24_static_syms);
|
size1 = SEGMENT_ROM_SIZE(icon_item_24_static_syms);
|
||||||
CmpDma_LoadAllFiles((uintptr_t)SEGMENT_ROM_START(icon_item_24_static_yar), pauseCtx->iconItem24Segment,
|
CmpDma_LoadAllFiles(SEGMENT_ROM_START(icon_item_24_static_yar), pauseCtx->iconItem24Segment, size1);
|
||||||
size1);
|
|
||||||
|
|
||||||
pauseCtx->iconItemAltSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItem24Segment + size1);
|
pauseCtx->iconItemAltSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItem24Segment + size1);
|
||||||
if (func_8010A0A4(play)) {
|
if (func_8010A0A4(play)) {
|
||||||
|
@ -2886,7 +2886,7 @@ void KaleidoScope_Update(PlayState* play) {
|
||||||
|
|
||||||
sInDungeonScene = false;
|
sInDungeonScene = false;
|
||||||
size = SEGMENT_ROM_SIZE(icon_item_field_static);
|
size = SEGMENT_ROM_SIZE(icon_item_field_static);
|
||||||
DmaMgr_SendRequest0(pauseCtx->iconItemAltSegment, _icon_item_field_staticSegmentRomStart, size);
|
DmaMgr_SendRequest0(pauseCtx->iconItemAltSegment, SEGMENT_ROM_START(icon_item_field_static), size);
|
||||||
iconItemLangSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemAltSegment + size);
|
iconItemLangSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemAltSegment + size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue