mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
Decompile graph.c (#274)
* Decompiled, 1 non-matching, add some bss reordering helpers * Document stuff * Review suggestions * graphutil.c -> graphalloc.c * Try to fix fault callback warnings * Remove extra comments in GfxMasterList * char pad -> u32 pad Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * Fix gameState Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Other suggestions Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
This commit is contained in:
co-authored by
Derek Hensley
engineer124
parent
38fc110f99
commit
b1b114e142
+25
-25
@@ -53,9 +53,9 @@ void __osSyncVPrintf(const char* fmt, ...);
|
||||
void osSyncPrintf(const char* fmt, ...);
|
||||
void rmonPrintf(const char* fmt, ...);
|
||||
void Fault_SleepImpl(u32 duration);
|
||||
void Fault_AddClient(FaultClient* client, fault_client_func callback, void* param0, void* param1);
|
||||
void Fault_AddClient(FaultClient* client, void* callback, void* param0, void* param1);
|
||||
void Fault_RemoveClient(FaultClient* client);
|
||||
void Fault_AddAddrConvClient(FaultAddrConvClient* client, FaultAddrConvFunc callback, void* param);
|
||||
void Fault_AddAddrConvClient(FaultAddrConvClient* client, void* callback, void* param);
|
||||
void Fault_RemoveAddrConvClient(FaultAddrConvClient* client);
|
||||
void* Fault_ConvertAddress(void* addr);
|
||||
void Fault_Sleep(u32 duration);
|
||||
@@ -2412,7 +2412,7 @@ Gfx* Gfx_TwoTexScroll(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 wi
|
||||
Gfx* Gfx_TwoTexScrollEnvColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2, u32 x2, u32 y2, s32 width2, s32 height2, s32 r, s32 g, s32 b, s32 a);
|
||||
Gfx* Gfx_EnvColor(GraphicsContext* gfxCtx, s32 r, s32 g, s32 b, s32 a);
|
||||
Gfx* Gfx_PrimColor(GraphicsContext* gfxCtx, s32 lodfrac, s32 r, s32 g, s32 b, s32 a);
|
||||
void func_8012CF0C(GraphicsContext* gfxCtx, s32 iParm2, s32 iParm3, u8 r, u8 g, u8 b);
|
||||
void func_8012CF0C(GraphicsContext* gfxCtx, s32 clearFb, s32 clearZb, u8 r, u8 g, u8 b);
|
||||
void func_8012D374(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b);
|
||||
void func_8012D40C(f32* param_1, f32* param_2, s16* param_3);
|
||||
void Room_nop8012D510(GlobalContext* globalCtx, Room* room, UNK_PTR param_3, UNK_TYPE1 param_4);
|
||||
@@ -3176,26 +3176,26 @@ void GameState_Realloc(GameState* gameState, size_t size);
|
||||
void GameState_Init(GameState* gameState, GameStateFunc gameStateInit, GraphicsContext* gfxCtx);
|
||||
void GameState_Destroy(GameState* gameState);
|
||||
GameStateFunc GameState_GetNextStateInit(GameState* gameState);
|
||||
size_t Game_GetNextStateSize(GameState* gameState);
|
||||
size_t GameState_GetNextStateSize(GameState* gameState);
|
||||
u32 GameState_IsRunning(GameState* gameState);
|
||||
s32 GameState_GetArenaSize(GameState* gameState);
|
||||
s32 func_80173B48(GameState* gameState);
|
||||
void GameAlloc_Log(GameAlloc* heap);
|
||||
void* GameAlloc_Malloc(GameAlloc* heap, size_t size);
|
||||
void GameAlloc_Free(GameAlloc* heap, void* ptr);
|
||||
void GameAlloc_Cleanup(GameAlloc* heap);
|
||||
void GameAlloc_Init(GameAlloc* iParm1);
|
||||
// void Graph_FaultClient(void);
|
||||
void Graph_DlAlloc(TwoHeadGfxArena* dl, void* memoryBlock, size_t size);
|
||||
void Graph_InitTHGA(GraphicsContext* gfxCtx);
|
||||
void GameAlloc_Log(GameAlloc* this);
|
||||
void* GameAlloc_Malloc(GameAlloc* this, size_t size);
|
||||
void GameAlloc_Free(GameAlloc* this, void* data);
|
||||
void GameAlloc_Cleanup(GameAlloc* this);
|
||||
void GameAlloc_Init(GameAlloc* this);
|
||||
void* Graph_FaultClient(void);
|
||||
void Graph_InitTHGA(TwoHeadGfxArena* arena, Gfx* buffer, s32 size);
|
||||
void Graph_SetNextGfxPool(GraphicsContext* gfxCtx);
|
||||
GameStateOverlay* Graph_GetNextGameState(GameState* gameState);
|
||||
void* Graph_FaultAddrConvFunc(void* addr);
|
||||
void* Graph_FaultAddrConvFunc(void* address, void* param);
|
||||
void Graph_Init(GraphicsContext* gfxCtx);
|
||||
// void Graph_Destroy(void);
|
||||
void Graph_Render(GraphicsContext* gfxCtx, GameState* gameState);
|
||||
void Graph_FrameSetup(GameState* gameState);
|
||||
void Graph_RenderFrame(GraphicsContext* gfxCtx, GameState* gameState);
|
||||
void Graph_DoFrame(GraphicsContext* gfxCtx, GameState* gameState);
|
||||
void Graph_Destroy(GraphicsContext* gfxCtx);
|
||||
void Graph_TaskSet00(GraphicsContext* gfxCtx, GameState* gameState);
|
||||
void Graph_UpdateGame(GameState* gameState);
|
||||
void Graph_ExecuteAndDraw(GraphicsContext* gfxCtx, GameState* gameState);
|
||||
void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState);
|
||||
void Graph_ThreadEntry(void* arg);
|
||||
Gfx* Graph_GfxPlusOne(Gfx* gfx);
|
||||
Gfx* Graph_BranchDlist(Gfx* gfx, Gfx* dst);
|
||||
@@ -3267,10 +3267,10 @@ void func_801780F0(Mtx* param_1, f32 param_2, f32 param_3, f32 param_4, f32 para
|
||||
// void func_8017842C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10, UNK_TYPE4 param_11);
|
||||
// void func_80178750(void);
|
||||
// void func_80178818(void);
|
||||
// void func_80178978(void);
|
||||
void func_80178978(void);
|
||||
// void func_801789D4(void);
|
||||
u32* get_framebuffer(s32 index);
|
||||
// u16* get_zbuffer(void);
|
||||
u32 SysCfb_GetFbPtr(s32 index);
|
||||
u32 SysCfb_GetZBuffer(void);
|
||||
// UNK_TYPE4 func_80178A24(void);
|
||||
// void func_80178A34(void);
|
||||
s32 func_80178A94(s32 param_1, s32 param_2);
|
||||
@@ -3436,10 +3436,10 @@ void func_8018219C(MtxF* pfParm1, Vec3s* psParm2, s32 iParm3);
|
||||
// void func_801822C4(void);
|
||||
void Matrix_InsertRotationAroundUnitVector_f(f32 rotation, Vec3f* vector, s32 appendToState);
|
||||
void Matrix_InsertRotationAroundUnitVector_s(s16 rotation, Vec3f* vector, s32 appendToState);
|
||||
// void func_80182C90(void);
|
||||
// void func_80182CA0(void);
|
||||
// void func_80182CBC(void);
|
||||
// void func_80182CCC(void);
|
||||
u64* SysUcode_GetUCodeBoot(void);
|
||||
u32 SysUcode_GetUCodeBootSize(void);
|
||||
u64* SysUcode_GetUCode(void);
|
||||
u64* SysUcode_GetUCodeData(void);
|
||||
// void func_80182CE0(void);
|
||||
// void func_80183020(void);
|
||||
// void func_80183058(void);
|
||||
|
||||
@@ -88,6 +88,7 @@ extern GraphicsContext* __gfxCtx;
|
||||
#define POLY_OPA_DISP __gfxCtx->polyOpa.p
|
||||
#define POLY_XLU_DISP __gfxCtx->polyXlu.p
|
||||
#define OVERLAY_DISP __gfxCtx->overlay.p
|
||||
#define DEBUG_DISP __gfxCtx->debug.p
|
||||
|
||||
// __gfxCtx shouldn't be used directly.
|
||||
// Use the DISP macros defined above when writing to display buffers.
|
||||
@@ -121,6 +122,7 @@ extern GraphicsContext* __gfxCtx;
|
||||
|
||||
#define ALIGN8(val) (((val) + 7) & ~7)
|
||||
#define ALIGN16(val) (((val) + 0xF) & ~0xF)
|
||||
#define ALIGN64(val) (((val) + 0x3F) & ~0x3F)
|
||||
|
||||
#define SQ(x) ((x) * (x))
|
||||
#define ABS(x) ((x) >= 0 ? (x) : -(x))
|
||||
|
||||
@@ -81,10 +81,8 @@ typedef struct {
|
||||
/* 0x18 */ s32 (*epiDmaCallback)(OSPiHandle*, s32, u32, void*, size_t);
|
||||
} OSDevMgr; // size = 0x1C
|
||||
|
||||
|
||||
typedef u64 OSTime;
|
||||
|
||||
|
||||
typedef struct OSTimer_s {
|
||||
/* 0x00 */ struct OSTimer_s* next;
|
||||
/* 0x04 */ struct OSTimer_s* prev;
|
||||
@@ -94,7 +92,6 @@ typedef struct OSTimer_s {
|
||||
/* 0x1C */ OSMesg msg;
|
||||
} OSTimer; // size = 0x20
|
||||
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ u16 type;
|
||||
/* 0x2 */ u8 status;
|
||||
|
||||
+13
-13
@@ -79,26 +79,26 @@ typedef struct {
|
||||
/* 0x00 */ u32 type;
|
||||
/* 0x04 */ u32 flags;
|
||||
|
||||
/* 0x08 */ u64* ucode_boot;
|
||||
/* 0x0C */ u32 ucode_boot_size;
|
||||
/* 0x08 */ u64* ucodeBoot;
|
||||
/* 0x0C */ u32 ucodeBootSize;
|
||||
|
||||
/* 0x10 */ u64* ucode;
|
||||
/* 0x14 */ u32 ucode_size;
|
||||
/* 0x14 */ u32 ucodeSize;
|
||||
|
||||
/* 0x18 */ u64* ucode_data;
|
||||
/* 0x1C */ u32 ucode_data_size;
|
||||
/* 0x18 */ u64* ucodeData;
|
||||
/* 0x1C */ u32 ucodeDataSize;
|
||||
|
||||
/* 0x20 */ u64* dram_stack;
|
||||
/* 0x24 */ u32 dram_stack_size;
|
||||
/* 0x20 */ u64* dramStack;
|
||||
/* 0x24 */ u32 dramStackSize;
|
||||
|
||||
/* 0x28 */ u64* output_buff;
|
||||
/* 0x2C */ u64* output_buff_size;
|
||||
/* 0x28 */ u64* outputBuff;
|
||||
/* 0x2C */ u64* outputBuffSize;
|
||||
|
||||
/* 0x30 */ u64* data_ptr;
|
||||
/* 0x34 */ u32 data_size;
|
||||
/* 0x30 */ u64* dataPtr;
|
||||
/* 0x34 */ u32 dataSize;
|
||||
|
||||
/* 0x38 */ u64* yield_data_ptr;
|
||||
/* 0x3C */ u32 yield_data_size;
|
||||
/* 0x38 */ u64* yieldDataPtr;
|
||||
/* 0x3C */ u32 yieldDataSize;
|
||||
} OSTask_t; // size = 0x40
|
||||
|
||||
typedef union
|
||||
|
||||
+33
-1
@@ -1,6 +1,8 @@
|
||||
#ifndef _ULTRA64_VI_H_
|
||||
#define _ULTRA64_VI_H_
|
||||
|
||||
#include "ultra64/message.h"
|
||||
|
||||
/* Special Features */
|
||||
#define OS_VI_GAMMA_ON 0x0001
|
||||
#define OS_VI_GAMMA_OFF 0x0002
|
||||
@@ -65,7 +67,7 @@ typedef struct {
|
||||
/* 0x14 */ OSMesg* msg;
|
||||
/* 0x18 */ __OSViScale x;
|
||||
/* 0x24 */ __OSViScale y;
|
||||
} OSViContext; // size = 0x30
|
||||
} __OSViContext; // size = 0x30
|
||||
|
||||
#define OS_VI_NTSC_LPN1 0 /* NTSC */
|
||||
#define OS_VI_NTSC_LPF1 1
|
||||
@@ -97,6 +99,36 @@ typedef struct {
|
||||
#define OS_VI_PAL_HPN2 26
|
||||
#define OS_VI_PAL_HPF2 27
|
||||
|
||||
#define OS_VI_MPAL_LPN1 28 /* MPAL */
|
||||
#define OS_VI_MPAL_LPF1 29
|
||||
#define OS_VI_MPAL_LAN1 30
|
||||
#define OS_VI_MPAL_LAF1 31
|
||||
#define OS_VI_MPAL_LPN2 32
|
||||
#define OS_VI_MPAL_LPF2 33
|
||||
#define OS_VI_MPAL_LAN2 34
|
||||
#define OS_VI_MPAL_LAF2 35
|
||||
#define OS_VI_MPAL_HPN1 36
|
||||
#define OS_VI_MPAL_HPF1 37
|
||||
#define OS_VI_MPAL_HAN1 38
|
||||
#define OS_VI_MPAL_HAF1 39
|
||||
#define OS_VI_MPAL_HPN2 40
|
||||
#define OS_VI_MPAL_HPF2 41
|
||||
|
||||
#define OS_VI_FPAL_LPN1 42 /* FPAL */
|
||||
#define OS_VI_FPAL_LPF1 43
|
||||
#define OS_VI_FPAL_LAN1 44
|
||||
#define OS_VI_FPAL_LAF1 45
|
||||
#define OS_VI_FPAL_LPN2 46
|
||||
#define OS_VI_FPAL_LPF2 47
|
||||
#define OS_VI_FPAL_LAN2 48
|
||||
#define OS_VI_FPAL_LAF2 49
|
||||
#define OS_VI_FPAL_HPN1 50
|
||||
#define OS_VI_FPAL_HPF1 51
|
||||
#define OS_VI_FPAL_HAN1 52
|
||||
#define OS_VI_FPAL_HAF1 53
|
||||
#define OS_VI_FPAL_HPN2 54
|
||||
#define OS_VI_FPAL_HPF2 55
|
||||
|
||||
#define OS_TV_PAL 0
|
||||
#define OS_TV_NTSC 1
|
||||
#define OS_TV_MPAL 2
|
||||
|
||||
+21
-30
@@ -937,13 +937,7 @@ extern s16 D_801BD8C6;
|
||||
extern ColliderCylinderInit fireObjCollisionInit;
|
||||
extern FireObjLightParams D_801BD8FC[2];
|
||||
extern GameStateOverlay gGameStateOverlayTable[];
|
||||
// extern GameStateOverlay D_801BD940;
|
||||
// extern GameStateOverlay titleGameStateInfo;
|
||||
// extern GameStateOverlay mainGameStateInfo;
|
||||
// extern GameStateOverlay openingGameStateInfo;
|
||||
// extern GameStateOverlay fileChooseGameStateInfo;
|
||||
// extern GameStateOverlay daytelopGameStateInfo;
|
||||
// extern UNK_TYPE4 graphNumGameStates;
|
||||
extern s32 graphNumGameStates;
|
||||
// extern UNK_TYPE2 D_801BDA70;
|
||||
// extern UNK_TYPE2 D_801BDA74;
|
||||
// extern UNK_TYPE2 D_801BDA78;
|
||||
@@ -1660,8 +1654,8 @@ extern s32 gFramerateDivisor;
|
||||
extern f32 gFramerateDivisorF;
|
||||
extern f32 gFramerateDivisorHalf;
|
||||
extern f32 gFramerateDivisorThird;
|
||||
extern u32 D_801D1510;
|
||||
extern u32 D_801D1514[3];
|
||||
extern u32 retryCount;
|
||||
extern u32 cfbIdx[3];
|
||||
extern s32 gScreenWidth;
|
||||
extern s32 gScreenHeight;
|
||||
extern u32 startHeapSize;
|
||||
@@ -3422,11 +3416,10 @@ extern struct_801F8010 D_801F8010;
|
||||
extern struct_801F8020 D_801F8020;
|
||||
extern VisMono sMonoColors;
|
||||
extern UNK_TYPE1 D_801F8048;
|
||||
extern FaultAddrConvClient grapgFaultAddrConvClient;
|
||||
extern FaultClient graphFaultClient;
|
||||
extern Gfx* graphDlEntry;
|
||||
// extern UNK_TYPE1 D_801F80F8;
|
||||
extern u64 lastRenderFrameTimestamp;
|
||||
extern FaultAddrConvClient sGraphFaultAddrConvClient;
|
||||
extern FaultClient sGraphFaultClient;
|
||||
extern GfxMasterList* gGfxMasterDL;
|
||||
extern CfbInfo sGraphCfbInfos[3];
|
||||
extern OSMesgQueue sSiIntMsgQ;
|
||||
extern OSMesg sSiIntMsgBuf[1];
|
||||
extern u32 gSegments[NUM_SEGMENTS];
|
||||
@@ -3452,8 +3445,8 @@ extern OSTime sRSPOtherStartTime;
|
||||
extern OSTime sRDPStartTime;
|
||||
extern u64* gAudioSPDataPtr;
|
||||
extern u32 gAudioSPDataSize;
|
||||
// extern UNK_TYPE1 D_801FBAE0;
|
||||
// extern UNK_TYPE1 D_801FBAE8;
|
||||
extern volatile OSTime D_801FBAE0;
|
||||
extern volatile OSTime D_801FBAE8;
|
||||
extern volatile OSTime D_801FBAF0;
|
||||
extern volatile OSTime lastRenderFrameDuration;
|
||||
extern volatile OSTime gRSPAudioTotalTime;
|
||||
@@ -3466,21 +3459,21 @@ extern OSViMode D_801FBB30;
|
||||
extern u32* gFramebuffers[2];
|
||||
extern OSViMode* D_801FBB88;
|
||||
extern u16* gZBufferPtr;
|
||||
// extern UNK_TYPE4 D_801FBB90;
|
||||
// extern UNK_TYPE1 D_801FBB94;
|
||||
// extern UNK_TYPE1 D_801FBB98;
|
||||
extern void* D_801FBB90;
|
||||
extern u64* gGfxSPTaskOutputBufferPtr;
|
||||
extern u32 gGfxSPTaskOutputBufferSize;
|
||||
// extern UNK_TYPE1 D_801FBB9C;
|
||||
// extern UNK_TYPE1 D_801FBBA0;
|
||||
extern u16* sys_cfb_zbufl;
|
||||
extern u16** sys_cfb_wbufl;
|
||||
extern u16** sys_cfb_fifol;
|
||||
// extern UNK_TYPE1 D_801FBBB0;
|
||||
extern u16 (*gZBuffer)[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
extern u16 (*gWorkBuffer)[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
extern u64 (*gGfxSPTaskOutputBuffer)[0x3000];
|
||||
extern void* gGfxSPTaskOutputBufferEnd;
|
||||
// extern UNK_TYPE1 D_801FBBB4;
|
||||
// extern UNK_TYPE1 D_801FBBB8;
|
||||
// extern UNK_TYPE1 D_801FBBBC;
|
||||
// extern UNK_TYPE1 D_801FBBC0;
|
||||
// extern UNK_TYPE1 D_801FBBC4;
|
||||
// extern UNK_TYPE1 D_801FBBC8;
|
||||
extern u64 (*gGfxSPTaskOutputBuffer2)[0x3000];
|
||||
extern void* gGfxSPTaskOutputBufferEnd2;
|
||||
extern UNK_TYPE2 D_801FBBCC;
|
||||
extern UNK_TYPE2 D_801FBBCE;
|
||||
// extern UNK_TYPE1 D_801FBBD0;
|
||||
@@ -4093,10 +4086,8 @@ extern UNK_TYPE D_05023008;
|
||||
extern UNK_TYPE D_0502324C;
|
||||
|
||||
// other segments
|
||||
extern UNK_TYPE D_0E000048;
|
||||
extern UNK_TYPE D_0E000088;
|
||||
extern UNK_TYPE D_0E000140;
|
||||
extern UNK_TYPE D_0E0001C8;
|
||||
extern UNK_TYPE D_0E0002C8;
|
||||
extern GfxMasterList D_0E000000;
|
||||
|
||||
extern UNK_TYPE D_0F000000;
|
||||
|
||||
#endif
|
||||
|
||||
+168
-156
@@ -5,16 +5,13 @@
|
||||
#include "stdbool.h"
|
||||
#include "stdint.h"
|
||||
|
||||
#include "PR/ultratypes.h"
|
||||
#include "PR/gbi.h"
|
||||
#include "ultra64.h"
|
||||
#include "io/controller.h"
|
||||
#include "osint.h"
|
||||
#include "viint.h"
|
||||
#include "math.h"
|
||||
#include "os.h"
|
||||
#include "stdlib.h"
|
||||
#include "xstdio.h"
|
||||
#include "unk.h"
|
||||
|
||||
#include "bgm.h"
|
||||
#include "sfx.h"
|
||||
@@ -255,6 +252,30 @@ typedef struct {
|
||||
/* 0x14 */ s16 data[REG_GROUPS * REG_PER_GROUP]; // 0xAE0 entries
|
||||
} GameInfo; // size = 0x15D4
|
||||
|
||||
typedef struct IrqMgrClient {
|
||||
/* 0x0 */ struct IrqMgrClient* next;
|
||||
/* 0x4 */ OSMesgQueue* queue;
|
||||
} IrqMgrClient; // size = 0x8
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ s16 type;
|
||||
/* 0x2 */ u8 misc[30];
|
||||
} OSScMsg;
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ OSScMsg verticalRetraceMesg;
|
||||
/* 0x020 */ OSScMsg prenmiMsg;
|
||||
/* 0x040 */ OSScMsg nmiMsg;
|
||||
/* 0x060 */ OSMesgQueue irqQueue;
|
||||
/* 0x078 */ OSMesg irqBuffer[8];
|
||||
/* 0x098 */ OSThread thread;
|
||||
/* 0x248 */ IrqMgrClient* callbacks;
|
||||
/* 0x24C */ u8 prenmiStage;
|
||||
/* 0x250 */ OSTime lastPrenmiTime;
|
||||
/* 0x258 */ OSTimer prenmiTimer;
|
||||
/* 0x278 */ OSTime lastFrameTime;
|
||||
} IrqMgr; // size = 0x280
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ u32 size;
|
||||
/* 0x0004 */ void* bufp;
|
||||
@@ -269,13 +290,31 @@ typedef struct {
|
||||
/* 0x000C */ Gfx* d;
|
||||
} TwoHeadGfxArena; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ Gfx taskStart[9];
|
||||
/* 0x048 */ Gfx clearZBuffer[8]; // original name: clear_zb_dl
|
||||
/* 0x088 */ Gfx clearFrameBuffer[5]; // original name: clear_fb_dl
|
||||
/* 0x0B0 */ Gfx setupBuffers[6]; // setup framebuffer and zbuffer
|
||||
/* 0x0E0 */ Gfx unk_E0[12]; // unused
|
||||
/* 0x140 */ Gfx syncSegments[17];
|
||||
/* 0x1C8 */ Gfx setScissor[2];
|
||||
/* 0x1D8 */ Gfx unk_1D8[25]; // unused
|
||||
/* 0x2A0 */ Gfx disps[5];
|
||||
/* 0x2C8 */ Gfx clearFillRect[3]; // fillrect for clearing buffers
|
||||
/* 0x2E0 */ Gfx fillRect[3]; // fillrect for general purpose
|
||||
/* 0x2F8 */ Gfx debugDisp[1];
|
||||
} GfxMasterList; // size = 0x300
|
||||
|
||||
#define GFXPOOL_HEAD_MAGIC 0x1234
|
||||
#define GFXPOOL_TAIL_MAGIC 0x5678
|
||||
|
||||
typedef struct {
|
||||
/* 0x00000 */ u16 headMagic; // 1234
|
||||
/* 0x00008 */ Gfx unk8[96];
|
||||
/* 0x00008 */ GfxMasterList master;
|
||||
/* 0x00308 */ Gfx polyXluBuffer[2048];
|
||||
/* 0x04308 */ Gfx overlayBuffer[1024];
|
||||
/* 0x06308 */ Gfx unk6308[64];
|
||||
/* 0x06508 */ Gfx unk6508[64];
|
||||
/* 0x06308 */ Gfx workBuffer[64];
|
||||
/* 0x06508 */ Gfx debugBuffer[64];
|
||||
/* 0x06708 */ Gfx polyOpaBuffer[13184];
|
||||
/* 0x20308 */ u16 tailMagic; // 5678
|
||||
} GfxPool; // size = 0x20310
|
||||
@@ -293,38 +332,90 @@ typedef struct {
|
||||
/* 0x18 */ f32 yScale;
|
||||
} CfbInfo; // size = 0x1C
|
||||
|
||||
#define OS_SC_NEEDS_RDP 0x0001
|
||||
#define OS_SC_NEEDS_RSP 0x0002
|
||||
#define OS_SC_DRAM_DLIST 0x0004
|
||||
#define OS_SC_PARALLEL_TASK 0x0010
|
||||
#define OS_SC_LAST_TASK 0x0020
|
||||
#define OS_SC_SWAPBUFFER 0x0040
|
||||
|
||||
#define OS_SC_RCP_MASK 0x0003
|
||||
#define OS_SC_TYPE_MASK 0x0007
|
||||
|
||||
#define OS_SC_DP 0x0001
|
||||
#define OS_SC_SP 0x0002
|
||||
#define OS_SC_YIELD 0x0010
|
||||
#define OS_SC_YIELDED 0x0020
|
||||
|
||||
typedef struct OSScTask {
|
||||
/* 0x00 */ struct OSScTask* next;
|
||||
/* 0x04 */ u32 state;
|
||||
/* 0x08 */ u32 flags;
|
||||
/* 0x0C */ CfbInfo* framebuffer;
|
||||
/* 0x10 */ OSTask list;
|
||||
/* 0x50 */ OSMesgQueue* msgQ;
|
||||
/* 0x54 */ OSMesg msg;
|
||||
} OSScTask; // size = 0x58
|
||||
|
||||
typedef struct GraphicsContext {
|
||||
/* 0x000 */ Gfx* polyOpaBuffer;
|
||||
/* 0x004 */ Gfx* polyXluBuffer;
|
||||
/* 0x008 */ UNK_TYPE1 pad8[0x8];
|
||||
/* 0x010 */ Gfx* overlayBuffer;
|
||||
/* 0x014 */ UNK_TYPE1 pad14[0x24];
|
||||
/* 0x038 */ UNK_TYPE4 unk38[8];
|
||||
/* 0x058 */ OSMesgQueue* unk58;
|
||||
/* 0x05C */ OSMesgQueue unk5C;
|
||||
/* 0x074 */ UNK_TYPE1 pad74[0x12C];
|
||||
/* 0x1A0 */ Gfx* unk1A0;
|
||||
/* 0x1A4 */ TwoHeadGfxArena unk1A4;
|
||||
/* 0x1B4 */ Gfx* unk1B4;
|
||||
/* 0x1B8 */ TwoHeadGfxArena unk1B8;
|
||||
/* 0x1C8 */ UNK_TYPE1 pad1C8[0xAC];
|
||||
/* 0x274 */ OSViMode* viMode;
|
||||
/* 0x278 */ void* zbuffer;
|
||||
/* 0x27C */ UNK_TYPE1 pad27C[0x1C];
|
||||
/* 0x298 */ TwoHeadGfxArena overlay;
|
||||
/* 0x2A8 */ TwoHeadGfxArena polyOpa;
|
||||
/* 0x2B8 */ TwoHeadGfxArena polyXlu;
|
||||
/* 0x2C8 */ s32 displaylistCounter;
|
||||
/* 0x2CC */ void* framebuffer;
|
||||
/* 0x2D0 */ int pad2D0;
|
||||
/* 0x2D4 */ u32 viConfigFeatures;
|
||||
/* 0x2D8 */ UNK_TYPE1 gap2D8[0x3];
|
||||
/* 0x2DB */ u8 framebufferCounter;
|
||||
/* 0x2DC */ UNK_TYPE1 pad2DC[0x8];
|
||||
/* 0x2E4 */ f32 viConfigXScale;
|
||||
/* 0x2E8 */ f32 viConfigYScale;
|
||||
/* 0x2EC */ UNK_TYPE1 pad2EC[0x4];
|
||||
} GraphicsContext; // size = 0x2F0
|
||||
/* 0x000 */ Gfx* polyOpaBuffer; // Pointer to "Zelda 0"
|
||||
/* 0x004 */ Gfx* polyXluBuffer; // Pointer to "Zelda 1"
|
||||
/* 0x008 */ char unk_8[0x8]; // Unused, could this be pointers to "Zelda 2" / "Zelda 3"
|
||||
/* 0x010 */ Gfx* overlayBuffer; // Pointer to "Zelda 4"
|
||||
/* 0x014 */ u32 unk_14;
|
||||
/* 0x018 */ char unk_18[0x20];
|
||||
/* 0x038 */ OSMesg msgBuff[8];
|
||||
/* 0x058 */ OSMesgQueue* schedMsgQ;
|
||||
/* 0x05C */ OSMesgQueue queue;
|
||||
/* 0x074 */ char unk_74[0x04];
|
||||
/* 0x078 */ OSScTask task;
|
||||
/* 0x0E0 */ char unk_E0[0xD0];
|
||||
/* 0x1B0 */ Gfx* workBuffer;
|
||||
/* 0x1B4 */ TwoHeadGfxArena work;
|
||||
/* 0x1C4 */ Gfx* debugBuffer;
|
||||
/* 0x1C8 */ TwoHeadGfxArena debug;
|
||||
/* 0x1D8 */ char unk_1D8[0xAC];
|
||||
/* 0x284 */ OSViMode* viMode;
|
||||
/* 0x288 */ void* zbuffer;
|
||||
/* 0x28C */ char unk_28C[0x1C];
|
||||
/* 0x2A8 */ TwoHeadGfxArena overlay; // "Zelda 4"
|
||||
/* 0x2B8 */ TwoHeadGfxArena polyOpa; // "Zelda 0"
|
||||
/* 0x2C8 */ TwoHeadGfxArena polyXlu; // "Zelda 1"
|
||||
/* 0x2D8 */ u32 gfxPoolIdx;
|
||||
/* 0x2DC */ u16* curFrameBuffer;
|
||||
/* 0x2E0 */ char unk_2E0[0x4];
|
||||
/* 0x2E4 */ u32 viConfigFeatures;
|
||||
/* 0x2E8 */ char unk_2E8[0x2];
|
||||
/* 0x2EA */ u8 updateViMode;
|
||||
/* 0x2EB */ u8 framebufferIdx;
|
||||
/* 0x2EC */ void (*callback)(struct GraphicsContext*, u32);
|
||||
/* 0x2F0 */ u32 callbackParam;
|
||||
/* 0x2F4 */ f32 xScale;
|
||||
/* 0x2F8 */ f32 yScale;
|
||||
/* 0x2FC */ GfxMasterList* masterList;
|
||||
} GraphicsContext; // size = 0x300
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ OSMesgQueue interruptQ;
|
||||
/* 0x018 */ OSMesg intBuf[64];
|
||||
/* 0x118 */ OSMesgQueue cmdQ;
|
||||
/* 0x130 */ OSMesg cmdMsgBuf[8];
|
||||
/* 0x150 */ OSThread thread;
|
||||
/* 0x300 */ OSScTask* audioListHead;
|
||||
/* 0x304 */ OSScTask* gfxListHead;
|
||||
/* 0x308 */ OSScTask* audioListTail;
|
||||
/* 0x30C */ OSScTask* gfxListTail;
|
||||
/* 0x310 */ OSScTask* curRSPTask;
|
||||
/* 0x314 */ OSScTask* curRDPTask;
|
||||
/* 0x318 */ s32 retraceCount;
|
||||
/* 0x318 */ s32 doAudio;
|
||||
/* 0x320 */ CfbInfo* curBuf;
|
||||
/* 0x324 */ CfbInfo* pendingSwapBuf1;
|
||||
/* 0x328 */ CfbInfo* pendingSwapBuf2;
|
||||
/* 0x32C */ char unk_32C[0x3];
|
||||
/* 0x32F */ u8 shouldUpdateVi;
|
||||
/* 0x330 */ IrqMgrClient irqClient;
|
||||
} SchedContext; // size = 0x338
|
||||
|
||||
typedef enum IRQ_MSG_TYPE {
|
||||
IRQ_VERTICAL_RETRACE_MSG = 0x1,
|
||||
@@ -410,10 +501,6 @@ typedef struct {
|
||||
/* 0xC */ s32 rightX;
|
||||
} Viewport; // size = 0x10
|
||||
|
||||
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*, size_t);
|
||||
@@ -563,25 +650,6 @@ typedef enum {
|
||||
GFXPRINT_OPEN = 0x80
|
||||
} GfxPrintFlag;
|
||||
|
||||
typedef struct GameState GameState;
|
||||
|
||||
typedef void (*GameStateFunc)(GameState* gameState);
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ void* loadedRamAddr;
|
||||
/* 0x04 */ uintptr_t vromStart; // if applicable
|
||||
/* 0x08 */ uintptr_t vromEnd; // if applicable
|
||||
/* 0x0C */ void* vramStart; // if applicable
|
||||
/* 0x10 */ void* vramEnd; // if applicable
|
||||
/* 0x14 */ UNK_PTR unk_14;
|
||||
/* 0x18 */ GameStateFunc init; // initializes and executes the given context
|
||||
/* 0x1C */ GameStateFunc destroy; // deconstructs the context, and sets the next context to load
|
||||
/* 0x20 */ UNK_PTR unk_20;
|
||||
/* 0x24 */ UNK_PTR unk_24;
|
||||
/* 0x28 */ UNK_TYPE unk_28;
|
||||
/* 0x2C */ size_t instanceSize;
|
||||
} GameStateOverlay; // size = 0x30
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u16 countdown;
|
||||
/* 0x04 */ Vec3f originPos;
|
||||
@@ -988,12 +1056,12 @@ typedef struct {
|
||||
/* 0x120D8 */ UNK_TYPE1 pad120D8[0x8];
|
||||
} MessageContext; // size = 0x120E0
|
||||
|
||||
typedef struct ArenaNode_t {
|
||||
typedef struct ArenaNode {
|
||||
/* 0x0 */ s16 magic; // Should always be 0x7373
|
||||
/* 0x2 */ s16 isFree;
|
||||
/* 0x4 */ size_t size;
|
||||
/* 0x8 */ struct ArenaNode_t* next;
|
||||
/* 0xC */ struct ArenaNode_t* prev;
|
||||
/* 0x8 */ struct ArenaNode* next;
|
||||
/* 0xC */ struct ArenaNode* prev;
|
||||
} ArenaNode; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
@@ -1005,22 +1073,18 @@ typedef struct {
|
||||
/* 0x22 */ u8 flag;
|
||||
} Arena; // size = 0x24
|
||||
|
||||
typedef struct FaultAddrConvClient FaultAddrConvClient;
|
||||
|
||||
struct FaultAddrConvClient {
|
||||
/* 0x0 */ FaultAddrConvClient* next;
|
||||
/* 0x4 */ FaultAddrConvFunc callback;
|
||||
typedef struct FaultAddrConvClient {
|
||||
/* 0x0 */ struct FaultAddrConvClient* next;
|
||||
/* 0x4 */ void* (*callback)(void*, void*);
|
||||
/* 0x8 */ void* param;
|
||||
}; // size = 0xC
|
||||
} FaultAddrConvClient; // size = 0xC
|
||||
|
||||
typedef struct FaultClient FaultClient;
|
||||
|
||||
struct FaultClient {
|
||||
/* 0x0 */ FaultClient* next;
|
||||
/* 0x4 */ fault_client_func callback;
|
||||
typedef struct FaultClient {
|
||||
/* 0x0 */ struct FaultClient* next;
|
||||
/* 0x4 */ void (*callback)(void*, void*);
|
||||
/* 0x8 */ void* param0;
|
||||
/* 0xC */ void* param1;
|
||||
}; // size = 0x10
|
||||
} FaultClient; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ OSThread thread;
|
||||
@@ -1044,9 +1108,28 @@ typedef struct FireObj FireObj;
|
||||
|
||||
typedef struct FireObjLight FireObjLight;
|
||||
|
||||
typedef struct GameAllocNode {
|
||||
/* 0x0 */ struct GameAllocNode* next;
|
||||
/* 0x4 */ struct GameAllocNode* prev;
|
||||
struct GameState;
|
||||
|
||||
typedef void (*GameStateFunc)(struct GameState* gameState);
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ void* loadedRamAddr;
|
||||
/* 0x04 */ uintptr_t vromStart; // if applicable
|
||||
/* 0x08 */ uintptr_t vromEnd; // if applicable
|
||||
/* 0x0C */ void* vramStart; // if applicable
|
||||
/* 0x10 */ void* vramEnd; // if applicable
|
||||
/* 0x14 */ UNK_PTR unk_14;
|
||||
/* 0x18 */ GameStateFunc init; // initializes and executes the given context
|
||||
/* 0x1C */ GameStateFunc destroy; // deconstructs the context, and sets the next context to load
|
||||
/* 0x20 */ UNK_PTR unk_20;
|
||||
/* 0x24 */ UNK_PTR unk_24;
|
||||
/* 0x28 */ UNK_TYPE unk_28;
|
||||
/* 0x2C */ size_t instanceSize;
|
||||
} GameStateOverlay; // size = 0x30
|
||||
|
||||
typedef struct GameAllocEntry {
|
||||
/* 0x0 */ struct GameAllocEntry* next;
|
||||
/* 0x4 */ struct GameAllocEntry* prev;
|
||||
/* 0x8 */ size_t size;
|
||||
/* 0xC */ u32 unk_0C;
|
||||
} GameAllocEntry; // size = 0x10
|
||||
@@ -1056,7 +1139,7 @@ typedef struct GameAlloc {
|
||||
/* 0x10 */ GameAllocEntry* head;
|
||||
} GameAlloc; // size = 0x14
|
||||
|
||||
struct GameState {
|
||||
typedef struct GameState {
|
||||
/* 0x00 */ GraphicsContext* gfxCtx;
|
||||
/* 0x04 */ GameStateFunc main;
|
||||
/* 0x08 */ GameStateFunc destroy;
|
||||
@@ -1070,8 +1153,8 @@ struct GameState {
|
||||
/* 0x9C */ u32 frames;
|
||||
/* 0xA0 */ u8 padA0[0x2];
|
||||
/* 0xA2 */ u8 framerateDivisor; // game speed?
|
||||
/* 0xA3 */ UNK_TYPE1 unkA3;
|
||||
}; // size = 0xA4
|
||||
/* 0xA3 */ u8 unk_A3;
|
||||
} GameState; // size = 0xA4
|
||||
|
||||
typedef struct PreNMIContext {
|
||||
/* 0x00 */ GameState state;
|
||||
@@ -1236,30 +1319,6 @@ typedef enum {
|
||||
QUAKE2_SETUP,
|
||||
} Quake2State;
|
||||
|
||||
typedef struct IrqMgrClient_t {
|
||||
/* 0x0 */ struct IrqMgrClient_t* next;
|
||||
/* 0x4 */ OSMesgQueue* queue;
|
||||
} IrqMgrClient; // size = 0x8
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ s16 type;
|
||||
/* 0x2 */ u8 misc[30];
|
||||
} OSScMsg;
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ OSScMsg verticalRetraceMesg;
|
||||
/* 0x020 */ OSScMsg prenmiMsg;
|
||||
/* 0x040 */ OSScMsg nmiMsg;
|
||||
/* 0x060 */ OSMesgQueue irqQueue;
|
||||
/* 0x078 */ OSMesg irqBuffer[8];
|
||||
/* 0x098 */ OSThread thread;
|
||||
/* 0x248 */ IrqMgrClient* callbacks;
|
||||
/* 0x24C */ u8 prenmiStage;
|
||||
/* 0x250 */ OSTime lastPrenmiTime;
|
||||
/* 0x258 */ OSTimer prenmiTimer;
|
||||
/* 0x278 */ OSTime lastFrameTime;
|
||||
} IrqMgr; // size = 0x280
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ u8 controllers; // bit 0 is set if controller 1 is plugged in, etc.
|
||||
/* 0x001 */ UNK_TYPE1 pad1[0x13];
|
||||
@@ -1283,56 +1342,9 @@ typedef struct {
|
||||
/* 0x47F */ UNK_TYPE1 pad47F[0x1];
|
||||
} PadMgr; // size = 0x480
|
||||
|
||||
#define OS_SC_NEEDS_RDP 0x0001
|
||||
#define OS_SC_NEEDS_RSP 0x0002
|
||||
#define OS_SC_DRAM_DLIST 0x0004
|
||||
#define OS_SC_PARALLEL_TASK 0x0010
|
||||
#define OS_SC_LAST_TASK 0x0020
|
||||
#define OS_SC_SWAPBUFFER 0x0040
|
||||
|
||||
#define OS_SC_RCP_MASK 0x0003
|
||||
#define OS_SC_TYPE_MASK 0x0007
|
||||
|
||||
#define OS_SC_DP 0x0001
|
||||
#define OS_SC_SP 0x0002
|
||||
#define OS_SC_YIELD 0x0010
|
||||
#define OS_SC_YIELDED 0x0020
|
||||
|
||||
typedef struct OSScTask {
|
||||
/* 0x00 */ struct OSScTask* next;
|
||||
/* 0x04 */ u32 state;
|
||||
/* 0x08 */ u32 flags;
|
||||
/* 0x0C */ CfbInfo* framebuffer;
|
||||
/* 0x10 */ OSTask list;
|
||||
/* 0x50 */ OSMesgQueue* msgQ;
|
||||
/* 0x54 */ OSMesg msg;
|
||||
} OSScTask; // size = 0x58
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ OSMesgQueue interruptQ;
|
||||
/* 0x0018 */ OSMesg intBuf[64];
|
||||
/* 0x0118 */ OSMesgQueue cmdQ;
|
||||
/* 0x0130 */ OSMesg cmdMsgBuf[8];
|
||||
/* 0x0150 */ OSThread thread;
|
||||
/* 0x0300 */ OSScTask* audioListHead;
|
||||
/* 0x0304 */ OSScTask* gfxListHead;
|
||||
/* 0x0308 */ OSScTask* audioListTail;
|
||||
/* 0x030C */ OSScTask* gfxListTail;
|
||||
/* 0x0310 */ OSScTask* curRSPTask;
|
||||
/* 0x0314 */ OSScTask* curRDPTask;
|
||||
/* 0x0318 */ s32 retraceCount;
|
||||
/* 0x0318 */ s32 doAudio;
|
||||
/* 0x0320 */ CfbInfo* curBuf;
|
||||
/* 0x0324 */ CfbInfo* pendingSwapBuf1;
|
||||
/* 0x0328 */ CfbInfo* pendingSwapBuf2;
|
||||
/* 0x032C */ char unk_32C[0x3];
|
||||
/* 0x032F */ u8 shouldUpdateVi;
|
||||
/* 0x0330 */ IrqMgrClient irqClient;
|
||||
} SchedContext; // size = 0x338
|
||||
|
||||
typedef struct StackEntry_t {
|
||||
/* 0x00 */ struct StackEntry_t* next;
|
||||
/* 0x04 */ struct StackEntry_t* prev;
|
||||
typedef struct StackEntry {
|
||||
/* 0x00 */ struct StackEntry* next;
|
||||
/* 0x04 */ struct StackEntry* prev;
|
||||
/* 0x08 */ u32 head;
|
||||
/* 0x0C */ u32 tail;
|
||||
/* 0x10 */ u32 initValue;
|
||||
|
||||
@@ -610,11 +610,10 @@ beginseg
|
||||
include "build/data/code/game.bss.o"
|
||||
include "build/src/code/gamealloc.o"
|
||||
include "build/src/code/graph.o"
|
||||
include "build/data/code/graph.data.o"
|
||||
include "build/data/code/graph.bss.o"
|
||||
include "build/src/code/code_80174A40.o"
|
||||
include "build/src/code/graphalloc.o"
|
||||
include "build/src/code/listalloc.o"
|
||||
include "build/src/code/main.o"
|
||||
include "build/data/code/main.data.o"
|
||||
include "build/data/code/main.bss.o"
|
||||
include "build/src/code/padmgr.o"
|
||||
include "build/data/code/padmgr.data.o"
|
||||
@@ -635,6 +634,7 @@ beginseg
|
||||
include "build/data/code/sys_matrix.data.o"
|
||||
include "build/data/code/sys_matrix.bss.o"
|
||||
include "build/src/code/sys_ucode.o"
|
||||
include "build/src/code/code_80182CE0.o"
|
||||
include "build/data/code/code_801D1E70.data.o"
|
||||
include "build/src/code/code_80183070.o"
|
||||
include "build/src/code/c_keyframe.o"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "prevent_bss_reordering.h"
|
||||
|
||||
UNK_TYPE4 D_8009BE30;
|
||||
UNK_TYPE4 D_8009BE34;
|
||||
@@ -17,7 +18,7 @@ void CIC6105_PrintRomInfo(void) {
|
||||
}
|
||||
|
||||
void CIC6105_AddRomInfoFaultPage(void) {
|
||||
Fault_AddClient(&romInfoFaultClient, (fault_client_func)CIC6105_PrintRomInfo, 0, 0);
|
||||
Fault_AddClient(&romInfoFaultClient, CIC6105_PrintRomInfo, 0, 0);
|
||||
}
|
||||
|
||||
void CIC6105_RemoveRomInfoFaultPage(void) {
|
||||
|
||||
@@ -33,7 +33,7 @@ void Fault_SleepImpl(u32 duration) {
|
||||
Sleep_Cycles(value);
|
||||
}
|
||||
|
||||
void Fault_AddClient(FaultClient* client, fault_client_func callback, void* param0, void* param1) {
|
||||
void Fault_AddClient(FaultClient* client, void* callback, void* param0, void* param1) {
|
||||
OSIntMask mask;
|
||||
u32 alreadyExists = 0;
|
||||
|
||||
@@ -104,7 +104,7 @@ void Fault_RemoveClient(FaultClient* client) {
|
||||
}
|
||||
}
|
||||
|
||||
void Fault_AddAddrConvClient(FaultAddrConvClient* client, FaultAddrConvFunc callback, void* param) {
|
||||
void Fault_AddAddrConvClient(FaultAddrConvClient* client, void* callback, void* param) {
|
||||
OSIntMask mask;
|
||||
u32 alreadyExists = 0;
|
||||
|
||||
@@ -910,8 +910,8 @@ void Fault_HangupFaultClient(const char* arg0, char* arg1) {
|
||||
|
||||
void Fault_AddHungupAndCrashImpl(const char* arg0, char* arg1) {
|
||||
FaultClient client;
|
||||
char padd[4];
|
||||
Fault_AddClient(&client, (fault_client_func)Fault_HangupFaultClient, (void*)arg0, arg1);
|
||||
u32 pad;
|
||||
Fault_AddClient(&client, Fault_HangupFaultClient, (void*)arg0, arg1);
|
||||
*(u32*)0x11111111 = 0; // trigger an exception
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#include "global.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_80174A40/Graph_GfxPlusOne.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_80174A40/Graph_BranchDlist.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_80174A40/Graph_DlistAlloc.s")
|
||||
@@ -0,0 +1,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_80182CE0/func_80182CE0.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_80182CE0/func_80183020.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_80182CE0/func_80183058.s")
|
||||
+11
-14
@@ -5,9 +5,6 @@ f32 gFramerateDivisorF = 1.0f;
|
||||
f32 gFramerateDivisorHalf = 1.0f / 2.0f;
|
||||
f32 gFramerateDivisorThird = 1.0f / 3.0f;
|
||||
|
||||
u32 D_801D1510 = 0x0000000A;
|
||||
u32 D_801D1514[3] = { 0 };
|
||||
|
||||
void Game_UpdateFramerateVariables(s32 divisor) {
|
||||
gFramerateDivisor = divisor;
|
||||
gFramerateDivisorF = (f32)divisor;
|
||||
@@ -104,12 +101,12 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) {
|
||||
void GameState_SetFrameBuffer(GraphicsContext* gfxCtx) {
|
||||
OPEN_DISPS(gfxCtx);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0, NULL);
|
||||
gSPSegment(POLY_OPA_DISP++, 0xF, gfxCtx->framebuffer);
|
||||
gSPSegment(POLY_XLU_DISP++, 0, NULL);
|
||||
gSPSegment(POLY_XLU_DISP++, 0xF, gfxCtx->framebuffer);
|
||||
gSPSegment(OVERLAY_DISP++, 0, NULL);
|
||||
gSPSegment(OVERLAY_DISP++, 0xF, gfxCtx->framebuffer);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x00, NULL);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x0F, gfxCtx->curFrameBuffer);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x00, NULL);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x0F, gfxCtx->curFrameBuffer);
|
||||
gSPSegment(OVERLAY_DISP++, 0x00, NULL);
|
||||
gSPSegment(OVERLAY_DISP++, 0x0F, gfxCtx->curFrameBuffer);
|
||||
|
||||
CLOSE_DISPS(gfxCtx);
|
||||
}
|
||||
@@ -199,8 +196,8 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g
|
||||
gameState->running = 1;
|
||||
gfxCtx->viMode = D_801FBB88;
|
||||
gfxCtx->viConfigFeatures = gViConfigFeatures;
|
||||
gfxCtx->viConfigXScale = gViConfigXScale;
|
||||
gfxCtx->viConfigYScale = gViConfigYScale;
|
||||
gfxCtx->xScale = gViConfigXScale;
|
||||
gfxCtx->yScale = gViConfigYScale;
|
||||
gameState->nextGameStateInit = NULL;
|
||||
gameState->nextGameStateSize = 0U;
|
||||
|
||||
@@ -220,14 +217,14 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g
|
||||
func_801773A0(&D_801F7FF0);
|
||||
func_8013ED9C();
|
||||
|
||||
osSendMesg(&gameState->gfxCtx->unk5C, NULL, 1);
|
||||
osSendMesg(&gameState->gfxCtx->queue, NULL, OS_MESG_BLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
void GameState_Destroy(GameState* gameState) {
|
||||
func_80172BC0();
|
||||
func_8019E014();
|
||||
osRecvMesg(&gameState->gfxCtx->unk5C, NULL, OS_MESG_BLOCK);
|
||||
osRecvMesg(&gameState->gfxCtx->queue, NULL, OS_MESG_BLOCK);
|
||||
|
||||
if (gameState->destroy != NULL) {
|
||||
gameState->destroy(gameState);
|
||||
@@ -247,7 +244,7 @@ GameStateFunc GameState_GetNextStateInit(GameState* gameState) {
|
||||
return gameState->nextGameStateInit;
|
||||
}
|
||||
|
||||
size_t Game_GetNextStateSize(GameState* gameState) {
|
||||
size_t GameState_GetNextStateSize(GameState* gameState) {
|
||||
return gameState->nextGameStateSize;
|
||||
}
|
||||
|
||||
|
||||
+374
-11
@@ -1,25 +1,388 @@
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "global.h"
|
||||
#include "overlays/gamestates/ovl_daytelop/z_daytelop.h"
|
||||
#include "overlays/gamestates/ovl_file_choose/z_file_choose.h"
|
||||
#include "overlays/gamestates/ovl_opening/z_opening.h"
|
||||
#include "overlays/gamestates/ovl_select/z_select.h"
|
||||
#include "overlays/gamestates/ovl_title/z_title.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_FaultClient.s")
|
||||
FaultAddrConvClient sGraphFaultAddrConvClient;
|
||||
FaultClient sGraphFaultClient;
|
||||
GfxMasterList* gGfxMasterDL;
|
||||
CfbInfo sGraphCfbInfos[3];
|
||||
OSTime sGraphTaskStartTime;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_DlAlloc.s")
|
||||
void* Graph_FaultClient(void) {
|
||||
FaultDrawer_DrawText(30, 100, "ShowFrameBuffer PAGE 0/1");
|
||||
osViSwapBuffer(SysCfb_GetFbPtr(0));
|
||||
osViSetMode(D_801FBB88);
|
||||
osViSetSpecialFeatures(OS_VI_DITHER_FILTER_ON | OS_VI_GAMMA_OFF);
|
||||
Fault_WaitForInput();
|
||||
osViSwapBuffer(SysCfb_GetFbPtr(1));
|
||||
osViSetMode(D_801FBB88);
|
||||
osViSetSpecialFeatures(OS_VI_DITHER_FILTER_ON | OS_VI_GAMMA_OFF);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_InitTHGA.s")
|
||||
void Graph_InitTHGA(TwoHeadGfxArena* arena, Gfx* buffer, s32 size) {
|
||||
THGA_Ct(arena, buffer, size);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_GetNextGameState.s")
|
||||
void Graph_SetNextGfxPool(GraphicsContext* gfxCtx) {
|
||||
GfxPool* pool = &gGfxPools[gfxCtx->gfxPoolIdx % 2];
|
||||
|
||||
gGfxMasterDL = &pool->master;
|
||||
gSegments[0x0E] = gGfxMasterDL;
|
||||
|
||||
pool->headMagic = GFXPOOL_HEAD_MAGIC;
|
||||
pool->tailMagic = GFXPOOL_TAIL_MAGIC;
|
||||
|
||||
Graph_InitTHGA(&gfxCtx->polyOpa, pool->polyOpaBuffer, sizeof(pool->polyOpaBuffer));
|
||||
Graph_InitTHGA(&gfxCtx->polyXlu, pool->polyXluBuffer, sizeof(pool->polyXluBuffer));
|
||||
Graph_InitTHGA(&gfxCtx->overlay, pool->overlayBuffer, sizeof(pool->overlayBuffer));
|
||||
Graph_InitTHGA(&gfxCtx->work, pool->workBuffer, sizeof(pool->workBuffer));
|
||||
Graph_InitTHGA(&gfxCtx->debug, pool->debugBuffer, sizeof(pool->debugBuffer));
|
||||
|
||||
gfxCtx->polyOpaBuffer = pool->polyOpaBuffer;
|
||||
gfxCtx->polyXluBuffer = pool->polyXluBuffer;
|
||||
gfxCtx->overlayBuffer = pool->overlayBuffer;
|
||||
gfxCtx->workBuffer = pool->workBuffer;
|
||||
gfxCtx->debugBuffer = pool->debugBuffer;
|
||||
|
||||
gfxCtx->curFrameBuffer = (u16*)SysCfb_GetFbPtr(gfxCtx->framebufferIdx % 2);
|
||||
gSegments[0x0F] = gfxCtx->curFrameBuffer;
|
||||
|
||||
gfxCtx->zbuffer = SysCfb_GetZBuffer();
|
||||
|
||||
gSPBranchList(&gGfxMasterDL->disps[0], pool->polyOpaBuffer);
|
||||
gSPBranchList(&gGfxMasterDL->disps[1], pool->polyXluBuffer);
|
||||
gSPBranchList(&gGfxMasterDL->disps[2], pool->overlayBuffer);
|
||||
gSPBranchList(&gGfxMasterDL->disps[3], pool->workBuffer);
|
||||
gSPEndDisplayList(&gGfxMasterDL->disps[4]);
|
||||
gSPBranchList(&gGfxMasterDL->debugDisp[0], pool->debugBuffer);
|
||||
}
|
||||
|
||||
GameStateOverlay* Graph_GetNextGameState(GameState* gameState) {
|
||||
GameStateFunc gameStateInit = GameState_GetNextStateInit(gameState);
|
||||
|
||||
if (gameStateInit == (GameStateFunc)TitleSetup_Init) {
|
||||
return &gGameStateOverlayTable[0];
|
||||
}
|
||||
if (gameStateInit == (GameStateFunc)Select_Init) {
|
||||
return &gGameStateOverlayTable[1];
|
||||
}
|
||||
if (gameStateInit == (GameStateFunc)Title_Init) {
|
||||
return &gGameStateOverlayTable[2];
|
||||
}
|
||||
if (gameStateInit == (GameStateFunc)Play_Init) {
|
||||
return &gGameStateOverlayTable[3];
|
||||
}
|
||||
if (gameStateInit == (GameStateFunc)Opening_Init) {
|
||||
return &gGameStateOverlayTable[4];
|
||||
}
|
||||
if (gameStateInit == (GameStateFunc)FileChoose_Init) {
|
||||
return &gGameStateOverlayTable[5];
|
||||
}
|
||||
if (gameStateInit == (GameStateFunc)Daytelop_Init) {
|
||||
return &gGameStateOverlayTable[6];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// Regalloc differences
|
||||
void* Graph_FaultAddrConvFunc(void* address, void* param) {
|
||||
u32 addr = address;
|
||||
GameStateOverlay* gamestateOvl;
|
||||
u32 ramConv;
|
||||
u32 ramStart;
|
||||
u32 diff;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < graphNumGameStates; i++) {
|
||||
gamestateOvl = &gGameStateOverlayTable[i];
|
||||
ramStart = gamestateOvl->loadedRamAddr;
|
||||
diff = (u32)gamestateOvl->vramEnd - (u32)gamestateOvl->vramStart;
|
||||
ramConv = (u32)gamestateOvl->vramStart - ramStart;
|
||||
|
||||
if (gamestateOvl->loadedRamAddr != NULL) {
|
||||
if (addr >= ramStart && addr < ramStart + diff) {
|
||||
return addr + ramConv;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_FaultAddrConvFunc.s")
|
||||
#endif
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_Init.s")
|
||||
void Graph_Init(GraphicsContext* gfxCtx) {
|
||||
bzero(gfxCtx, sizeof(GraphicsContext));
|
||||
gfxCtx->gfxPoolIdx = 0;
|
||||
gfxCtx->framebufferIdx = 0;
|
||||
gfxCtx->viMode = NULL;
|
||||
gfxCtx->viConfigFeatures = gViConfigFeatures;
|
||||
gfxCtx->xScale = gViConfigXScale;
|
||||
gfxCtx->yScale = gViConfigYScale;
|
||||
osCreateMesgQueue(&gfxCtx->queue, gfxCtx->msgBuff, ARRAY_COUNT(gfxCtx->msgBuff));
|
||||
Fault_AddClient(&sGraphFaultClient, Graph_FaultClient, NULL, NULL);
|
||||
Fault_AddAddrConvClient(&sGraphFaultAddrConvClient, Graph_FaultAddrConvFunc, NULL);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_Destroy.s")
|
||||
void Graph_Destroy(GraphicsContext* gfxCtx) {
|
||||
Fault_RemoveClient(&sGraphFaultClient);
|
||||
Fault_RemoveAddrConvClient(&sGraphFaultAddrConvClient);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_Render.s")
|
||||
/**
|
||||
* Constructs the graphics OSTask and forwards it to the scheduler.
|
||||
* Waits for up to 3 additional seconds for any current graphics task to complete.
|
||||
* If it does not signal completion in that time, retry or trigger a crash.
|
||||
*/
|
||||
void Graph_TaskSet00(GraphicsContext* gfxCtx, GameState* gameState) {
|
||||
static s32 retryCount = 10;
|
||||
static s32 cfbIdx = 0;
|
||||
OSTask_t* task = &gfxCtx->task.list.t;
|
||||
OSScTask* scTask = &gfxCtx->task;
|
||||
OSTimer timer;
|
||||
OSMesg msg;
|
||||
CfbInfo* cfb;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_FrameSetup.s")
|
||||
retry:
|
||||
osSetTimer(&timer, OS_USEC_TO_CYCLES(3 * 1000 * 1000), 0, &gfxCtx->queue, (OSMesg)666);
|
||||
osRecvMesg(&gfxCtx->queue, &msg, OS_MESG_BLOCK);
|
||||
osStopTimer(&timer);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_RenderFrame.s")
|
||||
if (msg == (OSMesg)666) {
|
||||
osSyncPrintf("GRAPH SP TIMEOUT\n");
|
||||
if (retryCount >= 0) {
|
||||
retryCount--;
|
||||
Sched_SendGfxCancelMsg(&gSchedContext);
|
||||
goto retry;
|
||||
} else {
|
||||
// graph.c: No more! die!
|
||||
osSyncPrintf("graph.c:もうダメ!死ぬ!\n");
|
||||
Fault_AddHungupAndCrashImpl("RCP is HUNG UP!!", "Oh! MY GOD!!");
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_DoFrame.s")
|
||||
gfxCtx->masterList = gGfxMasterDL;
|
||||
if (gfxCtx->callback != NULL) {
|
||||
gfxCtx->callback(gfxCtx, gfxCtx->callbackParam);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_ThreadEntry.s")
|
||||
task->type = M_GFXTASK;
|
||||
task->flags = OS_SC_DRAM_DLIST;
|
||||
task->ucodeBoot = SysUcode_GetUCodeBoot();
|
||||
task->ucodeBootSize = SysUcode_GetUCodeBootSize();
|
||||
task->ucode = SysUcode_GetUCode();
|
||||
task->ucodeData = SysUcode_GetUCodeData();
|
||||
task->ucodeSize = 0x1000;
|
||||
task->ucodeDataSize = 0x800;
|
||||
task->dramStack = (u64*)gGfxSPTaskStack;
|
||||
task->dramStackSize = sizeof(gGfxSPTaskStack);
|
||||
task->outputBuff = gGfxSPTaskOutputBufferPtr;
|
||||
task->outputBuffSize = gGfxSPTaskOutputBufferSize;
|
||||
task->dataPtr = (u64*)gGfxMasterDL;
|
||||
task->dataSize = 0;
|
||||
task->yieldDataPtr = (u64*)gGfxSPTaskYieldBuffer;
|
||||
task->yieldDataSize = sizeof(gGfxSPTaskYieldBuffer);
|
||||
|
||||
scTask->next = NULL;
|
||||
scTask->flags = OS_SC_RCP_MASK | OS_SC_SWAPBUFFER | OS_SC_LAST_TASK;
|
||||
|
||||
if (SREG(33) & 1) {
|
||||
SREG(33) &= ~1;
|
||||
scTask->flags &= ~OS_SC_SWAPBUFFER;
|
||||
gfxCtx->framebufferIdx--;
|
||||
}
|
||||
|
||||
scTask->msgQ = &gfxCtx->queue;
|
||||
scTask->msg = NULL;
|
||||
|
||||
{ s32 pad; }
|
||||
|
||||
cfb = &sGraphCfbInfos[cfbIdx];
|
||||
cfbIdx = (cfbIdx + 1) % ARRAY_COUNT(sGraphCfbInfos);
|
||||
|
||||
cfb->fb1 = gfxCtx->curFrameBuffer;
|
||||
cfb->swapBuffer = gfxCtx->curFrameBuffer;
|
||||
|
||||
if (gfxCtx->updateViMode) {
|
||||
gfxCtx->updateViMode = false;
|
||||
cfb->viMode = gfxCtx->viMode;
|
||||
cfb->features = gfxCtx->viConfigFeatures;
|
||||
cfb->xScale = gfxCtx->xScale;
|
||||
cfb->yScale = gfxCtx->yScale;
|
||||
} else {
|
||||
cfb->viMode = NULL;
|
||||
}
|
||||
cfb->unk_10 = 0;
|
||||
cfb->updateRate = gameState->framerateDivisor;
|
||||
|
||||
scTask->framebuffer = cfb;
|
||||
|
||||
while (gfxCtx->queue.validCount != 0) {
|
||||
osRecvMesg(&gfxCtx->queue, NULL, OS_MESG_NOBLOCK);
|
||||
}
|
||||
|
||||
gfxCtx->schedMsgQ = &gSchedContext.cmdQ;
|
||||
osSendMesg(&gSchedContext.cmdQ, scTask, OS_MESG_BLOCK);
|
||||
Sched_SendEntryMsg(&gSchedContext);
|
||||
}
|
||||
|
||||
void Graph_UpdateGame(GameState* gameState) {
|
||||
Game_UpdateInput(gameState);
|
||||
Game_IncrementFrameCount(gameState);
|
||||
if (SREG(20) < 3) {
|
||||
func_8019E014();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the gamestate logic, then finalize the gfx buffer
|
||||
* and run the graphics task for this frame.
|
||||
*/
|
||||
void Graph_ExecuteAndDraw(GraphicsContext* gfxCtx, GameState* gameState) {
|
||||
u32 problem;
|
||||
|
||||
gameState->unk_A3 = 0;
|
||||
Graph_SetNextGfxPool(gfxCtx);
|
||||
|
||||
Game_Update(gameState);
|
||||
|
||||
OPEN_DISPS(gfxCtx);
|
||||
|
||||
gSPEndDisplayList(WORK_DISP++);
|
||||
gSPEndDisplayList(POLY_OPA_DISP++);
|
||||
gSPEndDisplayList(POLY_XLU_DISP++);
|
||||
gSPEndDisplayList(OVERLAY_DISP++);
|
||||
gSPEndDisplayList(DEBUG_DISP++);
|
||||
|
||||
CLOSE_DISPS(gfxCtx);
|
||||
|
||||
{
|
||||
Gfx* gfx = gGfxMasterDL->taskStart;
|
||||
|
||||
gSPSegment(gfx++, 0x0E, gGfxMasterDL);
|
||||
gSPDisplayList(gfx++, &D_0E000000.disps[3]);
|
||||
gSPDisplayList(gfx++, &D_0E000000.disps[0]);
|
||||
gSPDisplayList(gfx++, &D_0E000000.disps[1]);
|
||||
gSPDisplayList(gfx++, &D_0E000000.disps[2]);
|
||||
gSPDisplayList(gfx++, &D_0E000000.debugDisp[0]);
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
gDPFullSync(gfx++);
|
||||
gSPEndDisplayList(gfx++);
|
||||
}
|
||||
|
||||
problem = false;
|
||||
|
||||
{
|
||||
GfxPool* pool = &gGfxPools[gfxCtx->gfxPoolIdx % 2];
|
||||
|
||||
if (pool->headMagic != GFXPOOL_HEAD_MAGIC) {
|
||||
Fault_AddHungupAndCrash("../graph.c", 1054);
|
||||
}
|
||||
if (pool->tailMagic != GFXPOOL_TAIL_MAGIC) {
|
||||
Fault_AddHungupAndCrash("../graph.c", 1066);
|
||||
}
|
||||
}
|
||||
|
||||
if (THGA_IsCrash(&gfxCtx->polyOpa)) {
|
||||
problem = true;
|
||||
}
|
||||
if (THGA_IsCrash(&gfxCtx->polyXlu)) {
|
||||
problem = true;
|
||||
}
|
||||
if (THGA_IsCrash(&gfxCtx->overlay)) {
|
||||
problem = true;
|
||||
}
|
||||
if (THGA_IsCrash(&gfxCtx->work)) {
|
||||
problem = true;
|
||||
}
|
||||
if (THGA_IsCrash(&gfxCtx->debug)) {
|
||||
problem = true;
|
||||
}
|
||||
|
||||
if (!problem) {
|
||||
Graph_TaskSet00(gfxCtx, gameState);
|
||||
gfxCtx->gfxPoolIdx++;
|
||||
gfxCtx->framebufferIdx++;
|
||||
}
|
||||
|
||||
{
|
||||
OSTime time = osGetTime();
|
||||
|
||||
D_801FBAE8 = sRSPGFXTotalTime;
|
||||
D_801FBAE0 = gRSPAudioTotalTime;
|
||||
D_801FBAF0 = gRDPTotalTime;
|
||||
sRSPGFXTotalTime = 0;
|
||||
gRSPAudioTotalTime = 0;
|
||||
gRDPTotalTime = 0;
|
||||
|
||||
if (sGraphTaskStartTime != 0) {
|
||||
lastRenderFrameDuration = time - sGraphTaskStartTime;
|
||||
}
|
||||
sGraphTaskStartTime = time;
|
||||
}
|
||||
}
|
||||
|
||||
void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
|
||||
gameState->unk_A3 = 0;
|
||||
|
||||
Graph_UpdateGame(gameState);
|
||||
Graph_ExecuteAndDraw(gfxCtx, gameState);
|
||||
}
|
||||
|
||||
void Graph_ThreadEntry(void* arg) {
|
||||
GraphicsContext gfxCtx;
|
||||
GameStateOverlay* nextOvl = &gGameStateOverlayTable[0];
|
||||
GameStateOverlay* ovl;
|
||||
GameState* gameState;
|
||||
u32 size;
|
||||
s32 pad[2];
|
||||
|
||||
gZBuffer = SystemArena_Malloc(sizeof(*gZBuffer) + sizeof(*gWorkBuffer) + 64 - 1);
|
||||
gZBuffer = (void*)ALIGN64((u32)gZBuffer);
|
||||
|
||||
gWorkBuffer = (void*)((u8*)gZBuffer + sizeof(*gZBuffer));
|
||||
|
||||
gGfxSPTaskOutputBuffer2 = gGfxSPTaskOutputBuffer = SystemArena_Malloc(sizeof(*gGfxSPTaskOutputBuffer));
|
||||
|
||||
gGfxSPTaskOutputBufferEnd = (u8*)gGfxSPTaskOutputBuffer + sizeof(*gGfxSPTaskOutputBuffer);
|
||||
gGfxSPTaskOutputBufferEnd2 = (u8*)gGfxSPTaskOutputBuffer2 + sizeof(*gGfxSPTaskOutputBuffer2);
|
||||
|
||||
func_80178978();
|
||||
Fault_SetFB(D_801FBB90, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
Graph_Init(&gfxCtx);
|
||||
|
||||
while (nextOvl) {
|
||||
ovl = nextOvl;
|
||||
|
||||
Overlay_LoadGameState(ovl);
|
||||
|
||||
size = ovl->instanceSize;
|
||||
|
||||
func_800809F4(ovl->vromStart);
|
||||
|
||||
gameState = SystemArena_Malloc(size);
|
||||
|
||||
bzero(gameState, size);
|
||||
GameState_Init(gameState, ovl->init, &gfxCtx);
|
||||
|
||||
while (GameState_IsRunning(gameState)) {
|
||||
Graph_Update(&gfxCtx, gameState);
|
||||
}
|
||||
|
||||
nextOvl = Graph_GetNextGameState(gameState);
|
||||
|
||||
if (size) {}
|
||||
|
||||
GameState_Destroy(gameState);
|
||||
SystemArena_Free(gameState);
|
||||
|
||||
Overlay_FreeGameState(ovl);
|
||||
}
|
||||
Graph_Destroy(&gfxCtx);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#include "global.h"
|
||||
|
||||
Gfx* Graph_GfxPlusOne(Gfx* gfx) {
|
||||
return &gfx[1];
|
||||
}
|
||||
|
||||
Gfx* Graph_BranchDlist(Gfx* gfx, Gfx* dst) {
|
||||
gSPBranchList(gfx, dst);
|
||||
return dst;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates a structure of `size` into the display list buffer`gfx`,
|
||||
* returning a pointer to the start of the buffer.
|
||||
* Since the alloc may not itself be display list commands, a BranchList
|
||||
* command is used to step over this region.
|
||||
*/
|
||||
void* Graph_DlistAlloc(Gfx** gfx, size_t size) {
|
||||
u8* start;
|
||||
Gfx* end;
|
||||
|
||||
size = ALIGN8(size);
|
||||
start = (u8*)&(*gfx)[1];
|
||||
end = (Gfx*)(start + size);
|
||||
gSPBranchList(*gfx, end);
|
||||
|
||||
*gfx = end;
|
||||
return start;
|
||||
}
|
||||
+4
-4
@@ -179,7 +179,7 @@ halt_rdp:
|
||||
if (dpTask->type == M_GFXTASK) {
|
||||
// Try to stop DP
|
||||
osSyncPrintf("DP止めようとします\n");
|
||||
bzero(dpTask->output_buff, (u32)dpTask->output_buff_size - (u32)dpTask->output_buff);
|
||||
bzero(dpTask->outputBuff, (u32)dpTask->outputBuffSize - (u32)dpTask->outputBuff);
|
||||
osSendMesg(&sched->interruptQ, RDP_DONE_MSG, OS_MESG_NOBLOCK);
|
||||
}
|
||||
}
|
||||
@@ -336,8 +336,8 @@ void Sched_RunTask(SchedContext* sched, OSScTask* spTask, OSScTask* dpTask) {
|
||||
|
||||
if (spTask->list.t.type == M_AUDTASK) {
|
||||
// Set global pointers to audio task data for use in audio processing
|
||||
gAudioSPDataPtr = spTask->list.t.data_ptr;
|
||||
gAudioSPDataSize = spTask->list.t.data_size;
|
||||
gAudioSPDataPtr = spTask->list.t.dataPtr;
|
||||
gAudioSPDataSize = spTask->list.t.dataSize;
|
||||
}
|
||||
|
||||
// Begin task execution
|
||||
@@ -527,7 +527,7 @@ void Sched_FaultClient(void* param1, void* param2) {
|
||||
spTask = sched->curRSPTask;
|
||||
if (spTask != NULL) {
|
||||
FaultDrawer_Printf("RSPTask %08x %08x %02x %02x\n%01x %08x %08x\n", spTask, spTask->next, spTask->state,
|
||||
spTask->flags, spTask->list.t.type, spTask->list.t.data_ptr, spTask->list.t.data_size);
|
||||
spTask->flags, spTask->list.t.type, spTask->list.t.dataPtr, spTask->list.t.dataSize);
|
||||
}
|
||||
|
||||
dpTask = sched->curRDPTask;
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_cmpdma/func_801789D4.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_cmpdma/get_framebuffer.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_cmpdma/SysCfb_GetFbPtr.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_cmpdma/get_zbuffer.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_cmpdma/SysCfb_GetZBuffer.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_cmpdma/func_80178A24.s")
|
||||
|
||||
|
||||
@@ -87,11 +87,3 @@ void Matrix_StatePop(void) {
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_InsertRotationAroundUnitVector_f.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_InsertRotationAroundUnitVector_s.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/func_80182C90.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/func_80182CA0.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/func_80182CBC.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/func_80182CCC.s")
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#include "global.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_ucode/func_80182CE0.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_ucode/SysUcode_GetUCodeBoot.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_ucode/func_80183020.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_ucode/SysUcode_GetUCodeBootSize.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_ucode/func_80183058.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_ucode/SysUcode_GetUCode.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_ucode/SysUcode_GetUCodeData.s")
|
||||
|
||||
@@ -62,6 +62,6 @@ void TitleSetup_Destroy(GameState* gameState) {
|
||||
}
|
||||
|
||||
void TitleSetup_Init(GameState* gameState) {
|
||||
gameState->destroy = &TitleSetup_Destroy;
|
||||
gameState->destroy = TitleSetup_Destroy;
|
||||
TitleSetup_InitImpl(gameState);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user