(WiiU) refactors/cleanups.

This commit is contained in:
aliaspider 2017-01-23 15:59:44 +01:00
parent 8db8e8d663
commit e96ad48cd1
122 changed files with 1735 additions and 3314 deletions

View File

@ -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)

View File

@ -18,19 +18,11 @@
#include <malloc.h>
#include <stdint.h>
#include <sndcore2/core.h>
#include <sndcore2/device.h>
#include <sndcore2/drcvs.h>
#include <sndcore2/result.h>
#include <sndcore2/voice.h>
#include <coreinit/time.h>
#include <coreinit/cache.h>
#include <coreinit/thread.h>
#include <coreinit/spinlock.h>
#include <wiiu/os.h>
#include <wiiu/ax.h>
#include "wiiu/wiiu_dbg.h"
#include "wiiu/system/memory.h"
#include "wiiu/multivoice.h"
#include "audio/audio_driver.h"
#include "performance_counters.h"

View File

@ -35,7 +35,7 @@
#include "tasks/tasks_internal.h"
#include "runloop.h"
#include <nsysnet/socket.h>
#include <sys/socket.h>
#include "fs/fs_utils.h"
#include "fs/sd_fat_devoptab.h"
#include "system/dynamic.h"
@ -44,15 +44,15 @@
#include "system/exception.h"
#include <sys/iosupport.h>
#include <coreinit/foreground.h>
#include <proc_ui/procui.h>
#include <vpad/input.h>
#include <sysapp/launch.h>
#include <padscore.h>
#include <wiiu/os/foreground.h>
#include <wiiu/procui.h>
#include <wiiu/sysapp.h>
#include <wiiu/ios.h>
#include <wiiu/vpad.h>
#include <wiiu/kpad.h>
#include <fat.h>
#include <iosuhax.h>
#include "ios.h"
#include "wiiu_dbg.h"

View File

@ -19,11 +19,9 @@
#include "performance_counters.h"
#include <string.h>
#include <coreinit/screen.h>
#include <coreinit/cache.h>
#include "gx2.h"
#include <wiiu/os.h>
#include <wiiu/gx2.h>
#include "system/memory.h"
#include "system/wiiu.h"
#include "tex_shader.h"
#include "wiiu_dbg.h"

View File

@ -18,8 +18,8 @@
#include "../../config.h"
#endif
#include <vpad/input.h>
#include <padscore.h>
#include <wiiu/vpad.h>
#include <wiiu/kpad.h>
#include "../input_config.h"
#include "../input_driver.h"

View File

@ -74,8 +74,7 @@
#endif
#ifdef WIIU
#include <coreinit/time.h>
#include "wiiu/system/wiiu.h"
#include <wiiu/os/time.h>
#endif
#if defined(_3DS)

View File

@ -33,8 +33,7 @@
#elif defined(GEKKO) || defined(__PSL1GHT__) || defined(__QNX__)
#include <unistd.h>
#elif defined(WIIU)
#include <coreinit/thread.h>
#include "system/wiiu.h"
#include <wiiu/os/thread.h>
#elif defined(PSP)
#include <pspthreadman.h>
#elif defined(VITA)

View File

@ -3,7 +3,7 @@
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <coreinit/filesystem.h>
#include <wiiu/fs.h>
/* FS defines and types */
#define FS_MAX_LOCALPATH_SIZE 511

View File

