Animation system updated, some more boot files decompiled (+6%), z_fcurve_data_skelanime decompiled (1 non-matching), some asm files split, etc (#89)

* Progress on various files

* gfxprint stuff

* split some rodata, add iconv for rodata string parsing

* z_std_dma rodata

* 2 nonmatchings in gfxprint

* mtxuty-cvt ok

* more

* match a function in idle.c

* progress

* Cleanup

* Rename BgPolygon to CollisionPoly

* progress

* some effect stuff

* more effect progress

* updates

* made suggested changes

* z_effect_soft_sprite_old_init mostly ok

* remove old effects enum

* gamealloc.c OK

* added more files

* motor.c almost done

* motor.c OK

* updates

* migration of two files

* listalloc.c oK

* z_fcurve_data_skelanime split

* z_fcurve_data_skelanime.c decompiled

* more files split

* z_malloc.c OK

* contpfs.c OK

* fault.c rodata migrated

* migrated fault_drawer rodata

* update

* update preprocess.py

* renamed functions in z_skelanime

* started z_skelanime cleanup

* like halfway through fixing z_skelanime

* animation system updated to meet oot standards

* remove unused animation structs

* rename matrix structs to fit oot

* Add -woff 712

* fix diff_settings.py because i accidentally broke it before

* fixed merge conflict, doesn't match though

* It matches now

* Updates

* Fixed warnings...added gcc code syntax checking

* Remove gcc check, added in Tharo's PR

* warnings fixed (i think)

* fixed all warnings i think

* ok

* not sure what to do

* Fix all warnings i think (z_en_a_keep needs some file cleanup thouguh)

* it matches if i do this

* remove comment

* accidentally put osPfsFreeBlocks in epilinkhandle.c

* memcmp -> bcmp

* change u32 size to size_t size, delete string.h because it caused unnecessary confusion with defining size_t twice

* format.sh

* MTXMODE_NEW and MTXMODE_APPLY to matrix functions

* Made suggested changes

* pragma sFaultDrawerFont instead of including in repo

* add some functions to functions.h

* Bss reordering fixed in z_collision_check...added hack to disasm.py

* Updated z_en_a_keep.c

* Missed suggestion in EnAObj_Destroy

* .

* update z_fcurve_Data_skelanime and z_skelanime with suggestions

* devmgr.c ok

* minor changes

* Addressed comments

* remove redundant file

* gfxp -> dlist in game.c

* updated actorfixer.py

* fixed warnings in z_malloc

* Change void* back to Actor*

* format

* Add the soft_sprit comments back

* Rename SV->Flex

* remove .common

* run format

* Update src/code/z_skelanime.c

* u32 channel

Co-authored-by: Lucas Shaw <lucas.shaw1123@gmail.com>
Co-authored-by: angie <angheloalf95@gmail.com>
Co-authored-by: Kenix3 <kenixwhisperwind@gmail.com>
This commit is contained in:
Lucas Shaw
2021-10-24 10:59:14 -04:00
committed by GitHub
co-authored by Lucas Shaw angie Kenix3
parent 961913f18f
commit dcf44596d2
181 changed files with 4953 additions and 3658 deletions
+1 -1
View File
@@ -92,7 +92,7 @@
#define SEGMENT_ADDR(num, off) (((num) << 24) + (off))
#ifndef NULL
#define NULL 0
#define NULL ((void*)0)
#endif
#endif /* !_MBI_H_ */
+259 -238
View File
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -139,7 +139,8 @@ typedef struct {
/* 0x01 */ u8 txsize;
/* 0x02 */ u8 rxsize;
/* 0x03 */ u8 cmd;
/* 0x04 */ u16 address;
/* 0x04 */ u8 hi;
/* 0x05 */ u8 lo;
/* 0x06 */ u8 data[32];
/* 0x26 */ u8 datacrc;
} __OSContRamReadFormat;
+4 -3
View File
@@ -1,6 +1,7 @@
#ifndef _OS_H_
#define _OS_H_
#include "stdlib.h"
#include "ultra64/thread.h"
#include "ultra64/message.h"
@@ -65,7 +66,7 @@ typedef struct {
/* 0x00 */ OSIoMesgHdr hdr;
/* 0x08 */ void* dramAddr;
/* 0x0C */ u32 devAddr;
/* 0x10 */ u32 size;
/* 0x10 */ size_t size;
/* 0x14 */ OSPiHandle* piHandle;
} OSIoMesg; // size = 0x88
@@ -76,8 +77,8 @@ typedef struct {
/* 0x08 */ OSMesgQueue* cmdQueue;
/* 0x0C */ OSMesgQueue* evtQueue;
/* 0x10 */ OSMesgQueue* acsQueue;
/* 0x14 */ s32 (*piDmaCallback)(s32, u32, void*, u32);
/* 0x18 */ s32 (*epiDmaCallback)(OSPiHandle*, s32, u32, void*, u32);
/* 0x14 */ s32 (*piDmaCallback)(s32, u32, void*, size_t);
/* 0x18 */ s32 (*epiDmaCallback)(OSPiHandle*, s32, u32, void*, size_t);
} OSDevMgr; // size = 0x1C
+10
View File
@@ -6,4 +6,14 @@ typedef struct {
/* 0x04 */ OSMesg msg;
} __osHwInt; // size = 0x08
typedef struct {
/* 0x00 */ u32 initialized;
/* 0x04 */ OSThread* mgrThread;
/* 0x08 */ OSMesgQueue* cmdQueue;
/* 0x0C */ OSMesgQueue* eventQueue;
/* 0x10 */ OSMesgQueue* accessQueue;
/* 0x14 */ s32 (*piDmaCallback)(s32, u32, void*, size_t);
/* 0x18 */ s32 (*epiDmaCallback)(OSPiHandle*, s32, u32, void*, size_t);
} OSMgrArgs; // size = 0x1C
#endif
+1 -1
View File
@@ -18,7 +18,7 @@ typedef struct {
/* 0x8 */ long long rem;
} lldiv_t;
typedef unsigned int size_t;
typedef unsigned long size_t;
typedef int ssize_t;
-7
View File
@@ -1,7 +0,0 @@
#ifndef _STRING_H_
#define _STRING_H_
#define NULL 0
typedef unsigned int size_t;
#endif
+27 -36
View File
@@ -30,8 +30,8 @@ extern vs32 gIrqMgrResetStatus;
extern volatile OSTime sIrqMgrResetTime;
extern volatile OSTime sIrqMgrRetraceTime;
extern s32 sIrqMgrRetraceCount;
extern char* D_80096B80[18];
extern char* sExceptionNames[6];
extern const char* sCpuExceptions[18];
extern const char* sFpuExceptions[6];
extern FaultDrawer* sFaultDrawContext;
extern FaultDrawer sFaultDrawerDefault;
// extern UNK_TYPE4 D_80096C20;
@@ -67,8 +67,8 @@ extern OSPiHandle* __osPiTable;
extern OSPiHandle* __osCurrentHandle[];
extern UNK_TYPE4 __osPiAccessQueueEnabled;
extern OSViMode osViModeNtscHpn1;
// extern UNK_TYPE4 D_80097F00;
// extern UNK_TYPE1 D_80097F04;
extern s32 __osPfsInodeCacheChannel;
extern u8 __osPfsInodeCacheBank;
extern UNK_TYPE4 D_80097F10;
extern char spaces[];
extern char zeroes[];
@@ -207,8 +207,8 @@ extern char D_80098A00[];
extern char D_80098A0C[];
extern char D_80098A1C[];
extern char D_80098A20[34];
extern char D_80098A44[];
extern char D_80098A68[];
extern const char D_80098A44[];
extern const char D_80098A68[];
extern char D_80098A88[53];
extern char D_80098AC0[49];
extern char D_80098AF4[51];
@@ -218,7 +218,7 @@ extern char D_80098B68[];
extern char D_80098B84[];
extern char D_80098BA0[];
extern char D_80098BBC[];
extern char faultThreadName[];
extern const char faultThreadName[];
extern char D_80098BE0[];
extern char D_80098BF8[];
extern char D_80098BFC[];
@@ -230,15 +230,14 @@ extern char D_80098C2C[];
extern char D_80098C34[];
extern char D_80098C38[];
extern char D_80098C40[];
extern u8 sFaultDrawerFont[8][128];
extern char D_80099050[];
extern char D_80099054[];
extern char D_8009905C[];
extern char D_80099064[];
extern char D_80099070[];
extern char D_80099078[];
extern char D_8009907C[];
extern char D_80099080[];
extern const char D_80099078[];
extern const char D_8009907C[];
extern const char D_80099080[];
extern char D_800990B0[];
extern f32 D_800990C0[9];
extern f32 D_800990E4;
@@ -325,10 +324,10 @@ extern FaultDrawer sFaultDrawerStruct;
// extern Arena gSystemArena;
extern u32 sRandFloat;
// extern UNK_TYPE4 sArenaLockMsg;
// extern OSTask tmp_task;
// extern UNK_TYPE1 D_8009CDB0;
// extern OSMesg siAccessBuf[1];
// extern OSMesgQueue __osSiAccessQueue;
extern OSTask tmp_task;
extern OSPifRam osPifBuffers[4];
extern OSMesg siAccessBuf[1];
extern OSMesgQueue __osSiAccessQueue;
extern OSPifRam __osContPifRam;
// extern UNK_TYPE1 D_8009CF0C;
extern u8 __osContLastCmd;
@@ -1673,7 +1672,7 @@ extern UNK_PTR D_801D1540;
// extern f32 sFactorialTbl[13];
extern Vec3f D_801D15B0;
extern Vec3s D_801D15BC;
extern RSPMatrix D_801D1DE0;
extern Mtx D_801D1DE0;
extern MtxF D_801D1E20;
extern UNK_PTR D_801D1E60;
extern UNK_PTR D_801D1E64;
@@ -3263,7 +3262,6 @@ extern TriNorm D_801EF590;
extern TriNorm D_801EF5C8;
extern TriNorm D_801EF600;
extern TriNorm D_801EF638;
// extern UNK_TYPE1 D_801EF66D;
extern SaveContext gSaveContext;
// extern UNK_TYPE2 D_801F3F38;
// extern UNK_TYPE1 D_801F3F3A;
@@ -3344,7 +3342,7 @@ extern s16 D_801F4E7A;
// extern UNK_TYPE1 D_801F4F68;
// extern UNK_TYPE1 D_801F4F6A;
extern LightsBuffer sLightsBuffer;
extern Arena mainHeap;
extern Arena sZeldaArena;
// extern UNK_TYPE1 D_801F5130;
// extern UNK_TYPE1 D_801F5270;
// extern UNK_TYPE1 D_801F528E;
@@ -3368,13 +3366,6 @@ extern Arena mainHeap;
// extern UNK_TYPE1 D_801F59F0;
// extern UNK_TYPE1 D_801F59F4;
// extern UNK_TYPE1 D_801F59F8;
// extern QuakeRequest sQuakeRequest[4];
// extern Quake2Context sQuake2Context;
// extern s32 sMatAnimStep;
// extern u32 sMatAnimFlags;
// extern f32 sMatAnimAlphaRatio;
extern s32 D_801F5AB0;
extern s32 D_801F5AB4;
// extern UNK_TYPE1 D_801F5AC0;
// extern UNK_TYPE1 D_801F69D0;
// extern UNK_TYPE1 D_801F6A10;
@@ -3437,19 +3428,19 @@ extern FaultClient graphFaultClient;
extern Gfx* graphDlEntry;
// extern UNK_TYPE1 D_801F80F8;
extern u64 lastRenderFrameTimestamp;
extern OSMesgQueue siEventCallbackQueue;
extern OSMesg siEventCallbackBuffer[1];
extern OSMesgQueue sSiIntMsgQ;
extern OSMesg sSiIntMsgBuf[1];
extern u32 gSegments[NUM_SEGMENTS];
extern SchedContext gSchedContext;
extern IrqMgrClient mainIrqmgrCallbackNode;
extern OSMesgQueue mainIrqmgrCallbackQueue;
extern OSMesg mainIrqCallbackBuffer[60];
extern OSThread graphOSThread;
extern u8 graphStack[0x1800];
extern u8 schedStack[0x600];
extern u8 audioStack[0x800];
extern u8 padmgrStack[0x500];
extern StackEntry graphStackEntry;
extern IrqMgrClient irqClient;
extern OSMesgQueue irqMgrMsgQ;
extern OSMesg irqMgrMsgBuf[60];
extern OSThread sGraphThread;
extern u8 sGraphStack[6144];
extern u8 schedStack[1536];
extern u8 audioStack[2048];
extern u8 padmgrStack[1280];
extern StackEntry sGraphStackInfo;
extern StackEntry schedStackEntry;
extern StackEntry audioStackEntry;
extern StackEntry padmgrStackEntry;
+27 -26
View File
@@ -308,7 +308,7 @@ typedef struct GraphicsContext {
/* 0x1B4 */ Gfx* unk1B4;
/* 0x1B8 */ TwoHeadGfxArena unk1B8;
/* 0x1C8 */ UNK_TYPE1 pad1C8[0xAC];
/* 0x274 */ OSViMode* unk274;
/* 0x274 */ OSViMode* viMode;
/* 0x278 */ void* zbuffer;
/* 0x27C */ UNK_TYPE1 pad27C[0x1C];
/* 0x298 */ TwoHeadGfxArena overlay;
@@ -410,13 +410,13 @@ typedef struct {
/* 0xC */ s32 rightX;
} Viewport; // size = 0x10
typedef void*(*fault_address_converter_func)(void* addr, void* arg);
typedef void*(*FaultAddrConvFunc)(void* addr, void* arg);
typedef void(*fault_client_func)(void* arg1, void* arg2);
typedef void(*osCreateThread_func)(void*);
typedef void* (*PrintCallback)(void*, const char*, u32);
typedef void* (*PrintCallback)(void*, const char*, size_t);
typedef enum {
SLOWLY_CALLBACK_NO_ARGS,
@@ -991,7 +991,7 @@ typedef struct {
typedef struct ArenaNode_t {
/* 0x0 */ s16 magic; // Should always be 0x7373
/* 0x2 */ s16 isFree;
/* 0x4 */ u32 size;
/* 0x4 */ size_t size;
/* 0x8 */ struct ArenaNode_t* next;
/* 0xC */ struct ArenaNode_t* prev;
} ArenaNode; // size = 0x10
@@ -1009,7 +1009,7 @@ typedef struct FaultAddrConvClient FaultAddrConvClient;
struct FaultAddrConvClient {
/* 0x0 */ FaultAddrConvClient* next;
/* 0x4 */ fault_address_converter_func callback;
/* 0x4 */ FaultAddrConvFunc callback;
/* 0x8 */ void* param;
}; // size = 0xC
@@ -1044,46 +1044,47 @@ typedef struct FireObj FireObj;
typedef struct FireObjLight FireObjLight;
typedef struct GameAlloc GameAlloc;
typedef struct GameAllocNode {
/* 0x0 */ struct GameAllocNode* next;
/* 0x4 */ struct GameAllocNode* prev;
/* 0x8 */ size_t size;
/* 0xC */ u32 unk_0C;
} GameAllocEntry; // size = 0x10
typedef struct PreNMIContext PreNMIContext;
typedef struct GameAllocNode GameAllocNode;
struct GameAllocNode {
/* 0x0 */ GameAllocNode* next;
/* 0x4 */ GameAllocNode* prev;
/* 0x8 */ u32 size;
/* 0xC */ UNK_TYPE1 padC[0x4];
}; // size = 0x10
struct GameAlloc {
/* 0x00 */ GameAllocNode base;
/* 0x10 */ GameAllocNode* head;
}; // size = 0x14
typedef struct GameAlloc {
/* 0x00 */ GameAllocEntry base;
/* 0x10 */ GameAllocEntry* head;
} GameAlloc; // size = 0x14
struct GameState {
/* 0x00 */ GraphicsContext* gfxCtx;
/* 0x04 */ GameStateFunc main;
/* 0x08 */ GameStateFunc destroy;
/* 0x0C */ GameStateFunc nextGameStateInit;
/* 0x10 */ u32 nextGameStateSize;
/* 0x10 */ size_t nextGameStateSize;
/* 0x14 */ Input input[4];
/* 0x74 */ TwoHeadArena heap;
/* 0x84 */ GameAlloc alloc;
/* 0x98 */ UNK_TYPE1 pad98[0x3];
/* 0x9B */ u8 running; // If 0, switch to next game state
/* 0x9C */ u32 frames;
/* 0xA0 */ UNK_TYPE1 padA0[0x2];
/* 0xA0 */ u8 padA0[0x2];
/* 0xA2 */ u8 framerateDivisor; // game speed?
/* 0xA3 */ UNK_TYPE1 unkA3;
}; // size = 0xA4
struct PreNMIContext {
typedef struct PreNMIContext {
/* 0x00 */ GameState state;
/* 0xA4 */ u32 timer;
/* 0xA8 */ UNK_TYPE4 unkA8;
}; // size = 0xAC
} PreNMIContext; // size = 0xAC
typedef struct {
/* 0x00 */ u32 resetting;
/* 0x04 */ u32 resetCount;
/* 0x08 */ OSTime duration;
/* 0x10 */ OSTime resetTime;
} PreNmiBuff; // size = 0x18 (actually osAppNmiBuffer is 0x40 bytes large but the rest is unused)
typedef struct GlobalContext GlobalContext;
@@ -1266,7 +1267,7 @@ typedef struct {
/* 0x024 */ UNK_TYPE4 unk24;
/* 0x028 */ OSMesg lockMesg[1];
/* 0x02C */ OSMesg interrupts[8];
/* 0x04C */ OSMesgQueue siEventCallbackQueue;
/* 0x04C */ OSMesgQueue sSiIntMsgQ;
/* 0x064 */ OSMesgQueue lock;
/* 0x07C */ OSMesgQueue irqmgrCallbackQueue;
/* 0x094 */ IrqMgrClient irqmgrCallbackQueueNode;
+9 -5
View File
@@ -141,7 +141,7 @@ typedef struct {
/* 0x10 */ f32 shadowScale; // Changes the size of the shadow
/* 0x14 */ u8 shadowAlpha; // Default is 255
/* 0x15 */ u8 feetFloorFlags; // Set if the actor's foot is clipped under the floor. & 1 is right foot, & 2 is left
/* 0x18 */ Vec3f feetPos[2]; // Update by using `Actor_SetFeetPos` in PostLimbDraw
/* 0x18 */ Vec3f feetPos[2]; // Update by using `Actor_SetFeetPos` in PostLimbDrawOpa
} ActorShape; // size = 0x30
typedef struct Actor {
@@ -289,12 +289,16 @@ typedef struct EnItem00 {
/* 0x1A4 */ s8 unk1A4;
} EnItem00; // size = 0x1A8
typedef struct {
/* 0x000 */ Actor base;
/* 0x144 */ ActorFunc update;
struct EnAObj;
typedef void (*EnAObjActionFunc)(struct EnAObj*, struct GlobalContext*);
typedef struct EnAObj {
/* 0x000 */ Actor actor;
/* 0x144 */ EnAObjActionFunc actionFunc;
/* 0x148 */ ColliderCylinder collision;
/* 0x194 */ UNK_TYPE1 pad194[0x14];
} ActorEnAObj; // size = 0x1A8
} EnAObj; // size = 0x1A8
typedef enum {
/* 0x00 */ ACTORCAT_SWITCH,
+131 -111
View File
@@ -6,196 +6,216 @@
#include "z64dma.h"
#include "z64math.h"
struct GlobalContext;
struct Actor;
struct SkelAnime;
#define LINK_ANIMETION_OFFSET(addr, offset) \
(SEGMENT_ROM_START(link_animetion) + ((u32)addr & 0xFFFFFF) + ((u32)offset))
#define LIMB_DONE 0xFF
#define ANIMATION_ENTRY_MAX 50
#define ANIM_FLAG_UPDATEXZ 0x02
#define ANIM_FLAG_UPDATEY 0x10
#define ANIM_FLAG_UPDATEY (1 << 1)
#define ANIM_FLAG_NOMOVE (1 << 4)
struct GlobalContext;
struct Actor;
typedef struct SkelAnime SkelAnime;
typedef enum {
/* 0 */ ANIMMODE_LOOP,
/* 1 */ ANIMMODE_LOOP_INTERP,
/* 2 */ ANIMMODE_ONCE,
/* 3 */ ANIMMODE_ONCE_INTERP,
/* 4 */ ANIMMODE_LOOP_PARTIAL,
/* 5 */ ANIMMODE_LOOP_PARTIAL_INTERP
} AnimationModes;
typedef enum {
/* -1 */ ANIMTAPER_DECEL = -1,
/* 0 */ ANIMTAPER_NONE,
/* 1 */ ANIMTAPER_ACCEL
} AnimationTapers;
typedef struct {
/* 0x000 */ Vec3s translation; // Translation relative to parent limb. root limb is a tranlation for entire model.
/* 0x006 */ u8 firstChildIndex; // The first child's index into the limb table.
/* 0x007 */ u8 nextLimbIndex; // The parent limb's next limb index into the limb table.
/* 0x008 */ Gfx* displayLists[1]; // Display lists for the limb. Index 0 is the normal display list, index 1 is the
// far model display list.
} StandardLimb; // Size = 0xC
/* 0x00 */ Vec3s jointPos; // Root is position in model space, children are relative to parent
/* 0x06 */ u8 child; // The first child's index into the limb table.
/* 0x07 */ u8 sibling; // The parent limb's next limb index into the limb table.
/* 0x08 */ Gfx* dList; // Display lists for the limb. Index 0 is the normal display list, index 1 is the
// far model display list.
} StandardLimb; // size = 0xC
// Model has limbs with only rigid meshes
typedef struct {
/* 0x000 */ void** skeletonSeg; // Segment address of SkelLimbIndex.
/* 0x004 */ u8 limbCount; // Number of limbs in the model.
/* 0x00 */ Vec3s jointPos; // Root is position in model space, children are relative to parent
/* 0x06 */ u8 child;
/* 0x07 */ u8 sibling;
/* 0x08 */ Gfx* dLists[2]; // Near and far
} LodLimb; // size = 0x10
// Model has limbs with only rigid meshes
typedef struct {
/* 0x00 */ void** segment;
/* 0x04 */ u8 limbCount;
} SkeletonHeader; // size = 0x8
// Model has limbs with flexible meshes
typedef struct {
/* 0x000 */ SkeletonHeader sh;
/* 0x008 */ u8 dListCount; // Number of display lists in the model.
/* 0x00 */ SkeletonHeader sh;
/* 0x08 */ u8 dListCount;
} FlexSkeletonHeader; // size = 0xC
typedef s16 AnimationRotationValue;
// Index into the frame data table.
typedef struct {
/* 0x000 */ u16 x;
/* 0x002 */ u16 y;
/* 0x004 */ u16 z;
/* 0x00 */ u16 x;
/* 0x02 */ u16 y;
/* 0x04 */ u16 z;
} JointIndex; // size = 0x06
typedef struct {
/* 0x000 */ s16 frameCount;
/* 0x002 */ s16 unk02;
} AnimationHeaderCommon; // size = 0x4
/* 0x00 */ s16 frameCount;
} AnimationHeaderCommon;
typedef struct {
/* 0x00 */ AnimationHeaderCommon common;
/* 0x04 */ s16* frameData; // referenced as tbl
/* 0x08 */ JointIndex* jointIndices; // referenced as ref_tbl
/* 0x0C */ u16 staticIndexMax;
/* 0x000 */ AnimationHeaderCommon common;
/* 0x004 */ s16* frameData; // referenced as tbl
/* 0x008 */ JointIndex* jointIndices; // referenced as ref_tbl
/* 0x00C */ u16 staticIndexMax;
} AnimationHeader; // size = 0x10
typedef struct {
/* 0x00 */ s16 xMax;
/* 0x02 */ s16 x;
/* 0x04 */ s16 yMax;
/* 0x06 */ s16 y;
/* 0x08 */ s16 zMax;
/* 0x10 */ s16 z;
} JointKey; // size = 0x12
typedef struct {
/* 0x00 */ s16 frameCount;
/* 0x02 */ s16 limbCount;
/* 0x04 */ s16* frameData;
/* 0x08 */ JointKey* jointKey;
} LegacyAnimationHeader; // size = 0xC
typedef enum {
ANIMATION_LINKANIMETION,
ANIMATION_TYPE1,
ANIMATION_TYPE2,
ANIMATION_TYPE3,
ANIMATION_TYPE4,
ANIMATION_TYPE5
ANIMENTRY_COPYALL,
ANIMENTRY_INTERP,
ANIMENTRY_COPYTRUE,
ANIMENTRY_COPYFALSE,
ANIMENTRY_MOVEACTOR
} AnimationType;
typedef struct {
/* 0x000 */ DmaRequest req;
/* 0x020 */ OSMesgQueue msgQueue;
/* 0x038 */ OSMesg msg;
} AnimationEntryType0; // size = 0x3C
} AnimEntryLoadFrame; // size = 0x3C
typedef struct {
/* 0x000 */ u8 unk00;
/* 0x000 */ u8 queueFlag;
/* 0x001 */ u8 vecCount;
/* 0x004 */ Vec3s* dst;
/* 0x008 */ Vec3s* src;
} AnimationEntryType1; // size = 0xC
} AnimEntryCopyAll; // size = 0xC
typedef struct {
/* 0x000 */ u8 unk00;
/* 0x001 */ u8 limbCount;
/* 0x004 */ Vec3s* unk04;
/* 0x008 */ Vec3s* unk08;
/* 0x00C */ f32 unk0C;
} AnimationEntryType2; // size = 0x10
/* 0x000 */ u8 queueFlag;
/* 0x001 */ u8 vecCount;
/* 0x004 */ Vec3s* base;
/* 0x008 */ Vec3s* mod;
/* 0x00C */ f32 weight;
} AnimEntryInterp; // size = 0x10
typedef struct {
/* 0x000 */ u8 unk00;
/* 0x000 */ u8 queueFlag;
/* 0x001 */ u8 vecCount;
/* 0x004 */ Vec3s* dst;
/* 0x008 */ Vec3s* src;
/* 0x00C */ u8* index;
} AnimationEntryType3; // size = 0x10
/* 0x00C */ u8* copyFlag;
} AnimEntryCopyTrue; // size = 0x10
typedef struct {
/* 0x000 */ u8 unk00;
/* 0x000 */ u8 queueFlag;
/* 0x001 */ u8 vecCount;
/* 0x002 */ char unk02[0x2];
/* 0x004 */ Vec3s* dst;
/* 0x008 */ Vec3s* src;
/* 0x00C */ u8* index;
} AnimationEntryType4; // size = 0x10
/* 0x00C */ u8* copyFlag;
} AnimEntryCopyFalse; // size = 0x10
typedef struct {
/* 0x000 */ struct Actor* actor;
/* 0x004 */ SkelAnime* skelAnime;
/* 0x004 */ struct SkelAnime* skelAnime;
/* 0x008 */ f32 unk08;
} AnimationEntryType5; // size = 0xC
typedef struct {
/* 0x000 */ u8 raw[0x3C];
} AnimationEntryRaw; // size = 0x3C
} AnimEntryMoveActor; // size = 0xC
typedef union {
AnimationEntryRaw raw;
AnimationEntryType0 type0;
AnimationEntryType1 type1;
AnimationEntryType2 type2;
AnimationEntryType3 type3;
AnimationEntryType4 type4;
AnimationEntryType5 type5;
} AnimationEntryType; // size = 0x3C
AnimEntryLoadFrame load;
AnimEntryCopyAll copy;
AnimEntryInterp interp;
AnimEntryCopyTrue copy1;
AnimEntryCopyFalse copy0;
AnimEntryMoveActor move;
} AnimationEntryData; // size = 0x3C
typedef struct {
/* 0x000 */ u8 type;
/* 0x001 */ u8 unk01;
/* 0x004 */ AnimationEntryType types;
/* 0x004 */ AnimationEntryData data;
} AnimationEntry; // size = 0x40
typedef struct AnimationContext {
/* 0x000 */ s16 animationCount;
/* 0x002 */ char unk02[2];
/* 0x004 */ AnimationEntry entries[ANIMATION_ENTRY_MAX];
} AnimationContext; // size = 0xC84
typedef struct {
/* 0x00 */ AnimationHeaderCommon common;
/* 0x04 */ u32 segment;
/* 0x000 */ AnimationHeaderCommon common;
/* 0x004 */ u32 segment;
} LinkAnimationHeader; // size = 0x8
struct SkelAnime {
/* 0x00 */ u8 limbCount; // joint_Num
/* modes 0 and 1 repeat the animation indefinitely
* modes 2 and 3 play the animaton once then stop
* modes >= 4 play the animation once, and always start at frame 0.
*/
/* 0x01 */ u8 mode;
/* 0x02 */ u8 dListCount;
/* 0x03 */ s8 unk03;
typedef struct SkelAnime {
/* 0x00 */ u8 limbCount; // Number of limbs in the skeleton
/* 0x01 */ u8 mode; // 0: loop, 2: play once, 4: partial loop. +1 to interpolate between frames.
/* 0x02 */ u8 dListCount; // Number of display lists in a flexible skeleton
/* 0x03 */ s8 taper; // Tapering to use when morphing between animations. Only used by Door_Warp1.
/* 0x04 */ void** skeleton; // An array of pointers to limbs. Can be StandardLimb, LodLimb, or SkinLimb.
/* 0x08 */
union {
AnimationHeader* animCurrentSeg;
LinkAnimationHeader* linkAnimetionSeg;
AnimationHeaderCommon* genericSeg;
};
/* 0x0C */ f32 initialFrame;
/* 0x10 */ f32 animFrameCount;
/* 0x14 */ f32 totalFrames;
/* 0x18 */ f32 animCurrentFrame;
/* 0x1C */ f32 animPlaybackSpeed;
/* 0x20 */ Vec3s* limbDrawTbl; // now_joint
/* 0x24 */ Vec3s* transitionDrawTbl; // morf_joint
/* 0x28 */ f32 transCurrentFrame;
/* 0x2C */ f32 transitionStep;
/* 0x30 */ s32 (*animUpdate)();
/* 0x34 */ s8 initFlags;
/* 0x35 */ u8 flags;
/* 0x36 */ s16 prevFrameRot;
/* 0x38 */ Vec3s prevFramePos;
/* 0x3E */ Vec3s unk3E;
}; // size = 0x44
/* 0x08 */ void* animation; // Can be an AnimationHeader or LinkAnimationHeader.
/* 0x0C */ f32 startFrame; // In mode 4, start of partial loop.
/* 0x10 */ f32 endFrame; // In mode 2, Update returns true when curFrame is equal to this. In mode 4, end of partial loop.
/* 0x14 */ f32 animLength; // Total number of frames in the current animation's file.
/* 0x18 */ f32 curFrame; // Current frame in the animation
/* 0x1C */ f32 playSpeed; // Multiplied by R_UPDATE_RATE / 3 to get the animation's frame rate.
/* 0x20 */ Vec3s* jointTable; // Current translation of model and rotations of all limbs
/* 0x24 */ Vec3s* morphTable; // Table of values used to morph between animations
/* 0x28 */ f32 morphWeight; // Weight of the current animation morph as a fraction in [0,1]
/* 0x2C */ f32 morphRate; // Reciprocal of the number of frames in the morph
/* 0x30 */ s32 (*update)(); // Can be Loop, Partial loop, Play once, Morph, or Tapered morph. Link only has Loop, Play once, and Morph
/* 0x34 */ s8 initFlags; // Flags used when initializing Link's skeleton
/* 0x35 */ u8 moveFlags; // Flags used for animations that move the actor in worldspace.
/* 0x36 */ s16 prevRot; // Previous rotation in worldspace.
/* 0x38 */ Vec3s prevTransl; // Previous modelspace translation.
/* 0x3E */ Vec3s baseTransl; // Base modelspace translation.
} SkelAnime; // size = 0x44
typedef s32 (*OverrideLimbDraw)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
typedef s32 (*OverrideLimbDrawOpa)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
struct Actor* actor);
typedef void (*PostLimbDrawOpa)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot,
struct Actor* actor);
typedef s32 (*OverrideLimbDraw)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
struct Actor* actor, Gfx** gfx);
typedef void (*PostLimbDraw)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot,
struct Actor* actor);
struct Actor* actor, Gfx** gfx);
typedef s32 (*OverrideLimbDraw2)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
struct Actor* actor, Gfx** gfx);
typedef s32 (*OverrideLimbDrawFlex)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
struct Actor* actor);
typedef void (*PostLimbDraw2)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot,
struct Actor* actor, Gfx** gfx);
typedef s32 (*OverrideLimbDrawSV)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
struct Actor* actor);
typedef void (*PostLimbDrawSV)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList1, Gfx** dList2, Vec3s* rot,
struct Actor* actor);
typedef void (*PostLimbDrawFlex)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList1, Gfx** dList2, Vec3s* rot,
struct Actor* actor);
typedef void (*UnkActorDraw)(struct GlobalContext* globalCtx, s32 limbIndex, struct Actor* actor);
typedef void (*AnimationEntryCallback)(struct GlobalContext*, AnimationEntryType*);
typedef void (*AnimationEntryCallback)(struct GlobalContext*, AnimationEntryData*);
extern u32 link_animetion_segment;
+27 -6
View File
@@ -274,16 +274,37 @@ typedef struct {
/* 0x8 */ s32 size;
} EffectSsInfo; // size = 0xC
typedef struct {
/* 0x0 */ EffectSs* data_table; // Name from debug assert
/* 0x4 */ s32 searchIndex;
/* 0x8 */ s32 size;
} EffectTableInfo; // size = 0xC
typedef struct {
/* 0x0 */ UNK_TYPE4 unk0;
/* 0x4 */ EffectSsInitFunc init;
} ParticleOverlayInfo; // size = 0x8
typedef struct {
/* 0x00 */ u32 vromStart;
/* 0x04 */ u32 vromEnd;
/* 0x08 */ void* vramStart;
/* 0x0C */ void* vramEnd;
/* 0x10 */ void* loadedRamAddr;
/* 0x14 */ ParticleOverlayInfo* overlayInfo;
/* 0x18 */ u32 unk18; // Always 0x01000000?
} ParticleOverlay; // size = 0x1C
typedef enum {
/* 0x00 */ EFFECT_SS_DUST,
/* 0x01 */ EFFECT_SS_KIRAKIRA,
/* 0x02 */ EFFECT_SS_UNSET_02,
/* 0x02 */ EFFECT_SS_UNSET_02, // Deleted
/* 0x03 */ EFFECT_SS_BOMB2,
/* 0x04 */ EFFECT_SS_BLAST,
/* 0x05 */ EFFECT_SS_G_SPK,
/* 0x06 */ EFFECT_SS_D_FIRE,
/* 0x07 */ EFFECT_SS_BUBBLE,
/* 0x08 */ EFFECT_SS_UNSET_08,
/* 0x08 */ EFFECT_SS_UNSET_08, // Deleted
/* 0x09 */ EFFECT_SS_G_RIPPLE,
/* 0x0A */ EFFECT_SS_G_SPLASH,
/* 0x0B */ EFFECT_SS_UNSET_0B,
@@ -293,8 +314,8 @@ typedef enum {
/* 0x0F */ EFFECT_SS_HAHEN,
/* 0x10 */ EFFECT_SS_STICK,
/* 0x11 */ EFFECT_SS_SIBUKI,
/* 0x12 */ EFFECT_SS_UNSET_12,
/* 0x13 */ EFFECT_SS_UNSET_13,
/* 0x12 */ EFFECT_SS_UNSET_12, // Deleted
/* 0x13 */ EFFECT_SS_UNSET_13, // Deleted
/* 0x14 */ EFFECT_SS_STONE1,
/* 0x15 */ EFFECT_SS_HITMARK,
/* 0x16 */ EFFECT_SS_FHG_FLASH,
@@ -306,11 +327,11 @@ typedef enum {
/* 0x1C */ EFFECT_SS_FIRE_TAIL,
/* 0x1D */ EFFECT_SS_EN_FIRE,
/* 0x1E */ EFFECT_SS_EXTRA,
/* 0x1F */ EFFECT_SS_UNSET_1F,
/* 0x1F */ EFFECT_SS_UNSET_1F, // Deleted
/* 0x20 */ EFFECT_SS_DEAD_DB,
/* 0x21 */ EFFECT_SS_DEAD_DD,
/* 0x22 */ EFFECT_SS_DEAD_DS,
/* 0x23 */ EFFECT_SS_UNSET_23,
/* 0x23 */ EFFECT_SS_UNSET_23, // Deleted
/* 0x24 */ EFFECT_SS_ICE_SMOKE,
/* 0x25 */ EFFECT_EN_ICE_BLOCK,
/* 0x26 */ EFFECT_SS_SBN,
+2 -2
View File
@@ -215,8 +215,8 @@ typedef struct {
} SCmdMinimapChests;
typedef struct {
/* 0x0 */ u32 opaqueDl;
/* 0x4 */ u32 translucentDl;
/* 0x0 */ Gfx* opaqueDl;
/* 0x4 */ Gfx* translucentDl;
} RoomMeshType0Params; // size = 0x8
// Fields TODO
+2 -3
View File
@@ -25,7 +25,6 @@ beginseg
include "build/src/boot_O2_g3/CIC6105.o"
include "build/src/boot_O2_g3/syncprintf.o"
include "build/src/boot_O2_g3/fault.o"
include "build/data/boot/fault.data.o"
include "build/data/boot/fault.bss.o"
include "build/src/boot_O2_g3/fault_drawer.o"
include "build/data/boot/fault_drawer.bss.o"
@@ -491,7 +490,7 @@ beginseg
include "build/src/code/code_800F12D0.o"
include "build/src/code/z_eventmgr.o"
include "build/data/code/z_eventmgr.bss.o"
include "build/src/code/code_800F23E0.o"
include "build/src/code/z_fcurve_data.o"
include "build/src/code/z_fcurve_data_skelanime.o"
include "build/data/code/code_801BD830.data.o"
include "build/src/code/z_fireobj.o"
@@ -528,7 +527,7 @@ beginseg
include "build/data/code/z_parameter.data.o"
include "build/data/code/z_parameter.bss.o"
include "build/src/code/z_path.o"
include "build/src/code/code_80122660.o"
include "build/src/code/z_pause.o"
include "build/src/code/z_player_lib.o"
include "build/data/code/z_player_lib.data.o"
include "build/data/code/z_player_lib.bss.o"
+5
View File
@@ -0,0 +1,5 @@
#include "global.h"
void osViExtendVStart(u32 a0) {
__additional_scanline = a0;
}
+4 -4
View File
@@ -45,7 +45,7 @@ ArenaNode* ArenaImpl_GetLastBlock(Arena* arena) {
return last;
}
void __osMallocInit(Arena* arena, void* start, u32 size) {
void __osMallocInit(Arena* arena, void* start, size_t size) {
bzero(arena, sizeof(*arena));
ArenaImpl_LockInit(arena);
__osMallocAddBlock(arena, start, size);
@@ -91,7 +91,7 @@ u8 __osMallocIsInitalized(Arena* arena) {
return arena->isInit;
}
void* __osMalloc(Arena* arena, u32 size) {
void* __osMalloc(Arena* arena, size_t size) {
ArenaNode* iter;
ArenaNode* newNode;
void* alloc;
@@ -134,7 +134,7 @@ void* __osMalloc(Arena* arena, u32 size) {
return alloc;
}
void* __osMallocR(Arena* arena, u32 size) {
void* __osMallocR(Arena* arena, size_t size) {
ArenaNode* iter;
ArenaNode* newNode;
u32 blockSize;
@@ -219,7 +219,7 @@ end:
#pragma GLOBAL_ASM("asm/non_matchings/boot/__osMalloc/__osRealloc.s")
void __osAnalyzeArena(Arena* arena, u32* outMaxFree, u32* outFree, u32* outAlloc) {
void __osAnalyzeArena(Arena* arena, size_t* outMaxFree, size_t* outFree, size_t* outAlloc) {
ArenaNode* iter;
ArenaImpl_Lock(arena);
+1 -1
View File
@@ -1,6 +1,6 @@
#include "global.h"
void* __osMemset(void* ptr, s32 val, u32 size) {
void* __osMemset(void* ptr, s32 val, size_t size) {
u8* dst = ptr;
register s32 rem;
+3 -3
View File
@@ -71,7 +71,7 @@ void Load2_Relocate(u32 allocatedVRamAddr, OverlayRelocationSection* overlayInfo
s32 Load2_LoadOverlay(u32 vRomStart, u32 vRomEnd, u32 vRamStart, u32 vRamEnd, u32 allocatedVRamAddr) {
int nbytes;
u32 pad;
u32 size;
size_t size;
void* end;
OverlayRelocationSection* overlayInfo;
@@ -106,9 +106,9 @@ s32 Load2_LoadOverlay(u32 vRomStart, u32 vRomEnd, u32 vRamStart, u32 vRamEnd, u3
#pragma GLOBAL_ASM("asm/non_matchings/boot/loadfragment2/Load2_LoadOverlay.s")
#endif
void* Load2_AllocateAndLoad(u32 vRomStart, u32 vRomEnd, u32 vRamStart, u32 vRamEnd) {
void* Overlay_AllocateAndLoad(u32 vRomStart, u32 vRomEnd, u32 vRamStart, u32 vRamEnd) {
void* allocatedVRamAddr;
u32 size;
size_t size;
size = vRamEnd - vRamStart;
allocatedVRamAddr = SystemArena_MallocR(size);
+7 -7
View File
@@ -2,15 +2,15 @@
Arena gSystemArena;
void* SystemArena_Malloc(u32 size) {
void* SystemArena_Malloc(size_t size) {
return __osMalloc(&gSystemArena, size);
}
void* SystemArena_MallocR(u32 size) {
void* SystemArena_MallocR(size_t size) {
return __osMallocR(&gSystemArena, size);
}
void* SystemArena_Realloc(void* oldPtr, u32 newSize) {
void* SystemArena_Realloc(void* oldPtr, size_t newSize) {
return __osRealloc(&gSystemArena, oldPtr, newSize);
}
@@ -18,9 +18,9 @@ void SystemArena_Free(void* ptr) {
__osFree(&gSystemArena, ptr);
}
void* SystemArena_Calloc(u32 elements, u32 size) {
void* SystemArena_Calloc(u32 elements, size_t size) {
void* ptr;
u32 totalSize = elements * size;
size_t totalSize = elements * size;
ptr = __osMalloc(&gSystemArena, totalSize);
if (ptr != NULL) {
@@ -29,7 +29,7 @@ void* SystemArena_Calloc(u32 elements, u32 size) {
return ptr;
}
void SystemArena_AnalyzeArena(u32* maxFreeBlock, u32* bytesFree, u32* bytesAllocated) {
void SystemArena_AnalyzeArena(size_t* maxFreeBlock, size_t* bytesFree, size_t* bytesAllocated) {
__osAnalyzeArena(&gSystemArena, maxFreeBlock, bytesFree, bytesAllocated);
}
@@ -37,7 +37,7 @@ u32 SystemArena_CheckArena(void) {
return __osCheckArena(&gSystemArena);
}
void SystemArena_InitArena(void* start, u32 size) {
void SystemArena_InitArena(void* start, size_t size) {
__osMallocInit(&gSystemArena, start, size);
}
+37 -12
View File
@@ -1,7 +1,32 @@
#include "ultra64.h"
#include "global.h"
#include "vt.h"
#pragma GLOBAL_ASM("asm/non_matchings/boot/fault/D_800982B0.s")
// data
const char* sCpuExceptions[] = {
"Interrupt",
"TLB modification",
"TLB exception on load",
"TLB exception on store",
"Address error on load",
"Address error on store",
"Bus error on inst.",
"Bus error on data",
"System call exception",
"Breakpoint exception",
"Reserved instruction",
"Coprocessor unusable",
"Arithmetic overflow",
"Trap exception",
"Virtual coherency on inst.",
"Floating point exception",
"Watchpoint exception",
"Virtual coherency on data",
};
const char* sFpuExceptions[] = {
"Unimplemented operation", "Invalid operation", "Division by zero", "Overflow", "Underflow", "Inexact operation",
};
void Fault_SleepImpl(u32 duration) {
u64 value = (duration * OS_CPU_COUNTER) / 1000ull;
@@ -79,7 +104,7 @@ void Fault_RemoveClient(FaultClient* client) {
}
}
void Fault_AddAddrConvClient(FaultAddrConvClient* client, fault_address_converter_func callback, void* param) {
void Fault_AddAddrConvClient(FaultAddrConvClient* client, FaultAddrConvFunc callback, void* param) {
OSIntMask mask;
u32 alreadyExists = 0;
@@ -269,9 +294,9 @@ void Fault_PrintFPCR(u32 value) {
u32 flag = 0x20000;
FaultDrawer_Printf("FPCSR:%08xH ", value);
for (i = 0; i < ARRAY_COUNT(sExceptionNames); i++) {
for (i = 0; i < ARRAY_COUNT(sFpuExceptions); i++) {
if (value & flag) {
FaultDrawer_Printf("(%s)", sExceptionNames[i]);
FaultDrawer_Printf("(%s)", sFpuExceptions[i]);
break;
}
flag >>= 1;
@@ -284,9 +309,9 @@ void osSyncPrintfFPCR(u32 value) {
u32 flag = 0x20000;
osSyncPrintf("FPCSR:%08xH ", value);
for (i = 0; i < ARRAY_COUNT(sExceptionNames); i++) {
for (i = 0; i < ARRAY_COUNT(sFpuExceptions); i++) {
if (value & flag) {
osSyncPrintf("(%s)\n", sExceptionNames[i]);
osSyncPrintf("(%s)\n", sFpuExceptions[i]);
break;
}
flag >>= 1;
@@ -308,7 +333,7 @@ void Fault_PrintThreadContext(OSThread* t) {
FaultDrawer_SetCursor(0x16, 0x14);
ctx = &t->context;
FaultDrawer_Printf("THREAD:%d (%d:%s)\n", t->id, causeStrIdx, D_80096B80[causeStrIdx]);
FaultDrawer_Printf("THREAD:%d (%d:%s)\n", t->id, causeStrIdx, sCpuExceptions[causeStrIdx]);
FaultDrawer_SetCharPad(-1, 0);
FaultDrawer_Printf("PC:%08xH SR:%08xH VA:%08xH\n", (u32)ctx->pc, (u32)ctx->sr, (u32)ctx->badvaddr);
@@ -368,7 +393,7 @@ void osSyncPrintfThreadContext(OSThread* t) {
ctx = &t->context;
osSyncPrintf("\n");
osSyncPrintf("THREAD ID:%d (%d:%s)\n", t->id, causeStrIdx, D_80096B80[causeStrIdx]);
osSyncPrintf("THREAD ID:%d (%d:%s)\n", t->id, causeStrIdx, sCpuExceptions[causeStrIdx]);
osSyncPrintf("PC:%08xH SR:%08xH VA:%08xH\n", (u32)ctx->pc, (u32)ctx->sr, (u32)ctx->badvaddr);
osSyncPrintf("AT:%08xH V0:%08xH V1:%08xH\n", (u32)ctx->at, (u32)ctx->v0, (u32)ctx->v1);
@@ -444,7 +469,7 @@ void Fault_WaitForButtonCombo(void) {
} while (!CHECK_BTN_ALL(input->cur.button, BTN_DLEFT | BTN_L | BTN_R | BTN_CRIGHT));
}
void Fault_DrawMemDumpPage(char* title, u32* addr, u32 param_3) {
void Fault_DrawMemDumpPage(const char* title, u32* addr, u32 param_3) {
u32* alignedAddr;
u32* writeAddr;
s32 y;
@@ -741,9 +766,9 @@ void Fault_SetOptionsFromController3(void) {
}
if (faultCustomOptions) {
graphPC = graphOSThread.context.pc;
graphRA = graphOSThread.context.ra;
graphSP = graphOSThread.context.sp;
graphPC = sGraphThread.context.pc;
graphRA = sGraphThread.context.ra;
graphSP = sGraphThread.context.sp;
if (CHECK_BTN_ALL(input3->press.button, BTN_R)) {
faultCopyToLog = !faultCopyToLog;
FaultDrawer_SetOsSyncPrintfEnabled(faultCopyToLog);

Some files were not shown because too many files have changed in this diff Show More