diff options
| author | TakaRikka <38417346+TakaRikka@users.noreply.github.com> | 2025-12-16 06:55:07 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-16 16:55:07 +0200 |
| commit | 8185d87f855baff0d55d0e3ffc1a3cbdcfc4b5e2 (patch) | |
| tree | 2a3c01f1a2a8b81de5a0748a5bcb187a97e7a114 /include | |
| parent | c8104b6d62cc424318c7e0c44c92d94234bfef15 (diff) | |
copy homebuttonLib from oot-vc (#2960)
* initial copy of hbm from sdk_2009-12-11
* some more nw4hbm cleanup
* nw4hbm db mostly done
* nw4hbm snd copied from oot-vc
* nw4hbm ut copied
* nw4hbm lyt copied
* nw4hbm copied, mostly matching usa 1.0
* setup nw4hbm debug define
* fix HBMDataInfo struct
* add rvl sdk card lib
Diffstat (limited to 'include')
| -rw-r--r-- | include/dolphin/card.h | 4 | ||||
| -rw-r--r-- | include/global.h | 15 | ||||
| -rw-r--r-- | include/m_Do/m_Do_printf.h | 2 | ||||
| -rw-r--r-- | include/revolution/arc.h | 67 | ||||
| -rw-r--r-- | include/revolution/ax.h | 50 | ||||
| -rw-r--r-- | include/revolution/axfx.h | 24 | ||||
| -rw-r--r-- | include/revolution/card.h | 322 | ||||
| -rw-r--r-- | include/revolution/hbm.h | 55 | ||||
| -rw-r--r-- | include/revolution/mem.h | 8 | ||||
| -rw-r--r-- | include/revolution/mem/allocator.h | 37 | ||||
| -rw-r--r-- | include/revolution/mem/expHeap.h | 50 | ||||
| -rw-r--r-- | include/revolution/mem/heapCommon.h | 43 | ||||
| -rw-r--r-- | include/revolution/mem/list.h | 31 | ||||
| -rw-r--r-- | include/revolution/mtx.h | 2 | ||||
| -rw-r--r-- | include/revolution/os.h | 108 | ||||
| -rw-r--r-- | include/revolution/tpl.h | 52 | ||||
| -rw-r--r-- | include/revolution/wenc.h | 12 | ||||
| -rw-r--r-- | include/revolution/wpad.h | 83 |
18 files changed, 909 insertions, 56 deletions
diff --git a/include/dolphin/card.h b/include/dolphin/card.h index 6ed175b71c..6487d88f43 100644 --- a/include/dolphin/card.h +++ b/include/dolphin/card.h @@ -1,6 +1,9 @@ #ifndef _DOLPHIN_CARD_H_ #define _DOLPHIN_CARD_H_ +#ifdef __REVOLUTION_SDK__ +#include <revolution/card.h> +#else #include <dolphin/os.h> #include <dolphin/dsp.h> #include <dolphin/dvd.h> @@ -320,3 +323,4 @@ s32 CARDWrite(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset); #endif #endif +#endif diff --git a/include/global.h b/include/global.h index b8bb5c02b2..f9057a67ae 100644 --- a/include/global.h +++ b/include/global.h @@ -45,6 +45,10 @@ #define ROUND(n, a) (((u32)(n) + (a)-1) & ~((a)-1)) #define TRUNC(n, a) (((u32)(n)) & ~((a)-1)) +#ifndef decltype +#define decltype __decltype__ +#endif + #define JUT_EXPECT(...) #define _SDA_BASE_(dummy) 0 @@ -77,6 +81,9 @@ void* __memcpy(void*, const void*, int); #define SQUARE(x) ((x) * (x)) +#define POINTER_ADD_TYPE(type_, ptr_, offset_) ((type_)((unsigned long)(ptr_) + (unsigned long)(offset_))) +#define POINTER_ADD(ptr_, offset_) POINTER_ADD_TYPE(__typeof__(ptr_), ptr_, offset_) + // floating-point constants #define _HUGE_ENUF 1e+300 #define INFINITY ((float)(_HUGE_ENUF * _HUGE_ENUF)) @@ -91,6 +98,14 @@ static const float INF = 2000000000.0f; #define READU32_BE(ptr, offset) \ (((u32)ptr[offset] << 24) | ((u32)ptr[offset + 1] << 16) | ((u32)ptr[offset + 2] << 8) | (u32)ptr[offset + 3]); +#ifndef NO_INLINE +#ifdef __MWERKS__ +#define NO_INLINE __attribute__((never_inline)) +#else +#define NO_INLINE +#endif +#endif + // Hack to trick the compiler into not inlining functions that use this macro. #define FORCE_DONT_INLINE \ (void*)0; (void*)0; (void*)0; (void*)0; (void*)0; (void*)0; (void*)0; (void*)0; (void*)0; (void*)0; \ diff --git a/include/m_Do/m_Do_printf.h b/include/m_Do/m_Do_printf.h index 84d6c080b4..13ca5b0e01 100644 --- a/include/m_Do/m_Do_printf.h +++ b/include/m_Do/m_Do_printf.h @@ -1,7 +1,7 @@ #ifndef M_DO_M_DO_PRINTF_H #define M_DO_M_DO_PRINTF_H -#include "__va_arg.h" +#include <dolphin/os.h> void my_PutString(const char*); void mDoPrintf_vprintf_Interrupt(char const*, va_list); diff --git a/include/revolution/arc.h b/include/revolution/arc.h new file mode 100644 index 0000000000..8e8b23b732 --- /dev/null +++ b/include/revolution/arc.h @@ -0,0 +1,67 @@ +#ifndef _REVOLUTION_ARC_H_ +#define _REVOLUTION_ARC_H_ + +#include <revolution/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define ARC_ENTRY_NUM_INVALID (-1) + +typedef struct { + unsigned int magic; + int fstStart; + int fstSize; + int fileStart; + int pad[4]; +} ARCHeader; + +typedef struct { + void* archiveStartAddr; // 0x0 + void* FSTStart; // 0x4 + void* fileStart; // 0x8 + u32 entryNum; // 0xC + char* FSTStringStart; // 0x10 + u32 FSTLength; // 0x14 + u32 currDir; // 0x18 +} ARCHandle; + +typedef struct { + ARCHandle* handle; + u32 startOffset; + u32 length; +} ARCFileInfo; + +typedef struct { + ARCHandle* handle; + u32 entryNum; + u32 location; + u32 next; +} ARCDir; + +typedef struct { + ARCHandle* handle; + u32 entryNum; + BOOL isDir; + char* name; +} ARCDirEntry; + +BOOL ARCInitHandle(void*, ARCHandle*); +BOOL ARCFastOpen(ARCHandle*, s32, ARCFileInfo*); +s32 ARCConvertPathToEntrynum(ARCHandle*, const char*); +void* ARCGetStartAddrInMem(ARCFileInfo*); +u32 ARCGetLength(ARCFileInfo*); +BOOL ARCClose(ARCFileInfo*); +BOOL ARCChangeDir(ARCHandle*, const char*); +BOOL ARCGetCurrentDir(ARCHandle*, char*, u32); + +BOOL ARCOpenDir(ARCHandle*, const char*, ARCDir*); +BOOL ARCReadDir(ARCDir*, ARCDirEntry*); +BOOL ARCCloseDir(ARCDir*); + +#ifdef __cplusplus +} +#endif + +#endif // _REVOLUTION_ARC_H_ diff --git a/include/revolution/ax.h b/include/revolution/ax.h index a1a85ddd87..37693da034 100644 --- a/include/revolution/ax.h +++ b/include/revolution/ax.h @@ -7,6 +7,16 @@ extern "C" { #endif +#define AX_SAMPLE_RATE 32000 +#define AX_SAMPLES_PER_FRAME 96 +#define AX_SAMPLE_DEPTH_BYTES sizeof(u32) +#define AX_SAMPLES_PER_FRAME_RMT 18 +#define AX_FRAME_SIZE (AX_SAMPLES_PER_FRAME * AX_SAMPLE_DEPTH_BYTES) +#define AX_MAX_VOLUME 32768 + +#define AX_VOICE_STOP 0 +#define AX_VOICE_RUN 1 + typedef struct _AXPBMIX { /* 0x00 */ u16 vL; /* 0x02 */ u16 vDeltaL; @@ -210,7 +220,45 @@ typedef struct AX_AUX_DATA_DPL2 { /* 0x00 */ s32* rs; } AX_AUX_DATA_DPL2; +typedef struct _AXPBRMTMIX { + /* 0x0 */ u16 vMain0; + /* 0x2 */ u16 vDeltaMain0; + /* 0x4 */ u16 vAux0; + /* 0x6 */ u16 vDeltaAux0; + /* 0x8 */ u16 vMain1; + /* 0xA */ u16 vDeltaMain1; + /* 0xC */ u16 vAux1; + /* 0xE */ u16 vDeltaAux1; + /* 0x10 */ u16 vMain2; + /* 0x12 */ u16 vDeltaMain2; + /* 0x14 */ u16 vAux2; + /* 0x16 */ u16 vDeltaAux2; + /* 0x18 */ u16 vMain3; + /* 0x1A */ u16 vDeltaMain3; + /* 0x1C */ u16 vAux3; + /* 0x1E */ u16 vDeltaAux3; +} AXPBRMTMIX; + +typedef struct _AXPBBIQUAD { + /* 0x0 */ u16 on; + /* 0x2 */ u16 xn1; + /* 0x4 */ u16 xn2; + /* 0x6 */ u16 yn1; + /* 0x8 */ u16 yn2; + /* 0xA */ u16 b0; + /* 0xC */ u16 b1; + /* 0xE */ u16 b2; + /* 0x10 */ u16 a1; + /* 0x12 */ u16 a2; +} AXPBBIQUAD; + +typedef union __AXPBRMTIIR { + AXPBLPF lpf; + AXPBBIQUAD biquad; +} AXPBRMTIIR; + typedef void (*AXCallback)(); +typedef void (*AXAuxCallback)(void* chans, void* context); #define AX_DSP_SLAVE_LENGTH 0xF80 #define AX_MAX_VOICES 64 @@ -268,7 +316,7 @@ AXVPB* AXAcquireVoice(u32 priority, void (*callback)(void *), u32 userContext); void AXSetVoicePriority(AXVPB* p, u32 priority); // AXAux -void AXRegisterAuxACallback(void (*callback)(void*, void*), void* context); +void AXRegisterAuxACallback(AXAuxCallback callback, void* context); void AXRegisterAuxBCallback(void (*callback)(void*, void*), void* context); // AXCL diff --git a/include/revolution/axfx.h b/include/revolution/axfx.h index 259e73e7b5..3c8b2a2d7e 100644 --- a/include/revolution/axfx.h +++ b/include/revolution/axfx.h @@ -2,6 +2,7 @@ #define _REVOLUTION_AXFX_H_ #include <revolution/types.h> +#include <revolution/ax.h> #ifdef __cplusplus extern "C" { @@ -158,6 +159,9 @@ typedef struct AXFX_CHORUS { /* 0x98 */ u32 period; } AXFX_CHORUS; +typedef void* (*AXFXAllocFunc)(u32); +typedef void (*AXFXFreeFunc)(void*); + // chorus int AXFXChorusInit(AXFX_CHORUS* c); int AXFXChorusShutdown(AXFX_CHORUS* c); @@ -168,14 +172,13 @@ void AXFXChorusCallback(AXFX_BUFFERUPDATE* bufferUpdate, AXFX_CHORUS* chorus); void AXFXDelayCallback(AXFX_BUFFERUPDATE* bufferUpdate, AXFX_DELAY* delay); int AXFXDelaySettings(AXFX_DELAY* delay); int AXFXDelayInit(AXFX_DELAY* delay); -int AXFXDelayShutdown(AXFX_DELAY* delay); +int AXFXDelayShutdown(AXFX_DELAY* delay); // reverb_hi void DoCrossTalk(s32* l, s32* r, f32 cross, f32 invcross); int AXFXReverbHiInit(AXFX_REVERBHI* rev); int AXFXReverbHiShutdown(AXFX_REVERBHI* rev); int AXFXReverbHiSettings(AXFX_REVERBHI* rev); -void AXFXReverbHiCallback(AXFX_BUFFERUPDATE* bufferUpdate, AXFX_REVERBHI* reverb); // reverb_hi_4ch int AXFXReverbHiInitDpl2(AXFX_REVERBHI_DPL2* reverb); @@ -189,8 +192,23 @@ int AXFXReverbStdShutdown(AXFX_REVERBSTD* rev); int AXFXReverbStdSettings(AXFX_REVERBSTD* rev); void AXFXReverbStdCallback(AXFX_BUFFERUPDATE* bufferUpdate, AXFX_REVERBSTD* reverb); +void AXFXReverbHiCallback(void *data, void *context); +void AXGetAuxACallback(AXAuxCallback* cbOut, void** contextOut); +void AXFXSetHooks(AXFXAllocFunc alloc, AXFXFreeFunc free); +void AXFXGetHooks(AXFXAllocFunc* allocOut, AXFXFreeFunc* freeOut); +BOOL AXFXReverbHiInit(AXFX_REVERBHI* reverbHi); +BOOL AXFXReverbHiShutdown(AXFX_REVERBHI* reverbHi); +u16 AXGetAuxAReturnVolume(void); +u16 AXGetAuxBReturnVolume(void); +u16 AXGetAuxCReturnVolume(void); +void AXSetAuxAReturnVolume(u16 volume); +void AXSetAuxBReturnVolume(u16 volume); +void AXSetAuxCReturnVolume(u16 volume); +void AXSetMasterVolume(u16 volume); +u16 AXGetMasterVolume(void); + #ifdef __cplusplus } #endif -#endif // _REVOLUTION_AXFX_H_ +#endif // _REVOLUTION_AXFX_H_ diff --git a/include/revolution/card.h b/include/revolution/card.h new file mode 100644 index 0000000000..35c6e8b7d7 --- /dev/null +++ b/include/revolution/card.h @@ -0,0 +1,322 @@ +#ifndef _REVOLUTION_CARD_H_ +#define _REVOLUTION_CARD_H_ + +#include <revolution/os.h> +#include <revolution/dsp.h> +#include <revolution/dvd.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define CARD_FILENAME_MAX 32 +#define CARD_MAX_FILE 127 +#define CARD_ICON_MAX 8 + +typedef void (*CARDCallback)(s32 chan, s32 result); + +typedef struct CARDFileInfo { + s32 chan; + s32 fileNo; + s32 offset; + s32 length; + u16 iBlock; +} CARDFileInfo; + +typedef struct CARDDir { + u8 gameName[4]; + u8 company[2]; + u8 _padding0; + u8 bannerFormat; + u8 fileName[CARD_FILENAME_MAX]; + u32 time; // seconds since 01/01/2000 midnight + u32 iconAddr; // 0xffffffff if not used + u16 iconFormat; + u16 iconSpeed; + u8 permission; + u8 copyTimes; + u16 startBlock; + u16 length; + u8 _padding1[2]; + u32 commentAddr; // 0xffffffff if not used +} CARDDir; + +typedef struct CARDControl { + /* 0x000 */ BOOL attached; + /* 0x004 */ s32 result; + /* 0x008 */ u16 size; + /* 0x00A */ u16 pageSize; + /* 0x00C */ s32 sectorSize; + /* 0x010 */ u16 cBlock; + /* 0x012 */ u16 vendorID; + /* 0x014 */ s32 latency; + /* 0x018 */ u8 id[12]; + /* 0x024 */ int mountStep; + /* 0x028 */ int formatStep; + /* 0x028 */ u32 scramble; + /* 0x02C */ DSPTaskInfo task; + /* 0x080 */ void* workArea; + /* 0x084 */ CARDDir *currentDir; + /* 0x088 */ u16* currentFat; + /* 0x08C */ OSThreadQueue threadQueue; + /* 0x094 */ u8 cmd[9]; + /* 0x0A0 */ s32 cmdlen; + /* 0x0A4 */ volatile u32 mode; + /* 0x0A8 */ int retry; + /* 0x0AC */ int repeat; + /* 0x0B0 */ u32 addr; + /* 0x0B4 */ void* buffer; + /* 0x0B8 */ s32 xferred; + /* 0x0BC */ u16 freeNo; + /* 0x0BE */ u16 startBlock; + /* 0x0C0 */ CARDFileInfo* fileInfo; + /* 0x0C4 */ CARDCallback extCallback; + /* 0x0C8 */ CARDCallback txCallback; + /* 0x0CC */ CARDCallback exiCallback; + /* 0x0D0 */ CARDCallback apiCallback; + /* 0x0D4 */ CARDCallback xferCallback; + /* 0x0D8 */ CARDCallback eraseCallback; + /* 0x0DC */ CARDCallback unlockCallback; + /* 0x0E0 */ OSAlarm alarm; + /* 0x108 */ u32 cid; + /* 0x10C */ const DVDDiskID* diskID; +} CARDControl; + +typedef struct CARDDecParam { + /* 0x00 */ u8* inputAddr; + /* 0x04 */ u32 inputLength; + /* 0x08 */ u32 aramAddr; + /* 0x0C */ u8* outputAddr; +} CARDDecParam; + +typedef struct CARDID { + /* 0x000 */ u8 serial[32]; + /* 0x020 */ u16 deviceID; + /* 0x022 */ u16 size; + /* 0x024 */ u16 encode; + /* 0x026 */ u8 padding[470]; + /* 0x1FC */ u16 checkSum; + /* 0x1FE */ u16 checkSumInv; +} CARDID; + +typedef struct CARDDirCheck { + /* 0x00 */ u8 padding0[56]; + /* 0x38 */ u16 padding1; + /* 0x3A */ s16 checkCode; + /* 0x3C */ u16 checkSum; + /* 0x3E */ u16 checkSumInv; +} CARDDirCheck; + +typedef struct CARDStat { + /* 0x00 */ char fileName[CARD_FILENAME_MAX]; + /* 0x20 */ u32 length; + /* 0x24 */ u32 time; + /* 0x28 */ u8 gameName[4]; + /* 0x2C */ u8 company[2]; + /* 0x2E */ u8 bannerFormat; + /* 0x30 */ u32 iconAddr; + /* 0x34 */ u16 iconFormat; + /* 0x36 */ u16 iconSpeed; + /* 0x38 */ u32 commentAddr; + /* 0x3C */ u32 offsetBanner; + /* 0x40 */ u32 offsetBannerTlut; + /* 0x44 */ u32 offsetIcon[CARD_ICON_MAX]; + /* 0x64 */ u32 offsetIconTlut; + /* 0x68 */ u32 offsetData; +} CARDStat; + +#define CARD_ATTR_PUBLIC 0x04u +#define CARD_ATTR_NO_COPY 0x08u +#define CARD_ATTR_NO_MOVE 0x10u +#define CARD_ATTR_GLOBAL 0x20u +#define CARD_ATTR_COMPANY 0x40u + +#define CARD_FAT_AVAIL 0x0000u +#define CARD_FAT_CHECKSUM 0x0000u +#define CARD_FAT_CHECKSUMINV 0x0001u +#define CARD_FAT_CHECKCODE 0x0002u +#define CARD_FAT_FREEBLOCKS 0x0003u +#define CARD_FAT_LASTSLOT 0x0004u + +#define CARD_WORKAREA_SIZE (5 * 8 * 1024) + +#define CARD_SEG_SIZE 0x200u +#define CARD_PAGE_SIZE 0x80u +#define CARD_MAX_SIZE 0x01000000U + +#define CARD_NUM_SYSTEM_BLOCK 5 +#define CARD_SYSTEM_BLOCK_SIZE (8 * 1024u) + +#define CARD_MAX_MOUNT_STEP (CARD_NUM_SYSTEM_BLOCK + 2) + +#define CARD_STAT_SPEED_END 0 +#define CARD_STAT_SPEED_FAST 1 +#define CARD_STAT_SPEED_MIDDLE 2 +#define CARD_STAT_SPEED_SLOW 3 +#define CARD_STAT_SPEED_MASK 3 + +#define CARD_STAT_ANIM_LOOP 0 +#define CARD_STAT_ANIM_BOUNCE 4 +#define CARD_STAT_ANIM_MASK 0x4 + +#define CARD_RESULT_UNLOCKED 1 +#define CARD_RESULT_READY 0 +#define CARD_RESULT_BUSY -1 +#define CARD_RESULT_WRONGDEVICE -2 +#define CARD_RESULT_NOCARD -3 +#define CARD_RESULT_NOFILE -4 +#define CARD_RESULT_IOERROR -5 +#define CARD_RESULT_BROKEN -6 +#define CARD_RESULT_EXIST -7 +#define CARD_RESULT_NOENT -8 +#define CARD_RESULT_INSSPACE -9 +#define CARD_RESULT_NOPERM -10 +#define CARD_RESULT_LIMIT -11 +#define CARD_RESULT_NAMETOOLONG -12 +#define CARD_RESULT_ENCODING -13 +#define CARD_RESULT_CANCELED -14 +#define CARD_RESULT_FATAL_ERROR -128 + +#define CARDIsValidBlockNo(card, blockNo) ((blockNo) >= CARD_NUM_SYSTEM_BLOCK && (blockNo) < (card)->cBlock) + +#define CARD_READ_SIZE 512 +#define CARD_COMMENT_SIZE 64 + +#define CARD_ICON_WIDTH 32 +#define CARD_ICON_HEIGHT 32 + +#define CARD_BANNER_WIDTH 96 +#define CARD_BANNER_HEIGHT 32 + +#define CARD_STAT_ICON_NONE 0 +#define CARD_STAT_ICON_C8 1 +#define CARD_STAT_ICON_RGB5A3 2 +#define CARD_STAT_ICON_MASK 3 + +#define CARD_STAT_BANNER_NONE 0 +#define CARD_STAT_BANNER_C8 1 +#define CARD_STAT_BANNER_RGB5A3 2 +#define CARD_STAT_BANNER_MASK 3 + +#define CARD_ENCODE_ANSI 0 +#define CARD_ENCODE_SJIS 1 + +#define CARDGetDirCheck(dir) ((CARDDirCheck*)&(dir)[CARD_MAX_FILE]) +#define CARDGetBannerFormat(stat) (((stat)->bannerFormat) & CARD_STAT_BANNER_MASK) +#define CARDGetIconAnim(stat) (((stat)->bannerFormat) & CARD_STAT_ANIM_MASK) +#define CARDGetIconFormat(stat, n) (((stat)->iconFormat >> (2 * (n))) & CARD_STAT_ICON_MASK) +#define CARDGetIconSpeed(stat, n) (((stat)->iconSpeed >> (2 * (n))) & CARD_STAT_SPEED_MASK) +#define CARDSetBannerFormat(stat, f) \ + ((stat)->bannerFormat = (u8)(((stat)->bannerFormat & ~CARD_STAT_BANNER_MASK) | (f))) +#define CARDSetIconAnim(stat, f) \ + ((stat)->bannerFormat = (u8)(((stat)->bannerFormat & ~CARD_STAT_ANIM_MASK) | (f))) +#define CARDSetIconFormat(stat, n, f) \ + ((stat)->iconFormat = \ + (u16)(((stat)->iconFormat & ~(CARD_STAT_ICON_MASK << (2 * (n)))) | ((f) << (2 * (n))))) +#define CARDSetIconSpeed(stat, n, f) \ + ((stat)->iconSpeed = \ + (u16)(((stat)->iconSpeed & ~(CARD_STAT_SPEED_MASK << (2 * (n)))) | ((f) << (2 * (n))))) +#define CARDSetIconAddress(stat, addr) ((stat)->iconAddr = (u32)(addr)) +#define CARDSetCommentAddress(stat, addr) ((stat)->commentAddr = (u32)(addr)) +#define CARDGetFileNo(fileInfo) ((fileInfo)->fileNo) + +extern u32 __CARDFreq; + +#if DEBUG +#define CARDFreq __CARDFreq +#else +#define CARDFreq EXI_FREQ_16M +#endif + +void CARDInit(void); +s32 CARDGetResultCode(s32 chan); +s32 CARDCheckAsync(s32 chan, CARDCallback callback); +s32 CARDFreeBlocks(s32 chan, s32* byteNotUsed, s32* filesNotUsed); +s32 CARDRenameAsync(s32 chan, const char* oldName, const char* newName, CARDCallback callback); + +// CARDBios +void CARDInit(void); +s32 CARDGetResultCode(s32 chan); +s32 CARDFreeBlocks(s32 chan, s32* byteNotUsed, s32* filesNotUsed); +s32 CARDGetEncoding(s32 chan, u16* encode); +s32 CARDGetMemSize(s32 chan, u16* size); +s32 CARDGetSectorSize(s32 chan, u32* size); +const DVDDiskID* CARDGetDiskID(s32 chan); +s32 CARDSetDiskID(s32 chan, const DVDDiskID* diskID); +BOOL CARDSetFastMode(BOOL enable); +BOOL CARDGetFastMode(void); +s32 CARDGetCurrentMode(s32 chan, u32* mode); + +// CARDCheck +s32 CARDCheckExAsync(s32 chan, s32* xferBytes, CARDCallback callback); +s32 CARDCheckAsync(s32 chan, CARDCallback callback); +s32 CARDCheckEx(s32 chan, s32* xferBytes); +s32 CARDCheck(s32 chan); + +// CARDCreate +s32 CARDCreateAsync(s32 chan, const char* fileName, u32 size, CARDFileInfo* fileInfo, CARDCallback callback); +s32 CARDCreate(s32 chan, const char* fileName, u32 size, CARDFileInfo* fileInfo); + +// CARDDelete +s32 CARDFastDeleteAsync(s32 chan, s32 fileNo, CARDCallback callback); +s32 CARDFastDelete(s32 chan, s32 fileNo); +s32 CARDDeleteAsync(s32 chan, const char* fileName, CARDCallback callback); +s32 CARDDelete(s32 chan, const char* fileName); + +// CARDErase +s32 CARDEraseAsync(CARDFileInfo* fileInfo, s32 length, s32 offset, CARDCallback callback); +s32 CARDErase(CARDFileInfo* fileInfo, s32 length, s32 offset); + +// CARDFormat +s32 CARDFormat(s32 chan); + +// CARDMount +int CARDProbe(s32 chan); +s32 CARDProbeEx(s32 chan, s32* memSize, s32* sectorSize); +s32 CARDMountAsync(s32 chan, void* workArea, CARDCallback detachCallback, CARDCallback attachCallback); +s32 CARDMount(s32 chan, void* workArea, CARDCallback detachCallback); +s32 CARDUnmount(s32 chan); + +// CARDNet +u16 CARDSetVendorID(u16 vendorID); +u16 CARDGetVendorID(); +s32 CARDGetSerialNo(s32 chan, u64* serialNo); +s32 CARDGetUniqueCode(s32 chan, u64* uniqueCode); +s32 CARDGetAttributes(s32 chan, s32 fileNo, u8* attr); +s32 CARDSetAttributesAsync(s32 chan, s32 fileNo, u8 attr, CARDCallback callback); +s32 CARDSetAttributes(s32 chan, s32 fileNo, u8 attr); + +// CARDOpen +s32 CARDFastOpen(s32 chan, s32 fileNo, CARDFileInfo* fileInfo); +s32 CARDOpen(s32 chan, const char* fileName, CARDFileInfo* fileInfo); +s32 CARDClose(CARDFileInfo* fileInfo); + +// CARDProgram +s32 CARDProgramAsync(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset, CARDCallback callback); +s32 CARDProgram(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset); + +// CARDRdwr +s32 CARDGetXferredBytes(s32 chan); + +// CARDRead +s32 CARDReadAsync(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset, CARDCallback callback); +s32 CARDRead(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset); +s32 CARDCancel(CARDFileInfo* fileInfo); + +// CARDRename +s32 CARDRename(s32 chan, const char* oldName, const char* newName); + +// CARDStat +s32 CARDGetStatus(s32 chan, s32 fileNo, CARDStat* stat); +s32 CARDSetStatusAsync(s32 chan, s32 fileNo, CARDStat* stat, CARDCallback callback); +s32 CARDSetStatus(s32 chan, s32 fileNo, CARDStat* stat); + +// CARDWrite +s32 CARDWriteAsync(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset, CARDCallback callback); +s32 CARDWrite(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/revolution/hbm.h b/include/revolution/hbm.h index ac3a34b0bf..f5fa0e28e7 100644 --- a/include/revolution/hbm.h +++ b/include/revolution/hbm.h @@ -2,10 +2,14 @@ #define _REVOLUTION_HBM_H_ #include <revolution/kpad.h> +#include <revolution/mem.h> #ifdef __cplusplus extern "C" { #endif + +#define NW4HBM_VERSION(major, minor) ((major & 0xFF) << 8 | minor & 0xFF) + typedef enum HBMSelectBtnNum { HBM_SELECT_NULL = -1, @@ -18,8 +22,45 @@ typedef enum HBMSelectBtnNum { HBM_SELECT_MAX } HBMSelectBtnNum; -// TODO: move this later -typedef struct MEMAllocator MEMAllocator; +enum HBMSoundEvent_et { + HBM_SOUND_EVENT_0, // StartInitSound? and then num would not matter + HBM_SOUND_EVENT_1, // EndInitSound? and then num would not matter + HBM_SOUND_EVENT_2, // Fadeout, num = ms? see calc_fadeoutAnm + HBM_SOUND_EVENT_3, // Blackout, num = ms? from various + HBM_SOUND_EVENT_4, // ShutdownSound? and then num would not matter + HBM_SOUND_EVENT_PLAY, /* num = HBMSound_et (see below) */ +}; + +enum HBMSound_et { + HBM_SOUND_HOME_BUTTON, + HBM_SOUND_RETURN_APP, + HBM_SOUND_GOTO_MENU, + HBM_SOUND_RESET_APP, + HBM_SOUND_FOCUS, + HBM_SOUND_SELECT, + HBM_SOUND_CANCEL, + HBM_SOUND_OPEN_CONTROLLER, + HBM_SOUND_CLOSE_CONTROLLER, + HBM_SOUND_VOLUME_PLUS, + HBM_SOUND_VOLUME_MINUS, + HBM_SOUND_VOLUME_PLUS_LIMIT, + HBM_SOUND_VOLUME_MINUS_LIMIT, + HBM_SOUND_NOTHING_DONE, + HBM_SOUND_VIBE_ON, + HBM_SOUND_VIBE_OFF, + HBM_SOUND_START_CONNECT_WINDOW, + HBM_SOUND_CONNECTED1, + HBM_SOUND_CONNECTED2, + HBM_SOUND_CONNECTED3, + HBM_SOUND_CONNECTED4, + HBM_SOUND_END_CONNECT_WINDOW, + HBM_SOUND_MANUAL_OPEN, + HBM_SOUND_MANUAL_FOCUS, + HBM_SOUND_MANUAL_SELECT, + HBM_SOUND_MANUAL_SCROLL, + HBM_SOUND_MANUAL_CANCEL, + HBM_SOUND_MANUAL_RETURN_APP +}; typedef int HBMSoundCallback(int evt, int num); typedef struct HBMDataInfo { @@ -32,11 +73,11 @@ typedef struct HBMDataInfo { /* 0x18 */ int backFlag; /* 0x1C */ int region; /* 0x20 */ int cursor; - /* 0x24 */ u32 memSize; - /* 0x28 */ f32 frameDelta; - /* 0x2C */ Vec2 adjust; - /* 0x34 */ MEMAllocator* pAllocator; -} HBMDataInfo; // size 0x38 + /* 0x28 */ u32 memSize; + /* 0x2C */ f32 frameDelta; + /* 0x30 */ Vec2 adjust; + /* 0x38 */ MEMAllocator* pAllocator; +} HBMDataInfo; // size 0x3C typedef struct HBMKPadData { KPADStatus* kpad; diff --git a/include/revolution/mem.h b/include/revolution/mem.h new file mode 100644 index 0000000000..e93eb1a95c --- /dev/null +++ b/include/revolution/mem.h @@ -0,0 +1,8 @@ +#ifndef _REVOLUTION_MEM_H_ +#define _REVOLUTION_MEM_H_ + +#include <revolution/mem/allocator.h> +#include <revolution/mem/expHeap.h> +#include <revolution/mem/heapCommon.h> + +#endif // _REVOLUTION_MEM_H_ diff --git a/include/revolution/mem/allocator.h b/include/revolution/mem/allocator.h new file mode 100644 index 0000000000..1f4e933fec --- /dev/null +++ b/include/revolution/mem/allocator.h @@ -0,0 +1,37 @@ +#ifndef _REVOLUTION_MEM_ALLOCATOR_H_ +#define _REVOLUTION_MEM_ALLOCATOR_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <revolution/mem/heapCommon.h> +#include <revolution/types.h> + +typedef struct MEMAllocator MEMAllocator; +typedef void* (*MEMFuncAllocatorAlloc)(MEMAllocator* pAllocator, u32 size); +typedef void (*MEMFuncAllocatorFree)(MEMAllocator* pAllocator, void* memBlock); +typedef struct MEMAllocatorFunc MEMAllocatorFunc; + +struct MEMAllocatorFunc { + MEMFuncAllocatorAlloc pfAlloc; + MEMFuncAllocatorFree pfFree; +}; + +struct MEMAllocator { + const MEMAllocatorFunc* pFunc; + void* pHeap; + u32 heapParam1; + u32 heapParam2; +}; + +void* MEMAllocFromAllocator(MEMAllocator*, u32); +void MEMFreeToAllocator(MEMAllocator*, void*); +void MEMInitAllocatorForExpHeap(MEMAllocator*, MEMHeapHandle, int); +void MEMInitAllocatorForFrmHeap(MEMAllocator* allocator, struct MEMiHeapHead* heap, s32 align); + +#ifdef __cplusplus +} +#endif + +#endif // _REVOLUTION_MEM_ALLOCATOR_H_ diff --git a/include/revolution/mem/expHeap.h b/include/revolution/mem/expHeap.h new file mode 100644 index 0000000000..2d811ad2fa --- /dev/null +++ b/include/revolution/mem/expHeap.h @@ -0,0 +1,50 @@ +#ifndef _REVOLUTION_MEM_EXPHEAP_H_ +#define _REVOLUTION_MEM_EXPHEAP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <revolution/mem/heapCommon.h> + +typedef struct MEMiExpHeapMBlockHead MEMiExpHeapMBlockHead; + +struct MEMiExPheapMBlockHead { + u16 signature; + + union { + u16 val; + + struct { + u16 allocDir : 1; + u16 alignment : 7; + u16 groupID : 8; + } fields; + } attribute; + + u32 blockSize; + MEMiExpHeapMBlockHead* prev; + MEMiExpHeapMBlockHead* next; +}; + +MEMHeapHandle MEMCreateExpHeapEx(void*, u32, u16); +void* MEMDestroyExpHeap(MEMHeapHandle); +void* MEMAllocFromExpHeapEx(MEMHeapHandle, u32, int); +void MEMFreeToExpHeap(MEMHeapHandle, void*); +u32 MEMGetAllocatableSizeForExpHeapEx(MEMHeapHandle, int); +MEMHeapHandle MEMCreateFrmHeapEx(void* start, u32 size, u16 opt); +MEMHeapHandle MEMDestroyFrmHeap(MEMHeapHandle heap); + +static inline MEMHeapHandle MEMCreateExpHeap(void* start, u32 size) { + return MEMCreateExpHeapEx(start, size, 0); +} + +static inline void* MEMAllocFromExpHeap(MEMHeapHandle heap, u32 size) { + return MEMAllocFromExpHeapEx(heap, size, 4); +} + +#ifdef __cplusplus +} +#endif + +#endif // _REVOLUTION_MEM_EXPHEAP_H_ diff --git a/include/revolution/mem/heapCommon.h b/include/revolution/mem/heapCommon.h new file mode 100644 index 0000000000..5c156348a6 --- /dev/null +++ b/include/revolution/mem/heapCommon.h @@ -0,0 +1,43 @@ +#ifndef _REVOLUTION_MEM_HEAPCOMMON_H_ +#define _REVOLUTION_MEM_HEAPCOMMON_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <revolution/mem/list.h> +#include <revolution/os.h> + +typedef struct MEMiHeapHead MEMiHeapHead; + +struct MEMiHeapHead { + u32 signature; + MEMLink link; + MEMList childList; + void* heapStart; + void* heapEnd; + OSMutex mutex; + + union { + u32 val; + + struct { + u32 reserved : 24; + u32 optFlag : 8; + } fields; + } attribute; +}; + +typedef MEMiHeapHead* MEMHeapHandle; + +typedef u32 UIntPtr; + +static inline UIntPtr GetUIntPtr(const void* ptr) { + return (UIntPtr)(ptr); +} + +#ifdef __cplusplus +} +#endif + +#endif // _REVOLUTION_MEM_HEAPCOMMON_H_ diff --git a/include/revolution/mem/list.h b/include/revolution/mem/list.h new file mode 100644 index 0000000000..9a713a6814 --- /dev/null +++ b/include/revolution/mem/list.h @@ -0,0 +1,31 @@ +#ifndef _REVOLUTION_MEM_LIST_H_ +#define _REVOLUTION_MEM_LIST_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <revolution/types.h> + +typedef struct { + void* prev; + void* next; +} MEMLink; + +typedef struct { + void* head; + void* tail; + u16 num; + u16 offs; +} MEMList; + +void MEMInitList(MEMList*, u16); +void MEMAppendListObject(MEMList*, void*); +void MEMRemoveListObject(MEMList*, void*); +void* MEMGetNextListObject(MEMList*, void*); + +#ifdef __cplusplus +} +#endif + +#endif // _REVOLUTION_MEM_LIST_H_ diff --git a/include/revolution/mtx.h b/include/revolution/mtx.h index b6687e0c52..38a4adebec 100644 --- a/include/revolution/mtx.h +++ b/include/revolution/mtx.h @@ -11,6 +11,8 @@ typedef struct Vec { f32 x, y, z; } Vec, *VecPtr, Point3d, *Point3dPtr; +typedef const VecPtr CVecPtr; + typedef struct { s16 x, y, z; } S16Vec, *S16VecPtr; diff --git a/include/revolution/os.h b/include/revolution/os.h index 62603a97aa..c2b6248f20 100644 --- a/include/revolution/os.h +++ b/include/revolution/os.h @@ -320,46 +320,98 @@ extern BOOL __OSInReboot; #define ASSERT(cond) ASSERTLINE(__LINE__, cond) -inline s16 __OSf32tos16(__REGISTER f32 inF) { -#ifdef __MWERKS__ - register s16 out; - u32 tmp; - register u32* tmpPtr = &tmp; - // clang-format off +static inline u8 __OSf32tou8(register f32 in) { + f32 a; + register f32* ptr = &a; + u8 r; - asm { - psq_st inF, 0(tmpPtr), 0x1, 5 - lha out, 0(tmpPtr) - } +#if defined(__MWERKS__) + asm { psq_st in, 0(ptr), 1, 2 }; +#else +# pragma unused(in) +#endif - // clang-format on - return out; + r = *(u8 *)ptr; + + return r; +} + +static inline u16 __OSf32tou16(register f32 in) { + f32 a; + register f32* ptr = &a; + u16 r; + +#if defined(__MWERKS__) + asm { psq_st in, 0(ptr), 1, 3 }; +#else +# pragma unused(in) #endif + + r = *(u16 *)ptr; + + return r; } -inline void OSf32tos16(f32* f, s16* out) { - *out = __OSf32tos16(*f); +static inline s16 __OSf32tos16(register f32 in) { + f32 a; + register f32* ptr = &a; + s16 r; + +#if defined(__MWERKS__) + asm { psq_st in, 0(ptr), 1, 5 }; +#else +# pragma unused(in) +#endif + + r = *(s16*)ptr; + + return r; } -inline u8 __OSf32tou8(__REGISTER f32 inF) { -#ifdef __MWERKS__ - register u8 out; - u32 tmp; - register u32* tmpPtr = &tmp; - // clang-format off +static inline f32 __OSu16tof32(register u16 const* arg) { + register f32 ret; - asm { - psq_st inF, 0(tmpPtr), 0x1, 2 - lbz out, 0(tmpPtr) - } +#if defined(__MWERKS__) + asm { psq_l ret, 0(arg), 1, 3 }; +#else +# pragma unused(arg) + ret = 0; +#endif - // clang-format on - return out; + return ret; +} + +static inline f32 __OSs16tof32(register s16 const* arg) { + register f32 ret; + +#if defined(__MWERKS__) + asm { psq_l ret, 0(arg), 1, 5 }; +#else +# pragma unused(arg) + ret = 0; #endif + + return ret; +} + +static inline void OSf32tou8(f32 const* in, u8* out) { + *out = __OSf32tou8(*in); +} + +static inline void OSf32tou16(f32 const* in, u16* out) { + *out = __OSf32tou16(*in); +} + +static inline void OSf32tos16(f32 const* in, s16* out) { + *out = __OSf32tos16(*in); +} + +static inline void OSs16tof32(s16 const* in, f32* out) { + *out = __OSs16tof32(in); } -inline void OSf32tou8(f32* f, u8* out) { - *out = __OSf32tou8(*f); +static inline void OSu16tof32(u16 const* in, f32* out) { + *out = __OSu16tof32(in); } static inline void OSInitFastCast(void) { diff --git a/include/revolution/tpl.h b/include/revolution/tpl.h new file mode 100644 index 0000000000..aabc59d469 --- /dev/null +++ b/include/revolution/tpl.h @@ -0,0 +1,52 @@ +#ifndef _REVOLUTION_TPL_H_ +#define _REVOLUTION_TPL_H_ + +#include <revolution/gx.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + u16 numEntries; + u8 unpacked; + u8 _4; + GXTlutFmt format; + char* data; +} TPLClutHeader, *TPLClutHeaderPtr; + +typedef struct { + u16 height; + u16 width; + u32 format; + char* data; + GXTexWrapMode wrapS; + GXTexWrapMode wrapT; + GXTexFilter minFilter; + GXTexFilter magFilter; + f32 LODBias; + u8 edgeLODEnable; + u8 minLOD; + u8 maxLOD; + u8 unpacked; +} TPLHeader, *TPLHeaderPtr; + +typedef struct { + TPLHeaderPtr textureHeader; + TPLClutHeaderPtr CLUTHeader; +} TPLDescriptor, *TPLDescriptorPtr; + +typedef struct { + u32 versionNumber; + u32 numDescriptors; + TPLDescriptorPtr descriptorArray; +} TPLPalette, *TPLPalettePtr; + +void TPLBind(TPLPalettePtr); +TPLDescriptorPtr TPLGet(TPLPalettePtr, u32); + +#ifdef __cplusplus +} +#endif + +#endif // _REVOLUTION_TPL_H_ diff --git a/include/revolution/wenc.h b/include/revolution/wenc.h index 39b9180977..d3c8117c09 100644 --- a/include/revolution/wenc.h +++ b/include/revolution/wenc.h @@ -11,15 +11,9 @@ typedef enum { WENC_FLAG_USER_INFO = (1 << 0), } WENCFlag; -typedef struct WENCInfo { - /* 0x00 */ s32 xn; - /* 0x04 */ s32 dl; - /* 0x08 */ s32 qn; - /* 0x0C */ s32 dn; - /* 0x10 */ s32 dlh; - /* 0x14 */ s32 dlq; - /* 0x18 */ u8 padding[8]; -} WENCInfo; +typedef struct { + u8 data[32]; +} WENCInfo; // size 0x20 s32 WENCGetEncodeData(WENCInfo* info, u32 flag, const s16* pcmData, s32 samples, u8* adpcmData); diff --git a/include/revolution/wpad.h b/include/revolution/wpad.h index 2e7456e3e6..82f259b95b 100644 --- a/include/revolution/wpad.h +++ b/include/revolution/wpad.h @@ -2,6 +2,7 @@ #define _REVOLUTION_WPAD_H_ #include <revolution/types.h> +#include <revolution/sc.h> #ifdef __cplusplus extern "C" { @@ -21,6 +22,22 @@ extern "C" { #define WPAD_BUTTON_C 0x4000 #define WPAD_BUTTON_HOME 0x8000 +#define WPAD_BUTTON_CL_UP (1 << 0) +#define WPAD_BUTTON_CL_LEFT (1 << 1) +#define WPAD_BUTTON_CL_ZR (1 << 2) +#define WPAD_BUTTON_CL_X (1 << 3) +#define WPAD_BUTTON_CL_A (1 << 4) +#define WPAD_BUTTON_CL_Y (1 << 5) +#define WPAD_BUTTON_CL_B (1 << 6) +#define WPAD_BUTTON_CL_ZL (1 << 7) +#define WPAD_BUTTON_CL_FULL_R (1 << 9) +#define WPAD_BUTTON_CL_PLUS (1 << 10) +#define WPAD_BUTTON_CL_HOME (1 << 11) +#define WPAD_BUTTON_CL_MINUS (1 << 12) +#define WPAD_BUTTON_CL_FULL_L (1 << 13) +#define WPAD_BUTTON_CL_DOWN (1 << 14) +#define WPAD_BUTTON_CL_RIGHT (1 << 15) + #define WPAD_MAX_DPD_OBJECTS 4 #define WPAD_CHAN0 0 @@ -62,11 +79,44 @@ enum WPADResult_et { #define WPAD_CE6 (WPAD_E6 + 0) #define WPAD_CEBADE (WPAD_EBADE + 0) -typedef void WPADInitFunc(void); -typedef void WPADCallback(s32 chan, s32 result); -typedef void WPADExtensionCallback(s32 chan, s32 devType); -typedef void WPADSamplingCallback(s32 chan); -typedef void WPADConnectCallback(s32 chan, s32 result); +#define WPAD_DEV_CORE 0 +#define WPAD_DEV_FS 1 +#define WPAD_DEV_CLASSIC 2 +#define WPAD_DEV_BALANCE_CHECKER 3 +#define WPAD_DEV_VSM 4 +#define WPAD_DEV_MOTION_PLUS 5 +#define WPAD_DEV_MPLS_PT_FS 6 +#define WPAD_DEV_MPLS_PT_CLASSIC 7 + +#define WPAD_DEV_TRAIN 16 +#define WPAD_DEV_GUITAR 17 +#define WPAD_DEV_DRUM 18 +#define WPAD_DEV_TAIKO 19 +#define WPAD_DEV_TURNTABLE 20 + +// seems to be like maybe general purpose non-specific device types +// maybe this was for testing or something? idk +#define WPAD_DEV_BULK_1 21 +#define WPAD_DEV_BULK_2 22 +#define WPAD_DEV_BULK_3 23 +#define WPAD_DEV_BULK_4 24 +#define WPAD_DEV_BULK_5 25 +#define WPAD_DEV_BULK_6 26 +#define WPAD_DEV_BULK_7 27 +#define WPAD_DEV_BULK_8 28 + +#define WPAD_DEV_MPLS_PT_UNKNOWN 250 +#define WPAD_DEV_251 251 +#define WPAD_DEV_252 252 // invalid device mode? +#define WPAD_DEV_NONE 253 // sort of like WPAD_ENODEV (see __wpadAbortInitExtension in WPADHIDParser.c) +#define WPAD_DEV_INITIALIZING 255 // see __a1_20_status_report + +typedef void (*WPADInitFunc)(void); +typedef void (*WPADCallback)(s32 chan, s32 result); +typedef void (*WPADExtensionCallback)(s32 chan, s32 devType); +typedef void (*WPADSamplingCallback)(s32 chan); +typedef void (*WPADConnectCallback)(s32 chan, s32 result); +typedef void (*WPADSimpleSyncCallback)(s32 result, s32 num); typedef struct DPDObject { /* 0x00 */ s16 x; @@ -264,14 +314,33 @@ typedef struct WPADInfo { #define WPAD_SPEAKER_PLAY 4 #define WPAD_SPEAKER_CMD_05 5 // does the same thing as ENABLE? unless i'm missing something. not used so i don't know the context +#define WPAD_MOTOR_STOP 0 +#define WPAD_MOTOR_RUMBLE 1 + s32 WPADProbe(s32 chan, u32* devType); u8 WPADGetRadioSensitivity(s32 chan); void WPADRead(s32 chan, WPADStatus* status); BOOL WPADIsSpeakerEnabled(s32 chan); -s32 WPADControlSpeaker(s32 chan, u32 command, WPADCallback* cb); +s32 WPADControlSpeaker(s32 chan, u32 command, WPADCallback cb); s32 WPADSendStreamData(s32 chan, void* p_buf, u16 len); -WPADExtensionCallback* WPADSetExtensionCallback(s32 chan, WPADExtensionCallback* cb); +WPADConnectCallback WPADSetConnectCallback(s32 chan, WPADConnectCallback cb); +WPADExtensionCallback WPADSetExtensionCallback(s32 chan, WPADExtensionCallback cb); +WPADSimpleSyncCallback WPADSetSimpleSyncCallback(WPADSimpleSyncCallback cb); + +BOOL WPADIsUsedCallbackByKPAD(void); +void WPADSetCallbackByKPAD(BOOL isKPAD); +s32 WPADGetInfoAsync(s32 chan, WPADInfo* info, WPADCallback cb); +void WPADControlMotor(s32 chan, u32 command); +BOOL WPADCanSendStreamData(s32 chan); +BOOL WPADStopSimpleSync(void); +void WPADDisconnect(s32 chan); +BOOL WPADStartFastSimpleSync(void); +BOOL WPADSaveConfig(SCFlushCallback* cb); +void WPADSetSpeakerVolume(u8 volume); +u8 WPADGetSpeakerVolume(void); +void WPADEnableMotor(BOOL enabled); +BOOL WPADIsMotorEnabled(void); #ifdef __cplusplus } |
