Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure all enums are 4 bytes #306

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/avm/drc.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ typedef enum AVMDrcScanMode
AVM_DRC_SCAN_MODE_UNKNOWN_3 = 3,
AVM_DRC_SCAN_MODE_UNKNOWN_255 = 255,
} AVMDrcScanMode;
WUT_CHECK_SIZE(AVMDrcScanMode, 4);

typedef enum AVMDrcMode
{
AVM_DRC_MODE_NONE = 0,
AVM_DRC_MODE_SINGLE = 1,
AVM_DRC_MODE_DOUBLE = 2,
} AVMDrcMode;
WUT_CHECK_SIZE(AVMDrcMode, 4);

BOOL
AVMGetDRCScanMode(AVMDrcScanMode *outScanMode);
Expand Down
3 changes: 3 additions & 0 deletions include/camera/camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,20 @@ typedef enum CamError
CAMERA_ERROR_DEVICE_IN_USE = -12,
CAMERA_ERROR_SEGMENT_VIOLATION = -14
} CamError;
WUT_CHECK_SIZE(CamError, 4);

typedef enum CamFps
{
CAMERA_FPS_15,
CAMERA_FPS_30
} CamFps;
WUT_CHECK_SIZE(CamFps, 4);

typedef enum CamStreamType
{
CAMERA_STREAM_TYPE_1
} CamStreamType;
WUT_CHECK_SIZE(CamStreamType, 4);

struct CAMEventData
{
Expand Down
2 changes: 2 additions & 0 deletions include/coreinit/bsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ typedef enum BSPErrors
BSP_ERROR_IOS_ERROR = 0x40,
BSP_ERROR_RESPONSE_TOO_LARGE = 0x80,
} BSPErrors;
WUT_CHECK_SIZE(BSPErrors, 4);

typedef enum BSPHardwareVersions
{
Expand Down Expand Up @@ -58,6 +59,7 @@ typedef enum BSPHardwareVersions
BSP_HARDWARE_VERSION_LATTE_B1X_CAT = 0x26100020,
BSP_HARDWARE_VERSION_LATTE_B1X_CAFE = 0x26100028
} BSPHardwareVersions;
WUT_CHECK_SIZE(BSPHardwareVersions, 4);

BSPError
bspInitializeShimInterface();
Expand Down
1 change: 1 addition & 0 deletions include/coreinit/codegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ typedef enum OSCodegenSecMode
//! The area can be read or executed, but not written to.
CODEGEN_R_X = 1,
} OSCodegenSecMode;
WUT_CHECK_SIZE(OSCodegenSecMode, 4);

