From acfffa6d85d770358b6aa584239e6fa067c311ab Mon Sep 17 00:00:00 2001 From: James Benton Date: Thu, 7 Jan 2016 04:44:44 -0800 Subject: [PATCH] Apparently static const struct members don't exist in C. Let's use #defines, that's much better ... C is nice language Kappa --- include/coreinit/alarm.h | 7 +++++-- include/coreinit/condition.h | 6 +++--- include/coreinit/event.h | 4 ++-- include/coreinit/fastmutex.h | 4 ++-- include/coreinit/mutex.h | 4 ++-- include/coreinit/semaphore.h | 4 ++-- include/coreinit/thread.h | 7 ++++--- 7 files changed, 20 insertions(+), 16 deletions(-) diff --git a/include/coreinit/alarm.h b/include/coreinit/alarm.h index 879909b..f1aa4a9 100644 --- a/include/coreinit/alarm.h +++ b/include/coreinit/alarm.h @@ -16,9 +16,11 @@ typedef struct OSAlarmQueue OSAlarmQueue; typedef void (*OSAlarmCallback)(OSAlarm *, OSContext *); +#define OS_ALARM_QUEUE_TAG 0x614C6D51u + struct OSAlarmQueue { - static const uint32_t Tag = 0x614C6D51; + // OS_ALARM_QUEUE_TAG uint32_t tag; const char *name; UNKNOWN(4); @@ -42,9 +44,10 @@ CHECK_OFFSET(OSAlarmLink, 0x00, prev); CHECK_OFFSET(OSAlarmLink, 0x04, next); CHECK_SIZE(OSAlarmLink, 0x08); +#define OS_ALARM_TAG 0x614C724Du struct OSAlarm { - static const uint32_t Tag = 0x614C724D; + // OS_ALARM_TAG uint32_t tag; const char *name; UNKNOWN(4); diff --git a/include/coreinit/condition.h b/include/coreinit/condition.h index ccaf6ea..9e5d28a 100644 --- a/include/coreinit/condition.h +++ b/include/coreinit/condition.h @@ -10,11 +10,11 @@ struct OSMutex; typedef struct OSCondition OSCondition; +#define OS_CONDITION_TAG 0x634E6456u + struct OSCondition { - static const uint32_t Tag = 0x634E6456; - - // OSCondition::Tag + // OS_CONDITION_TAG uint32_t tag; // Name set by OSInitCondEx(condition, name) diff --git a/include/coreinit/event.h b/include/coreinit/event.h index e0a9943..e2eb182 100644 --- a/include/coreinit/event.h +++ b/include/coreinit/event.h @@ -17,10 +17,10 @@ enum OSEventMode OS_EVENT_MODE_AUTO = 1, }; +#define OS_EVENT_TAG 0x65566E54u + struct OSEvent { - static const uint32_t Tag = 0x65566E54; - uint32_t tag; const char *name; UNKNOWN(4); diff --git a/include/coreinit/fastmutex.h b/include/coreinit/fastmutex.h index 9a66fd9..fdf3656 100644 --- a/include/coreinit/fastmutex.h +++ b/include/coreinit/fastmutex.h @@ -19,10 +19,10 @@ CHECK_OFFSET(OSFastMutexLink, 0x00, next); CHECK_OFFSET(OSFastMutexLink, 0x04, prev); CHECK_SIZE(OSFastMutexLink, 0x08); +#define OS_FAST_MUTEX_TAG 0x664D7458u + struct OSFastMutex { - static const uint32_t Tag = 0x664D7458; - uint32_t tag; const char *name; UNKNOWN(4); diff --git a/include/coreinit/mutex.h b/include/coreinit/mutex.h index 7e58ba5..ff7c32a 100644 --- a/include/coreinit/mutex.h +++ b/include/coreinit/mutex.h @@ -21,10 +21,10 @@ CHECK_OFFSET(OSMutexLink, 0x00, next); CHECK_OFFSET(OSMutexLink, 0x04, prev); CHECK_SIZE(OSMutexLink, 0x8); +#define OS_MUTEX_TAG 0x6D557458u + struct OSMutex { - static const uint32_t Tag = 0x6D557458; - // OSMutex::Tag uint32_t tag; diff --git a/include/coreinit/semaphore.h b/include/coreinit/semaphore.h index a75241d..10b648a 100644 --- a/include/coreinit/semaphore.h +++ b/include/coreinit/semaphore.h @@ -8,10 +8,10 @@ extern "C" { typedef struct OSSemaphore OSSemaphore; +#define OS_SEMAPHORE_TAG 0x73506852u + struct OSSemaphore { - static const uint32_t Tag = 0x73506852; - uint32_t tag; const char *name; UNKNOWN(4); diff --git a/include/coreinit/thread.h b/include/coreinit/thread.h index f54ec3f..cd7df42 100644 --- a/include/coreinit/thread.h +++ b/include/coreinit/thread.h @@ -46,9 +46,10 @@ enum OSThreadAttributes OS_THREAD_ATTRIB_DETACHED = 1 << 4 }; +#define OS_CONTEXT_TAG 0x4F53436F6E747874ull + struct OSContext { - static const uint64_t Tag1 = 0x4F53436F6E747874ull; uint64_t tag; uint32_t gpr[32]; uint32_t cr; @@ -122,10 +123,10 @@ CHECK_OFFSET(OSFastMutexQueue, 0x00, head); CHECK_OFFSET(OSFastMutexQueue, 0x04, tail); CHECK_SIZE(OSFastMutexQueue, 0x08); +#define OS_THREAD_TAG 0x74487244u + struct OSThread { - static const uint32_t Tag = 0x74487244; - OSContext context; uint32_t tag; OSThreadState state;