1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-27 07:07:09 +00:00

create ucode_disas.h (#2222)

* ucode_disas.h

* create UcodeType

* bss
This commit is contained in:
mzxrules 2024-09-24 13:45:53 -04:00 committed by GitHub
parent f9d892a2ae
commit dc1501e7a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 70 additions and 59 deletions

View file

@ -940,11 +940,6 @@ void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line
void DebugArena_FreeDebug(void* ptr, const char* file, int line);
void DebugArena_Display(void);
#endif
void UCodeDisas_Init(UCodeDisas*);
void UCodeDisas_Destroy(UCodeDisas*);
void UCodeDisas_Disassemble(UCodeDisas*, Gfx*);
void UCodeDisas_RegisterUCode(UCodeDisas*, s32, UCodeInfo*);
void UCodeDisas_SetCurUCode(UCodeDisas*, void*);
Acmd* AudioSynth_Update(Acmd* cmdStart, s32* cmdCnt, s16* aiStart, s32 aiBufLen);
void AudioHeap_DiscardFont(s32 fontId);
void AudioHeap_ReleaseNotesForFont(s32 fontId);

View file

@ -126,41 +126,6 @@ typedef enum SetupDL {
/* 71 */ SETUPDL_MAX
} SetupDL;
#define UCODE_NULL 0
#define UCODE_F3DZEX 1
#define UCODE_UNK 2
#define UCODE_S2DEX 3
typedef struct UCodeInfo {
/* 0x00 */ u32 type;
/* 0x04 */ void* ptr;
} UCodeInfo; // size = 0x8
typedef struct UCodeDisas {
/* 0x00 */ uintptr_t segments[NUM_SEGMENTS];
/* 0x40 */ Gfx* dlStack[18];
/* 0x88 */ s32 dlDepth;
/* 0x8C */ u32 dlCnt;
/* 0x90 */ u32 vtxCnt;
/* 0x94 */ u32 spvtxCnt;
/* 0x98 */ u32 tri1Cnt;
/* 0x9C */ u32 tri2Cnt;
/* 0xA0 */ u32 quadCnt;
/* 0xA4 */ u32 lineCnt;
/* 0xA8 */ u32 loaducodeCnt;
/* 0xAC */ u32 pipeSyncRequired;
/* 0xB0 */ u32 tileSyncRequired;
/* 0xB4 */ u32 loadSyncRequired;
/* 0xB8 */ u32 syncErr;
/* 0xBC */ s32 enableLog;
/* 0xC0 */ s32 ucodeType;
/* 0xC4 */ s32 ucodeInfoCount;
/* 0xC8 */ UCodeInfo* ucodeInfo;
/* 0xCC */ u32 modeH;
/* 0xD0 */ u32 modeL;
/* 0xD4 */ u32 geometryMode;
} UCodeDisas; // size = 0xD8
void* Graph_Alloc(GraphicsContext* gfxCtx, size_t size);
void* Graph_Alloc2(GraphicsContext* gfxCtx, size_t size);

49
include/ucode_disas.h Normal file
View file

@ -0,0 +1,49 @@
#ifndef UCODE_DISAS_H
#define UCODE_DISAS_H
#include "ultra64.h"
typedef enum UcodeType {
/* 0 */ UCODE_TYPE_NULL,
/* 1 */ UCODE_TYPE_F3DZEX,
/* 2 */ UCODE_TYPE_UNK, // Likely F3DEX2 or a similar variant
/* 3 */ UCODE_TYPE_S2DEX
} UcodeType;
typedef struct UCodeInfo {
/* 0x00 */ u32 type;
/* 0x04 */ void* ptr;
} UCodeInfo; // size = 0x8
typedef struct UCodeDisas {
/* 0x00 */ uintptr_t segments[NUM_SEGMENTS];
/* 0x40 */ Gfx* dlStack[18];
/* 0x88 */ s32 dlDepth;
/* 0x8C */ u32 dlCnt;
/* 0x90 */ u32 vtxCnt;
/* 0x94 */ u32 spvtxCnt;
/* 0x98 */ u32 tri1Cnt;
/* 0x9C */ u32 tri2Cnt;
/* 0xA0 */ u32 quadCnt;
/* 0xA4 */ u32 lineCnt;
/* 0xA8 */ u32 loaducodeCnt;
/* 0xAC */ u32 pipeSyncRequired;
/* 0xB0 */ u32 tileSyncRequired;
/* 0xB4 */ u32 loadSyncRequired;
/* 0xB8 */ u32 syncErr;
/* 0xBC */ s32 enableLog;
/* 0xC0 */ s32 ucodeType;
/* 0xC4 */ s32 ucodeInfoCount;
/* 0xC8 */ UCodeInfo* ucodeInfo;
/* 0xCC */ u32 modeH;
/* 0xD0 */ u32 modeL;
/* 0xD4 */ u32 geometryMode;
} UCodeDisas; // size = 0xD8
void UCodeDisas_Init(UCodeDisas*);
void UCodeDisas_Destroy(UCodeDisas*);
void UCodeDisas_Disassemble(UCodeDisas*, Gfx*);
void UCodeDisas_RegisterUCode(UCodeDisas*, s32, UCodeInfo*);
void UCodeDisas_SetCurUCode(UCodeDisas*, void*);
#endif

View file

@ -27,7 +27,7 @@
#endif
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \
"ntsc-1.2:102"
"ntsc-1.2:108"
StackEntry sDmaMgrStackInfo;
OSMesgQueue sDmaMgrMsgQueue;

View file

@ -1,6 +1,7 @@
#include "global.h"
#include "fault.h"
#include "terminal.h"
#include "ucode_disas.h"
#define GFXPOOL_HEAD_MAGIC 0x1234
#define GFXPOOL_TAIL_MAGIC 0x5678
@ -22,15 +23,15 @@ OSTime sGraphPrevTaskTimeStart;
FaultClient sGraphFaultClient;
UCodeInfo D_8012D230[3] = {
{ UCODE_F3DZEX, gspF3DZEX2_NoN_PosLight_fifoTextStart },
{ UCODE_UNK, NULL },
{ UCODE_S2DEX, gspS2DEX2d_fifoTextStart },
{ UCODE_TYPE_F3DZEX, gspF3DZEX2_NoN_PosLight_fifoTextStart },
{ UCODE_TYPE_UNK, NULL },
{ UCODE_TYPE_S2DEX, gspS2DEX2d_fifoTextStart },
};
UCodeInfo D_8012D248[3] = {
{ UCODE_F3DZEX, gspF3DZEX2_NoN_PosLight_fifoTextStart },
{ UCODE_UNK, NULL },
{ UCODE_S2DEX, gspS2DEX2d_fifoTextStart },
{ UCODE_TYPE_F3DZEX, gspF3DZEX2_NoN_PosLight_fifoTextStart },
{ UCODE_TYPE_UNK, NULL },
{ UCODE_TYPE_S2DEX, gspS2DEX2d_fifoTextStart },
};
void Graph_FaultClient(void) {

View file

@ -23,7 +23,7 @@ extern struct IrqMgr gIrqMgr;
#endif
#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \
"ntsc-1.2:160"
"ntsc-1.2:166"
extern u8 _buffersSegmentEnd[];

View file

@ -1,4 +1,5 @@
#include "global.h"
#include "ucode_disas.h"
typedef struct F3dzexConst {
/* 0x00 */ u32 value;
@ -223,7 +224,7 @@ void UCodeDisas_SetCurUCodeImpl(UCodeDisas* this, void* ptr) {
}
if (i >= this->ucodeInfoCount) {
DISAS_LOG(T("マイクロコードが一致しなかった\n", "Microcode did not match\n"));
this->ucodeType = UCODE_NULL;
this->ucodeType = UCODE_TYPE_NULL;
}
}
@ -800,8 +801,8 @@ void UCodeDisas_Disassemble(UCodeDisas* this, Gfx* ptr) {
default: {
switch (this->ucodeType) {
case UCODE_F3DZEX:
case UCODE_UNK: {
case UCODE_TYPE_F3DZEX:
case UCODE_TYPE_UNK: {
switch (cmd) {
case G_MTX: {
Gdma2 gmtx = ptr->dma2;
@ -1098,7 +1099,7 @@ void UCodeDisas_Disassemble(UCodeDisas* this, Gfx* ptr) {
}
} break;
case UCODE_S2DEX: {
case UCODE_TYPE_S2DEX: {
switch (cmd) {
case G_BG_COPY: {
Gwords words = ptr->words;

View file

@ -1,7 +1,7 @@
#include "global.h"
#include "terminal.h"
#pragma increment_block_number "ntsc-1.2:148"
#pragma increment_block_number "ntsc-1.2:152"
u16 DynaSSNodeList_GetNextNodeIdx(DynaSSNodeList* nodeList);
void BgCheck_GetStaticLookupIndicesFromPos(CollisionContext* colCtx, Vec3f* pos, Vec3i* sector);

View file

@ -3638,7 +3638,7 @@ s32 Camera_KeepOn3(Camera* camera) {
}
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \
"ntsc-1.2:104"
"ntsc-1.2:110"
s32 Camera_KeepOn4(Camera* camera) {
static Vec3f D_8015BD50;

View file

@ -5,7 +5,7 @@
#include "overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.h"
#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:216"
#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:224"
typedef s32 (*ColChkResetFunc)(PlayState*, Collider*);
typedef void (*ColChkApplyFunc)(PlayState*, CollisionCheckContext*, Collider*);

View file

@ -3,7 +3,7 @@
#include "versions.h"
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \
"ntsc-1.2:192"
"ntsc-1.2:224"
ALIGNED(16) SaveContext gSaveContext;
u32 D_8015FA88;

View file

@ -7,7 +7,7 @@
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#include "assets/objects/gameplay_field_keep/gameplay_field_keep.h"
#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:0"
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:0"
typedef enum LightningBoltState {
/* 0x00 */ LIGHTNING_BOLT_START,
@ -212,7 +212,7 @@ s16 sLightningFlashAlpha;
s16 sSunDepthTestX;
s16 sSunDepthTestY;
#pragma increment_block_number "gc-eu:240 gc-eu-mq:240 gc-jp:216 gc-jp-ce:216 gc-jp-mq:216 gc-us:216 gc-us-mq:216" \
#pragma increment_block_number "gc-eu:112 gc-eu-mq:112 gc-jp:216 gc-jp-ce:216 gc-jp-mq:216 gc-us:216 gc-us-mq:216" \
"ntsc-1.2:224"
LightNode* sNGameOverLightNode;

View file

@ -16,7 +16,7 @@
#include "cic6105.h"
#endif
#pragma increment_block_number "gc-eu:125 gc-eu-mq:125 gc-jp:127 gc-jp-ce:127 gc-jp-mq:127 gc-us:127 gc-us-mq:127"
#pragma increment_block_number "gc-eu:131 gc-eu-mq:131 gc-jp:133 gc-jp-ce:133 gc-jp-mq:133 gc-us:133 gc-us-mq:133"
#define FLAGS ACTOR_FLAG_4