From f9123fa460177bb5bd1bfdc7e298b5a03ad40192 Mon Sep 17 00:00:00 2001 From: James Benton Date: Fri, 8 Jan 2016 08:52:12 -0800 Subject: [PATCH] Fix compile errors. --- include/coreinit/alarm.h | 2 +- include/coreinit/event.h | 2 -- include/coreinit/exception.h | 1 - include/coreinit/frameheap.h | 7 +++++++ include/coreinit/memlist.h | 11 +++++++---- include/coreinit/messagequeue.h | 5 +++-- include/coreinit/mutex.h | 3 +-- include/coreinit/rendezvous.h | 2 -- include/coreinit/spinlock.h | 2 -- include/coreinit/taskqueue.h | 21 +++++++++++++++++---- include/gx2/context.h | 3 +++ include/gx2/event.h | 2 ++ include/gx2/registers.h | 28 +++++++++++++++++++++++++--- include/gx2/sampler.h | 3 +++ include/gx2/surface.h | 15 +++++++++++++++ include/gx2/texture.h | 4 ++-- 16 files changed, 86 insertions(+), 25 deletions(-) diff --git a/include/coreinit/alarm.h b/include/coreinit/alarm.h index f941e2f..bca8e0a 100644 --- a/include/coreinit/alarm.h +++ b/include/coreinit/alarm.h @@ -111,7 +111,7 @@ CHECK_OFFSET(OSAlarm, 0x10, group); CHECK_OFFSET(OSAlarm, 0x18, nextFire); CHECK_OFFSET(OSAlarm, 0x20, link); CHECK_OFFSET(OSAlarm, 0x28, period); -CHECK_OFFSET(OSAlarm, 0x30, tbrStart); +CHECK_OFFSET(OSAlarm, 0x30, start); CHECK_OFFSET(OSAlarm, 0x38, userData); CHECK_OFFSET(OSAlarm, 0x3c, state); CHECK_OFFSET(OSAlarm, 0x40, threadQueue); diff --git a/include/coreinit/event.h b/include/coreinit/event.h index 0395271..91362af 100644 --- a/include/coreinit/event.h +++ b/include/coreinit/event.h @@ -56,8 +56,6 @@ CHECK_OFFSET(OSEvent, 0x10, queue); CHECK_OFFSET(OSEvent, 0x20, mode); CHECK_SIZE(OSEvent, 0x24); -#pragma pack(pop) - /** * Initialise an event object with value and mode. diff --git a/include/coreinit/exception.h b/include/coreinit/exception.h index d0ec70a..ec59607 100644 --- a/include/coreinit/exception.h +++ b/include/coreinit/exception.h @@ -11,7 +11,6 @@ extern "C" { #endif -typedef uint32_t OSExceptionType; typedef BOOL (*OSExceptionCallbackFn)(OSContext *context); typedef enum OSExceptionType diff --git a/include/coreinit/frameheap.h b/include/coreinit/frameheap.h index 6e8ce04..cb5b1c8 100644 --- a/include/coreinit/frameheap.h +++ b/include/coreinit/frameheap.h @@ -17,6 +17,13 @@ typedef enum MEMFrameHeapFreeMode MEM_FRAME_HEAP_FREE_FROM_TOP = 1 << 1, } MEMFrameHeapFreeMode; +typedef struct MEMFrameHeap MEMFrameHeap; + +struct MEMFrameHeap +{ +}; +UNKNOWN_SIZE(MEMFrameHeap); + MEMFrameHeap * MEMCreateFrmHeap(MEMFrameHeap *heap, uint32_t size); diff --git a/include/coreinit/memlist.h b/include/coreinit/memlist.h index 462f2db..7544807 100644 --- a/include/coreinit/memlist.h +++ b/include/coreinit/memlist.h @@ -11,15 +11,18 @@ extern "C" { #endif +typedef struct MEMMemoryLink MEMMemoryLink; +typedef struct MEMMemoryList MEMMemoryList; + struct MEMMemoryLink { void *prev; void *next; }; -CHECK_OFFSET(MemoryLink, 0x0, prev); -CHECK_OFFSET(MemoryLink, 0x4, next); -CHECK_SIZE(MemoryLink, 0x8); +CHECK_OFFSET(MEMMemoryLink, 0x0, prev); +CHECK_OFFSET(MEMMemoryLink, 0x4, next); +CHECK_SIZE(MEMMemoryLink, 0x8); struct MEMMemoryList { @@ -64,7 +67,7 @@ MEMGetPrevListObject(MEMMemoryList *list, void *object); void * -MEMGetNthListObject(MEMMEMMemoryList *list, +MEMGetNthListObject(MEMMemoryList *list, uint16_t n); #ifdef __cplusplus diff --git a/include/coreinit/messagequeue.h b/include/coreinit/messagequeue.h index c81fe4f..458095c 100644 --- a/include/coreinit/messagequeue.h +++ b/include/coreinit/messagequeue.h @@ -11,6 +11,9 @@ extern "C" { #endif +typedef struct OSMessage OSMessage; +typedef struct OSMessageQueue OSMessageQueue; + typedef enum OSMessageFlags { OS_MESSAGE_QUEUE_BLOCKING = 1 << 0, @@ -50,8 +53,6 @@ CHECK_OFFSET(OSMessageQueue, 0x34, first); CHECK_OFFSET(OSMessageQueue, 0x38, used); CHECK_SIZE(OSMessageQueue, 0x3c); -#pragma pack(pop) - void OSInitMessageQueue(OSMessageQueue *queue, OSMessage *messages, diff --git a/include/coreinit/mutex.h b/include/coreinit/mutex.h index 9aa90fa..2b7c9e2 100644 --- a/include/coreinit/mutex.h +++ b/include/coreinit/mutex.h @@ -16,9 +16,8 @@ extern "C" { #endif -typedef struct OSThread; +typedef struct OSThread OSThread; -typedef struct OSCondition OSCondition; typedef struct OSMutex OSMutex; typedef struct OSMutexLink OSMutexLink; diff --git a/include/coreinit/rendezvous.h b/include/coreinit/rendezvous.h index c282815..edb44f6 100644 --- a/include/coreinit/rendezvous.h +++ b/include/coreinit/rendezvous.h @@ -21,8 +21,6 @@ struct OSRendezvous CHECK_OFFSET(OSRendezvous, 0x00, core); CHECK_SIZE(OSRendezvous, 0x10); -#pragma pack(pop) - void OSInitRendezvous(OSRendezvous *rendezvous); diff --git a/include/coreinit/spinlock.h b/include/coreinit/spinlock.h index 98efd9a..440c815 100644 --- a/include/coreinit/spinlock.h +++ b/include/coreinit/spinlock.h @@ -25,8 +25,6 @@ CHECK_OFFSET(OSSpinLock, 0x0, owner); CHECK_OFFSET(OSSpinLock, 0x8, recursion); CHECK_SIZE(OSSpinLock, 0x10); -#pragma pack(pop) - void OSInitSpinLock(OSSpinLock *spinlock); diff --git a/include/coreinit/taskqueue.h b/include/coreinit/taskqueue.h index 4a15b23..ad7d572 100644 --- a/include/coreinit/taskqueue.h +++ b/include/coreinit/taskqueue.h @@ -21,12 +21,22 @@ typedef uint32_t (*MPTaskFunc)(uint32_t, uint32_t); typedef enum MPTaskState { - MP_TASK_STATE_INITIALISED = 1 << 0, - MP_TASK_STATE_READY = 1 << 1, - MP_TASK_STATE_RUNNING = 1 << 2, - MP_TASK_STATE_FINISHED = 1 << 3, + MP_TASK_STATE_INITIALISED = 1 << 0, + MP_TASK_STATE_READY = 1 << 1, + MP_TASK_STATE_RUNNING = 1 << 2, + MP_TASK_STATE_FINISHED = 1 << 3, } MPTaskState; +typedef enum MPTaskQueueState +{ + MP_TASK_QUEUE_STATE_INITIALISED = 1 << 0, + MP_TASK_QUEUE_STATE_READY = 1 << 1, + MP_TASK_QUEUE_STATE_STOPPING = 1 << 2, + MP_TASK_QUEUE_STATE_STOPPED = 1 << 3, + MP_TASK_QUEUE_STATE_FINISHED = 1 << 4, +} MPTaskQueueState; + +#pragma pack(push, 1) struct MPTaskInfo { MPTaskState state; @@ -34,12 +44,14 @@ struct MPTaskInfo uint32_t coreID; OSTime duration; }; +#pragma pack(pop) CHECK_OFFSET(MPTaskInfo, 0x00, state); CHECK_OFFSET(MPTaskInfo, 0x04, result); CHECK_OFFSET(MPTaskInfo, 0x08, coreID); CHECK_OFFSET(MPTaskInfo, 0x0C, duration); CHECK_SIZE(MPTaskInfo, 0x14); +#pragma pack(push, 1) struct MPTask { MPTask *self; @@ -53,6 +65,7 @@ struct MPTask OSTime duration; void *userData; }; +#pragma pack(pop) CHECK_OFFSET(MPTask, 0x00, self); CHECK_OFFSET(MPTask, 0x04, queue); CHECK_OFFSET(MPTask, 0x08, state); diff --git a/include/gx2/context.h b/include/gx2/context.h index 3251875..0395640 100644 --- a/include/gx2/context.h +++ b/include/gx2/context.h @@ -11,6 +11,9 @@ extern "C" { #endif +typedef struct GX2ShadowState GX2ShadowState; +typedef struct GX2ContextState GX2ContextState; + struct GX2ShadowState { uint32_t config[0xB00]; diff --git a/include/gx2/event.h b/include/gx2/event.h index 5aad7b1..48ad136 100644 --- a/include/gx2/event.h +++ b/include/gx2/event.h @@ -12,6 +12,8 @@ extern "C" { #endif +typedef struct GX2DisplayListOverrunData GX2DisplayListOverrunData; + typedef enum GX2EventType { GX2_EVENT_TYPE_VSYNC = 2, diff --git a/include/gx2/registers.h b/include/gx2/registers.h index d6b8f0b..e4fb563 100644 --- a/include/gx2/registers.h +++ b/include/gx2/registers.h @@ -1,8 +1,9 @@ #pragma once #include +#include "surface.h" /** - * \defgroup gx2_displaylist Display List + * \defgroup gx2_registers Registers * \ingroup gx2 * @{ */ @@ -11,6 +12,23 @@ extern "C" { #endif +typedef struct GX2AAMaskReg GX2AAMaskReg; +typedef struct GX2AlphaTestReg GX2AlphaTestReg; +typedef struct GX2AlphaToMaskReg GX2AlphaToMaskReg; +typedef struct GX2BlendControlReg GX2BlendControlReg; +typedef struct GX2BlendConstantColorReg GX2BlendConstantColorReg; +typedef struct GX2ColorControlReg GX2ColorControlReg; +typedef struct GX2DepthStencilControlReg GX2DepthStencilControlReg; +typedef struct GX2StencilMaskReg GX2StencilMaskReg; +typedef struct GX2LineWidthReg GX2LineWidthReg; +typedef struct GX2PointSizeReg GX2PointSizeReg; +typedef struct GX2PointLimitsReg GX2PointLimitsReg; +typedef struct GX2PolygonControlReg GX2PolygonControlReg; +typedef struct GX2PolygonOffsetReg GX2PolygonOffsetReg; +typedef struct GX2ScissorReg GX2ScissorReg; +typedef struct GX2TargetChannelMaskReg GX2TargetChannelMaskReg; +typedef struct GX2ViewportReg GX2ViewportReg; + typedef enum GX2CompareFunction { GX2_COMPARE_FUNC_NEVER = 0, @@ -64,6 +82,12 @@ typedef enum GX2BlendCombineMode GX2_BLEND_COMBINE_MODE_REV_SUB = 4, } GX2BlendCombineMode; +typedef enum GX2FrontFace +{ + GX2_FRONT_FACE_CCW = 0, + GX2_FRONT_FACE_CW = 1, +} GX2FrontFace; + typedef enum GX2LogicOp { GX2_LOGIC_OP_CLEAR = 0x00, @@ -219,8 +243,6 @@ struct GX2ViewportReg }; CHECK_SIZE(GX2ViewportReg, 48); -#pragma pack(pop) - void GX2SetAAMask(uint8_t upperLeft, uint8_t upperRight, diff --git a/include/gx2/sampler.h b/include/gx2/sampler.h index b160fac..3819d54 100644 --- a/include/gx2/sampler.h +++ b/include/gx2/sampler.h @@ -11,6 +11,8 @@ extern "C" { #endif +typedef struct GX2Sampler GX2Sampler; + struct GX2Sampler { uint32_t regs[3]; @@ -66,6 +68,7 @@ typedef enum GX2TexZFilterMode typedef enum GX2TexZPerfMode { + GX2_TEX_Z_PERF_MODE_DISABLED = 0, } GX2TexZPerfMode; typedef enum GX2RoundingMode diff --git a/include/gx2/surface.h b/include/gx2/surface.h index e38b381..d1ef52d 100644 --- a/include/gx2/surface.h +++ b/include/gx2/surface.h @@ -11,6 +11,10 @@ extern "C" { #endif +typedef struct GX2Surface GX2Surface; +typedef struct GX2DepthBuffer GX2DepthBuffer; +typedef struct GX2ColorBuffer GX2ColorBuffer; + typedef enum { GX2_SURFACE_DIM_TEXTURE_1D = 0, @@ -157,6 +161,17 @@ typedef enum GX2TileMode GX2_TILE_MODE_LINEAR_SPECIAL = 16, } GX2TileMode; +typedef enum GX2RenderTarget +{ + GX2_RENDER_TARGET_0 = 0, + GX2_RENDER_TARGET_1 = 1, + GX2_RENDER_TARGET_2 = 2, + GX2_RENDER_TARGET_3 = 3, + GX2_RENDER_TARGET_4 = 4, + GX2_RENDER_TARGET_5 = 5, + GX2_RENDER_TARGET_6 = 6, +} GX2RenderTarget; + struct GX2Surface { GX2SurfaceDim dim; diff --git a/include/gx2/texture.h b/include/gx2/texture.h index c7c2b53..3f4d8b9 100644 --- a/include/gx2/texture.h +++ b/include/gx2/texture.h @@ -12,6 +12,8 @@ extern "C" { #endif +typedef struct GX2Texture GX2Texture; + struct GX2Texture { GX2Surface surface; @@ -32,8 +34,6 @@ CHECK_OFFSET(GX2Texture, 0x84, compMap); CHECK_OFFSET(GX2Texture, 0x88, regs); CHECK_SIZE(GX2Texture, 0x9c); -#pragma pack(pop) - void GX2InitTextureRegs(GX2Texture *texture);