/**
* Gets the location and size of codegen memory, if available.
Expand Down
1 change: 1 addition & 0 deletions include/coreinit/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ enum OS_CONTEXT_STATE {
OS_CONTEXT_STATE_OSCALLBACK = 1 << 3,
OS_CONTEXT_STATE_USERMODE_SAVED = 1 << 4
};
WUT_CHECK_SIZE(enum OS_CONTEXT_STATE, 4);

typedef struct OSContext OSContext;

Expand Down
2 changes: 2 additions & 0 deletions include/coreinit/cosreport.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ typedef enum COSReportLevel{
COS_REPORT_LEVEL_INFO = 2,
COS_REPORT_LEVEL_VERBOSE = 3,
} COSReportLevel;
WUT_CHECK_SIZE(COSReportLevel, 4);

typedef enum COSReportModule{
COS_REPORT_MODULE_UNKNOWN_0 = 0,
COS_REPORT_MODULE_UNKNOWN_1 = 1,
COS_REPORT_MODULE_UNKNOWN_2 = 2,
COS_REPORT_MODULE_UNKNOWN_5 = 5,
} COSReportModule;
WUT_CHECK_SIZE(COSReportModule, 4);

void
COSVReport(COSReportModule module,
Expand Down
2 changes: 1 addition & 1 deletion include/coreinit/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ typedef enum DisassemblePPCFlags
{
DISASSEMBLE_PPC_FLAGS_NONE = 0,
} DisassemblePPCFlags;

WUT_CHECK_SIZE(DisassemblePPCFlags, 4);

void
OSConsoleWrite(const char *msg,
Expand Down
6 changes: 5 additions & 1 deletion include/coreinit/dynload.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ typedef enum OSDynLoad_Error
OS_DYNLOAD_INVALID_ALLOCATOR_PTR = 0xBAD10017,
OS_DYNLOAD_OUT_OF_SYSTEM_MEMORY = 0xBAD1002F,
OS_DYNLOAD_TLS_ALLOCATOR_LOCKED = 0xBAD10031,
OS_DYNLOAD_MODULE_NOT_FOUND = -6,
OS_DYNLOAD_MODULE_NOT_FOUND = 0xFFFFFFFA,
} OSDynLoad_Error;
WUT_CHECK_SIZE(OSDynLoad_Error, 4);

typedef OSDynLoad_Error (*OSDynLoadAllocFn)(int32_t size, int32_t align, void **outAddr);
typedef void (*OSDynLoadFreeFn)(void *addr);
Expand All @@ -43,12 +44,14 @@ typedef enum OSDynLoad_ExportType {
OS_DYNLOAD_EXPORT_FUNC = 0,
OS_DYNLOAD_EXPORT_DATA = 1,
} OSDynLoad_ExportType;
WUT_CHECK_SIZE(OSDynLoad_ExportType, 4);

typedef enum OSDynLoad_EntryReason
{
OS_DYNLOAD_LOADED = 0,
OS_DYNLOAD_UNLOADED = 1,
} OSDynLoad_EntryReason;
WUT_CHECK_SIZE(OSDynLoad_EntryReason, 4);

struct OSDynLoad_NotifyData
{
Expand Down Expand Up @@ -201,6 +204,7 @@ typedef enum OSDynLoad_NotifyReason
OS_DYNLOAD_NOTIFY_UNLOADED = 0,
OS_DYNLOAD_NOTIFY_LOADED = 1
} OSDynLoad_NotifyReason;
WUT_CHECK_SIZE(OSDynLoad_NotifyReason, 4);

typedef void (*OSDynLoadNotifyFunc)(OSDynLoad_Module module,
void *userContext,
Expand Down
1 change: 1 addition & 0 deletions include/coreinit/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ typedef enum OSEventMode
//! An auto event will reset everytime a thread is woken.
OS_EVENT_MODE_AUTO = 1,
} OSEventMode;
WUT_CHECK_SIZE(OSEventMode, 4);

#define OS_EVENT_TAG 0x65566E54u

Expand Down
2 changes: 2 additions & 0 deletions include/coreinit/exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ typedef enum OSExceptionMode
OS_EXCEPTION_MODE_THREAD_ALL_CORES = 3,
OS_EXCEPTION_MODE_GLOBAL_ALL_CORES = 4,
} OSExceptionMode;
WUT_CHECK_SIZE(OSExceptionMode, 4);

typedef enum OSExceptionType
{
Expand All @@ -41,6 +42,7 @@ typedef enum OSExceptionType
OS_EXCEPTION_TYPE_SYSTEM_INTERRUPT = 13,
OS_EXCEPTION_TYPE_ICI = 14,
} OSExceptionType;
WUT_CHECK_SIZE(OSExceptionType, 4);

OSExceptionCallbackFn
OSSetExceptionCallback(OSExceptionType exceptionType,
Expand Down
9 changes: 9 additions & 0 deletions include/coreinit/filesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ typedef enum FSErrorFlag
FS_ERROR_FLAG_JOURNAL_FULL = 0x800,
FS_ERROR_FLAG_ALL = 0xFFFFFFFF,
} FSErrorFlag;
WUT_CHECK_SIZE(FSErrorFlag, 4);

typedef enum FSStatus
{
Expand All @@ -90,6 +91,7 @@ typedef enum FSStatus
FS_STATUS_CORRUPTED = -18,
FS_STATUS_FATAL_ERROR = -0x400,
} FSStatus;
WUT_CHECK_SIZE(FSStatus, 4);

typedef enum FSError
{
Expand Down Expand Up @@ -132,6 +134,7 @@ typedef enum FSError
FS_ERROR_WRITE_PROTECTED = -0x30042,
FS_ERROR_INVALID_MEDIA = -0x30043,
} FSError;
WUT_CHECK_SIZE(FSError, 4);

typedef enum FSMode
{
Expand All @@ -147,6 +150,7 @@ typedef enum FSMode
FS_MODE_WRITE_OTHER = 0x002,
FS_MODE_EXEC_OTHER = 0x001,
} FSMode;
WUT_CHECK_SIZE(FSMode, 4);

//! Flags for \link FSStat \endlink.
//! One can return multiple flags, so for example a file that's encrypted or a linked directory.
Expand All @@ -164,6 +168,7 @@ typedef enum FSStatFlags
//! Note: It's currently not known how one can read the linked-to file entry.
FS_STAT_LINK = 0x00010000,
} FSStatFlags;
WUT_CHECK_SIZE(FSStatFlags, 4);

typedef enum FSVolumeState
{
Expand All @@ -180,6 +185,7 @@ typedef enum FSVolumeState
FS_VOLUME_STATE_FATAL = 10,
FS_VOLUME_STATE_INVALID = 11,
} FSVolumeState;
WUT_CHECK_SIZE(FSVolumeState, 4);

typedef enum FSMediaState {
FS_MEDIA_STATE_READY = 0,
Expand All @@ -188,11 +194,13 @@ typedef enum FSMediaState {
FS_MEDIA_STATE_DIRTY_MEDIA = 3,
FS_MEDIA_STATE_MEDIA_ERROR = 4,
} FSMediaState;
WUT_CHECK_SIZE(FSMediaState, 4);

typedef enum FSMountSourceType {
FS_MOUNT_SOURCE_SD = 0,
FS_MOUNT_SOURCE_UNK = 1,
} FSMountSourceType;
WUT_CHECK_SIZE(FSMountSourceType, 4);

typedef enum FSOpenFileFlags
{
Expand All @@ -203,6 +211,7 @@ typedef enum FSOpenFileFlags
//! Preallocates new file size using given size
FS_OPEN_FLAG_PREALLOC_SIZE = (1 << 1)
} FSOpenFileFlags;
WUT_CHECK_SIZE(FSOpenFileFlags, 4);

typedef void(*FSAsyncCallback)(FSClient *, FSCmdBlock *, FSStatus, uint32_t);
typedef void(*FSStateChangeCallback)(FSClient *, FSVolumeState, void *);
Expand Down
16 changes: 12 additions & 4 deletions include/coreinit/filesystem_fsa.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ typedef enum FSAMountPriority {
FSA_MOUNT_PRIORITY_TITLE_UPDATE = 0x9,
FSA_MOUNT_PRIORITY_UNMOUNT_ALL = 0x80000000,
} FSAMountPriority;
WUT_CHECK_SIZE(FSAMountPriority, 4);

typedef enum FSAQueryInfoType {
FSA_QUERY_INFO_FREE_SPACE_SIZE = 0x0,
Expand All @@ -127,16 +128,19 @@ typedef enum FSAQueryInfoType {
FSA_QUERY_INFO_JOURNAL_FREE_SPACE_SIZE = 0x7,
FSA_QUERY_INFO_FRAGMENT_BLOCK_INFO = 0x8,
} FSAQueryInfoType;
WUT_CHECK_SIZE(FSAQueryInfoType, 4);

typedef enum FSAReadFlag {
FSA_READ_FLAG_NONE = 0x0,
FSA_READ_FLAG_READ_WITH_POS = 0x1
} FSAReadFlag;
WUT_CHECK_SIZE(FSAReadFlag, 4);

typedef enum FSAWriteFlag {
FSA_WRITE_FLAG_NONE = 0x0,
FSA_WRITE_FLAG_READ_WITH_POS = 0x1
} FSAWriteFlag;
WUT_CHECK_SIZE(FSAWriteFlag, 4);

/**
* Process information.
Expand Down Expand Up @@ -723,7 +727,7 @@ WUT_CHECK_OFFSET(FSAResponse, 0x0, word0);
WUT_CHECK_OFFSET(FSAResponse, 0x4, rawOpen);
WUT_CHECK_SIZE(FSAResponse, 0x293);

enum FSACommandEnum {
typedef enum FSACommandEnum {
FSA_COMMAND_INVALID = 0x0,
FSA_COMMAND_MOUNT = 0x1,
FSA_COMMAND_UNMOUNT = 0x2,
Expand Down Expand Up @@ -789,12 +793,14 @@ enum FSACommandEnum {
FSA_COMMAND_GET_PROC_RESOURCE_USAGE = 0x8C,
FSA_COMMAND_GET_ALL_RESOURCE_USAGE = 0x8D,
FSA_COMMAND_SEND_PROFILE_CMD = 0x8E,
};
} FSACommandEnum;
WUT_CHECK_SIZE(FSACommandEnum, 4);

enum FSAIpcRequestTypeEnum {
typedef enum FSAIpcRequestTypeEnum {
FSA_IPC_REQUEST_IOCTL = 0,
FSA_IPC_REQUEST_IOCTLV = 1,
};
} FSAIpcRequestTypeEnum;
WUT_CHECK_SIZE(FSAIpcRequestTypeEnum, 4);

struct FSAAsyncResult {
//! Queue to put a message on when command is complete.
Expand Down Expand Up @@ -900,12 +906,14 @@ typedef enum FSAMountFlags {
FSA_MOUNT_FLAG_BIND_MOUNT = 1,
FSA_MOUNT_FLAG_GLOBAL_MOUNT = 2,
} FSAMountFlags;
WUT_CHECK_SIZE(FSAMountFlags, 4);

typedef enum FSAUnmountFlags {
FSA_UNMOUNT_FLAG_NONE = 0x00000000,
FSA_UNMOUNT_FLAG_FORCE = 0x00000002,
FSA_UNMOUNT_FLAG_BIND_MOUNT = 0x80000000,
} FSAUnmountFlags;
WUT_CHECK_SIZE(FSAUnmountFlags, 4);

FSError
FSAInit();
Expand Down
3 changes: 3 additions & 0 deletions include/coreinit/im.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ typedef enum IMParameter
IM_PARAMETER_DIM_ENABLE_DRC = 10,
IM_PARAMETER_MAX = 11,
} IMParameter;
WUT_CHECK_SIZE(IMParameter, 4);

typedef enum IMTimer
{
IM_TIMER_DIM = 0,
IM_TIMER_APD = 1,
} IMTimer;
WUT_CHECK_SIZE(IMTimer, 4);

typedef enum IMEvent
{
Expand All @@ -94,6 +96,7 @@ typedef enum IMEvent
IM_EVENT_SYNC = 1 << 7,
IM_EVENT_UNK8 = 1 << 8,
} IMEvent;
WUT_CHECK_SIZE(IMEvent, 4);

IOSHandle
IM_Open(void);
Expand Down
1 change: 1 addition & 0 deletions include/coreinit/interrupts.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ typedef enum OSInterruptType
OS_INTERRUPT_TYPE_IPCPPC2 = 11,
OS_INTERRUPT_TYPE_AHB = 12
} OSInterruptType;
WUT_CHECK_SIZE(OSInterruptType, 4);

typedef void(*OSUserInterruptHandler)(OSInterruptType type, OSContext* interruptedContext);

Expand Down
2 changes: 2 additions & 0 deletions include/coreinit/ios.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ typedef enum IOSOpenMode
IOS_OPEN_WRITE = 1 << 1,
IOS_OPEN_READWRITE = IOS_OPEN_READ | IOS_OPEN_WRITE,
} IOSOpenMode;
WUT_CHECK_SIZE(IOSOpenMode, 4);

typedef enum IOSError
{
Expand Down Expand Up @@ -67,6 +68,7 @@ typedef enum IOSError
IOS_ERROR_STALEHANDLE = -41,
IOS_ERROR_UNKNOWNVALUE = -42,
} IOSError;
WUT_CHECK_SIZE(IOSError, 4);

struct IOSVec
{
Expand Down
1 change: 1 addition & 0 deletions include/coreinit/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ typedef enum OSICICommand {
OS_ICI_COMMAND_UNKNOWN = 0xE, // Waits for rendezvous, then updates heartbeat
OS_ICI_COMMAND_OVERLAY_ARENA = 0xF,
} OSICICommand;
WUT_CHECK_SIZE(OSICICommand, 4);

typedef void (*OSExceptionCallbackExFn)(OSExceptionType exceptionType, OSContext * interruptedContext, OSContext *cbContext);

Expand Down
4 changes: 4 additions & 0 deletions include/coreinit/mcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ typedef enum MCPAppType
MCP_APP_TYPE_AOC_OVERLAY = 0xD000002C,
MCP_APP_TYPE_AMIIBO_SETTINGS = 0xD0000033,
} MCPAppType;
WUT_CHECK_SIZE(MCPAppType, 4);

typedef enum MCPDeviceFlags
{
Expand All @@ -67,12 +68,14 @@ typedef enum MCPDeviceFlags
MCP_DEVICE_FLAG_UNK_4 = 0x4,
MCP_DEVICE_FLAG_UNK_8 = 0x8,
} MCPDeviceFlags;
WUT_CHECK_SIZE(MCPDeviceFlags, 4);

typedef enum MCPInstallTarget
{
MCP_INSTALL_TARGET_MLC = 0,
MCP_INSTALL_TARGET_USB = 1,
} MCPInstallTarget;
WUT_CHECK_SIZE(MCPInstallTarget, 4);

typedef enum MCPRegion
{
Expand All @@ -83,6 +86,7 @@ typedef enum MCPRegion
MCP_REGION_KOREA = 0x20,
MCP_REGION_TAIWAN = 0x40,
} MCPRegion;
WUT_CHECK_SIZE(MCPRegion, 4);

struct WUT_PACKED MCPDevice
{
Expand Down
2 changes: 2 additions & 0 deletions include/coreinit/memexpheap.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ typedef enum MEMExpHeapMode
MEM_EXP_HEAP_MODE_FIRST_FREE = 0,
MEM_EXP_HEAP_MODE_NEAREST_SIZE = 1,
} MEMExpHeapMode;
WUT_CHECK_SIZE(MEMExpHeapMode, 4);

typedef enum MEMExpHeapDirection
{
MEM_EXP_HEAP_DIR_FROM_TOP = 0,
MEM_EXP_HEAP_DIR_FROM_BOTTOM = 1,
} MEMExpHeapDirection;
WUT_CHECK_SIZE(MEMExpHeapDirection, 4);

struct MEMExpHeapBlock
{
Expand Down
Loading