diff options
| author | Tharo <17233964+Thar0@users.noreply.github.com> | 2022-11-17 02:57:02 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-16 21:57:02 -0500 |
| commit | 7ecafcfe7d357ff1cbcf49ce4d87a9efedae552e (patch) | |
| tree | ba036ae7cdce859adb4e0f036fcc28284be22423 /include | |
| parent | 40639e698d0b4681d088194dc72a6a3b910e7d13 (diff) | |
More documentation for `z_std_dma.c` (#1415)
* More documentation for z_std_dma
* uintptr casts for rom symbols in z64animation.h and z_kanfont.c
* Format
* Suggested changes, more defines for static texture sizes
* PI Interface -> PI
* Further suggested changes
* Format
* Comments about item_name and map_name texture assumptions
Diffstat (limited to 'include')
| -rw-r--r-- | include/functions.h | 16 | ||||
| -rw-r--r-- | include/variables.h | 3 | ||||
| -rw-r--r-- | include/z64.h | 29 | ||||
| -rwxr-xr-x | include/z64animation.h | 2 | ||||
| -rwxr-xr-x | include/z64dma.h | 27 | ||||
| -rw-r--r-- | include/z64item.h | 14 |
6 files changed, 70 insertions, 21 deletions
diff --git a/include/functions.h b/include/functions.h index 46dc6299b..8c60f88b4 100644 --- a/include/functions.h +++ b/include/functions.h @@ -21,24 +21,10 @@ void Main_ThreadEntry(void* arg); void Idle_ThreadEntry(void* arg); void ViConfig_UpdateVi(u32 black); void ViConfig_UpdateBlack(void); -s32 DmaMgr_CompareName(const char* name1, const char* name2); -s32 DmaMgr_DmaRomToRam(uintptr_t rom, void* ram, u32 size); -s32 DmaMgr_DmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction); -void DmaMgr_Error(DmaRequest* req, const char* file, const char* errorName, const char* errorDesc); -const char* DmaMgr_GetFileNameImpl(uintptr_t vrom); -const char* DmaMgr_GetFileName(uintptr_t vrom); -void DmaMgr_ProcessMsg(DmaRequest* req); -void DmaMgr_ThreadEntry(void* arg); -s32 DmaMgr_SendRequestImpl(DmaRequest* req, void* ram, uintptr_t vrom, u32 size, u32 unk, OSMesgQueue* queue, OSMesg msg); -s32 DmaMgr_SendRequest0(void* ram, uintptr_t vrom, u32 size); -void DmaMgr_Init(void); -s32 DmaMgr_SendRequest2(DmaRequest* req, void* ram, uintptr_t vrom, u32 size, u32 unk5, OSMesgQueue* queue, OSMesg msg, - const char* file, s32 line); -s32 DmaMgr_SendRequest1(void* ram, uintptr_t vrom, u32 size, const char* file, s32 line); void* Yaz0_FirstDMA(void); void* Yaz0_NextDMA(u8* curSrcPos); void Yaz0_DecompressImpl(Yaz0Header* hdr, u8* dst); -void Yaz0_Decompress(uintptr_t romStart, u8* dst, u32 size); +void Yaz0_Decompress(uintptr_t romStart, u8* dst, size_t size); void Locale_Init(void); void Locale_ResetRegion(void); u32 func_80001F48(void); diff --git a/include/variables.h b/include/variables.h index 44f7a2725..7c8386672 100644 --- a/include/variables.h +++ b/include/variables.h @@ -13,8 +13,6 @@ extern u32 osMemSize; extern u8 osAppNMIBuffer[0x40]; extern s8 D_80009430; -extern u32 gDmaMgrVerbose; -extern u32 gDmaMgrDmaBuffSize; extern vu8 gViConfigBlack; extern u8 gViConfigAdditionalScanLines; extern u32 gViConfigFeatures; @@ -53,7 +51,6 @@ extern OSTime __osCurrentTime; extern u32 __osBaseCounter; extern u32 __osViIntrCount; extern u32 __osTimerCounter; -extern DmaEntry gDmaDataTable[0x60C]; extern EffectSsOverlay gEffectSsOverlayTable[EFFECT_SS_TYPE_MAX]; extern Gfx D_80116280[]; extern ActorOverlay gActorOverlayTable[ACTOR_ID_MAX]; // original name: "actor_dlftbls" 801162A0 diff --git a/include/z64.h b/include/z64.h index 40dabeb5e..3fb20884f 100644 --- a/include/z64.h +++ b/include/z64.h @@ -420,11 +420,14 @@ typedef enum { // TODO get these properties from the textures themselves #define FONT_CHAR_TEX_WIDTH 16 #define FONT_CHAR_TEX_HEIGHT 16 -#define FONT_CHAR_TEX_SIZE ((16 * 16) / 2) // 16x16 I4 texture +#define FONT_CHAR_TEX_SIZE ((FONT_CHAR_TEX_WIDTH * FONT_CHAR_TEX_HEIGHT) / 2) // 16x16 I4 texture // TODO get these properties from the textures themselves #define MESSAGE_STATIC_TEX_SIZE 0x1000 +// TODO get these properties from the textures themselves +#define MESSAGE_TEXTURE_STATIC_TEX_SIZE 0x900 + typedef enum { /* 0x00 */ MSGMODE_NONE, /* 0x01 */ MSGMODE_TEXT_START, @@ -616,6 +619,11 @@ typedef enum { /* 0x1D */ DO_ACTION_MAX } DoAction; +// TODO extract this information from the texture definitions themselves +#define DO_ACTION_TEX_WIDTH 48 +#define DO_ACTION_TEX_HEIGHT 16 +#define DO_ACTION_TEX_SIZE ((DO_ACTION_TEX_WIDTH * DO_ACTION_TEX_HEIGHT) / 2) // (sizeof(gCheckDoActionENGTex)) + typedef struct { /* 0x0000 */ View view; /* 0x0128 */ Vtx* actionVtx; @@ -1427,6 +1435,25 @@ typedef struct { /* 0x6C */ s16* skullFloorIconY; // dungeon big skull icon Y pos } MapData; // size = 0x70 +// TODO get these properties from the textures themselves +#define MAP_I_TEX_WIDTH 96 +#define MAP_I_TEX_HEIGHT 85 +#define MAP_I_TEX_SIZE ((MAP_I_TEX_WIDTH * MAP_I_TEX_HEIGHT) / 2) // 96x85 I4 texture + +#define MAP_48x85_TEX_WIDTH 48 +#define MAP_48x85_TEX_HEIGHT 85 +#define MAP_48x85_TEX_SIZE ((MAP_48x85_TEX_WIDTH * MAP_48x85_TEX_HEIGHT) / 2) // 48x85 CI4 texture + +// Note that z_kaleido_scope_PAL.c assumes that the dimensions and texture format here also matches the dimensions and +// texture format for ITEM_NAME_TEX_* +#define MAP_NAME_TEX1_WIDTH 128 +#define MAP_NAME_TEX1_HEIGHT 16 +#define MAP_NAME_TEX1_SIZE ((MAP_NAME_TEX1_WIDTH * MAP_NAME_TEX1_HEIGHT) / 2) // 128x16 IA4 texture + +#define MAP_NAME_TEX2_WIDTH 80 +#define MAP_NAME_TEX2_HEIGHT 32 +#define MAP_NAME_TEX2_SIZE (MAP_NAME_TEX2_WIDTH * MAP_NAME_TEX2_HEIGHT) // 80x32 IA8 texture + #define PAUSE_MAP_MARK_NONE -1 #define PAUSE_MAP_MARK_CHEST 0 #define PAUSE_MAP_MARK_BOSS 1 diff --git a/include/z64animation.h b/include/z64animation.h index 31d4d84fe..830befae7 100755 --- a/include/z64animation.h +++ b/include/z64animation.h @@ -10,7 +10,7 @@ struct Actor; struct SkelAnime; #define LINK_ANIMATION_OFFSET(addr, offset) \ - (((u32)_link_animetionSegmentRomStart) + ((u32)addr) - ((u32)_link_animetionSegmentStart) + ((u32)offset)) + (((uintptr_t)_link_animetionSegmentRomStart) + ((uintptr_t)(addr)) - ((uintptr_t)_link_animetionSegmentStart) + (offset)) #define LIMB_DONE 0xFF #define ANIMATION_ENTRY_MAX 50 #define ANIM_FLAG_UPDATEY (1 << 1) diff --git a/include/z64dma.h b/include/z64dma.h index f19c3e767..c27aa0273 100755 --- a/include/z64dma.h +++ b/include/z64dma.h @@ -2,11 +2,12 @@ #define Z64_DMA_H #include "ultra64.h" +#include "alignment.h" typedef struct { /* 0x00 */ uintptr_t vromAddr; // VROM address (source) /* 0x04 */ void* dramAddr; // DRAM address (destination) - /* 0x08 */ u32 size; // File Transfer size + /* 0x08 */ size_t size; // File Transfer size /* 0x0C */ const char* filename; // Filename for debugging /* 0x10 */ s32 line; // Line for debugging /* 0x14 */ s32 unk_14; @@ -21,4 +22,28 @@ typedef struct { /* 0x0C */ uintptr_t romEnd; } DmaEntry; +extern DmaEntry gDmaDataTable[]; + +extern u32 gDmaMgrVerbose; +extern size_t gDmaMgrDmaBuffSize; + +#define DMAMGR_DEFAULT_BUFSIZE ALIGN16(0x2000) + +// Standard DMA Requests + +s32 DmaMgr_RequestSync(void* ram, uintptr_t vrom, size_t size); +s32 DmaMgr_RequestSyncDebug(void* ram, uintptr_t vrom, size_t size, const char* file, s32 line); +s32 DmaMgr_RequestAsync(DmaRequest* req, void* ram, uintptr_t vrom, size_t size, u32 unk5, OSMesgQueue* queue, + OSMesg msg, const char* file, s32 line); + +// Special-purpose DMA Requests + +s32 DmaMgr_DmaRomToRam(uintptr_t rom, void* ram, size_t size); +void DmaMgr_DmaFromDriveRom(void* ram, uintptr_t rom, size_t size); +s32 DmaMgr_AudioDmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction); + +// Initialization + +void DmaMgr_Init(void); + #endif diff --git a/include/z64item.h b/include/z64item.h index 264a63d6e..a642841b9 100644 --- a/include/z64item.h +++ b/include/z64item.h @@ -1,6 +1,20 @@ #ifndef Z64ITEM_H #define Z64ITEM_H +#define ICON_ITEM_TEX_WIDTH 32 +#define ICON_ITEM_TEX_HEIGHT 32 +#define ICON_ITEM_TEX_SIZE ((ICON_ITEM_TEX_WIDTH * ICON_ITEM_TEX_HEIGHT) * 4) // 32x32 RGBA32 texture + +#define ICON_ITEM_24_TEX_WIDTH 24 +#define ICON_ITEM_24_TEX_HEIGHT 24 +#define ICON_ITEM_24_TEX_SIZE ((ICON_ITEM_24_TEX_WIDTH * ICON_ITEM_24_TEX_HEIGHT) * 4) // 24x24 RGBA32 texture + +// Note that z_kaleido_scope_PAL.c assumes that the dimensions and texture format here also matches the dimensions and +// texture format for MAP_NAME_TEX1_* +#define ITEM_NAME_TEX_WIDTH 128 +#define ITEM_NAME_TEX_HEIGHT 16 +#define ITEM_NAME_TEX_SIZE ((ITEM_NAME_TEX_WIDTH * ITEM_NAME_TEX_HEIGHT) / 2) // 128x16 IA4 texture + typedef enum { /* 0 */ EQUIP_TYPE_SWORD, /* 1 */ EQUIP_TYPE_SHIELD, |
