diff --git a/Makefile.wiiu b/Makefile.wiiu index 2d89412de7..182d2ddd33 100644 --- a/Makefile.wiiu +++ b/Makefile.wiiu @@ -93,10 +93,17 @@ LD := $(CXX) ELF2RPL := wiiu/wut/elf2rpl/elf2rpl -INCDIRS := -I. -Ideps/zlib -Ideps/7zip -Ilibretro-common/include -Iwiiu -Iwiiu/wut/include -I$(DEVKITPRO)/portlibs/ppc/include +ifneq ($(findstring Linux,$(shell uname -a)),) +else ifneq ($(findstring Darwin,$(shell uname -a)),) +else + ELF2RPL := $(ELF2RPL).exe +endif + + +INCDIRS := -I. -Ideps/zlib -Ideps/7zip -Ilibretro-common/include -Iwiiu -Iwiiu/include -I$(DEVKITPRO)/portlibs/ppc/include LIBDIRS := -L. -L$(DEVKITPRO)/portlibs/ppc/lib -CFLAGS := -mrvl -mcpu=750 -meabi -mhard-float +CFLAGS := -mwup -mcpu=750 -meabi -mhard-float LDFLAGS := ifeq ($(DEBUG), 1) @@ -111,8 +118,9 @@ ASFLAGS := $(CFLAGS) -mregnames CFLAGS += -ffast-math -Werror=implicit-function-declaration #CFLAGS += -fomit-frame-pointer -mword-relocations #CFLAGS += -Wall -CFLAGS += -Dstatic_assert=_Static_assert -CFLAGS += -DWIIU -D__wiiu__ -DMSB_FIRST + +#todo: remove -DWIIU and use the built-in macros instead (HW_WUP or __wiiu__). +CFLAGS += -DWIIU -DMSB_FIRST CFLAGS += -DHAVE_MAIN CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE CFLAGS += -DHAVE_FILTERS_BUILTIN $(DEFINES) diff --git a/audio/drivers/wiiu_audio.c b/audio/drivers/wiiu_audio.c index a547946905..bdab0c84c7 100644 --- a/audio/drivers/wiiu_audio.c +++ b/audio/drivers/wiiu_audio.c @@ -18,19 +18,11 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include #include "wiiu/wiiu_dbg.h" #include "wiiu/system/memory.h" -#include "wiiu/multivoice.h" #include "audio/audio_driver.h" #include "performance_counters.h" diff --git a/frontend/drivers/platform_wiiu.c b/frontend/drivers/platform_wiiu.c index be097a0eaf..ef7149a8f2 100644 --- a/frontend/drivers/platform_wiiu.c +++ b/frontend/drivers/platform_wiiu.c @@ -35,7 +35,7 @@ #include "tasks/tasks_internal.h" #include "runloop.h" -#include +#include #include "fs/fs_utils.h" #include "fs/sd_fat_devoptab.h" #include "system/dynamic.h" @@ -44,15 +44,15 @@ #include "system/exception.h" #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include -#include "ios.h" #include "wiiu_dbg.h" diff --git a/gfx/drivers/wiiu_gfx.c b/gfx/drivers/wiiu_gfx.c index 2055b2d7ff..5f9b057a18 100644 --- a/gfx/drivers/wiiu_gfx.c +++ b/gfx/drivers/wiiu_gfx.c @@ -19,11 +19,9 @@ #include "performance_counters.h" #include -#include -#include -#include "gx2.h" +#include +#include #include "system/memory.h" -#include "system/wiiu.h" #include "tex_shader.h" #include "wiiu_dbg.h" diff --git a/input/drivers_joypad/wiiu_joypad.c b/input/drivers_joypad/wiiu_joypad.c index 8610f64108..4ea25a8f71 100644 --- a/input/drivers_joypad/wiiu_joypad.c +++ b/input/drivers_joypad/wiiu_joypad.c @@ -18,8 +18,8 @@ #include "../../config.h" #endif -#include -#include +#include +#include #include "../input_config.h" #include "../input_driver.h" diff --git a/libretro-common/features/features_cpu.c b/libretro-common/features/features_cpu.c index ddaa01f9ce..646f7c31b4 100644 --- a/libretro-common/features/features_cpu.c +++ b/libretro-common/features/features_cpu.c @@ -74,8 +74,7 @@ #endif #ifdef WIIU -#include -#include "wiiu/system/wiiu.h" +#include #endif #if defined(_3DS) diff --git a/libretro-common/include/retro_miscellaneous.h b/libretro-common/include/retro_miscellaneous.h index 83d004b8a0..e0e93b601e 100644 --- a/libretro-common/include/retro_miscellaneous.h +++ b/libretro-common/include/retro_miscellaneous.h @@ -33,8 +33,7 @@ #elif defined(GEKKO) || defined(__PSL1GHT__) || defined(__QNX__) #include #elif defined(WIIU) -#include -#include "system/wiiu.h" +#include #elif defined(PSP) #include #elif defined(VITA) diff --git a/wiiu/fs/fs_utils.c b/wiiu/fs/fs_utils.c index 7c33f54eaa..83d74411f5 100644 --- a/wiiu/fs/fs_utils.c +++ b/wiiu/fs/fs_utils.c @@ -3,7 +3,7 @@ #include #include #include -#include +#include /* FS defines and types */ #define FS_MAX_LOCALPATH_SIZE 511 diff --git a/wiiu/fs/fs_utils.h b/wiiu/fs/fs_utils.h index e68567b90f..4f39d39378 100644 --- a/wiiu/fs/fs_utils.h +++ b/wiiu/fs/fs_utils.h @@ -5,8 +5,7 @@ extern "C" { #endif -//#include -#include +#include int MountFS(void *pClient, void *pCmd, char **mount_path); int UmountFS(void *pClient, void *pCmd, const char *mountPath); diff --git a/wiiu/fs/sd_fat_devoptab.c b/wiiu/fs/sd_fat_devoptab.c index b6d27d5f5b..d12fd2fb31 100644 --- a/wiiu/fs/sd_fat_devoptab.c +++ b/wiiu/fs/sd_fat_devoptab.c @@ -22,7 +22,6 @@ * distribution. ***************************************************************************/ #include -//#include #include #include #include @@ -30,8 +29,8 @@ #include #include #include "fs_utils.h" -#include -#include +#include +#include #define FS_ALIGNMENT 0x40 #define FS_ALIGN(x) (((x) + FS_ALIGNMENT - 1) & ~(FS_ALIGNMENT - 1)) diff --git a/wiiu/wut/include/nsysnet/socket.h b/wiiu/include/sys/socket.h similarity index 99% rename from wiiu/wut/include/nsysnet/socket.h rename to wiiu/include/sys/socket.h index 64f1dcae8c..2c5b27b392 100644 --- a/wiiu/wut/include/nsysnet/socket.h +++ b/wiiu/include/sys/socket.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include #include diff --git a/wiiu/include/wiiu/ax.h b/wiiu/include/wiiu/ax.h new file mode 100644 index 0000000000..ff29862e78 --- /dev/null +++ b/wiiu/include/wiiu/ax.h @@ -0,0 +1,8 @@ +#pragma once + +#include +#include +#include +#include +#include +#include diff --git a/wiiu/wut/include/sndcore2/core.h b/wiiu/include/wiiu/ax/core.h similarity index 81% rename from wiiu/wut/include/sndcore2/core.h rename to wiiu/include/wiiu/ax/core.h index 1002450808..21b088ec6d 100644 --- a/wiiu/wut/include/sndcore2/core.h +++ b/wiiu/include/wiiu/ax/core.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include "result.h" #ifdef __cplusplus @@ -38,9 +38,9 @@ void AXInit(); void AXQuit(); void AXInitWithParams(AXInitParams *params); BOOL AXIsInit(); -void AXInitProfile(AXProfile *profile, uint32_t count); -uint32_t AXGetSwapProfile(AXProfile *profile, uint32_t count); -AXResult AXSetDefaultMixerSelect(uint32_t unk0); +void AXInitProfile(AXProfile *profile, u32 count); +uint32_t AXGetSwapProfile(AXProfile *profile, u32 count); +AXResult AXSetDefaultMixerSelect(u32 unk0); AXResult AXRegisterAppFrameCallback(AXFrameCallback callback); uint32_t AXGetInputSamplesPerFrame(); uint32_t AXGetInputSamplesPerSec(); diff --git a/wiiu/wut/include/sndcore2/device.h b/wiiu/include/wiiu/ax/device.h similarity index 98% rename from wiiu/wut/include/sndcore2/device.h rename to wiiu/include/wiiu/ax/device.h index 8817a38f29..d809245a79 100644 --- a/wiiu/wut/include/sndcore2/device.h +++ b/wiiu/include/wiiu/ax/device.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include "result.h" #ifdef __cplusplus diff --git a/wiiu/wut/include/sndcore2/drcvs.h b/wiiu/include/wiiu/ax/drcvs.h similarity index 97% rename from wiiu/wut/include/sndcore2/drcvs.h rename to wiiu/include/wiiu/ax/drcvs.h index 8b48b4a5f2..6190fb06a0 100644 --- a/wiiu/wut/include/sndcore2/drcvs.h +++ b/wiiu/include/wiiu/ax/drcvs.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include "result.h" #ifdef __cplusplus diff --git a/wiiu/multivoice.h b/wiiu/include/wiiu/ax/multivoice.h similarity index 72% rename from wiiu/multivoice.h rename to wiiu/include/wiiu/ax/multivoice.h index b8ab2284e5..01c372b232 100644 --- a/wiiu/multivoice.h +++ b/wiiu/include/wiiu/ax/multivoice.h @@ -1,6 +1,10 @@ +#pragma once +#include +#include "voice.h" -#ifndef _MULTIVOICE_H_ -#define _MULTIVOICE_H_ +#ifdef __cplusplus +extern "C" { +#endif typedef struct { @@ -9,8 +13,8 @@ typedef struct AXVoice *v[]; } AXMVoice; -void AXAcquireMultiVoice(uint32_t prio, void *cb, uint32_t cbarg, void *setup, AXMVoice **mvoice); -void AXSetMultiVoiceDeviceMix(AXMVoice *mvoice, AXDeviceType type, uint32_t id, uint32_t bus, uint16_t vol, int16_t delta); +void AXAcquireMultiVoice(u32 prio, void *cb, u32 cbarg, void *setup, AXMVoice **mvoice); +void AXSetMultiVoiceDeviceMix(AXMVoice *mvoice, AXDeviceType type, u32 id, u32 bus, u16 vol, s16 delta); void AXSetMultiVoiceOffsets(AXMVoice *mvoice, AXVoiceOffsets *offsets); void AXSetMultiVoiceCurrentOffset(AXMVoice *mvoice, uint32_t offset); void AXSetMultiVoiceState(AXMVoice *mvoice, AXVoiceState state); @@ -20,4 +24,6 @@ void AXSetMultiVoiceSrcRatio(AXMVoice *mvoice, float ratio); bool AXIsMultiVoiceRunning(AXMVoice *mvoice); void AXFreeMultiVoice(AXMVoice *mvoice); +#ifdef __cplusplus +} #endif diff --git a/wiiu/wut/include/sndcore2/result.h b/wiiu/include/wiiu/ax/result.h similarity index 93% rename from wiiu/wut/include/sndcore2/result.h rename to wiiu/include/wiiu/ax/result.h index 70473d3901..66007125cd 100644 --- a/wiiu/wut/include/sndcore2/result.h +++ b/wiiu/include/wiiu/ax/result.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #ifdef __cplusplus extern "C" { diff --git a/wiiu/wut/include/sndcore2/voice.h b/wiiu/include/wiiu/ax/voice.h similarity index 99% rename from wiiu/wut/include/sndcore2/voice.h rename to wiiu/include/wiiu/ax/voice.h index 8c86357092..0de23dab05 100644 --- a/wiiu/wut/include/sndcore2/voice.h +++ b/wiiu/include/wiiu/ax/voice.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include "device.h" #include "result.h" diff --git a/wiiu/include/wiiu/fs.h b/wiiu/include/wiiu/fs.h new file mode 100644 index 0000000000..77dca33247 --- /dev/null +++ b/wiiu/include/wiiu/fs.h @@ -0,0 +1,269 @@ +#pragma once +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef uint32_t FSDirectoryHandle; +typedef uint32_t FSFileHandle; +typedef uint32_t FSPriority; + +typedef enum FSStatus +{ + FS_STATUS_OK = 0, + FS_STATUS_CANCELLED = -1, + FS_STATUS_END = -2, + FS_STATUS_MAX = -3, + FS_STATUS_ALREADY_OPEN = -4, + FS_STATUS_EXISTS = -5, + FS_STATUS_NOT_FOUND = -6, + FS_STATUS_NOT_FILE = -7, + FS_STATUS_NOT_DIR = -8, + FS_STATUS_ACCESS_ERROR = -9, + FS_STATUS_PERMISSION_ERROR = -10, + FS_STATUS_FILE_TOO_BIG = -11, + FS_STATUS_STORAGE_FULL = -12, + FS_STATUS_JOURNAL_FULL = -13, + FS_STATUS_UNSUPPORTED_CMD = -14, + FS_STATUS_MEDIA_NOT_READY = -15, + FS_STATUS_MEDIA_ERROR = -17, + FS_STATUS_CORRUPTED = -18, + FS_STATUS_FATAL_ERROR = -0x400, +} FSStatus; + +typedef enum FSError +{ + FS_ERROR_NOT_INIT = -0x30001, + FS_ERROR_BUSY = -0x30002, + FS_ERROR_CANCELLED = -0x30003, + FS_ERROR_END_OF_DIR = -0x30004, + FS_ERROR_END_OF_FILE = -0x30005, + FS_ERROR_MAX_MOUNT_POINTS = -0x30010, + FS_ERROR_MAX_VOLUMES = -0x30011, + FS_ERROR_MAX_CLIENTS = -0x30012, + FS_ERROR_MAX_FILES = -0x30013, + FS_ERROR_MAX_DIRS = -0x30014, + FS_ERROR_ALREADY_OPEN = -0x30015, + FS_ERROR_ALREADY_EXISTS = -0x30016, + FS_ERROR_NOT_FOUND = -0x30017, + FS_ERROR_NOT_EMPTY = -0x30018, + FS_ERROR_ACCESS_ERROR = -0x30019, + FS_ERROR_PERMISSION_ERROR = -0x3001A, + FS_ERROR_DATA_CORRUPTED = -0x3001B, + FS_ERROR_STORAGE_FULL = -0x3001C, + FS_ERROR_JOURNAL_FULL = -0x3001D, + FS_ERROR_UNAVAILABLE_COMMAND = -0x3001F, + FS_ERROR_UNSUPPORTED_COMMAND = -0x30020, + FS_ERROR_INVALID_PARAM = -0x30021, + FS_ERROR_INVALID_PATH = -0x30022, + FS_ERROR_INVALID_BUFFER = -0x30023, + FS_ERROR_INVALID_ALIGNMENT = -0x30024, + FS_ERROR_INVALID_CLIENTHANDLE = -0x30025, + FS_ERROR_INVALID_FILEHANDLE = -0x30026, + FS_ERROR_INVALID_DIRHANDLE = -0x30027, + FS_ERROR_NOT_FILE = -0x30028, + FS_ERROR_NOT_DIR = -0x30029, + FS_ERROR_FILE_TOO_BIG = -0x3002A, + FS_ERROR_OUT_OF_RANGE = -0x3002B, + FS_ERROR_OUT_OF_RESOURCES = -0x3002C, + FS_ERROR_MEDIA_NOT_READY = -0x30030, + FS_ERROR_MEDIA_ERROR = -0x30031, + FS_ERROR_WRITE_PROTECTED = -0x30032, + FS_ERROR_INVALID_MEDIA = -0x30033, +} FSError; + +typedef enum FSMode +{ + FS_MODE_READ_OWNER = 0x400, + FS_MODE_WRITE_OWNER = 0x200, + FS_MODE_EXEC_OWNER = 0x100, + + FS_MODE_READ_GROUP = 0x040, + FS_MODE_WRITE_GROUP = 0x020, + FS_MODE_EXEC_GROUP = 0x010, + + FS_MODE_READ_OTHER = 0x004, + FS_MODE_WRITE_OTHER = 0x002, + FS_MODE_EXEC_OTHER = 0x001, +} FSMode; + +typedef enum FSStatFlags +{ + FS_STAT_DIRECTORY = 0x80000000, +} FSStatFlags; + +typedef enum FSVolumeState +{ + FS_VOLUME_STATE_INITIAL = 0, + FS_VOLUME_STATE_READY = 1, + FS_VOLUME_STATE_NO_MEDIA = 2, + FS_VOLUME_STATE_INVALID_MEDIA = 3, + FS_VOLUME_STATE_DIRTY_MEDIA = 4, + FS_VOLUME_STATE_WRONG_MEDIA = 5, + FS_VOLUME_STATE_MEDIA_ERROR = 6, + FS_VOLUME_STATE_DATA_CORRUPTED = 7, + FS_VOLUME_STATE_WRITE_PROTECTED = 8, + FS_VOLUME_STATE_JOURNAL_FULL = 9, + FS_VOLUME_STATE_FATAL = 10, + FS_VOLUME_STATE_INVALID = 11, +} FSVolumeState; + +typedef enum FSMountSourceType +{ + FS_MOUNT_SOURCE_SD = 0, + FS_MOUNT_SOURCE_UNK = 1, +} FSMountSourceType; + +typedef struct FSClient +{ + uint32_t __unknown[0x5C0]; +} FSClient; + +typedef struct FSCmdBlock +{ + uint32_t __unknown[0x2A0]; +} FSCmdBlock; + +typedef struct FSStat +{ + FSStatFlags flags; + FSMode mode; + uint32_t owner; + uint32_t group; + uint32_t size; + uint32_t __unknown[0x14]; +} FSStat; + +typedef struct FSStateChangeInfo +{ + uint32_t __unknown[0x3]; +} FSStateChangeInfo; + +typedef void(*FSAsyncCallback)(FSClient *, FSCmdBlock *, FSStatus, uint32_t); + +typedef struct FSAsyncData +{ + uint32_t callback; + uint32_t param; + uint32_t __unknown; +} FSAsyncData; + +typedef struct FSDirectoryEntry +{ + FSStat info; + char name[256]; +} FSDirectoryEntry; + +typedef struct FSMountSource +{ + uint32_t __unknown[0xC0]; +} FSMountSource; + +FSStatus fsDevInit(); +FSStatus fsDevExit(); + +void FSInit(); +void FSShutdown(); + +FSStatus FSAddClient(FSClient *client, uint32_t flags); +FSStatus FSDelClient(FSClient *client, uint32_t flags); +uint32_t FSGetClientNum(); +void FSInitCmdBlock(FSCmdBlock *block); +FSStatus FSSetCmdPriority(FSCmdBlock *block, FSPriority priority); +void FSSetStateChangeNotification(FSClient *client, FSStateChangeInfo *info); +FSStatus FSGetCwd(FSClient *client, FSCmdBlock *block, char *buffer, uint32_t bufferSize, + uint32_t flags); +FSStatus FSChangeDir(FSClient *client, FSCmdBlock *block, const char *path, uint32_t flags); +FSStatus FSChangeDirAsync(FSClient *client, FSCmdBlock *block, const char *path, uint32_t flags, + FSAsyncData *asyncData); +FSStatus FSGetStat(FSClient *client, FSCmdBlock *block, const char *path, FSStat *stat, + uint32_t flags); +FSStatus FSGetStatAsync(FSClient *client, FSCmdBlock *block, const char *path, FSStat *stat, + uint32_t flags, FSAsyncData *asyncData); +FSStatus FSRemove(FSClient *client, FSCmdBlock *block, const char *path, uint32_t flags); +FSStatus FSRemoveAsync(FSClient *client, FSCmdBlock *block, const char *path, uint32_t flags, + FSAsyncData *asyncData); +FSStatus FSOpenFile(FSClient *client, FSCmdBlock *block, const char *path, const char *mode, + FSFileHandle *handle, uint32_t flags); +FSStatus FSOpenFileAsync(FSClient *client, FSCmdBlock *block, const char *path, const char *mode, + FSFileHandle *outHandle, uint32_t flags, FSAsyncData *asyncData); +FSStatus FSCloseFile(FSClient *client, FSCmdBlock *block, FSFileHandle handle, uint32_t flags); +FSStatus FSCloseFileAsync(FSClient *client, FSCmdBlock *block, FSFileHandle handle, uint32_t flags, + FSAsyncData *asyncData); +FSStatus FSOpenDir(FSClient *client, FSCmdBlock *block, const char *path, FSDirectoryHandle *handle, + uint32_t flags); +FSStatus FSOpenDirAsync(FSClient *client, FSCmdBlock *block, const char *path, + FSDirectoryHandle *handle, uint32_t flags, FSAsyncData *asyncData); +FSStatus FSMakeDir(FSClient *client, FSCmdBlock *block, const char *path, uint32_t flags); +FSStatus FSMakeDirAsync(FSClient *client, FSCmdBlock *block, const char *path, uint32_t flags, + FSAsyncData *asyncData); +FSStatus FSReadDir(FSClient *client, FSCmdBlock *block, FSDirectoryHandle handle, + FSDirectoryEntry *entry, uint32_t flags); +FSStatus FSReadDirAsync(FSClient *client, FSCmdBlock *block, FSDirectoryHandle handle, + FSDirectoryEntry *entry, uint32_t flags, FSAsyncData *asyncData); +FSStatus FSRewindDir(FSClient *client, FSCmdBlock *block, FSDirectoryHandle handle, uint32_t flags); +FSStatus FSCloseDir(FSClient *client, FSCmdBlock *block, FSDirectoryHandle handle, uint32_t flags); +FSStatus FSCloseDirAsync(FSClient *client, FSCmdBlock *block, FSDirectoryHandle handle, + uint32_t flags, FSAsyncData *asyncData); +FSStatus FSChangeMode(FSClient *client, FSCmdBlock *block, char *path, FSMode mode, uint32_t flags); +FSStatus FSChangeModeAsync(FSClient *client, FSCmdBlock *block, char *path, FSMode mode, + uint32_t flags, FSAsyncData *asyncData); +FSStatus FSGetFreeSpaceSize(FSClient *client, FSCmdBlock *block, char *path, u64 *outSize, + uint32_t flags); +FSStatus FSGetFreeSpaceSizeAsync(FSClient *client, FSCmdBlock *block, char *path, u64 *outSize, + uint32_t flags, FSAsyncData *asyncData); +FSStatus FSGetStatFile(FSClient *client, FSCmdBlock *block, FSFileHandle handle, FSStat *stat, + uint32_t flags); +FSStatus FSGetStatFileAsync(FSClient *client, FSCmdBlock *block, FSFileHandle handle, FSStat *stat, + uint32_t flags, FSAsyncData *asyncData); +FSStatus FSReadFile(FSClient *client, FSCmdBlock *block, uint8_t *buffer, uint32_t size, + uint32_t count, FSFileHandle handle, uint32_t unk1, uint32_t flags); +FSStatus FSReadFileAsync(FSClient *client, FSCmdBlock *block, uint8_t *buffer, uint32_t size, + uint32_t count, FSFileHandle handle, uint32_t unk1, uint32_t flags, FSAsyncData *asyncData); +FSStatus FSReadFileWithPos(FSClient *client, FSCmdBlock *block, uint8_t *buffer, uint32_t size, + uint32_t count, uint32_t pos, FSFileHandle handle, uint32_t unk1, uint32_t flags); +FSStatus FSReadFileWithPosAsync(FSClient *client, FSCmdBlock *block, uint8_t *buffer, uint32_t size, + uint32_t count, uint32_t pos, FSFileHandle handle, uint32_t unk1, uint32_t flags, + FSAsyncData *asyncData); +FSStatus FSWriteFile(FSClient *client, FSCmdBlock *block, uint8_t *buffer, uint32_t size, + uint32_t count, FSFileHandle handle, uint32_t unk1, uint32_t flags); +FSStatus FSWriteFileAsync(FSClient *client, FSCmdBlock *block, uint8_t *buffer, uint32_t size, + uint32_t count, FSFileHandle handle, uint32_t unk1, uint32_t flags, FSAsyncData *asyncData); +FSStatus FSWriteFileWithPos(FSClient *client, FSCmdBlock *block, uint8_t *buffer, uint32_t size, + uint32_t count, uint32_t pos, FSFileHandle handle, uint32_t unk1, uint32_t flags); +FSStatus FSWriteFileWithPosAsync(FSClient *client, FSCmdBlock *block, uint8_t *buffer, + uint32_t size, uint32_t count, uint32_t pos, FSFileHandle handle, uint32_t unk1, uint32_t flags, + FSAsyncData *asyncData); +FSStatus FSGetPosFile(FSClient *client, FSCmdBlock *block, FSFileHandle fileHandle, uint32_t *pos, + uint32_t flags); +FSStatus FSGetPosFileAsync(FSClient *client, FSCmdBlock *block, FSFileHandle fileHandle, + uint32_t *pos, uint32_t flags, FSAsyncData *asyncData); +FSStatus FSSetPosFile(FSClient *client, FSCmdBlock *block, FSFileHandle handle, uint32_t pos, + uint32_t flags); +FSStatus FSSetPosFileAsync(FSClient *client, FSCmdBlock *block, FSFileHandle handle, uint32_t pos, + uint32_t flags, FSAsyncData *asyncData); +FSStatus FSFlushFile(FSClient *client, FSCmdBlock *block, FSFileHandle handle, uint32_t flags); +FSStatus FSFlushFileAsync(FSClient *client, FSCmdBlock *block, FSFileHandle handle, uint32_t flags, + FSAsyncData *asyncData); +FSStatus FSTruncateFile(FSClient *client, FSCmdBlock *block, FSFileHandle handle, uint32_t flags); +FSStatus FSTruncateFileAsync(FSClient *client, FSCmdBlock *block, FSFileHandle handle, + uint32_t flags, FSAsyncData *asyncData); +FSStatus FSRename(FSClient *client, FSCmdBlock *block, const char *oldPath, const char *newPath, + uint32_t flags); +FSStatus FSRenameAsync(FSClient *client, FSCmdBlock *block, const char *oldPath, + const char *newPath, uint32_t flags, FSAsyncData *asyncData); +FSVolumeState FSGetVolumeState(FSClient *client); +FSError FSGetLastErrorCodeForViewer(FSClient *client); +FSStatus FSGetMountSource(FSClient *client, FSCmdBlock *cmd, FSMountSourceType type, + FSMountSource *out, uint32_t flags); +FSStatus FSMount(FSClient *client, FSCmdBlock *cmd, FSMountSource *source, const char *target, + uint32_t bytes, uint32_t flags); +FSStatus FSUnmount(FSClient *client, FSCmdBlock *cmd, const char *target, uint32_t flags); +FSStatus FSBindMount(FSClient *client, FSCmdBlock *cmd, const char *source, const char *target, + uint32_t flags); +FSStatus FSbindUnmount(FSClient *client, FSCmdBlock *cmd, const char *target, uint32_t flags); + +#ifdef __cplusplus +} +#endif diff --git a/wiiu/include/wiiu/gx2.h b/wiiu/include/wiiu/gx2.h new file mode 100644 index 0000000000..8157d6f0ab --- /dev/null +++ b/wiiu/include/wiiu/gx2.h @@ -0,0 +1,19 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + diff --git a/wiiu/gx2.h b/wiiu/include/wiiu/gx2/common.h similarity index 50% rename from wiiu/gx2.h rename to wiiu/include/wiiu/gx2/common.h index 649c365466..f160d7b14b 100644 --- a/wiiu/gx2.h +++ b/wiiu/include/wiiu/gx2/common.h @@ -1,21 +1,4 @@ -#ifndef GX2_H -#define GX2_H -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#pragma once #define GX2_SCAN_BUFFER_ALIGNMENT 0x1000 #define GX2_SHADER_ALIGNMENT 0x100 @@ -30,4 +13,3 @@ #define GX2_TRUE TRUE #define GX2_FALSE FALSE -#endif // GX2_H diff --git a/wiiu/wut/include/gx2/context.h b/wiiu/include/wiiu/gx2/context.h similarity index 97% rename from wiiu/wut/include/gx2/context.h rename to wiiu/include/wiiu/gx2/context.h index 4809f3e49d..f06c80bbd0 100644 --- a/wiiu/wut/include/gx2/context.h +++ b/wiiu/include/wiiu/gx2/context.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #ifdef __cplusplus extern "C" { diff --git a/wiiu/include/wiiu/gx2/display.h b/wiiu/include/wiiu/gx2/display.h new file mode 100644 index 0000000000..122edc4e15 --- /dev/null +++ b/wiiu/include/wiiu/gx2/display.h @@ -0,0 +1,30 @@ +#pragma once +#include +#include "enum.h" +#include "surface.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void GX2SetTVEnable(BOOL enable); +void GX2SetDRCEnable(BOOL enable); + +void GX2CalcTVSize(GX2TVRenderMode tvRenderMode, GX2SurfaceFormat surfaceFormat, + GX2BufferingMode bufferingMode, uint32_t *size, uint32_t *unkOut); +void GX2CalcDRCSize(GX2DrcRenderMode drcRenderMode, GX2SurfaceFormat surfaceFormat, + GX2BufferingMode bufferingMode, uint32_t *size, uint32_t *unkOut); +void GX2SetTVBuffer(void *buffer, uint32_t size, GX2TVRenderMode tvRenderMode, + GX2SurfaceFormat surfaceFormat, GX2BufferingMode bufferingMode); +void GX2SetDRCBuffer(void *buffer, uint32_t size, GX2DrcRenderMode drcRenderMode, + GX2SurfaceFormat surfaceFormat, GX2BufferingMode bufferingMode); +void GX2SetTVScale(uint32_t x, uint32_t y); +void GX2SetDRCScale(uint32_t x, uint32_t y); + +GX2TVScanMode GX2GetSystemTVScanMode(); +GX2TVScanMode GX2GetSystemDRCScanMode(); +GX2DrcRenderMode GX2GetSystemDRCMode(); + +#ifdef __cplusplus +} +#endif diff --git a/wiiu/wut/include/gx2/displaylist.h b/wiiu/include/wiiu/gx2/displaylist.h similarity index 95% rename from wiiu/wut/include/gx2/displaylist.h rename to wiiu/include/wiiu/gx2/displaylist.h index ea594e8620..a5801bd08f 100644 --- a/wiiu/wut/include/gx2/displaylist.h +++ b/wiiu/include/wiiu/gx2/displaylist.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #ifdef __cplusplus extern "C" { diff --git a/wiiu/wut/include/gx2/draw.h b/wiiu/include/wiiu/gx2/draw.h similarity index 98% rename from wiiu/wut/include/gx2/draw.h rename to wiiu/include/wiiu/gx2/draw.h index a0327163ed..85f2ff4c59 100644 --- a/wiiu/wut/include/gx2/draw.h +++ b/wiiu/include/wiiu/gx2/draw.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include "enum.h" diff --git a/wiiu/wut/include/gx2/enum.h b/wiiu/include/wiiu/gx2/enum.h similarity index 99% rename from wiiu/wut/include/gx2/enum.h rename to wiiu/include/wiiu/gx2/enum.h index bfbc9fddae..e6cd3c7977 100644 --- a/wiiu/wut/include/gx2/enum.h +++ b/wiiu/include/wiiu/gx2/enum.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #ifdef __cplusplus extern "C" { diff --git a/wiiu/wut/include/gx2/event.h b/wiiu/include/wiiu/gx2/event.h similarity index 94% rename from wiiu/wut/include/gx2/event.h rename to wiiu/include/wiiu/gx2/event.h index 117084b6db..08685949e4 100644 --- a/wiiu/wut/include/gx2/event.h +++ b/wiiu/include/wiiu/gx2/event.h @@ -1,6 +1,6 @@ #pragma once -#include -#include +#include +#include #include "enum.h" #ifdef __cplusplus diff --git a/wiiu/wut/include/gx2/mem.h b/wiiu/include/wiiu/gx2/mem.h similarity index 86% rename from wiiu/wut/include/gx2/mem.h rename to wiiu/include/wiiu/gx2/mem.h index c3dc377f13..c764f66f3d 100644 --- a/wiiu/wut/include/gx2/mem.h +++ b/wiiu/include/wiiu/gx2/mem.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include "enum.h" #ifdef __cplusplus @@ -11,5 +11,3 @@ void GX2Invalidate(GX2InvalidateMode mode, void *buffer, uint32_t size); #ifdef __cplusplus } #endif - -/** @} */ diff --git a/wiiu/include/wiiu/gx2/registers.h b/wiiu/include/wiiu/gx2/registers.h new file mode 100644 index 0000000000..2e712943a7 --- /dev/null +++ b/wiiu/include/wiiu/gx2/registers.h @@ -0,0 +1,235 @@ +#pragma once +#include +#include "enum.h" +#include "surface.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct +{ + uint32_t pa_sc_aa_mask; +} GX2AAMaskReg; + +typedef struct +{ + uint32_t sx_alpha_test_control; + uint32_t sx_alpha_ref; +} GX2AlphaTestReg; + +typedef struct +{ + uint32_t db_alpha_to_mask; +} GX2AlphaToMaskReg; + +typedef struct +{ + GX2RenderTarget target; + uint32_t cb_blend_control; +} GX2BlendControlReg; + +typedef struct +{ + float red; + float green; + float blue; + float alpha; +} GX2BlendConstantColorReg; + +typedef struct +{ + uint32_t cb_color_control; +} GX2ColorControlReg; + +typedef struct +{ + uint32_t db_depth_control; +} GX2DepthStencilControlReg; + +typedef struct +{ + uint32_t db_stencilrefmask; + uint32_t db_stencilrefmask_bf; +} GX2StencilMaskReg; + +typedef struct +{ + uint32_t pa_su_line_cntl; +} GX2LineWidthReg; + +typedef struct +{ + uint32_t pa_su_point_size; +} GX2PointSizeReg; + +typedef struct +{ + uint32_t pa_su_point_minmax; +} GX2PointLimitsReg; + +typedef struct +{ + uint32_t pa_su_sc_mode_cntl; +} GX2PolygonControlReg; + +typedef struct +{ + uint32_t pa_su_poly_offset_front_scale; + uint32_t pa_su_poly_offset_front_offset; + uint32_t pa_su_poly_offset_back_scale; + uint32_t pa_su_poly_offset_back_offset; + uint32_t pa_su_poly_offset_clamp; +} GX2PolygonOffsetReg; + +typedef struct +{ + uint32_t pa_sc_generic_scissor_tl; + uint32_t pa_sc_generic_scissor_br; +} GX2ScissorReg; + +typedef struct +{ + uint32_t cb_target_mask; +} GX2TargetChannelMaskReg; + +typedef struct +{ + uint32_t pa_cl_vport_xscale; + uint32_t pa_cl_vport_xoffset; + uint32_t pa_cl_vport_yscale; + uint32_t pa_cl_vport_yoffset; + uint32_t pa_cl_vport_zscale; + uint32_t pa_cl_vport_zoffset; + uint32_t pa_cl_gb_vert_clip_adj; + uint32_t pa_cl_gb_vert_disc_adj; + uint32_t pa_cl_gb_horz_clip_adj; + uint32_t pa_cl_gb_horz_disc_adj; + uint32_t pa_sc_vport_zmin; + uint32_t pa_sc_vport_zmax; +} GX2ViewportReg; + +void GX2SetAAMask(uint8_t upperLeft, uint8_t upperRight, uint8_t lowerLeft, uint8_t lowerRight); +void GX2InitAAMaskReg(GX2AAMaskReg *reg, uint8_t upperLeft, uint8_t upperRight, uint8_t lowerLeft, + uint8_t lowerRight); +void GX2GetAAMaskReg(GX2AAMaskReg *reg, uint8_t *upperLeft, uint8_t *upperRight, uint8_t *lowerLeft, + uint8_t *lowerRight); +void GX2SetAAMaskReg(GX2AAMaskReg *reg); +void GX2SetAlphaTest(BOOL alphaTest, GX2CompareFunction func, float ref); +void GX2InitAlphaTestReg(GX2AlphaTestReg *reg, BOOL alphaTest, GX2CompareFunction func, float ref); +void GX2GetAlphaTestReg(const GX2AlphaTestReg *reg, BOOL *alphaTest, GX2CompareFunction *func, + float *ref); +void GX2SetAlphaTestReg(GX2AlphaTestReg *reg); +void GX2SetAlphaToMask(BOOL alphaToMask, GX2AlphaToMaskMode mode); +void GX2InitAlphaToMaskReg(GX2AlphaToMaskReg *reg, BOOL alphaToMask, GX2AlphaToMaskMode mode); +void GX2GetAlphaToMaskReg(const GX2AlphaToMaskReg *reg, BOOL *alphaToMask, + GX2AlphaToMaskMode *mode); +void GX2SetAlphaToMaskReg(GX2AlphaToMaskReg *reg); +void GX2SetBlendConstantColor(float red, float green, float blue, float alpha); +void GX2InitBlendConstantColorReg(GX2BlendConstantColorReg *reg, float red, float green, float blue, + float alpha); +void GX2GetBlendConstantColorReg(GX2BlendConstantColorReg *reg, float *red, float *green, + float *blue, float *alpha); +void GX2SetBlendConstantColorReg(GX2BlendConstantColorReg *reg); +void GX2SetBlendControl(GX2RenderTarget target, GX2BlendMode colorSrcBlend, + GX2BlendMode colorDstBlend, GX2BlendCombineMode colorCombine, BOOL useAlphaBlend, + GX2BlendMode alphaSrcBlend, GX2BlendMode alphaDstBlend, GX2BlendCombineMode alphaCombine); +void GX2InitBlendControlReg(GX2BlendControlReg *reg, GX2RenderTarget target, + GX2BlendMode colorSrcBlend, GX2BlendMode colorDstBlend, GX2BlendCombineMode colorCombine, + BOOL useAlphaBlend, GX2BlendMode alphaSrcBlend, GX2BlendMode alphaDstBlend, + GX2BlendCombineMode alphaCombine); +void GX2GetBlendControlReg(GX2BlendControlReg *reg, GX2RenderTarget *target, + GX2BlendMode *colorSrcBlend, GX2BlendMode *colorDstBlend, GX2BlendCombineMode *colorCombine, + BOOL *useAlphaBlend, GX2BlendMode *alphaSrcBlend, GX2BlendMode *alphaDstBlend, + GX2BlendCombineMode *alphaCombine); +void GX2SetBlendControlReg(GX2BlendControlReg *reg); +void GX2SetColorControl(GX2LogicOp rop3, uint8_t targetBlendEnable, BOOL multiWriteEnable, + BOOL colorWriteEnable); +void GX2InitColorControlReg(GX2ColorControlReg *reg, GX2LogicOp rop3, uint8_t targetBlendEnable, + BOOL multiWriteEnable, BOOL colorWriteEnable); +void GX2GetColorControlReg(GX2ColorControlReg *reg, GX2LogicOp *rop3, uint8_t *targetBlendEnable, + BOOL *multiWriteEnable, BOOL *colorWriteEnable); +void GX2SetColorControlReg(GX2ColorControlReg *reg); +void GX2SetDepthOnlyControl(BOOL depthTest, BOOL depthWrite, GX2CompareFunction depthCompare); +void GX2SetDepthStencilControl(BOOL depthTest, BOOL depthWrite, GX2CompareFunction depthCompare, + BOOL stencilTest, BOOL backfaceStencil, GX2CompareFunction frontStencilFunc, + GX2StencilFunction frontStencilZPass, GX2StencilFunction frontStencilZFail, + GX2StencilFunction frontStencilFail, GX2CompareFunction backStencilFunc, + GX2StencilFunction backStencilZPass, GX2StencilFunction backStencilZFail, + GX2StencilFunction backStencilFail); +void GX2InitDepthStencilControlReg(GX2DepthStencilControlReg *reg, BOOL depthTest, BOOL depthWrite, + GX2CompareFunction depthCompare, BOOL stencilTest, BOOL backfaceStencil, + GX2CompareFunction frontStencilFunc, GX2StencilFunction frontStencilZPass, + GX2StencilFunction frontStencilZFail, GX2StencilFunction frontStencilFail, + GX2CompareFunction backStencilFunc, GX2StencilFunction backStencilZPass, + GX2StencilFunction backStencilZFail, GX2StencilFunction backStencilFail); +void GX2GetDepthStencilControlReg(GX2DepthStencilControlReg *reg, BOOL *depthTest, BOOL *depthWrite, + GX2CompareFunction *depthCompare, BOOL *stencilTest, BOOL *backfaceStencil, + GX2CompareFunction *frontStencilFunc, GX2StencilFunction *frontStencilZPass, + GX2StencilFunction *frontStencilZFail, GX2StencilFunction *frontStencilFail, + GX2CompareFunction *backStencilFunc, GX2StencilFunction *backStencilZPass, + GX2StencilFunction *backStencilZFail, GX2StencilFunction *backStencilFail); +void GX2SetDepthStencilControlReg(GX2DepthStencilControlReg *reg); +void GX2SetStencilMask(uint8_t frontMask, uint8_t frontWriteMask, uint8_t frontRef, + uint8_t backMask, uint8_t backWriteMask, uint8_t backRef); +void GX2InitStencilMaskReg(GX2StencilMaskReg *reg, uint8_t frontMask, uint8_t frontWriteMask, + uint8_t frontRef, uint8_t backMask, uint8_t backWriteMask, uint8_t backRef); +void GX2GetStencilMaskReg(GX2StencilMaskReg *reg, uint8_t *frontMask, uint8_t *frontWriteMask, + uint8_t *frontRef, uint8_t *backMask, uint8_t *backWriteMask, uint8_t *backRef); +void GX2SetStencilMaskReg(GX2StencilMaskReg *reg); +void GX2SetLineWidth(float width); +void GX2InitLineWidthReg(GX2LineWidthReg *reg, float width); +void GX2GetLineWidthReg(GX2LineWidthReg *reg, float *width); +void GX2SetLineWidthReg(GX2LineWidthReg *reg); +void GX2SetPointSize(float width, float height); +void GX2InitPointSizeReg(GX2PointSizeReg *reg, float width, float height); +void GX2GetPointSizeReg(GX2PointSizeReg *reg, float *width, float *height); +void GX2SetPointSizeReg(GX2PointSizeReg *reg); +void GX2SetPointLimits(float min, float max); +void GX2InitPointLimitsReg(GX2PointLimitsReg *reg, float min, float max); +void GX2GetPointLimitsReg(GX2PointLimitsReg *reg, float *min, float *max); +void GX2SetPointLimitsReg(GX2PointLimitsReg *reg); +void GX2SetCullOnlyControl(GX2FrontFace frontFace, BOOL cullFront, BOOL cullBack); +void GX2SetPolygonControl(GX2FrontFace frontFace, BOOL cullFront, BOOL cullBack, BOOL polyMode, + GX2PolygonMode polyModeFront, GX2PolygonMode polyModeBack, BOOL polyOffsetFrontEnable, + BOOL polyOffsetBackEnable, BOOL polyOffsetParaEnable); +void GX2InitPolygonControlReg(GX2PolygonControlReg *reg, GX2FrontFace frontFace, BOOL cullFront, + BOOL cullBack, BOOL polyMode, GX2PolygonMode polyModeFront, GX2PolygonMode polyModeBack, + BOOL polyOffsetFrontEnable, BOOL polyOffsetBackEnable, BOOL polyOffsetParaEnable); +void GX2GetPolygonControlReg(GX2PolygonControlReg *reg, GX2FrontFace *frontFace, BOOL *cullFront, + BOOL *cullBack, BOOL *polyMode, GX2PolygonMode *polyModeFront, GX2PolygonMode *polyModeBack, + BOOL *polyOffsetFrontEnable, BOOL *polyOffsetBackEnable, BOOL *polyOffsetParaEnable); +void GX2SetPolygonControlReg(GX2PolygonControlReg *reg); +void GX2SetPolygonOffset(float frontOffset, float frontScale, float backOffset, float backScale, + float clamp); +void GX2InitPolygonOffsetReg(GX2PolygonOffsetReg *reg, float frontOffset, float frontScale, + float backOffset, float backScale, float clamp); +void GX2GetPolygonOffsetReg(GX2PolygonOffsetReg *reg, float *frontOffset, float *frontScale, + float *backOffset, float *backScale, float *clamp); +void GX2SetPolygonOffsetReg(GX2PolygonOffsetReg *reg); +void GX2SetScissor(uint32_t x, uint32_t y, uint32_t width, uint32_t height); +void GX2InitScissorReg(GX2ScissorReg *reg, uint32_t x, uint32_t y, uint32_t width, uint32_t height); +void GX2GetScissorReg(GX2ScissorReg *reg, uint32_t *x, uint32_t *y, uint32_t *width, + uint32_t *height); +void GX2SetScissorReg(GX2ScissorReg *reg); +void GX2SetTargetChannelMasks(GX2ChannelMask mask0, GX2ChannelMask mask1, GX2ChannelMask mask2, + GX2ChannelMask mask3, GX2ChannelMask mask4, GX2ChannelMask mask5, GX2ChannelMask mask6, + GX2ChannelMask mask7); +void GX2InitTargetChannelMasksReg(GX2TargetChannelMaskReg *reg, GX2ChannelMask mask0, + GX2ChannelMask mask1, GX2ChannelMask mask2, GX2ChannelMask mask3, GX2ChannelMask mask4, + GX2ChannelMask mask5, GX2ChannelMask mask6, GX2ChannelMask mask7); +void GX2GetTargetChannelMasksReg(GX2TargetChannelMaskReg *reg, GX2ChannelMask *mask0, + GX2ChannelMask *mask1, GX2ChannelMask *mask2, GX2ChannelMask *mask3, GX2ChannelMask *mask4, + GX2ChannelMask *mask5, GX2ChannelMask *mask6, GX2ChannelMask *mask7); +void GX2SetTargetChannelMasksReg(GX2TargetChannelMaskReg *reg); +void GX2SetViewport(float x, float y, float width, float height, float nearZ, float farZ); +void GX2InitViewportReg(GX2ViewportReg *reg, float x, float y, float width, float height, + float nearZ, float farZ); +void GX2GetViewportReg(GX2ViewportReg *reg, float *x, float *y, float *width, float *height, + float *nearZ, float *farZ); +void GX2SetViewportReg(GX2ViewportReg *reg); +#ifdef __cplusplus +} +#endif + +/** @} */ diff --git a/wiiu/include/wiiu/gx2/sampler.h b/wiiu/include/wiiu/gx2/sampler.h new file mode 100644 index 0000000000..8b7f23db13 --- /dev/null +++ b/wiiu/include/wiiu/gx2/sampler.h @@ -0,0 +1,35 @@ +#pragma once +#include +#include "enum.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef struct GX2Sampler +{ + uint32_t regs[3]; +} GX2Sampler; + +void GX2InitSampler(GX2Sampler *sampler, GX2TexClampMode clampMode, + GX2TexXYFilterMode minMagFilterMode); +void GX2InitSamplerBorderType(GX2Sampler *sampler, GX2TexBorderType borderType); +void GX2InitSamplerClamping(GX2Sampler *sampler, GX2TexClampMode clampX, GX2TexClampMode clampY, + GX2TexClampMode clampZ); +void GX2InitSamplerDepthCompare(GX2Sampler *sampler, GX2CompareFunction depthCompare); +void GX2InitSamplerFilterAdjust(GX2Sampler *sampler, BOOL highPrecision, GX2TexMipPerfMode perfMip, + GX2TexZPerfMode perfZ); +void GX2InitSamplerLOD(GX2Sampler *sampler, float lodMin, float lodMax, float lodBias); +void GX2InitSamplerLODAdjust(GX2Sampler *sampler, float unk1, BOOL unk2); +void GX2InitSamplerRoundingMode(GX2Sampler *sampler, GX2RoundingMode roundingMode); +void GX2InitSamplerXYFilter(GX2Sampler *sampler, GX2TexXYFilterMode filterMag, + GX2TexXYFilterMode filterMin, GX2TexAnisoRatio maxAniso); +void GX2InitSamplerZMFilter(GX2Sampler *sampler, GX2TexZFilterMode filterZ, + GX2TexMipFilterMode filterMip); + +#ifdef __cplusplus +} +#endif + +/** @} */ diff --git a/wiiu/wut/include/gx2/shaders.h b/wiiu/include/wiiu/gx2/shaders.h similarity index 99% rename from wiiu/wut/include/gx2/shaders.h rename to wiiu/include/wiiu/gx2/shaders.h index 63c8b35b54..045befee66 100644 --- a/wiiu/wut/include/gx2/shaders.h +++ b/wiiu/include/wiiu/gx2/shaders.h @@ -1,8 +1,8 @@ #pragma once -#include +#include +#include #include "enum.h" #include "sampler.h" -#include "gx2r/buffer.h" #ifdef __cplusplus extern "C" { diff --git a/wiiu/include/wiiu/gx2/state.h b/wiiu/include/wiiu/gx2/state.h new file mode 100644 index 0000000000..8b3e3718b1 --- /dev/null +++ b/wiiu/include/wiiu/gx2/state.h @@ -0,0 +1,15 @@ +#pragma once +#include +#include "enum.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void GX2Init(uint32_t *attributes); +void GX2Shutdown(); +void GX2Flush(); + +#ifdef __cplusplus +} +#endif diff --git a/wiiu/wut/include/gx2/surface.h b/wiiu/include/wiiu/gx2/surface.h similarity index 99% rename from wiiu/wut/include/gx2/surface.h rename to wiiu/include/wiiu/gx2/surface.h index ca63e316b0..9b1ffa37c4 100644 --- a/wiiu/wut/include/gx2/surface.h +++ b/wiiu/include/wiiu/gx2/surface.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include "enum.h" #ifdef __cplusplus diff --git a/wiiu/include/wiiu/gx2/swap.h b/wiiu/include/wiiu/gx2/swap.h new file mode 100644 index 0000000000..9a86a3955c --- /dev/null +++ b/wiiu/include/wiiu/gx2/swap.h @@ -0,0 +1,20 @@ +#pragma once +#include +#include "enum.h" +#include "surface.h" +#include "texture.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void GX2CopyColorBufferToScanBuffer(GX2ColorBuffer *buffer, GX2ScanTarget scanTarget); +void GX2SwapScanBuffers(); +BOOL GX2GetLastFrame(GX2ScanTarget scanTarget, GX2Texture *texture); +BOOL GX2GetLastFrameGamma(GX2ScanTarget scanTarget, float *gammaOut); +uint32_t GX2GetSwapInterval(); +void GX2SetSwapInterval(uint32_t interval); + +#ifdef __cplusplus +} +#endif diff --git a/wiiu/wut/include/gx2/tessellation.h b/wiiu/include/wiiu/gx2/tessellation.h similarity index 87% rename from wiiu/wut/include/gx2/tessellation.h rename to wiiu/include/wiiu/gx2/tessellation.h index 659282fd88..c9105831cf 100644 --- a/wiiu/wut/include/gx2/tessellation.h +++ b/wiiu/include/wiiu/gx2/tessellation.h @@ -1,6 +1,5 @@ #pragma once -#include -#include +#include #include "enum.h" #ifdef __cplusplus diff --git a/wiiu/wut/include/gx2/texture.h b/wiiu/include/wiiu/gx2/texture.h similarity index 86% rename from wiiu/wut/include/gx2/texture.h rename to wiiu/include/wiiu/gx2/texture.h index 96cc1c4899..1fd42830da 100644 --- a/wiiu/wut/include/gx2/texture.h +++ b/wiiu/include/wiiu/gx2/texture.h @@ -1,15 +1,12 @@ #pragma once -#include +#include #include "surface.h" - #ifdef __cplusplus extern "C" { #endif -typedef struct GX2Texture GX2Texture; - -struct GX2Texture +typedef struct { GX2Surface surface; uint32_t viewFirstMip; @@ -17,9 +14,8 @@ struct GX2Texture uint32_t viewFirstSlice; uint32_t viewNumSlices; uint32_t compMap; - uint32_t regs[5]; -}; +}GX2Texture; void GX2InitTextureRegs(GX2Texture *texture); void GX2SetPixelTexture(GX2Texture *texture, uint32_t unit); diff --git a/wiiu/include/wiiu/gx2r.h b/wiiu/include/wiiu/gx2r.h new file mode 100644 index 0000000000..1c3e8e3861 --- /dev/null +++ b/wiiu/include/wiiu/gx2r.h @@ -0,0 +1,8 @@ +#pragma once + +#include +#include +#include +#include +#include +#include diff --git a/wiiu/wut/include/gx2r/buffer.h b/wiiu/include/wiiu/gx2r/buffer.h similarity index 97% rename from wiiu/wut/include/gx2r/buffer.h rename to wiiu/include/wiiu/gx2r/buffer.h index 0f8c376ae0..27292bc460 100644 --- a/wiiu/wut/include/gx2r/buffer.h +++ b/wiiu/include/wiiu/gx2r/buffer.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include "resource.h" #ifdef __cplusplus diff --git a/wiiu/wut/include/gx2r/displaylist.h b/wiiu/include/wiiu/gx2r/displaylist.h similarity index 94% rename from wiiu/wut/include/gx2r/displaylist.h rename to wiiu/include/wiiu/gx2r/displaylist.h index fd40fdf035..f8e09e94b6 100644 --- a/wiiu/wut/include/gx2r/displaylist.h +++ b/wiiu/include/wiiu/gx2r/displaylist.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include "resource.h" #include "buffer.h" diff --git a/wiiu/wut/include/gx2r/draw.h b/wiiu/include/wiiu/gx2r/draw.h similarity index 94% rename from wiiu/wut/include/gx2r/draw.h rename to wiiu/include/wiiu/gx2r/draw.h index 0b6c1ba83f..be265bfcd9 100644 --- a/wiiu/wut/include/gx2r/draw.h +++ b/wiiu/include/wiiu/gx2r/draw.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include #include "resource.h" #include "buffer.h" diff --git a/wiiu/wut/include/gx2r/mem.h b/wiiu/include/wiiu/gx2r/mem.h similarity index 95% rename from wiiu/wut/include/gx2r/mem.h rename to wiiu/include/wiiu/gx2r/mem.h index f2340c58fe..77aa7cfc6a 100644 --- a/wiiu/wut/include/gx2r/mem.h +++ b/wiiu/include/wiiu/gx2r/mem.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include "resource.h" #ifdef __cplusplus diff --git a/wiiu/wut/include/gx2r/resource.h b/wiiu/include/wiiu/gx2r/resource.h similarity index 98% rename from wiiu/wut/include/gx2r/resource.h rename to wiiu/include/wiiu/gx2r/resource.h index a6899af8aa..89be225214 100644 --- a/wiiu/wut/include/gx2r/resource.h +++ b/wiiu/include/wiiu/gx2r/resource.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #ifdef __cplusplus extern "C" { diff --git a/wiiu/wut/include/gx2r/surface.h b/wiiu/include/wiiu/gx2r/surface.h similarity index 96% rename from wiiu/wut/include/gx2r/surface.h rename to wiiu/include/wiiu/gx2r/surface.h index afbb87a622..2b6d036ab6 100644 --- a/wiiu/wut/include/gx2r/surface.h +++ b/wiiu/include/wiiu/gx2r/surface.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include #include "resource.h" diff --git a/wiiu/include/wiiu/ios.h b/wiiu/include/wiiu/ios.h new file mode 100644 index 0000000000..33ed277140 --- /dev/null +++ b/wiiu/include/wiiu/ios.h @@ -0,0 +1,15 @@ +#pragma once +#include + +#ifdef __cplusplus +extern "C" { +#endif + +int IOS_Open(char *path, u32 mode); +int IOS_Close(int fd); +int IOS_Ioctl(int fd, u32 request, void *input_buffer, u32 input_buffer_len, void *output_buffer, u32 output_buffer_len); +int IOS_IoctlAsync(int fd, u32 request, void *input_buffer, u32 input_buffer_len, void *output_buffer, u32 output_buffer_len, void *cb, void *cbarg); + +#ifdef __cplusplus +} +#endif diff --git a/wiiu/include/wiiu/kpad.h b/wiiu/include/wiiu/kpad.h new file mode 100644 index 0000000000..90343df6ce --- /dev/null +++ b/wiiu/include/wiiu/kpad.h @@ -0,0 +1,59 @@ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef struct _KPADData +{ + u32 btns_h; + u32 btns_d; + u32 btns_r; + u32 unused_1[5]; + f32 pos_x; + f32 pos_y; + u32 unused_2[3]; + f32 angle_x; + f32 angle_y; + u32 unused_3[8]; + u8 device_type; + u8 wpad_error; + u8 pos_valid; + u8 unused_4[1]; + + union + { + struct + { + f32 stick_x; + f32 stick_y; + } nunchuck; + + struct + { + u32 btns_h; + u32 btns_d; + u32 btns_r; + f32 lstick_x; + f32 lstick_y; + f32 rstick_x; + f32 rstick_y; + f32 ltrigger; + f32 rtrigger; + } classic; + + u32 unused_6[20]; + }; + u32 unused_7[16]; +} KPADData; + + +void KPADInit (void); +s32 KPADRead(s32 chan, void * data, u32 size); + +#ifdef __cplusplus +} +#endif diff --git a/wiiu/include/wiiu/mcp.h b/wiiu/include/wiiu/mcp.h new file mode 100644 index 0000000000..65210d1e0e --- /dev/null +++ b/wiiu/include/wiiu/mcp.h @@ -0,0 +1,61 @@ +#pragma once + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum MCPInstallTarget +{ + MCP_INSTALL_TARGET_MLC = 0, + MCP_INSTALL_TARGET_USB = 1, +} MCPInstallTarget; + +typedef struct __attribute__((__packed__)) +{ + uint32_t inProgress; + uint64_t tid; + uint64_t sizeTotal; + uint64_t sizeProgress; + uint32_t contentsTotal; + uint32_t contentsProgress; +}MCPInstallProgress; + +typedef struct +{ + char buffer[0x27F]; +} MCPInstallInfo; + +typedef struct +{ + char buffer[0x27F]; +}MCPInstallTitleInfo; + +typedef struct +{ + char name[0x31B]; +}MCPDevice; + +typedef struct +{ + MCPDevice devices[32]; +}MCPDeviceList; + +int MCP_Open(); +int MCP_Close(int handle); +int MCP_InstallSetTargetDevice(int handle, MCPInstallTarget device); +int MCP_InstallGetTargetDevice(int handle, MCPInstallTarget *deviceOut); +int MCP_InstallSetTargetUsb(int handle, int usb); +int MCP_InstallGetInfo(int handle, char *path, MCPInstallInfo *out); +int MCP_InstallTitleAsync(int handle, char *path, MCPInstallTitleInfo *out); +int MCP_InstallGetProgress(int handle, MCPInstallProgress *installProgressOut); +int MCP_InstallTitleAbort(int handle); +int MCP_UninstallTitleAsync(int handle, char *path, MCPInstallTitleInfo *out); +int MCP_DeviceList(int handle, int *numDevices, MCPDeviceList *outDevices, uint32_t outBufferSize); +int MCP_FullDeviceList(int handle, int *numDevices, MCPDeviceList *outDevices, + uint32_t outBufferSize); + +#ifdef __cplusplus +} +#endif diff --git a/wiiu/include/wiiu/mem.h b/wiiu/include/wiiu/mem.h new file mode 100644 index 0000000000..2452892b7c --- /dev/null +++ b/wiiu/include/wiiu/mem.h @@ -0,0 +1,9 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include diff --git a/wiiu/include/wiiu/mem/baseheap.h b/wiiu/include/wiiu/mem/baseheap.h new file mode 100644 index 0000000000..355490a4de --- /dev/null +++ b/wiiu/include/wiiu/mem/baseheap.h @@ -0,0 +1,23 @@ +#pragma once +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void *MEMHeapHandle; + +typedef enum MEMBaseHeapType +{ + MEM_BASE_HEAP_MEM1 = 0, + MEM_BASE_HEAP_MEM2 = 1, + MEM_BASE_HEAP_FG = 8, +} MEMBaseHeapType; + +MEMBaseHeapType MEMGetArena(MEMHeapHandle handle); +MEMHeapHandle MEMGetBaseHeapHandle(MEMBaseHeapType type); +MEMHeapHandle MEMSetBaseHeapHandle(MEMBaseHeapType type, MEMHeapHandle handle); + +#ifdef __cplusplus +} +#endif diff --git a/wiiu/wut/include/coreinit/blockheap.h b/wiiu/include/wiiu/mem/blockheap.h similarity index 98% rename from wiiu/wut/include/coreinit/blockheap.h rename to wiiu/include/wiiu/mem/blockheap.h index 9635da3ccd..8847f0925b 100644 --- a/wiiu/wut/include/coreinit/blockheap.h +++ b/wiiu/include/wiiu/mem/blockheap.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include "memheap.h" #ifdef __cplusplus diff --git a/wiiu/wut/include/coreinit/expandedheap.h b/wiiu/include/wiiu/mem/expandedheap.h similarity index 98% rename from wiiu/wut/include/coreinit/expandedheap.h rename to wiiu/include/wiiu/mem/expandedheap.h index cd98c64873..93f4b050f3 100644 --- a/wiiu/wut/include/coreinit/expandedheap.h +++ b/wiiu/include/wiiu/mem/expandedheap.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include "memheap.h" #ifdef __cplusplus diff --git a/wiiu/wut/include/coreinit/frameheap.h b/wiiu/include/wiiu/mem/frameheap.h similarity index 98% rename from wiiu/wut/include/coreinit/frameheap.h rename to wiiu/include/wiiu/mem/frameheap.h index fe9e731466..0cbce64a79 100644 --- a/wiiu/wut/include/coreinit/frameheap.h +++ b/wiiu/include/wiiu/mem/frameheap.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include "memheap.h" #ifdef __cplusplus diff --git a/wiiu/wut/include/coreinit/memheap.h b/wiiu/include/wiiu/mem/memheap.h similarity index 96% rename from wiiu/wut/include/coreinit/memheap.h rename to wiiu/include/wiiu/mem/memheap.h index 91b8262a06..876a2ccd98 100644 --- a/wiiu/wut/include/coreinit/memheap.h +++ b/wiiu/include/wiiu/mem/memheap.h @@ -1,6 +1,6 @@ #pragma once -#include -#include "spinlock.h" +#include +#include #include "memlist.h" #ifdef __cplusplus diff --git a/wiiu/wut/include/coreinit/memlist.h b/wiiu/include/wiiu/mem/memlist.h similarity index 97% rename from wiiu/wut/include/coreinit/memlist.h rename to wiiu/include/wiiu/mem/memlist.h index dd29e570c9..290328716c 100644 --- a/wiiu/wut/include/coreinit/memlist.h +++ b/wiiu/include/wiiu/mem/memlist.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #ifdef __cplusplus extern "C" { diff --git a/wiiu/include/wiiu/mem/unitheap.h b/wiiu/include/wiiu/mem/unitheap.h new file mode 100644 index 0000000000..94c52bb5b9 --- /dev/null +++ b/wiiu/include/wiiu/mem/unitheap.h @@ -0,0 +1,32 @@ +#pragma once +#include +#include "memheap.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct MEMUnitHeapFreeBlock +{ + struct MEMUnitHeapFreeBlock *next; +} MEMUnitHeapFreeBlock; + +typedef struct +{ + MEMHeapHeader header; + MEMUnitHeapFreeBlock *freeBlocks; + uint32_t blockSize; +} MEMUnitHeap; + +MEMUnitHeap *MEMCreateUnitHeapEx(MEMUnitHeap *heap, uint32_t size, uint32_t blockSize, + int32_t alignment, uint16_t flags); +void *MEMDestroyUnitHeap(MEMUnitHeap *heap); +void *MEMAllocFromUnitHeap(MEMUnitHeap *heap); +void MEMFreeToUnitHeap(MEMUnitHeap *heap, void *block); +void MEMiDumpUnitHeap(MEMUnitHeap *heap); +uint32_t MEMCountFreeBlockForUnitHeap(MEMUnitHeap *heap); +uint32_t MEMCalcHeapSizeForUnitHeap(uint32_t blockSize, uint32_t count, int32_t alignment); + +#ifdef __cplusplus +} +#endif diff --git a/wiiu/include/wiiu/mp/taskqueue.h b/wiiu/include/wiiu/mp/taskqueue.h new file mode 100644 index 0000000000..700393d29f --- /dev/null +++ b/wiiu/include/wiiu/mp/taskqueue.h @@ -0,0 +1,111 @@ +#pragma once +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum +{ + 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 +{ + 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; + + +typedef uint32_t (*MPTaskFunc)(uint32_t, uint32_t); + +#pragma pack(push, 1) +typedef struct +{ + MPTaskState state; + uint32_t result; + uint32_t coreID; + OSTime duration; +} MPTaskInfo; +#pragma pack(pop) + +typedef struct MPTask MPTask; +typedef struct MPTaskQueue MPTaskQueue; + +#pragma pack(push, 1) +typedef struct MPTask +{ + MPTask *self; + MPTaskQueue *queue; + MPTaskState state; + MPTaskFunc func; + uint32_t userArg1; + uint32_t userArg2; + uint32_t result; + uint32_t coreID; + OSTime duration; + void *userData; +}MPTask; +#pragma pack(pop) + +typedef struct +{ + MPTaskQueueState state; + uint32_t tasks; + uint32_t tasksReady; + uint32_t tasksRunning; + uint32_t tasksFinished; +}MPTaskQueueInfo; + +typedef struct MPTaskQueue +{ + MPTaskQueue *self; + MPTaskQueueState state; + uint32_t tasks; + uint32_t tasksReady; + uint32_t tasksRunning; + uint32_t __unknown0; + uint32_t tasksFinished; + uint32_t __unknown1; + uint32_t __unknown2; + uint32_t queueIndex; + uint32_t __unknown3; + uint32_t __unknown4; + uint32_t queueSize; + uint32_t __unknown5; + MPTask **queue; + uint32_t queueMaxSize; + OSSpinLock lock; +}MPTaskQueue; + +void MPInitTaskQ(MPTaskQueue *queue, MPTask **queueBuffer, uint32_t queueBufferLen); +BOOL MPTermTaskQ(MPTaskQueue *queue); +BOOL MPGetTaskQInfo(MPTaskQueue *queue, MPTaskQueueInfo *info); +BOOL MPStartTaskQ(MPTaskQueue *queue); +BOOL MPStopTaskQ(MPTaskQueue *queue); +BOOL MPResetTaskQ(MPTaskQueue *queue); +BOOL MPEnqueTask(MPTaskQueue *queue, MPTask *task); +MPTask *MPDequeTask(MPTaskQueue *queue); +uint32_t MPDequeTasks(MPTaskQueue *queue, MPTask **queueBuffer, uint32_t queueBufferLen); +BOOL MPWaitTaskQ(MPTaskQueue *queue, MPTaskQueueState mask); +BOOL MPWaitTaskQWithTimeout(MPTaskQueue *queue, MPTaskQueueState wmask, OSTime timeout); +BOOL MPPrintTaskQStats(MPTaskQueue *queue, uint32_t unk); +void MPInitTask(MPTask *task, MPTaskFunc func, uint32_t userArg1, uint32_t userArg2); +BOOL MPTermTask(MPTask *task); +BOOL MPGetTaskInfo(MPTask *task, MPTaskInfo *info); +void *MPGetTaskUserData(MPTask *task); +void MPSetTaskUserData(MPTask *task, void *userData); +BOOL MPRunTasksFromTaskQ(MPTaskQueue *queue, uint32_t count); +BOOL MPRunTask(MPTask *task); + +#ifdef __cplusplus +} +#endif diff --git a/wiiu/include/wiiu/os.h b/wiiu/include/wiiu/os.h new file mode 100644 index 0000000000..e824ee1dbb --- /dev/null +++ b/wiiu/include/wiiu/os.h @@ -0,0 +1,26 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/wiiu/wut/include/coreinit/alarm.h b/wiiu/include/wiiu/os/alarm.h similarity index 53% rename from wiiu/wut/include/coreinit/alarm.h rename to wiiu/include/wiiu/os/alarm.h index e1f561b02f..6e699e09e6 100644 --- a/wiiu/wut/include/coreinit/alarm.h +++ b/wiiu/include/wiiu/os/alarm.h @@ -1,83 +1,52 @@ #pragma once -#include +#include #include "thread.h" -#include "threadqueue.h" #include "time.h" #ifdef __cplusplus extern "C" { #endif +typedef struct OSAlarm OSAlarm; + typedef void (*OSAlarmCallback)(OSAlarm *, OSContext *); #define OS_ALARM_QUEUE_TAG 0x614C6D51u - -typedef struct OSAlarmQueue +typedef struct { - //! Should always be set to the value OS_ALARM_QUEUE_TAG. uint32_t tag; - - //! Name set by OSInitAlarmQueueEx const char *name; uint32_t __unknown; - OSThreadQueue threadQueue; OSAlarm *head; OSAlarm *tail; -}OSAlarmQueue; +} OSAlarmQueue; -typedef struct OSAlarmLink +typedef struct { - struct OSAlarm *prev; - struct OSAlarm *next; -}OSAlarmLink; + OSAlarm *prev; + OSAlarm *next; +} OSAlarmLink; #define OS_ALARM_TAG 0x614C724Du typedef struct OSAlarm { - //! Should always be set to the value OS_ALARM_TAG. uint32_t tag; - - //! Name set from OSCreateAlarmEx. const char *name; - - uint32_t __unknown; - - //! The callback to execute once the alarm is triggered. + uint32_t __unknown0; OSAlarmCallback callback; - - //! Used with OSCancelAlarms for bulk cancellation of alarms. uint32_t group; - - uint32_t __unknown; - - //! The time when the alarm will next be triggered. + uint32_t __unknown1; OSTime nextFire; - - //! Link used for when this OSAlarm object is inside an OSAlarmQueue OSAlarmLink link; - - //! The period between alarm triggers, this is only set for periodic alarms. OSTime period; - - //! The time the alarm was started. OSTime start; - - //! User data set with OSSetAlarmUserData and retrieved with OSGetAlarmUserData. void *userData; - - //! The current state of the alarm, internal values. uint32_t state; - - //! Queue of threads currently waiting for the alarm to trigger with OSWaitAlarm. OSThreadQueue threadQueue; - - //! The queue that this alarm is currently in. OSAlarmQueue *alarmQueue; - - //! The context the alarm was triggered on. OSContext *context; -}OSAlarm; +} OSAlarm; void OSCreateAlarm(OSAlarm *alarm); void OSCreateAlarmEx(OSAlarm *alarm, const char *name); diff --git a/wiiu/wut/include/coreinit/atomic64.h b/wiiu/include/wiiu/os/atomic64.h similarity index 96% rename from wiiu/wut/include/coreinit/atomic64.h rename to wiiu/include/wiiu/os/atomic64.h index dda6e314fc..ca4c095382 100644 --- a/wiiu/wut/include/coreinit/atomic64.h +++ b/wiiu/include/wiiu/os/atomic64.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #ifdef __cplusplus extern "C" { diff --git a/wiiu/include/wiiu/os/cache.h b/wiiu/include/wiiu/os/cache.h new file mode 100644 index 0000000000..06003e7b1c --- /dev/null +++ b/wiiu/include/wiiu/os/cache.h @@ -0,0 +1,19 @@ +#pragma once +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void DCInvalidateRange(void *addr, uint32_t size); /* Equivalent to dcbi instruction. */ +void DCFlushRange(void *addr, uint32_t size); /* Equivalent to dcbf, sync, eieio. */ +void DCStoreRange(void *addr, uint32_t size); /* Equivalent to dcbst, sync, eieio. */ +void DCFlushRangeNoSync(void *addr, uint32_t size); /* Equivalent to dcbf. Does not perform sync, eieio like DCFlushRange. */ +void DCStoreRangeNoSync(void *addr, uint32_t size); /* Equivalent to dcbst. Does not perform sync, eieio like DCStoreRange. */ +void DCZeroRange(void *addr, uint32_t size); /* Equivalent to dcbz instruction. */ +void DCTouchRange(void *addr, uint32_t size); /* Equivalent to dcbt instruction. */ +void ICInvalidateRange(void *addr, uint32_t size); /* Equivalent to icbi instruction. */ + +#ifdef __cplusplus +} +#endif diff --git a/wiiu/include/wiiu/os/condition.h b/wiiu/include/wiiu/os/condition.h new file mode 100644 index 0000000000..d4030872cf --- /dev/null +++ b/wiiu/include/wiiu/os/condition.h @@ -0,0 +1,26 @@ +#pragma once +#include +#include "mutex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define OS_CONDITION_TAG 0x634E6456u + +typedef struct OSCondition +{ + uint32_t tag; + const char *name; + uint32_t __unknown; + OSThreadQueue queue; +}OSCondition; + +void OSInitCond(OSCondition *condition); +void OSInitCondEx(OSCondition *condition, const char *name); +void OSWaitCond(OSCondition *condition, OSMutex *mutex); +void OSSignalCond(OSCondition *condition); + +#ifdef __cplusplus +} +#endif diff --git a/wiiu/include/wiiu/os/core.h b/wiiu/include/wiiu/os/core.h new file mode 100644 index 0000000000..9ea1321099 --- /dev/null +++ b/wiiu/include/wiiu/os/core.h @@ -0,0 +1,17 @@ +#pragma once +#include + +#ifdef __cplusplus +extern "C" { +#endif + +uint32_t OSGetCoreCount(); +uint32_t OSGetCoreId(); +uint32_t OSGetMainCoreId(); +BOOL OSIsMainCore(); + +#ifdef __cplusplus +} +#endif + +/** @} */ diff --git a/wiiu/wut/include/coreinit/coroutine.h b/wiiu/include/wiiu/os/coroutine.h similarity index 95% rename from wiiu/wut/include/coreinit/coroutine.h rename to wiiu/include/wiiu/os/coroutine.h index 3108d15c0e..11422857cb 100644 --- a/wiiu/wut/include/coreinit/coroutine.h +++ b/wiiu/include/wiiu/os/coroutine.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #ifdef __cplusplus extern "C" { diff --git a/wiiu/include/wiiu/os/debug.h b/wiiu/include/wiiu/os/debug.h new file mode 100644 index 0000000000..7a565a69aa --- /dev/null +++ b/wiiu/include/wiiu/os/debug.h @@ -0,0 +1,18 @@ +#pragma once +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void OSConsoleWrite(const char *msg, int size); +void OSReport(const char *fmt, ...); +void OSPanic(const char *file, int line, const char *fmt, ...); +void OSFatal(const char *msg); + +int __os_snprintf(char *buf, int n, const char *format, ... ); + +#ifdef __cplusplus +} +#endif diff --git a/wiiu/wut/include/coreinit/dynload.h b/wiiu/include/wiiu/os/dynload.h similarity index 96% rename from wiiu/wut/include/coreinit/dynload.h rename to wiiu/include/wiiu/os/dynload.h index 0fb27fee8c..238a2337b8 100644 --- a/wiiu/wut/include/coreinit/dynload.h +++ b/wiiu/include/wiiu/os/dynload.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include "thread.h" #include "time.h" diff --git a/wiiu/include/wiiu/os/event.h b/wiiu/include/wiiu/os/event.h new file mode 100644 index 0000000000..ec895d6668 --- /dev/null +++ b/wiiu/include/wiiu/os/event.h @@ -0,0 +1,36 @@ +#pragma once +#include +#include "thread.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum OSEventMode +{ + OS_EVENT_MODE_MANUAL = 0, + OS_EVENT_MODE_AUTO = 1, +} OSEventMode; + +#define OS_EVENT_TAG 0x65566E54u +typedef struct +{ + uint32_t tag; + const char *name; + uint32_t __unknown; + BOOL value; + OSThreadQueue queue; + OSEventMode mode; +} OSEvent; + +void OSInitEvent(OSEvent *event, BOOL value, OSEventMode mode); +void OSInitEventEx(OSEvent *event, BOOL value, OSEventMode mode, char *name); +void OSSignalEvent(OSEvent *event); +void OSSignalEventAll(OSEvent *event); +void OSWaitEvent(OSEvent *event); +void OSResetEvent(OSEvent *event); +BOOL OSWaitEventWithTimeout(OSEvent *event, OSTime timeout); + +#ifdef __cplusplus +} +#endif diff --git a/wiiu/wut/include/coreinit/exception.h b/wiiu/include/wiiu/os/exception.h similarity index 87% rename from wiiu/wut/include/coreinit/exception.h rename to wiiu/include/wiiu/os/exception.h index d86880ba71..00a538ed96 100644 --- a/wiiu/wut/include/coreinit/exception.h +++ b/wiiu/include/wiiu/os/exception.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #ifdef __cplusplus extern "C" { @@ -26,10 +26,11 @@ typedef enum OSExceptionType OS_EXCEPTION_TYPE_ICI = 14, } OSExceptionType; -OSExceptionCallbackFn OSSetExceptionCallback(OSExceptionType exceptionType, OSExceptionCallbackFn callback); -OSExceptionCallbackFn OSSetExceptionCallbackEx(int unknown, OSExceptionType exceptionType, OSExceptionCallbackFn callback); +OSExceptionCallbackFn OSSetExceptionCallback(OSExceptionType exceptionType, + OSExceptionCallbackFn callback); +OSExceptionCallbackFn OSSetExceptionCallbackEx(int unknown, OSExceptionType exceptionType, + OSExceptionCallbackFn callback); #ifdef __cplusplus } #endif - diff --git a/wiiu/wut/include/coreinit/fastcondition.h b/wiiu/include/wiiu/os/fastcondition.h similarity index 91% rename from wiiu/wut/include/coreinit/fastcondition.h rename to wiiu/include/wiiu/os/fastcondition.h index 015b9c747c..f71a6ffa97 100644 --- a/wiiu/wut/include/coreinit/fastcondition.h +++ b/wiiu/include/wiiu/os/fastcondition.h @@ -1,6 +1,5 @@ #pragma once -#include -#include "threadqueue.h" +#include #include "fastmutex.h" #ifdef __cplusplus diff --git a/wiiu/wut/include/coreinit/fastmutex.h b/wiiu/include/wiiu/os/fastmutex.h similarity index 61% rename from wiiu/wut/include/coreinit/fastmutex.h rename to wiiu/include/wiiu/os/fastmutex.h index 23ecc30dc7..c38d2b1f07 100644 --- a/wiiu/wut/include/coreinit/fastmutex.h +++ b/wiiu/include/wiiu/os/fastmutex.h @@ -1,38 +1,26 @@ #pragma once -#include -#include "threadqueue.h" - -/** - * \defgroup coreinit_fastmutex Fast Mutex - * \ingroup coreinit - * - * Similar to OSMutex but tries to acquire the mutex without using the global - * scheduler lock, and does not test for thread cancel. - * @{ - */ +#include #ifdef __cplusplus extern "C" { #endif typedef struct OSFastMutex OSFastMutex; - -typedef struct OSFastMutexLink +typedef struct { OSFastMutex *next; OSFastMutex *prev; }OSFastMutexLink; #define OS_FAST_MUTEX_TAG 0x664D7458u - typedef struct OSFastMutex { uint32_t tag; const char *name; - uint32_t __unknown; + uint32_t __unknown0; OSThreadSimpleQueue queue; OSFastMutexLink link; - uint32_t __unknown[4]; + uint32_t __unknown1[4]; }OSFastMutex; void OSFastMutex_Init(OSFastMutex *mutex, const char *name); @@ -43,5 +31,3 @@ BOOL OSFastMutex_TryLock(OSFastMutex *mutex); #ifdef __cplusplus } #endif - -/** @} */ diff --git a/wiiu/wut/include/coreinit/foreground.h b/wiiu/include/wiiu/os/foreground.h similarity index 88% rename from wiiu/wut/include/coreinit/foreground.h rename to wiiu/include/wiiu/os/foreground.h index e7a56572f6..910b271f36 100644 --- a/wiiu/wut/include/coreinit/foreground.h +++ b/wiiu/include/wiiu/os/foreground.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #ifdef __cplusplus extern "C" { diff --git a/wiiu/wut/include/coreinit/memory.h b/wiiu/include/wiiu/os/memory.h similarity index 93% rename from wiiu/wut/include/coreinit/memory.h rename to wiiu/include/wiiu/os/memory.h index a184638843..55d6aeb3d4 100644 --- a/wiiu/wut/include/coreinit/memory.h +++ b/wiiu/include/wiiu/os/memory.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #ifdef __cplusplus extern "C" { diff --git a/wiiu/wut/include/coreinit/messagequeue.h b/wiiu/include/wiiu/os/messagequeue.h similarity index 97% rename from wiiu/wut/include/coreinit/messagequeue.h rename to wiiu/include/wiiu/os/messagequeue.h index 301e5d4bc1..d86a863fd8 100644 --- a/wiiu/wut/include/coreinit/messagequeue.h +++ b/wiiu/include/wiiu/os/messagequeue.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #ifdef __cplusplus extern "C" { @@ -18,7 +18,6 @@ typedef struct OSMessage } OSMessage; #define OS_MESSAGE_QUEUE_TAG 0x6D536751u - typedef struct OSMessageQueue { uint32_t tag; diff --git a/wiiu/include/wiiu/os/mutex.h b/wiiu/include/wiiu/os/mutex.h new file mode 100644 index 0000000000..d3724dbee5 --- /dev/null +++ b/wiiu/include/wiiu/os/mutex.h @@ -0,0 +1,39 @@ +#pragma once +#include +#include "thread.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OSMutex OSMutex; + +typedef struct +{ + OSMutex *next; + OSMutex *prev; +} OSMutexLink; + +#define OS_MUTEX_TAG 0x6D557458u +typedef struct OSMutex +{ + uint32_t tag; + const char *name; + uint32_t __unknown; + OSThreadQueue queue; + OSThread *owner; + int32_t count; + OSMutexLink link; +} OSMutex; + +void OSInitMutex(OSMutex *mutex); +void OSInitMutexEx(OSMutex *mutex, const char *name); +void OSLockMutex(OSMutex *mutex); +BOOL OSTryLockMutex(OSMutex *mutex); +void OSUnlockMutex(OSMutex *mutex); + +#ifdef __cplusplus +} +#endif + +/** @} */ diff --git a/wiiu/wut/include/coreinit/rendezvous.h b/wiiu/include/wiiu/os/rendezvous.h similarity index 80% rename from wiiu/wut/include/coreinit/rendezvous.h rename to wiiu/include/wiiu/os/rendezvous.h index 5162870b33..d5c2d224e1 100644 --- a/wiiu/wut/include/coreinit/rendezvous.h +++ b/wiiu/include/wiiu/os/rendezvous.h @@ -1,17 +1,15 @@ #pragma once -#include +#include #ifdef __cplusplus extern "C" { #endif -typedef struct OSRendezvous OSRendezvous; - -struct OSRendezvous +typedef struct { uint32_t core[3]; uint32_t __unknown; -}; +} OSRendezvous; void OSInitRendezvous(OSRendezvous *rendezvous); BOOL OSWaitRendezvous(OSRendezvous *rendezvous, uint32_t coreMask); diff --git a/wiiu/include/wiiu/os/screen.h b/wiiu/include/wiiu/os/screen.h new file mode 100644 index 0000000000..8cc926fb45 --- /dev/null +++ b/wiiu/include/wiiu/os/screen.h @@ -0,0 +1,25 @@ +#pragma once +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum OSScreenID +{ + SCREEN_TV = 0, + SCREEN_DRC = 1, +} OSScreenID; + +void OSScreenInit(); +uint32_t OSScreenGetBufferSizeEx(OSScreenID screen); +void OSScreenSetBufferEx(OSScreenID screen, void *addr); +void OSScreenClearBufferEx(OSScreenID screen, uint32_t colour); +void OSScreenFlipBuffersEx(OSScreenID screen); +void OSScreenPutFontEx(OSScreenID screen, uint32_t row, uint32_t column, const char *buffer); +void OSScreenPutPixelEx(OSScreenID screen, uint32_t x, uint32_t y, uint32_t colour); +void OSScreenEnableEx(OSScreenID screen, BOOL enable); + +#ifdef __cplusplus +} +#endif diff --git a/wiiu/include/wiiu/os/semaphore.h b/wiiu/include/wiiu/os/semaphore.h new file mode 100644 index 0000000000..487a66a86c --- /dev/null +++ b/wiiu/include/wiiu/os/semaphore.h @@ -0,0 +1,28 @@ +#pragma once +#include +#include "thread.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define OS_SEMAPHORE_TAG 0x73506852u +typedef struct +{ + uint32_t tag; + const char *name; + uint32_t __unknown; + int32_t count; + OSThreadQueue queue; +}OSSemaphore; + +void OSInitSemaphore(OSSemaphore *semaphore, int32_t count); +void OSInitSemaphoreEx(OSSemaphore *semaphore, int32_t count, const char *name); +int32_t OSGetSemaphoreCount(OSSemaphore *semaphore); +int32_t OSSignalSemaphore(OSSemaphore *semaphore); +int32_t OSWaitSemaphore(OSSemaphore *semaphore); +int32_t OSTryWaitSemaphore(OSSemaphore *semaphore); + +#ifdef __cplusplus +} +#endif diff --git a/wiiu/include/wiiu/os/spinlock.h b/wiiu/include/wiiu/os/spinlock.h new file mode 100644 index 0000000000..79edf31aae --- /dev/null +++ b/wiiu/include/wiiu/os/spinlock.h @@ -0,0 +1,31 @@ +#pragma once +#include +#include "time.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct +{ + uint32_t owner; + uint32_t __unknown0; + uint32_t recursion; + uint32_t __unknown1; +} OSSpinLock; + +void OSInitSpinLock(OSSpinLock *spinlock); +BOOL OSAcquireSpinLock(OSSpinLock *spinlock); +BOOL OSTryAcquireSpinLock(OSSpinLock *spinlock); +BOOL OSTryAcquireSpinLockWithTimeout(OSSpinLock *spinlock, OSTime timeout); +BOOL OSReleaseSpinLock(OSSpinLock *spinlock); +BOOL OSUninterruptibleSpinLock_Acquire(OSSpinLock *spinlock); +BOOL OSUninterruptibleSpinLock_TryAcquire(OSSpinLock *spinlock); +BOOL OSUninterruptibleSpinLock_TryAcquireWithTimeout(OSSpinLock *spinlock, OSTime timeout); +BOOL OSUninterruptibleSpinLock_Release(OSSpinLock *spinlock); + +#ifdef __cplusplus +} +#endif + +/** @} */ diff --git a/wiiu/include/wiiu/os/systeminfo.h b/wiiu/include/wiiu/os/systeminfo.h new file mode 100644 index 0000000000..e28c83634d --- /dev/null +++ b/wiiu/include/wiiu/os/systeminfo.h @@ -0,0 +1,21 @@ +#pragma once +#include +#include "time.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct +{ + uint32_t clockSpeed; + uint32_t __unknown0; + OSTime baseTime; + uint32_t __unknown[4]; +}OSSystemInfo; + +OSSystemInfo *OSGetSystemInfo(); + +#ifdef __cplusplus +} +#endif diff --git a/wiiu/include/wiiu/os/thread.h b/wiiu/include/wiiu/os/thread.h new file mode 100644 index 0000000000..edda453d8b --- /dev/null +++ b/wiiu/include/wiiu/os/thread.h @@ -0,0 +1,278 @@ +#pragma once +#include +#include "time.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OSThread OSThread; + +typedef int (*OSThreadEntryPointFn)(int argc, const char **argv); +typedef void (*OSThreadCleanupCallbackFn)(OSThread *thread, void *stack); +typedef void (*OSThreadDeallocatorFn)(OSThread *thread, void *stack); + +enum OS_THREAD_STATE +{ + OS_THREAD_STATE_NONE = 0, + + //! Thread is ready to run + OS_THREAD_STATE_READY = 1 << 0, + + //! Thread is running + OS_THREAD_STATE_RUNNING = 1 << 1, + + //! Thread is waiting, i.e. on a mutex + OS_THREAD_STATE_WAITING = 1 << 2, + + //! Thread is about to terminate + OS_THREAD_STATE_MORIBUND = 1 << 3, +}; +typedef uint8_t OSThreadState; + +enum OS_THREAD_REQUEST +{ + OS_THREAD_REQUEST_NONE = 0, + OS_THREAD_REQUEST_SUSPEND = 1, + OS_THREAD_REQUEST_CANCEL = 2, +}; +typedef uint32_t OSThreadRequest; + +enum OS_THREAD_ATTRIB +{ + //! Allow the thread to run on CPU0. + OS_THREAD_ATTRIB_AFFINITY_CPU0 = 1 << 0, + + //! Allow the thread to run on CPU1. + OS_THREAD_ATTRIB_AFFINITY_CPU1 = 1 << 1, + + //! Allow the thread to run on CPU2. + OS_THREAD_ATTRIB_AFFINITY_CPU2 = 1 << 2, + + //! Allow the thread to run any CPU. + OS_THREAD_ATTRIB_AFFINITY_ANY = ((1 << 0) | (1 << 1) | (1 << 2)), + + //! Start the thread detached. + OS_THREAD_ATTRIB_DETACHED = 1 << 3, + + //! Enables tracking of stack usage. + OS_THREAD_ATTRIB_STACK_USAGE = 1 << 5 +}; +typedef uint8_t OSThreadAttributes; + +#define OS_CONTEXT_TAG 0x4F53436F6E747874ull + +typedef struct OSContext +{ + //! Should always be set to the value OS_CONTEXT_TAG. + uint64_t tag; + + uint32_t gpr[32]; + uint32_t cr; + uint32_t lr; + uint32_t ctr; + uint32_t xer; + uint32_t srr0; + uint32_t srr1; + uint32_t __unknown[0x5]; + uint32_t fpscr; + double fpr[32]; + uint16_t spinLockCount; + uint16_t state; + uint32_t gqr[8]; + uint32_t __unknown0; + double psf[32]; + uint64_t coretime[3]; + uint64_t starttime; + uint32_t error; + uint32_t __unknown1; + uint32_t pmc1; + uint32_t pmc2; + uint32_t pmc3; + uint32_t pmc4; + uint32_t mmcr0; + uint32_t mmcr1; +} OSContext; + +typedef struct OSMutex OSMutex; +typedef struct OSFastMutex OSFastMutex; + +typedef struct OSMutexQueue +{ + OSMutex *head; + OSMutex *tail; + void *parent; + uint32_t __unknown; +} OSMutexQueue; + +typedef struct OSFastMutexQueue +{ + OSFastMutex *head; + OSFastMutex *tail; +} OSFastMutexQueue; + + +typedef struct +{ + OSThread *prev; + OSThread *next; +} OSThreadLink; + +typedef struct +{ + OSThread *head; + OSThread *tail; + void *parent; + uint32_t __unknown; +} OSThreadQueue; + +typedef struct +{ + OSThread *head; + OSThread *tail; +} OSThreadSimpleQueue; + +#define OS_THREAD_TAG 0x74487244u +#pragma pack(push, 1) +typedef struct OSThread +{ + OSContext context; + + //! Should always be set to the value OS_THREAD_TAG. + uint32_t tag; + + //! Bitfield of OS_THREAD_STATE + OSThreadState state; + + //! Bitfield of OS_THREAD_ATTRIB + OSThreadAttributes attr; + + //! Unique thread ID + uint16_t id; + + //! Suspend count (increased by OSSuspendThread). + int32_t suspendCounter; + + //! Actual priority of thread. + int32_t priority; + + //! Base priority of thread, 0 is highest priority, 31 is lowest priority. + int32_t basePriority; + + //! Exit value + int32_t exitValue; + + uint32_t unknown0[0x9]; + + //! Queue the thread is currently waiting on + OSThreadQueue *queue; + + //! Link used for thread queue + OSThreadLink link; + + //! Queue of threads waiting to join this thread + OSThreadQueue joinQueue; + + //! Mutex this thread is waiting to lock + OSMutex *mutex; + + //! Queue of mutexes this thread owns + OSMutexQueue mutexQueue; + + //! Link for global active thread queue + OSThreadLink activeLink; + + //! Stack start (top, highest address) + void *stackStart; + + //! Stack end (bottom, lowest address) + void *stackEnd; + + //! Thread entry point + OSThreadEntryPointFn entryPoint; + + uint32_t unknown1[0x77]; + + //! Thread specific values, accessed with OSSetThreadSpecific and OSGetThreadSpecific. + uint32_t specific[0x10]; + + uint32_t unknown2; + + //! Thread name, accessed with OSSetThreadName and OSGetThreadName. + const char *name; + + uint32_t unknown3; + + //! The stack pointer passed in OSCreateThread. + void *userStackPointer; + + //! Called just before thread is terminated, set with OSSetThreadCleanupCallback + OSThreadCleanupCallbackFn cleanupCallback; + + //! Called just after a thread is terminated, set with OSSetThreadDeallocator + OSThreadDeallocatorFn deallocator; + + //! If TRUE then a thread can be cancelled or suspended, set with OSSetThreadCancelState + BOOL cancelState; + + //! Current thread request, used for cancelleing and suspending the thread. + OSThreadRequest requestFlag; + + //! Pending suspend request count + int32_t needSuspend; + + //! Result of thread suspend + int32_t suspendResult; + + //! Queue of threads waiting for a thread to be suspended. + OSThreadQueue suspendQueue; + + uint32_t unknown4[0x2A]; +} OSThread; +#pragma pack(pop) + +void +OSCancelThread(OSThread *thread); +int32_t OSCheckActiveThreads(); +int32_t OSCheckThreadStackUsage(OSThread *thread); +void OSClearThreadStackUsage(OSThread *thread); +void OSContinueThread(OSThread *thread); +BOOL OSCreateThread(OSThread *thread, OSThreadEntryPointFn entry, int32_t argc, char *argv, + void *stack, uint32_t stackSize, int32_t priority, OSThreadAttributes attributes); +void OSDetachThread(OSThread *thread); +void OSExitThread(int32_t result); +void OSGetActiveThreadLink(OSThread *thread, OSThreadLink *link); +OSThread *OSGetCurrentThread(); +OSThread *OSGetDefaultThread(uint32_t coreID); +uint32_t OSGetStackPointer(); +uint32_t OSGetThreadAffinity(OSThread *thread); +const char *OSGetThreadName(OSThread *thread); +int32_t OSGetThreadPriority(OSThread *thread); +uint32_t OSGetThreadSpecific(uint32_t id); +BOOL OSIsThreadSuspended(OSThread *thread); +BOOL OSIsThreadTerminated(OSThread *thread); +BOOL OSJoinThread(OSThread *thread, int *threadResult); +int32_t OSResumeThread(OSThread *thread); +BOOL OSRunThread(OSThread *thread, OSThreadEntryPointFn entry, int argc, const char **argv); +BOOL OSSetThreadAffinity(OSThread *thread, uint32_t affinity); +BOOL OSSetThreadCancelState(BOOL state); +OSThreadCleanupCallbackFn OSSetThreadCleanupCallback(OSThread *thread, + OSThreadCleanupCallbackFn callback); +OSThreadDeallocatorFn OSSetThreadDeallocator(OSThread *thread, OSThreadDeallocatorFn deallocator); +void OSSetThreadName(OSThread *thread, const char *name); +BOOL OSSetThreadPriority(OSThread *thread, int32_t priority); +BOOL OSSetThreadRunQuantum(OSThread *thread, uint32_t quantum); +void OSSetThreadSpecific(uint32_t id, uint32_t value); +BOOL OSSetThreadStackUsage(OSThread *thread); +void OSSleepThread(OSThreadQueue *queue); +void OSSleepTicks(OSTime ticks); +uint32_t OSSuspendThread(OSThread *thread); +void OSTestThreadCancel(); +void OSWakeupThread(OSThreadQueue *queue); +void OSYieldThread(); +void OSInitThreadQueue(OSThreadQueue *queue); +void OSInitThreadQueueEx(OSThreadQueue *queue, void *parent); + +#ifdef __cplusplus +} +#endif diff --git a/wiiu/system/wiiu.h b/wiiu/include/wiiu/os/time.h similarity index 54% rename from wiiu/system/wiiu.h rename to wiiu/include/wiiu/os/time.h index 84aadd8ee3..01c8b89b71 100644 --- a/wiiu/system/wiiu.h +++ b/wiiu/include/wiiu/os/time.h @@ -1,5 +1,14 @@ -#ifndef WIIU_H -#define WIIU_H +#pragma once +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define OSOneSecond ((OSGetSystemInfo()->clockSpeed) / 4) +#define OSMilliseconds(val) ((((uint64_t)(val)) * (uint64_t)(OSOneSecond)) / 1000ull) +#define OSMicroseconds(val) ((((uint64_t)(val)) * (uint64_t)(OSOneSecond)) / 1000000ull) +#define OSNanoseconds(val) ((((uint64_t)(val)) * (uint64_t)(OSOneSecond)) / 1000000000ull) #define wiiu_bus_clock (17 * 13 * 5*5*5 * 5*5*5 * 3*3 * 2*2*2) // 248.625000 Mhz #define wiiu_cpu_clock (17 * 13 * 5*5*5 * 5*5*5 * 5 * 3*3 * 2*2*2) // 1243.125000 Mhz @@ -15,4 +24,27 @@ #define ticks_to_us(ticks) (((uint64_t)(ticks) * (2*2 * 2*2*2)) / (17 * 13 * 3*3)) #define ticks_to_ns(ticks) (((uint64_t)(ticks) * (2*2 * 2*2*2 * 2*2*2 * 5*5*5)) / (17 * 13 * 3*3)) -#endif // WIIU_H +typedef int32_t OSTick; +typedef int64_t OSTime; + +typedef struct +{ + int32_t tm_sec; + int32_t tm_min; + int32_t tm_hour; + int32_t tm_mday; + int32_t tm_mon; + int32_t tm_year; +}OSCalendarTime; + + +OSTime OSGetTime(); +OSTime OSGetSystemTime(); +OSTick OSGetTick(); +OSTick OSGetSystemTick(); +OSTime OSCalendarTimeToTicks(OSCalendarTime *calendarTime); +void OSTicksToCalendarTime(OSTime time, OSCalendarTime *calendarTime); + +#ifdef __cplusplus +} +#endif diff --git a/wiiu/wut/include/coreinit/title.h b/wiiu/include/wiiu/os/title.h similarity index 79% rename from wiiu/wut/include/coreinit/title.h rename to wiiu/include/wiiu/os/title.h index c37a15a102..424f292c19 100644 --- a/wiiu/wut/include/coreinit/title.h +++ b/wiiu/include/wiiu/os/title.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #ifdef __cplusplus extern "C" { @@ -10,5 +10,3 @@ u64 OSGetTitleID(void); #ifdef __cplusplus } #endif - -/** @} */ diff --git a/wiiu/wut/include/proc_ui/procui.h b/wiiu/include/wiiu/procui.h similarity index 90% rename from wiiu/wut/include/proc_ui/procui.h rename to wiiu/include/wiiu/procui.h index 5a0d7793a4..4ab4435154 100644 --- a/wiiu/wut/include/proc_ui/procui.h +++ b/wiiu/include/wiiu/procui.h @@ -1,11 +1,5 @@ #pragma once -#include - -/** - * \defgroup proc_ui_procui ProcUI - * \ingroup proc_ui - * @{ - */ +#include #ifdef __cplusplus extern "C" { @@ -39,5 +33,3 @@ ProcUIStatus ProcUISubProcessMessages(BOOL block); #ifdef __cplusplus } #endif - -/** @} */ diff --git a/wiiu/wut/include/sysapp/launch.h b/wiiu/include/wiiu/sysapp.h similarity index 54% rename from wiiu/wut/include/sysapp/launch.h rename to wiiu/include/wiiu/sysapp.h index 5562cbdf4d..49b48bef40 100644 --- a/wiiu/wut/include/sysapp/launch.h +++ b/wiiu/include/wiiu/sysapp.h @@ -1,10 +1,18 @@ #pragma once -#include +#include #ifdef __cplusplus extern "C" { #endif +typedef struct sysapp_input_struct sysapp_input_struct; + +void SYSSwitchToSyncControllerOnHBM(); +void SYSSwitchToEManual(); +void SYSSwitchToEShop(); +void _SYSSwitchToMainApp(); +void SYSSwitchToBrowserForViewer(sysapp_input_struct *); + void SYSRelaunchTitle(uint32_t argc, char *pa_Argv[]); void SYSLaunchMenu(); void SYSLaunchTitle(uint64_t TitleId); diff --git a/wiiu/wut/include/wut_types.h b/wiiu/include/wiiu/types.h similarity index 100% rename from wiiu/wut/include/wut_types.h rename to wiiu/include/wiiu/types.h index c09a6e7f6b..d84180142e 100644 --- a/wiiu/wut/include/wut_types.h +++ b/wiiu/include/wiiu/types.h @@ -2,8 +2,6 @@ #include #include -typedef int BOOL; - #ifndef TRUE #define TRUE 1 #endif @@ -12,6 +10,8 @@ typedef int BOOL; #define FALSE 0 #endif +typedef int BOOL; + typedef uint8_t u8; typedef uint16_t u16; typedef uint32_t u32; diff --git a/wiiu/wut/include/vpad/input.h b/wiiu/include/wiiu/vpad.h similarity index 98% rename from wiiu/wut/include/vpad/input.h rename to wiiu/include/wiiu/vpad.h index 5336826768..f3887b2c3c 100644 --- a/wiiu/wut/include/vpad/input.h +++ b/wiiu/include/wiiu/vpad.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #ifdef __cplusplus extern "C" { @@ -130,5 +130,3 @@ void VPADGetTPCalibratedPoint(uint32_t chan, VPADTouchData *calibratedData, VPAD #ifdef __cplusplus } #endif - -/** @} */ diff --git a/wiiu/include/wiiu/wpad.h b/wiiu/include/wiiu/wpad.h new file mode 100644 index 0000000000..64afc0ddef --- /dev/null +++ b/wiiu/include/wiiu/wpad.h @@ -0,0 +1,52 @@ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define WPAD_BUTTON_LEFT 0x0001 +#define WPAD_BUTTON_RIGHT 0x0002 +#define WPAD_BUTTON_DOWN 0x0004 +#define WPAD_BUTTON_UP 0x0008 +#define WPAD_BUTTON_PLUS 0x0010 +#define WPAD_BUTTON_2 0x0100 +#define WPAD_BUTTON_1 0x0200 +#define WPAD_BUTTON_B 0x0400 +#define WPAD_BUTTON_A 0x0800 +#define WPAD_BUTTON_MINUS 0x1000 +#define WPAD_BUTTON_Z 0x2000 +#define WPAD_BUTTON_C 0x4000 +#define WPAD_BUTTON_HOME 0x8000 + +#define WPAD_CLASSIC_BUTTON_UP 0x0001 +#define WPAD_CLASSIC_BUTTON_LEFT 0x0002 +#define WPAD_CLASSIC_BUTTON_ZR 0x0004 +#define WPAD_CLASSIC_BUTTON_X 0x0008 +#define WPAD_CLASSIC_BUTTON_A 0x0010 +#define WPAD_CLASSIC_BUTTON_Y 0x0020 +#define WPAD_CLASSIC_BUTTON_B 0x0040 +#define WPAD_CLASSIC_BUTTON_ZL 0x0080 +#define WPAD_CLASSIC_BUTTON_R 0x0200 +#define WPAD_CLASSIC_BUTTON_PLUS 0x0400 +#define WPAD_CLASSIC_BUTTON_HOME 0x0800 +#define WPAD_CLASSIC_BUTTON_MINUS 0x1000 +#define WPAD_CLASSIC_BUTTON_L 0x2000 +#define WPAD_CLASSIC_BUTTON_DOWN 0x4000 +#define WPAD_CLASSIC_BUTTON_RIGHT 0x8000 + +#define WPAD_PRO_BUTTON_STICK_R 0x10000 +#define WPAD_PRO_BUTTON_STICK_L 0x20000 + +typedef void (* wpad_connect_callback_t)(s32 chan, s32 status); + +s32 WPADProbe (s32 chan, u32 * pad_type); +s32 WPADSetDataFormat(s32 chan, s32 format); +void WPADEnableURCC(s32 enable); +void WPADEnableWiiRemote(s32 enable); +void WPADRead(s32 chan, void * data); + +#ifdef __cplusplus +} +#endif diff --git a/wiiu/ios.h b/wiiu/ios.h deleted file mode 100644 index 5bc1f43de2..0000000000 --- a/wiiu/ios.h +++ /dev/null @@ -1,10 +0,0 @@ - -#ifndef _IOS_H_ -#define _IOS_H_ - -int IOS_Open(char *path, unsigned int mode); -int IOS_Close(int fd); -int IOS_Ioctl(int fd, unsigned int request, void *input_buffer, unsigned int input_buffer_len, void *output_buffer, unsigned int output_buffer_len); -int IOS_IoctlAsync(int fd, unsigned int request, void *input_buffer, unsigned int input_buffer_len, void *output_buffer, unsigned int output_buffer_len, void *cb, void *cbarg); - -#endif diff --git a/wiiu/padscore.h b/wiiu/padscore.h deleted file mode 100644 index 962dff02d4..0000000000 --- a/wiiu/padscore.h +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#ifndef __PAD_SCORE_FUNCTIONS_H_ -#define __PAD_SCORE_FUNCTIONS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define WPAD_BUTTON_LEFT 0x0001 -#define WPAD_BUTTON_RIGHT 0x0002 -#define WPAD_BUTTON_DOWN 0x0004 -#define WPAD_BUTTON_UP 0x0008 -#define WPAD_BUTTON_PLUS 0x0010 -#define WPAD_BUTTON_2 0x0100 -#define WPAD_BUTTON_1 0x0200 -#define WPAD_BUTTON_B 0x0400 -#define WPAD_BUTTON_A 0x0800 -#define WPAD_BUTTON_MINUS 0x1000 -#define WPAD_BUTTON_Z 0x2000 -#define WPAD_BUTTON_C 0x4000 -#define WPAD_BUTTON_HOME 0x8000 - -#define WPAD_CLASSIC_BUTTON_UP 0x0001 -#define WPAD_CLASSIC_BUTTON_LEFT 0x0002 -#define WPAD_CLASSIC_BUTTON_ZR 0x0004 -#define WPAD_CLASSIC_BUTTON_X 0x0008 -#define WPAD_CLASSIC_BUTTON_A 0x0010 -#define WPAD_CLASSIC_BUTTON_Y 0x0020 -#define WPAD_CLASSIC_BUTTON_B 0x0040 -#define WPAD_CLASSIC_BUTTON_ZL 0x0080 -#define WPAD_CLASSIC_BUTTON_R 0x0200 -#define WPAD_CLASSIC_BUTTON_PLUS 0x0400 -#define WPAD_CLASSIC_BUTTON_HOME 0x0800 -#define WPAD_CLASSIC_BUTTON_MINUS 0x1000 -#define WPAD_CLASSIC_BUTTON_L 0x2000 -#define WPAD_CLASSIC_BUTTON_DOWN 0x4000 -#define WPAD_CLASSIC_BUTTON_RIGHT 0x8000 - -#define WPAD_PRO_BUTTON_STICK_R 0x10000 -#define WPAD_PRO_BUTTON_STICK_L 0x20000 - -void InitPadScoreFunctionPointers(void); - - -typedef struct _KPADData -{ - u32 btns_h; - u32 btns_d; - u32 btns_r; - u32 unused_1[5]; - f32 pos_x; - f32 pos_y; - u32 unused_2[3]; - f32 angle_x; - f32 angle_y; - u32 unused_3[8]; - u8 device_type; - u8 wpad_error; - u8 pos_valid; - u8 unused_4[1]; - - union - { - struct - { - f32 stick_x; - f32 stick_y; - } nunchuck; - - struct - { - u32 btns_h; - u32 btns_d; - u32 btns_r; - f32 lstick_x; - f32 lstick_y; - f32 rstick_x; - f32 rstick_y; - f32 ltrigger; - f32 rtrigger; - } classic; - - u32 unused_6[20]; - }; - u32 unused_7[16]; -} KPADData; - -typedef void (* wpad_connect_callback_t)(s32 chan, s32 status); - -void KPADInit (void); -s32 WPADProbe (s32 chan, u32 * pad_type); -s32 WPADSetDataFormat(s32 chan, s32 format); -void WPADEnableURCC(s32 enable); -void WPADEnableWiiRemote(s32 enable); -void WPADRead(s32 chan, void * data); -s32 KPADRead(s32 chan, void * data, u32 size); - -#ifdef __cplusplus -} -#endif - -#endif // __PAD_SCORE_FUNCTIONS_H_ diff --git a/wiiu/system/dynamic.c b/wiiu/system/dynamic.c index 8b929071d4..cb8a9f7cbd 100644 --- a/wiiu/system/dynamic.c +++ b/wiiu/system/dynamic.c @@ -1,5 +1,5 @@ -#include -#include +#include +#include #define IMPORT(name) void* addr_##name #define IMPORT_BEGIN(lib) diff --git a/wiiu/system/exception.h b/wiiu/system/exception.h index f1c3a0507d..9d7226cd15 100644 --- a/wiiu/system/exception.h +++ b/wiiu/system/exception.h @@ -1,10 +1,6 @@ /* source: https://github.com/QuarkTheAwesome/URetro */ -#include -#include -#include -#include -#include +#include #ifndef __EXCEPTION_H__ #define __EXCEPTION_H__ diff --git a/wiiu/system/exception_handler.c b/wiiu/system/exception_handler.c index 66680d9c71..d7512cbd68 100644 --- a/wiiu/system/exception_handler.c +++ b/wiiu/system/exception_handler.c @@ -1,8 +1,5 @@ #include -#include -#include -#include -#include +#include #include "exception_handler.h" #include "wiiu_dbg.h" diff --git a/wiiu/system/memory.c b/wiiu/system/memory.c index ce3ffa7d0b..b5d2e0ac0c 100644 --- a/wiiu/system/memory.c +++ b/wiiu/system/memory.c @@ -17,10 +17,7 @@ #include #include #include "memory.h" -#include -#include -#include -#include +#include static MEMExpandedHeap* mem1_heap; static MEMExpandedHeap* bucket_heap; diff --git a/wiiu/tex_shader.h b/wiiu/tex_shader.h index fa2571aa17..f907c4e4a8 100644 --- a/wiiu/tex_shader.h +++ b/wiiu/tex_shader.h @@ -15,8 +15,7 @@ #ifndef TEX_SHADER_H #define TEX_SHADER_H -#include -#include "system/memory.h" +#include #ifdef __cplusplus extern "C" { diff --git a/wiiu/wiiu_dbg.h b/wiiu/wiiu_dbg.h index 195d3cb297..05f558dd81 100644 --- a/wiiu/wiiu_dbg.h +++ b/wiiu/wiiu_dbg.h @@ -2,7 +2,7 @@ #define WIIU_DBG_H #include -#include +#include #ifdef __cplusplus extern "C" { #endif diff --git a/wiiu/wut/elf2rpl/Makefile b/wiiu/wut/elf2rpl/Makefile index 3597b6a9eb..21c85a29bd 100644 --- a/wiiu/wut/elf2rpl/Makefile +++ b/wiiu/wut/elf2rpl/Makefile @@ -9,6 +9,12 @@ INCLUDES := -I. CFLAGS := -O2 -Wall --std=c++14 LDFLAGS := -lz +ifneq ($(findstring Linux,$(shell uname -a)),) +else ifneq ($(findstring Darwin,$(shell uname -a)),) +else + TARGET := $(TARGET).exe +endif + all: $(TARGET) clean: diff --git a/wiiu/wut/include/coreinit/baseheap.h b/wiiu/wut/include/coreinit/baseheap.h deleted file mode 100644 index 3993c2e5e2..0000000000 --- a/wiiu/wut/include/coreinit/baseheap.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once -#include - -/** - * \defgroup coreinit_baseheap Base Heap - * \ingroup coreinit - * @{ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void *MEMHeapHandle; - -typedef enum MEMBaseHeapType -{ - MEM_BASE_HEAP_MEM1 = 0, - MEM_BASE_HEAP_MEM2 = 1, - MEM_BASE_HEAP_FG = 8, -} MEMBaseHeapType; - -/** - * Get which memory area a heap belongs to. - */ -MEMBaseHeapType -MEMGetArena(MEMHeapHandle handle); - -/** - * Get base heap for memory area. - */ -MEMHeapHandle -MEMGetBaseHeapHandle(MEMBaseHeapType type); - -/** - * Set base heap for memory area. - */ -MEMHeapHandle -MEMSetBaseHeapHandle(MEMBaseHeapType type, - MEMHeapHandle handle); - -#ifdef __cplusplus -} -#endif - -/** @} */ diff --git a/wiiu/wut/include/coreinit/cache.h b/wiiu/wut/include/coreinit/cache.h deleted file mode 100644 index e5b6679276..0000000000 --- a/wiiu/wut/include/coreinit/cache.h +++ /dev/null @@ -1,70 +0,0 @@ -#pragma once -#include - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * Equivalent to dcbi instruction. - */ -void DCInvalidateRange(void *addr, - uint32_t size); - - -/** - * Equivalent to dcbf, sync, eieio. - */ -void DCFlushRange(void *addr, - uint32_t size); - - -/** - * Equivalent to dcbst, sync, eieio. - */ -void DCStoreRange(void *addr, - uint32_t size); - - -/** - * Equivalent to dcbf. - * - * Does not perform sync, eieio like DCFlushRange. - */ -void DCFlushRangeNoSync(void *addr, - uint32_t size); - - -/** - * Equivalent to dcbst. - * - * Does not perform sync, eieio like DCStoreRange. - */ -void DCStoreRangeNoSync(void *addr, - uint32_t size); - - -/** - * Equivalent to dcbz instruction. - */ -void DCZeroRange(void *addr, - uint32_t size); - - -/** - * Equivalent to dcbt instruction. - */ -void DCTouchRange(void *addr, - uint32_t size); - - -/** - * Equivalent to icbi instruction. - */ -void ICInvalidateRange(void *addr, - uint32_t size); - -#ifdef __cplusplus -} -#endif diff --git a/wiiu/wut/include/coreinit/condition.h b/wiiu/wut/include/coreinit/condition.h deleted file mode 100644 index abd3524e4e..0000000000 --- a/wiiu/wut/include/coreinit/condition.h +++ /dev/null @@ -1,61 +0,0 @@ -#pragma once -#include -#include "threadqueue.h" -#include "mutex.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define OS_CONDITION_TAG 0x634E6456u - -typedef struct OSCondition -{ - //! Should always be set to the value OS_CONDITION_TAG. - uint32_t tag; - - //! Name set by OSInitCondEx. - const char *name; - - uint32_t __unknown; - - //! Queue of threads currently waiting on condition with OSWaitCond. - OSThreadQueue queue; -}OSCondition; - -/** - * Initialise a condition variable structure. - */ -void OSInitCond(OSCondition *condition); - - -/** - * Initialise a condition variable structure with a name. - */ -void OSInitCondEx(OSCondition *condition, - const char *name); - - -/** - * Sleep the current thread until the condition variable has been signalled. - * - * The mutex must be locked when entering this function. - * Will unlock the mutex and then sleep, reacquiring the mutex when woken. - * - * Similar to std::condition_variable::wait. - */ -void OSWaitCond(OSCondition *condition, - OSMutex *mutex); - - -/** - * Will wake up any threads waiting on the condition with OSWaitCond. - * - * Similar to std::condition_variable::notify_all. - */ -void OSSignalCond(OSCondition *condition); - - -#ifdef __cplusplus -} -#endif diff --git a/wiiu/wut/include/coreinit/core.h b/wiiu/wut/include/coreinit/core.h deleted file mode 100644 index f339627716..0000000000 --- a/wiiu/wut/include/coreinit/core.h +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once -#include - -/** - * \defgroup coreinit_core Core Identification - * \ingroup coreinit - * @{ - */ - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * Returns the number of cores, should always be 3. - */ -uint32_t -OSGetCoreCount(); - - -/** - * Returns the ID of the core currently executing this thread. - */ -uint32_t -OSGetCoreId(); - - -/** - * Returns the ID of the main core. - */ -uint32_t -OSGetMainCoreId(); - - -/** - * Returns true if the current core is the main core. - */ -BOOL -OSIsMainCore(); - - -#ifdef __cplusplus -} -#endif - -/** @} */ diff --git a/wiiu/wut/include/coreinit/debug.h b/wiiu/wut/include/coreinit/debug.h deleted file mode 100644 index e8fe664c80..0000000000 --- a/wiiu/wut/include/coreinit/debug.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once -#include - -#ifdef __cplusplus -extern "C" { -#endif - -void OSConsoleWrite(const char *msg, uint32_t size); -void OSReport(const char *fmt, ...); -void OSPanic(const char *file, uint32_t line, const char *fmt, ...); -void OSFatal(const char *msg); - -#ifdef __cplusplus -} -#endif diff --git a/wiiu/wut/include/coreinit/event.h b/wiiu/wut/include/coreinit/event.h deleted file mode 100644 index 4e93c17e8c..0000000000 --- a/wiiu/wut/include/coreinit/event.h +++ /dev/null @@ -1,113 +0,0 @@ -#pragma once -#include -#include "thread.h" -#include "threadqueue.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OSEvent OSEvent; - -typedef enum OSEventMode -{ - //! A manual event will only reset when OSResetEvent is called. - OS_EVENT_MODE_MANUAL = 0, - - //! An auto event will reset everytime a thread is woken. - OS_EVENT_MODE_AUTO = 1, -} OSEventMode; - -#define OS_EVENT_TAG 0x65566E54u - -struct OSEvent -{ - //! Should always be set to the value OS_EVENT_TAG. - uint32_t tag; - - const char *name; - uint32_t __unknown; - BOOL value; - - //! The threads currently waiting on this event object with OSWaitEvent. - OSThreadQueue queue; - - //! The mode of the event object, set by OSInitEvent. - OSEventMode mode; -}; - - -/** - * Initialise an event object with value and mode. - */ -void OSInitEvent(OSEvent *event, BOOL value, OSEventMode mode); - - -/** - * Initialise an event object with value, mode and name. - */ -void OSInitEventEx(OSEvent *event, BOOL value, OSEventMode mode, char *name); - -/** - * Signals the event. - * - * If no threads are waiting the event value is set. - * - * If the event mode is OS_EVENT_MODE_MANUAL this will wake all waiting threads - * and the event will remain set until OSResetEvent is called. - * - * If the event mode is OS_EVENT_MODE_AUTO this will wake only one thread - * and the event will be reset immediately. - * - * Similar to SetEvent. - */ -void OSSignalEvent(OSEvent *event); - -/** - * Signals all threads waiting on an event. - * - * If no threads are waiting the event value is set. - * - * If the event mode is OS_EVENT_MODE_MANUAL this will wake all waiting threads - * and the event will remain set until OSResetEvent is called. - * - * If the event mode is OS_EVENT_MODE_AUTO this will wake all waiting threads - * and the event will be reset. - */ -void -OSSignalEventAll(OSEvent *event); - - -/** - * Wait until an event is signalled. - * - * If the event is already set, this returns immediately. - * - * If the event mode is OS_EVENT_MODE_AUTO the event will be reset before - * returning from this method. - * - * Similar to WaitForSingleObject. - */ -void OSWaitEvent(OSEvent *event); - - -/** - * Resets the event object. - * - * Similar to ResetEvent. - */ -void OSResetEvent(OSEvent *event); - - -/** - * Wait until an event is signalled or a timeout has occurred. - * - * Similar to WaitForSingleObject. - */ -BOOL -OSWaitEventWithTimeout(OSEvent *event, - OSTime timeout); - -#ifdef __cplusplus -} -#endif diff --git a/wiiu/wut/include/coreinit/exit.h b/wiiu/wut/include/coreinit/exit.h deleted file mode 100644 index 83de0ae2e8..0000000000 --- a/wiiu/wut/include/coreinit/exit.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once -#include - -#ifdef __cplusplus -extern "C" { -#endif - -void -exit(int code); - -void -_Exit(); - -#ifdef __cplusplus -} -#endif - diff --git a/wiiu/wut/include/coreinit/filesystem.h b/wiiu/wut/include/coreinit/filesystem.h deleted file mode 100644 index 7aa7400f26..0000000000 --- a/wiiu/wut/include/coreinit/filesystem.h +++ /dev/null @@ -1,473 +0,0 @@ -#pragma once -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef uint32_t FSDirectoryHandle; -typedef uint32_t FSFileHandle; -typedef uint32_t FSPriority; - -typedef enum FSStatus -{ - FS_STATUS_OK = 0, - FS_STATUS_CANCELLED = -1, - FS_STATUS_END = -2, - FS_STATUS_MAX = -3, - FS_STATUS_ALREADY_OPEN = -4, - FS_STATUS_EXISTS = -5, - FS_STATUS_NOT_FOUND = -6, - FS_STATUS_NOT_FILE = -7, - FS_STATUS_NOT_DIR = -8, - FS_STATUS_ACCESS_ERROR = -9, - FS_STATUS_PERMISSION_ERROR = -10, - FS_STATUS_FILE_TOO_BIG = -11, - FS_STATUS_STORAGE_FULL = -12, - FS_STATUS_JOURNAL_FULL = -13, - FS_STATUS_UNSUPPORTED_CMD = -14, - FS_STATUS_MEDIA_NOT_READY = -15, - FS_STATUS_MEDIA_ERROR = -17, - FS_STATUS_CORRUPTED = -18, - FS_STATUS_FATAL_ERROR = -0x400, -} FSStatus; - -typedef enum FSError -{ - FS_ERROR_NOT_INIT = -0x30001, - FS_ERROR_BUSY = -0x30002, - FS_ERROR_CANCELLED = -0x30003, - FS_ERROR_END_OF_DIR = -0x30004, - FS_ERROR_END_OF_FILE = -0x30005, - FS_ERROR_MAX_MOUNT_POINTS = -0x30010, - FS_ERROR_MAX_VOLUMES = -0x30011, - FS_ERROR_MAX_CLIENTS = -0x30012, - FS_ERROR_MAX_FILES = -0x30013, - FS_ERROR_MAX_DIRS = -0x30014, - FS_ERROR_ALREADY_OPEN = -0x30015, - FS_ERROR_ALREADY_EXISTS = -0x30016, - FS_ERROR_NOT_FOUND = -0x30017, - FS_ERROR_NOT_EMPTY = -0x30018, - FS_ERROR_ACCESS_ERROR = -0x30019, - FS_ERROR_PERMISSION_ERROR = -0x3001A, - FS_ERROR_DATA_CORRUPTED = -0x3001B, - FS_ERROR_STORAGE_FULL = -0x3001C, - FS_ERROR_JOURNAL_FULL = -0x3001D, - FS_ERROR_UNAVAILABLE_COMMAND = -0x3001F, - FS_ERROR_UNSUPPORTED_COMMAND = -0x30020, - FS_ERROR_INVALID_PARAM = -0x30021, - FS_ERROR_INVALID_PATH = -0x30022, - FS_ERROR_INVALID_BUFFER = -0x30023, - FS_ERROR_INVALID_ALIGNMENT = -0x30024, - FS_ERROR_INVALID_CLIENTHANDLE = -0x30025, - FS_ERROR_INVALID_FILEHANDLE = -0x30026, - FS_ERROR_INVALID_DIRHANDLE = -0x30027, - FS_ERROR_NOT_FILE = -0x30028, - FS_ERROR_NOT_DIR = -0x30029, - FS_ERROR_FILE_TOO_BIG = -0x3002A, - FS_ERROR_OUT_OF_RANGE = -0x3002B, - FS_ERROR_OUT_OF_RESOURCES = -0x3002C, - FS_ERROR_MEDIA_NOT_READY = -0x30030, - FS_ERROR_MEDIA_ERROR = -0x30031, - FS_ERROR_WRITE_PROTECTED = -0x30032, - FS_ERROR_INVALID_MEDIA = -0x30033, -} FSError; - -typedef enum FSMode -{ - FS_MODE_READ_OWNER = 0x400, - FS_MODE_WRITE_OWNER = 0x200, - FS_MODE_EXEC_OWNER = 0x100, - - FS_MODE_READ_GROUP = 0x040, - FS_MODE_WRITE_GROUP = 0x020, - FS_MODE_EXEC_GROUP = 0x010, - - FS_MODE_READ_OTHER = 0x004, - FS_MODE_WRITE_OTHER = 0x002, - FS_MODE_EXEC_OTHER = 0x001, -} FSMode; - -typedef enum FSStatFlags -{ - FS_STAT_DIRECTORY = 0x80000000, -} FSStatFlags; - -typedef enum FSVolumeState -{ - FS_VOLUME_STATE_INITIAL = 0, - FS_VOLUME_STATE_READY = 1, - FS_VOLUME_STATE_NO_MEDIA = 2, - FS_VOLUME_STATE_INVALID_MEDIA = 3, - FS_VOLUME_STATE_DIRTY_MEDIA = 4, - FS_VOLUME_STATE_WRONG_MEDIA = 5, - FS_VOLUME_STATE_MEDIA_ERROR = 6, - FS_VOLUME_STATE_DATA_CORRUPTED = 7, - FS_VOLUME_STATE_WRITE_PROTECTED = 8, - FS_VOLUME_STATE_JOURNAL_FULL = 9, - FS_VOLUME_STATE_FATAL = 10, - FS_VOLUME_STATE_INVALID = 11, -} FSVolumeState; - -typedef enum FSMountSourceType -{ - FS_MOUNT_SOURCE_SD = 0, - FS_MOUNT_SOURCE_UNK = 1, -} FSMountSourceType; - -typedef struct FSClient -{ - uint32_t __unknown[0x5C0]; -} FSClient; - -typedef struct FSCmdBlock -{ - uint32_t __unknown[0x2A0]; -} FSCmdBlock; - -typedef struct FSStat -{ - FSStatFlags flags; - FSMode mode; - uint32_t owner; - uint32_t group; - uint32_t size; - uint32_t __unknown[0x14]; -} FSStat; - -typedef struct FSStateChangeInfo -{ - uint32_t __unknown[0x3]; -} FSStateChangeInfo; - -typedef void(*FSAsyncCallback)(FSClient *, FSCmdBlock *, FSStatus, uint32_t); - -typedef struct FSAsyncData -{ - uint32_t callback; - uint32_t param; - uint32_t __unknown; -} FSAsyncData; - -typedef struct FSDirectoryEntry -{ - FSStat info; - char name[256]; -} FSDirectoryEntry; - -typedef struct FSMountSource -{ - uint32_t __unknown[0xC0]; -} FSMountSource; - -FSStatus fsDevInit(); -FSStatus fsDevExit(); - -void FSInit(); -void FSShutdown(); - -FSStatus FSAddClient(FSClient *client, - uint32_t flags); - -FSStatus FSDelClient(FSClient *client, - uint32_t flags); - -uint32_t FSGetClientNum(); - -void FSInitCmdBlock(FSCmdBlock *block); - -FSStatus FSSetCmdPriority(FSCmdBlock *block, - FSPriority priority); - -void FSSetStateChangeNotification(FSClient *client, - FSStateChangeInfo *info); - -FSStatus FSGetCwd(FSClient *client, FSCmdBlock *block, char *buffer, uint32_t bufferSize, uint32_t flags); -FSStatus FSChangeDir(FSClient *client, FSCmdBlock *block, const char *path, uint32_t flags); -FSStatus FSChangeDirAsync(FSClient *client, FSCmdBlock *block, const char *path, uint32_t flags, FSAsyncData *asyncData); -FSStatus FSGetStat(FSClient *client, FSCmdBlock *block, const char *path, FSStat *stat, uint32_t flags); -FSStatus FSGetStatAsync(FSClient *client, FSCmdBlock *block, const char *path, FSStat *stat, uint32_t flags, FSAsyncData *asyncData); -FSStatus FSRemove(FSClient *client, FSCmdBlock *block, const char *path, uint32_t flags); -FSStatus FSRemoveAsync(FSClient *client, FSCmdBlock *block, const char *path, uint32_t flags, FSAsyncData *asyncData); -FSStatus FSOpenFile(FSClient *client, FSCmdBlock *block, const char *path, const char *mode, FSFileHandle *handle, uint32_t flags); -FSStatus FSOpenFileAsync(FSClient *client, FSCmdBlock *block, const char *path, const char *mode, FSFileHandle *outHandle, uint32_t flags, FSAsyncData *asyncData); - -FSStatus FSCloseFile(FSClient *client, - FSCmdBlock *block, - FSFileHandle handle, - uint32_t flags); - -FSStatus FSCloseFileAsync(FSClient *client, - FSCmdBlock *block, - FSFileHandle handle, - uint32_t flags, - FSAsyncData *asyncData); - -FSStatus FSOpenDir(FSClient *client, - FSCmdBlock *block, - const char *path, - FSDirectoryHandle *handle, - uint32_t flags); - -FSStatus FSOpenDirAsync(FSClient *client, - FSCmdBlock *block, - const char *path, - FSDirectoryHandle *handle, - uint32_t flags, - FSAsyncData *asyncData); - -FSStatus FSMakeDir(FSClient *client, - FSCmdBlock *block, - const char *path, - uint32_t flags); - -FSStatus FSMakeDirAsync(FSClient *client, - FSCmdBlock *block, - const char *path, - uint32_t flags, - FSAsyncData *asyncData); - -FSStatus FSReadDir(FSClient *client, - FSCmdBlock *block, - FSDirectoryHandle handle, - FSDirectoryEntry *entry, - uint32_t flags); - -FSStatus FSReadDirAsync(FSClient *client, - FSCmdBlock *block, - FSDirectoryHandle handle, - FSDirectoryEntry *entry, - uint32_t flags, - FSAsyncData *asyncData); - -FSStatus FSRewindDir(FSClient *client, - FSCmdBlock *block, - FSDirectoryHandle handle, - uint32_t flags); - -FSStatus FSCloseDir(FSClient *client, - FSCmdBlock *block, - FSDirectoryHandle handle, - uint32_t flags); - -FSStatus FSCloseDirAsync(FSClient *client, - FSCmdBlock *block, - FSDirectoryHandle handle, - uint32_t flags, - FSAsyncData *asyncData); -FSStatus FSChangeMode(FSClient *client, - FSCmdBlock *block, - char *path, - FSMode mode, - uint32_t flags); - -FSStatus FSChangeModeAsync(FSClient *client, - FSCmdBlock *block, - char *path, - FSMode mode, - uint32_t flags, - FSAsyncData *asyncData); - -FSStatus FSGetFreeSpaceSize(FSClient *client, - FSCmdBlock *block, - char *path, - u64 *outSize, - uint32_t flags); - -FSStatus FSGetFreeSpaceSizeAsync(FSClient *client, - FSCmdBlock *block, - char *path, - u64 *outSize, - uint32_t flags, - FSAsyncData *asyncData); - -FSStatus FSGetStatFile(FSClient *client, - FSCmdBlock *block, - FSFileHandle handle, - FSStat *stat, - uint32_t flags); - -FSStatus FSGetStatFileAsync(FSClient *client, - FSCmdBlock *block, - FSFileHandle handle, - FSStat *stat, - uint32_t flags, - FSAsyncData *asyncData); - -FSStatus FSReadFile(FSClient *client, - FSCmdBlock *block, - uint8_t *buffer, - uint32_t size, - uint32_t count, - FSFileHandle handle, - uint32_t unk1, - uint32_t flags); - -FSStatus FSReadFileAsync(FSClient *client, - FSCmdBlock *block, - uint8_t *buffer, - uint32_t size, - uint32_t count, - FSFileHandle handle, - uint32_t unk1, - uint32_t flags, - FSAsyncData *asyncData); - -FSStatus FSReadFileWithPos(FSClient *client, - FSCmdBlock *block, - uint8_t *buffer, - uint32_t size, - uint32_t count, - uint32_t pos, - FSFileHandle handle, - uint32_t unk1, - uint32_t flags); - -FSStatus FSReadFileWithPosAsync(FSClient *client, - FSCmdBlock *block, - uint8_t *buffer, - uint32_t size, - uint32_t count, - uint32_t pos, - FSFileHandle handle, - uint32_t unk1, - uint32_t flags, - FSAsyncData *asyncData); - -FSStatus FSWriteFile(FSClient *client, - FSCmdBlock *block, - uint8_t *buffer, - uint32_t size, - uint32_t count, - FSFileHandle handle, - uint32_t unk1, - uint32_t flags); - -FSStatus FSWriteFileAsync(FSClient *client, - FSCmdBlock *block, - uint8_t *buffer, - uint32_t size, - uint32_t count, - FSFileHandle handle, - uint32_t unk1, - uint32_t flags, - FSAsyncData *asyncData); - -FSStatus FSWriteFileWithPos(FSClient *client, - FSCmdBlock *block, - uint8_t *buffer, - uint32_t size, - uint32_t count, - uint32_t pos, - FSFileHandle handle, - uint32_t unk1, - uint32_t flags); - -FSStatus FSWriteFileWithPosAsync(FSClient *client, - FSCmdBlock *block, - uint8_t *buffer, - uint32_t size, - uint32_t count, - uint32_t pos, - FSFileHandle handle, - uint32_t unk1, - uint32_t flags, - FSAsyncData *asyncData); - -FSStatus FSGetPosFile(FSClient *client, - FSCmdBlock *block, - FSFileHandle fileHandle, - uint32_t *pos, - uint32_t flags); - -FSStatus FSGetPosFileAsync(FSClient *client, - FSCmdBlock *block, - FSFileHandle fileHandle, - uint32_t *pos, - uint32_t flags, - FSAsyncData *asyncData); - -FSStatus FSSetPosFile(FSClient *client, - FSCmdBlock *block, - FSFileHandle handle, - uint32_t pos, - uint32_t flags); - -FSStatus FSSetPosFileAsync(FSClient *client, - FSCmdBlock *block, - FSFileHandle handle, - uint32_t pos, - uint32_t flags, - FSAsyncData *asyncData); - -FSStatus FSFlushFile(FSClient *client, - FSCmdBlock *block, - FSFileHandle handle, - uint32_t flags); - -FSStatus FSFlushFileAsync(FSClient *client, - FSCmdBlock *block, - FSFileHandle handle, - uint32_t flags, - FSAsyncData *asyncData); - -FSStatus FSTruncateFile(FSClient *client, - FSCmdBlock *block, - FSFileHandle handle, - uint32_t flags); - -FSStatus FSTruncateFileAsync(FSClient *client, - FSCmdBlock *block, - FSFileHandle handle, - uint32_t flags, - FSAsyncData *asyncData); - -FSStatus FSRename(FSClient *client, - FSCmdBlock *block, - const char *oldPath, - const char *newPath, - uint32_t flags); - -FSStatus FSRenameAsync(FSClient *client, - FSCmdBlock *block, - const char *oldPath, - const char *newPath, - uint32_t flags, - FSAsyncData *asyncData); - -FSVolumeState FSGetVolumeState(FSClient *client); - -FSError FSGetLastErrorCodeForViewer(FSClient *client); - -FSStatus FSGetMountSource(FSClient *client, - FSCmdBlock *cmd, - FSMountSourceType type, - FSMountSource *out, - uint32_t flags); - -FSStatus FSMount(FSClient *client, - FSCmdBlock *cmd, - FSMountSource *source, - const char *target, - uint32_t bytes, - uint32_t flags); - -FSStatus FSUnmount(FSClient *client, - FSCmdBlock *cmd, - const char *target, - uint32_t flags); - -FSStatus FSBindMount(FSClient *client, - FSCmdBlock *cmd, - const char *source, - const char *target, - uint32_t flags); - -FSStatus FSbindUnmount(FSClient *client, - FSCmdBlock *cmd, - const char *target, - uint32_t flags); - -#ifdef __cplusplus -} -#endif diff --git a/wiiu/wut/include/coreinit/internal.h b/wiiu/wut/include/coreinit/internal.h deleted file mode 100644 index 57b3d76d06..0000000000 --- a/wiiu/wut/include/coreinit/internal.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once -#include - -#ifdef __cplusplus -extern "C" { -#endif - -int __os_snprintf(char *buf, size_t n, const char *format, ... ); - -#ifdef __cplusplus -} -#endif diff --git a/wiiu/wut/include/coreinit/mcp.h b/wiiu/wut/include/coreinit/mcp.h deleted file mode 100644 index 1e01408a8d..0000000000 --- a/wiiu/wut/include/coreinit/mcp.h +++ /dev/null @@ -1,111 +0,0 @@ -#pragma once -#include - -/** - * \defgroup coreinit_mcp MCP IOS Calls - * \ingroup coreinit - * @{ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum MCPInstallTarget -{ - MCP_INSTALL_TARGET_MLC = 0, - MCP_INSTALL_TARGET_USB = 1, -} MCPInstallTarget; - -struct __attribute__((__packed__)) MCPInstallProgress -{ - uint32_t inProgress; - uint64_t tid; - uint64_t sizeTotal; - uint64_t sizeProgress; - uint32_t contentsTotal; - uint32_t contentsProgress; -}; - -typedef struct MCPInstallInfo -{ - UNKNOWN(0x27F); -}MCPInstallInfo; - -CHECK_SIZE(MCPInstallInfo, 0x27F); - -struct MCPInstallTitleInfo -{ - UNKNOWN(0x27F); -}; -CHECK_SIZE(MCPInstallTitleInfo, 0x27F); - -struct MCPDevice -{ - char name[0x31B]; -}; -CHECK_SIZE(MCPDevice, 0x31B); - -struct MCPDeviceList -{ - MCPDevice devices[32]; -}; -CHECK_SIZE(MCPDeviceList, 0x31B*32); - -int -MCP_Open(); - -int -MCP_Close(int handle); - -int -MCP_InstallSetTargetDevice(int handle, - MCPInstallTarget device); - -int -MCP_InstallGetTargetDevice(int handle, - MCPInstallTarget *deviceOut); - -int -MCP_InstallSetTargetUsb(int handle, - int usb); - -int -MCP_InstallGetInfo(int handle, - char *path, - MCPInstallInfo *out); - -int -MCP_InstallTitleAsync(int handle, - char *path, - MCPInstallTitleInfo *out); - -int -MCP_InstallGetProgress(int handle, - MCPInstallProgress *installProgressOut); - -int -MCP_InstallTitleAbort(int handle); - -int -MCP_UninstallTitleAsync(int handle, - char *path, - MCPInstallTitleInfo *out); - -int -MCP_DeviceList(int handle, - int *numDevices, - MCPDeviceList *outDevices, - uint32_t outBufferSize); - -int -MCP_FullDeviceList(int handle, - int *numDevices, - MCPDeviceList *outDevices, - uint32_t outBufferSize); - -#ifdef __cplusplus -} -#endif - -/** @} */ diff --git a/wiiu/wut/include/coreinit/mutex.h b/wiiu/wut/include/coreinit/mutex.h deleted file mode 100644 index 4817de35fa..0000000000 --- a/wiiu/wut/include/coreinit/mutex.h +++ /dev/null @@ -1,110 +0,0 @@ -#pragma once -#include -#include "threadqueue.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OSThread OSThread; - -typedef struct OSMutex OSMutex; -typedef struct OSMutexLink -{ - OSMutex *next; - OSMutex *prev; -}OSMutexLink; - -#define OS_MUTEX_TAG 0x6D557458u - -typedef struct OSMutex -{ - //! Should always be set to the value OS_MUTEX_TAG. - uint32_t tag; - - //! Name set by OSInitMutexEx. - const char *name; - - uint32_t __unknown; - - //! Queue of threads waiting for this mutex to unlock. - OSThreadQueue queue; - - //! Current owner of mutex. - OSThread *owner; - - //! Current recursion lock count of mutex. - int32_t count; - - //! Link used inside OSThread's mutex queue. - OSMutexLink link; -}OSMutex; - - -/** - * Initialise a mutex structure. - */ -void -OSInitMutex(OSMutex *mutex); - - -/** - * Initialise a mutex structure with a name. - */ -void -OSInitMutexEx(OSMutex *mutex, - const char *name); - - -/** - * Lock the mutex. - * - * If no one owns the mutex, set current thread as owner. - * - * If the lock is owned by the current thread, increase the recursion count. - * - * If the lock is owned by another thread, the current thread will sleep until - * the owner has unlocked this mutex. - * - * Similar to std::recursive_mutex::lock. - */ -void -OSLockMutex(OSMutex *mutex); - - -/** - * Try to lock a mutex. - * - * If no one owns the mutex, set current thread as owner. - * - * If the lock is owned by the current thread, increase the recursion count. - * - * If the lock is owned by another thread, do not block, return FALSE. - * - * \return TRUE if the mutex is locked, FALSE if the mutex is owned by another thread. - * - * Similar to std::recursive_mutex::try_lock. - */ -BOOL -OSTryLockMutex(OSMutex *mutex); - - -/** - * Unlocks the mutex. - * - * Will decrease the recursion count, will only unlock the mutex when the - * recursion count reaches 0. - * - * If any other threads are waiting to lock the mutex they will be woken. - * - * Similar to std::recursive_mutex::unlock. - */ -void -OSUnlockMutex(OSMutex *mutex); - - -#ifdef __cplusplus -} -#endif - -/** @} */ diff --git a/wiiu/wut/include/coreinit/screen.h b/wiiu/wut/include/coreinit/screen.h deleted file mode 100644 index a2ef936c3f..0000000000 --- a/wiiu/wut/include/coreinit/screen.h +++ /dev/null @@ -1,57 +0,0 @@ -#pragma once -#include - -/** - * \defgroup coreinit_screen Screen - * \ingroup coreinit - * @{ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum OSScreenID -{ - SCREEN_TV = 0, - SCREEN_DRC = 1, -} OSScreenID; - -void -OSScreenInit(); - -uint32_t -OSScreenGetBufferSizeEx(OSScreenID screen); - -void -OSScreenSetBufferEx(OSScreenID screen, - void *addr); - -void -OSScreenClearBufferEx(OSScreenID screen, - uint32_t colour); - -void -OSScreenFlipBuffersEx(OSScreenID screen); - -void -OSScreenPutFontEx(OSScreenID screen, - uint32_t row, - uint32_t column, - const char *buffer); - -void -OSScreenPutPixelEx(OSScreenID screen, - uint32_t x, - uint32_t y, - uint32_t colour); - -void -OSScreenEnableEx(OSScreenID screen, - BOOL enable); - -#ifdef __cplusplus -} -#endif - -/** @} */ diff --git a/wiiu/wut/include/coreinit/semaphore.h b/wiiu/wut/include/coreinit/semaphore.h deleted file mode 100644 index 0587e95c3d..0000000000 --- a/wiiu/wut/include/coreinit/semaphore.h +++ /dev/null @@ -1,104 +0,0 @@ -#pragma once -#include -#include "threadqueue.h" - -/** - * \defgroup coreinit_semaphore Semaphore - * \ingroup coreinit - * - * Similar to Windows Semaphore Objects. - * @{ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OSSemaphore OSSemaphore; - -#define OS_SEMAPHORE_TAG 0x73506852u - -struct OSSemaphore -{ - //! Should always be set to the value OS_SEMAPHORE_TAG. - uint32_t tag; - - //! Name set by OSInitMutexEx. - const char *name; - - uint32_t __unknown; - - //! Current count of semaphore - int32_t count; - - //! Queue of threads waiting on semaphore object with OSWaitSemaphore - OSThreadQueue queue; -}; -CHECK_OFFSET(OSSemaphore, 0x00, tag); -CHECK_OFFSET(OSSemaphore, 0x04, name); -CHECK_OFFSET(OSSemaphore, 0x0C, count); -CHECK_OFFSET(OSSemaphore, 0x10, queue); -CHECK_SIZE(OSSemaphore, 0x20); - - -/** - * Initialise semaphore object with count. - */ -void -OSInitSemaphore(OSSemaphore *semaphore, - int32_t count); - - -/** - * Initialise semaphore object with count and name. - */ -void -OSInitSemaphoreEx(OSSemaphore *semaphore, - int32_t count, - const char *name); - - -/** - * Get the current semaphore count. - */ -int32_t -OSGetSemaphoreCount(OSSemaphore *semaphore); - - -/** - * Increase the semaphore value. - * - * If any threads are waiting for semaphore, they are woken. - */ -int32_t -OSSignalSemaphore(OSSemaphore *semaphore); - - -/** - * Decrease the semaphore value. - * - * If the value is less than or equal to zero the current thread will be put to - * sleep until the count is above zero and it can decrement it safely. - */ -int32_t -OSWaitSemaphore(OSSemaphore *semaphore); - - -/** - * Try to decrease the semaphore value. - * - * If the value is greater than zero then it will be decremented, else the function - * will return immediately with a value <= 0 indicating a failure. - * - * \return Returns previous semaphore count, before the decrement in this function. - * If the value is >0 then it means the call was succesful. - */ -int32_t -OSTryWaitSemaphore(OSSemaphore *semaphore); - - -#ifdef __cplusplus -} -#endif - -/** @} */ diff --git a/wiiu/wut/include/coreinit/spinlock.h b/wiiu/wut/include/coreinit/spinlock.h deleted file mode 100644 index 440c815caf..0000000000 --- a/wiiu/wut/include/coreinit/spinlock.h +++ /dev/null @@ -1,61 +0,0 @@ -#pragma once -#include -#include "time.h" - -/** - * \defgroup coreinit_spinlock Spinlock - * \ingroup coreinit - * @{ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OSSpinLock OSSpinLock; - -struct OSSpinLock -{ - uint32_t owner; - UNKNOWN(0x4); - uint32_t recursion; - UNKNOWN(0x4); -}; -CHECK_OFFSET(OSSpinLock, 0x0, owner); -CHECK_OFFSET(OSSpinLock, 0x8, recursion); -CHECK_SIZE(OSSpinLock, 0x10); - -void -OSInitSpinLock(OSSpinLock *spinlock); - -BOOL -OSAcquireSpinLock(OSSpinLock *spinlock); - -BOOL -OSTryAcquireSpinLock(OSSpinLock *spinlock); - -BOOL -OSTryAcquireSpinLockWithTimeout(OSSpinLock *spinlock, - OSTime timeout); - -BOOL -OSReleaseSpinLock(OSSpinLock *spinlock); - -BOOL -OSUninterruptibleSpinLock_Acquire(OSSpinLock *spinlock); - -BOOL -OSUninterruptibleSpinLock_TryAcquire(OSSpinLock *spinlock); - -BOOL -OSUninterruptibleSpinLock_TryAcquireWithTimeout(OSSpinLock *spinlock, - OSTime timeout); - -BOOL -OSUninterruptibleSpinLock_Release(OSSpinLock *spinlock); - -#ifdef __cplusplus -} -#endif - -/** @} */ diff --git a/wiiu/wut/include/coreinit/systeminfo.h b/wiiu/wut/include/coreinit/systeminfo.h deleted file mode 100644 index 00c7ab9e79..0000000000 --- a/wiiu/wut/include/coreinit/systeminfo.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once -#include -#include "time.h" - -/** - * \defgroup coreinit_systeminfo System Info - * \ingroup coreinit - * @{ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OSSystemInfo OSSystemInfo; - -struct OSSystemInfo -{ - uint32_t clockSpeed; - UNKNOWN(0x4); - OSTime baseTime; - UNKNOWN(0x10); -}; -CHECK_OFFSET(OSSystemInfo, 0x0, clockSpeed); -CHECK_OFFSET(OSSystemInfo, 0x8, baseTime); -CHECK_SIZE(OSSystemInfo, 0x20); - -OSSystemInfo * -OSGetSystemInfo(); - -#ifdef __cplusplus -} -#endif - -/** @} */ diff --git a/wiiu/wut/include/coreinit/taskqueue.h b/wiiu/wut/include/coreinit/taskqueue.h deleted file mode 100644 index a0baa1dfac..0000000000 --- a/wiiu/wut/include/coreinit/taskqueue.h +++ /dev/null @@ -1,206 +0,0 @@ -#pragma once -#include -#include "time.h" - -/** - * \defgroup coreinit_taskq Task Queue - * \ingroup coreinit - * @{ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct MPTask MPTask; -typedef struct MPTaskInfo MPTaskInfo; -typedef struct MPTaskQueue MPTaskQueue; -typedef struct MPTaskQueueInfo MPTaskQueueInfo; - -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, -} 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; - uint32_t result; - 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; - MPTaskQueue *queue; - MPTaskState state; - MPTaskFunc func; - uint32_t userArg1; - uint32_t userArg2; - uint32_t result; - uint32_t coreID; - OSTime duration; - void *userData; -}; -#pragma pack(pop) -CHECK_OFFSET(MPTask, 0x00, self); -CHECK_OFFSET(MPTask, 0x04, queue); -CHECK_OFFSET(MPTask, 0x08, state); -CHECK_OFFSET(MPTask, 0x0C, func); -CHECK_OFFSET(MPTask, 0x10, userArg1); -CHECK_OFFSET(MPTask, 0x14, userArg2); -CHECK_OFFSET(MPTask, 0x18, result); -CHECK_OFFSET(MPTask, 0x1C, coreID); -CHECK_OFFSET(MPTask, 0x20, duration); -CHECK_OFFSET(MPTask, 0x28, userData); -CHECK_SIZE(MPTask, 0x2C); - -struct MPTaskQueueInfo -{ - MPTaskQueueState state; - uint32_t tasks; - uint32_t tasksReady; - uint32_t tasksRunning; - uint32_t tasksFinished; -}; -CHECK_OFFSET(MPTaskQueueInfo, 0x00, state); -CHECK_OFFSET(MPTaskQueueInfo, 0x04, tasks); -CHECK_OFFSET(MPTaskQueueInfo, 0x08, tasksReady); -CHECK_OFFSET(MPTaskQueueInfo, 0x0C, tasksRunning); -CHECK_OFFSET(MPTaskQueueInfo, 0x10, tasksFinished); -CHECK_SIZE(MPTaskQueueInfo, 0x14); - -struct MPTaskQueue -{ - MPTaskQueue *self; - MPTaskQueueState state; - uint32_t tasks; - uint32_t tasksReady; - uint32_t tasksRunning; - uint32_t __unknown0; - uint32_t tasksFinished; - uint32_t __unknown1; - uint32_t __unknown2; - uint32_t queueIndex; - uint32_t __unknown3; - uint32_t __unknown4; - uint32_t queueSize; - uint32_t __unknown5; - MPTask **queue; - uint32_t queueMaxSize; - OSSpinLock lock; -}; -CHECK_OFFSET(MPTaskQueue, 0x00, self); -CHECK_OFFSET(MPTaskQueue, 0x04, state); -CHECK_OFFSET(MPTaskQueue, 0x08, tasks); -CHECK_OFFSET(MPTaskQueue, 0x0C, tasksReady); -CHECK_OFFSET(MPTaskQueue, 0x10, tasksRunning); -CHECK_OFFSET(MPTaskQueue, 0x18, tasksFinished); -CHECK_OFFSET(MPTaskQueue, 0x24, queueIndex); -CHECK_OFFSET(MPTaskQueue, 0x30, queueSize); -CHECK_OFFSET(MPTaskQueue, 0x38, queue); -CHECK_OFFSET(MPTaskQueue, 0x3C, queueMaxSize); -CHECK_OFFSET(MPTaskQueue, 0x40, lock); -CHECK_SIZE(MPTaskQueue, 0x50); - -void -MPInitTaskQ(MPTaskQueue *queue, - MPTask **queueBuffer, - uint32_t queueBufferLen); - -BOOL -MPTermTaskQ(MPTaskQueue *queue); - -BOOL -MPGetTaskQInfo(MPTaskQueue *queue, - MPTaskQueueInfo *info); - -BOOL -MPStartTaskQ(MPTaskQueue *queue); - -BOOL -MPStopTaskQ(MPTaskQueue *queue); - -BOOL -MPResetTaskQ(MPTaskQueue *queue); - -BOOL -MPEnqueTask(MPTaskQueue *queue, - MPTask *task); - -MPTask * -MPDequeTask(MPTaskQueue *queue); - -uint32_t -MPDequeTasks(MPTaskQueue *queue, - MPTask **queueBuffer, - uint32_t queueBufferLen); - -BOOL -MPWaitTaskQ(MPTaskQueue *queue, - MPTaskQueueState mask); - -BOOL -MPWaitTaskQWithTimeout(MPTaskQueue *queue, - MPTaskQueueState wmask, - OSTime timeout); - -BOOL -MPPrintTaskQStats(MPTaskQueue *queue, - uint32_t unk); - -void -MPInitTask(MPTask *task, - MPTaskFunc func, - uint32_t userArg1, - uint32_t userArg2); - -BOOL -MPTermTask(MPTask* task); - -BOOL -MPGetTaskInfo(MPTask *task, - MPTaskInfo *info); - -void * -MPGetTaskUserData(MPTask *task); - -void -MPSetTaskUserData(MPTask *task, - void *userData); - -BOOL -MPRunTasksFromTaskQ(MPTaskQueue *queue, - uint32_t count); - -BOOL -MPRunTask(MPTask *task); - -#ifdef __cplusplus -} -#endif - -/** @} */ diff --git a/wiiu/wut/include/coreinit/thread.h b/wiiu/wut/include/coreinit/thread.h deleted file mode 100644 index ffc03e5459..0000000000 --- a/wiiu/wut/include/coreinit/thread.h +++ /dev/null @@ -1,555 +0,0 @@ -#pragma once -#include -#include "time.h" -#include "threadqueue.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef int (*OSThreadEntryPointFn)(int argc, const char **argv); -typedef void (*OSThreadCleanupCallbackFn)(OSThread *thread, void *stack); -typedef void (*OSThreadDeallocatorFn)(OSThread *thread, void *stack); - -enum OS_THREAD_STATE -{ - OS_THREAD_STATE_NONE = 0, - - //! Thread is ready to run - OS_THREAD_STATE_READY = 1 << 0, - - //! Thread is running - OS_THREAD_STATE_RUNNING = 1 << 1, - - //! Thread is waiting, i.e. on a mutex - OS_THREAD_STATE_WAITING = 1 << 2, - - //! Thread is about to terminate - OS_THREAD_STATE_MORIBUND = 1 << 3, -}; -typedef uint8_t OSThreadState; - -enum OS_THREAD_REQUEST -{ - OS_THREAD_REQUEST_NONE = 0, - OS_THREAD_REQUEST_SUSPEND = 1, - OS_THREAD_REQUEST_CANCEL = 2, -}; -typedef uint32_t OSThreadRequest; - -enum OS_THREAD_ATTRIB -{ - //! Allow the thread to run on CPU0. - OS_THREAD_ATTRIB_AFFINITY_CPU0 = 1 << 0, - - //! Allow the thread to run on CPU1. - OS_THREAD_ATTRIB_AFFINITY_CPU1 = 1 << 1, - - //! Allow the thread to run on CPU2. - OS_THREAD_ATTRIB_AFFINITY_CPU2 = 1 << 2, - - //! Allow the thread to run any CPU. - OS_THREAD_ATTRIB_AFFINITY_ANY = ((1 << 0) | (1 << 1) | (1 << 2)), - - //! Start the thread detached. - OS_THREAD_ATTRIB_DETACHED = 1 << 3, - - //! Enables tracking of stack usage. - OS_THREAD_ATTRIB_STACK_USAGE = 1 << 5 -}; -typedef uint8_t OSThreadAttributes; - -#define OS_CONTEXT_TAG 0x4F53436F6E747874ull - -typedef struct OSContext -{ - //! Should always be set to the value OS_CONTEXT_TAG. - uint64_t tag; - - uint32_t gpr[32]; - uint32_t cr; - uint32_t lr; - uint32_t ctr; - uint32_t xer; - uint32_t srr0; - uint32_t srr1; - UNKNOWN(0x14); - uint32_t fpscr; - double fpr[32]; - uint16_t spinLockCount; - uint16_t state; - uint32_t gqr[8]; - uint32_t __unknown0; - double psf[32]; - uint64_t coretime[3]; - uint64_t starttime; - uint32_t error; - uint32_t __unknown1; - uint32_t pmc1; - uint32_t pmc2; - uint32_t pmc3; - uint32_t pmc4; - uint32_t mmcr0; - uint32_t mmcr1; -}OSContext; - -typedef struct OSMutex OSMutex; -typedef struct OSFastMutex OSFastMutex; - -typedef struct OSMutexQueue -{ - OSMutex *head; - OSMutex *tail; - void *parent; - uint32_t __unknown; -}OSMutexQueue; - -typedef struct OSFastMutexQueue -{ - OSFastMutex *head; - OSFastMutex *tail; -}OSFastMutexQueue; - -#define OS_THREAD_TAG 0x74487244u -#pragma pack(push, 1) -typedef struct OSThread -{ - OSContext context; - - //! Should always be set to the value OS_THREAD_TAG. - uint32_t tag; - - //! Bitfield of OS_THREAD_STATE - OSThreadState state; - - //! Bitfield of OS_THREAD_ATTRIB - OSThreadAttributes attr; - - //! Unique thread ID - uint16_t id; - - //! Suspend count (increased by OSSuspendThread). - int32_t suspendCounter; - - //! Actual priority of thread. - int32_t priority; - - //! Base priority of thread, 0 is highest priority, 31 is lowest priority. - int32_t basePriority; - - //! Exit value - int32_t exitValue; - - uint32_t unknown0[0x9]; - - //! Queue the thread is currently waiting on - OSThreadQueue *queue; - - //! Link used for thread queue - OSThreadLink link; - - //! Queue of threads waiting to join this thread - OSThreadQueue joinQueue; - - //! Mutex this thread is waiting to lock - OSMutex *mutex; - - //! Queue of mutexes this thread owns - OSMutexQueue mutexQueue; - - //! Link for global active thread queue - OSThreadLink activeLink; - - //! Stack start (top, highest address) - void *stackStart; - - //! Stack end (bottom, lowest address) - void *stackEnd; - - //! Thread entry point - OSThreadEntryPointFn entryPoint; - - uint32_t unknown1[0x77]; - - //! Thread specific values, accessed with OSSetThreadSpecific and OSGetThreadSpecific. - uint32_t specific[0x10]; - - uint32_t unknown2; - - //! Thread name, accessed with OSSetThreadName and OSGetThreadName. - const char *name; - - uint32_t unknown3; - - //! The stack pointer passed in OSCreateThread. - void *userStackPointer; - - //! Called just before thread is terminated, set with OSSetThreadCleanupCallback - OSThreadCleanupCallbackFn cleanupCallback; - - //! Called just after a thread is terminated, set with OSSetThreadDeallocator - OSThreadDeallocatorFn deallocator; - - //! If TRUE then a thread can be cancelled or suspended, set with OSSetThreadCancelState - BOOL cancelState; - - //! Current thread request, used for cancelleing and suspending the thread. - OSThreadRequest requestFlag; - - //! Pending suspend request count - int32_t needSuspend; - - //! Result of thread suspend - int32_t suspendResult; - - //! Queue of threads waiting for a thread to be suspended. - OSThreadQueue suspendQueue; - - uint32_t unknown4[0x2A]; -}OSThread; -#pragma pack(pop) - -CHECK_OFFSET(OSThread, 0x320, tag); -CHECK_OFFSET(OSThread, 0x324, state); -CHECK_OFFSET(OSThread, 0x325, attr); -CHECK_OFFSET(OSThread, 0x326, id); -CHECK_OFFSET(OSThread, 0x328, suspendCounter); -CHECK_OFFSET(OSThread, 0x32c, priority); -CHECK_OFFSET(OSThread, 0x330, basePriority); -CHECK_OFFSET(OSThread, 0x334, exitValue); -CHECK_OFFSET(OSThread, 0x35c, queue); -CHECK_OFFSET(OSThread, 0x360, link); -CHECK_OFFSET(OSThread, 0x368, joinQueue); -CHECK_OFFSET(OSThread, 0x378, mutex); -CHECK_OFFSET(OSThread, 0x37c, mutexQueue); -CHECK_OFFSET(OSThread, 0x38c, activeLink); -CHECK_OFFSET(OSThread, 0x394, stackStart); -CHECK_OFFSET(OSThread, 0x398, stackEnd); -CHECK_OFFSET(OSThread, 0x39c, entryPoint); -CHECK_OFFSET(OSThread, 0x57c, specific); -CHECK_OFFSET(OSThread, 0x5c0, name); -CHECK_OFFSET(OSThread, 0x5c8, userStackPointer); -CHECK_OFFSET(OSThread, 0x5cc, cleanupCallback); -CHECK_OFFSET(OSThread, 0x5d0, deallocator); -CHECK_OFFSET(OSThread, 0x5d4, cancelState); -CHECK_OFFSET(OSThread, 0x5d8, requestFlag); -CHECK_OFFSET(OSThread, 0x5dc, needSuspend); -CHECK_OFFSET(OSThread, 0x5e0, suspendResult); -CHECK_OFFSET(OSThread, 0x5e4, suspendQueue); -CHECK_SIZE(OSThread, 0x69c); - -/** - * Cancels a thread. - * - * This sets the threads requestFlag to OS_THREAD_REQUEST_CANCEL, the thread will - * be terminated next time OSTestThreadCancel is called. - */ -void -OSCancelThread(OSThread *thread); - - -/** - * Returns the count of active threads. - */ -int32_t OSCheckActiveThreads(); - - -/** - * Get the maximum amount of stack the thread has used. - */ -int32_t OSCheckThreadStackUsage(OSThread *thread); - - -/** - * Disable tracking of thread stack usage - */ -void OSClearThreadStackUsage(OSThread *thread); - - -/** - * Clears a thread's suspend counter and resumes it. - */ -void OSContinueThread(OSThread *thread); - - -/** - * Create a new thread. - * - * \param thread Thread to initialise. - * \param entry Thread entry point. - * \param argc argc argument passed to entry point. - * \param argv argv argument passed to entry point. - * \param stack Top of stack (highest address). - * \param stackSize Size of stack. - * \param priority Thread priority, 0 is highest priorty, 31 is lowest. - * \param attributes Thread attributes, see OSThreadAttributes. - */ -BOOL OSCreateThread(OSThread *thread, - OSThreadEntryPointFn entry, - int32_t argc, - char *argv, - void *stack, - uint32_t stackSize, - int32_t priority, - OSThreadAttributes attributes); - - -/** - * Detach thread. - */ -void OSDetachThread(OSThread *thread); - - -/** - * Exit the current thread with a exit code. - * - * This function is implicitly called when the thread entry point returns. - */ -void OSExitThread(int32_t result); - - -/** - * Get the next and previous thread in the thread's active queue. - */ -void OSGetActiveThreadLink(OSThread *thread, - OSThreadLink *link); - - -/** - * Return pointer to OSThread object for the current thread. - */ -OSThread *OSGetCurrentThread(); - - -/** - * Returns the default thread for a specific core. - * - * Each core has 1 default thread created before the game boots. The default - * thread for core 1 calls the RPX entry point, the default threads for core 0 - * and 2 are suspended and can be used with OSRunThread. - */ -OSThread *OSGetDefaultThread(uint32_t coreID); - - -/** - * Return current stack pointer, value of r1 register. - */ -uint32_t OSGetStackPointer(); - - -/** - * Get a thread's affinity. - */ -uint32_t OSGetThreadAffinity(OSThread *thread); - - -/** - * Get a thread's name. - */ -const char *OSGetThreadName(OSThread *thread); - - -/** - * Get a thread's base priority. - */ -int32_t -OSGetThreadPriority(OSThread *thread); - - -/** - * Get a thread's specific value set by OSSetThreadSpecific. - */ -uint32_t OSGetThreadSpecific(uint32_t id); - - -/** - * Returns TRUE if a thread is suspended. - */ -BOOL OSIsThreadSuspended(OSThread *thread); - - -/** - * Returns TRUE if a thread is terminated. - */ -BOOL OSIsThreadTerminated(OSThread *thread); - - -/** - * Wait until thread is terminated. - * - * If the target thread is detached, returns FALSE. - * - * \param thread Thread to wait for - * \param threadResult Pointer to store thread exit value in. - * \returns Returns TRUE if thread has terminated, FALSE if thread is detached. - */ -BOOL OSJoinThread(OSThread *thread, - int *threadResult); - - -/** - * Resumes a thread. - * - * Decrements the thread's suspend counter, if the counter reaches 0 the thread - * is resumed. - * - * \returns Returns the previous value of the suspend counter. - */ -int32_t OSResumeThread(OSThread *thread); - - -/** - * Run a function on an already created thread. - * - * Can only be used on idle threads. - */ -BOOL OSRunThread(OSThread *thread, - OSThreadEntryPointFn entry, - int argc, - const char **argv); - - -/** - * Set a thread's affinity. - */ -BOOL -OSSetThreadAffinity(OSThread *thread, - uint32_t affinity); - - -/** - * Set a thread's cancellation state. - * - * If the state is TRUE then the thread can be suspended or cancelled when - * OSTestThreadCancel is called. - */ -BOOL -OSSetThreadCancelState(BOOL state); - - -/** - * Set the callback to be called just before a thread is terminated. - */ -OSThreadCleanupCallbackFn -OSSetThreadCleanupCallback(OSThread *thread, - OSThreadCleanupCallbackFn callback); - - -/** - * Set the callback to be called just after a thread is terminated. - */ -OSThreadDeallocatorFn -OSSetThreadDeallocator(OSThread *thread, - OSThreadDeallocatorFn deallocator); - - -/** - * Set a thread's name. - */ -void -OSSetThreadName(OSThread *thread, - const char *name); - - -/** - * Set a thread's priority. - */ -BOOL -OSSetThreadPriority(OSThread *thread, - int32_t priority); - - -/** - * Set a thread's run quantum. - * - * This is the maximum amount of time the thread can run for before being forced - * to yield. - */ -BOOL -OSSetThreadRunQuantum(OSThread *thread, - uint32_t quantum); - -/** - * Set a thread specific value. - * - * Can be read with OSGetThreadSpecific. - */ -void -OSSetThreadSpecific(uint32_t id, - uint32_t value); - - -/** - * Set thread stack usage tracking. - */ -BOOL -OSSetThreadStackUsage(OSThread *thread); - - -/** - * Sleep the current thread and add it to a thread queue. - * - * Will sleep until the thread queue is woken with OSWakeupThread. - */ -void -OSSleepThread(OSThreadQueue *queue); - - -/** - * Sleep the current thread for a period of time. - */ -void -OSSleepTicks(OSTime ticks); - - -/** - * Suspend a thread. - * - * Increases a thread's suspend counter, if the counter is >0 then the thread is - * suspended. - * - * \returns Returns the thread's previous suspend counter value - */ -uint32_t -OSSuspendThread(OSThread *thread); - - -/** - * Check to see if the current thread should be cancelled or suspended. - * - * This is implicitly called in: - * - OSLockMutex - * - OSTryLockMutex - * - OSUnlockMutex - * - OSAcquireSpinLock - * - OSTryAcquireSpinLock - * - OSTryAcquireSpinLockWithTimeout - * - OSReleaseSpinLock - * - OSCancelThread - */ -void -OSTestThreadCancel(); - - -/** - * Wake up all threads in queue. - * - * Clears the thread queue. - */ -void -OSWakeupThread(OSThreadQueue *queue); - - -/** - * Yield execution to waiting threads with same priority. - * - * This will never switch to a thread with a lower priority than the current - * thread. - */ -void -OSYieldThread(); - - -#ifdef __cplusplus -} -#endif diff --git a/wiiu/wut/include/coreinit/threadqueue.h b/wiiu/wut/include/coreinit/threadqueue.h deleted file mode 100644 index 33fa8cb006..0000000000 --- a/wiiu/wut/include/coreinit/threadqueue.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OSThread OSThread; - -typedef struct -{ - OSThread *prev; - OSThread *next; -}OSThreadLink; - -typedef struct -{ - OSThread *head; - OSThread *tail; - void *parent; - uint32_t __unknown; -}OSThreadQueue; - -typedef struct -{ - OSThread *head; - OSThread *tail; -}OSThreadSimpleQueue; - -void OSInitThreadQueue(OSThreadQueue *queue); -void OSInitThreadQueueEx(OSThreadQueue *queue, void *parent); - -#ifdef __cplusplus -} -#endif diff --git a/wiiu/wut/include/coreinit/time.h b/wiiu/wut/include/coreinit/time.h deleted file mode 100644 index aed728d378..0000000000 --- a/wiiu/wut/include/coreinit/time.h +++ /dev/null @@ -1,64 +0,0 @@ -#pragma once -#include - -/** - * \defgroup coreinit_time Time - * \ingroup coreinit - * @{ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OSCalendarTime OSCalendarTime; - -typedef int32_t OSTick; -typedef int64_t OSTime; - -struct OSCalendarTime -{ - int32_t tm_sec; - int32_t tm_min; - int32_t tm_hour; - int32_t tm_mday; - int32_t tm_mon; - int32_t tm_year; -}; -CHECK_OFFSET(OSCalendarTime, 0x00, tm_sec); -CHECK_OFFSET(OSCalendarTime, 0x04, tm_min); -CHECK_OFFSET(OSCalendarTime, 0x08, tm_hour); -CHECK_OFFSET(OSCalendarTime, 0x0C, tm_mday); -CHECK_OFFSET(OSCalendarTime, 0x10, tm_mon); -CHECK_OFFSET(OSCalendarTime, 0x14, tm_year); -CHECK_SIZE(OSCalendarTime, 0x18); - -#define OSOneSecond ((OSGetSystemInfo()->clockSpeed) / 4) -#define OSMilliseconds(val) ((((uint64_t)(val)) * (uint64_t)(OSOneSecond)) / 1000ull) -#define OSMicroseconds(val) ((((uint64_t)(val)) * (uint64_t)(OSOneSecond)) / 1000000ull) -#define OSNanoseconds(val) ((((uint64_t)(val)) * (uint64_t)(OSOneSecond)) / 1000000000ull) - -OSTime -OSGetTime(); - -OSTime -OSGetSystemTime(); - -OSTick -OSGetTick(); - -OSTick -OSGetSystemTick(); - -OSTime -OSCalendarTimeToTicks(OSCalendarTime *calendarTime); - -void -OSTicksToCalendarTime(OSTime time, - OSCalendarTime *calendarTime); - -#ifdef __cplusplus -} -#endif - -/** @} */ diff --git a/wiiu/wut/include/coreinit/unitheap.h b/wiiu/wut/include/coreinit/unitheap.h deleted file mode 100644 index 549a0c1eb3..0000000000 --- a/wiiu/wut/include/coreinit/unitheap.h +++ /dev/null @@ -1,68 +0,0 @@ -#pragma once -#include -#include "memheap.h" - -/** - * \defgroup coreinit_unitheap Unit Heap - * \ingroup coreinit - * @{ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct MEMUnitHeap MEMUnitHeap; -typedef struct MEMUnitHeapFreeBlock MEMUnitHeapFreeBlock; - -struct MEMUnitHeapFreeBlock -{ - MEMUnitHeapFreeBlock *next; -}; -CHECK_OFFSET(MEMUnitHeapFreeBlock, 0x00, next); -CHECK_SIZE(MEMUnitHeapFreeBlock, 0x04); - -struct MEMUnitHeap -{ - MEMHeapHeader header; - MEMUnitHeapFreeBlock *freeBlocks; - uint32_t blockSize; -}; -CHECK_OFFSET(MEMUnitHeap, 0x00, header); -CHECK_OFFSET(MEMUnitHeap, 0x40, freeBlocks); -CHECK_OFFSET(MEMUnitHeap, 0x44, blockSize); -CHECK_SIZE(MEMUnitHeap, 0x48); - -MEMUnitHeap * -MEMCreateUnitHeapEx(MEMUnitHeap *heap, - uint32_t size, - uint32_t blockSize, - int32_t alignment, - uint16_t flags); - -void * -MEMDestroyUnitHeap(MEMUnitHeap *heap); - -void * -MEMAllocFromUnitHeap(MEMUnitHeap *heap); - -void -MEMFreeToUnitHeap(MEMUnitHeap *heap, - void *block); - -void -MEMiDumpUnitHeap(MEMUnitHeap *heap); - -uint32_t -MEMCountFreeBlockForUnitHeap(MEMUnitHeap *heap); - -uint32_t -MEMCalcHeapSizeForUnitHeap(uint32_t blockSize, - uint32_t count, - int32_t alignment); - -#ifdef __cplusplus -} -#endif - -/** @} */ diff --git a/wiiu/wut/include/gx2/display.h b/wiiu/wut/include/gx2/display.h deleted file mode 100644 index e5672cc696..0000000000 --- a/wiiu/wut/include/gx2/display.h +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once -#include -#include "enum.h" -#include "surface.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void GX2SetTVEnable(BOOL enable); -void GX2SetDRCEnable(BOOL enable); - -void GX2CalcTVSize(GX2TVRenderMode tvRenderMode, - GX2SurfaceFormat surfaceFormat, - GX2BufferingMode bufferingMode, - uint32_t *size, uint32_t *unkOut); - -void GX2CalcDRCSize(GX2DrcRenderMode drcRenderMode, - GX2SurfaceFormat surfaceFormat, - GX2BufferingMode bufferingMode, - uint32_t *size, uint32_t *unkOut); - -void GX2SetTVBuffer(void *buffer, uint32_t size, - GX2TVRenderMode tvRenderMode, - GX2SurfaceFormat surfaceFormat, - GX2BufferingMode bufferingMode); - -void GX2SetDRCBuffer(void *buffer, uint32_t size, - GX2DrcRenderMode drcRenderMode, - GX2SurfaceFormat surfaceFormat, - GX2BufferingMode bufferingMode); - -void GX2SetTVScale(uint32_t x, uint32_t y); -void GX2SetDRCScale(uint32_t x, uint32_t y); - -GX2TVScanMode GX2GetSystemTVScanMode(); -GX2TVScanMode GX2GetSystemDRCScanMode(); -GX2DrcRenderMode GX2GetSystemDRCMode(); - -#ifdef __cplusplus -} -#endif - -/** @} */ diff --git a/wiiu/wut/include/gx2/registers.h b/wiiu/wut/include/gx2/registers.h deleted file mode 100644 index bdffbec9ad..0000000000 --- a/wiiu/wut/include/gx2/registers.h +++ /dev/null @@ -1,478 +0,0 @@ -#pragma once -#include -#include "enum.h" -#include "surface.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct GX2AAMaskReg -{ - uint32_t pa_sc_aa_mask; -} GX2AAMaskReg; - -typedef struct GX2AlphaTestReg -{ - uint32_t sx_alpha_test_control; - uint32_t sx_alpha_ref; -} GX2AlphaTestReg; - -typedef struct GX2AlphaToMaskReg -{ - uint32_t db_alpha_to_mask; -} GX2AlphaToMaskReg; - -typedef struct GX2BlendControlReg -{ - GX2RenderTarget target; - uint32_t cb_blend_control; -} GX2BlendControlReg; - -typedef struct GX2BlendConstantColorReg -{ - float red; - float green; - float blue; - float alpha; -} GX2BlendConstantColorReg; - -typedef struct GX2ColorControlReg -{ - uint32_t cb_color_control; -} GX2ColorControlReg; - -typedef struct GX2DepthStencilControlReg -{ - uint32_t db_depth_control; -} GX2DepthStencilControlReg; - -typedef struct GX2StencilMaskReg -{ - uint32_t db_stencilrefmask; - uint32_t db_stencilrefmask_bf; -} GX2StencilMaskReg; - -typedef struct GX2LineWidthReg -{ - uint32_t pa_su_line_cntl; -} GX2LineWidthReg; - -typedef struct GX2PointSizeReg -{ - uint32_t pa_su_point_size; -} GX2PointSizeReg; - -typedef struct GX2PointLimitsReg -{ - uint32_t pa_su_point_minmax; -} GX2PointLimitsReg; - -typedef struct GX2PolygonControlReg -{ - uint32_t pa_su_sc_mode_cntl; -} GX2PolygonControlReg; - -typedef struct GX2PolygonOffsetReg -{ - uint32_t pa_su_poly_offset_front_scale; - uint32_t pa_su_poly_offset_front_offset; - uint32_t pa_su_poly_offset_back_scale; - uint32_t pa_su_poly_offset_back_offset; - uint32_t pa_su_poly_offset_clamp; -} GX2PolygonOffsetReg; - -typedef struct GX2ScissorReg -{ - uint32_t pa_sc_generic_scissor_tl; - uint32_t pa_sc_generic_scissor_br; -} GX2ScissorReg; - -typedef struct GX2TargetChannelMaskReg -{ - uint32_t cb_target_mask; -} GX2TargetChannelMaskReg; - -typedef struct GX2ViewportReg -{ - uint32_t pa_cl_vport_xscale; - uint32_t pa_cl_vport_xoffset; - uint32_t pa_cl_vport_yscale; - uint32_t pa_cl_vport_yoffset; - uint32_t pa_cl_vport_zscale; - uint32_t pa_cl_vport_zoffset; - uint32_t pa_cl_gb_vert_clip_adj; - uint32_t pa_cl_gb_vert_disc_adj; - uint32_t pa_cl_gb_horz_clip_adj; - uint32_t pa_cl_gb_horz_disc_adj; - uint32_t pa_sc_vport_zmin; - uint32_t pa_sc_vport_zmax; -} GX2ViewportReg; - -void GX2SetAAMask(uint8_t upperLeft, - uint8_t upperRight, - uint8_t lowerLeft, - uint8_t lowerRight); - -void GX2InitAAMaskReg(GX2AAMaskReg *reg, - uint8_t upperLeft, - uint8_t upperRight, - uint8_t lowerLeft, - uint8_t lowerRight); - -void GX2GetAAMaskReg(GX2AAMaskReg *reg, - uint8_t *upperLeft, - uint8_t *upperRight, - uint8_t *lowerLeft, - uint8_t *lowerRight); - -void GX2SetAAMaskReg(GX2AAMaskReg *reg); - -void GX2SetAlphaTest(BOOL alphaTest, - GX2CompareFunction func, - float ref); - -void GX2InitAlphaTestReg(GX2AlphaTestReg *reg, - BOOL alphaTest, - GX2CompareFunction func, - float ref); - -void GX2GetAlphaTestReg(const GX2AlphaTestReg *reg, - BOOL *alphaTest, - GX2CompareFunction *func, - float *ref); - -void GX2SetAlphaTestReg(GX2AlphaTestReg *reg); - -void GX2SetAlphaToMask(BOOL alphaToMask, - GX2AlphaToMaskMode mode); - -void GX2InitAlphaToMaskReg(GX2AlphaToMaskReg *reg, - BOOL alphaToMask, - GX2AlphaToMaskMode mode); - -void GX2GetAlphaToMaskReg(const GX2AlphaToMaskReg *reg, - BOOL *alphaToMask, - GX2AlphaToMaskMode *mode); - -void GX2SetAlphaToMaskReg(GX2AlphaToMaskReg *reg); - -void GX2SetBlendConstantColor(float red, - float green, - float blue, - float alpha); - -void GX2InitBlendConstantColorReg(GX2BlendConstantColorReg *reg, - float red, - float green, - float blue, - float alpha); - -void GX2GetBlendConstantColorReg(GX2BlendConstantColorReg *reg, - float *red, - float *green, - float *blue, - float *alpha); - -void GX2SetBlendConstantColorReg(GX2BlendConstantColorReg *reg); - -void GX2SetBlendControl(GX2RenderTarget target, - GX2BlendMode colorSrcBlend, - GX2BlendMode colorDstBlend, - GX2BlendCombineMode colorCombine, - BOOL useAlphaBlend, - GX2BlendMode alphaSrcBlend, - GX2BlendMode alphaDstBlend, - GX2BlendCombineMode alphaCombine); - -void GX2InitBlendControlReg(GX2BlendControlReg *reg, - GX2RenderTarget target, - GX2BlendMode colorSrcBlend, - GX2BlendMode colorDstBlend, - GX2BlendCombineMode colorCombine, - BOOL useAlphaBlend, - GX2BlendMode alphaSrcBlend, - GX2BlendMode alphaDstBlend, - GX2BlendCombineMode alphaCombine); - -void GX2GetBlendControlReg(GX2BlendControlReg *reg, - GX2RenderTarget *target, - GX2BlendMode *colorSrcBlend, - GX2BlendMode *colorDstBlend, - GX2BlendCombineMode *colorCombine, - BOOL *useAlphaBlend, - GX2BlendMode *alphaSrcBlend, - GX2BlendMode *alphaDstBlend, - GX2BlendCombineMode *alphaCombine); - -void GX2SetBlendControlReg(GX2BlendControlReg *reg); - -void GX2SetColorControl(GX2LogicOp rop3, - uint8_t targetBlendEnable, - BOOL multiWriteEnable, - BOOL colorWriteEnable); - -void GX2InitColorControlReg(GX2ColorControlReg *reg, - GX2LogicOp rop3, - uint8_t targetBlendEnable, - BOOL multiWriteEnable, - BOOL colorWriteEnable); - -void GX2GetColorControlReg(GX2ColorControlReg *reg, - GX2LogicOp *rop3, - uint8_t *targetBlendEnable, - BOOL *multiWriteEnable, - BOOL *colorWriteEnable); - -void GX2SetColorControlReg(GX2ColorControlReg *reg); - -void GX2SetDepthOnlyControl(BOOL depthTest, - BOOL depthWrite, - GX2CompareFunction depthCompare); - -void GX2SetDepthStencilControl(BOOL depthTest, - BOOL depthWrite, - GX2CompareFunction depthCompare, - BOOL stencilTest, - BOOL backfaceStencil, - GX2CompareFunction frontStencilFunc, - GX2StencilFunction frontStencilZPass, - GX2StencilFunction frontStencilZFail, - GX2StencilFunction frontStencilFail, - GX2CompareFunction backStencilFunc, - GX2StencilFunction backStencilZPass, - GX2StencilFunction backStencilZFail, - GX2StencilFunction backStencilFail); - -void GX2InitDepthStencilControlReg(GX2DepthStencilControlReg *reg, - BOOL depthTest, - BOOL depthWrite, - GX2CompareFunction depthCompare, - BOOL stencilTest, - BOOL backfaceStencil, - GX2CompareFunction frontStencilFunc, - GX2StencilFunction frontStencilZPass, - GX2StencilFunction frontStencilZFail, - GX2StencilFunction frontStencilFail, - GX2CompareFunction backStencilFunc, - GX2StencilFunction backStencilZPass, - GX2StencilFunction backStencilZFail, - GX2StencilFunction backStencilFail); - -void GX2GetDepthStencilControlReg(GX2DepthStencilControlReg *reg, - BOOL *depthTest, - BOOL *depthWrite, - GX2CompareFunction *depthCompare, - BOOL *stencilTest, - BOOL *backfaceStencil, - GX2CompareFunction *frontStencilFunc, - GX2StencilFunction *frontStencilZPass, - GX2StencilFunction *frontStencilZFail, - GX2StencilFunction *frontStencilFail, - GX2CompareFunction *backStencilFunc, - GX2StencilFunction *backStencilZPass, - GX2StencilFunction *backStencilZFail, - GX2StencilFunction *backStencilFail); - -void GX2SetDepthStencilControlReg(GX2DepthStencilControlReg *reg); - -void GX2SetStencilMask(uint8_t frontMask, - uint8_t frontWriteMask, - uint8_t frontRef, - uint8_t backMask, - uint8_t backWriteMask, - uint8_t backRef); - -void GX2InitStencilMaskReg(GX2StencilMaskReg *reg, - uint8_t frontMask, - uint8_t frontWriteMask, - uint8_t frontRef, - uint8_t backMask, - uint8_t backWriteMask, - uint8_t backRef); - -void GX2GetStencilMaskReg(GX2StencilMaskReg *reg, - uint8_t *frontMask, - uint8_t *frontWriteMask, - uint8_t *frontRef, - uint8_t *backMask, - uint8_t *backWriteMask, - uint8_t *backRef); - -void GX2SetStencilMaskReg(GX2StencilMaskReg *reg); - -void GX2SetLineWidth(float width); - -void GX2InitLineWidthReg(GX2LineWidthReg *reg, - float width); - -void GX2GetLineWidthReg(GX2LineWidthReg *reg, - float *width); - -void GX2SetLineWidthReg(GX2LineWidthReg *reg); - -void GX2SetPointSize(float width, - float height); - -void GX2InitPointSizeReg(GX2PointSizeReg *reg, - float width, - float height); - -void GX2GetPointSizeReg(GX2PointSizeReg *reg, - float *width, - float *height); - -void GX2SetPointSizeReg(GX2PointSizeReg *reg); - -void GX2SetPointLimits(float min, - float max); - -void GX2InitPointLimitsReg(GX2PointLimitsReg *reg, - float min, - float max); - -void GX2GetPointLimitsReg(GX2PointLimitsReg *reg, - float *min, - float *max); - -void GX2SetPointLimitsReg(GX2PointLimitsReg *reg); - -void GX2SetCullOnlyControl(GX2FrontFace frontFace, - BOOL cullFront, - BOOL cullBack); - -void GX2SetPolygonControl(GX2FrontFace frontFace, - BOOL cullFront, - BOOL cullBack, - BOOL polyMode, - GX2PolygonMode polyModeFront, - GX2PolygonMode polyModeBack, - BOOL polyOffsetFrontEnable, - BOOL polyOffsetBackEnable, - BOOL polyOffsetParaEnable); - -void GX2InitPolygonControlReg(GX2PolygonControlReg *reg, - GX2FrontFace frontFace, - BOOL cullFront, - BOOL cullBack, - BOOL polyMode, - GX2PolygonMode polyModeFront, - GX2PolygonMode polyModeBack, - BOOL polyOffsetFrontEnable, - BOOL polyOffsetBackEnable, - BOOL polyOffsetParaEnable); - -void GX2GetPolygonControlReg(GX2PolygonControlReg *reg, - GX2FrontFace *frontFace, - BOOL *cullFront, - BOOL *cullBack, - BOOL *polyMode, - GX2PolygonMode *polyModeFront, - GX2PolygonMode *polyModeBack, - BOOL *polyOffsetFrontEnable, - BOOL *polyOffsetBackEnable, - BOOL *polyOffsetParaEnable); - -void GX2SetPolygonControlReg(GX2PolygonControlReg *reg); - -void GX2SetPolygonOffset(float frontOffset, - float frontScale, - float backOffset, - float backScale, - float clamp); - -void GX2InitPolygonOffsetReg(GX2PolygonOffsetReg *reg, - float frontOffset, - float frontScale, - float backOffset, - float backScale, - float clamp); - -void GX2GetPolygonOffsetReg(GX2PolygonOffsetReg *reg, - float *frontOffset, - float *frontScale, - float *backOffset, - float *backScale, - float *clamp); - -void GX2SetPolygonOffsetReg(GX2PolygonOffsetReg *reg); - -void GX2SetScissor(uint32_t x, - uint32_t y, - uint32_t width, - uint32_t height); - -void GX2InitScissorReg(GX2ScissorReg *reg, - uint32_t x, - uint32_t y, - uint32_t width, - uint32_t height); - -void GX2GetScissorReg(GX2ScissorReg *reg, - uint32_t *x, - uint32_t *y, - uint32_t *width, - uint32_t *height); - -void GX2SetScissorReg(GX2ScissorReg *reg); - -void GX2SetTargetChannelMasks(GX2ChannelMask mask0, - GX2ChannelMask mask1, - GX2ChannelMask mask2, - GX2ChannelMask mask3, - GX2ChannelMask mask4, - GX2ChannelMask mask5, - GX2ChannelMask mask6, - GX2ChannelMask mask7); - -void GX2InitTargetChannelMasksReg(GX2TargetChannelMaskReg *reg, - GX2ChannelMask mask0, - GX2ChannelMask mask1, - GX2ChannelMask mask2, - GX2ChannelMask mask3, - GX2ChannelMask mask4, - GX2ChannelMask mask5, - GX2ChannelMask mask6, - GX2ChannelMask mask7); - -void GX2GetTargetChannelMasksReg(GX2TargetChannelMaskReg *reg, - GX2ChannelMask *mask0, - GX2ChannelMask *mask1, - GX2ChannelMask *mask2, - GX2ChannelMask *mask3, - GX2ChannelMask *mask4, - GX2ChannelMask *mask5, - GX2ChannelMask *mask6, - GX2ChannelMask *mask7); - -void GX2SetTargetChannelMasksReg(GX2TargetChannelMaskReg *reg); - -void GX2SetViewport(float x, - float y, - float width, - float height, - float nearZ, - float farZ); - -void GX2InitViewportReg(GX2ViewportReg *reg, - float x, - float y, - float width, - float height, - float nearZ, - float farZ); - -void GX2GetViewportReg(GX2ViewportReg *reg, - float *x, - float *y, - float *width, - float *height, - float *nearZ, - float *farZ); - -void GX2SetViewportReg(GX2ViewportReg *reg); -#ifdef __cplusplus -} -#endif - -/** @} */ diff --git a/wiiu/wut/include/gx2/sampler.h b/wiiu/wut/include/gx2/sampler.h deleted file mode 100644 index 0018420a91..0000000000 --- a/wiiu/wut/include/gx2/sampler.h +++ /dev/null @@ -1,60 +0,0 @@ -#pragma once -#include -#include "enum.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -typedef struct GX2Sampler -{ - uint32_t regs[3]; -} GX2Sampler; - -void GX2InitSampler(GX2Sampler *sampler, - GX2TexClampMode clampMode, - GX2TexXYFilterMode minMagFilterMode); - -void GX2InitSamplerBorderType(GX2Sampler *sampler, - GX2TexBorderType borderType); - -void GX2InitSamplerClamping(GX2Sampler *sampler, - GX2TexClampMode clampX, - GX2TexClampMode clampY, - GX2TexClampMode clampZ); - -void GX2InitSamplerDepthCompare(GX2Sampler *sampler, - GX2CompareFunction depthCompare); - -void GX2InitSamplerFilterAdjust(GX2Sampler *sampler, - BOOL highPrecision, - GX2TexMipPerfMode perfMip, - GX2TexZPerfMode perfZ); - -void GX2InitSamplerLOD(GX2Sampler *sampler, - float lodMin, - float lodMax, - float lodBias); - -void GX2InitSamplerLODAdjust(GX2Sampler *sampler, - float unk1, - BOOL unk2); - -void GX2InitSamplerRoundingMode(GX2Sampler *sampler, - GX2RoundingMode roundingMode); - -void GX2InitSamplerXYFilter(GX2Sampler *sampler, - GX2TexXYFilterMode filterMag, - GX2TexXYFilterMode filterMin, - GX2TexAnisoRatio maxAniso); - -void GX2InitSamplerZMFilter(GX2Sampler *sampler, - GX2TexZFilterMode filterZ, - GX2TexMipFilterMode filterMip); - -#ifdef __cplusplus -} -#endif - -/** @} */ diff --git a/wiiu/wut/include/gx2/state.h b/wiiu/wut/include/gx2/state.h deleted file mode 100644 index 9e7d520491..0000000000 --- a/wiiu/wut/include/gx2/state.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once -#include -#include "enum.h" - -/** - * \defgroup gx2_state State - * \ingroup gx2 - * @{ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -void -GX2Init(uint32_t *attributes); - -void -GX2Shutdown(); - -void -GX2Flush(); - -#ifdef __cplusplus -} -#endif - -/** @} */ diff --git a/wiiu/wut/include/gx2/swap.h b/wiiu/wut/include/gx2/swap.h deleted file mode 100644 index 194ebbf079..0000000000 --- a/wiiu/wut/include/gx2/swap.h +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once -#include -#include "enum.h" - -/** - * \defgroup gx2_swap Swap - * \ingroup gx2 - * @{ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct GX2ColorBuffer GX2ColorBuffer; -typedef struct GX2Texture GX2Texture; - -void -GX2CopyColorBufferToScanBuffer(GX2ColorBuffer *buffer, - GX2ScanTarget scanTarget); - -void -GX2SwapScanBuffers(); - -BOOL -GX2GetLastFrame(GX2ScanTarget scanTarget, - GX2Texture *texture); - -BOOL -GX2GetLastFrameGamma(GX2ScanTarget scanTarget, - float *gammaOut); - -uint32_t -GX2GetSwapInterval(); - -void -GX2SetSwapInterval(uint32_t interval); - -#ifdef __cplusplus -} -#endif - -/** @} */ diff --git a/wiiu/wut/include/sysapp/switch.h b/wiiu/wut/include/sysapp/switch.h deleted file mode 100644 index 8d98a3a9ad..0000000000 --- a/wiiu/wut/include/sysapp/switch.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once -#include - -#ifdef __cplusplus -extern "C" { -#endif - -//TODO -typedef void sysapp_input_struct; - -void SYSSwitchToSyncControllerOnHBM(); -void SYSSwitchToEManual(); -void SYSSwitchToEShop(); -void _SYSSwitchToMainApp(); -void SYSSwitchToBrowserForViewer(sysapp_input_struct *); - -#ifdef __cplusplus -} -#endif diff --git a/wiiu/wut/include/wut.h b/wiiu/wut/include/wut.h deleted file mode 100644 index 7414e25fed..0000000000 --- a/wiiu/wut/include/wut.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once -#include "wut_structsize.h" -#include "wut_types.h" diff --git a/wiiu/wut/include/wut_structsize.h b/wiiu/wut/include/wut_structsize.h deleted file mode 100644 index 03a780c0f4..0000000000 --- a/wiiu/wut/include/wut_structsize.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once -#include -#include - -// Ensure structs are correct size & offsets -#define CHECK_SIZE(Type, Size) \ - static_assert(sizeof(Type) == Size, \ - #Type " must be " #Size " bytes") - -#define CHECK_OFFSET(Type, Offset, Field) \ - static_assert(offsetof(Type, Field) == Offset, \ - #Type "::" #Field " must be at offset " #Offset) - -// Workaround weird macro concat ## behaviour -#define PP_CAT(a, b) PP_CAT_I(a, b) -#define PP_CAT_I(a, b) PP_CAT_II(~, a ## b) -#define PP_CAT_II(p, res) res - -// Allow us to easily add UNKNOWN / PADDING bytes into our structs, -// generates unique variable names using __COUNTER__ -#define UNKNOWN(Size) char PP_CAT(__unk, __COUNTER__) [Size] -#define PADDING(Size) UNKNOWN(Size) -