1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-17 05:15:16 +00:00

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
This commit is contained in:
Tharo 2022-11-17 02:57:02 +00:00 committed by GitHub
parent 40639e698d
commit 7ecafcfe7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 549 additions and 320 deletions

View file

@ -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);

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -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,