1313#define RACE_CULL_BOX_HALF_EXTENT_FIXED 0x0FEA0000
1414#define RACE_CULL_BOX_FULL_EXTENT_FIXED 0x1FD40000
1515
16+ #define BUFFER_SIZE 0x10000
17+
18+ // gCallbackEntrySegment overlaps with the lower 2 bytes of gCurrentDoubleBufferIndex
19+ #define gCallbackEntrySegment (*(u16 *)((u8 *)&gCurrentDoubleBufferIndex + 2))
20+
1621typedef struct {
1722 u8 light1R ;
1823 u8 light1G ;
@@ -37,6 +42,12 @@ typedef struct CallbackEntry {
3742 u8 poolIndex ;
3843} CallbackEntry ;
3944
45+ typedef struct {
46+ u8 padding [0x8 ];
47+ CallbackEntry * unk8 ;
48+ s32 unkC ;
49+ } CallbackPoolSlot ;
50+
4051/* RSP task message sent to the scheduler for each viewport group */
4152typedef struct {
4253 OSTask t ;
@@ -77,6 +88,30 @@ typedef struct {
7788 u64 * ucode_data ;
7889} UcodeEntry ;
7990
91+ typedef struct {
92+ s16 clipLeft ;
93+ s16 clipTop ;
94+ s16 clipRight ;
95+ s16 clipBottom ;
96+ u8 displayFlags ;
97+ u8 overlayR ;
98+ u8 overlayG ;
99+ u8 overlayB ;
100+ u8 envR ;
101+ u8 envG ;
102+ u8 envB ;
103+ u8 envA ;
104+ } BorderData ;
105+
106+ typedef struct {
107+ /* 0x00 */ s16 clipLeft ;
108+ /* 0x02 */ s16 clipTop ;
109+ /* 0x04 */ s16 clipRight ;
110+ /* 0x06 */ s16 clipBottom ;
111+ /* 0x08 */ s16 offsetX ;
112+ /* 0x0A */ s16 offsetY ;
113+ } TextClipAndOffsetData ;
114+
80115typedef struct ViewportNode {
81116 /* 0x00 */ union {
82117 struct ViewportNode * next ;
@@ -177,13 +212,44 @@ typedef struct {
177212} ColorData ;
178213
179214extern ViewportNode gRootViewport ;
215+ extern s32 gCurrentDoubleBufferIndex ;
216+ extern s32 gCurrentDisplayBufferIndex ;
217+ extern s32 gFrameSkipCounter ;
218+ extern u32 __additional_scanline_0 ;
219+ extern u8 gNeedsDisplayListInit ;
220+ extern u8 gDisplayFramePending ;
221+ extern s32 gFrameBufferFlags [];
222+ extern s32 gFrameBufferCounters [];
223+ extern s32 gFrameCounter ;
224+ extern s32 gBufferedFrameCounter ;
225+ extern ActiveViewportState * gActiveViewport ;
226+ extern s16 gGraphicsMode ;
227+ extern s16 gCurrentPoolIndex ;
228+ extern s32 gCallbackCounter ;
229+ extern TextClipAndOffsetData gTextClipAndOffsetData ;
230+ extern OSMesgQueue mainMessageQueue ;
231+ extern Gfx gInitDisplayList [];
232+ extern Gfx gDefaultRenderDisplayList [];
233+ extern Gfx gFadeOverlayDisplayList [];
180234
181235// Location of S2Dex code/rodata segments
182236extern u64 gspS2DEX_fifoTextStart [];
183237extern u64 gspS2DEX_fifoDataStart [];
184238
185239extern UcodeEntry microcodeGroups [];
186240
241+ void selectGraphicsArena (s32 index );
242+
243+ void linearAllocSelectRegion (s32 index );
244+
245+ void initViewportCallbackPool (ViewportNode * node );
246+
247+ s32 isRegionAllocSpaceLow (void );
248+
249+ void resetLinearAllocator (void );
250+
251+ void updateViewportBounds (void );
252+
187253void setViewportFadeValue (ViewportNode * node , u8 fadeValue , u8 fadeMode );
188254
189255void setViewportFadeValueBySlotIndex (u16 slotIndex , u8 fadeValue , u8 fadeMode );
@@ -240,4 +306,4 @@ void func_8006FEE8_70AE8(ViewportNode *arg0);
240306
241307void setViewportOverlayRgbAndEnable (ViewportNode * arg0 , s8 r , s8 g , s8 b );
242308
243- void setViewportLightColors (u16 viewportId , u16 colorCount , ColorData * lightColors , ColorData * ambientColor );
309+ void setViewportLightColors (u16 viewportId , u16 colorCount , ColorData * lightColors , ColorData * ambientColor );
0 commit comments