mirror of https://github.com/zeldaret/mm.git
Dmadata Migration (#1526)
* Matching dmatable * Generate NON_MATCHING dmadata * Clean up dmamgr * Format * Ignore tools/buildtools/mkdmadata * Warnings * Use SYMS flag instead of segment name * PR + more notes * PR cleanups
This commit is contained in:
parent
697e73f995
commit
1611c22212
8
Makefile
8
Makefile
|
@ -118,6 +118,7 @@ endif
|
||||||
CPP := cpp
|
CPP := cpp
|
||||||
ELF2ROM := tools/buildtools/elf2rom
|
ELF2ROM := tools/buildtools/elf2rom
|
||||||
MKLDSCRIPT := tools/buildtools/mkldscript
|
MKLDSCRIPT := tools/buildtools/mkldscript
|
||||||
|
MKDMADATA := tools/buildtools/mkdmadata
|
||||||
YAZ0 := tools/buildtools/yaz0
|
YAZ0 := tools/buildtools/yaz0
|
||||||
ZAPD := tools/ZAPD/ZAPD.out
|
ZAPD := tools/ZAPD/ZAPD.out
|
||||||
FADO := tools/fado/fado.elf
|
FADO := tools/fado/fado.elf
|
||||||
|
@ -345,6 +346,13 @@ build/$(SPEC): $(SPEC)
|
||||||
build/ldscript.txt: build/$(SPEC)
|
build/ldscript.txt: build/$(SPEC)
|
||||||
$(MKLDSCRIPT) $< $@
|
$(MKLDSCRIPT) $< $@
|
||||||
|
|
||||||
|
build/dmadata_table_spec.h: build/$(SPEC)
|
||||||
|
$(MKDMADATA) $< $@
|
||||||
|
|
||||||
|
# Dependencies for files that may include the dmadata header automatically generated from the spec file
|
||||||
|
build/src/boot/z_std_dma.o: build/dmadata_table_spec.h
|
||||||
|
build/src/dmadata/dmadata.o: build/dmadata_table_spec.h
|
||||||
|
|
||||||
build/asm/%.o: asm/%.s
|
build/asm/%.o: asm/%.s
|
||||||
$(AS) $(ASFLAGS) $< -o $@
|
$(AS) $(ASFLAGS) $< -o $@
|
||||||
|
|
||||||
|
|
|
@ -6,22 +6,7 @@
|
||||||
void bootproc(void);
|
void bootproc(void);
|
||||||
void ViConfig_UpdateVi(u32 black);
|
void ViConfig_UpdateVi(u32 black);
|
||||||
void ViConfig_UpdateBlack(void);
|
void ViConfig_UpdateBlack(void);
|
||||||
s32 DmaMgr_DmaRomToRam(uintptr_t rom, void* ram, size_t size);
|
|
||||||
s32 DmaMgr_DmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction);
|
|
||||||
DmaEntry* DmaMgr_FindDmaEntry(uintptr_t vrom);
|
|
||||||
u32 DmaMgr_TranslateVromToRom(uintptr_t vrom);
|
|
||||||
s32 DmaMgr_FindDmaIndex(uintptr_t vrom);
|
|
||||||
const char* func_800809F4(uintptr_t param_1);
|
|
||||||
void DmaMgr_ProcessMsg(DmaRequest* req);
|
|
||||||
void DmaMgr_ThreadEntry(void* arg);
|
|
||||||
s32 DmaMgr_SendRequestImpl(DmaRequest* request, void* vramStart, uintptr_t vromStart, size_t size, UNK_TYPE4 unused, OSMesgQueue* queue, void* msg);
|
|
||||||
s32 DmaMgr_SendRequest0(void* vramStart, uintptr_t vromStart, size_t size);
|
|
||||||
void DmaMgr_Start(void);
|
|
||||||
void DmaMgr_Stop(void);
|
|
||||||
void* Yaz0_FirstDMA(void);
|
|
||||||
void* Yaz0_NextDMA(void* curSrcPos);
|
|
||||||
s32 Yaz0_DecompressImpl(u8* src, u8* dst);
|
|
||||||
void Yaz0_Decompress(uintptr_t romStart, void* dst, size_t size);
|
|
||||||
void IrqMgr_AddClient(IrqMgr* irqmgr, IrqMgrClient* client, OSMesgQueue* msgQueue);
|
void IrqMgr_AddClient(IrqMgr* irqmgr, IrqMgrClient* client, OSMesgQueue* msgQueue);
|
||||||
void IrqMgr_RemoveClient(IrqMgr* irqmgr, IrqMgrClient* remove);
|
void IrqMgr_RemoveClient(IrqMgr* irqmgr, IrqMgrClient* remove);
|
||||||
void IrqMgr_SendMesgForClient(IrqMgr* irqmgr, OSMesg msg);
|
void IrqMgr_SendMesgForClient(IrqMgr* irqmgr, OSMesg msg);
|
||||||
|
|
|
@ -23,4 +23,9 @@ typedef struct {
|
||||||
/* 0x278 */ OSTime lastFrameTime;
|
/* 0x278 */ OSTime lastFrameTime;
|
||||||
} IrqMgr; // size = 0x280
|
} IrqMgr; // size = 0x280
|
||||||
|
|
||||||
|
extern vs32 gIrqMgrResetStatus;
|
||||||
|
extern volatile OSTime sIrqMgrResetTime;
|
||||||
|
extern volatile OSTime gIrqMgrRetraceTime;
|
||||||
|
extern s32 sIrqMgrRetraceCount;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,9 @@
|
||||||
|
/**
|
||||||
|
* Select dmadata table for version
|
||||||
|
*/
|
||||||
|
#ifdef NON_MATCHING
|
||||||
|
// For non-matching builds, dmadata is generated from the specfile segments
|
||||||
|
#include "dmadata_table_spec.h"
|
||||||
|
#else
|
||||||
|
#include "dmadata/dmadata_table_us.h"
|
||||||
|
#endif
|
|
@ -6,12 +6,6 @@
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
// data
|
// data
|
||||||
extern size_t gDmaMgrDmaBuffSize;
|
|
||||||
extern vs32 gIrqMgrResetStatus;
|
|
||||||
extern volatile OSTime sIrqMgrResetTime;
|
|
||||||
extern volatile OSTime gIrqMgrRetraceTime;
|
|
||||||
extern s32 sIrqMgrRetraceCount;
|
|
||||||
|
|
||||||
// extern UNK_TYPE1 sGfxPrintFontTLUT;
|
// extern UNK_TYPE1 sGfxPrintFontTLUT;
|
||||||
// extern UNK_TYPE1 sGfxPrintRainbowTLUT;
|
// extern UNK_TYPE1 sGfxPrintRainbowTLUT;
|
||||||
// extern UNK_TYPE1 sGfxPrintRainbowData;
|
// extern UNK_TYPE1 sGfxPrintRainbowData;
|
||||||
|
@ -27,8 +21,6 @@ extern void* gYaz0DecompressDstEnd;
|
||||||
|
|
||||||
// extern UNK_TYPE4 D_8009CD10;
|
// extern UNK_TYPE4 D_8009CD10;
|
||||||
// extern UNK_TYPE4 sArenaLockMsg;
|
// extern UNK_TYPE4 sArenaLockMsg;
|
||||||
|
|
||||||
extern DmaEntry dmadata[1568];
|
|
||||||
// extern UNK_TYPE1 D_80186028;
|
// extern UNK_TYPE1 D_80186028;
|
||||||
|
|
||||||
extern u8 sDropTable[DROP_TABLE_SIZE * DROP_TABLE_NUMBER];
|
extern u8 sDropTable[DROP_TABLE_SIZE * DROP_TABLE_NUMBER];
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
#ifndef YAZ0_H
|
||||||
|
#define YAZ0_H
|
||||||
|
|
||||||
|
#include "ultra64.h"
|
||||||
|
|
||||||
|
void Yaz0_Decompress(uintptr_t romStart, void* dst, size_t size);
|
||||||
|
|
||||||
|
#endif
|
|
@ -2,16 +2,17 @@
|
||||||
#define Z64DMA_H
|
#define Z64DMA_H
|
||||||
|
|
||||||
#include "ultra64.h"
|
#include "ultra64.h"
|
||||||
|
#include "unk.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ uintptr_t vromAddr; // VROM address (source)
|
/* 0x00 */ uintptr_t vromAddr; // VROM address (source)
|
||||||
/* 0x04 */ void* dramAddr; // DRAM address (destination)
|
/* 0x04 */ void* dramAddr; // DRAM address (destination)
|
||||||
/* 0x08 */ u32 size; // File Transfer size
|
/* 0x08 */ size_t size; // File Transfer size
|
||||||
/* 0x0C */ char* filename; // Filename for debugging
|
/* 0x0C */ char* filename; // Filename for debugging
|
||||||
/* 0x10 */ s32 line; // Line for debugging
|
/* 0x10 */ s32 line; // Line for debugging
|
||||||
/* 0x14 */ s32 unk14;
|
/* 0x14 */ s32 unk14;
|
||||||
/* 0x18 */ OSMesgQueue* notifyQueue; // Message queue for the notification message
|
/* 0x18 */ OSMesgQueue* notifyQueue; // Message queue for the notification message
|
||||||
/* 0x1C */ OSMesg notifyMsg; // Completion notification message
|
/* 0x1C */ OSMesg notifyMsg; // Completion notification message
|
||||||
} DmaRequest; // size = 0x20
|
} DmaRequest; // size = 0x20
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -21,4 +22,25 @@ typedef struct {
|
||||||
/* 0xC */ uintptr_t romEnd;
|
/* 0xC */ uintptr_t romEnd;
|
||||||
} DmaEntry; // size = 0x10
|
} DmaEntry; // size = 0x10
|
||||||
|
|
||||||
|
#define DMAMGR_DEFAULT_BUFSIZE ALIGN16(0x2000)
|
||||||
|
|
||||||
|
extern DmaEntry gDmaDataTable[];
|
||||||
|
extern size_t gDmaMgrDmaBuffSize;
|
||||||
|
|
||||||
|
// Standard DMA Requests
|
||||||
|
s32 DmaMgr_RequestAsync(DmaRequest* req, void* ram, uintptr_t vrom, size_t size, UNK_TYPE unused, OSMesgQueue* queue, void* msg);
|
||||||
|
s32 DmaMgr_RequestSync(void* ram, uintptr_t vrom, size_t size);
|
||||||
|
|
||||||
|
// Special-purpose DMA Requests
|
||||||
|
|
||||||
|
s32 DmaMgr_DmaRomToRam(uintptr_t rom, void* ram, size_t size);
|
||||||
|
s32 DmaMgr_TranslateVromToRom(uintptr_t vrom);
|
||||||
|
s32 DmaMgr_AudioDmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction);
|
||||||
|
const char* func_800809F4(uintptr_t vrom);
|
||||||
|
|
||||||
|
// Thread Management
|
||||||
|
|
||||||
|
void DmaMgr_Init(void);
|
||||||
|
void DmaMgr_Stop(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,16 +13,17 @@
|
||||||
#define Z_THREAD_ID_DMAMGR 18
|
#define Z_THREAD_ID_DMAMGR 18
|
||||||
#define Z_THREAD_ID_IRQMGR 19
|
#define Z_THREAD_ID_IRQMGR 19
|
||||||
|
|
||||||
#define Z_PRIORITY_SLOWLY 5
|
#define Z_PRIORITY_SLOWLY 5
|
||||||
#define Z_PRIORITY_GRAPH 9
|
#define Z_PRIORITY_GRAPH 9
|
||||||
#define Z_PRIORITY_AUDIOMGR 11
|
#define Z_PRIORITY_DMAMGR_LOW 10
|
||||||
#define Z_PRIORITY_IDLE 12
|
#define Z_PRIORITY_AUDIOMGR 11
|
||||||
#define Z_PRIORITY_MAIN 12
|
#define Z_PRIORITY_IDLE 12
|
||||||
#define Z_PRIORITY_FLASHROM 13
|
#define Z_PRIORITY_MAIN 12
|
||||||
#define Z_PRIORITY_PADMGR 15
|
#define Z_PRIORITY_FLASHROM 13
|
||||||
#define Z_PRIORITY_SCHED 16
|
#define Z_PRIORITY_PADMGR 15
|
||||||
#define Z_PRIORITY_DMAMGR 17
|
#define Z_PRIORITY_SCHED 16
|
||||||
#define Z_PRIORITY_IRQMGR 18
|
#define Z_PRIORITY_DMAMGR 17
|
||||||
#define Z_PRIORITY_FAULT OS_PRIORITY_APPMAX
|
#define Z_PRIORITY_IRQMGR 18
|
||||||
|
#define Z_PRIORITY_FAULT OS_PRIORITY_APPMAX
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
5
spec
5
spec
|
@ -247,7 +247,7 @@ endseg
|
||||||
|
|
||||||
beginseg
|
beginseg
|
||||||
name "dmadata"
|
name "dmadata"
|
||||||
include "build/asm/dmadata/dmadata.o"
|
include "build/src/dmadata/dmadata.o"
|
||||||
endseg
|
endseg
|
||||||
|
|
||||||
beginseg
|
beginseg
|
||||||
|
@ -280,6 +280,7 @@ endseg
|
||||||
|
|
||||||
beginseg
|
beginseg
|
||||||
name "icon_item_static_syms"
|
name "icon_item_static_syms"
|
||||||
|
flags SYMS
|
||||||
romalign 0x1000
|
romalign 0x1000
|
||||||
include "build/assets/archives/icon_item_static/icon_item_static_yar.symbols.o"
|
include "build/assets/archives/icon_item_static/icon_item_static_yar.symbols.o"
|
||||||
number 8
|
number 8
|
||||||
|
@ -287,6 +288,7 @@ endseg
|
||||||
|
|
||||||
beginseg
|
beginseg
|
||||||
name "icon_item_24_static_syms"
|
name "icon_item_24_static_syms"
|
||||||
|
flags SYMS
|
||||||
romalign 0x1000
|
romalign 0x1000
|
||||||
include "build/assets/archives/icon_item_24_static/icon_item_24_static_yar.symbols.o"
|
include "build/assets/archives/icon_item_24_static/icon_item_24_static_yar.symbols.o"
|
||||||
number 9
|
number 9
|
||||||
|
@ -366,6 +368,7 @@ endseg
|
||||||
|
|
||||||
beginseg
|
beginseg
|
||||||
name "schedule_dma_static_syms"
|
name "schedule_dma_static_syms"
|
||||||
|
flags SYMS
|
||||||
include "build/assets/archives/schedule_dma_static/schedule_dma_static_yar.symbols.o"
|
include "build/assets/archives/schedule_dma_static/schedule_dma_static_yar.symbols.o"
|
||||||
number 7
|
number 7
|
||||||
endseg
|
endseg
|
||||||
|
|
|
@ -146,7 +146,7 @@ size_t Fragment_Load(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, vo
|
||||||
if (gLoadLogSeverity >= 3) {}
|
if (gLoadLogSeverity >= 3) {}
|
||||||
|
|
||||||
end = (uintptr_t)allocatedRamAddr + size;
|
end = (uintptr_t)allocatedRamAddr + size;
|
||||||
DmaMgr_SendRequest0(allocatedRamAddr, vromStart, size);
|
DmaMgr_RequestSync(allocatedRamAddr, vromStart, size);
|
||||||
|
|
||||||
ovlRelocs = (OverlayRelocationSection*)(end - ((s32*)end)[-1]);
|
ovlRelocs = (OverlayRelocationSection*)(end - ((s32*)end)[-1]);
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ void* Fragment_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vra
|
||||||
|
|
||||||
if (gLoadLogSeverity >= 3) {}
|
if (gLoadLogSeverity >= 3) {}
|
||||||
|
|
||||||
DmaMgr_SendRequest0(allocatedRamAddr, vromStart, size);
|
DmaMgr_RequestSync(allocatedRamAddr, vromStart, size);
|
||||||
|
|
||||||
if (gLoadLogSeverity >= 3) {}
|
if (gLoadLogSeverity >= 3) {}
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* ramStart, void
|
||||||
if (gOverlayLogSeverity >= 3) {}
|
if (gOverlayLogSeverity >= 3) {}
|
||||||
|
|
||||||
end = (uintptr_t)allocatedRamAddr + size;
|
end = (uintptr_t)allocatedRamAddr + size;
|
||||||
DmaMgr_SendRequest0(allocatedRamAddr, vromStart, size);
|
DmaMgr_RequestSync(allocatedRamAddr, vromStart, size);
|
||||||
|
|
||||||
ovlRelocs = (OverlayRelocationSection*)(end - ((s32*)end)[-1]);
|
ovlRelocs = (OverlayRelocationSection*)(end - ((s32*)end)[-1]);
|
||||||
|
|
||||||
|
|
|
@ -73,8 +73,8 @@ void Main_Init(void) {
|
||||||
prevSize = gDmaMgrDmaBuffSize;
|
prevSize = gDmaMgrDmaBuffSize;
|
||||||
gDmaMgrDmaBuffSize = 0;
|
gDmaMgrDmaBuffSize = 0;
|
||||||
|
|
||||||
DmaMgr_SendRequestImpl(&dmaReq, SEGMENT_START(code), SEGMENT_ROM_START(code), SEGMENT_ROM_SIZE_ALT(code), 0, &mq,
|
DmaMgr_RequestAsync(&dmaReq, SEGMENT_START(code), SEGMENT_ROM_START(code), SEGMENT_ROM_SIZE_ALT(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);
|
||||||
|
@ -87,7 +87,7 @@ void Main_Init(void) {
|
||||||
void Main_ThreadEntry(void* arg) {
|
void Main_ThreadEntry(void* arg) {
|
||||||
StackCheck_Init(&sIrqMgrStackInfo, sIrqMgrStack, STACK_TOP(sIrqMgrStack), 0, 0x100, "irqmgr");
|
StackCheck_Init(&sIrqMgrStackInfo, sIrqMgrStack, STACK_TOP(sIrqMgrStack), 0, 0x100, "irqmgr");
|
||||||
IrqMgr_Init(&gIrqMgr, STACK_TOP(sIrqMgrStack), Z_PRIORITY_IRQMGR, 1);
|
IrqMgr_Init(&gIrqMgr, STACK_TOP(sIrqMgrStack), Z_PRIORITY_IRQMGR, 1);
|
||||||
DmaMgr_Start();
|
DmaMgr_Init();
|
||||||
Main_Init();
|
Main_Init();
|
||||||
Main(arg);
|
Main(arg);
|
||||||
DmaMgr_Stop();
|
DmaMgr_Stop();
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
|
#include "yaz0.h"
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "fault.h"
|
#include "fault.h"
|
||||||
#include "libc64/sprintf.h"
|
#include "libc64/sprintf.h"
|
||||||
#include "libc64/sleep.h"
|
#include "libc64/sleep.h"
|
||||||
|
#include "z64dma.h"
|
||||||
|
|
||||||
u8 sYaz0DataBuffer[0x400] ALIGNED(16);
|
u8 sYaz0DataBuffer[0x400] ALIGNED(16);
|
||||||
u8* sYaz0CurDataEnd;
|
u8* sYaz0CurDataEnd;
|
||||||
|
@ -10,7 +13,7 @@ u32 sYaz0CurSize;
|
||||||
u8* sYaz0MaxPtr;
|
u8* sYaz0MaxPtr;
|
||||||
void* gYaz0DecompressDstEnd;
|
void* gYaz0DecompressDstEnd;
|
||||||
|
|
||||||
void* Yaz0_FirstDMA() {
|
void* Yaz0_FirstDMA(void) {
|
||||||
u32 pad0;
|
u32 pad0;
|
||||||
u32 dmaSize;
|
u32 dmaSize;
|
||||||
u32 curSize;
|
u32 curSize;
|
||||||
|
@ -51,7 +54,7 @@ void* Yaz0_NextDMA(void* curSrcPos) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
oldPri = osGetThreadPri(NULL);
|
oldPri = osGetThreadPri(NULL);
|
||||||
osSetThreadPri(NULL, 0x7F);
|
osSetThreadPri(NULL, OS_PRIORITY_APPMAX);
|
||||||
osSyncPrintf("圧縮展開異常\n");
|
osSyncPrintf("圧縮展開異常\n");
|
||||||
osSetThreadPri(NULL, oldPri);
|
osSetThreadPri(NULL, oldPri);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,55 @@
|
||||||
#include "prevent_bss_reordering.h"
|
/**
|
||||||
#include "global.h"
|
* @file z_std_dma.c
|
||||||
|
*
|
||||||
|
* This file implements a system for structuring the ROM image and retrieving data. It is designed to have the same
|
||||||
|
* external interface regardless of whether the ROM segments are compressed or not.
|
||||||
|
*
|
||||||
|
* The ROM image is partitioned into regions that are entered into the DMA data table `gDmaDataTable`. External code
|
||||||
|
* does not directly address locations on the ROM image directly, instead a "Virtual ROM" addressing is used. Virtual
|
||||||
|
* ROM is defined to be the ROM address of a segment in a totally uncompressed ROM. For uncompressed ROMs, "physical"
|
||||||
|
* ROM and VROM addresses coincide. The DMA data table converts VROM to ROM addresses so that code may exclusively use
|
||||||
|
* VROM addresses even if the ROM is compressed.
|
||||||
|
*
|
||||||
|
* External code typically submits requests to the DMA Manager asking for a transfer in terms of Virtual ROM; the DMA
|
||||||
|
* Manager translates this to the physical ROM address, performs the transfer to RAM and decompresses the data if
|
||||||
|
* required.
|
||||||
|
* Requests are processed in the order they are received and may be submitted both synchronously and asynchronously.
|
||||||
|
*
|
||||||
|
* There are some additional provisions to ensure that audio DMA is particularly high-speed, the audio data is assumed
|
||||||
|
* to be uncompressed and the request queue and address translation is skipped.
|
||||||
|
*/
|
||||||
|
#include "z64dma.h"
|
||||||
|
|
||||||
#include "carthandle.h"
|
#include "carthandle.h"
|
||||||
#include "fault.h"
|
#include "fault.h"
|
||||||
|
#include "macros.h"
|
||||||
|
#include "segment_symbols.h"
|
||||||
#include "stack.h"
|
#include "stack.h"
|
||||||
#include "stackcheck.h"
|
#include "stackcheck.h"
|
||||||
#include "z64dma.h"
|
#include "yaz0.h"
|
||||||
#include "z64thread.h"
|
#include "z64thread.h"
|
||||||
|
|
||||||
size_t gDmaMgrDmaBuffSize = 0x2000;
|
size_t gDmaMgrDmaBuffSize = DMAMGR_DEFAULT_BUFSIZE;
|
||||||
|
|
||||||
StackEntry sDmaMgrStackInfo;
|
StackEntry sDmaMgrStackInfo;
|
||||||
u16 sNumDmaEntries;
|
u16 sNumDmaEntries;
|
||||||
OSMesgQueue sDmaMgrMsgQueue;
|
OSMesgQueue sDmaMgrMsgQueue;
|
||||||
OSMesg sDmaMgrMsgs[32];
|
OSMesg sDmaMgrMsgBuf[32];
|
||||||
OSThread sDmaMgrThread;
|
OSThread sDmaMgrThread;
|
||||||
STACK(sDmaMgrStack, 0x500);
|
STACK(sDmaMgrStack, 0x500);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transfer `size` bytes from physical ROM address `rom` to `ram`.
|
||||||
|
*
|
||||||
|
* This function is intended for internal use only, however it is possible to use this function externally in which
|
||||||
|
* case it behaves as a synchronous transfer, data is available as soon as this function returns.
|
||||||
|
*
|
||||||
|
* Transfers are divided into chunks based on the current value of `gDmaMgrDmaBuffSize` to avoid congestion of the PI
|
||||||
|
* so that higher priority transfers can still be carried out in a timely manner. The transfers are sent in a queue to
|
||||||
|
* the OS PI Manager which performs the transfer.
|
||||||
|
*
|
||||||
|
* @return 0 if successful, -1 if the DMA could not be queued with the PI Manager.
|
||||||
|
*/
|
||||||
s32 DmaMgr_DmaRomToRam(uintptr_t rom, void* ram, size_t size) {
|
s32 DmaMgr_DmaRomToRam(uintptr_t rom, void* ram, size_t size) {
|
||||||
OSIoMesg ioMsg;
|
OSIoMesg ioMsg;
|
||||||
OSMesgQueue queue;
|
OSMesgQueue queue;
|
||||||
|
@ -28,14 +62,14 @@ s32 DmaMgr_DmaRomToRam(uintptr_t rom, void* ram, size_t size) {
|
||||||
|
|
||||||
if (buffSize != 0) {
|
if (buffSize != 0) {
|
||||||
while (buffSize < size) {
|
while (buffSize < size) {
|
||||||
ioMsg.hdr.pri = 0;
|
ioMsg.hdr.pri = OS_MESG_PRI_NORMAL;
|
||||||
ioMsg.hdr.retQueue = &queue;
|
ioMsg.hdr.retQueue = &queue;
|
||||||
ioMsg.devAddr = rom;
|
ioMsg.devAddr = rom;
|
||||||
ioMsg.dramAddr = ram;
|
ioMsg.dramAddr = ram;
|
||||||
ioMsg.size = buffSize;
|
ioMsg.size = buffSize;
|
||||||
ret = osEPiStartDma(gCartHandle, &ioMsg, 0);
|
ret = osEPiStartDma(gCartHandle, &ioMsg, OS_READ);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
goto END;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
osRecvMesg(&queue, NULL, OS_MESG_BLOCK);
|
osRecvMesg(&queue, NULL, OS_MESG_BLOCK);
|
||||||
|
@ -44,46 +78,52 @@ s32 DmaMgr_DmaRomToRam(uintptr_t rom, void* ram, size_t size) {
|
||||||
ram = (u8*)ram + buffSize;
|
ram = (u8*)ram + buffSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ioMsg.hdr.pri = 0;
|
|
||||||
|
ioMsg.hdr.pri = OS_MESG_PRI_NORMAL;
|
||||||
ioMsg.hdr.retQueue = &queue;
|
ioMsg.hdr.retQueue = &queue;
|
||||||
ioMsg.devAddr = rom;
|
ioMsg.devAddr = rom;
|
||||||
ioMsg.dramAddr = ram;
|
ioMsg.dramAddr = ram;
|
||||||
ioMsg.size = size;
|
ioMsg.size = size;
|
||||||
ret = osEPiStartDma(gCartHandle, &ioMsg, 0);
|
ret = osEPiStartDma(gCartHandle, &ioMsg, OS_READ);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
goto END;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
osRecvMesg(&queue, NULL, OS_MESG_BLOCK);
|
osRecvMesg(&queue, NULL, OS_MESG_BLOCK);
|
||||||
|
|
||||||
osInvalDCache(ram, size);
|
osInvalDCache(ram, size);
|
||||||
|
|
||||||
END:
|
end:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 DmaMgr_DmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) {
|
/**
|
||||||
|
* Callback function to facilitate audio DMA. Audio DMA does not use the request queue as audio data is often needed
|
||||||
|
* very soon after the request is sent, requiring a higher priority method for enqueueing a DMA on the OS PI command
|
||||||
|
* queue.
|
||||||
|
*
|
||||||
|
* @param pihandle Cartridge ROM PI Handle.
|
||||||
|
* @param mb IO Message describing the transfer.
|
||||||
|
* @param direction Read or write.
|
||||||
|
* @return 0 if the IO Message was successfully put on the OS PI command queue, < 0 otherwise
|
||||||
|
*/
|
||||||
|
s32 DmaMgr_AudioDmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) {
|
||||||
return osEPiStartDma(pihandle, mb, direction);
|
return osEPiStartDma(pihandle, mb, direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
DmaEntry* DmaMgr_FindDmaEntry(uintptr_t vrom) {
|
DmaEntry* DmaMgr_FindDmaEntry(uintptr_t vrom) {
|
||||||
DmaEntry* curr;
|
DmaEntry* entry;
|
||||||
|
|
||||||
for (curr = dmadata; curr->vromEnd != 0; curr++) {
|
for (entry = gDmaDataTable; entry->vromEnd != 0; entry++) {
|
||||||
if (vrom < curr->vromStart) {
|
if ((vrom >= entry->vromStart) && (vrom < entry->vromEnd)) {
|
||||||
continue;
|
return entry;
|
||||||
}
|
}
|
||||||
if (vrom >= curr->vromEnd) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
return curr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 DmaMgr_TranslateVromToRom(uintptr_t vrom) {
|
s32 DmaMgr_TranslateVromToRom(uintptr_t vrom) {
|
||||||
DmaEntry* entry = DmaMgr_FindDmaEntry(vrom);
|
DmaEntry* entry = DmaMgr_FindDmaEntry(vrom);
|
||||||
|
|
||||||
if (entry != NULL) {
|
if (entry != NULL) {
|
||||||
|
@ -105,65 +145,69 @@ s32 DmaMgr_FindDmaIndex(uintptr_t vrom) {
|
||||||
DmaEntry* entry = DmaMgr_FindDmaEntry(vrom);
|
DmaEntry* entry = DmaMgr_FindDmaEntry(vrom);
|
||||||
|
|
||||||
if (entry != NULL) {
|
if (entry != NULL) {
|
||||||
return entry - dmadata;
|
return entry - gDmaDataTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* func_800809F4(u32 a0) {
|
const char* func_800809F4(uintptr_t vrom) {
|
||||||
return "??";
|
return "??";
|
||||||
}
|
}
|
||||||
|
|
||||||
void DmaMgr_ProcessMsg(DmaRequest* req) {
|
void DmaMgr_ProcessRequest(DmaRequest* req) {
|
||||||
uintptr_t vrom;
|
uintptr_t vrom = req->vromAddr;
|
||||||
void* ram;
|
void* ram = req->dramAddr;
|
||||||
size_t size;
|
size_t size = req->size;
|
||||||
uintptr_t romStart;
|
uintptr_t romStart;
|
||||||
size_t romSize;
|
size_t romSize;
|
||||||
DmaEntry* dmaEntry;
|
DmaEntry* entry;
|
||||||
s32 index;
|
s32 index = DmaMgr_FindDmaIndex(vrom);
|
||||||
|
|
||||||
vrom = req->vromAddr;
|
|
||||||
ram = req->dramAddr;
|
|
||||||
size = req->size;
|
|
||||||
|
|
||||||
index = DmaMgr_FindDmaIndex(vrom);
|
|
||||||
|
|
||||||
if ((index >= 0) && (index < sNumDmaEntries)) {
|
if ((index >= 0) && (index < sNumDmaEntries)) {
|
||||||
dmaEntry = &dmadata[index];
|
entry = &gDmaDataTable[index];
|
||||||
if (dmaEntry->romEnd == 0) {
|
if (entry->romEnd == 0) {
|
||||||
if (dmaEntry->vromEnd < (vrom + size)) {
|
// romEnd of 0 indicates that the file is uncompressed. Files that are stored uncompressed can have
|
||||||
|
// only part of their content loaded into RAM, so DMA only the requested region.
|
||||||
|
if (entry->vromEnd < (vrom + size)) {
|
||||||
|
// Error, vrom + size ends up in a different file than it started in
|
||||||
Fault_AddHungupAndCrash("../z_std_dma.c", 499);
|
Fault_AddHungupAndCrash("../z_std_dma.c", 499);
|
||||||
}
|
}
|
||||||
DmaMgr_DmaRomToRam((dmaEntry->romStart + vrom) - dmaEntry->vromStart, (u8*)ram, size);
|
DmaMgr_DmaRomToRam((entry->romStart + vrom) - entry->vromStart, ram, size);
|
||||||
return;
|
} else {
|
||||||
|
// File is compressed. Files that are stored compressed must be loaded into RAM all at once.
|
||||||
|
|
||||||
|
romSize = entry->romEnd - entry->romStart;
|
||||||
|
romStart = entry->romStart;
|
||||||
|
|
||||||
|
if (vrom != entry->vromStart) {
|
||||||
|
// Error, requested vrom is not the start of a file
|
||||||
|
Fault_AddHungupAndCrash("../z_std_dma.c", 518);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (size != (entry->vromEnd - entry->vromStart)) {
|
||||||
|
// Error, only part of the file was requested
|
||||||
|
Fault_AddHungupAndCrash("../z_std_dma.c", 525);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reduce the thread priority and decompress the file, the decompression routine handles the DMA
|
||||||
|
// in chunks. Restores the thread priority when done.
|
||||||
|
osSetThreadPri(NULL, Z_PRIORITY_DMAMGR_LOW);
|
||||||
|
Yaz0_Decompress(romStart, ram, romSize);
|
||||||
|
osSetThreadPri(NULL, Z_PRIORITY_DMAMGR);
|
||||||
}
|
}
|
||||||
|
|
||||||
romSize = dmaEntry->romEnd - dmaEntry->romStart;
|
|
||||||
romStart = dmaEntry->romStart;
|
|
||||||
|
|
||||||
if (vrom != dmaEntry->vromStart) {
|
|
||||||
Fault_AddHungupAndCrash("../z_std_dma.c", 518);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (size != (dmaEntry->vromEnd - dmaEntry->vromStart)) {
|
|
||||||
Fault_AddHungupAndCrash("../z_std_dma.c", 525);
|
|
||||||
}
|
|
||||||
|
|
||||||
osSetThreadPri(NULL, 10);
|
|
||||||
Yaz0_Decompress(romStart, ram, romSize);
|
|
||||||
osSetThreadPri(NULL, 17);
|
|
||||||
} else {
|
} else {
|
||||||
|
// Error, invalid index
|
||||||
Fault_AddHungupAndCrash("../z_std_dma.c", 558);
|
Fault_AddHungupAndCrash("../z_std_dma.c", 558);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DmaMgr_ThreadEntry(void* a0) {
|
void DmaMgr_ThreadEntry(void* arg) {
|
||||||
OSMesg msg;
|
OSMesg msg;
|
||||||
DmaRequest* req;
|
DmaRequest* req;
|
||||||
|
|
||||||
while (1) {
|
while (true) {
|
||||||
|
// Wait for DMA Requests to arrive from other threads
|
||||||
osRecvMesg(&sDmaMgrMsgQueue, &msg, OS_MESG_BLOCK);
|
osRecvMesg(&sDmaMgrMsgQueue, &msg, OS_MESG_BLOCK);
|
||||||
|
|
||||||
if (msg == NULL) {
|
if (msg == NULL) {
|
||||||
|
@ -172,32 +216,56 @@ void DmaMgr_ThreadEntry(void* a0) {
|
||||||
|
|
||||||
req = (DmaRequest*)msg;
|
req = (DmaRequest*)msg;
|
||||||
|
|
||||||
DmaMgr_ProcessMsg(req);
|
DmaMgr_ProcessRequest(req);
|
||||||
if (req->notifyQueue) {
|
|
||||||
|
// Notify the sender that the request has been processed
|
||||||
|
if (req->notifyQueue != NULL) {
|
||||||
osSendMesg(req->notifyQueue, req->notifyMsg, OS_MESG_NOBLOCK);
|
osSendMesg(req->notifyQueue, req->notifyMsg, OS_MESG_NOBLOCK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 DmaMgr_SendRequestImpl(DmaRequest* request, void* vramStart, uintptr_t vromStart, size_t size, UNK_TYPE4 unused,
|
/**
|
||||||
OSMesgQueue* queue, OSMesg msg) {
|
* Submit an asynchronous DMA request. Unlike other DMA requests, this will not block the
|
||||||
|
* current thread. Data arrival is not immediate however, ensure that the request has completed by awaiting a message
|
||||||
|
* sent to `queue` when the DMA operation has completed.
|
||||||
|
*
|
||||||
|
* @param req DMA request, filled out internally.
|
||||||
|
* @param ram Location in DRAM for data to be written.
|
||||||
|
* @param vrom Virtual ROM location for data to be read.
|
||||||
|
* @param size Transfer size.
|
||||||
|
* @param queue Message queue to notify with `msg` once the transfer is complete.
|
||||||
|
* @param msg Message to send to `queue` once the transfer is complete.
|
||||||
|
* @return -2 if Irq is in NMI reset state, 0 otherwise
|
||||||
|
*/
|
||||||
|
s32 DmaMgr_RequestAsync(DmaRequest* req, void* ram, uintptr_t vrom, size_t size, UNK_TYPE4 unused, OSMesgQueue* queue,
|
||||||
|
OSMesg msg) {
|
||||||
if (gIrqMgrResetStatus >= 2) {
|
if (gIrqMgrResetStatus >= 2) {
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
request->vromAddr = vromStart;
|
req->vromAddr = vrom;
|
||||||
request->dramAddr = vramStart;
|
req->dramAddr = ram;
|
||||||
request->size = size;
|
req->size = size;
|
||||||
request->unk14 = 0;
|
req->unk14 = 0;
|
||||||
request->notifyQueue = queue;
|
req->notifyQueue = queue;
|
||||||
request->notifyMsg = msg;
|
req->notifyMsg = msg;
|
||||||
|
|
||||||
osSendMesg(&sDmaMgrMsgQueue, request, OS_MESG_BLOCK);
|
osSendMesg(&sDmaMgrMsgQueue, (OSMesg)req, OS_MESG_BLOCK);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 DmaMgr_SendRequest0(void* vramStart, uintptr_t vromStart, size_t size) {
|
/**
|
||||||
|
* Submit a synchronous DMA request. This will block the current thread until the requested transfer is complete. Data
|
||||||
|
* is immediately available as soon as this function returns.
|
||||||
|
*
|
||||||
|
* @param ram Location in DRAM for data to be written.
|
||||||
|
* @param vrom Virtual ROM location for data to be read.
|
||||||
|
* @param size Transfer size.
|
||||||
|
* @return 0
|
||||||
|
*/
|
||||||
|
s32 DmaMgr_RequestSync(void* ram, uintptr_t vrom, size_t size) {
|
||||||
DmaRequest req;
|
DmaRequest req;
|
||||||
OSMesgQueue queue;
|
OSMesgQueue queue;
|
||||||
OSMesg msg[1];
|
OSMesg msg[1];
|
||||||
|
@ -205,33 +273,32 @@ s32 DmaMgr_SendRequest0(void* vramStart, uintptr_t vromStart, size_t size) {
|
||||||
|
|
||||||
osCreateMesgQueue(&queue, msg, ARRAY_COUNT(msg));
|
osCreateMesgQueue(&queue, msg, ARRAY_COUNT(msg));
|
||||||
|
|
||||||
ret = DmaMgr_SendRequestImpl(&req, vramStart, vromStart, size, 0, &queue, NULL);
|
ret = DmaMgr_RequestAsync(&req, ram, vrom, size, 0, &queue, NULL);
|
||||||
|
if (ret == -1) { // DmaMgr_RequestAsync does not return -1
|
||||||
if (ret == -1) {
|
|
||||||
return ret;
|
return ret;
|
||||||
} else {
|
|
||||||
osRecvMesg(&queue, NULL, OS_MESG_BLOCK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
osRecvMesg(&queue, NULL, OS_MESG_BLOCK);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DmaMgr_Start(void) {
|
void DmaMgr_Init(void) {
|
||||||
DmaMgr_DmaRomToRam(SEGMENT_ROM_START(dmadata), dmadata, SEGMENT_ROM_SIZE(dmadata));
|
DmaMgr_DmaRomToRam(SEGMENT_ROM_START(dmadata), gDmaDataTable, SEGMENT_ROM_SIZE(dmadata));
|
||||||
|
|
||||||
{
|
{
|
||||||
DmaEntry* iter = dmadata;
|
DmaEntry* entry = gDmaDataTable;
|
||||||
u32 idx = 0;
|
s32 index = 0;
|
||||||
|
|
||||||
while (iter->vromEnd != 0) {
|
while (entry->vromEnd != 0) {
|
||||||
iter++;
|
entry++;
|
||||||
idx++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
sNumDmaEntries = idx;
|
sNumDmaEntries = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
osCreateMesgQueue(&sDmaMgrMsgQueue, sDmaMgrMsgs, ARRAY_COUNT(sDmaMgrMsgs));
|
osCreateMesgQueue(&sDmaMgrMsgQueue, sDmaMgrMsgBuf, ARRAY_COUNT(sDmaMgrMsgBuf));
|
||||||
StackCheck_Init(&sDmaMgrStackInfo, sDmaMgrStack, STACK_TOP(sDmaMgrStack), 0, 0x100, "dmamgr");
|
StackCheck_Init(&sDmaMgrStackInfo, sDmaMgrStack, STACK_TOP(sDmaMgrStack), 0, 0x100, "dmamgr");
|
||||||
osCreateThread(&sDmaMgrThread, Z_THREAD_ID_DMAMGR, DmaMgr_ThreadEntry, NULL, STACK_TOP(sDmaMgrStack),
|
osCreateThread(&sDmaMgrThread, Z_THREAD_ID_DMAMGR, DmaMgr_ThreadEntry, NULL, STACK_TOP(sDmaMgrStack),
|
||||||
Z_PRIORITY_DMAMGR);
|
Z_PRIORITY_DMAMGR);
|
||||||
|
|
|
@ -80,7 +80,7 @@ void AudioMgr_ThreadEntry(void* arg) {
|
||||||
s32 exit;
|
s32 exit;
|
||||||
|
|
||||||
Audio_Init();
|
Audio_Init();
|
||||||
AudioLoad_SetDmaHandler(DmaMgr_DmaHandler);
|
AudioLoad_SetDmaHandler(DmaMgr_AudioDmaHandler);
|
||||||
Audio_InitSound();
|
Audio_InitSound();
|
||||||
osSendMesg(&audioMgr->lockQueue, NULL, OS_MESG_BLOCK);
|
osSendMesg(&audioMgr->lockQueue, NULL, OS_MESG_BLOCK);
|
||||||
IrqMgr_AddClient(audioMgr->irqMgr, &irqClient, &audioMgr->interruptQueue);
|
IrqMgr_AddClient(audioMgr->irqMgr, &irqClient, &audioMgr->interruptQueue);
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#include "prevent_bss_reordering.h"
|
|
||||||
#include "z64.h"
|
#include "z64.h"
|
||||||
#include "regs.h"
|
#include "regs.h"
|
||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "libc64/malloc.h"
|
#include "libc64/malloc.h"
|
||||||
|
|
||||||
|
#include "yaz0.h"
|
||||||
|
#include "z64dma.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x0 */ union {
|
/* 0x0 */ union {
|
||||||
u32 dmaWord[2];
|
u32 dmaWord[2];
|
||||||
|
|
|
@ -71,7 +71,7 @@ void Check_ClearRGBA16(u16* buffer) {
|
||||||
* Draw error message textures directly to a screen buffer at the end of normal RDRAM
|
* Draw error message textures directly to a screen buffer at the end of normal RDRAM
|
||||||
*/
|
*/
|
||||||
void Check_DrawExpansionPakErrorMessage(void) {
|
void Check_DrawExpansionPakErrorMessage(void) {
|
||||||
DmaMgr_SendRequest0(CHECK_ERRMSG_STATIC_SEGMENT, SEGMENT_ROM_START(memerrmsg), SEGMENT_SIZE(memerrmsg));
|
DmaMgr_RequestSync(CHECK_ERRMSG_STATIC_SEGMENT, SEGMENT_ROM_START(memerrmsg), SEGMENT_SIZE(memerrmsg));
|
||||||
Check_ClearRGBA16((u16*)FAULT_FB_ADDRESS);
|
Check_ClearRGBA16((u16*)FAULT_FB_ADDRESS);
|
||||||
Check_DrawI4Texture((u16*)FAULT_FB_ADDRESS, 96, 71, MEMERRMSG_WIDTH, MEMERRMSG_HEIGHT, CHECK_ERRMSG_STATIC_SEGMENT);
|
Check_DrawI4Texture((u16*)FAULT_FB_ADDRESS, 96, 71, MEMERRMSG_WIDTH, MEMERRMSG_HEIGHT, CHECK_ERRMSG_STATIC_SEGMENT);
|
||||||
Check_DrawI4Texture((u16*)FAULT_FB_ADDRESS, 96, 127, MEMERRMSG_WIDTH, MEMERRMSG_HEIGHT,
|
Check_DrawI4Texture((u16*)FAULT_FB_ADDRESS, 96, 127, MEMERRMSG_WIDTH, MEMERRMSG_HEIGHT,
|
||||||
|
@ -85,7 +85,7 @@ void Check_DrawExpansionPakErrorMessage(void) {
|
||||||
* Draw error message texture directly to a screen buffer at the end of normal RDRAM
|
* Draw error message texture directly to a screen buffer at the end of normal RDRAM
|
||||||
*/
|
*/
|
||||||
void Check_DrawRegionLockErrorMessage(void) {
|
void Check_DrawRegionLockErrorMessage(void) {
|
||||||
DmaMgr_SendRequest0(CHECK_ERRMSG_STATIC_SEGMENT, SEGMENT_ROM_START(locerrmsg), SEGMENT_SIZE(locerrmsg));
|
DmaMgr_RequestSync(CHECK_ERRMSG_STATIC_SEGMENT, SEGMENT_ROM_START(locerrmsg), SEGMENT_SIZE(locerrmsg));
|
||||||
Check_ClearRGBA16((u16*)FAULT_FB_ADDRESS);
|
Check_ClearRGBA16((u16*)FAULT_FB_ADDRESS);
|
||||||
Check_DrawI4Texture((u16*)FAULT_FB_ADDRESS, 56, 112, LOCERRMSG_WIDTH, LOCERRMSG_HEIGHT,
|
Check_DrawI4Texture((u16*)FAULT_FB_ADDRESS, 56, 112, LOCERRMSG_WIDTH, LOCERRMSG_HEIGHT,
|
||||||
CHECK_ERRMSG_STATIC_SEGMENT);
|
CHECK_ERRMSG_STATIC_SEGMENT);
|
||||||
|
|
|
@ -8,15 +8,14 @@ void Font_LoadCharNES(PlayState* play, u8 codePointIndex, s32 offset) {
|
||||||
MessageContext* msgCtx = &play->msgCtx;
|
MessageContext* msgCtx = &play->msgCtx;
|
||||||
Font* font = &msgCtx->font;
|
Font* font = &msgCtx->font;
|
||||||
|
|
||||||
DmaMgr_SendRequest0(&font->charBuf[font->unk_11D88][offset],
|
DmaMgr_RequestSync(&font->charBuf[font->unk_11D88][offset],
|
||||||
SEGMENT_ROM_START_OFFSET(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_RequestSync(&font->iconBuf, SEGMENT_ROM_START_OFFSET(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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 sFontOrdering[] = {
|
static u8 sFontOrdering[] = {
|
||||||
|
@ -39,7 +38,7 @@ void Font_LoadOrderedFont(Font* font) {
|
||||||
loadOffset = 0;
|
loadOffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DmaMgr_SendRequest0(writeLocation, SEGMENT_ROM_START(nes_font_static) + loadOffset, FONT_CHAR_TEX_SIZE);
|
DmaMgr_RequestSync(writeLocation, SEGMENT_ROM_START(nes_font_static) + loadOffset, FONT_CHAR_TEX_SIZE);
|
||||||
if (sFontOrdering[codePointIndex] == 0x8C) {
|
if (sFontOrdering[codePointIndex] == 0x8C) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1084,8 +1084,8 @@ void Environment_UpdateSkybox(u8 skyboxId, EnvironmentContext* envCtx, SkyboxCon
|
||||||
envCtx->skyboxDmaState = SKYBOX_DMA_TEXTURE1_START;
|
envCtx->skyboxDmaState = SKYBOX_DMA_TEXTURE1_START;
|
||||||
size = sNormalSkyFiles[skybox1Index].file.vromEnd - sNormalSkyFiles[skybox1Index].file.vromStart;
|
size = sNormalSkyFiles[skybox1Index].file.vromEnd - sNormalSkyFiles[skybox1Index].file.vromStart;
|
||||||
osCreateMesgQueue(&envCtx->loadQueue, envCtx->loadMsg, ARRAY_COUNT(envCtx->loadMsg));
|
osCreateMesgQueue(&envCtx->loadQueue, envCtx->loadMsg, ARRAY_COUNT(envCtx->loadMsg));
|
||||||
DmaMgr_SendRequestImpl(&envCtx->dmaRequest, skyboxCtx->staticSegments[0],
|
DmaMgr_RequestAsync(&envCtx->dmaRequest, skyboxCtx->staticSegments[0],
|
||||||
sNormalSkyFiles[skybox1Index].file.vromStart, size, 0, &envCtx->loadQueue, NULL);
|
sNormalSkyFiles[skybox1Index].file.vromStart, size, 0, &envCtx->loadQueue, NULL);
|
||||||
envCtx->skybox1Index = skybox1Index;
|
envCtx->skybox1Index = skybox1Index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1093,8 +1093,8 @@ void Environment_UpdateSkybox(u8 skyboxId, EnvironmentContext* envCtx, SkyboxCon
|
||||||
envCtx->skyboxDmaState = SKYBOX_DMA_TEXTURE2_START;
|
envCtx->skyboxDmaState = SKYBOX_DMA_TEXTURE2_START;
|
||||||
size = sNormalSkyFiles[skybox2Index].file.vromEnd - sNormalSkyFiles[skybox2Index].file.vromStart;
|
size = sNormalSkyFiles[skybox2Index].file.vromEnd - sNormalSkyFiles[skybox2Index].file.vromStart;
|
||||||
osCreateMesgQueue(&envCtx->loadQueue, envCtx->loadMsg, ARRAY_COUNT(envCtx->loadMsg));
|
osCreateMesgQueue(&envCtx->loadQueue, envCtx->loadMsg, ARRAY_COUNT(envCtx->loadMsg));
|
||||||
DmaMgr_SendRequestImpl(&envCtx->dmaRequest, skyboxCtx->staticSegments[1],
|
DmaMgr_RequestAsync(&envCtx->dmaRequest, skyboxCtx->staticSegments[1],
|
||||||
sNormalSkyFiles[skybox2Index].file.vromStart, size, 0, &envCtx->loadQueue, NULL);
|
sNormalSkyFiles[skybox2Index].file.vromStart, size, 0, &envCtx->loadQueue, NULL);
|
||||||
envCtx->skybox2Index = skybox2Index;
|
envCtx->skybox2Index = skybox2Index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2270,9 +2270,9 @@ void Message_Decode(PlayState* play) {
|
||||||
decodedBufPos += playerNameLen - 1;
|
decodedBufPos += playerNameLen - 1;
|
||||||
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_RequestSync(msgCtx->textboxSegment + 0x1000, SEGMENT_ROM_START(message_texture_static), 0x900);
|
||||||
DmaMgr_SendRequest0(msgCtx->textboxSegment + 0x1900, SEGMENT_ROM_START(message_texture_static) + 0x900,
|
DmaMgr_RequestSync(msgCtx->textboxSegment + 0x1900, SEGMENT_ROM_START(message_texture_static) + 0x900,
|
||||||
0x900);
|
0x900);
|
||||||
numLines = 2;
|
numLines = 2;
|
||||||
spD2 = 2;
|
spD2 = 2;
|
||||||
msgCtx->unk12012 = msgCtx->textboxY + 8;
|
msgCtx->unk12012 = msgCtx->textboxY + 8;
|
||||||
|
@ -3038,8 +3038,8 @@ void func_80150A84(PlayState* play) {
|
||||||
s32 textBoxType = msgCtx->textBoxType;
|
s32 textBoxType = msgCtx->textBoxType;
|
||||||
|
|
||||||
if (D_801CFC78[textBoxType] != 14) {
|
if (D_801CFC78[textBoxType] != 14) {
|
||||||
DmaMgr_SendRequest0(msgCtx->textboxSegment,
|
DmaMgr_RequestSync(msgCtx->textboxSegment, SEGMENT_ROM_START(message_static) + D_801CFC78[textBoxType] * 0x1000,
|
||||||
SEGMENT_ROM_START(message_static) + D_801CFC78[textBoxType] * 0x1000, 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) ||
|
||||||
|
@ -3166,18 +3166,18 @@ 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_RequestSync(&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_RequestSync(&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_RequestSync(&font->msgBuf, SEGMENT_ROM_START(message_data_static) + font->messageStart,
|
||||||
font->messageEnd);
|
font->messageEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
msgCtx->choiceNum = 0;
|
msgCtx->choiceNum = 0;
|
||||||
|
@ -3265,13 +3265,13 @@ 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_RequestSync(&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_RequestSync(&font->msgBuf, SEGMENT_ROM_START(message_data_static) + font->messageStart,
|
||||||
font->messageEnd);
|
font->messageEnd);
|
||||||
}
|
}
|
||||||
msgCtx->choiceNum = 0;
|
msgCtx->choiceNum = 0;
|
||||||
msgCtx->textUnskippable = false;
|
msgCtx->textUnskippable = false;
|
||||||
|
@ -3285,7 +3285,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_RequestSync(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;
|
||||||
|
|
|
@ -1084,9 +1084,9 @@ void Message_DecodeNES(PlayState* play) {
|
||||||
}
|
}
|
||||||
decodedBufPos--;
|
decodedBufPos--;
|
||||||
} else if (curChar == 0xC1) {
|
} else if (curChar == 0xC1) {
|
||||||
DmaMgr_SendRequest0(msgCtx->textboxSegment + 0x1000, SEGMENT_ROM_START(message_texture_static), 0x900);
|
DmaMgr_RequestSync(msgCtx->textboxSegment + 0x1000, SEGMENT_ROM_START(message_texture_static), 0x900);
|
||||||
DmaMgr_SendRequest0(msgCtx->textboxSegment + 0x1900, SEGMENT_ROM_START(message_texture_static) + 0x900,
|
DmaMgr_RequestSync(msgCtx->textboxSegment + 0x1900, SEGMENT_ROM_START(message_texture_static) + 0x900,
|
||||||
0x900);
|
0x900);
|
||||||
numLines = 2;
|
numLines = 2;
|
||||||
spC6 = 2;
|
spC6 = 2;
|
||||||
msgCtx->unk12012 = msgCtx->textboxY + 8;
|
msgCtx->unk12012 = msgCtx->textboxY + 8;
|
||||||
|
|
|
@ -627,10 +627,10 @@ void Message_DecodeCredits(PlayState* play) {
|
||||||
msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[msgCtx->msgBufPos + 1];
|
msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[msgCtx->msgBufPos + 1];
|
||||||
Message_LoadItemIcon(play, font->msgBuf.schar[msgCtx->msgBufPos + 1], msgCtx->textboxY + 10);
|
Message_LoadItemIcon(play, font->msgBuf.schar[msgCtx->msgBufPos + 1], msgCtx->textboxY + 10);
|
||||||
} else if (curChar == 0x15) {
|
} else if (curChar == 0x15) {
|
||||||
DmaMgr_SendRequest0(msgCtx->textboxSegment + 0x1000,
|
DmaMgr_RequestSync(msgCtx->textboxSegment + 0x1000,
|
||||||
(uintptr_t)SEGMENT_ROM_START(message_texture_static) + 0x900, 0x900);
|
(uintptr_t)SEGMENT_ROM_START(message_texture_static) + 0x900, 0x900);
|
||||||
DmaMgr_SendRequest0(msgCtx->textboxSegment + 0x1900,
|
DmaMgr_RequestSync(msgCtx->textboxSegment + 0x1900,
|
||||||
(uintptr_t)SEGMENT_ROM_START(message_texture_static) + 0x900, 0x900);
|
(uintptr_t)SEGMENT_ROM_START(message_texture_static) + 0x900, 0x900);
|
||||||
msgCtx->msgBufPos += 3;
|
msgCtx->msgBufPos += 3;
|
||||||
msgCtx->unk12012 = msgCtx->textboxY + 8;
|
msgCtx->unk12012 = msgCtx->textboxY + 8;
|
||||||
numLines = 2;
|
numLines = 2;
|
||||||
|
|
|
@ -919,8 +919,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((void*)(play->interfaceCtx.doActionSegment + 0x780),
|
DmaMgr_RequestSync((void*)(play->interfaceCtx.doActionSegment + 0x780),
|
||||||
SEGMENT_ROM_START_OFFSET(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++) {
|
||||||
|
@ -6586,8 +6586,8 @@ void Interface_LoadStory(PlayState* play, s32 osMesgFlag) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
osCreateMesgQueue(&interfaceCtx->storyMsgQueue, &interfaceCtx->storyMsgBuf, 1);
|
osCreateMesgQueue(&interfaceCtx->storyMsgQueue, &interfaceCtx->storyMsgBuf, 1);
|
||||||
DmaMgr_SendRequestImpl(&interfaceCtx->dmaRequest, interfaceCtx->storySegment, interfaceCtx->storyAddr,
|
DmaMgr_RequestAsync(&interfaceCtx->dmaRequest, interfaceCtx->storySegment, interfaceCtx->storyAddr,
|
||||||
interfaceCtx->storySize, 0, &interfaceCtx->storyMsgQueue, NULL);
|
interfaceCtx->storySize, 0, &interfaceCtx->storyMsgQueue, NULL);
|
||||||
interfaceCtx->storyDmaStatus = STORY_DMA_LOADING;
|
interfaceCtx->storyDmaStatus = STORY_DMA_LOADING;
|
||||||
// fallthrough
|
// fallthrough
|
||||||
case STORY_DMA_LOADING:
|
case STORY_DMA_LOADING:
|
||||||
|
@ -7121,12 +7121,11 @@ void Interface_Init(PlayState* play) {
|
||||||
|
|
||||||
parameterStaticSize = SEGMENT_ROM_SIZE(parameter_static);
|
parameterStaticSize = SEGMENT_ROM_SIZE(parameter_static);
|
||||||
interfaceCtx->parameterSegment = THA_AllocTailAlign16(&play->state.tha, parameterStaticSize);
|
interfaceCtx->parameterSegment = THA_AllocTailAlign16(&play->state.tha, parameterStaticSize);
|
||||||
DmaMgr_SendRequest0(interfaceCtx->parameterSegment, SEGMENT_ROM_START(parameter_static), parameterStaticSize);
|
DmaMgr_RequestSync(interfaceCtx->parameterSegment, SEGMENT_ROM_START(parameter_static), parameterStaticSize);
|
||||||
|
|
||||||
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_RequestSync(interfaceCtx->doActionSegment, SEGMENT_ROM_START(do_action_static), 0x300);
|
||||||
DmaMgr_SendRequest0(interfaceCtx->doActionSegment + 0x300, SEGMENT_ROM_START_OFFSET(do_action_static, 0x480),
|
DmaMgr_RequestSync(interfaceCtx->doActionSegment + 0x300, SEGMENT_ROM_START_OFFSET(do_action_static, 0x480), 0x180);
|
||||||
0x180);
|
|
||||||
|
|
||||||
Interface_NewDay(play, CURRENT_DAY);
|
Interface_NewDay(play, CURRENT_DAY);
|
||||||
|
|
||||||
|
|
|
@ -1554,7 +1554,7 @@ void* Play_LoadFile(PlayState* this, RomFile* entry) {
|
||||||
size_t size = entry->vromEnd - entry->vromStart;
|
size_t size = entry->vromEnd - entry->vromStart;
|
||||||
void* allocp = THA_AllocTailAlign16(&this->state.tha, size);
|
void* allocp = THA_AllocTailAlign16(&this->state.tha, size);
|
||||||
|
|
||||||
DmaMgr_SendRequest0(allocp, entry->vromStart, size);
|
DmaMgr_RequestSync(allocp, entry->vromStart, size);
|
||||||
|
|
||||||
return allocp;
|
return allocp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1106,8 +1106,8 @@ void BombersNotebook_LoadFiles(BombersNotebook* this, s32 flag) {
|
||||||
}
|
}
|
||||||
CmpDma_LoadAllFiles(this->scheduleDmaSegmentStart, this->scheduleDmaSegment, this->scheduleDmaSegmentSize);
|
CmpDma_LoadAllFiles(this->scheduleDmaSegmentStart, this->scheduleDmaSegment, this->scheduleDmaSegmentSize);
|
||||||
osCreateMesgQueue(&this->loadQueue, this->loadMsg, ARRAY_COUNT(this->loadMsg));
|
osCreateMesgQueue(&this->loadQueue, this->loadMsg, ARRAY_COUNT(this->loadMsg));
|
||||||
DmaMgr_SendRequestImpl(&this->dmaRequest, this->scheduleSegment, this->scheduleSegmentStart,
|
DmaMgr_RequestAsync(&this->dmaRequest, this->scheduleSegment, this->scheduleSegmentStart,
|
||||||
this->scheduleSegmentSize, 0, &this->loadQueue, NULL);
|
this->scheduleSegmentSize, 0, &this->loadQueue, NULL);
|
||||||
this->loadState = BOMBERS_NOTEBOOK_LOAD_STATE_STARTED;
|
this->loadState = BOMBERS_NOTEBOOK_LOAD_STATE_STARTED;
|
||||||
// fallthrough
|
// fallthrough
|
||||||
case BOMBERS_NOTEBOOK_LOAD_STATE_STARTED:
|
case BOMBERS_NOTEBOOK_LOAD_STATE_STARTED:
|
||||||
|
|
|
@ -200,9 +200,9 @@ void func_801229FC(Player* player) {
|
||||||
s16 objectId = sMaskObjectIds[(u8)player->maskId - 1];
|
s16 objectId = sMaskObjectIds[(u8)player->maskId - 1];
|
||||||
|
|
||||||
osCreateMesgQueue(&player->maskObjectLoadQueue, &player->maskObjectLoadMsg, 1);
|
osCreateMesgQueue(&player->maskObjectLoadQueue, &player->maskObjectLoadMsg, 1);
|
||||||
DmaMgr_SendRequestImpl(&player->maskDmaRequest, player->maskObjectSegment, gObjectTable[objectId].vromStart,
|
DmaMgr_RequestAsync(&player->maskDmaRequest, player->maskObjectSegment, gObjectTable[objectId].vromStart,
|
||||||
gObjectTable[objectId].vromEnd - gObjectTable[objectId].vromStart, 0,
|
gObjectTable[objectId].vromEnd - gObjectTable[objectId].vromStart, 0,
|
||||||
&player->maskObjectLoadQueue, NULL);
|
&player->maskObjectLoadQueue, NULL);
|
||||||
player->maskObjectLoadState++;
|
player->maskObjectLoadState++;
|
||||||
} else if (player->maskObjectLoadState == 2) {
|
} else if (player->maskObjectLoadState == 2) {
|
||||||
if (osRecvMesg(&player->maskObjectLoadQueue, NULL, OS_MESG_NOBLOCK) == 0) {
|
if (osRecvMesg(&player->maskObjectLoadQueue, NULL, OS_MESG_NOBLOCK) == 0) {
|
||||||
|
|
|
@ -560,8 +560,8 @@ s32 Room_StartRoomTransition(PlayState* play, RoomContext* roomCtx, s32 index) {
|
||||||
(size + 8) * roomCtx->activeMemPage - 7));
|
(size + 8) * roomCtx->activeMemPage - 7));
|
||||||
|
|
||||||
osCreateMesgQueue(&roomCtx->loadQueue, roomCtx->loadMsg, ARRAY_COUNT(roomCtx->loadMsg));
|
osCreateMesgQueue(&roomCtx->loadQueue, roomCtx->loadMsg, ARRAY_COUNT(roomCtx->loadMsg));
|
||||||
DmaMgr_SendRequestImpl(&roomCtx->dmaRequest, roomCtx->activeRoomVram, play->roomList[index].vromStart, size, 0,
|
DmaMgr_RequestAsync(&roomCtx->dmaRequest, roomCtx->activeRoomVram, play->roomList[index].vromStart, size, 0,
|
||||||
&roomCtx->loadQueue, NULL);
|
&roomCtx->loadQueue, NULL);
|
||||||
roomCtx->activeMemPage ^= 1;
|
roomCtx->activeMemPage ^= 1;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -22,7 +22,7 @@ s32 Object_SpawnPersistent(ObjectContext* objectCtx, s16 id) {
|
||||||
if (1) {}
|
if (1) {}
|
||||||
|
|
||||||
if (size != 0) {
|
if (size != 0) {
|
||||||
DmaMgr_SendRequest0(objectCtx->slots[objectCtx->numEntries].segment, gObjectTable[id].vromStart, size);
|
DmaMgr_RequestSync(objectCtx->slots[objectCtx->numEntries].segment, gObjectTable[id].vromStart, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (objectCtx->numEntries < ARRAY_COUNT(objectCtx->slots) - 1) {
|
if (objectCtx->numEntries < ARRAY_COUNT(objectCtx->slots) - 1) {
|
||||||
|
@ -87,8 +87,8 @@ void Object_UpdateEntries(ObjectContext* objectCtx) {
|
||||||
entry->id = 0;
|
entry->id = 0;
|
||||||
} else {
|
} else {
|
||||||
osCreateMesgQueue(&entry->loadQueue, &entry->loadMsg, 1);
|
osCreateMesgQueue(&entry->loadQueue, &entry->loadMsg, 1);
|
||||||
DmaMgr_SendRequestImpl(&entry->dmaReq, entry->segment, objectFile->vromStart, size, 0,
|
DmaMgr_RequestAsync(&entry->dmaReq, entry->segment, objectFile->vromStart, size, 0,
|
||||||
&entry->loadQueue, NULL);
|
&entry->loadQueue, NULL);
|
||||||
}
|
}
|
||||||
} else if (!osRecvMesg(&entry->loadQueue, NULL, OS_MESG_NOBLOCK)) {
|
} else if (!osRecvMesg(&entry->loadQueue, NULL, OS_MESG_NOBLOCK)) {
|
||||||
entry->id = id;
|
entry->id = id;
|
||||||
|
@ -132,7 +132,7 @@ void Object_LoadAll(ObjectContext* objectCtx) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
DmaMgr_SendRequest0(objectCtx->slots[i].segment, gObjectTable[id].vromStart, vromSize);
|
DmaMgr_RequestSync(objectCtx->slots[i].segment, gObjectTable[id].vromStart, vromSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ void Scene_LoadAreaTextures(PlayState* play, s32 fileIndex) {
|
||||||
|
|
||||||
if (size != 0) {
|
if (size != 0) {
|
||||||
play->roomCtx.unk74 = THA_AllocTailAlign16(&play->state.tha, size);
|
play->roomCtx.unk74 = THA_AllocTailAlign16(&play->state.tha, size);
|
||||||
DmaMgr_SendRequest0(play->roomCtx.unk74, vromStart, size);
|
DmaMgr_RequestSync(play->roomCtx.unk74, vromStart, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1011,7 +1011,7 @@ void AnimationContext_SetLoadFrame(PlayState* play, PlayerAnimationHeader* anima
|
||||||
s32 pad;
|
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_RequestAsync(
|
||||||
&entry->data.load.req, frameTable,
|
&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);
|
||||||
|
|
|
@ -197,19 +197,19 @@ void Skybox_Setup(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyboxId)
|
||||||
skyboxCtx->staticSegments[0] = gLoBuffer.skyboxBuffer;
|
skyboxCtx->staticSegments[0] = gLoBuffer.skyboxBuffer;
|
||||||
size = SEGMENT_ROM_SIZE(d2_cloud_static);
|
size = SEGMENT_ROM_SIZE(d2_cloud_static);
|
||||||
segment = (void*)ALIGN8((uintptr_t)skyboxCtx->staticSegments[0] + size);
|
segment = (void*)ALIGN8((uintptr_t)skyboxCtx->staticSegments[0] + size);
|
||||||
DmaMgr_SendRequest0(skyboxCtx->staticSegments[0], SEGMENT_ROM_START(d2_cloud_static), size);
|
DmaMgr_RequestSync(skyboxCtx->staticSegments[0], SEGMENT_ROM_START(d2_cloud_static), size);
|
||||||
|
|
||||||
// Send a DMA request for the clear sky texture
|
// Send a DMA request for the clear sky texture
|
||||||
skyboxCtx->staticSegments[1] = segment;
|
skyboxCtx->staticSegments[1] = segment;
|
||||||
size = SEGMENT_ROM_SIZE(d2_fine_static);
|
size = SEGMENT_ROM_SIZE(d2_fine_static);
|
||||||
segment = (void*)ALIGN8((uintptr_t)segment + size);
|
segment = (void*)ALIGN8((uintptr_t)segment + size);
|
||||||
DmaMgr_SendRequest0(skyboxCtx->staticSegments[1], SEGMENT_ROM_START(d2_fine_static), size);
|
DmaMgr_RequestSync(skyboxCtx->staticSegments[1], SEGMENT_ROM_START(d2_fine_static), size);
|
||||||
|
|
||||||
// Send a DMA request for the skybox palette
|
// Send a DMA request for the skybox palette
|
||||||
skyboxCtx->paletteStaticSegment = segment;
|
skyboxCtx->paletteStaticSegment = segment;
|
||||||
size = SEGMENT_ROM_SIZE(d2_fine_pal_static);
|
size = SEGMENT_ROM_SIZE(d2_fine_pal_static);
|
||||||
segment = (void*)ALIGN8((uintptr_t)segment + size);
|
segment = (void*)ALIGN8((uintptr_t)segment + size);
|
||||||
DmaMgr_SendRequest0(skyboxCtx->paletteStaticSegment, SEGMENT_ROM_START(d2_fine_pal_static), size);
|
DmaMgr_RequestSync(skyboxCtx->paletteStaticSegment, SEGMENT_ROM_START(d2_fine_pal_static), size);
|
||||||
|
|
||||||
skyboxCtx->prim.r = 145;
|
skyboxCtx->prim.r = 145;
|
||||||
skyboxCtx->prim.g = 120;
|
skyboxCtx->prim.g = 120;
|
||||||
|
@ -244,14 +244,14 @@ void func_80143324(PlayState* play, SkyboxContext* skyboxCtx, s16 skyboxId) {
|
||||||
// Send a DMA request for the clear sky texture
|
// Send a DMA request for the clear sky texture
|
||||||
size = SEGMENT_ROM_SIZE(d2_fine_static);
|
size = SEGMENT_ROM_SIZE(d2_fine_static);
|
||||||
|
|
||||||
DmaMgr_SendRequestImpl(&skyboxCtx->unk188, skyboxCtx->staticSegments[0],
|
DmaMgr_RequestAsync(&skyboxCtx->unk188, skyboxCtx->staticSegments[0], SEGMENT_ROM_START(d2_fine_static),
|
||||||
SEGMENT_ROM_START(d2_fine_static), size, 0, &skyboxCtx->loadQueue, NULL);
|
size, 0, &skyboxCtx->loadQueue, NULL);
|
||||||
} else {
|
} else {
|
||||||
// Send a DMA request for the cloudy sky texture
|
// Send a DMA request for the cloudy sky texture
|
||||||
size = SEGMENT_ROM_SIZE(d2_cloud_static);
|
size = SEGMENT_ROM_SIZE(d2_cloud_static);
|
||||||
|
|
||||||
DmaMgr_SendRequestImpl(&skyboxCtx->unk188, skyboxCtx->staticSegments[0],
|
DmaMgr_RequestAsync(&skyboxCtx->unk188, skyboxCtx->staticSegments[0],
|
||||||
SEGMENT_ROM_START(d2_cloud_static), size, 0, &skyboxCtx->loadQueue, NULL);
|
SEGMENT_ROM_START(d2_cloud_static), size, 0, &skyboxCtx->loadQueue, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
osRecvMesg(&skyboxCtx->loadQueue, NULL, OS_MESG_BLOCK);
|
osRecvMesg(&skyboxCtx->loadQueue, NULL, OS_MESG_BLOCK);
|
||||||
|
@ -261,14 +261,14 @@ void func_80143324(PlayState* play, SkyboxContext* skyboxCtx, s16 skyboxId) {
|
||||||
// Send a DMA request for the clear sky texture
|
// Send a DMA request for the clear sky texture
|
||||||
size = SEGMENT_ROM_SIZE(d2_fine_static);
|
size = SEGMENT_ROM_SIZE(d2_fine_static);
|
||||||
|
|
||||||
DmaMgr_SendRequestImpl(&skyboxCtx->unk1A8, skyboxCtx->staticSegments[1],
|
DmaMgr_RequestAsync(&skyboxCtx->unk1A8, skyboxCtx->staticSegments[1], SEGMENT_ROM_START(d2_fine_static),
|
||||||
SEGMENT_ROM_START(d2_fine_static), size, 0, &skyboxCtx->loadQueue, NULL);
|
size, 0, &skyboxCtx->loadQueue, NULL);
|
||||||
} else {
|
} else {
|
||||||
// Send a DMA request for the cloudy sky texture
|
// Send a DMA request for the cloudy sky texture
|
||||||
size = SEGMENT_ROM_SIZE(d2_cloud_static);
|
size = SEGMENT_ROM_SIZE(d2_cloud_static);
|
||||||
|
|
||||||
DmaMgr_SendRequestImpl(&skyboxCtx->unk1A8, skyboxCtx->staticSegments[1],
|
DmaMgr_RequestAsync(&skyboxCtx->unk1A8, skyboxCtx->staticSegments[1],
|
||||||
SEGMENT_ROM_START(d2_cloud_static), size, 0, &skyboxCtx->loadQueue, NULL);
|
SEGMENT_ROM_START(d2_cloud_static), size, 0, &skyboxCtx->loadQueue, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
osRecvMesg(&skyboxCtx->loadQueue, NULL, OS_MESG_BLOCK);
|
osRecvMesg(&skyboxCtx->loadQueue, NULL, OS_MESG_BLOCK);
|
||||||
|
@ -277,8 +277,8 @@ void func_80143324(PlayState* play, SkyboxContext* skyboxCtx, s16 skyboxId) {
|
||||||
size = SEGMENT_ROM_SIZE(d2_fine_pal_static);
|
size = SEGMENT_ROM_SIZE(d2_fine_pal_static);
|
||||||
|
|
||||||
// Send a DMA request for the skybox palette
|
// Send a DMA request for the skybox palette
|
||||||
DmaMgr_SendRequestImpl(&skyboxCtx->unk1C8, skyboxCtx->paletteStaticSegment,
|
DmaMgr_RequestAsync(&skyboxCtx->unk1C8, skyboxCtx->paletteStaticSegment,
|
||||||
SEGMENT_ROM_START(d2_fine_pal_static), size, 0, &skyboxCtx->loadQueue, NULL);
|
SEGMENT_ROM_START(d2_fine_pal_static), size, 0, &skyboxCtx->loadQueue, NULL);
|
||||||
|
|
||||||
osRecvMesg(&skyboxCtx->loadQueue, NULL, OS_MESG_BLOCK);
|
osRecvMesg(&skyboxCtx->loadQueue, NULL, OS_MESG_BLOCK);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
#include "segment_symbols.h"
|
||||||
|
#include "z64dma.h"
|
||||||
|
|
||||||
|
// Linker symbol declarations (used in the table below)
|
||||||
|
#define DEFINE_DMA_ENTRY(name, _nameString) DECLARE_ROM_SEGMENT(name)
|
||||||
|
#define DEFINE_DMA_ENTRY_UNSET(name, _nameString) DECLARE_ROM_SEGMENT(name)
|
||||||
|
|
||||||
|
#include "tables/dmadata_table.h"
|
||||||
|
|
||||||
|
#undef DEFINE_DMA_ENTRY
|
||||||
|
#undef DEFINE_DMA_ENTRY_UNSET
|
||||||
|
|
||||||
|
// dmadata Table definition
|
||||||
|
#define DEFINE_DMA_ENTRY(name, _nameString) \
|
||||||
|
{ SEGMENT_ROM_START(name), SEGMENT_ROM_END(name), SEGMENT_ROM_START(name), 0 },
|
||||||
|
#define DEFINE_DMA_ENTRY_UNSET(name, _nameString) \
|
||||||
|
{ SEGMENT_ROM_START(name), SEGMENT_ROM_END(name), 0xFFFFFFFF, 0xFFFFFFFF },
|
||||||
|
|
||||||
|
DmaEntry gDmaDataTable[] = {
|
||||||
|
#include "tables/dmadata_table.h"
|
||||||
|
{ 0 },
|
||||||
|
};
|
||||||
|
|
||||||
|
#undef DEFINE_DMA_ENTRY
|
||||||
|
#undef DEFINE_DMA_ENTRY_UNSET
|
||||||
|
|
||||||
|
u8 sDmaDataPadding[0xF0] = { 0 };
|
||||||
|
static s32 sBssPad;
|
|
@ -7316,9 +7316,9 @@ void func_80838830(Player* this, s16 objectId) {
|
||||||
if (objectId != OBJECT_UNSET_0) {
|
if (objectId != OBJECT_UNSET_0) {
|
||||||
this->giObjectLoading = true;
|
this->giObjectLoading = true;
|
||||||
osCreateMesgQueue(&this->giObjectLoadQueue, &this->giObjectLoadMsg, 1);
|
osCreateMesgQueue(&this->giObjectLoadQueue, &this->giObjectLoadMsg, 1);
|
||||||
DmaMgr_SendRequestImpl(&this->giObjectDmaRequest, this->giObjectSegment, gObjectTable[objectId].vromStart,
|
DmaMgr_RequestAsync(&this->giObjectDmaRequest, this->giObjectSegment, gObjectTable[objectId].vromStart,
|
||||||
gObjectTable[objectId].vromEnd - gObjectTable[objectId].vromStart, 0,
|
gObjectTable[objectId].vromEnd - gObjectTable[objectId].vromStart, 0,
|
||||||
&this->giObjectLoadQueue, NULL);
|
&this->giObjectLoadQueue, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -216,11 +216,11 @@ void DayTelop_LoadGraphics(DayTelopState* this) {
|
||||||
size_t segmentSize = SEGMENT_ROM_SIZE(daytelop_static);
|
size_t segmentSize = SEGMENT_ROM_SIZE(daytelop_static);
|
||||||
|
|
||||||
this->daytelopStaticFile = THA_AllocTailAlign16(&this->state.tha, segmentSize);
|
this->daytelopStaticFile = THA_AllocTailAlign16(&this->state.tha, segmentSize);
|
||||||
DmaMgr_SendRequest0(this->daytelopStaticFile, SEGMENT_ROM_START(daytelop_static), segmentSize);
|
DmaMgr_RequestSync(this->daytelopStaticFile, SEGMENT_ROM_START(daytelop_static), segmentSize);
|
||||||
|
|
||||||
segmentSize = SEGMENT_ROM_SIZE(icon_item_gameover_static);
|
segmentSize = SEGMENT_ROM_SIZE(icon_item_gameover_static);
|
||||||
this->gameoverStaticFile = THA_AllocTailAlign16(&this->state.tha, segmentSize);
|
this->gameoverStaticFile = THA_AllocTailAlign16(&this->state.tha, segmentSize);
|
||||||
DmaMgr_SendRequest0(this->gameoverStaticFile, SEGMENT_ROM_START(icon_item_gameover_static), segmentSize);
|
DmaMgr_RequestSync(this->gameoverStaticFile, SEGMENT_ROM_START(icon_item_gameover_static), segmentSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DayTelop_Init(GameState* thisx) {
|
void DayTelop_Init(GameState* thisx) {
|
||||||
|
|
|
@ -2522,15 +2522,15 @@ void FileSelect_Init(GameState* thisx) {
|
||||||
|
|
||||||
size = SEGMENT_ROM_SIZE(title_static);
|
size = SEGMENT_ROM_SIZE(title_static);
|
||||||
this->staticSegment = THA_AllocTailAlign16(&this->state.tha, size);
|
this->staticSegment = THA_AllocTailAlign16(&this->state.tha, size);
|
||||||
DmaMgr_SendRequest0(this->staticSegment, SEGMENT_ROM_START(title_static), size);
|
DmaMgr_RequestSync(this->staticSegment, SEGMENT_ROM_START(title_static), size);
|
||||||
|
|
||||||
size = SEGMENT_ROM_SIZE(parameter_static);
|
size = SEGMENT_ROM_SIZE(parameter_static);
|
||||||
this->parameterSegment = THA_AllocTailAlign16(&this->state.tha, size);
|
this->parameterSegment = THA_AllocTailAlign16(&this->state.tha, size);
|
||||||
DmaMgr_SendRequest0(this->parameterSegment, SEGMENT_ROM_START(parameter_static), size);
|
DmaMgr_RequestSync(this->parameterSegment, SEGMENT_ROM_START(parameter_static), size);
|
||||||
|
|
||||||
size = gObjectTable[OBJECT_MAG].vromEnd - gObjectTable[OBJECT_MAG].vromStart;
|
size = gObjectTable[OBJECT_MAG].vromEnd - gObjectTable[OBJECT_MAG].vromStart;
|
||||||
this->titleSegment = THA_AllocTailAlign16(&this->state.tha, size);
|
this->titleSegment = THA_AllocTailAlign16(&this->state.tha, size);
|
||||||
DmaMgr_SendRequest0(this->titleSegment, gObjectTable[OBJECT_MAG].vromStart, size);
|
DmaMgr_RequestSync(this->titleSegment, gObjectTable[OBJECT_MAG].vromStart, size);
|
||||||
|
|
||||||
Audio_SetSpec(0xA);
|
Audio_SetSpec(0xA);
|
||||||
// Setting ioData to 1 and writing it to ioPort 7 will skip the harp intro
|
// Setting ioData to 1 and writing it to ioPort 7 will skip the harp intro
|
||||||
|
|
|
@ -155,7 +155,7 @@ void ConsoleLogo_Init(GameState* thisx) {
|
||||||
uintptr_t segmentSize = SEGMENT_ROM_SIZE(nintendo_rogo_static);
|
uintptr_t segmentSize = SEGMENT_ROM_SIZE(nintendo_rogo_static);
|
||||||
|
|
||||||
this->staticSegment = THA_AllocTailAlign16(&this->state.tha, segmentSize);
|
this->staticSegment = THA_AllocTailAlign16(&this->state.tha, segmentSize);
|
||||||
DmaMgr_SendRequest0(this->staticSegment, SEGMENT_ROM_START(nintendo_rogo_static), segmentSize);
|
DmaMgr_RequestSync(this->staticSegment, SEGMENT_ROM_START(nintendo_rogo_static), segmentSize);
|
||||||
|
|
||||||
GameState_SetFramerateDivisor(&this->state, 1);
|
GameState_SetFramerateDivisor(&this->state, 1);
|
||||||
Matrix_Init(&this->state);
|
Matrix_Init(&this->state);
|
||||||
|
|
|
@ -2877,7 +2877,7 @@ void KaleidoScope_Update(PlayState* play) {
|
||||||
if (func_8010A0A4(play)) {
|
if (func_8010A0A4(play)) {
|
||||||
size_t size = SEGMENT_ROM_SIZE(icon_item_dungeon_static);
|
size_t size = SEGMENT_ROM_SIZE(icon_item_dungeon_static);
|
||||||
|
|
||||||
DmaMgr_SendRequest0(pauseCtx->iconItemAltSegment, SEGMENT_ROM_START(icon_item_dungeon_static), size);
|
DmaMgr_RequestSync(pauseCtx->iconItemAltSegment, SEGMENT_ROM_START(icon_item_dungeon_static), size);
|
||||||
iconItemLangSegment =
|
iconItemLangSegment =
|
||||||
func_801068FC(play, (void*)ALIGN16((uintptr_t)pauseCtx->iconItemAltSegment + size), size);
|
func_801068FC(play, (void*)ALIGN16((uintptr_t)pauseCtx->iconItemAltSegment + size), size);
|
||||||
sInDungeonScene = true;
|
sInDungeonScene = true;
|
||||||
|
@ -2886,13 +2886,13 @@ 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, SEGMENT_ROM_START(icon_item_field_static), size);
|
DmaMgr_RequestSync(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);
|
||||||
}
|
}
|
||||||
|
|
||||||
pauseCtx->iconItemLangSegment = iconItemLangSegment;
|
pauseCtx->iconItemLangSegment = iconItemLangSegment;
|
||||||
size2 = SEGMENT_ROM_SIZE(icon_item_jpn_static);
|
size2 = SEGMENT_ROM_SIZE(icon_item_jpn_static);
|
||||||
DmaMgr_SendRequest0(pauseCtx->iconItemLangSegment, SEGMENT_ROM_START(icon_item_jpn_static), size2);
|
DmaMgr_RequestSync(pauseCtx->iconItemLangSegment, SEGMENT_ROM_START(icon_item_jpn_static), size2);
|
||||||
|
|
||||||
pauseCtx->nameSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemLangSegment + size2);
|
pauseCtx->nameSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemLangSegment + size2);
|
||||||
func_8011552C(play, DO_ACTION_INFO);
|
func_8011552C(play, DO_ACTION_INFO);
|
||||||
|
@ -2903,8 +2903,8 @@ void KaleidoScope_Update(PlayState* play) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pauseCtx->iconItemVtxSegment = (void*)ALIGN16((uintptr_t)pauseCtx->nameSegment + 0xA00);
|
pauseCtx->iconItemVtxSegment = (void*)ALIGN16((uintptr_t)pauseCtx->nameSegment + 0xA00);
|
||||||
DmaMgr_SendRequest0(pauseCtx->iconItemVtxSegment, SEGMENT_ROM_START(icon_item_vtx_static),
|
DmaMgr_RequestSync(pauseCtx->iconItemVtxSegment, SEGMENT_ROM_START(icon_item_vtx_static),
|
||||||
SEGMENT_ROM_SIZE(icon_item_vtx_static));
|
SEGMENT_ROM_SIZE(icon_item_vtx_static));
|
||||||
|
|
||||||
pauseCtx->unk_2B6 = 255;
|
pauseCtx->unk_2B6 = 255;
|
||||||
pauseCtx->unk_2B7 = 255;
|
pauseCtx->unk_2B7 = 255;
|
||||||
|
@ -3195,11 +3195,11 @@ void KaleidoScope_Update(PlayState* play) {
|
||||||
|
|
||||||
pauseCtx->iconItemAltSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItem24Segment + size1);
|
pauseCtx->iconItemAltSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItem24Segment + size1);
|
||||||
size2 = SEGMENT_ROM_SIZE(icon_item_gameover_static);
|
size2 = SEGMENT_ROM_SIZE(icon_item_gameover_static);
|
||||||
DmaMgr_SendRequest0(pauseCtx->iconItemAltSegment, SEGMENT_ROM_START(icon_item_gameover_static), size2);
|
DmaMgr_RequestSync(pauseCtx->iconItemAltSegment, SEGMENT_ROM_START(icon_item_gameover_static), size2);
|
||||||
|
|
||||||
pauseCtx->iconItemLangSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemAltSegment + size2);
|
pauseCtx->iconItemLangSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemAltSegment + size2);
|
||||||
DmaMgr_SendRequest0(pauseCtx->iconItemLangSegment, SEGMENT_ROM_START(icon_item_jpn_static),
|
DmaMgr_RequestSync(pauseCtx->iconItemLangSegment, SEGMENT_ROM_START(icon_item_jpn_static),
|
||||||
SEGMENT_ROM_SIZE(icon_item_jpn_static));
|
SEGMENT_ROM_SIZE(icon_item_jpn_static));
|
||||||
|
|
||||||
gSaveContext.timerStates[TIMER_ID_MOON_CRASH] = TIMER_STATE_OFF;
|
gSaveContext.timerStates[TIMER_ID_MOON_CRASH] = TIMER_STATE_OFF;
|
||||||
|
|
||||||
|
@ -3440,11 +3440,11 @@ void KaleidoScope_Update(PlayState* play) {
|
||||||
pauseCtx->iconItemAltSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemSegment + size0);
|
pauseCtx->iconItemAltSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemSegment + size0);
|
||||||
sInDungeonScene = false;
|
sInDungeonScene = false;
|
||||||
size1 = SEGMENT_ROM_SIZE(icon_item_field_static);
|
size1 = SEGMENT_ROM_SIZE(icon_item_field_static);
|
||||||
DmaMgr_SendRequest0(pauseCtx->iconItemAltSegment, SEGMENT_ROM_START(icon_item_field_static), size1);
|
DmaMgr_RequestSync(pauseCtx->iconItemAltSegment, SEGMENT_ROM_START(icon_item_field_static), size1);
|
||||||
|
|
||||||
pauseCtx->iconItemLangSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemAltSegment + size1);
|
pauseCtx->iconItemLangSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemAltSegment + size1);
|
||||||
size2 = SEGMENT_ROM_SIZE(icon_item_jpn_static);
|
size2 = SEGMENT_ROM_SIZE(icon_item_jpn_static);
|
||||||
DmaMgr_SendRequest0(pauseCtx->iconItemLangSegment, SEGMENT_ROM_START(icon_item_jpn_static), size2);
|
DmaMgr_RequestSync(pauseCtx->iconItemLangSegment, SEGMENT_ROM_START(icon_item_jpn_static), size2);
|
||||||
|
|
||||||
pauseCtx->nameSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemLangSegment + size2);
|
pauseCtx->nameSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemLangSegment + size2);
|
||||||
func_8011552C(play, DO_ACTION_WARP);
|
func_8011552C(play, DO_ACTION_WARP);
|
||||||
|
@ -3452,8 +3452,8 @@ void KaleidoScope_Update(PlayState* play) {
|
||||||
Kaleido_LoadMapNameStatic(pauseCtx->nameSegment, worldMapCursorPoint);
|
Kaleido_LoadMapNameStatic(pauseCtx->nameSegment, worldMapCursorPoint);
|
||||||
|
|
||||||
pauseCtx->iconItemVtxSegment = (void*)ALIGN16((uintptr_t)pauseCtx->nameSegment + 0xA00);
|
pauseCtx->iconItemVtxSegment = (void*)ALIGN16((uintptr_t)pauseCtx->nameSegment + 0xA00);
|
||||||
DmaMgr_SendRequest0(pauseCtx->iconItemVtxSegment, SEGMENT_ROM_START(icon_item_vtx_static),
|
DmaMgr_RequestSync(pauseCtx->iconItemVtxSegment, SEGMENT_ROM_START(icon_item_vtx_static),
|
||||||
SEGMENT_ROM_SIZE(icon_item_vtx_static));
|
SEGMENT_ROM_SIZE(icon_item_vtx_static));
|
||||||
|
|
||||||
pauseCtx->state = PAUSE_STATE_OWL_WARP_3;
|
pauseCtx->state = PAUSE_STATE_OWL_WARP_3;
|
||||||
sGameOverRectPosY = 98;
|
sGameOverRectPosY = 98;
|
||||||
|
|
|
@ -4,5 +4,6 @@
|
||||||
yaz0
|
yaz0
|
||||||
makeromfs
|
makeromfs
|
||||||
elf2rom
|
elf2rom
|
||||||
|
mkdmadata
|
||||||
mkldscript
|
mkldscript
|
||||||
vtxdis
|
vtxdis
|
|
@ -1,5 +1,5 @@
|
||||||
CFLAGS := -Wall -Wextra -Wpedantic -std=c99 -g -Os
|
CFLAGS := -Wall -Wextra -Wpedantic -std=c99 -g -Os
|
||||||
PROGRAMS := elf2rom makeromfs mkldscript reloc_prereq yaz0 makeyar
|
PROGRAMS := elf2rom makeromfs mkdmadata mkldscript reloc_prereq yaz0 makeyar
|
||||||
|
|
||||||
ifeq ($(shell command -v clang >/dev/null 2>&1; echo $$?),0)
|
ifeq ($(shell command -v clang >/dev/null 2>&1; echo $$?),0)
|
||||||
CC := clang
|
CC := clang
|
||||||
|
@ -14,6 +14,7 @@ clean:
|
||||||
|
|
||||||
elf2rom_SOURCES := elf2rom.c elf32.c n64chksum.c util.c
|
elf2rom_SOURCES := elf2rom.c elf32.c n64chksum.c util.c
|
||||||
makeromfs_SOURCES := makeromfs.c n64chksum.c util.c
|
makeromfs_SOURCES := makeromfs.c n64chksum.c util.c
|
||||||
|
mkdmadata_SOURCES := mkdmadata.c spec.c util.c
|
||||||
mkldscript_SOURCES := mkldscript.c spec.c util.c
|
mkldscript_SOURCES := mkldscript.c spec.c util.c
|
||||||
reloc_prereq_SOURCES := reloc_prereq.c spec.c util.c
|
reloc_prereq_SOURCES := reloc_prereq.c spec.c util.c
|
||||||
yaz0_SOURCES := yaz0tool.c yaz0.c util.c
|
yaz0_SOURCES := yaz0tool.c yaz0.c util.c
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "spec.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
|
struct Segment* g_segments;
|
||||||
|
int g_segmentsCount;
|
||||||
|
|
||||||
|
static void write_dmadata_table(FILE *fout)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < g_segmentsCount; i++) {
|
||||||
|
// Don't emit dma entry for segments set with NOLOAD
|
||||||
|
if (g_segments[i].flags & FLAG_NOLOAD) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_segments[i].flags & FLAG_SYMS) {
|
||||||
|
// For segments set with SYMS, unset in the dma table
|
||||||
|
fprintf(fout, "DEFINE_DMA_ENTRY_UNSET(%s, \"%s\")\n", g_segments[i].name, g_segments[i].name);
|
||||||
|
} else {
|
||||||
|
fprintf(fout, "DEFINE_DMA_ENTRY(%s, \"%s\")\n", g_segments[i].name, g_segments[i].name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void usage(const char *execname)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "zelda64 dmadata generation tool v0.01\n"
|
||||||
|
"usage: %s SPEC_FILE DMADATA_TABLE\n"
|
||||||
|
"SPEC_FILE file describing the organization of object files into segments\n"
|
||||||
|
"DMADATA_TABLE filename of output dmadata table header\n",
|
||||||
|
execname);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
FILE *dmaout;
|
||||||
|
void *spec;
|
||||||
|
size_t size;
|
||||||
|
|
||||||
|
if (argc != 3)
|
||||||
|
{
|
||||||
|
usage(argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
spec = util_read_whole_file(argv[1], &size);
|
||||||
|
parse_rom_spec(spec, &g_segments, &g_segmentsCount);
|
||||||
|
|
||||||
|
dmaout = fopen(argv[2], "w");
|
||||||
|
if (dmaout == NULL)
|
||||||
|
util_fatal_error("failed to open file '%s' for writing", argv[2]);
|
||||||
|
write_dmadata_table(dmaout);
|
||||||
|
fclose(dmaout);
|
||||||
|
free_rom_spec(g_segments, g_segmentsCount);
|
||||||
|
free(spec);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -76,6 +76,8 @@ static bool parse_flags(char* str, unsigned int* flags) {
|
||||||
f |= FLAG_RAW;
|
f |= FLAG_RAW;
|
||||||
else if (strcmp(str, "NOLOAD") == 0)
|
else if (strcmp(str, "NOLOAD") == 0)
|
||||||
f |= FLAG_NOLOAD;
|
f |= FLAG_NOLOAD;
|
||||||
|
else if (strcmp(str, "SYMS") == 0)
|
||||||
|
f |= FLAG_SYMS;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ enum {
|
||||||
FLAG_OBJECT = (1 << 1),
|
FLAG_OBJECT = (1 << 1),
|
||||||
FLAG_RAW = (1 << 2),
|
FLAG_RAW = (1 << 2),
|
||||||
FLAG_NOLOAD = (1 << 3),
|
FLAG_NOLOAD = (1 << 3),
|
||||||
|
FLAG_SYMS = (1 << 4)
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Include {
|
struct Include {
|
||||||
|
|
|
@ -13,16 +13,16 @@
|
||||||
0x800805E0:("ViConfig_UpdateVi",),
|
0x800805E0:("ViConfig_UpdateVi",),
|
||||||
0x80080748:("ViConfig_UpdateBlack",),
|
0x80080748:("ViConfig_UpdateBlack",),
|
||||||
0x80080790:("DmaMgr_DmaRomToRam",),
|
0x80080790:("DmaMgr_DmaRomToRam",),
|
||||||
0x800808D4:("DmaMgr_DmaHandler",),
|
0x800808D4:("DmaMgr_AudioDmaHandler",),
|
||||||
0x800808F4:("DmaMgr_FindDmaEntry",),
|
0x800808F4:("DmaMgr_FindDmaEntry",),
|
||||||
0x80080950:("DmaMgr_TranslateVromToRom",),
|
0x80080950:("DmaMgr_TranslateVromToRom",),
|
||||||
0x800809BC:("DmaMgr_FindDmaIndex",),
|
0x800809BC:("DmaMgr_FindDmaIndex",),
|
||||||
0x800809F4:("func_800809F4",),
|
0x800809F4:("func_800809F4",),
|
||||||
0x80080A08:("DmaMgr_ProcessMsg",),
|
0x80080A08:("DmaMgr_ProcessRequest",),
|
||||||
0x80080B84:("DmaMgr_ThreadEntry",),
|
0x80080B84:("DmaMgr_ThreadEntry",),
|
||||||
0x80080C04:("DmaMgr_SendRequestImpl",),
|
0x80080C04:("DmaMgr_RequestAsync",),
|
||||||
0x80080C90:("DmaMgr_SendRequest0",),
|
0x80080C90:("DmaMgr_RequestSync",),
|
||||||
0x80080D0C:("DmaMgr_Start",),
|
0x80080D0C:("DmaMgr_Init",),
|
||||||
0x80080E00:("DmaMgr_Stop",),
|
0x80080E00:("DmaMgr_Stop",),
|
||||||
0x80080E30:("Yaz0_FirstDMA",),
|
0x80080E30:("Yaz0_FirstDMA",),
|
||||||
0x80080ED0:("Yaz0_NextDMA",),
|
0x80080ED0:("Yaz0_NextDMA",),
|
||||||
|
|
|
@ -987,6 +987,9 @@ wordReplace = {
|
||||||
|
|
||||||
"Game_SetFramerateDivisor": "GameState_SetFramerateDivisor",
|
"Game_SetFramerateDivisor": "GameState_SetFramerateDivisor",
|
||||||
|
|
||||||
|
"DmaMgr_SendRequestImpl": "DmaMgr_RequestAsync",
|
||||||
|
"DmaMgr_SendRequest0": "DmaMgr_RequestSync",
|
||||||
|
|
||||||
# Structs
|
# Structs
|
||||||
"ActorAnimationEntry": "AnimationInfo",
|
"ActorAnimationEntry": "AnimationInfo",
|
||||||
"ActorAnimationEntryS": "AnimationInfoS",
|
"ActorAnimationEntryS": "AnimationInfoS",
|
||||||
|
|
|
@ -10,16 +10,16 @@ asm/non_matchings/boot/idle/Idle_ThreadEntry.s,Idle_ThreadEntry,0x80080514,0x33
|
||||||
asm/non_matchings/boot/viconfig/ViConfig_UpdateVi.s,ViConfig_UpdateVi,0x800805E0,0x5A
|
asm/non_matchings/boot/viconfig/ViConfig_UpdateVi.s,ViConfig_UpdateVi,0x800805E0,0x5A
|
||||||
asm/non_matchings/boot/viconfig/ViConfig_UpdateBlack.s,ViConfig_UpdateBlack,0x80080748,0x12
|
asm/non_matchings/boot/viconfig/ViConfig_UpdateBlack.s,ViConfig_UpdateBlack,0x80080748,0x12
|
||||||
asm/non_matchings/boot/z_std_dma/DmaMgr_DmaRomToRam.s,DmaMgr_DmaRomToRam,0x80080790,0x51
|
asm/non_matchings/boot/z_std_dma/DmaMgr_DmaRomToRam.s,DmaMgr_DmaRomToRam,0x80080790,0x51
|
||||||
asm/non_matchings/boot/z_std_dma/DmaMgr_DmaHandler.s,DmaMgr_DmaHandler,0x800808D4,0x8
|
asm/non_matchings/boot/z_std_dma/DmaMgr_AudioDmaHandler.s,DmaMgr_AudioDmaHandler,0x800808D4,0x8
|
||||||
asm/non_matchings/boot/z_std_dma/DmaMgr_FindDmaEntry.s,DmaMgr_FindDmaEntry,0x800808F4,0x17
|
asm/non_matchings/boot/z_std_dma/DmaMgr_FindDmaEntry.s,DmaMgr_FindDmaEntry,0x800808F4,0x17
|
||||||
asm/non_matchings/boot/z_std_dma/DmaMgr_TranslateVromToRom.s,DmaMgr_TranslateVromToRom,0x80080950,0x1B
|
asm/non_matchings/boot/z_std_dma/DmaMgr_TranslateVromToRom.s,DmaMgr_TranslateVromToRom,0x80080950,0x1B
|
||||||
asm/non_matchings/boot/z_std_dma/DmaMgr_FindDmaIndex.s,DmaMgr_FindDmaIndex,0x800809BC,0xE
|
asm/non_matchings/boot/z_std_dma/DmaMgr_FindDmaIndex.s,DmaMgr_FindDmaIndex,0x800809BC,0xE
|
||||||
asm/non_matchings/boot/z_std_dma/func_800809F4.s,func_800809F4,0x800809F4,0x5
|
asm/non_matchings/boot/z_std_dma/func_800809F4.s,func_800809F4,0x800809F4,0x5
|
||||||
asm/non_matchings/boot/z_std_dma/DmaMgr_ProcessMsg.s,DmaMgr_ProcessMsg,0x80080A08,0x5F
|
asm/non_matchings/boot/z_std_dma/DmaMgr_ProcessRequest.s,DmaMgr_ProcessRequest,0x80080A08,0x5F
|
||||||
asm/non_matchings/boot/z_std_dma/DmaMgr_ThreadEntry.s,DmaMgr_ThreadEntry,0x80080B84,0x20
|
asm/non_matchings/boot/z_std_dma/DmaMgr_ThreadEntry.s,DmaMgr_ThreadEntry,0x80080B84,0x20
|
||||||
asm/non_matchings/boot/z_std_dma/DmaMgr_SendRequestImpl.s,DmaMgr_SendRequestImpl,0x80080C04,0x23
|
asm/non_matchings/boot/z_std_dma/DmaMgr_RequestAsync.s,DmaMgr_RequestAsync,0x80080C04,0x23
|
||||||
asm/non_matchings/boot/z_std_dma/DmaMgr_SendRequest0.s,DmaMgr_SendRequest0,0x80080C90,0x1F
|
asm/non_matchings/boot/z_std_dma/DmaMgr_RequestSync.s,DmaMgr_RequestSync,0x80080C90,0x1F
|
||||||
asm/non_matchings/boot/z_std_dma/DmaMgr_Start.s,DmaMgr_Start,0x80080D0C,0x3D
|
asm/non_matchings/boot/z_std_dma/DmaMgr_Init.s,DmaMgr_Init,0x80080D0C,0x3D
|
||||||
asm/non_matchings/boot/z_std_dma/DmaMgr_Stop.s,DmaMgr_Stop,0x80080E00,0xC
|
asm/non_matchings/boot/z_std_dma/DmaMgr_Stop.s,DmaMgr_Stop,0x80080E00,0xC
|
||||||
asm/non_matchings/boot/yaz0/Yaz0_FirstDMA.s,Yaz0_FirstDMA,0x80080E30,0x28
|
asm/non_matchings/boot/yaz0/Yaz0_FirstDMA.s,Yaz0_FirstDMA,0x80080E30,0x28
|
||||||
asm/non_matchings/boot/yaz0/Yaz0_NextDMA.s,Yaz0_NextDMA,0x80080ED0,0x48
|
asm/non_matchings/boot/yaz0/Yaz0_NextDMA.s,Yaz0_NextDMA,0x80080ED0,0x48
|
||||||
|
|
|
Loading…
Reference in New Issue