@ -5,8 +5,7 @@
extern "C" {
#endif
//#include <gctypes.h>
#include <wut_types.h>
#include <wiiu/types.h>
int MountFS(void *pClient, void *pCmd, char **mount_path);
int UmountFS(void *pClient, void *pCmd, const char *mountPath);

View File

@ -22,7 +22,6 @@
* distribution.
***************************************************************************/
#include <errno.h>
//#include <ogc/disc_io.h>
#include <sys/statvfs.h>
#include <sys/dirent.h>
#include <string.h>
@ -30,8 +29,8 @@
#include <fcntl.h>
#include <stdio.h>
#include "fs_utils.h"
#include <coreinit/mutex.h>
#include <coreinit/filesystem.h>
#include <wiiu/os/mutex.h>
#include <wiiu/fs.h>
#define FS_ALIGNMENT 0x40
#define FS_ALIGN(x) (((x) + FS_ALIGNMENT - 1) & ~(FS_ALIGNMENT - 1))

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#include <stdint.h>
#include <sys/time.h>

8
wiiu/include/wiiu/ax.h Normal file
View File

@ -0,0 +1,8 @@
#pragma once
#include <wiiu/ax/core.h>
#include <wiiu/ax/device.h>
#include <wiiu/ax/drcvs.h>
#include <wiiu/ax/multivoice.h>
#include <wiiu/ax/result.h>
#include <wiiu/ax/voice.h>

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#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();

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#include "result.h"
#ifdef __cplusplus

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#include "result.h"
#ifdef __cplusplus

View File

@ -1,6 +1,10 @@
#pragma once
#include <wiiu/types.h>
#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

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#ifdef __cplusplus
extern "C" {

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#include "device.h"
#include "result.h"

269
wiiu/include/wiiu/fs.h Normal file
View File

@ -0,0 +1,269 @@
#pragma once
#include <wiiu/types.h>
#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

19
wiiu/include/wiiu/gx2.h Normal file
View File

@ -0,0 +1,19 @@
#pragma once
#include <wiiu/gx2/context.h>
#include <wiiu/gx2/common.h>
#include <wiiu/gx2/display.h>
#include <wiiu/gx2/displaylist.h>
#include <wiiu/gx2/draw.h>
#include <wiiu/gx2/enum.h>
#include <wiiu/gx2/event.h>
#include <wiiu/gx2/mem.h>
#include <wiiu/gx2/registers.h>
#include <wiiu/gx2/sampler.h>
#include <wiiu/gx2/shaders.h>
#include <wiiu/gx2/state.h>
#include <wiiu/gx2/surface.h>
#include <wiiu/gx2/swap.h>
#include <wiiu/gx2/tessellation.h>
#include <wiiu/gx2/texture.h>

View File

@ -1,21 +1,4 @@
#ifndef GX2_H
#define GX2_H
#include <gx2/clear.h>
#include <gx2/context.h>
#include <gx2/display.h>
#include <gx2/displaylist.h>
#include <gx2/draw.h>
#include <gx2/enum.h>
#include <gx2/event.h>
#include <gx2/mem.h>
#include <gx2/registers.h>
#include <gx2/sampler.h>
#include <gx2/shaders.h>
#include <gx2/state.h>
#include <gx2/surface.h>
#include <gx2/swap.h>
#include <gx2/tessellation.h>
#include <gx2/texture.h>
#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

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#ifdef __cplusplus
extern "C" {

View File

@ -0,0 +1,30 @@
#pragma once
#include <wiiu/types.h>
#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

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#ifdef __cplusplus
extern "C" {

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#include "enum.h"

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#ifdef __cplusplus
extern "C" {

View File

@ -1,6 +1,6 @@
#pragma once
#include <wut.h>
#include <coreinit/time.h>
#include <wiiu/types.h>
#include <wiiu/os/time.h>
#include "enum.h"
#ifdef __cplusplus

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#include "enum.h"
#ifdef __cplusplus
@ -11,5 +11,3 @@ void GX2Invalidate(GX2InvalidateMode mode, void *buffer, uint32_t size);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -0,0 +1,235 @@
#pragma once
#include <wiiu/types.h>
#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
/** @} */

View File

@ -0,0 +1,35 @@
#pragma once
#include <wiiu/types.h>
#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
/** @} */

View File

@ -1,8 +1,8 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#include <wiiu/gx2r/buffer.h>
#include "enum.h"
#include "sampler.h"
#include "gx2r/buffer.h"
#ifdef __cplusplus
extern "C" {

View File

@ -0,0 +1,15 @@
#pragma once
#include <wiiu/types.h>
#include "enum.h"
#ifdef __cplusplus
extern "C" {
#endif
void GX2Init(uint32_t *attributes);
void GX2Shutdown();
void GX2Flush();
#ifdef __cplusplus
}
#endif

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#include "enum.h"
#ifdef __cplusplus

View File

@ -0,0 +1,20 @@
#pragma once
#include <wiiu/types.h>
#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

View File

@ -1,6 +1,5 @@
#pragma once
#include <wut.h>
#include <coreinit/time.h>
#include <wiiu/types.h>
#include "enum.h"
#ifdef __cplusplus

View File

@ -1,15 +1,12 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#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);

8
wiiu/include/wiiu/gx2r.h Normal file
View File

@ -0,0 +1,8 @@
#pragma once
#include <wiiu/gx2r/buffer.h>
#include <wiiu/gx2r/displaylist.h>
#include <wiiu/gx2r/draw.h>
#include <wiiu/gx2r/mem.h>
#include <wiiu/gx2r/resource.h>
#include <wiiu/gx2r/surface.h>

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#include "resource.h"
#ifdef __cplusplus

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#include "resource.h"
#include "buffer.h"

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#include <gx2/enum.h>
#include "resource.h"
#include "buffer.h"

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#include "resource.h"
#ifdef __cplusplus

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#ifdef __cplusplus
extern "C" {

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#include <gx2/surface.h>
#include "resource.h"

15
wiiu/include/wiiu/ios.h Normal file
View File

@ -0,0 +1,15 @@
#pragma once
#include <wiiu/types.h>
#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

59
wiiu/include/wiiu/kpad.h Normal file
View File

@ -0,0 +1,59 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <wiiu/types.h>
#include <wiiu/wpad.h>
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

61
wiiu/include/wiiu/mcp.h Normal file
View File

@ -0,0 +1,61 @@
#pragma once
#include <wiiu/types.h>
#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

9
wiiu/include/wiiu/mem.h Normal file
View File

@ -0,0 +1,9 @@
#pragma once
#include <wiiu/mem/baseheap.h>
#include <wiiu/mem/blockheap.h>
#include <wiiu/mem/expandedheap.h>
#include <wiiu/mem/frameheap.h>
#include <wiiu/mem/memheap.h>
#include <wiiu/mem/memlist.h>
#include <wiiu/mem/unitheap.h>

View File

@ -0,0 +1,23 @@
#pragma once
#include <wiiu/types.h>
#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

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#include "memheap.h"
#ifdef __cplusplus

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#include "memheap.h"
#ifdef __cplusplus

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#include "memheap.h"
#ifdef __cplusplus

View File

@ -1,6 +1,6 @@
#pragma once
#include <wut.h>
#include "spinlock.h"
#include <wiiu/types.h>
#include <wiiu/os/spinlock.h>
#include "memlist.h"
#ifdef __cplusplus

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#ifdef __cplusplus
extern "C" {

View File

@ -0,0 +1,32 @@
#pragma once
#include <wiiu/types.h>
#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

View File

@ -0,0 +1,111 @@
#pragma once
#include <wiiu/types.h>
#include <wiiu/os/time.h>
#include <wiiu/os/spinlock.h>
#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

26
wiiu/include/wiiu/os.h Normal file
View File

@ -0,0 +1,26 @@
#pragma once
#include <wiiu/os/alarm.h>
#include <wiiu/os/atomic64.h>
#include <wiiu/os/cache.h>
#include <wiiu/os/condition.h>
#include <wiiu/os/core.h>
#include <wiiu/os/coroutine.h>
#include <wiiu/os/debug.h>
#include <wiiu/os/dynload.h>
#include <wiiu/os/event.h>
#include <wiiu/os/exception.h>
#include <wiiu/os/fastcondition.h>
#include <wiiu/os/fastmutex.h>
#include <wiiu/os/foreground.h>
#include <wiiu/os/messagequeue.h>
#include <wiiu/os/mutex.h>
#include <wiiu/os/memory.h>
#include <wiiu/os/rendezvous.h>
#include <wiiu/os/screen.h>
#include <wiiu/os/semaphore.h>
#include <wiiu/os/spinlock.h>
#include <wiiu/os/systeminfo.h>
#include <wiiu/os/thread.h>
#include <wiiu/os/time.h>
#include <wiiu/os/title.h>

View File

@ -1,83 +1,52 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#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);

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#ifdef __cplusplus
extern "C" {

View File

@ -0,0 +1,19 @@
#pragma once
#include <wiiu/types.h>
#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

View File

@ -0,0 +1,26 @@
#pragma once
#include <wiiu/types.h>
#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

View File

@ -0,0 +1,17 @@
#pragma once
#include <wiiu/types.h>
#ifdef __cplusplus
extern "C" {
#endif
uint32_t OSGetCoreCount();
uint32_t OSGetCoreId();
uint32_t OSGetMainCoreId();
BOOL OSIsMainCore();
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#ifdef __cplusplus
extern "C" {

View File

@ -0,0 +1,18 @@
#pragma once
#include <stddef.h>
#include <wiiu/types.h>
#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

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#include "thread.h"
#include "time.h"

View File

@ -0,0 +1,36 @@
#pragma once
#include <wiiu/types.h>
#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

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#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

View File

@ -1,6 +1,5 @@
#pragma once
#include <wut.h>
#include "threadqueue.h"
#include <wiiu/types.h>
#include "fastmutex.h"
#ifdef __cplusplus

View File

@ -1,38 +1,26 @@
#pragma once
#include <wut.h>
#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 <wiiu/types.h>
#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
/** @} */

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#ifdef __cplusplus
extern "C" {

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#ifdef __cplusplus
extern "C" {

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#ifdef __cplusplus
extern "C" {
@ -18,7 +18,6 @@ typedef struct OSMessage
} OSMessage;
#define OS_MESSAGE_QUEUE_TAG 0x6D536751u
typedef struct OSMessageQueue
{
uint32_t tag;

View File

@ -0,0 +1,39 @@
#pragma once
#include <wiiu/types.h>
#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
/** @} */

View File

@ -1,17 +1,15 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#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);

View File

@ -0,0 +1,25 @@
#pragma once
#include <wiiu/types.h>
#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

View File

@ -0,0 +1,28 @@
#pragma once
#include <wiiu/types.h>
#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

View File

@ -0,0 +1,31 @@
#pragma once
#include <wiiu/types.h>
#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
/** @} */

View File

@ -0,0 +1,21 @@
#pragma once
#include <wiiu/types.h>
#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

View File

@ -0,0 +1,278 @@
#pragma once
#include <wiiu/types.h>
#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

View File

@ -1,5 +1,14 @@
#ifndef WIIU_H
#define WIIU_H
#pragma once
#include <wiiu/types.h>
#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

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#ifdef __cplusplus
extern "C" {
@ -10,5 +10,3 @@ u64 OSGetTitleID(void);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -1,11 +1,5 @@
#pragma once
#include <wut.h>
/**
* \defgroup proc_ui_procui ProcUI
* \ingroup proc_ui
* @{
*/
#include <wiiu/types.h>
#ifdef __cplusplus
extern "C" {
@ -39,5 +33,3 @@ ProcUIStatus ProcUISubProcessMessages(BOOL block);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -1,10 +1,18 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#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);

View File

@ -2,8 +2,6 @@
#include <stdint.h>
#include <stdbool.h>
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;

View File

@ -1,5 +1,5 @@
#pragma once
#include <wut.h>
#include <wiiu/types.h>
#ifdef __cplusplus
extern "C" {
@ -130,5 +130,3 @@ void VPADGetTPCalibratedPoint(uint32_t chan, VPADTouchData *calibratedData, VPAD
#ifdef __cplusplus
}
#endif
/** @} */

52
wiiu/include/wiiu/wpad.h Normal file
View File

@ -0,0 +1,52 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <wiiu/types.h>
#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

View File

@ -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

View File

@ -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 <wut_types.h>
#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_

View File

@ -1,5 +1,5 @@
#include <coreinit/dynload.h>
#include <coreinit/debug.h>
#include <wiiu/os/dynload.h>
#include <wiiu/os/debug.h>
#define IMPORT(name) void* addr_##name
#define IMPORT_BEGIN(lib)

View File

@ -1,10 +1,6 @@
/* source: https://github.com/QuarkTheAwesome/URetro */
#include <coreinit/thread.h>
#include <coreinit/exception.h>
#include <coreinit/debug.h>
#include <coreinit/dynload.h>
#include <coreinit/internal.h>
#include <wiiu/os.h>
#ifndef __EXCEPTION_H__
#define __EXCEPTION_H__

View File

@ -1,8 +1,5 @@
#include <stdio.h>
#include <coreinit/thread.h>
#include <coreinit/exception.h>
#include <coreinit/debug.h>
#include <coreinit/internal.h>
#include <wiiu/os.h>
#include "exception_handler.h"
#include "wiiu_dbg.h"

View File

@ -17,10 +17,7 @@
#include <malloc.h>
#include <string.h>
#include "memory.h"
#include <coreinit/memory.h>
#include <coreinit/baseheap.h>
#include <coreinit/frameheap.h>
#include <coreinit/expandedheap.h>
#include <wiiu/mem.h>
static MEMExpandedHeap* mem1_heap;
static MEMExpandedHeap* bucket_heap;

View File

@ -15,8 +15,7 @@
#ifndef TEX_SHADER_H
#define TEX_SHADER_H
#include <gx2.h>
#include "system/memory.h"
#include <wiiu/gx2.h>
#ifdef __cplusplus
extern "C" {

View File

@ -2,7 +2,7 @@
#define WIIU_DBG_H
#include <stdio.h>
#include <wut_types.h>
#include <wiiu/types.h>
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -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:

View File

@ -1,46 +0,0 @@
#pragma once
#include <wut.h>
/**
* \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
/** @} */

View File

@ -1,70 +0,0 @@
#pragma once
#include <wut.h>
#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

View File

@ -1,61 +0,0 @@
#pragma once
#include <wut.h>
#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 <a href="http://en.cppreference.com/w/cpp/thread/condition_variable/wait">std::condition_variable::wait</a>.
*/
void OSWaitCond(OSCondition *condition,
OSMutex *mutex);
/**
* Will wake up any threads waiting on the condition with OSWaitCond.
*
* Similar to <a href="http://en.cppreference.com/w/cpp/thread/condition_variable/notify_all">std::condition_variable::notify_all</a>.
*/
void OSSignalCond(OSCondition *condition);
#ifdef __cplusplus
}
#endif

View File

@ -1,47 +0,0 @@
#pragma once
#include <wut.h>
/**
* \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
/** @} */

View File

@ -1,15 +0,0 @@
#pragma once
#include <wut.h>
#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

View File

@ -1,113 +0,0 @@
#pragma once
#include <wut.h>
#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 <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms686211(v=vs.85).aspx">SetEvent</a>.
*/
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 <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms687032(v=vs.85).aspx">WaitForSingleObject</a>.
*/
void OSWaitEvent(OSEvent *event);
/**
* Resets the event object.
*
* Similar to <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms685081(v=vs.85).aspx">ResetEvent</a>.
*/
void OSResetEvent(OSEvent *event);
/**
* Wait until an event is signalled or a timeout has occurred.
*
* Similar to <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms687032(v=vs.85).aspx">WaitForSingleObject</a>.
*/
BOOL
OSWaitEventWithTimeout(OSEvent *event,
OSTime timeout);
#ifdef __cplusplus
}
#endif

Some files were not shown because too many files have changed in this diff Show More