├── share ├── rpl.specs └── wut.specs ├── include ├── avm │ ├── avm.dox │ └── drc.h ├── dmae │ ├── dmae.dox │ ├── sync.h │ └── mem.h ├── nsysuhs │ └── nsysuhs.dox ├── gx2 │ ├── gx2.dox │ ├── temp.h │ ├── mem.h │ ├── state.h │ ├── tessellation.h │ ├── utils.h │ ├── swap.h │ ├── displaylist.h │ ├── texture.h │ ├── clear.h │ ├── display.h │ ├── draw.h │ ├── event.h │ ├── context.h │ └── sampler.h ├── wut_rplwrap.h ├── sys │ ├── ioctl.h │ ├── select.h │ ├── filio.h │ └── ioccom.h ├── nn │ ├── nn.dox │ ├── act.h │ ├── pdm.h │ ├── swkbd.h │ ├── acp.h │ ├── ac.h │ ├── acp │ │ ├── nn_acp_types.h │ │ ├── device.h │ │ └── save.h │ └── pdm │ │ └── pdm_c.h ├── nsysnet │ ├── nsysnet.dox │ ├── socket.h │ └── _netdb.h ├── nsyshid │ └── nsyshid.dox ├── padscore │ └── padscore.dox ├── sndcore2 │ ├── sndcore2.dox │ ├── result.h │ ├── core.h │ ├── device.h │ └── drcvs.h ├── gx2r │ ├── gx2r.dox │ ├── mem.h │ ├── displaylist.h │ ├── draw.h │ ├── surface.h │ └── buffer.h ├── vpad │ └── vpad.dox ├── swkbd │ └── swkbd.dox ├── sysapp │ └── sysapp.dox ├── proc_ui │ └── procui.dox ├── netinet │ ├── tcp.h │ └── in.h ├── coreinit │ ├── coreinit.dox │ ├── internal.h │ ├── title.h │ ├── exit.h │ ├── foreground.h │ ├── fiber.h │ ├── rendezvous.h │ ├── systeminfo.h │ ├── energysaver.h │ ├── fastcondition.h │ ├── core.h │ ├── cosreport.h │ ├── atomic.h │ ├── spinlock.h │ ├── memdefaultheap.h │ ├── coroutine.h │ ├── threadqueue.h │ ├── atomic64.h │ ├── fastmutex.h │ ├── memunitheap.h │ ├── memlist.h │ ├── exception.h │ ├── debug.h │ └── condition.h ├── wut.h ├── poll.h ├── wut_types.h ├── arpa │ └── inet.h ├── curl │ └── stdcheaders.h └── wut_structsize.h ├── samples ├── cmake │ ├── custom_default_heap │ │ ├── exports.def │ │ └── CMakeLists.txt │ ├── my_first_rpl │ │ ├── exports.def │ │ ├── my_first_rpl.h │ │ ├── my_first_rpl.c │ │ ├── my_first_rpx.c │ │ └── CMakeLists.txt │ ├── content │ │ ├── pos_col_shader.gsh │ │ ├── README.txt │ │ ├── pos_col_shader.psh │ │ └── pos_col_shader.vsh │ ├── swkbd │ │ └── CMakeLists.txt │ ├── helloworld │ │ ├── CMakeLists.txt │ │ └── main.c │ ├── gx2_triangle │ │ └── CMakeLists.txt │ ├── helloworld_cpp │ │ ├── CMakeLists.txt │ │ └── main.cpp │ ├── curl │ │ └── CMakeLists.txt │ └── CMakeLists.txt └── make │ ├── Makefile │ ├── helloworld │ └── source │ │ └── main.c │ └── helloworld_cpp │ └── source │ └── main.cpp ├── cafe ├── nsysuvd.def ├── uvc.def ├── uac.def ├── mic.def ├── nio_prof.def ├── camera.def ├── dmae.def ├── usb_mic.def ├── nn_nets2.def ├── uvd.def ├── uac_rpl.def ├── nn_aoc.def ├── nsyshid.def ├── nn_hpad.def ├── nlibnss2.def ├── nlibnss.def ├── h264.def ├── proc_ui.def ├── nn_hai.def ├── nfc.def ├── nn_idbe.def ├── ntag.def ├── nn_temp.def ├── nn_cmpt.def ├── nn_vctl.def ├── nsysuhs.def ├── erreula.def ├── nn_ndm.def ├── dc.def ├── nsyskbd.def ├── tcl.def ├── lzma920.def ├── nlibcurl.def ├── vpadbase.def ├── tve.def ├── swkbd.def ├── nn_spm.def ├── drmapp.def ├── nn_pdm.def ├── nn_ccr.def ├── vpad.def ├── nn_save.def └── nn_dlp.def ├── libraries ├── libwhb │ ├── src │ │ ├── libmanager.c │ │ ├── log_cafe.c │ │ ├── gfx_heap.h │ │ ├── log_udp.c │ │ ├── gfx_texture.c │ │ └── sdcard.c │ └── include │ │ └── whb │ │ ├── crash.h │ │ ├── align.h │ │ ├── log_udp.h │ │ ├── log_cafe.h │ │ ├── sdcard.h │ │ ├── proc.h │ │ ├── libmanager.h │ │ ├── log_console.h │ │ ├── log.h │ │ └── file.h ├── wutsocket │ ├── inet_addr.c │ ├── inet_pton.c │ ├── wut_socket_close.c │ ├── wut_socket_open.c │ ├── inet_ntop.c │ ├── listen.c │ ├── shutdown.c │ ├── wut_socket_read.c │ ├── wut_socket_write.c │ ├── bind.c │ ├── recv.c │ ├── send.c │ ├── connect.c │ ├── getpeername.c │ ├── getsockname.c │ ├── sockatmark.c │ ├── hostid.c │ ├── getsockopt.c │ ├── setsockopt.c │ ├── sendto.c │ ├── recvfrom.c │ ├── socket.c │ ├── stubs.c │ ├── accept.c │ ├── wut_socket.h │ ├── host.c │ ├── addrinfo.c │ ├── NSSLCreateConnection.c │ ├── fcntl.c │ ├── ioctl.c │ └── poll.c ├── wutdevoptab │ ├── devoptab_fs_link.c │ ├── devoptab_fs_getmtime.c │ ├── devoptab_fs_fchmod.c │ ├── devoptab_fs_statvfs.c │ ├── devoptab_fs_close.c │ ├── devoptab_fs_fsync.c │ ├── devoptab_fs_dirclose.c │ ├── devoptab_fs_dirreset.c │ ├── devoptab_fs_rmdir.c │ ├── devoptab_fs_chdir.c │ ├── devoptab_fs_unlink.c │ ├── devoptab_fs_chmod.c │ ├── devoptab_fs_mkdir.c │ ├── devoptab_fs_fstat.c │ ├── devoptab_fs_truncate.c │ ├── devoptab_fs_diropen.c │ ├── devoptab_fs_rename.c │ ├── devoptab_fs_dirnext.c │ ├── devoptab_fs_stat.c │ ├── devoptab_fs_open.c │ ├── devoptab_fs_seek.c │ └── devoptab_fs_utils.c ├── wutcrt │ ├── crt0_rpx.s │ ├── crt0_rpl.s │ └── wut_crt.c ├── wutnewlib │ ├── wut_malloc_lock.c │ ├── wut_nanosleep.c │ ├── wut_gettod_r.c │ ├── wut_clock.h │ ├── wut_newlib.c │ ├── wut_lock.c │ ├── wut_newlib.h │ ├── wut_clock.c │ └── wut_sbrk.c └── wutstdc++ │ ├── wut_gthread_mutex.cpp │ ├── wut_gthread_recursive_mutex.cpp │ └── wut_gthread_once.cpp ├── tests ├── test_compile_headers_as_c11 │ ├── main.c │ └── CMakeLists.txt ├── test_compile_headers_as_c99 │ ├── main.c │ └── CMakeLists.txt ├── test_compile_headers_as_cpp │ ├── main.cpp │ └── CMakeLists.txt └── CMakeLists.txt ├── .gitignore ├── docs ├── mainpage.dox └── CMakeLists.txt ├── .editorconfig └── .github └── workflows └── ci.yml /share/rpl.specs: -------------------------------------------------------------------------------- 1 | *wut_entry: 2 | --entry=__rpl_start 3 | -------------------------------------------------------------------------------- /include/avm/avm.dox: -------------------------------------------------------------------------------- 1 | /** 2 | * \defgroup avm avm 3 | * 4 | * AVM 5 | */ 6 | -------------------------------------------------------------------------------- /samples/cmake/custom_default_heap/exports.def: -------------------------------------------------------------------------------- 1 | :TEXT 2 | __preinit_user 3 | -------------------------------------------------------------------------------- /include/dmae/dmae.dox: -------------------------------------------------------------------------------- 1 | /** 2 | * \defgroup dmae dmae 3 | * DMA Engine. 4 | */ 5 | -------------------------------------------------------------------------------- /include/nsysuhs/nsysuhs.dox: -------------------------------------------------------------------------------- 1 | /** 2 | * \defgroup nsysuhs nsysuhs 3 | * 4 | */ 5 | -------------------------------------------------------------------------------- /include/gx2/gx2.dox: -------------------------------------------------------------------------------- 1 | /** 2 | * \defgroup gx2 gx2 3 | * Graphics driver. 4 | */ 5 | -------------------------------------------------------------------------------- /include/wut_rplwrap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define RPLWRAP(func) __rplwrap_##func 4 | -------------------------------------------------------------------------------- /cafe/nsysuvd.def: -------------------------------------------------------------------------------- 1 | :NAME nsysuvd 2 | 3 | :TEXT 4 | UVD_Func1 5 | UVD_Func2 6 | UVD_RootRun 7 | -------------------------------------------------------------------------------- /samples/cmake/my_first_rpl/exports.def: -------------------------------------------------------------------------------- 1 | :NAME my_first_rpl 2 | 3 | :TEXT 4 | my_first_export 5 | -------------------------------------------------------------------------------- /include/sys/ioctl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | -------------------------------------------------------------------------------- /include/nn/nn.dox: -------------------------------------------------------------------------------- 1 | /** 2 | * \defgroup nn nn 3 | * Helper functions and classes for other APIs 4 | */ 5 | -------------------------------------------------------------------------------- /include/sys/select.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define FD_SETSIZE 32 4 | 5 | #include_next 6 | -------------------------------------------------------------------------------- /cafe/uvc.def: -------------------------------------------------------------------------------- 1 | :NAME uvc 2 | 3 | :TEXT 4 | UVCClose 5 | UVCGetFrame 6 | UVCInit 7 | UVCOpen 8 | UVCRequest 9 | -------------------------------------------------------------------------------- /include/nsysnet/nsysnet.dox: -------------------------------------------------------------------------------- 1 | /** 2 | * \defgroup nsysnet nsysnet 3 | * 4 | * Network functions. 5 | */ 6 | -------------------------------------------------------------------------------- /include/nsyshid/nsyshid.dox: -------------------------------------------------------------------------------- 1 | /** 2 | * \defgroup nsyshid nsyshid 3 | * 4 | * Human Input Device functions. 5 | */ 6 | -------------------------------------------------------------------------------- /samples/cmake/content/pos_col_shader.gsh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LRFLEW/wut/master/samples/cmake/content/pos_col_shader.gsh -------------------------------------------------------------------------------- /include/padscore/padscore.dox: -------------------------------------------------------------------------------- 1 | /** 2 | * \defgroup padscore padscore 3 | * 4 | * Input library for Wii controllers. 5 | */ 6 | -------------------------------------------------------------------------------- /include/sndcore2/sndcore2.dox: -------------------------------------------------------------------------------- 1 | /** 2 | * \defgroup sndcore2 sndcore2 3 | * 4 | * Sound playback and utility library. 5 | */ 6 | -------------------------------------------------------------------------------- /cafe/uac.def: -------------------------------------------------------------------------------- 1 | :NAME uac 2 | 3 | :TEXT 4 | UACClose 5 | UACFreeISODesc 6 | UACGetAudio 7 | UACInit 8 | UACOpen 9 | UACRequest 10 | -------------------------------------------------------------------------------- /include/gx2r/gx2r.dox: -------------------------------------------------------------------------------- 1 | /** 2 | * \defgroup gx2r gx2r 3 | * 4 | * Contains utilities to help manage memory invalidation for gx2. 5 | */ 6 | -------------------------------------------------------------------------------- /include/vpad/vpad.dox: -------------------------------------------------------------------------------- 1 | /** 2 | * \defgroup vpad vpad 3 | * 4 | * Input library for the Wii U Gamepad (Display Remote Controller). 5 | */ 6 | -------------------------------------------------------------------------------- /libraries/libwhb/src/libmanager.c: -------------------------------------------------------------------------------- 1 | void 2 | WHBInitializeSocketLibrary() 3 | { 4 | } 5 | 6 | void 7 | WHBDeinitializeSocketLibrary() 8 | { 9 | } 10 | -------------------------------------------------------------------------------- /samples/cmake/my_first_rpl/my_first_rpl.h: -------------------------------------------------------------------------------- 1 | #ifndef MY_FIRST_RPL_H 2 | #define MY_FIRST_RPL_H 3 | 4 | const char *my_first_export(); 5 | 6 | #endif // MY_FIRST_RPL_H 7 | -------------------------------------------------------------------------------- /cafe/mic.def: -------------------------------------------------------------------------------- 1 | :NAME mic 2 | 3 | :TEXT 4 | MICClose 5 | MICGetState 6 | MICGetStatus 7 | MICInit 8 | MICOpen 9 | MICSetDataConsumed 10 | MICSetState 11 | MICUninit 12 | -------------------------------------------------------------------------------- /include/swkbd/swkbd.dox: -------------------------------------------------------------------------------- 1 | /** 2 | * \defgroup swkbd swkbd 3 | * 4 | * C++ linkage for the software keyboard, see \link nn::swkbd \endlink for 5 | * general use. 6 | */ 7 | -------------------------------------------------------------------------------- /include/nn/act.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /** 4 | * \defgroup nn_act nn_act 5 | * Accounts API, manages user profiles and personal info. 6 | */ 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /share/wut.specs: -------------------------------------------------------------------------------- 1 | %rename link old_link 2 | 3 | *link: 4 | %(old_link) -T %:getenv(DEVKITPRO /wut/share/wut.ld) --gc-sections --emit-relocs --no-eh-frame-hdr -z nocopyreloc %(wut_entry) 5 | -------------------------------------------------------------------------------- /tests/test_compile_headers_as_c11/main.c: -------------------------------------------------------------------------------- 1 | #include "test_compile_headers_list.h" 2 | 3 | int main(int argc, char **argv) 4 | { 5 | (void)argc, (void)argv; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /tests/test_compile_headers_as_c99/main.c: -------------------------------------------------------------------------------- 1 | #include "test_compile_headers_list.h" 2 | 3 | int main(int argc, char **argv) 4 | { 5 | (void)argc, (void)argv; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /tests/test_compile_headers_as_cpp/main.cpp: -------------------------------------------------------------------------------- 1 | #include "test_compile_headers_list.h" 2 | 3 | int main(int argc, char **argv) 4 | { 5 | (void)argc, (void)argv; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /include/sysapp/sysapp.dox: -------------------------------------------------------------------------------- 1 | /** 2 | * \defgroup sysapp sysapp 3 | * 4 | * Functions to switch applications, launch overlay apps and perform other 5 | * multitasking functions. 6 | */ 7 | -------------------------------------------------------------------------------- /include/nn/pdm.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /** 4 | * \defgroup nn_pdm nn_pdm 5 | * Log Activities for Titles 6 | */ 7 | 8 | #include 9 | #include 10 | -------------------------------------------------------------------------------- /samples/cmake/content/README.txt: -------------------------------------------------------------------------------- 1 | Samples assume that this content directory is copied to /sdcard/wut/content 2 | 3 | e.g. For gx2_triangle /sdcard/wut/content/pos_col_shader.gsh must exist! 4 | -------------------------------------------------------------------------------- /include/proc_ui/procui.dox: -------------------------------------------------------------------------------- 1 | /** 2 | * \defgroup proc_ui proc_ui 3 | * 4 | * Process management library used for managing transitions between foreground 5 | * and background applications. 6 | */ 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .*/ 2 | !.github/ 3 | build/ 4 | release/ 5 | debug/ 6 | lib/ 7 | *.a 8 | *.o 9 | *.d 10 | *.elf 11 | *.rpl 12 | *.rpx 13 | *.wuhb 14 | *.bz2 15 | docs/html/ 16 | CMakeSettings.json 17 | -------------------------------------------------------------------------------- /cafe/nio_prof.def: -------------------------------------------------------------------------------- 1 | :NAME nio_prof 2 | 3 | :TEXT 4 | IO_ProfilerGetStatsAndEndCheckpoint 5 | IO_ProfilerGetStatsAndRestartCheckpoint 6 | IO_ProfilerLibFinish 7 | IO_ProfilerLibInit 8 | IO_ProfilerStartCheckpoint 9 | -------------------------------------------------------------------------------- /include/nn/swkbd.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /** 4 | * \defgroup nn_swkbd nn_swkbd 5 | * Graphical software keyboard, supporting several languages and configurations. 6 | */ 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /include/netinet/tcp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define SOL_TCP 6 4 | 5 | #define TCP_ACKDELAYTIME 0x2001 6 | #define TCP_NOACKDELAY 0x2002 7 | #define TCP_MAXSEG 0x2003 8 | #define TCP_NODELAY 0x2004 9 | -------------------------------------------------------------------------------- /include/nn/acp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /** 4 | * \defgroup nn_acp nn_acp 5 | * 6 | */ 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | -------------------------------------------------------------------------------- /cafe/camera.def: -------------------------------------------------------------------------------- 1 | :NAME camera 2 | 3 | :TEXT 4 | CAMCheckMemSegmentation 5 | CAMClose 6 | CAMExit 7 | CAMGetMemReq 8 | CAMGetState 9 | CAMGetStateInfo 10 | CAMInit 11 | CAMOpen 12 | CAMSetState 13 | CAMSubmitTargetSurface 14 | -------------------------------------------------------------------------------- /include/coreinit/coreinit.dox: -------------------------------------------------------------------------------- 1 | /** 2 | * \defgroup coreinit coreinit 3 | * 4 | * Contains all core operating system functions such as threads, synchronisation 5 | * objects, filesystem, memory, exception handling, etc... 6 | */ 7 | -------------------------------------------------------------------------------- /samples/cmake/content/pos_col_shader.psh: -------------------------------------------------------------------------------- 1 | ; $MODE = "UniformRegister" 2 | ; $NUM_SPI_PS_INPUT_CNTL = 1 3 | ; $SPI_PS_INPUT_CNTL[0].SEMANTIC = 0 4 | ; $SPI_PS_INPUT_CNTL[0].DEFAULT_VAL = 1 5 | 6 | 00 EXP_DONE: PIX0, R0.xyzw 7 | END_OF_PROGRAM 8 | -------------------------------------------------------------------------------- /include/nn/ac.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /** 4 | * \defgroup nn_ac nn_ac 5 | * Auto Connect API, used for managing and connecting to internet connection 6 | * profiles. 7 | */ 8 | 9 | #include 10 | #include 11 | -------------------------------------------------------------------------------- /include/coreinit/internal.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | int 9 | __os_snprintf(char *buf, size_t n, const char *format, ... ); 10 | 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | -------------------------------------------------------------------------------- /libraries/wutsocket/inet_addr.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | in_addr_t 4 | inet_addr(const char *cp) 5 | { 6 | struct in_addr addr = { 7 | .s_addr = INADDR_NONE, 8 | }; 9 | inet_aton(cp, &addr); 10 | return addr.s_addr; 11 | } 12 | -------------------------------------------------------------------------------- /libraries/wutdevoptab/devoptab_fs_link.c: -------------------------------------------------------------------------------- 1 | #include "devoptab_fs.h" 2 | 3 | int 4 | __wut_fs_link(struct _reent *r, 5 | const char *existing, 6 | const char *newLink) 7 | { 8 | r->_errno = ENOSYS; 9 | return -1; 10 | } 11 | -------------------------------------------------------------------------------- /docs/mainpage.dox: -------------------------------------------------------------------------------- 1 | /** 2 | * \mainpage Wii U Toolchain 3 | * 4 | * \section Introduction 5 | * An experimental in-development Wii U toolchain, the source can be found at 6 | * https://github.com/devkitPro/wut 7 | * 8 | * \section Usage 9 | * TODO. 10 | */ 11 | -------------------------------------------------------------------------------- /libraries/wutdevoptab/devoptab_fs_getmtime.c: -------------------------------------------------------------------------------- 1 | #include "devoptab_fs.h" 2 | 3 | int 4 | __wut_fs_getmtime(const char *name, 5 | uint64_t *mtime) 6 | { 7 | // TODO: Last modified time can probably be get via FSGetStatFile 8 | return -1; 9 | } 10 | -------------------------------------------------------------------------------- /cafe/dmae.def: -------------------------------------------------------------------------------- 1 | :NAME dmae 2 | 3 | :TEXT 4 | DMAECopyMem 5 | DMAEFillMem 6 | DMAEFillMemPhys 7 | DMAEGetLastSubmittedTimeStamp 8 | DMAEGetRetiredTimeStamp 9 | DMAEGetTimeout 10 | DMAESemaphore 11 | DMAESetTimeout 12 | DMAEWaitDone 13 | _DMAESubmit 14 | _DMAESubmitToRing 15 | -------------------------------------------------------------------------------- /cafe/usb_mic.def: -------------------------------------------------------------------------------- 1 | :NAME usb_mic 2 | 3 | :TEXT 4 | USBMICClose 5 | USBMICGetState 6 | USBMICGetStatus 7 | USBMICInit 8 | USBMICOpen 9 | USBMICOpenQuery 10 | USBMICSetDataConsumed 11 | USBMICSetState 12 | USBMICStart 13 | USBMICStartExt 14 | USBMICStop 15 | USBMICUninit 16 | -------------------------------------------------------------------------------- /cafe/nn_nets2.def: -------------------------------------------------------------------------------- 1 | :NAME nn_nets2 2 | 3 | :TEXT 4 | NSSLAddCRLExternal 5 | NSSLContextClearFlags 6 | NSSLContextGetFlags 7 | NSSLContextSetFlags 8 | NSSLContextSetMode 9 | icmp_cancel 10 | icmp_close_handle 11 | icmp_create_handle 12 | icmp_last_code_type 13 | icmp_ping 14 | somemopt 15 | -------------------------------------------------------------------------------- /cafe/uvd.def: -------------------------------------------------------------------------------- 1 | :NAME uvd 2 | 3 | :TEXT 4 | UVDCheckSegmentViolation 5 | UVDCreateContext 6 | UVDCreateDecodeSession 7 | UVDDecodePicture 8 | UVDDeinitHW 9 | UVDDestroyContext 10 | UVDDestroyDecodeSession 11 | UVDEndDecodePicture 12 | UVDGetDPBSize 13 | UVDInitHW 14 | UVDStartDecodePicture 15 | -------------------------------------------------------------------------------- /libraries/wutdevoptab/devoptab_fs_fchmod.c: -------------------------------------------------------------------------------- 1 | #include "devoptab_fs.h" 2 | 3 | int 4 | __wut_fs_fchmod(struct _reent *r, 5 | void *fd, 6 | mode_t mode) 7 | { 8 | // TODO: FSChangeMode and FSStatFile? 9 | r->_errno = ENOSYS; 10 | return -1; 11 | } 12 | -------------------------------------------------------------------------------- /libraries/wutsocket/inet_pton.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | int 4 | inet_pton(int af, 5 | const char *src, 6 | void *dst) 7 | { 8 | int rc = RPLWRAP(inet_pton)(af, src, dst); 9 | if (rc < 0) { 10 | errno = EAFNOSUPPORT; 11 | } 12 | return rc; 13 | } 14 | -------------------------------------------------------------------------------- /libraries/wutsocket/wut_socket_close.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | int 4 | __wut_socket_close(struct _reent *r, 5 | void *fd) 6 | { 7 | int sockfd = *(int *)fd; 8 | int rc = RPLWRAP(socketclose)(sockfd); 9 | return __wut_get_nsysnet_result(r, rc); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /include/nn/acp/nn_acp_types.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /* Included for compatibility - though this header was never in a released 5 | * version of wut. It had the definition of ACPMetaXml. 6 | */ 7 | //#warning " is deprecated! Please use ." 8 | -------------------------------------------------------------------------------- /libraries/wutdevoptab/devoptab_fs_statvfs.c: -------------------------------------------------------------------------------- 1 | #include "devoptab_fs.h" 2 | 3 | int 4 | __wut_fs_statvfs(struct _reent *r, 5 | const char *path, 6 | struct statvfs *buf) 7 | { 8 | //TODO: FSGetFileSystemInfo 9 | r->_errno = ENOSYS; 10 | return -1; 11 | } 12 | -------------------------------------------------------------------------------- /include/gx2/temp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup gx2_temp Temp 6 | * \ingroup gx2 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | uint32_t 15 | GX2TempGetGPUVersion(); 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | 21 | /** @} */ 22 | -------------------------------------------------------------------------------- /include/coreinit/title.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup coreinit_title Title 6 | * \ingroup coreinit 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | uint64_t OSGetTitleID(void); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | /** @} */ 21 | -------------------------------------------------------------------------------- /libraries/wutsocket/wut_socket_open.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | int 4 | __wut_socket_open(struct _reent *r, 5 | void *fileStruct, 6 | const char *path, 7 | int flags, 8 | int mode) 9 | { 10 | r->_errno = ENOSYS; 11 | return -1; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # https://EditorConfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | end_of_line = lf 7 | insert_final_newline = true 8 | indent_style = space 9 | indent_size = 3 10 | 11 | [{Makefile,*/Makefile,*.mk,*_rules}] 12 | indent_style = tab 13 | indent_size = 4 14 | 15 | [*.yml] 16 | indent_style = space 17 | indent_size = 2 18 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.2) 2 | project(tests) 3 | include("${DEVKITPRO}/wut/share/wut.cmake" REQUIRED) 4 | 5 | include_directories("test_compile_headers_common") 6 | add_subdirectory(test_compile_headers_as_c11) 7 | add_subdirectory(test_compile_headers_as_c99) 8 | add_subdirectory(test_compile_headers_as_cpp) 9 | -------------------------------------------------------------------------------- /libraries/libwhb/include/whb/crash.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup whb_crash Crash Handler 6 | * \ingroup whb 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | BOOL 15 | WHBInitCrashHandler(); 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | 21 | /** @} */ 22 | -------------------------------------------------------------------------------- /samples/make/Makefile: -------------------------------------------------------------------------------- 1 | MAKEFILES := $(shell find . -mindepth 2 -name Makefile) 2 | 3 | DATESTRING := $(shell date +%Y)$(shell date +%m)$(shell date +%d) 4 | 5 | all: 6 | @for i in $(MAKEFILES); do $(MAKE) -C `dirname $$i` || exit 1; done; 7 | 8 | clean: 9 | @for i in $(MAKEFILES); do $(MAKE) -C `dirname $$i` clean || exit 1; done; 10 | -------------------------------------------------------------------------------- /cafe/uac_rpl.def: -------------------------------------------------------------------------------- 1 | :NAME uac_rpl 2 | 3 | :TEXT 4 | UACClose 5 | UACGetState 6 | UACINGetStatus 7 | UACINSetDataConsumed 8 | UACINStart 9 | UACINStartExt 10 | UACINStop 11 | UACInit 12 | UACOUTGetStatus 13 | UACOUTSetDataConsumed 14 | UACOUTStart 15 | UACOUTStartExt 16 | UACOUTStop 17 | UACOpen 18 | UACOpenQuery 19 | UACSetState 20 | UACUninit 21 | -------------------------------------------------------------------------------- /libraries/wutsocket/inet_ntop.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | const char * 4 | inet_ntop(int af, 5 | const void *src, 6 | char *dst, 7 | socklen_t size) 8 | { 9 | const char *rc = RPLWRAP(inet_ntop)(af, src, dst, size); 10 | if (!rc) { 11 | errno = EAFNOSUPPORT; 12 | } 13 | return rc; 14 | } 15 | -------------------------------------------------------------------------------- /samples/cmake/swkbd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.2) 2 | project(swkbd CXX) 3 | include("${DEVKITPRO}/wut/share/wut.cmake" REQUIRED) 4 | 5 | add_executable(swkbd 6 | main.cpp) 7 | 8 | wut_create_rpx(swkbd) 9 | 10 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/swkbd.rpx" 11 | DESTINATION "${CMAKE_INSTALL_PREFIX}") 12 | -------------------------------------------------------------------------------- /libraries/wutsocket/listen.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | int 4 | listen(int sockfd, 5 | int backlog) 6 | { 7 | int rc; 8 | sockfd = __wut_get_nsysnet_fd(sockfd); 9 | if (sockfd == -1) { 10 | return -1; 11 | } 12 | rc = RPLWRAP(listen)(sockfd, backlog); 13 | return __wut_get_nsysnet_result(NULL, rc); 14 | } 15 | 16 | -------------------------------------------------------------------------------- /libraries/wutsocket/shutdown.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | int 4 | shutdown(int sockfd, 5 | int how) 6 | { 7 | int rc; 8 | sockfd = __wut_get_nsysnet_fd(sockfd); 9 | if (sockfd == -1) { 10 | return -1; 11 | } 12 | rc = RPLWRAP(shutdown)(sockfd, how); 13 | return __wut_get_nsysnet_result(NULL, rc); 14 | } 15 | 16 | -------------------------------------------------------------------------------- /cafe/nn_aoc.def: -------------------------------------------------------------------------------- 1 | :NAME nn_aoc 2 | 3 | :TEXT 4 | AOC_CalculateWorkBufferSize 5 | AOC_CloseTitle 6 | AOC_DebugRealDeviceAccess 7 | AOC_DeleteContent 8 | AOC_Finalize 9 | AOC_GetErrorCode 10 | AOC_GetOccupiedSize 11 | AOC_GetPurchaseInfo 12 | AOC_Initialize 13 | AOC_ListTitle 14 | AOC_LockTitle 15 | AOC_OpenTitle 16 | AOC_UnlockTitle 17 | AOC_UtilGetValidAocTitles 18 | -------------------------------------------------------------------------------- /include/coreinit/exit.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup coreinit_exit Exit 6 | * \ingroup coreinit 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | void 15 | RPLWRAP(exit)(int code); 16 | 17 | void 18 | _Exit(int code); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | /** @} */ 25 | -------------------------------------------------------------------------------- /libraries/libwhb/include/whb/align.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup whb_align Align 6 | * \ingroup whb 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #define WHBAlignUp(val, align) ((val + align - 1) & ~(align - 1)) 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | /** @} */ 21 | -------------------------------------------------------------------------------- /samples/cmake/helloworld/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.2) 2 | project(helloworld C) 3 | include("${DEVKITPRO}/wut/share/wut.cmake" REQUIRED) 4 | 5 | add_executable(helloworld 6 | main.c) 7 | 8 | wut_create_rpx(helloworld) 9 | 10 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/helloworld.rpx" 11 | DESTINATION "${CMAKE_INSTALL_PREFIX}") 12 | -------------------------------------------------------------------------------- /libraries/libwhb/include/whb/log_udp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup whb_log_udp UDP Log Output 6 | * \ingroup whb 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | BOOL 15 | WHBLogUdpInit(); 16 | 17 | BOOL 18 | WHBLogUdpDeinit(); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | /** @} */ 25 | -------------------------------------------------------------------------------- /libraries/wutsocket/wut_socket_read.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | ssize_t 4 | __wut_socket_read(struct _reent *r, 5 | void *fd, 6 | char *ptr, 7 | size_t len) 8 | { 9 | int sockfd = *(int *)fd; 10 | int rc = RPLWRAP(recv)(sockfd, ptr, len, 0); 11 | return (ssize_t)__wut_get_nsysnet_result(r, rc); 12 | } 13 | 14 | -------------------------------------------------------------------------------- /samples/cmake/gx2_triangle/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.2) 2 | project(gx2_triangle C) 3 | include("${DEVKITPRO}/wut/share/wut.cmake" REQUIRED) 4 | 5 | add_executable(gx2_triangle 6 | main.c) 7 | 8 | wut_create_rpx(gx2_triangle) 9 | 10 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/gx2_triangle.rpx" 11 | DESTINATION "${CMAKE_INSTALL_PREFIX}") 12 | -------------------------------------------------------------------------------- /libraries/libwhb/include/whb/log_cafe.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup whb_log_cafe Cafe OS System Log Output 6 | * \ingroup whb 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | BOOL 15 | WHBLogCafeInit(); 16 | 17 | BOOL 18 | WHBLogCafeDeinit(); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | /** @} */ 25 | -------------------------------------------------------------------------------- /libraries/wutsocket/wut_socket_write.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | ssize_t 4 | __wut_socket_write(struct _reent *r, 5 | void *fd, 6 | const char *ptr, 7 | size_t len) 8 | { 9 | int sockfd = *(int *)fd; 10 | int rc = RPLWRAP(send)(sockfd, ptr, len, 0); 11 | return (ssize_t)__wut_get_nsysnet_result(r, rc); 12 | } 13 | 14 | -------------------------------------------------------------------------------- /samples/cmake/helloworld_cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.2) 2 | project(helloworld_cpp CXX) 3 | include("${DEVKITPRO}/wut/share/wut.cmake" REQUIRED) 4 | 5 | add_executable(helloworld_cpp 6 | main.cpp) 7 | 8 | wut_create_rpx(helloworld_cpp) 9 | 10 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/helloworld_cpp.rpx" 11 | DESTINATION "${CMAKE_INSTALL_PREFIX}") 12 | -------------------------------------------------------------------------------- /libraries/wutsocket/bind.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | int 4 | bind(int sockfd, 5 | const struct sockaddr *addr, 6 | socklen_t addrlen) 7 | { 8 | int rc; 9 | sockfd = __wut_get_nsysnet_fd(sockfd); 10 | if (sockfd == -1) { 11 | return -1; 12 | } 13 | rc = RPLWRAP(bind)(sockfd, addr, addrlen); 14 | return __wut_get_nsysnet_result(NULL, rc); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /cafe/nsyshid.def: -------------------------------------------------------------------------------- 1 | :NAME nsyshid 2 | 3 | :TEXT 4 | HIDAddClient 5 | HIDAddPassiveClient 6 | HIDDecodeError 7 | HIDDelClient 8 | HIDDelPassiveClient 9 | HIDGetDescriptor 10 | HIDGetHierarchy 11 | HIDGetIdle 12 | HIDGetProtocol 13 | HIDGetReport 14 | HIDRead 15 | HIDResetDevice 16 | HIDSetDescriptor 17 | HIDSetIdle 18 | HIDSetProtocol 19 | HIDSetReport 20 | HIDSetup 21 | HIDTeardown 22 | HIDWrite 23 | -------------------------------------------------------------------------------- /libraries/wutsocket/recv.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | ssize_t 4 | recv(int sockfd, 5 | void *buf, 6 | size_t len, 7 | int flags) 8 | { 9 | int rc; 10 | sockfd = __wut_get_nsysnet_fd(sockfd); 11 | if (sockfd == -1) { 12 | return -1; 13 | } 14 | rc = RPLWRAP(recv)(sockfd, buf, len, flags); 15 | return (ssize_t)__wut_get_nsysnet_result(NULL, rc); 16 | } 17 | 18 | -------------------------------------------------------------------------------- /libraries/wutsocket/send.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | ssize_t 4 | send(int sockfd, 5 | const void* buf, 6 | size_t len, 7 | int flags) 8 | { 9 | int rc; 10 | sockfd = __wut_get_nsysnet_fd(sockfd); 11 | if (sockfd == -1) { 12 | return -1; 13 | } 14 | rc = RPLWRAP(send)(sockfd, buf, len, flags); 15 | return (ssize_t)__wut_get_nsysnet_result(NULL, rc); 16 | } 17 | 18 | -------------------------------------------------------------------------------- /include/gx2/mem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "enum.h" 4 | 5 | /** 6 | * \defgroup gx2_mem Memory 7 | * \ingroup gx2 8 | * @{ 9 | */ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | void 16 | GX2Invalidate(GX2InvalidateMode mode, 17 | void *buffer, 18 | uint32_t size); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | /** @} */ 25 | -------------------------------------------------------------------------------- /libraries/wutcrt/crt0_rpx.s: -------------------------------------------------------------------------------- 1 | .extern main 2 | .extern exit 3 | .extern __init_wut 4 | .extern __fini_wut 5 | 6 | .section .crt0, "ax", @progbits 7 | .global __rpx_start 8 | __rpx_start: 9 | stwu 1, -0x14(1) 10 | mflr 0 11 | stw 0, 0x18(1) 12 | stw 3, 0xC(1) 13 | stw 4, 0x10(1) 14 | bl __init_wut 15 | lwz 3, 0xC(1) 16 | lwz 4, 0x10(1) 17 | bl main 18 | addi 1, 1, 0x14 19 | b exit 20 | -------------------------------------------------------------------------------- /libraries/wutsocket/connect.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | int connect(int sockfd, 4 | const struct sockaddr *addr, 5 | socklen_t addrlen) 6 | { 7 | int rc; 8 | sockfd = __wut_get_nsysnet_fd(sockfd); 9 | if (sockfd == -1) { 10 | return -1; 11 | } 12 | rc = RPLWRAP(connect)(sockfd, addr, addrlen); 13 | return __wut_get_nsysnet_result(NULL, rc); 14 | } 15 | 16 | -------------------------------------------------------------------------------- /include/wut.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /* 4 | * wut 1.0.0-beta 5 | * 6 | * https://github.com/devkitPro/wut 7 | */ 8 | 9 | #include "wut_structsize.h" 10 | #include "wut_types.h" 11 | #include "wut_rplwrap.h" 12 | 13 | #ifdef __GNUC__ 14 | 15 | #define WUT_DEPRECATED(reason) __attribute__((deprecated(reason))) 16 | 17 | #else // not __GNUC__ 18 | 19 | #define WUT_DEPRECATED(reason) 20 | 21 | #endif //__GNUC__ 22 | -------------------------------------------------------------------------------- /include/nn/acp/device.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | /** 6 | * \defgroup nn_acp_device 7 | * \ingroup nn_acp 8 | * @{ 9 | */ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef int32_t ACPDeviceType; 16 | 17 | ACPResult 18 | ACPCheckApplicationDeviceEmulation(BOOL* emulation); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | /** @} */ 25 | -------------------------------------------------------------------------------- /libraries/libwhb/include/whb/sdcard.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup whb_sdcard SDCard Access 6 | * \ingroup whb 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | BOOL 15 | WHBMountSdCard(); 16 | 17 | char * 18 | WHBGetSdCardMountPath(); 19 | 20 | BOOL 21 | WHBUnmountSdCard(); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | 27 | /** @} */ 28 | -------------------------------------------------------------------------------- /libraries/wutsocket/getpeername.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | int 4 | getpeername(int sockfd, 5 | struct sockaddr *addr, 6 | socklen_t *addrlen) 7 | { 8 | int rc; 9 | sockfd = __wut_get_nsysnet_fd(sockfd); 10 | if (sockfd == -1) { 11 | return -1; 12 | } 13 | rc = RPLWRAP(getpeername)(sockfd, addr, addrlen); 14 | return __wut_get_nsysnet_result(NULL, rc); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /libraries/wutsocket/getsockname.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | int 4 | getsockname(int sockfd, 5 | struct sockaddr *addr, 6 | socklen_t *addrlen) 7 | { 8 | int rc; 9 | sockfd = __wut_get_nsysnet_fd(sockfd); 10 | if (sockfd == -1) { 11 | return -1; 12 | } 13 | rc = RPLWRAP(getsockname)(sockfd, addr, addrlen); 14 | return __wut_get_nsysnet_result(NULL, rc); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /cafe/nn_hpad.def: -------------------------------------------------------------------------------- 1 | :NAME nn_hpad 2 | 3 | :TEXT 4 | BETA_DEBUG_DUMP 5 | BETA_DEBUG_GET_QUEUE_SIZE 6 | BETA_DEBUG_GET_RAW_DATA 7 | BETA_DEBUG_SEND_REPT_ID 8 | BETA_DEBUG_SET_DUMP_MODE 9 | HPADControlMotor 10 | HPADGetGGGGStatus 11 | HPADInit 12 | HPADRead 13 | HPADRecalibrate 14 | HPADResetDevice 15 | HPADSetConnectCallback 16 | HPADSetGgggConnectCallback 17 | HPADSetPowerSupplyCallback 18 | HPADSetSamplingCallback 19 | HPADShutdown 20 | -------------------------------------------------------------------------------- /tests/test_compile_headers_as_cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.2) 2 | project(test_compile_headers_as_cpp CXX) 3 | include("${DEVKITPRO}/wut/share/wut.cmake" REQUIRED) 4 | 5 | add_executable(test_compile_headers_as_cpp 6 | main.cpp) 7 | 8 | target_compile_options(test_compile_headers_as_cpp PRIVATE 9 | -Wall 10 | -Wextra 11 | -pedantic 12 | -Werror) 13 | 14 | wut_create_rpx(test_compile_headers_as_cpp) 15 | -------------------------------------------------------------------------------- /include/coreinit/foreground.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup coreinit_foreground Foreground Management 6 | * \ingroup coreinit 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | void 15 | OSEnableForegroundExit(); 16 | 17 | void 18 | OSReleaseForeground(); 19 | 20 | void 21 | OSSavesDone_ReadyToRelease(); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | 27 | /** @} */ 28 | -------------------------------------------------------------------------------- /libraries/wutnewlib/wut_malloc_lock.c: -------------------------------------------------------------------------------- 1 | #include "wut_newlib.h" 2 | 3 | #include 4 | 5 | static OSMutex sMallocMutex; 6 | 7 | void 8 | __wut_malloc_lock(struct _reent *r) 9 | { 10 | OSLockMutex(&sMallocMutex); 11 | } 12 | 13 | void 14 | __wut_malloc_unlock(struct _reent *r) 15 | { 16 | OSUnlockMutex(&sMallocMutex); 17 | } 18 | 19 | void 20 | __init_wut_malloc_lock() 21 | { 22 | OSInitMutex(&sMallocMutex); 23 | } 24 | -------------------------------------------------------------------------------- /libraries/wutsocket/sockatmark.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | int sockatmark(int sockfd) 4 | { 5 | char buf[1]; 6 | int rc; 7 | 8 | sockfd = __wut_get_nsysnet_fd(sockfd); 9 | 10 | rc = RPLWRAP(recv)(sockfd, buf, sizeof(buf), MSG_OOB | MSG_PEEK | MSG_DONTWAIT); 11 | if (rc > 0) { 12 | return 1; 13 | } 14 | 15 | rc = __wut_get_nsysnet_result(NULL, rc); 16 | 17 | return (errno == EWOULDBLOCK) ? 0 : rc; 18 | } 19 | -------------------------------------------------------------------------------- /libraries/libwhb/include/whb/proc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup whb_proc ProcUI Utilities 6 | * \ingroup whb 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | void 15 | WHBProcInit(); 16 | 17 | void 18 | WHBProcShutdown(); 19 | 20 | void 21 | WHBProcStopRunning(); 22 | 23 | BOOL 24 | WHBProcIsRunning(); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | 30 | /** @} */ 31 | -------------------------------------------------------------------------------- /samples/cmake/curl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.2) 2 | project(curl C) 3 | include("${DEVKITPRO}/wut/share/wut.cmake" REQUIRED) 4 | 5 | add_executable(curl 6 | main.c) 7 | 8 | target_link_libraries(curl 9 | whb 10 | proc_ui 11 | sysapp 12 | nsysnet 13 | nlibcurl) 14 | 15 | wut_create_rpx(curl) 16 | 17 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/curl.rpx" 18 | DESTINATION "${CMAKE_INSTALL_PREFIX}") 19 | -------------------------------------------------------------------------------- /cafe/nlibnss2.def: -------------------------------------------------------------------------------- 1 | :NAME nlibnss2 2 | 3 | :TEXT 4 | NSSCreateHMACContext 5 | NSSCreateSymkeyCryptoContext 6 | NSSDestroyHMACContext 7 | NSSDestroySymkeyCryptoContext 8 | NSSHMACFinish 9 | NSSHMACUpdate 10 | NSSSymkeyCryptoDecryptFinish 11 | NSSSymkeyCryptoDecryptInitInternalKey 12 | NSSSymkeyCryptoDecryptUpdate 13 | NSSSymkeyCryptoEncryptFinish 14 | NSSSymkeyCryptoEncryptInitInternalKey 15 | NSSSymkeyCryptoEncryptUpdate 16 | NSSSymkeyCryptoGetCipherBlockSize 17 | -------------------------------------------------------------------------------- /include/gx2/state.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "enum.h" 4 | 5 | /** 6 | * \defgroup gx2_state State 7 | * \ingroup gx2 8 | * @{ 9 | */ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | void 16 | GX2Init(uint32_t *attributes); 17 | 18 | void 19 | GX2Shutdown(); 20 | 21 | void 22 | GX2Flush(); 23 | 24 | void 25 | GX2ResetGPU(uint32_t unknown); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | 31 | /** @} */ 32 | -------------------------------------------------------------------------------- /libraries/wutnewlib/wut_nanosleep.c: -------------------------------------------------------------------------------- 1 | #include "wut_newlib.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | int 8 | __wut_nanosleep(const struct timespec *req, 9 | struct timespec *rem) 10 | { 11 | OSSleepTicks(OSSecondsToTicks(req->tv_sec) + 12 | OSNanosecondsToTicks(req->tv_nsec)); 13 | rem->tv_sec = 0; 14 | rem->tv_nsec = 0; 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /samples/cmake/custom_default_heap/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.2) 2 | project(custom_default_heap C) 3 | include("${DEVKITPRO}/wut/share/wut.cmake" REQUIRED) 4 | 5 | add_executable(custom_default_heap 6 | main.c) 7 | 8 | wut_add_exports(custom_default_heap exports.def) 9 | wut_create_rpx(custom_default_heap) 10 | 11 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/custom_default_heap.rpx" 12 | DESTINATION "${CMAKE_INSTALL_PREFIX}") 13 | -------------------------------------------------------------------------------- /libraries/wutsocket/hostid.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | #include 4 | 5 | long 6 | gethostid(void) 7 | { 8 | uint32_t ip = UINT32_MAX; 9 | ACGetAssignedAddress(&ip); 10 | return (long)ip; 11 | } 12 | 13 | int 14 | gethostname(char *name, 15 | size_t len) 16 | { 17 | struct in_addr in; 18 | in.s_addr = gethostid(); 19 | const char *hostname = inet_ntop(AF_INET, &in, name, len); 20 | return hostname ? 0 : -1; 21 | } 22 | -------------------------------------------------------------------------------- /tests/test_compile_headers_as_c11/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.2) 2 | project(test_compile_headers_as_c11 C) 3 | include("${DEVKITPRO}/wut/share/wut.cmake" REQUIRED) 4 | 5 | set(CMAKE_C_STANDARD 11) 6 | 7 | add_executable(test_compile_headers_as_c11 8 | main.c) 9 | 10 | target_compile_options(test_compile_headers_as_c11 PRIVATE 11 | -Wall 12 | -Wextra 13 | -pedantic 14 | -Werror) 15 | 16 | wut_create_rpx(test_compile_headers_as_c11) 17 | -------------------------------------------------------------------------------- /tests/test_compile_headers_as_c99/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.2) 2 | project(test_compile_headers_as_c99 C) 3 | include("${DEVKITPRO}/wut/share/wut.cmake" REQUIRED) 4 | 5 | set(CMAKE_C_STANDARD 99) 6 | 7 | add_executable(test_compile_headers_as_c99 8 | main.c) 9 | 10 | target_compile_options(test_compile_headers_as_c99 PRIVATE 11 | -Wall 12 | -Wextra 13 | -pedantic 14 | -Werror) 15 | 16 | wut_create_rpx(test_compile_headers_as_c99) 17 | -------------------------------------------------------------------------------- /libraries/wutsocket/getsockopt.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | int 4 | getsockopt(int sockfd, 5 | int level, 6 | int optname, 7 | void *optval, 8 | socklen_t *optlen) 9 | { 10 | int rc; 11 | sockfd = __wut_get_nsysnet_fd(sockfd); 12 | if (sockfd == -1) { 13 | return -1; 14 | } 15 | rc = RPLWRAP(getsockopt)(sockfd, level, optname, optval, optlen); 16 | return __wut_get_nsysnet_result(NULL, rc); 17 | } 18 | 19 | -------------------------------------------------------------------------------- /libraries/wutsocket/setsockopt.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | int 4 | setsockopt(int sockfd, 5 | int level, 6 | int optname, 7 | const void *optval, 8 | socklen_t optlen) 9 | { 10 | int rc; 11 | sockfd = __wut_get_nsysnet_fd(sockfd); 12 | if (sockfd == -1) { 13 | return -1; 14 | } 15 | rc = RPLWRAP(setsockopt)(sockfd, level, optname, optval, optlen); 16 | return __wut_get_nsysnet_result(NULL, rc); 17 | } 18 | 19 | -------------------------------------------------------------------------------- /samples/cmake/content/pos_col_shader.vsh: -------------------------------------------------------------------------------- 1 | ; $MODE = "UniformRegister" 2 | ; $ATTRIB_VARS[0].name = "aColour" 3 | ; $ATTRIB_VARS[0].type = "Float4" 4 | ; $ATTRIB_VARS[0].location = 0 5 | ; $ATTRIB_VARS[1].name = "aPosition" 6 | ; $ATTRIB_VARS[1].type = "Float4" 7 | ; $ATTRIB_VARS[1].location = 1 8 | ; $NUM_SPI_VS_OUT_ID = 1 9 | ; $SPI_VS_OUT_ID[0].SEMANTIC_0 = 0 10 | 11 | 00 CALL_FS NO_BARRIER 12 | 01 EXP_DONE: POS0, R2.xyzw 13 | 02 EXP_DONE: PARAM0, R1.xyzw NO_BARRIER 14 | END_OF_PROGRAM 15 | -------------------------------------------------------------------------------- /cafe/nlibnss.def: -------------------------------------------------------------------------------- 1 | :NAME nlibnss 2 | 3 | :TEXT 4 | NSSCreateSignatureContext 5 | NSSDestroySignatureContext 6 | NSSExportDeviceCertChain 7 | NSSFinish 8 | NSSGetRandom 9 | NSSInit 10 | NSSLibReady 11 | NSSSecureStoreDeleteAllObjects 12 | NSSSecureStoreDeleteObject 13 | NSSSecureStoreDeleteTitleObjStore 14 | NSSSecureStoreExportObject 15 | NSSSecureStoreImportObject 16 | NSSSignatureGetSignatureLength 17 | NSSSignatureSetPrivateKey 18 | NSSSignatureSetPrivateKeyExternal 19 | NSSSignatureSignDigest 20 | -------------------------------------------------------------------------------- /samples/cmake/my_first_rpl/my_first_rpl.c: -------------------------------------------------------------------------------- 1 | #include "my_first_rpl.h" 2 | 3 | #include 4 | 5 | const char * 6 | my_first_export() 7 | { 8 | return "Hello from my_first_rpl!"; 9 | } 10 | 11 | int 12 | rpl_entry(OSDynLoad_Module module, 13 | OSDynLoad_EntryReason reason) 14 | { 15 | if (reason == OS_DYNLOAD_LOADED) { 16 | // Do stuff on load 17 | } else if (reason == OS_DYNLOAD_UNLOADED) { 18 | // Do stuff on unload 19 | } 20 | 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /cafe/h264.def: -------------------------------------------------------------------------------- 1 | :NAME h264 2 | 3 | :TEXT 4 | H264DECBegin 5 | H264DECCheckDecunitLength 6 | H264DECCheckMemSegmentation 7 | H264DECCheckSkipableFrame 8 | H264DECClose 9 | H264DECEnd 10 | H264DECExecute 11 | H264DECFindDecstartpoint 12 | H264DECFindIdrpoint 13 | H264DECFlush 14 | H264DECGetImageSize 15 | H264DECInitParam 16 | H264DECMemoryRequirement 17 | H264DECOpen 18 | H264DECSetBitstream 19 | H264DECSetParam 20 | H264DECSetParam_FPTR_OUTPUT 21 | H264DECSetParam_OUTPUT_PER_FRAME 22 | H264DECSetParam_USER_MEMORY 23 | -------------------------------------------------------------------------------- /libraries/wutsocket/sendto.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | ssize_t 4 | sendto(int sockfd, 5 | const void *buf, 6 | size_t len, 7 | int flags, 8 | const struct sockaddr *dest_addr, 9 | socklen_t addrlen) 10 | { 11 | int rc; 12 | sockfd = __wut_get_nsysnet_fd(sockfd); 13 | if (sockfd == -1) { 14 | return -1; 15 | } 16 | rc = RPLWRAP(sendto)(sockfd, buf, len, flags, dest_addr, addrlen); 17 | return (ssize_t)__wut_get_nsysnet_result(NULL, rc); 18 | } 19 | 20 | -------------------------------------------------------------------------------- /libraries/wutsocket/recvfrom.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | ssize_t 4 | recvfrom(int sockfd, 5 | void *buf, 6 | size_t len, 7 | int flags, 8 | struct sockaddr *src_addr, 9 | socklen_t *addrlen) 10 | { 11 | int rc; 12 | sockfd = __wut_get_nsysnet_fd(sockfd); 13 | if (sockfd == -1) { 14 | return -1; 15 | } 16 | rc = RPLWRAP(recvfrom)(sockfd, buf, len, flags, src_addr, addrlen); 17 | return (ssize_t)__wut_get_nsysnet_result(NULL, rc); 18 | } 19 | 20 | -------------------------------------------------------------------------------- /libraries/libwhb/include/whb/libmanager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /** 4 | * \defgroup whb_socketinit Socket Library Initialization Manager 5 | * \ingroup whb 6 | * @{ 7 | */ 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /** 14 | * Socket Library (nsysnet.rpl) 15 | */ 16 | 17 | __attribute__ ((deprecated)) void 18 | WHBInitializeSocketLibrary(); 19 | 20 | __attribute__ ((deprecated)) void 21 | WHBDeinitializeSocketLibrary(); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | 27 | /** @} */ 28 | -------------------------------------------------------------------------------- /cafe/proc_ui.def: -------------------------------------------------------------------------------- 1 | :NAME proc_ui 2 | 3 | :TEXT 4 | ProcUICalcMemorySize 5 | ProcUIClearCallbacks 6 | ProcUIDrawDoneRelease 7 | ProcUIInForeground 8 | ProcUIInShutdown 9 | ProcUIInit 10 | ProcUIInitEx 11 | ProcUIIsRunning 12 | ProcUIProcessMessages 13 | ProcUIRegisterBackgroundCallback 14 | ProcUIRegisterCallback 15 | ProcUIRegisterCallbackCore 16 | ProcUISetBucketStorage 17 | ProcUISetCallbackStackSize 18 | ProcUISetMEM1Storage 19 | ProcUISetMemoryPool 20 | ProcUISetSaveCallback 21 | ProcUIShutdown 22 | ProcUISubProcessMessages 23 | -------------------------------------------------------------------------------- /include/poll.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define POLLIN 0x01 4 | #define POLLPRI 0x02 5 | #define POLLOUT 0x04 6 | #define POLLERR 0x08 7 | #define POLLHUP 0x10 8 | #define POLLNVAL 0x20 9 | 10 | typedef unsigned long nfds_t; 11 | 12 | struct pollfd 13 | { 14 | int fd; 15 | int events; 16 | int revents; 17 | }; 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | int 24 | poll(struct pollfd *fds, 25 | nfds_t nfds, 26 | int timeout); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | 32 | -------------------------------------------------------------------------------- /libraries/libwhb/include/whb/log_console.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup whb_log_console On screen console log output 6 | * \ingroup whb 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #define WHB_SERVER_BUFFER_SIZE 1024 15 | 16 | BOOL 17 | WHBLogConsoleInit(); 18 | 19 | void 20 | WHBLogConsoleFree(); 21 | 22 | void 23 | WHBLogConsoleSetColor(uint32_t color); 24 | 25 | void 26 | WHBLogConsoleDraw(); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | 32 | /** @} */ 33 | -------------------------------------------------------------------------------- /libraries/libwhb/src/log_cafe.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | static void 7 | cafeLogHandler(const char * msg) 8 | { 9 | int length = strlen(msg); 10 | 11 | if(msg[length-1] != '\n') { 12 | OSReport("%s\n", msg); 13 | } 14 | else { 15 | OSReport(msg); 16 | } 17 | } 18 | 19 | BOOL 20 | WHBLogCafeInit() 21 | { 22 | return WHBAddLogHandler(cafeLogHandler); 23 | } 24 | 25 | BOOL 26 | WHBLogCafeDeinit() 27 | { 28 | return WHBRemoveLogHandler(cafeLogHandler); 29 | } 30 | -------------------------------------------------------------------------------- /include/avm/drc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup avm_drc DRC 6 | * \ingroup avm 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | typedef enum AVMDrcScanMode 15 | { 16 | AVM_DRC_SCAN_MODE_UNKNOWN_0 = 0, 17 | AVM_DRC_SCAN_MODE_UNKNOWN_1 = 1, 18 | AVM_DRC_SCAN_MODE_UNKNOWN_3 = 3, 19 | AVM_DRC_SCAN_MODE_UNKNOWN_255 = 255, 20 | } AVMDrcScanMode; 21 | 22 | BOOL 23 | AVMGetDRCScanMode(AVMDrcScanMode *outScanMode); 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | 29 | /** @} */ 30 | -------------------------------------------------------------------------------- /samples/cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.2) 2 | set(CMAKE_TOOLCHAIN_FILE $ENV{DEVKITPRO}/wut/share/wut.toolchain.cmake) 3 | project(samples) 4 | include("${DEVKITPRO}/wut/share/wut.cmake" REQUIRED) 5 | 6 | add_subdirectory(curl) 7 | add_subdirectory(custom_default_heap) 8 | add_subdirectory(gx2_triangle) 9 | add_subdirectory(helloworld) 10 | add_subdirectory(helloworld_cpp) 11 | add_subdirectory(my_first_rpl) 12 | add_subdirectory(swkbd) 13 | 14 | install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/content/" 15 | DESTINATION "${CMAKE_INSTALL_PREFIX}/content") 16 | -------------------------------------------------------------------------------- /samples/cmake/my_first_rpl/my_first_rpx.c: -------------------------------------------------------------------------------- 1 | #include "my_first_rpl.h" 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | int 11 | main(int argc, char **argv) 12 | { 13 | WHBProcInit(); 14 | WHBLogConsoleInit(); 15 | WHBLogPrintf(my_first_export()); 16 | 17 | while(WHBProcIsRunning()) { 18 | WHBLogConsoleDraw(); 19 | OSSleepTicks(OSMillisecondsToTicks(30)); 20 | } 21 | 22 | WHBLogConsoleFree(); 23 | WHBProcShutdown(); 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /cafe/nn_hai.def: -------------------------------------------------------------------------------- 1 | :NAME nn_hai 2 | 3 | :TEXT 4 | DBGGetAutoStop__Q3_2nn3hai5errorFv 5 | DBGSetAutoStop__Q3_2nn3hai5errorFi 6 | GetLaunchBufferSize__Q3_2nn3hai6launchFPUi 7 | Init__Q3_2nn3hai5errorFv 8 | Launch__Q3_2nn3hai6launchFv 9 | PrepareLaunch__Q3_2nn3hai6launchFPvUi 10 | SetFatalError__Q3_2nn3hai5errorFPQ4_2nn3hai5error5ErroriT2PCcT2 11 | SetFsError__Q3_2nn3hai5errorFPQ4_2nn3hai5error5ErrorP8FSClientP10FSCmdBlock 12 | SetHalt__Q3_2nn3hai5errorFPQ4_2nn3hai5error5ErrorPCcT2i 13 | SetMcpError__Q3_2nn3hai5errorFPQ4_2nn3hai5error5Errori 14 | StopIfRequired__Q3_2nn3hai5errorFPCQ4_2nn3hai5error5Error 15 | -------------------------------------------------------------------------------- /include/wut_types.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | typedef int32_t BOOL; 8 | 9 | #ifndef TRUE 10 | #define TRUE 1 11 | #endif 12 | 13 | #ifndef FALSE 14 | #define FALSE 0 15 | #endif 16 | 17 | #if __cplusplus >= 201402L 18 | #define WUT_ENUM_BITMASK_TYPE(_type) \ 19 | extern "C++" { static constexpr inline _type operator|(_type lhs, _type rhs) { \ 20 | return static_cast<_type>(static_cast(lhs) | static_cast(rhs)); \ 21 | } } 22 | #else 23 | #define WUT_ENUM_BITMASK_TYPE(_type) 24 | #endif 25 | -------------------------------------------------------------------------------- /cafe/nfc.def: -------------------------------------------------------------------------------- 1 | :NAME nfc 2 | 3 | :TEXT 4 | NFCAbort 5 | NFCAntennaCheck 6 | NFCDetect 7 | NFCFormat 8 | NFCGetMode 9 | NFCGetTagInfo 10 | NFCGetTagInfoMulti 11 | NFCGetUIDFromActivationEventData 12 | NFCInit 13 | NFCInitEx 14 | NFCIsInit 15 | NFCIsTagPresent 16 | NFCProc 17 | NFCRead 18 | NFCReadT2T 19 | NFCSendRawData 20 | NFCSendRawDataEx 21 | NFCSendRawDataEx2 22 | NFCSendRawDataTwice 23 | NFCSendRawDataWithPrePolling 24 | NFCSendRawDataWithPrePollingEx 25 | NFCSetLockBitsForT1T 26 | NFCSetMode 27 | NFCSetReadOnly 28 | NFCSetTagDetectCallback 29 | NFCShutdown 30 | NFCWrite 31 | NFCWriteT2T 32 | __NFCSystemAbort 33 | -------------------------------------------------------------------------------- /include/dmae/sync.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup dmae_sync Synchronization 6 | * \ingroup dmae 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | //! Timestamp for a DMAE operation. 15 | typedef uint64_t DMAETimeStamp; 16 | 17 | /** 18 | * Waits for a DMAE operation to complete. 19 | * 20 | * \param timestamp 21 | * Timestamp of the operation to wait for. 22 | * 23 | * \return 24 | * TRUE when successful. 25 | */ 26 | BOOL 27 | DMAEWaitDone(DMAETimeStamp timestamp); 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | 33 | /** @} */ 34 | -------------------------------------------------------------------------------- /libraries/wutdevoptab/devoptab_fs_close.c: -------------------------------------------------------------------------------- 1 | #include "devoptab_fs.h" 2 | 3 | int 4 | __wut_fs_close(struct _reent *r, 5 | void *fd) 6 | { 7 | FSStatus status; 8 | FSCmdBlock cmd; 9 | __wut_fs_file_t *file; 10 | 11 | if (!fd) { 12 | r->_errno = EINVAL; 13 | return -1; 14 | } 15 | 16 | FSInitCmdBlock(&cmd); 17 | file = (__wut_fs_file_t *)fd; 18 | status = FSCloseFile(__wut_devoptab_fs_client, &cmd, file->fd, FS_ERROR_FLAG_ALL); 19 | if (status < 0) { 20 | r->_errno = __wut_fs_translate_error(status); 21 | return -1; 22 | } 23 | 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /libraries/wutdevoptab/devoptab_fs_fsync.c: -------------------------------------------------------------------------------- 1 | #include "devoptab_fs.h" 2 | 3 | int 4 | __wut_fs_fsync(struct _reent *r, 5 | void *fd) 6 | { 7 | FSStatus status; 8 | FSCmdBlock cmd; 9 | __wut_fs_file_t *file; 10 | 11 | if (!fd) { 12 | r->_errno = EINVAL; 13 | return -1; 14 | } 15 | 16 | FSInitCmdBlock(&cmd); 17 | file = (__wut_fs_file_t *)fd; 18 | status = FSFlushFile(__wut_devoptab_fs_client, &cmd, file->fd, FS_ERROR_FLAG_ALL); 19 | if (status < 0) { 20 | r->_errno = __wut_fs_translate_error(status); 21 | return -1; 22 | } 23 | 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /libraries/wutsocket/socket.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | int 4 | socket(int domain, 5 | int type, 6 | int protocol) 7 | { 8 | int rc, fd, dev; 9 | 10 | dev = FindDevice("soc:"); 11 | if (dev == -1) { 12 | return -1; 13 | } 14 | 15 | fd = __alloc_handle(dev); 16 | if (fd == -1) { 17 | return -1; 18 | } 19 | 20 | rc = RPLWRAP(socket)(domain, type, protocol); 21 | if (rc == -1) { 22 | __release_handle(fd); 23 | return __wut_get_nsysnet_result(NULL, rc); 24 | } 25 | 26 | *(int *)__get_handle(fd)->fileStruct = rc; 27 | return fd; 28 | } 29 | 30 | -------------------------------------------------------------------------------- /cafe/nn_idbe.def: -------------------------------------------------------------------------------- 1 | :NAME nn_idbe 2 | 3 | :TEXT 4 | Cancel__Q2_2nn4idbeFv 5 | CheckDownloadResult__Q2_2nn4idbeFPQ3_2nn4idbe15DownloadContext 6 | CreateIconDownloadContext__Q2_2nn4idbeFPQ3_2nn4idbe15DownloadContextPvULUsb 7 | CreateLatestIconDownloadContext__Q2_2nn4idbeFPQ3_2nn4idbe15DownloadContextPvULb 8 | DecryptIconFile__Q2_2nn4idbeFPvPCv 9 | DecryptIconFile__Q2_2nn4idbeFPvPCvUL 10 | DestroyDownloadContext__Q2_2nn4idbeFPQ3_2nn4idbe15DownloadContext 11 | DownloadIconFile__Q2_2nn4idbeFPvULUsb 12 | DownloadLatestIconFile__Q2_2nn4idbeFPvULb 13 | Finalize__Q2_2nn4idbeFv 14 | Initialize__Q2_2nn4idbeFv 15 | SupportCtrTitle__Q2_2nn4idbeFv 16 | -------------------------------------------------------------------------------- /cafe/ntag.def: -------------------------------------------------------------------------------- 1 | :NAME ntag 2 | 3 | :TEXT 4 | NTAGAbort 5 | NTAGConvertMasterDataToWriteData 6 | NTAGConvertMasterDataToWriteDataForT2T 7 | NTAGConvertT2T 8 | NTAGCreateAllWriteData 9 | NTAGCreateAllWriteDataForT2T 10 | NTAGDetect 11 | NTAGFormat 12 | NTAGInit 13 | NTAGInitEx 14 | NTAGIsInit 15 | NTAGParseHeader 16 | NTAGProc 17 | NTAGRead 18 | NTAGReadT2T 19 | NTAGReadT2TRawData 20 | NTAGSetFormatSettings 21 | NTAGSetReadOnly 22 | NTAGSetTagDetectCallback 23 | NTAGShutdown 24 | NTAGWrite 25 | NTAGWriteT2T 26 | NTAGWriteT2TConfigArea 27 | NTAGWriteT2TLockArea 28 | NTAGWriteT2TRawData 29 | NTAGWriteT2TRawDataEx 30 | NTAGWriteT2TWithConvert 31 | -------------------------------------------------------------------------------- /include/gx2/tessellation.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include "enum.h" 5 | 6 | /** 7 | * \defgroup gx2_tessellation Tessellation 8 | * \ingroup gx2 9 | * @{ 10 | */ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | void 17 | GX2SetTessellation(GX2TessellationMode tessellationMode, 18 | GX2PrimitiveMode primitiveMode, 19 | GX2IndexType indexType); 20 | 21 | void 22 | GX2SetMinTessellationLevel(float min); 23 | 24 | void 25 | GX2SetMaxTessellationLevel(float max); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | 31 | /** @} */ 32 | -------------------------------------------------------------------------------- /include/sndcore2/result.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup sndcore2_result Result 6 | * \ingroup sndcore2 7 | * 8 | * @{ 9 | */ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | //! A value from enum AX_RESULT. 16 | typedef int32_t AXResult; 17 | 18 | enum AX_RESULT 19 | { 20 | AX_RESULT_SUCCESS = 0, 21 | AX_RESULT_INVALID_DEVICE_TYPE = -1, 22 | AX_RESULT_INVALID_DRC_VS_MODE = -13, 23 | AX_RESULT_VOICE_IS_RUNNING = -18, 24 | AX_RESULT_DELAY_TOO_BIG = -19, 25 | }; 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | 31 | /** @} */ 32 | -------------------------------------------------------------------------------- /libraries/wutstdc++/wut_gthread_mutex.cpp: -------------------------------------------------------------------------------- 1 | #include "wut_gthread.h" 2 | 3 | void 4 | __wut_mutex_init_function(OSMutex *mutex) 5 | { 6 | OSInitMutex(mutex); 7 | } 8 | 9 | int 10 | __wut_mutex_lock(OSMutex *mutex) 11 | { 12 | OSLockMutex(mutex); 13 | return 0; 14 | } 15 | 16 | int 17 | __wut_mutex_trylock(OSMutex *mutex) 18 | { 19 | if (!OSTryLockMutex(mutex)) { 20 | return -1; 21 | } 22 | 23 | return 0; 24 | } 25 | 26 | int 27 | __wut_mutex_unlock(OSMutex *mutex) 28 | { 29 | OSUnlockMutex(mutex); 30 | return 0; 31 | } 32 | 33 | int 34 | __wut_mutex_destroy(OSMutex *mutex) 35 | { 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /cafe/nn_temp.def: -------------------------------------------------------------------------------- 1 | :NAME nn_temp 2 | 3 | :TEXT 4 | TEMPChangeDir 5 | TEMPChangeDirAsync 6 | TEMPChangeOthersMode 7 | TEMPChangeOthersModeAsync 8 | TEMPCreateAndInitTempDir 9 | TEMPGetDirGlobalPath 10 | TEMPGetDirPath 11 | TEMPGetFreeSpaceSize 12 | TEMPGetFreeSpaceSizeAsync 13 | TEMPGetStat 14 | TEMPGetStatAsync 15 | TEMPInit 16 | TEMPMakeDir 17 | TEMPMakeDirAsync 18 | TEMPMountTempDir 19 | TEMPOpenDir 20 | TEMPOpenDirAsync 21 | TEMPOpenFile 22 | TEMPOpenFileAsync 23 | TEMPOpenNewFile 24 | TEMPOpenNewFileAsync 25 | TEMPRemove 26 | TEMPRemoveAsync 27 | TEMPRename 28 | TEMPRenameAsync 29 | TEMPShutdown 30 | TEMPShutdownTempDir 31 | TEMPUnmountTempDir 32 | -------------------------------------------------------------------------------- /libraries/wutcrt/crt0_rpl.s: -------------------------------------------------------------------------------- 1 | .extern main 2 | .extern exit 3 | .extern __init_wut 4 | .extern __fini_wut 5 | 6 | .section .crt0, "ax", @progbits 7 | .global __rpl_start 8 | __rpl_start: 9 | stwu 1, -0x14(1) 10 | mflr 0 11 | stw 0, 0x18(1) 12 | stw 3, 0xC(1) 13 | stw 4, 0x10(1) 14 | cmpwi 3, 2 15 | beq unload 16 | 17 | load: 18 | # Load 19 | bl __init_wut 20 | bl __eabi 21 | lwz 3, 0xC(1) 22 | lwz 4, 0x10(1) 23 | bl rpl_entry 24 | addi 1, 1, 0x14 25 | blr 26 | 27 | unload: 28 | # Handle unload 29 | lwz 3, 0xC(1) 30 | lwz 4, 0x10(1) 31 | bl rpl_entry 32 | addi 1, 1, 0x14 33 | b exit 34 | 35 | -------------------------------------------------------------------------------- /libraries/libwhb/include/whb/log.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup whb_log Logger 6 | * \ingroup whb 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | typedef void (*LogHandlerFn)(const char *msg); 15 | 16 | BOOL 17 | WHBAddLogHandler(LogHandlerFn fn); 18 | 19 | BOOL 20 | WHBRemoveLogHandler(LogHandlerFn fn); 21 | 22 | BOOL 23 | WHBLogWrite(const char *str); 24 | 25 | BOOL 26 | WHBLogPrint(const char *str); 27 | 28 | BOOL 29 | WHBLogWritef(const char *fmt, ...); 30 | 31 | BOOL 32 | WHBLogPrintf(const char *fmt, ...); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | /** @} */ 39 | -------------------------------------------------------------------------------- /libraries/wutdevoptab/devoptab_fs_dirclose.c: -------------------------------------------------------------------------------- 1 | #include "devoptab_fs.h" 2 | 3 | int 4 | __wut_fs_dirclose(struct _reent *r, 5 | DIR_ITER *dirState) 6 | { 7 | FSStatus status; 8 | FSCmdBlock cmd; 9 | __wut_fs_dir_t *dir; 10 | 11 | if (!dirState) { 12 | r->_errno = EINVAL; 13 | return -1; 14 | } 15 | 16 | FSInitCmdBlock(&cmd); 17 | dir = (__wut_fs_dir_t *)(dirState->dirStruct); 18 | status = FSCloseDir(__wut_devoptab_fs_client, &cmd, dir->fd, FS_ERROR_FLAG_ALL); 19 | if (status < 0) { 20 | r->_errno = __wut_fs_translate_error(status); 21 | return -1; 22 | } 23 | 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /libraries/wutdevoptab/devoptab_fs_dirreset.c: -------------------------------------------------------------------------------- 1 | #include "devoptab_fs.h" 2 | 3 | int 4 | __wut_fs_dirreset(struct _reent *r, 5 | DIR_ITER *dirState) 6 | { 7 | FSStatus status; 8 | FSCmdBlock cmd; 9 | __wut_fs_dir_t *dir; 10 | 11 | if (!dirState) { 12 | r->_errno = EINVAL; 13 | return -1; 14 | } 15 | 16 | FSInitCmdBlock(&cmd); 17 | dir = (__wut_fs_dir_t *)(dirState->dirStruct); 18 | status = FSRewindDir(__wut_devoptab_fs_client, &cmd, dir->fd, FS_ERROR_FLAG_ALL); 19 | if (status < 0) { 20 | r->_errno = __wut_fs_translate_error(status); 21 | return -1; 22 | } 23 | 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /samples/cmake/my_first_rpl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.2) 2 | project(my_first_rpl C) 3 | include("${DEVKITPRO}/wut/share/wut.cmake" REQUIRED) 4 | 5 | add_executable(my_first_rpl my_first_rpl.c) 6 | wut_add_exports(my_first_rpl exports.def) 7 | wut_create_rpl(my_first_rpl) 8 | 9 | add_executable(my_first_rpx my_first_rpx.c) 10 | wut_link_rpl(my_first_rpx my_first_rpl) 11 | wut_create_rpx(my_first_rpx) 12 | 13 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/my_first_rpx.rpx" 14 | DESTINATION "${CMAKE_INSTALL_PREFIX}") 15 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/my_first_rpl.rpl" 16 | DESTINATION "${CMAKE_INSTALL_PREFIX}") 17 | -------------------------------------------------------------------------------- /cafe/nn_cmpt.def: -------------------------------------------------------------------------------- 1 | :NAME nn_cmpt 2 | 3 | :TEXT 4 | CMPTAcctClearInternalState 5 | CMPTAcctGetDrcCtrlEnabled 6 | CMPTAcctGetEula 7 | CMPTAcctGetPcConf 8 | CMPTAcctGetProfile 9 | CMPTAcctGetScreenType 10 | CMPTAcctSetDrcCtrlEnabled 11 | CMPTAcctSetEula 12 | CMPTAcctSetEulaBySlotNo 13 | CMPTAcctSetPcConf 14 | CMPTAcctSetProfile 15 | CMPTAcctSetScreenType 16 | CMPTCheckScreenState 17 | CMPTExLaunch 18 | CMPTExPrepareLaunch 19 | CMPTExPrepareLaunchTest 20 | CMPTExSetWorkBuffer 21 | CMPTGetDataSize 22 | CMPTGetSystemVersion 23 | CMPTInitSystem 24 | CMPTIsClean 25 | CMPTIsPlayableDisc 26 | CMPTLaunchDataManager 27 | CMPTLaunchMenu 28 | CMPTLaunchTest 29 | CMPTLaunchTitle 30 | CMPTSetDirty 31 | -------------------------------------------------------------------------------- /cafe/nn_vctl.def: -------------------------------------------------------------------------------- 1 | :NAME nn_vctl 2 | 3 | :TEXT 4 | Finalize__Q2_2nn4vctlFv 5 | GetInstallContentIds__Q2_2nn4vctlFPUiT1UiPCcULQ3_2nn4Cafe9MediaType 6 | GetInstallContentIndices__Q2_2nn4vctlFPUiPUsUiPCcULQ3_2nn4Cafe9MediaType 7 | GetInstallRequiredSize__Q2_2nn4vctlFPULPCcULQ3_2nn4Cafe9MediaType 8 | GetTentativeUpdateInfo__Q2_2nn4vctlFPQ3_2nn4vctl10UpdateInfoULQ3_2nn4Cafe9MediaType 9 | GetTitleVersionInfo__Q2_2nn4vctlFPQ3_2nn4vctl16TitleVersionInfoULQ3_2nn4Cafe9MediaType 10 | GetUpdateInfo__Q2_2nn4vctlFPQ3_2nn4vctl10UpdateInfoULQ3_2nn4Cafe9MediaType 11 | GetUpdateInfo__Q2_2nn4vctlFPQ3_2nn4vctl10UpdateInfoULQ3_2nn4Cafe9MediaTypeQ3_2nn4vctl16UpdateInfoOption 12 | Initialize__Q2_2nn4vctlFv 13 | -------------------------------------------------------------------------------- /libraries/wutnewlib/wut_gettod_r.c: -------------------------------------------------------------------------------- 1 | #include "wut_newlib.h" 2 | #include "wut_clock.h" 3 | 4 | #include 5 | 6 | int 7 | __wut_gettod_r(struct _reent *ptr, 8 | struct timeval *tp, 9 | struct timezone *tz) 10 | { 11 | OSTime time = OSGetTime(); 12 | 13 | if (tp != NULL) { 14 | tp->tv_sec = (time_t)OSTicksToSeconds(time); 15 | 16 | time -= OSSecondsToTicks(tp->tv_sec); 17 | tp->tv_usec = (long)OSTicksToMicroseconds(time); 18 | 19 | tp->tv_sec += EPOCH_DIFF_SECS; 20 | } 21 | 22 | if (tz != NULL) { 23 | tz->tz_minuteswest = 0; 24 | tz->tz_dsttime = 0; 25 | } 26 | 27 | return 0; 28 | } 29 | -------------------------------------------------------------------------------- /cafe/nsysuhs.def: -------------------------------------------------------------------------------- 1 | :NAME nsysuhs 2 | 3 | :TEXT 4 | UhsAcquireInterface 5 | UhsAdministerDevice 6 | UhsAdministerEndpoint 7 | UhsAdministerEndpointOpt 8 | UhsClassDrvReg 9 | UhsClassDrvUnReg 10 | UhsClearEndpointHalt 11 | UhsClientClose 12 | UhsClientOpen 13 | UhsGetAlternateInterface 14 | UhsGetCurrentFrame 15 | UhsGetDescriptorString 16 | UhsGetFullConfigDescriptor 17 | UhsGetInterface 18 | UhsQueryInterfaces 19 | UhsReleaseInterface 20 | UhsSetInterface 21 | UhsSubmitBulkRequest 22 | UhsSubmitBulkRequestAsync 23 | UhsSubmitControlRequest 24 | UhsSubmitControlRequestAsync 25 | UhsSubmitInterruptRequest 26 | UhsSubmitInterruptRequestAsync 27 | UhsSubmitIsocRequest 28 | UhsSubmitIsocRequestAsync 29 | -------------------------------------------------------------------------------- /libraries/libwhb/src/gfx_heap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | BOOL 5 | GfxHeapInitMEM1(); 6 | 7 | BOOL 8 | GfxHeapDestroyMEM1(); 9 | 10 | BOOL 11 | GfxHeapInitForeground(); 12 | 13 | BOOL 14 | GfxHeapDestroyForeground(); 15 | 16 | void * 17 | GfxHeapAllocMEM1(uint32_t size, 18 | uint32_t alignment); 19 | 20 | void 21 | GfxHeapFreeMEM1(void *block); 22 | 23 | void * 24 | GfxHeapAllocForeground(uint32_t size, 25 | uint32_t alignment); 26 | 27 | void 28 | GfxHeapFreeForeground(void *block); 29 | 30 | void * 31 | GfxHeapAllocMEM2(uint32_t size, 32 | uint32_t alignment); 33 | 34 | void 35 | GfxHeapFreeMEM2(void *block); 36 | -------------------------------------------------------------------------------- /libraries/wutdevoptab/devoptab_fs_rmdir.c: -------------------------------------------------------------------------------- 1 | #include "devoptab_fs.h" 2 | 3 | int 4 | __wut_fs_rmdir(struct _reent *r, 5 | const char *name) 6 | { 7 | FSStatus status; 8 | FSCmdBlock cmd; 9 | 10 | if (!name) { 11 | r->_errno = EINVAL; 12 | return -1; 13 | } 14 | 15 | char *fixedPath = __wut_fs_fixpath(r, name); 16 | if (!fixedPath) { 17 | return -1; 18 | } 19 | 20 | FSInitCmdBlock(&cmd); 21 | status = FSRemove(__wut_devoptab_fs_client, &cmd, fixedPath, FS_ERROR_FLAG_ALL); 22 | free(fixedPath); 23 | if (status < 0) { 24 | r->_errno = __wut_fs_translate_error(status); 25 | return -1; 26 | } 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /libraries/wutdevoptab/devoptab_fs_chdir.c: -------------------------------------------------------------------------------- 1 | #include "devoptab_fs.h" 2 | 3 | int 4 | __wut_fs_chdir(struct _reent *r, 5 | const char *path) 6 | { 7 | FSStatus status; 8 | FSCmdBlock cmd; 9 | 10 | if (!path) { 11 | r->_errno = EINVAL; 12 | return -1; 13 | } 14 | 15 | char *fixedPath = __wut_fs_fixpath(r, path); 16 | if (!fixedPath) { 17 | return -1; 18 | } 19 | 20 | FSInitCmdBlock(&cmd); 21 | status = FSChangeDir(__wut_devoptab_fs_client, &cmd, fixedPath, FS_ERROR_FLAG_ALL); 22 | free(fixedPath); 23 | if (status < 0) { 24 | r->_errno = __wut_fs_translate_error(status); 25 | return -1; 26 | } 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /libraries/wutstdc++/wut_gthread_recursive_mutex.cpp: -------------------------------------------------------------------------------- 1 | #include "wut_gthread.h" 2 | 3 | int 4 | __wut_recursive_mutex_init_function(OSMutex *mutex) 5 | { 6 | OSInitMutex(mutex); 7 | return 0; 8 | } 9 | 10 | int 11 | __wut_recursive_mutex_lock(OSMutex *mutex) 12 | { 13 | OSLockMutex(mutex); 14 | return 0; 15 | } 16 | 17 | int 18 | __wut_recursive_mutex_trylock(OSMutex *mutex) 19 | { 20 | if (!OSTryLockMutex(mutex)) { 21 | return -1; 22 | } 23 | 24 | return 0; 25 | } 26 | 27 | int 28 | __wut_recursive_mutex_unlock(OSMutex *mutex) 29 | { 30 | OSUnlockMutex(mutex); 31 | return 0; 32 | } 33 | 34 | int 35 | __wut_recursive_mutex_destroy(OSMutex *mutex) 36 | { 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /libraries/wutsocket/stubs.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | #include 3 | 4 | struct servent * 5 | getservbyname(const char *name, 6 | const char *proto) 7 | { 8 | h_errno = NO_RECOVERY; 9 | errno = ENOSYS; 10 | return NULL; 11 | } 12 | 13 | struct servent * 14 | getservbyport(int port, 15 | const char *proto) 16 | { 17 | h_errno = NO_RECOVERY; 18 | errno = ENOSYS; 19 | return NULL; 20 | } 21 | 22 | struct servent * 23 | getservent(void) 24 | { 25 | h_errno = NO_RECOVERY; 26 | errno = ENOSYS; 27 | return NULL; 28 | } 29 | 30 | struct hostent * 31 | gethostent(void) 32 | { 33 | h_errno = NO_RECOVERY; 34 | errno = ENOSYS; 35 | return NULL; 36 | } 37 | -------------------------------------------------------------------------------- /libraries/wutdevoptab/devoptab_fs_unlink.c: -------------------------------------------------------------------------------- 1 | #include "devoptab_fs.h" 2 | 3 | int 4 | __wut_fs_unlink(struct _reent *r, 5 | const char *name) 6 | { 7 | FSStatus status; 8 | FSCmdBlock cmd; 9 | char *fixedPath; 10 | 11 | if (!name) { 12 | r->_errno = EINVAL; 13 | return -1; 14 | } 15 | 16 | fixedPath = __wut_fs_fixpath(r, name); 17 | if (!fixedPath) { 18 | return -1; 19 | } 20 | 21 | FSInitCmdBlock(&cmd); 22 | status = FSRemove(__wut_devoptab_fs_client, &cmd, fixedPath, FS_ERROR_FLAG_ALL); 23 | free(fixedPath); 24 | if (status < 0) { 25 | r->_errno = __wut_fs_translate_error(status); 26 | return -1; 27 | } 28 | 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /libraries/wutnewlib/wut_clock.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // The Wii U epoch is at 2000, so we must map it to 1970 for gettime 4 | #define WIIU_EPOCH_YEAR (2000) 5 | 6 | #define EPOCH_YEAR (1970) 7 | #define EPOCH_YEARS_SINCE_LEAP 2 8 | #define EPOCH_YEARS_SINCE_CENTURY 70 9 | #define EPOCH_YEARS_SINCE_LEAP_CENTURY 370 10 | 11 | #define EPOCH_DIFF_YEARS (2000 - EPOCH_YEAR) 12 | #define EPOCH_DIFF_DAYS \ 13 | ((EPOCH_DIFF_YEARS * 365) + \ 14 | (EPOCH_DIFF_YEARS - 1 + EPOCH_YEARS_SINCE_LEAP) / 4 - \ 15 | (EPOCH_DIFF_YEARS - 1 + EPOCH_YEARS_SINCE_CENTURY) / 100 + \ 16 | (EPOCH_DIFF_YEARS - 1 + EPOCH_YEARS_SINCE_LEAP_CENTURY) / 400) 17 | #define EPOCH_DIFF_SECS (60ull * 60ull * 24ull * (uint64_t)EPOCH_DIFF_DAYS) 18 | -------------------------------------------------------------------------------- /libraries/wutsocket/accept.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | int 4 | accept(int sockfd, 5 | struct sockaddr *address, 6 | socklen_t *addrlen) 7 | { 8 | int rc, fd, dev; 9 | 10 | fd = __wut_get_nsysnet_fd(sockfd); 11 | if (fd == -1) { 12 | return -1; 13 | } 14 | 15 | dev = __get_handle(sockfd)->device; 16 | sockfd = fd; 17 | 18 | fd = __alloc_handle(dev); 19 | if (fd == -1) { 20 | return -1; 21 | } 22 | 23 | rc = RPLWRAP(accept)(sockfd, address, addrlen); 24 | if (rc == -1) { 25 | __release_handle(fd); 26 | return __wut_get_nsysnet_result(NULL, rc); 27 | } 28 | 29 | *(int *)__get_handle(fd)->fileStruct = rc; 30 | return fd; 31 | } 32 | 33 | -------------------------------------------------------------------------------- /include/nn/pdm/pdm_c.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup nn_pdm_c 6 | * \ingroup nn_pdm 7 | * C functions for PDM 8 | * @{ 9 | */ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | /** 16 | * Initializes PDM. 17 | * Needs to be called before using other functions. 18 | * 19 | * \return 20 | * 0 on success. 21 | */ 22 | uint32_t 23 | PDMInitialize(); 24 | 25 | /** 26 | * Finalize PDM. 27 | */ 28 | void 29 | PDMFinalize(); 30 | 31 | /** 32 | * Close all opened PDM Files. 33 | */ 34 | void 35 | PDMCloseAllFiles(); 36 | 37 | void 38 | PDMNotifySetTimeBeginEvent(); 39 | 40 | void 41 | PDMNotifySetTimeEndEvent(); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | /** @} */ 48 | -------------------------------------------------------------------------------- /include/gx2r/mem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "resource.h" 4 | 5 | /** 6 | * \defgroup gx2r_mem Memory 7 | * \ingroup gx2r 8 | * @{ 9 | */ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef void * (*GX2RAllocFunction)(GX2RResourceFlags, uint32_t, uint32_t); 16 | typedef void (*GX2RFreeFunction)(GX2RResourceFlags, void *); 17 | 18 | void 19 | GX2RInvalidateMemory(GX2RResourceFlags flags, 20 | void *buffer, 21 | uint32_t size); 22 | 23 | BOOL 24 | GX2RIsUserMemory(GX2RResourceFlags flags); 25 | 26 | void 27 | GX2RSetAllocator(GX2RAllocFunction allocFn, 28 | GX2RFreeFunction freeFn); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | /** @} */ 35 | -------------------------------------------------------------------------------- /libraries/wutsocket/wut_socket.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #define __LINUX_ERRNO_EXTENSIONS__ 11 | #include 12 | 13 | int __wut_get_nsysnet_fd(int fd); 14 | int __wut_get_nsysnet_result(struct _reent *r, int rc); 15 | 16 | int __wut_socket_open(struct _reent *r, void *fileStruct, const char *path, int flags, int mode); 17 | int __wut_socket_close(struct _reent *r, void *fd); 18 | ssize_t __wut_socket_write(struct _reent *r, void *fd, const char *ptr, size_t len); 19 | ssize_t __wut_socket_read(struct _reent *r, void *fd, char *ptr, size_t len); 20 | 21 | -------------------------------------------------------------------------------- /libraries/wutdevoptab/devoptab_fs_chmod.c: -------------------------------------------------------------------------------- 1 | #include "devoptab_fs.h" 2 | 3 | int 4 | __wut_fs_chmod(struct _reent *r, 5 | const char *path, 6 | mode_t mode) 7 | { 8 | FSStatus status; 9 | FSCmdBlock cmd; 10 | 11 | if (!path) { 12 | r->_errno = EINVAL; 13 | return -1; 14 | } 15 | 16 | char *fixedPath = __wut_fs_fixpath(r, path); 17 | if (!fixedPath) { 18 | return -1; 19 | } 20 | 21 | FSInitCmdBlock(&cmd); 22 | status = FSChangeMode(__wut_devoptab_fs_client, &cmd, fixedPath, 23 | (FSMode)mode, FS_ERROR_FLAG_ALL); 24 | free(fixedPath); 25 | if (status < 0) { 26 | r->_errno = __wut_fs_translate_error(status); 27 | return -1; 28 | } 29 | 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /include/netinet/in.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | #define INADDR_ANY 0x00000000 6 | #define INADDR_LOOPBACK 0x7F000001 7 | #define INADDR_BROADCAST 0xFFFFFFFF 8 | #define INADDR_NONE 0xFFFFFFFF 9 | 10 | #define INET_ADDRSTRLEN 16 11 | 12 | #define IPPROTO_IP 0 13 | #define IPPROTO_TCP 6 14 | #define IPPROTO_UDP 17 15 | 16 | #define IP_TOS 3 17 | #define IP_TTL 4 18 | 19 | typedef uint16_t in_port_t; 20 | typedef uint32_t in_addr_t; 21 | 22 | struct in_addr { 23 | in_addr_t s_addr; 24 | }; 25 | 26 | struct sockaddr_in { 27 | sa_family_t sin_family; 28 | in_port_t sin_port; 29 | struct in_addr sin_addr; 30 | unsigned char sin_zero[8]; 31 | }; 32 | -------------------------------------------------------------------------------- /include/coreinit/fiber.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup coreinit_fiber Fiber 6 | * \ingroup coreinit 7 | * 8 | * @{ 9 | */ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef void (*OSFiberEntryFn)(); 16 | typedef void (*OSFiberExEntryFn)(uint32_t arg1, uint32_t arg2, 17 | uint32_t arg3, uint32_t arg4); 18 | 19 | int32_t 20 | OSSwitchFiber(OSFiberEntryFn entry, 21 | void *stack); 22 | 23 | int32_t 24 | OSSwitchFiberEx(uint32_t arg1, 25 | uint32_t arg2, 26 | uint32_t arg3, 27 | uint32_t arg4, 28 | OSFiberExEntryFn entry, 29 | void *stack); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | /** @} */ 36 | -------------------------------------------------------------------------------- /include/nn/acp/save.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | /** 7 | * \defgroup nn_acp_save Save 8 | * \ingroup nn_acp 9 | * 10 | * Save data services 11 | * @{ 12 | */ 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | ACPResult 19 | ACPCreateSaveDir(uint32_t persistentId, 20 | ACPDeviceType deviceType); 21 | 22 | ACPResult 23 | ACPIsExternalStorageRequired(BOOL* required); 24 | 25 | ACPResult 26 | ACPMountExternalStorage(); 27 | 28 | ACPResult 29 | ACPMountSaveDir(); 30 | 31 | ACPResult 32 | ACPRepairSaveMetaDir(); 33 | 34 | ACPResult 35 | ACPUnmountExternalStorage(); 36 | 37 | ACPResult 38 | ACPUnmountSaveDir(); 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | /** @} */ 45 | -------------------------------------------------------------------------------- /libraries/wutdevoptab/devoptab_fs_mkdir.c: -------------------------------------------------------------------------------- 1 | #include "devoptab_fs.h" 2 | 3 | int 4 | __wut_fs_mkdir(struct _reent *r, 5 | const char *path, 6 | int mode) 7 | { 8 | FSError status; 9 | FSCmdBlock cmd; 10 | char *fixedPath; 11 | 12 | if (!path) { 13 | r->_errno = EINVAL; 14 | return -1; 15 | } 16 | 17 | fixedPath = __wut_fs_fixpath(r, path); 18 | if (!fixedPath) { 19 | return -1; 20 | } 21 | 22 | // TODO: Use mode to set directory attributes. 23 | FSInitCmdBlock(&cmd); 24 | status = FSMakeDir(__wut_devoptab_fs_client, &cmd, fixedPath, FS_ERROR_FLAG_ALL); 25 | free(fixedPath); 26 | if (status < 0) { 27 | r->_errno = __wut_fs_translate_error(status); 28 | return -1; 29 | } 30 | 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /include/gx2r/displaylist.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "resource.h" 4 | 5 | /** 6 | * \defgroup gx2r_displaylist Display List 7 | * \ingroup gx2r 8 | * @{ 9 | */ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef struct GX2RBuffer GX2RBuffer; 16 | 17 | void 18 | GX2RBeginDisplayListEx(GX2RBuffer *displayList, 19 | uint32_t unknown, 20 | GX2RResourceFlags flags); 21 | 22 | uint32_t 23 | GX2REndDisplayList(GX2RBuffer *displayList); 24 | 25 | void 26 | GX2RCallDisplayList(GX2RBuffer *displayList, 27 | uint32_t size); 28 | 29 | void 30 | GX2RDirectCallDisplayList(GX2RBuffer *displayList, 31 | uint32_t size); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | /** @} */ 38 | -------------------------------------------------------------------------------- /include/nsysnet/socket.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #warning "nsysnet/socket.h is deprecated; please use standard socket headers instead." 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #define NSN_EAGAIN EAGAIN 19 | #define NSN_EWOULDBLOCK EWOULDBLOCK 20 | 21 | __attribute__ ((deprecated)) 22 | static inline int 23 | socketclose(int sockfd) 24 | { 25 | return close(sockfd); 26 | } 27 | 28 | __attribute__ ((deprecated)) 29 | static inline int 30 | socketlasterr() 31 | { 32 | return errno; 33 | } 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /libraries/wutstdc++/wut_gthread_once.cpp: -------------------------------------------------------------------------------- 1 | #include "wut_gthread.h" 2 | 3 | int 4 | __wut_once(__wut_once_t *once, 5 | void (*func) (void)) 6 | { 7 | uint32_t value = 0; 8 | 9 | if (OSCompareAndSwapAtomicEx(once, 10 | __WUT_ONCE_VALUE_INIT, 11 | __WUT_ONCE_VALUE_STARTED, 12 | &value)) { 13 | func(); 14 | OSCompareAndSwapAtomic(once, 15 | __WUT_ONCE_VALUE_STARTED, 16 | __WUT_ONCE_VALUE_DONE); 17 | } else if (value != __WUT_ONCE_VALUE_DONE) { 18 | while (!OSCompareAndSwapAtomic(once, 19 | __WUT_ONCE_VALUE_DONE, 20 | __WUT_ONCE_VALUE_DONE)); 21 | } 22 | 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /libraries/wutcrt/wut_crt.c: -------------------------------------------------------------------------------- 1 | void __init_wut_malloc(); 2 | void __init_wut_newlib(); 3 | void __init_wut_stdcpp(); 4 | void __init_wut_devoptab(); 5 | void __attribute__((weak)) __init_wut_socket(); 6 | 7 | void __fini_wut_malloc(); 8 | void __fini_wut_newlib(); 9 | void __fini_wut_stdcpp(); 10 | void __fini_wut_devoptab(); 11 | void __attribute__((weak)) __fini_wut_socket(); 12 | 13 | void __attribute__((weak)) 14 | __init_wut() 15 | { 16 | __init_wut_malloc(); 17 | __init_wut_newlib(); 18 | __init_wut_stdcpp(); 19 | __init_wut_devoptab(); 20 | if (&__init_wut_socket) __init_wut_socket(); 21 | } 22 | 23 | void __attribute__((weak)) 24 | __fini_wut() 25 | { 26 | if (&__fini_wut_socket) __fini_wut_socket(); 27 | __fini_wut_devoptab(); 28 | __fini_wut_stdcpp(); 29 | __fini_wut_newlib(); 30 | __fini_wut_malloc(); 31 | } 32 | -------------------------------------------------------------------------------- /include/gx2/utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup gx2_utils Utils 6 | * \ingroup gx2 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | typedef enum GX2_SQ_SEL 15 | { 16 | GX2_SQ_SEL_X = 0, 17 | GX2_SQ_SEL_Y = 1, 18 | GX2_SQ_SEL_Z = 2, 19 | GX2_SQ_SEL_W = 3, 20 | 21 | GX2_SQ_SEL_R = 0, 22 | GX2_SQ_SEL_G = 1, 23 | GX2_SQ_SEL_B = 2, 24 | GX2_SQ_SEL_A = 3, 25 | 26 | GX2_SQ_SEL_0 = 4, 27 | GX2_SQ_SEL_1 = 5, 28 | GX2_SQ_SEL_MASK = 7, 29 | } GX2_SQ_SEL; 30 | 31 | #define GX2_SEL_MASK(x, y, z, w) (((x) << 24) | ((y) << 16) | ((z) << 8) | (w)) 32 | #define GX2_COMP_MAP(x, y, z, w) (((x) << 24) | ((y) << 16) | ((z) << 8) | (w)) 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | /** @} */ 39 | -------------------------------------------------------------------------------- /include/gx2r/draw.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include "resource.h" 5 | 6 | /** 7 | * \defgroup gx2r_draw Draw 8 | * \ingroup gx2r 9 | * @{ 10 | */ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | typedef struct GX2RBuffer GX2RBuffer; 17 | 18 | void 19 | GX2RSetAttributeBuffer(GX2RBuffer *buffer, 20 | uint32_t index, 21 | uint32_t stride, 22 | uint32_t offset); 23 | 24 | void 25 | GX2RDrawIndexed(GX2PrimitiveMode mode, 26 | GX2RBuffer *buffer, 27 | GX2IndexType indexType, 28 | uint32_t count, 29 | uint32_t indexOffset, 30 | uint32_t vertexOffset, 31 | uint32_t numInstances); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | /** @} */ 38 | -------------------------------------------------------------------------------- /include/coreinit/rendezvous.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup coreinit_rendezvous Rendezvous 6 | * \ingroup coreinit 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | typedef struct OSRendezvous OSRendezvous; 15 | 16 | struct OSRendezvous 17 | { 18 | uint32_t core[3]; 19 | WUT_UNKNOWN_BYTES(4); 20 | }; 21 | WUT_CHECK_OFFSET(OSRendezvous, 0x00, core); 22 | WUT_CHECK_SIZE(OSRendezvous, 0x10); 23 | 24 | void 25 | OSInitRendezvous(OSRendezvous *rendezvous); 26 | 27 | BOOL 28 | OSWaitRendezvous(OSRendezvous *rendezvous, 29 | uint32_t coreMask); 30 | 31 | BOOL 32 | OSWaitRendezvousWithTimeout(OSRendezvous *rendezvous, 33 | uint32_t coreMask, 34 | OSTime timeout); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | /** @} */ 41 | -------------------------------------------------------------------------------- /include/arpa/inet.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | uint32_t 10 | htonl(uint32_t hostlong); 11 | 12 | uint16_t 13 | htons(uint16_t hostshort); 14 | 15 | uint32_t 16 | ntohl(uint32_t netlong); 17 | 18 | uint16_t 19 | ntohs(uint16_t netshort); 20 | 21 | in_addr_t 22 | inet_addr(const char *cp); 23 | 24 | int 25 | inet_aton(const char *cp, 26 | struct in_addr *inp); 27 | 28 | char * 29 | inet_ntoa(struct in_addr in); 30 | 31 | char * 32 | inet_ntoa_r(struct in_addr in, 33 | char *buf); 34 | 35 | const char * 36 | inet_ntop(int af, 37 | const void *src, 38 | char *dst, 39 | socklen_t size); 40 | 41 | int 42 | inet_pton(int af, 43 | const char *src, 44 | void *dst); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | -------------------------------------------------------------------------------- /include/gx2/swap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "enum.h" 4 | 5 | /** 6 | * \defgroup gx2_swap Swap 7 | * \ingroup gx2 8 | * @{ 9 | */ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef struct GX2ColorBuffer GX2ColorBuffer; 16 | typedef struct GX2Texture GX2Texture; 17 | 18 | void 19 | GX2CopyColorBufferToScanBuffer(const GX2ColorBuffer *buffer, 20 | GX2ScanTarget scanTarget); 21 | 22 | void 23 | GX2SwapScanBuffers(); 24 | 25 | BOOL 26 | GX2GetLastFrame(GX2ScanTarget scanTarget, 27 | GX2Texture *texture); 28 | 29 | BOOL 30 | GX2GetLastFrameGamma(GX2ScanTarget scanTarget, 31 | float *gammaOut); 32 | 33 | uint32_t 34 | GX2GetSwapInterval(); 35 | 36 | void 37 | GX2SetSwapInterval(uint32_t interval); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | /** @} */ 44 | -------------------------------------------------------------------------------- /libraries/wutsocket/host.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | #include 3 | #include 4 | 5 | struct hostent * 6 | gethostbyaddr(const void *addr, 7 | socklen_t len, 8 | int type) 9 | { 10 | if (!addr || !len) { 11 | h_errno = HOST_NOT_FOUND; 12 | return NULL; 13 | } 14 | 15 | if (type != AF_INET) { 16 | h_errno = HOST_NOT_FOUND; 17 | return NULL; 18 | } 19 | 20 | struct hostent *ent = RPLWRAP(gethostbyaddr)(addr, len, type); 21 | 22 | h_errno = *RPLWRAP(get_h_errno)(); 23 | 24 | return ent; 25 | } 26 | 27 | struct hostent * 28 | gethostbyname(const char *name) 29 | { 30 | if (!name) { 31 | h_errno = HOST_NOT_FOUND; 32 | return NULL; 33 | } 34 | 35 | struct hostent *ent = RPLWRAP(gethostbyname)(name); 36 | 37 | h_errno = *RPLWRAP(get_h_errno)(); 38 | 39 | return ent; 40 | } 41 | -------------------------------------------------------------------------------- /libraries/libwhb/include/whb/file.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup whb_file Filesystem 6 | * \ingroup whb 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | typedef enum WHBFileError 15 | { 16 | WHB_FILE_OK = 0, 17 | WHB_FILE_FATAL_ERROR = -1, 18 | } WHBFileError; 19 | 20 | BOOL 21 | WHBDeInitFileSystem(); 22 | 23 | int32_t 24 | WHBOpenFile(const char *path, 25 | const char *mode); 26 | 27 | uint32_t 28 | WHBGetFileSize(int32_t handle); 29 | 30 | uint32_t 31 | WHBReadFile(int32_t handle, 32 | void *buf, 33 | uint32_t size, 34 | uint32_t count); 35 | 36 | int32_t 37 | WHBCloseFile(int32_t handle); 38 | 39 | char * 40 | WHBReadWholeFile(const char *path, 41 | uint32_t *outSize); 42 | 43 | void 44 | WHBFreeWholeFile(char *file); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | /** @} */ 51 | -------------------------------------------------------------------------------- /libraries/wutdevoptab/devoptab_fs_fstat.c: -------------------------------------------------------------------------------- 1 | #include "devoptab_fs.h" 2 | 3 | int 4 | __wut_fs_fstat(struct _reent *r, 5 | void *fd, 6 | struct stat *st) 7 | { 8 | FSStatus status; 9 | FSStat fsStat; 10 | FSCmdBlock cmd; 11 | __wut_fs_file_t *file; 12 | 13 | if (!fd || !st) { 14 | r->_errno = EINVAL; 15 | return -1; 16 | } 17 | 18 | FSInitCmdBlock(&cmd); 19 | file = (__wut_fs_file_t *)fd; 20 | status = FSGetStatFile(__wut_devoptab_fs_client, &cmd, file->fd, &fsStat, 21 | FS_ERROR_FLAG_ALL); 22 | if (status < 0) { 23 | r->_errno = __wut_fs_translate_error(status); 24 | return -1; 25 | } 26 | 27 | memset(st, 0, sizeof(struct stat)); 28 | st->st_size = fsStat.size; 29 | st->st_uid = fsStat.owner; 30 | st->st_gid = fsStat.group; 31 | st->st_nlink = 1; 32 | st->st_mode = fsStat.mode | S_IFREG; 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /include/coreinit/systeminfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup coreinit_systeminfo System Info 6 | * \ingroup coreinit 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | typedef struct OSSystemInfo OSSystemInfo; 15 | 16 | struct OSSystemInfo 17 | { 18 | uint32_t busClockSpeed; 19 | uint32_t coreClockSpeed; 20 | int64_t baseTime; 21 | WUT_UNKNOWN_BYTES(0x10); 22 | }; 23 | WUT_CHECK_OFFSET(OSSystemInfo, 0x0, busClockSpeed); 24 | WUT_CHECK_OFFSET(OSSystemInfo, 0x4, coreClockSpeed); 25 | WUT_CHECK_OFFSET(OSSystemInfo, 0x8, baseTime); 26 | WUT_CHECK_SIZE(OSSystemInfo, 0x20); 27 | 28 | OSSystemInfo * 29 | OSGetSystemInfo(); 30 | 31 | BOOL 32 | OSEnableHomeButtonMenu(BOOL enable); 33 | 34 | BOOL 35 | OSIsHomeButtonMenuEnabled(); 36 | 37 | uint64_t 38 | OSGetOSID(); 39 | 40 | uint32_t 41 | __OSGetProcessSDKVersion(); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | /** @} */ 48 | -------------------------------------------------------------------------------- /libraries/wutdevoptab/devoptab_fs_truncate.c: -------------------------------------------------------------------------------- 1 | #include "devoptab_fs.h" 2 | 3 | int 4 | __wut_fs_ftruncate(struct _reent *r, 5 | void *fd, 6 | off_t len) 7 | { 8 | FSStatus status; 9 | FSCmdBlock cmd; 10 | __wut_fs_file_t *file; 11 | 12 | // Make sure length is non-negative 13 | if (!fd || len < 0) { 14 | r->_errno = EINVAL; 15 | return -1; 16 | } 17 | 18 | // Set the new file size 19 | FSInitCmdBlock(&cmd); 20 | file = (__wut_fs_file_t *)fd; 21 | status = FSSetPosFile(__wut_devoptab_fs_client, &cmd, file->fd, len, FS_ERROR_FLAG_ALL); 22 | if (status < 0) { 23 | r->_errno = __wut_fs_translate_error(status); 24 | return -1; 25 | } 26 | 27 | status = FSTruncateFile(__wut_devoptab_fs_client, &cmd, file->fd, FS_ERROR_FLAG_ALL); 28 | if (status < 0) { 29 | r->_errno = __wut_fs_translate_error(status); 30 | return -1; 31 | } 32 | 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /include/gx2/displaylist.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup gx2_displaylist Display List 6 | * \ingroup gx2 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | void 15 | GX2BeginDisplayListEx(void *displayList, 16 | uint32_t bytes, 17 | BOOL unk1); 18 | 19 | uint32_t 20 | GX2EndDisplayList(void *displayList); 21 | 22 | void 23 | GX2DirectCallDisplayList(const void *displayList, 24 | uint32_t bytes); 25 | 26 | void 27 | GX2CallDisplayList(const void *displayList, 28 | uint32_t bytes); 29 | 30 | BOOL 31 | GX2GetDisplayListWriteStatus(); 32 | 33 | BOOL 34 | GX2GetCurrentDisplayList(void **outDisplayList, 35 | uint32_t *outSize); 36 | 37 | void 38 | GX2CopyDisplayList(const void *displayList, 39 | uint32_t bytes); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | /** @} */ 46 | -------------------------------------------------------------------------------- /libraries/wutdevoptab/devoptab_fs_diropen.c: -------------------------------------------------------------------------------- 1 | #include "devoptab_fs.h" 2 | 3 | DIR_ITER * 4 | __wut_fs_diropen(struct _reent *r, 5 | DIR_ITER *dirState, 6 | const char *path) 7 | { 8 | FSDirectoryHandle fd; 9 | FSStatus status; 10 | FSCmdBlock cmd; 11 | __wut_fs_dir_t *dir; 12 | 13 | if (!dirState || !path) { 14 | r->_errno = EINVAL; 15 | return NULL; 16 | } 17 | 18 | char *fixedPath = __wut_fs_fixpath(r, path); 19 | if (!fixedPath) { 20 | return NULL; 21 | } 22 | 23 | FSInitCmdBlock(&cmd); 24 | dir = (__wut_fs_dir_t *)(dirState->dirStruct); 25 | status = FSOpenDir(__wut_devoptab_fs_client, &cmd, fixedPath, &fd, FS_ERROR_FLAG_ALL); 26 | free(fixedPath); 27 | if (status < 0) { 28 | r->_errno = __wut_fs_translate_error(status); 29 | return NULL; 30 | } 31 | 32 | dir->magic = FS_DIRITER_MAGIC; 33 | dir->fd = fd; 34 | memset(&dir->entry_data, 0, sizeof(dir->entry_data)); 35 | return dirState; 36 | } 37 | -------------------------------------------------------------------------------- /include/sys/filio.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | /* Generic file-descriptor ioctl's. */ 6 | #define FIOCLEX _IO('f', 1) /* set close on exec on fd */ 7 | #define FIONCLEX _IO('f', 2) /* remove close on exec */ 8 | #define FIONREAD _IOR('f', 127, int) /* get # bytes to read */ 9 | #define FIONWRITE _IOR('f', 119, int) /* get # bytes (yet) to write */ 10 | #define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */ 11 | #define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */ 12 | #define FIOSETOWN _IOW('f', 124, int) /* set owner */ 13 | #define FIOGETOWN _IOR('f', 123, int) /* get owner */ 14 | #define FIODTYPE _IOR('f', 122, int) /* get d_flags type part */ 15 | #define FIOGETLBA _IOR('f', 121, int) /* get start blk # */ 16 | struct fiodgname_arg { 17 | int len; 18 | void *buf; 19 | }; 20 | #define FIODGNAME _IOW('f', 120, struct fiodgname_arg) /* get dev. name */ 21 | #define FIONSPACE _IOR('f', 118, int) /* get space in send queue */ 22 | -------------------------------------------------------------------------------- /libraries/wutdevoptab/devoptab_fs_rename.c: -------------------------------------------------------------------------------- 1 | #include "devoptab_fs.h" 2 | 3 | int 4 | __wut_fs_rename(struct _reent *r, 5 | const char *oldName, 6 | const char *newName) 7 | { 8 | FSStatus status; 9 | FSCmdBlock cmd; 10 | char *fixedOldPath, *fixedNewPath; 11 | 12 | if (!oldName || !newName) { 13 | r->_errno = EINVAL; 14 | return -1; 15 | } 16 | 17 | fixedOldPath = __wut_fs_fixpath(r, oldName); 18 | if (!fixedOldPath) { 19 | return -1; 20 | } 21 | 22 | fixedNewPath = __wut_fs_fixpath(r, newName); 23 | if (!fixedNewPath) { 24 | free(fixedOldPath); 25 | return -1; 26 | } 27 | 28 | FSInitCmdBlock(&cmd); 29 | status = FSRename(__wut_devoptab_fs_client, &cmd, fixedOldPath, fixedNewPath, 30 | FS_ERROR_FLAG_ALL); 31 | free(fixedOldPath); 32 | free(fixedNewPath); 33 | 34 | if (status < 0) { 35 | r->_errno = __wut_fs_translate_error(status); 36 | return -1; 37 | } 38 | 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /cafe/erreula.def: -------------------------------------------------------------------------------- 1 | :NAME erreula 2 | 3 | :TEXT 4 | ErrEulaAppearError__3RplFRCQ3_2nn7erreula9AppearArg 5 | ErrEulaAppearHomeNixSign__3RplFRCQ3_2nn7erreula14HomeNixSignArg 6 | ErrEulaCalc__3RplFRCQ3_2nn7erreula14ControllerInfo 7 | ErrEulaChangeLang__3RplFQ3_2nn7erreula8LangType 8 | ErrEulaCreate__3RplFPUcQ3_2nn7erreula10RegionTypeQ3_2nn7erreula8LangTypeP8FSClient 9 | ErrEulaDestroy__3RplFv 10 | ErrEulaDisappearError__3RplFv 11 | ErrEulaDisappearHomeNixSign__3RplFv 12 | ErrEulaDrawDRC__3RplFv 13 | ErrEulaDrawTV__3RplFv 14 | ErrEulaGetResultCode__3RplFv 15 | ErrEulaGetResultType__3RplFv 16 | ErrEulaGetSelectButtonNumError__3RplFv 17 | ErrEulaGetStateErrorViewer__3RplFv 18 | ErrEulaIsAppearHomeNixSign__3RplFv 19 | ErrEulaIsDecideSelectButtonError__3RplFv 20 | ErrEulaIsDecideSelectLeftButtonError__3RplFv 21 | ErrEulaIsDecideSelectRightButtonError__3RplFv 22 | ErrEulaIsSelectCursorActive__3RplFv 23 | ErrEulaJump__3RplFPCcUi 24 | ErrEulaPlayAppearSE__3RplFb 25 | ErrEulaSetControllerRemo__3RplFQ3_2nn7erreula14ControllerType 26 | ErrEulaSetVersion__3RplFi 27 | -------------------------------------------------------------------------------- /cafe/nn_ndm.def: -------------------------------------------------------------------------------- 1 | :NAME nn_ndm 2 | 3 | :TEXT 4 | DisableResumeDaemons__Q2_2nn3ndmFv 5 | EnableConcurrentConnection__Q2_2nn3ndmFv 6 | EnableHomeButtonMenuAndBgProcess__Q2_2nn3ndmFi 7 | EnableResumeDaemons__Q2_2nn3ndmFv 8 | Finalize__Q2_2nn3ndmFv 9 | GetCurrentState__Q2_2nn3ndmFPQ4_2nn3ndm5CAFE_5State 10 | GetDaemonDisableCountByProcess__Q2_2nn3ndmFPiQ4_2nn3ndm4Cafe10DaemonName 11 | GetDaemonDisableCount__Q2_2nn3ndmFPiQ4_2nn3ndm4Cafe10DaemonName 12 | GetDaemonStatus__Q2_2nn3ndmFPQ4_2nn3ndm7IDaemon6StatusQ4_2nn3ndm4Cafe10DaemonName 13 | GetSchedulerDisableCount__Q2_2nn3ndmFPi 14 | GetTargetState__Q2_2nn3ndmFPQ4_2nn3ndm5CAFE_5State 15 | Initialize__Q2_2nn3ndmFv 16 | IsInitialized__Q2_2nn3ndmFv 17 | NDMDisableResumeDaemons 18 | NDMEnableHomeButtonMenuAndBgProcess 19 | NDMEnableResumeDaemons 20 | NDMFinalize 21 | NDMInitialize 22 | NDMIsResultSuccess 23 | ResumeDaemonsAndConnect__Q2_2nn3ndmFv 24 | ResumeDaemons__Q2_2nn3ndmFUi 25 | SuspendDaemonsAndDisconnectIfWireless__Q2_2nn3ndmFv 26 | SuspendDaemonsAndDisconnect__Q2_2nn3ndmFv 27 | SuspendDaemons__Q2_2nn3ndmFUi 28 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: C/C++ CI 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build: 7 | name: ubuntu-18.04 8 | runs-on: ubuntu-18.04 9 | container: devkitpro/devkitppc:latest 10 | 11 | steps: 12 | - uses: actions/checkout@v1 13 | with: 14 | submodules: true 15 | 16 | 17 | - name: install cmake 18 | run: | 19 | apt-get install -y cmake 20 | 21 | - name: Build 22 | run: | 23 | make -j2 24 | make install 25 | 26 | - name: Build Test 27 | run: | 28 | cd tests 29 | mkdir build && cd build 30 | cmake -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/wut/share/wut.toolchain.cmake ../ 31 | make -j2 32 | 33 | - name: Build Samples (Make) 34 | run: | 35 | cd samples/make 36 | make -j2 37 | 38 | - name: Build Samples (CMake) 39 | run: | 40 | cd samples/cmake 41 | mkdir build && cd build 42 | cmake -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/wut/share/wut.toolchain.cmake ../ 43 | make -j2 44 | -------------------------------------------------------------------------------- /cafe/dc.def: -------------------------------------------------------------------------------- 1 | :NAME dc 2 | 3 | :TEXT 4 | DCAssortedEnable 5 | DCCalcGamma 6 | DCCompat 7 | DCDisableCRTC 8 | DCDisableDVOCapInterrupt 9 | DCDisableTrigAInterrupt 10 | DCEnableCRTC 11 | DCEnableDVOCapInterrupt 12 | DCEnableDimming 13 | DCEnableFlipInterrupt 14 | DCEnablePipe 15 | DCEnableTrigAInterrupt 16 | DCEnableVlineInterrupt 17 | DCEnableVsyncInterrupt 18 | DCExit 19 | DCFlipBuffer 20 | DCForceMode 21 | DCGetBlankState 22 | DCGetBufferRequirement 23 | DCGetCRTCMode 24 | DCGetCurrentEye 25 | DCGetFormat 26 | DCGetFrameCount 27 | DCGetGamma 28 | DCGetLetterbox 29 | DCGetPitch 30 | DCGetRenderResolution 31 | DCGetUnderScan 32 | DCGetVertCount 33 | DCInit 34 | DCIsDimmingOn 35 | DCIsOVLEnable 36 | DCSetBuffer 37 | DCSetCRTCMode 38 | DCSetCompatPLL 39 | DCSetDVOCapCb 40 | DCSetFlipCb 41 | DCSetFormat 42 | DCSetGamma 43 | DCSetLetterbox 44 | DCSetPillarBox 45 | DCSetPitch 46 | DCSetRenderMode 47 | DCSetRenderResolution 48 | DCSetTVPALGamma 49 | DCSetTrigACb 50 | DCSetUnderScan 51 | DCSetUnderScanEx 52 | DCSetVIClock 53 | DCSetVlineCb 54 | DCSetVsyncCb 55 | DCUpdate 56 | -------------------------------------------------------------------------------- /libraries/wutnewlib/wut_newlib.c: -------------------------------------------------------------------------------- 1 | #include "wut_newlib.h" 2 | #include 3 | 4 | void(*__wut_exit)(int rc); 5 | extern void __fini_wut(void); 6 | 7 | int __syscall_lock_init(int *lock, int recursive) { 8 | return __wut_lock_init(lock,recursive); 9 | } 10 | 11 | int __syscall_lock_close(int *lock) { 12 | return __wut_lock_close(lock); 13 | } 14 | 15 | int __syscall_lock_release(int *lock) { 16 | return __wut_lock_release(lock); 17 | } 18 | 19 | int __syscall_lock_acquire(int *lock) { 20 | return __wut_lock_acquire(lock); 21 | } 22 | 23 | void __syscall_exit(int rc) { 24 | __fini_wut(); 25 | __wut_exit(rc); 26 | } 27 | 28 | int __syscall_gettod_r(struct _reent *ptr, struct timeval *tp, struct timezone *tz){ 29 | return __wut_gettod_r(ptr,tp,tz); 30 | } 31 | 32 | int __syscall_nanosleep(const struct timespec *req, struct timespec *rem){ 33 | return __wut_nanosleep(req, rem); 34 | } 35 | 36 | 37 | void 38 | __init_wut_newlib() 39 | { 40 | __wut_exit = RPLWRAP(exit); 41 | } 42 | 43 | void 44 | __fini_wut_newlib() 45 | { 46 | } 47 | -------------------------------------------------------------------------------- /samples/cmake/helloworld/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | int 9 | main(int argc, char **argv) 10 | { 11 | int last_tm_sec = -1; 12 | OSCalendarTime tm; 13 | 14 | WHBProcInit(); 15 | WHBLogConsoleInit(); 16 | WHBLogPrintf("Hello World!"); 17 | 18 | while(WHBProcIsRunning()) { 19 | OSTicksToCalendarTime(OSGetTime(), &tm); 20 | 21 | if (tm.tm_sec != last_tm_sec) { 22 | WHBLogPrintf("%02d/%02d/%04d %02d:%02d:%02d I'm still here.", 23 | tm.tm_mday, tm.tm_mon, tm.tm_year, 24 | tm.tm_hour, tm.tm_min, tm.tm_sec); 25 | last_tm_sec = tm.tm_sec; 26 | } 27 | 28 | WHBLogConsoleDraw(); 29 | OSSleepTicks(OSMillisecondsToTicks(100)); 30 | } 31 | 32 | WHBLogPrintf("Exiting... good bye."); 33 | WHBLogConsoleDraw(); 34 | OSSleepTicks(OSMillisecondsToTicks(1000)); 35 | 36 | WHBLogConsoleFree(); 37 | WHBProcShutdown(); 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /samples/make/helloworld/source/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | int 9 | main(int argc, char **argv) 10 | { 11 | int last_tm_sec = -1; 12 | OSCalendarTime tm; 13 | 14 | WHBProcInit(); 15 | WHBLogConsoleInit(); 16 | WHBLogPrintf("Hello World!"); 17 | 18 | while(WHBProcIsRunning()) { 19 | OSTicksToCalendarTime(OSGetTime(), &tm); 20 | 21 | if (tm.tm_sec != last_tm_sec) { 22 | WHBLogPrintf("%02d/%02d/%04d %02d:%02d:%02d I'm still here.", 23 | tm.tm_mday, tm.tm_mon, tm.tm_year, 24 | tm.tm_hour, tm.tm_min, tm.tm_sec); 25 | last_tm_sec = tm.tm_sec; 26 | } 27 | 28 | WHBLogConsoleDraw(); 29 | OSSleepTicks(OSMillisecondsToTicks(100)); 30 | } 31 | 32 | WHBLogPrintf("Exiting... good bye."); 33 | WHBLogConsoleDraw(); 34 | OSSleepTicks(OSMillisecondsToTicks(1000)); 35 | 36 | WHBLogConsoleFree(); 37 | WHBProcShutdown(); 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /libraries/wutnewlib/wut_lock.c: -------------------------------------------------------------------------------- 1 | #include "wut_newlib.h" 2 | 3 | #include 4 | #include 5 | 6 | int 7 | __wut_lock_init(int *lock, 8 | int recursive) 9 | { 10 | OSMutex *mutex = NULL; 11 | if (!lock) { 12 | return -1; 13 | } 14 | 15 | mutex = (OSMutex *)malloc(sizeof(OSMutex)); 16 | if (!mutex) { 17 | return -1; 18 | } 19 | 20 | OSInitMutex(mutex); 21 | *lock = (int)mutex; 22 | return 0; 23 | } 24 | 25 | int 26 | __wut_lock_close(int *lock) 27 | { 28 | if (!lock || *lock == 0) { 29 | return -1; 30 | } 31 | 32 | free((void *)*lock); 33 | *lock = 0; 34 | return 0; 35 | } 36 | 37 | int 38 | __wut_lock_acquire(int *lock) 39 | { 40 | OSMutex *mutex = (OSMutex *)*lock; 41 | if (!lock || *lock == 0) { 42 | return -1; 43 | } 44 | 45 | OSLockMutex(mutex); 46 | return 0; 47 | } 48 | 49 | int 50 | __wut_lock_release(int *lock) 51 | { 52 | OSMutex *mutex = (OSMutex *)*lock; 53 | if (!lock || *lock == 0) { 54 | return -1; 55 | } 56 | 57 | OSUnlockMutex(mutex); 58 | return 0; 59 | } 60 | -------------------------------------------------------------------------------- /libraries/wutnewlib/wut_newlib.h: -------------------------------------------------------------------------------- 1 | #ifndef __WUT_NEWLIB_H 2 | #define __WUT_NEWLIB_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | void * __wut_sbrk_r(struct _reent *r, ptrdiff_t incr); 10 | int __wut_lock_init(int *lock, int recursive); 11 | int __wut_lock_close(int *lock); 12 | int __wut_lock_acquire(int *lock); 13 | int __wut_lock_release(int *lock); 14 | void __wut_malloc_lock(struct _reent *r); 15 | void __wut_malloc_unlock(struct _reent *r); 16 | int __wut_gettod_r(struct _reent *ptr, struct timeval *tp, 17 | struct timezone *tz); 18 | int __wut_clock_gettime(clockid_t clock_id, struct timespec *tp); 19 | int __wut_clock_settime(clockid_t clock_id, const struct timespec *tp); 20 | int __wut_clock_getres(clockid_t clock_id, struct timespec *res); 21 | int __wut_nanosleep(const struct timespec *req, struct timespec *rem); 22 | 23 | void __init_wut_malloc_lock(); 24 | void __init_wut_sbrk_heap(); 25 | void __fini_wut_sbrk_heap(); 26 | 27 | #endif // ifndef __WUT_NEWLIB_H 28 | -------------------------------------------------------------------------------- /include/coreinit/energysaver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup coreinit_energysaver Energy saver 6 | * \ingroup coreinit 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | typedef int32_t IMError; 15 | 16 | IMError 17 | IMDisableAPD(); 18 | 19 | IMError 20 | IMDisableDim(); 21 | 22 | IMError 23 | IMEnableAPD(); 24 | 25 | IMError 26 | IMEnableDim(); 27 | 28 | IMError 29 | IMIsAPDEnabled(uint32_t *outValue); 30 | 31 | IMError 32 | IMIsAPDEnabledBySysSettings(uint32_t *outValue); 33 | 34 | IMError 35 | IMIsDimEnabled(uint32_t *outValue); 36 | 37 | IMError 38 | IMGetDimEnableDRC(uint32_t *outValue); 39 | 40 | IMError 41 | IMGetDimEnableTV(uint32_t *outValue); 42 | 43 | IMError 44 | IMGetDimPeriod(uint32_t *outValue); 45 | 46 | IMError 47 | IMGetTimeBeforeAPD(uint32_t *outSeconds); 48 | 49 | IMError 50 | IMGetTimeBeforeDimming(uint32_t *outSeconds); 51 | 52 | IMError 53 | IMSetDimEnableDRC(BOOL value); 54 | 55 | IMError 56 | IMSetDimEnableTV(BOOL value); 57 | 58 | IMError 59 | IMStartAPDVideoMode(); 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | /** @} */ 66 | -------------------------------------------------------------------------------- /cafe/nsyskbd.def: -------------------------------------------------------------------------------- 1 | :NAME nsyskbd 2 | 3 | :TEXT 4 | KBDEmptyQueue 5 | KBDExit 6 | KBDGetAccessSticky 7 | KBDGetChannelStatus 8 | KBDGetCountry 9 | KBDGetKey 10 | KBDGetLockProcessing 11 | KBDGetModState 12 | KBDGetRepeat 13 | KBDInit 14 | KBDInitRegionEU 15 | KBDInitRegionJP 16 | KBDInitRegionUS 17 | KBDResetChannel 18 | KBDSetAccessSticky 19 | KBDSetCountry 20 | KBDSetLeds 21 | KBDSetLedsAsync 22 | KBDSetLedsAsyncEx 23 | KBDSetLedsEx 24 | KBDSetLedsRetry 25 | KBDSetLedsRetryEx 26 | KBDSetLockProcessing 27 | KBDSetModState 28 | KBDSetRepeat 29 | KBDSetup 30 | KBDTeardown 31 | KBDTranslateHidCode 32 | KPRClearQueue 33 | KPRGetChar 34 | KPRGetMode 35 | KPRInitQueue 36 | KPRInitRegionEU 37 | KPRInitRegionJP 38 | KPRInitRegionUS 39 | KPRLookAhead 40 | KPRPutChar 41 | KPRRemoveChar 42 | KPRSetMode 43 | SKBDEmptyQueue 44 | SKBDGetAccessSticky 45 | SKBDGetChannelStatus 46 | SKBDGetCountry 47 | SKBDGetKey 48 | SKBDGetLockProcessing 49 | SKBDGetModState 50 | SKBDGetRepeat 51 | SKBDKeyEvent 52 | SKBDResetChannel 53 | SKBDSetAccessSticky 54 | SKBDSetCountry 55 | SKBDSetLockProcessing 56 | SKBDSetModState 57 | SKBDSetMode 58 | SKBDSetRepeat 59 | SKBDSetup 60 | SKBDTeardown 61 | -------------------------------------------------------------------------------- /libraries/wutsocket/addrinfo.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | #include 3 | #include 4 | 5 | int 6 | getaddrinfo(const char *node, 7 | const char *service, 8 | const struct addrinfo *hints, 9 | struct addrinfo **res) 10 | { 11 | int rc; 12 | 13 | if (!node && !service) { 14 | return EAI_NONAME; 15 | } 16 | 17 | if (!res) { 18 | errno = EINVAL; 19 | return EAI_SYSTEM; 20 | } 21 | 22 | rc = RPLWRAP(getaddrinfo)(node, service, hints, res); 23 | 24 | return rc; 25 | } 26 | 27 | void 28 | freeaddrinfo(struct addrinfo *res) 29 | { 30 | RPLWRAP(freeaddrinfo)(res); 31 | } 32 | 33 | int 34 | getnameinfo(const struct sockaddr *addr, 35 | socklen_t addrlen, 36 | char *host, 37 | socklen_t hostlen, 38 | char *serv, 39 | socklen_t servlen, 40 | int flags) 41 | { 42 | int rc; 43 | 44 | rc = RPLWRAP(getnameinfo)(addr, addrlen, host, hostlen, serv, servlen, flags); 45 | 46 | return rc; 47 | } 48 | 49 | const char * 50 | gai_strerror(int ecode) 51 | { 52 | return RPLWRAP(gai_strerror)(ecode); 53 | } 54 | -------------------------------------------------------------------------------- /include/coreinit/fastcondition.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "threadqueue.h" 4 | 5 | /** 6 | * \defgroup coreinit_fastcond Fast Condition Variable 7 | * \ingroup coreinit 8 | * 9 | * A condition variable to be used with an OSFastMutex. 10 | * 11 | * @{ 12 | */ 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | typedef struct OSFastCondition OSFastCondition; 19 | typedef struct OSFastMutex OSFastMutex; 20 | 21 | #define OS_FAST_CONDITION_TAG 0x664E6456u 22 | 23 | struct OSFastCondition 24 | { 25 | uint32_t tag; 26 | const char *name; 27 | WUT_UNKNOWN_BYTES(4); 28 | OSThreadQueue queue; 29 | }; 30 | WUT_CHECK_OFFSET(OSFastCondition, 0x00, tag); 31 | WUT_CHECK_OFFSET(OSFastCondition, 0x04, name); 32 | WUT_CHECK_OFFSET(OSFastCondition, 0x0c, queue); 33 | WUT_CHECK_SIZE(OSFastCondition, 0x1c); 34 | 35 | void 36 | OSFastCond_Init(OSFastCondition *condition, 37 | const char *name); 38 | 39 | void 40 | OSFastCond_Wait(OSFastCondition *condition, 41 | OSFastMutex *mutex); 42 | 43 | void 44 | OSFastCond_Signal(OSFastCondition *condition); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | /** @} */ 51 | -------------------------------------------------------------------------------- /libraries/wutsocket/NSSLCreateConnection.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | #include 3 | 4 | NSSLConnectionHandle 5 | RPLWRAP(NSSLCreateConnection)(NSSLContextHandle context, 6 | const char *host, 7 | int32_t hostLength, 8 | int32_t options, 9 | int32_t socket, 10 | int32_t block); 11 | 12 | NSSLConnectionHandle 13 | NSSLCreateConnection(NSSLContextHandle context, 14 | const char *host, 15 | int32_t hostLength, 16 | int32_t options, 17 | int32_t socket, 18 | int32_t block) 19 | { 20 | socket = __wut_get_nsysnet_fd(socket); 21 | if (socket == -1) { 22 | return NSSL_ERROR_INVALID_FD; 23 | } 24 | 25 | return RPLWRAP(NSSLCreateConnection)(context, 26 | host, 27 | hostLength, 28 | options, 29 | socket, 30 | block); 31 | } 32 | -------------------------------------------------------------------------------- /cafe/tcl.def: -------------------------------------------------------------------------------- 1 | :NAME tcl 2 | 3 | :TEXT 4 | AddrCombineBankPipeSwizzle 5 | AddrComputeCmaskAddrFromCoord 6 | AddrComputeCmaskCoordFromAddr 7 | AddrComputeCmaskInfo 8 | AddrComputeFmaskAddrFromCoord 9 | AddrComputeFmaskCoordFromAddr 10 | AddrComputeFmaskInfo 11 | AddrComputeHtileAddrFromCoord 12 | AddrComputeHtileCoordFromAddr 13 | AddrComputeHtileInfo 14 | AddrComputeSliceSwizzle 15 | AddrComputeSurfaceAddrFromCoord 16 | AddrComputeSurfaceCoordFromAddr 17 | AddrComputeSurfaceInfo 18 | AddrConvertTileIndex 19 | AddrConvertTileInfoToHW 20 | AddrCreate 21 | AddrDestroy 22 | AddrExtractBankPipeSwizzle 23 | AddrGetTileIndex 24 | AddrGetVersion 25 | AddrUseTileIndex 26 | ElemFlt32ToColorPixel 27 | ElemFlt32ToDepthPixel 28 | ElemGetExportNorm 29 | TCLAllocTilingAperture 30 | TCLCloseDebugFile 31 | TCLDebug 32 | TCLFreeTilingAperture 33 | TCLGetIHThreadPriority 34 | TCLGetInfo 35 | TCLGetInterruptCount 36 | TCLIHEnableInterrupt 37 | TCLIHRegister 38 | TCLIHUnregister 39 | TCLOpenDebugFile 40 | TCLReadRegister 41 | TCLReadTimestamp 42 | TCLReset 43 | TCLSetHangWait 44 | TCLSetIHThreadPriority 45 | TCLSetTimeout 46 | TCLSubmit 47 | TCLSubmitToRing 48 | TCLWaitForIdle 49 | TCLWaitTimestamp 50 | TCLWriteRegister 51 | -------------------------------------------------------------------------------- /include/gx2r/surface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "resource.h" 4 | 5 | /** 6 | * \defgroup gx2r_surface Surface 7 | * \ingroup gx2r 8 | * @{ 9 | */ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef struct GX2Surface GX2Surface; 16 | 17 | BOOL 18 | GX2RCreateSurface(GX2Surface *surface, 19 | GX2RResourceFlags flags); 20 | 21 | BOOL 22 | GX2RCreateSurfaceUserMemory(GX2Surface *surface, 23 | uint8_t *image, 24 | uint8_t *mipmap, 25 | GX2RResourceFlags flags); 26 | 27 | BOOL 28 | GX2RDestroySurfaceEx(GX2Surface *surface, 29 | GX2RResourceFlags flags); 30 | 31 | BOOL 32 | GX2RInvalidateSurface(GX2Surface *surface, 33 | int32_t level, 34 | GX2RResourceFlags flags); 35 | 36 | void * 37 | GX2RLockSurfaceEx(GX2Surface *surface, 38 | int32_t level, 39 | GX2RResourceFlags flags); 40 | 41 | void 42 | GX2RUnlockSurfaceEx(GX2Surface *surface, 43 | int32_t level, 44 | GX2RResourceFlags flags); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | /** @} */ 51 | -------------------------------------------------------------------------------- /cafe/lzma920.def: -------------------------------------------------------------------------------- 1 | :NAME lzma920 2 | 3 | :TEXT 4 | Bt3Zip_MatchFinder_GetMatches 5 | Bt3Zip_MatchFinder_Skip 6 | GetMatchesSpec1 7 | Hc3Zip_MatchFinder_GetMatches 8 | Hc3Zip_MatchFinder_Skip 9 | Lzma2Dec_Allocate 10 | Lzma2Dec_AllocateProbs 11 | Lzma2Dec_DecodeToBuf 12 | Lzma2Dec_DecodeToDic 13 | Lzma2Dec_Init 14 | Lzma2Decode 15 | Lzma2EncProps_Init 16 | Lzma2EncProps_Normalize 17 | Lzma2Enc_Create 18 | Lzma2Enc_Destroy 19 | Lzma2Enc_Encode 20 | Lzma2Enc_SetProps 21 | Lzma2Enc_WriteProperties 22 | LzmaCompress 23 | LzmaDec_Allocate 24 | LzmaDec_AllocateProbs 25 | LzmaDec_DecodeToBuf 26 | LzmaDec_DecodeToDic 27 | LzmaDec_Free 28 | LzmaDec_FreeProbs 29 | LzmaDec_Init 30 | LzmaDecode 31 | LzmaEncProps_GetDictSize 32 | LzmaEncProps_Init 33 | LzmaEncProps_Normalize 34 | LzmaEnc_Create 35 | LzmaEnc_Destroy 36 | LzmaEnc_Encode 37 | LzmaEnc_MemEncode 38 | LzmaEnc_SetProps 39 | LzmaEnc_WriteProperties 40 | LzmaEncode 41 | LzmaProps_Decode 42 | LzmaUncompress 43 | MatchFinder_Construct 44 | MatchFinder_Create 45 | MatchFinder_CreateVTable 46 | MatchFinder_Free 47 | MatchFinder_GetPointerToCurrentPos 48 | MatchFinder_Init 49 | MatchFinder_MoveBlock 50 | MatchFinder_NeedMove 51 | MatchFinder_Normalize3 52 | MatchFinder_ReadIfRequired 53 | MatchFinder_ReduceOffsets 54 | -------------------------------------------------------------------------------- /cafe/nlibcurl.def: -------------------------------------------------------------------------------- 1 | :NAME nlibcurl 2 | 3 | :TEXT 4 | curl_easy_cleanup 5 | curl_easy_duphandle 6 | curl_easy_escape 7 | curl_easy_getinfo 8 | curl_easy_init 9 | curl_easy_pause 10 | curl_easy_perform 11 | curl_easy_recv 12 | curl_easy_reset 13 | curl_easy_send 14 | curl_easy_setopt 15 | curl_easy_strerror 16 | curl_easy_unescape 17 | curl_escape 18 | curl_formadd 19 | curl_formfree 20 | curl_free 21 | curl_getdate 22 | curl_getenv 23 | curl_global_cleanup 24 | curl_global_init 25 | curl_global_init_mem 26 | curl_maprintf 27 | curl_mfprintf 28 | curl_mprintf 29 | curl_msnprintf 30 | curl_msprintf 31 | curl_multi_add_handle 32 | curl_multi_assign 33 | curl_multi_cleanup 34 | curl_multi_fdset 35 | curl_multi_info_read 36 | curl_multi_init 37 | curl_multi_perform 38 | curl_multi_remove_handle 39 | curl_multi_setopt 40 | curl_multi_socket 41 | curl_multi_socket_action 42 | curl_multi_socket_all 43 | curl_multi_strerror 44 | curl_multi_timeout 45 | curl_mvaprintf 46 | curl_mvfprintf 47 | curl_mvprintf 48 | curl_mvsnprintf 49 | curl_mvsprintf 50 | curl_share_cleanup 51 | curl_share_init 52 | curl_share_setopt 53 | curl_share_strerror 54 | curl_slist_append 55 | curl_slist_free_all 56 | curl_unescape 57 | curl_version 58 | curl_version_info 59 | mw_curl_easy_init 60 | -------------------------------------------------------------------------------- /include/coreinit/core.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup coreinit_core Core 6 | * \ingroup coreinit 7 | * 8 | * Provides information about each core of the system's processor. 9 | * @{ 10 | */ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | 17 | /** 18 | * Gets the number of cores in the system. On a retail Wii U, this is always 3. 19 | * 20 | * \returns 21 | * The core count of the system. 22 | */ 23 | uint32_t 24 | OSGetCoreCount(); 25 | 26 | 27 | /** 28 | * Gets the core executing the current thread. 29 | * 30 | * \returns 31 | * The ID of the current core. 32 | */ 33 | uint32_t 34 | OSGetCoreId(); 35 | 36 | 37 | /** 38 | * Gets the main core of the system. On a retail Wii U, this is always core 1. 39 | * 40 | * \returns 41 | * The ID of the main core. 42 | */ 43 | uint32_t 44 | OSGetMainCoreId(); 45 | 46 | 47 | /** 48 | * Determines whether the current thread is running on the main core. 49 | * On a retail Wii U, the main core is always core 1. 50 | * 51 | * \returns 52 | * \c true if the current core is the main core. 53 | * 54 | * \sa 55 | *
  • \link OSGetMainCoreId \endlink
56 | */ 57 | BOOL 58 | OSIsMainCore(); 59 | 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | /** @} */ 66 | -------------------------------------------------------------------------------- /include/coreinit/cosreport.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup coreinit_cosreport COS Report 6 | * \ingroup coreinit 7 | * 8 | * @{ 9 | */ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef enum COSReportLevel{ 16 | COS_REPORT_LEVEL_ERROR = 0, 17 | COS_REPORT_LEVEL_WARN = 1, 18 | COS_REPORT_LEVEL_INFO = 2, 19 | COS_REPORT_LEVEL_VERBOSE = 3, 20 | } COSReportLevel; 21 | 22 | typedef enum COSReportModule{ 23 | COS_REPORT_MODULE_UNKNOWN_0 = 0, 24 | COS_REPORT_MODULE_UNKNOWN_1 = 1, 25 | COS_REPORT_MODULE_UNKNOWN_2 = 2, 26 | COS_REPORT_MODULE_UNKNOWN_5 = 5, 27 | } COSReportModule; 28 | 29 | void 30 | COSVReport(COSReportModule module, 31 | COSReportLevel level, 32 | const char* fmt, 33 | ...); 34 | 35 | void 36 | COSError(COSReportModule module, 37 | const char* fmt, 38 | ...); 39 | 40 | void 41 | COSInfo(COSReportModule module, 42 | const char* fmt, 43 | ...); 44 | 45 | void 46 | COSVerbose(COSReportModule module, 47 | const char* fmt, 48 | ...); 49 | 50 | void 51 | COSWarn(COSReportModule module, 52 | const char* fmt, 53 | ...); 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | /** @} */ 60 | -------------------------------------------------------------------------------- /libraries/wutsocket/fcntl.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | int 4 | fcntl(int fd, 5 | int cmd, ...) 6 | { 7 | va_list args; 8 | int sockfd, rc, flags, nonblock; 9 | socklen_t nonblock_len = sizeof(nonblock); 10 | 11 | if (cmd != F_GETFL && cmd != F_SETFL) { 12 | errno = EOPNOTSUPP; 13 | return -1; 14 | } 15 | 16 | sockfd = __wut_get_nsysnet_fd(fd); 17 | if (sockfd == -1) { 18 | return -1; 19 | } 20 | 21 | /* F_SETFL */ 22 | if (cmd == F_SETFL) { 23 | va_start(args, cmd); 24 | flags = va_arg(args, int); 25 | va_end(args); 26 | 27 | nonblock = !!(flags & O_NONBLOCK); 28 | rc = RPLWRAP(setsockopt)(sockfd, 29 | SOL_SOCKET, 30 | SO_NONBLOCK, 31 | &nonblock, 32 | nonblock_len); 33 | return __wut_get_nsysnet_result(NULL, rc); 34 | } 35 | 36 | /* F_GETFL */ 37 | rc = RPLWRAP(getsockopt)(sockfd, 38 | SOL_SOCKET, 39 | SO_NONBLOCK, 40 | &nonblock, 41 | &nonblock_len); 42 | if (rc == -1) { 43 | return __wut_get_nsysnet_result(NULL, rc); 44 | } 45 | flags = (nonblock) ? O_NONBLOCK : 0; 46 | return flags; 47 | } 48 | 49 | -------------------------------------------------------------------------------- /cafe/vpadbase.def: -------------------------------------------------------------------------------- 1 | :NAME vpadbase 2 | 3 | :TEXT 4 | VPADBASEClearIRCEvent 5 | VPADBASEClearNFCEvent 6 | VPADBASEClearNFCMode 7 | VPADBASEClearSyncWaitCount 8 | VPADBASEGetCalibrationData 9 | VPADBASEGetEEPROMData 10 | VPADBASEGetFactorySetting 11 | VPADBASEGetGameControllerMode 12 | VPADBASEGetHeadphoneStatus 13 | VPADBASEGetIRCStatus 14 | VPADBASEGetLCDStatus 15 | VPADBASEGetMessageLEDStatus 16 | VPADBASEGetMicStatus 17 | VPADBASEGetMotorOnRemainingCount 18 | VPADBASEGetNFCStatus 19 | VPADBASEGetPowerButtonPressStatus 20 | VPADBASEGetSensorBarSetting 21 | VPADBASEGetSensorBarStatus 22 | VPADBASEGetState 23 | VPADBASEGetStickOffset 24 | VPADBASEGetTVMenuStatus 25 | VPADBASEGetTrollInvalidSetting 26 | VPADBASEGetTrollInvalidStatus 27 | VPADBASEGetVideoStreamingStatus 28 | VPADBASEGetVolumeOverrideSetting 29 | VPADBASEGetVolumeOverrideStatus 30 | VPADBASEInit 31 | VPADBASEInitVolumeOverrideSettingSyncTime 32 | VPADBASEIsInit 33 | VPADBASERead 34 | VPADBASESetAutoSamplingBuf 35 | VPADBASESetCalibrationData 36 | VPADBASESetGameControllerMode 37 | VPADBASESetMotorOnRemainingCount 38 | VPADBASESetPowerButtonDisableMode 39 | VPADBASESetPowerButtonPressStatus 40 | VPADBASESetSamplingCallback 41 | VPADBASESetSensorBarSetting 42 | VPADBASESetStickOffset 43 | VPADBASESetStickOrigin 44 | VPADBASESetTrollInvalidSetting 45 | VPADBASESetVolumeOverrideSetting 46 | VPADBASEShutdown 47 | -------------------------------------------------------------------------------- /include/gx2/texture.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "surface.h" 4 | 5 | /** 6 | * \defgroup gx2_texture Texture 7 | * \ingroup gx2 8 | * @{ 9 | */ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef struct GX2Texture GX2Texture; 16 | 17 | struct GX2Texture 18 | { 19 | GX2Surface surface; 20 | uint32_t viewFirstMip; 21 | uint32_t viewNumMips; 22 | uint32_t viewFirstSlice; 23 | uint32_t viewNumSlices; 24 | uint32_t compMap; 25 | 26 | uint32_t regs[5]; 27 | }; 28 | WUT_CHECK_OFFSET(GX2Texture, 0x0, surface); 29 | WUT_CHECK_OFFSET(GX2Texture, 0x74, viewFirstMip); 30 | WUT_CHECK_OFFSET(GX2Texture, 0x78, viewNumMips); 31 | WUT_CHECK_OFFSET(GX2Texture, 0x7c, viewFirstSlice); 32 | WUT_CHECK_OFFSET(GX2Texture, 0x80, viewNumSlices); 33 | WUT_CHECK_OFFSET(GX2Texture, 0x84, compMap); 34 | WUT_CHECK_OFFSET(GX2Texture, 0x88, regs); 35 | WUT_CHECK_SIZE(GX2Texture, 0x9c); 36 | 37 | void 38 | GX2InitTextureRegs(GX2Texture *texture); 39 | 40 | void 41 | GX2SetPixelTexture(const GX2Texture *texture, 42 | uint32_t unit); 43 | 44 | void 45 | GX2SetVertexTexture(const GX2Texture *texture, 46 | uint32_t unit); 47 | 48 | void 49 | GX2SetGeometryTexture(const GX2Texture *texture, 50 | uint32_t unit); 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | /** @} */ 57 | -------------------------------------------------------------------------------- /cafe/tve.def: -------------------------------------------------------------------------------- 1 | :NAME tve 2 | 3 | :TEXT 4 | I2CInit 5 | I2CMEnable 6 | I2CWriteDRCData 7 | I2CWriteDRCInfo 8 | TVECECInit 9 | TVECECReceiveCommand 10 | TVECECSendCommand 11 | TVECreateSysConfig 12 | TVEDisableStereoMode 13 | TVEDisableVideoOut 14 | TVEEnableVideoOut 15 | TVEExit 16 | TVEGet3DFormatEDID 17 | TVEGet3DInfo 18 | TVEGetAnalogAudioDACEnable 19 | TVEGetAnalogDTVStatus 20 | TVEGetAnalogStat 21 | TVEGetAudioConfig 22 | TVEGetAudioMute 23 | TVEGetCGMS 24 | TVEGetConfigVersion 25 | TVEGetContentType 26 | TVEGetCurrentConfig 27 | TVEGetCurrentPort 28 | TVEGetEDIDBaseCheckSum 29 | TVEGetEDIDInfo 30 | TVEGetEDIDRaw 31 | TVEGetHDCP 32 | TVEGetHDMIErrorStat 33 | TVEGetHotPlugState 34 | TVEGetMaxAudioChannel 35 | TVEGetSinkHDCPInfo 36 | TVEGetWSS 37 | TVEInit 38 | TVEIsCECEnable 39 | TVEIsForceRGBEnable 40 | TVEReset4in1 41 | TVESet3DInfo 42 | TVESetAll 43 | TVESetAllAsync 44 | TVESetAllEx 45 | TVESetAllExAsync 46 | TVESetAnalogAudioDACEnable 47 | TVESetAnalogAudioDACFlag 48 | TVESetAudioConfig 49 | TVESetAudioMute 50 | TVESetCECEnable 51 | TVESetCGMS 52 | TVESetContentType 53 | TVESetForceRGBMode 54 | TVESetForceShutDown 55 | TVESetHDCP 56 | TVESetHDMIHotplug5V 57 | TVESetRCA 58 | TVESetVideoMute 59 | TVESetWSS 60 | TVESetWiiCompat 61 | TVESetWiiCompatEx 62 | TVEShutDown 63 | TVEVsyncSignal 64 | TVEWait4in1Done 65 | TVEWait4in1DoneWithTimeout 66 | __TVESetContentTypeParam 67 | __TVESetRCAFlag 68 | -------------------------------------------------------------------------------- /libraries/wutdevoptab/devoptab_fs_dirnext.c: -------------------------------------------------------------------------------- 1 | #include "devoptab_fs.h" 2 | 3 | int 4 | __wut_fs_dirnext(struct _reent *r, 5 | DIR_ITER *dirState, 6 | char *filename, 7 | struct stat *filestat) 8 | { 9 | FSStatus status; 10 | FSCmdBlock cmd; 11 | __wut_fs_dir_t *dir; 12 | 13 | if (!dirState || !filename || !filestat) { 14 | r->_errno = EINVAL; 15 | return -1; 16 | } 17 | 18 | FSInitCmdBlock(&cmd); 19 | dir = (__wut_fs_dir_t *)(dirState->dirStruct); 20 | memset(&dir->entry_data, 0, sizeof(dir->entry_data)); 21 | status = FSReadDir(__wut_devoptab_fs_client, &cmd, dir->fd, &dir->entry_data, 22 | FS_ERROR_FLAG_ALL); 23 | if (status < 0) { 24 | r->_errno = __wut_fs_translate_error(status); 25 | return -1; 26 | } 27 | 28 | // Fill in the stat info 29 | memset(filestat, 0, sizeof(struct stat)); 30 | filestat->st_ino = 0; 31 | 32 | if (dir->entry_data.info.flags & FS_STAT_DIRECTORY) { 33 | filestat->st_mode = S_IFDIR; 34 | } else { 35 | filestat->st_mode = S_IFREG; 36 | } 37 | 38 | filestat->st_uid = dir->entry_data.info.owner; 39 | filestat->st_gid = dir->entry_data.info.group; 40 | filestat->st_size = dir->entry_data.info.size; 41 | 42 | memset(filename, 0, NAME_MAX); 43 | strcpy(filename, dir->entry_data.name); 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /include/nsysnet/_netdb.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | /** 6 | * \defgroup nsysnet_netdb Netdb 7 | * \ingroup nsysnet 8 | * @{ 9 | */ 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | struct hostent * 15 | RPLWRAP(gethostbyaddr)(const void *addr, 16 | size_t len, 17 | int type); 18 | 19 | struct hostent * 20 | RPLWRAP(gethostbyname)(const char *name); 21 | 22 | int 23 | RPLWRAP(getaddrinfo)(const char *node, 24 | const char *service, 25 | const struct addrinfo *hints, 26 | struct addrinfo **res); 27 | 28 | void 29 | RPLWRAP(freeaddrinfo)(struct addrinfo *res); 30 | 31 | int 32 | RPLWRAP(getnameinfo)(const struct sockaddr *addr, 33 | socklen_t addrlen, 34 | char *host, 35 | socklen_t hostlen, 36 | char *serv, 37 | socklen_t servlen, 38 | int flags); 39 | 40 | void 41 | RPLWRAP(clear_resolver_cache)(void); 42 | 43 | int 44 | RPLWRAP(set_resolver_allocator)(void* (*alloc)(uint32_t), 45 | void (*free)(void*)); 46 | 47 | int * 48 | RPLWRAP(get_h_errno)(void); 49 | 50 | const char * 51 | RPLWRAP(gai_strerror)(int ecode); 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | /** @} */ 58 | -------------------------------------------------------------------------------- /include/coreinit/atomic.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup coreinit_atomic Atomic Operations 6 | * \ingroup coreinit 7 | * 8 | * These functions are used for atomically operating on 32 bit values in memory. 9 | * @{ 10 | */ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | BOOL 17 | OSCompareAndSwapAtomic(volatile uint32_t *ptr, 18 | uint32_t compare, 19 | uint32_t value); 20 | 21 | BOOL 22 | OSCompareAndSwapAtomicEx(volatile uint32_t *ptr, 23 | uint32_t compare, 24 | uint32_t value, 25 | uint32_t *old); 26 | 27 | uint32_t 28 | OSSwapAtomic(volatile uint32_t *ptr, 29 | uint32_t value); 30 | 31 | int32_t 32 | OSAddAtomic(volatile int32_t *ptr, 33 | int32_t value); 34 | 35 | uint32_t 36 | OSAndAtomic(volatile uint32_t *ptr, 37 | uint32_t value); 38 | 39 | uint32_t 40 | OSOrAtomic(volatile uint32_t *ptr, 41 | uint32_t value); 42 | 43 | uint32_t 44 | OSXorAtomic(volatile uint32_t *ptr, 45 | uint32_t value); 46 | 47 | BOOL 48 | OSTestAndClearAtomic(volatile uint32_t *ptr, 49 | uint32_t bit); 50 | 51 | BOOL 52 | OSTestAndSetAtomic(volatile uint32_t *ptr, 53 | uint32_t bit); 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | /** @} */ 60 | -------------------------------------------------------------------------------- /include/coreinit/spinlock.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "time.h" 4 | 5 | /** 6 | * \defgroup coreinit_spinlock Spinlock 7 | * \ingroup coreinit 8 | * @{ 9 | */ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef struct OSSpinLock OSSpinLock; 16 | 17 | struct WUT_ALIGNAS(16) OSSpinLock 18 | { 19 | uint32_t owner; 20 | WUT_UNKNOWN_BYTES(0x4); 21 | uint32_t recursion; 22 | WUT_UNKNOWN_BYTES(0x4); 23 | }; 24 | WUT_CHECK_OFFSET(OSSpinLock, 0x0, owner); 25 | WUT_CHECK_OFFSET(OSSpinLock, 0x8, recursion); 26 | WUT_CHECK_SIZE(OSSpinLock, 0x10); 27 | 28 | void 29 | OSInitSpinLock(OSSpinLock *spinlock); 30 | 31 | BOOL 32 | OSAcquireSpinLock(OSSpinLock *spinlock); 33 | 34 | BOOL 35 | OSTryAcquireSpinLock(OSSpinLock *spinlock); 36 | 37 | BOOL 38 | OSTryAcquireSpinLockWithTimeout(OSSpinLock *spinlock, 39 | OSTime timeout); 40 | 41 | BOOL 42 | OSReleaseSpinLock(OSSpinLock *spinlock); 43 | 44 | BOOL 45 | OSUninterruptibleSpinLock_Acquire(OSSpinLock *spinlock); 46 | 47 | BOOL 48 | OSUninterruptibleSpinLock_TryAcquire(OSSpinLock *spinlock); 49 | 50 | BOOL 51 | OSUninterruptibleSpinLock_TryAcquireWithTimeout(OSSpinLock *spinlock, 52 | OSTime timeout); 53 | 54 | BOOL 55 | OSUninterruptibleSpinLock_Release(OSSpinLock *spinlock); 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | /** @} */ 62 | -------------------------------------------------------------------------------- /libraries/libwhb/src/log_udp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | static int 12 | sSocket = -1; 13 | 14 | static struct sockaddr_in 15 | sSendAddr; 16 | 17 | #define SERVER_PORT 4405 18 | 19 | static void 20 | udpLogHandler(const char *msg) 21 | { 22 | sendto(sSocket, 23 | msg, 24 | strlen(msg), 25 | 0, 26 | (struct sockaddr *)&sSendAddr, 27 | sizeof(struct sockaddr_in)); 28 | } 29 | 30 | BOOL 31 | WHBLogUdpInit() 32 | { 33 | int broadcastEnable = 1; 34 | 35 | sSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); 36 | if (sSocket < 0) { 37 | return FALSE; 38 | } 39 | 40 | setsockopt(sSocket, SOL_SOCKET, SO_BROADCAST, &broadcastEnable, sizeof(broadcastEnable)); 41 | 42 | memset(&sSendAddr, 0, sizeof(struct sockaddr_in)); 43 | sSendAddr.sin_family = AF_INET; 44 | sSendAddr.sin_port = htons(SERVER_PORT); 45 | sSendAddr.sin_addr.s_addr = htonl(INADDR_BROADCAST); 46 | 47 | return WHBAddLogHandler(udpLogHandler); 48 | } 49 | 50 | BOOL 51 | WHBLogUdpDeinit() 52 | { 53 | if(shutdown(sSocket, SHUT_WR) != 0) { 54 | return FALSE; 55 | } 56 | 57 | return WHBRemoveLogHandler(udpLogHandler); 58 | } 59 | -------------------------------------------------------------------------------- /docs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.9) 2 | find_package(Doxygen) 3 | 4 | if(DOXYGEN_FOUND) 5 | set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/../docs/Doxyfile.in) 6 | set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) 7 | 8 | set(DOXYGEN_PROJECT_NAME "wut") 9 | set(DOXYGEN_PROJECT_NUMBER "1.0.0-beta") 10 | set(DOXYGEN_PROJECT_BRIEF "Wii U Toolchain") 11 | 12 | set(DOXYGEN_GENERATE_HTML YES) 13 | set(DOXYGEN_GENERATE_LATEX NO) 14 | 15 | set(DOXYGEN_TAB_SIZE 3) 16 | set(DOXYGEN_OPTIMIZE_OUTPUT_FOR_C YES) 17 | set(DOXYGEN_INLINE_SIMPLE_STRUCTS YES) 18 | set(DOXYGEN_EXTRACT_ALL YES) 19 | set(DOXYGEN_EXTRACT_STATIC YES) 20 | set(DOXYGEN_HIDE_SCOPE_NAMES YES) 21 | set(DOXYGEN_SORT_MEMBER_DOCS NO) 22 | set(DOXYGEN_RECURSIVE YES) 23 | set(DOXYGEN_EXCLUDE_PATTERNS 24 | "wut_structsize.h") 25 | set(DOXYGEN_EXCLUDE_SYMBOLS 26 | "WUT_CHECK_OFFSET" 27 | "WUT_CHECK_SIZE" 28 | "WUT_PADDING_BYTES" 29 | "WUT_UNKNOWN_BYTES" 30 | "WUT_UNKNOWN_SIZE") 31 | set(DOXYGEN_SOURCE_BROWSER YES) 32 | set(DOXYGEN_JAVADOC_AUTOBRIEF YES) 33 | set(DOXYGEN_ENUM_VALUES_PER_LINE 1) 34 | set(DOXYGEN_CLASS_DIAGRAMS NO) 35 | set(DOXYGEN_COLLABORATION_GRAPH NO) 36 | set(DOXYGEN_PREDEFINED "__cplusplus") 37 | 38 | doxygen_add_docs(docs 39 | "${CMAKE_CURRENT_SOURCE_DIR}/../include" 40 | "${CMAKE_CURRENT_SOURCE_DIR}/../docs") 41 | endif() 42 | -------------------------------------------------------------------------------- /libraries/wutnewlib/wut_clock.c: -------------------------------------------------------------------------------- 1 | #include "wut_newlib.h" 2 | #include "wut_clock.h" 3 | 4 | #include 5 | #include 6 | 7 | int 8 | __wut_clock_gettime(clockid_t clock_id, 9 | struct timespec *tp) 10 | { 11 | if (clock_id == CLOCK_MONOTONIC) { 12 | OSTime time = OSGetSystemTime(); 13 | tp->tv_sec = (time_t)OSTicksToSeconds(time); 14 | 15 | time -= OSSecondsToTicks(tp->tv_sec); 16 | tp->tv_nsec = (long)OSTicksToNanoseconds(time); 17 | } else if (clock_id == CLOCK_REALTIME) { 18 | OSTime time = OSGetTime(); 19 | tp->tv_sec = (time_t)OSTicksToSeconds(time); 20 | 21 | time -= OSSecondsToTicks(tp->tv_sec); 22 | tp->tv_nsec = (long)OSTicksToNanoseconds(time); 23 | 24 | tp->tv_sec += EPOCH_DIFF_SECS; 25 | } else { 26 | return EINVAL; 27 | } 28 | 29 | return 0; 30 | } 31 | 32 | int 33 | __wut_clock_settime(clockid_t clock_id, 34 | const struct timespec *tp) 35 | { 36 | return EPERM; 37 | } 38 | 39 | int 40 | __wut_clock_getres(clockid_t clock_id, 41 | struct timespec *res) 42 | { 43 | if (clock_id != CLOCK_MONOTONIC && 44 | clock_id != CLOCK_REALTIME) { 45 | return EINVAL; 46 | } 47 | 48 | res->tv_sec = 0; 49 | res->tv_nsec = (long)((1000000000ull + (uint64_t)OSTimerClockSpeed) / (uint64_t)OSTimerClockSpeed); 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /include/coreinit/memdefaultheap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "memheap.h" 4 | 5 | /** 6 | * \defgroup coreinit_memdefaultheap Default Heap 7 | * \ingroup coreinit 8 | * @{ 9 | */ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef void *(*MEMAllocFromDefaultHeapFn)(uint32_t size); 16 | typedef void *(*MEMAllocFromDefaultHeapExFn)(uint32_t size, int32_t alignment); 17 | typedef void (*MEMFreeToDefaultHeapFn)(void *ptr); 18 | 19 | extern MEMAllocFromDefaultHeapFn MEMAllocFromDefaultHeap; 20 | extern MEMAllocFromDefaultHeapExFn MEMAllocFromDefaultHeapEx; 21 | extern MEMFreeToDefaultHeapFn MEMFreeToDefaultHeap; 22 | 23 | /** 24 | * Default implementation of __preinit_user. 25 | */ 26 | void 27 | CoreInitDefaultHeap(MEMHeapHandle *outMem1, 28 | MEMHeapHandle *outFG, 29 | MEMHeapHandle *outMem2); 30 | 31 | /** 32 | * Allows the user to completely customise the default heaps, this runs after 33 | * the rpx code section has loaded but before the data section as the data 34 | * sections are allocated from the default heap. 35 | * 36 | * This is for a user to export from their .rpx file, it is not exported from 37 | * coreinit.rpl 38 | */ 39 | void 40 | __preinit_user(MEMHeapHandle *outMem1, 41 | MEMHeapHandle *outFG, 42 | MEMHeapHandle *outMem2); 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | /** @} */ 49 | -------------------------------------------------------------------------------- /libraries/libwhb/src/gfx_texture.c: -------------------------------------------------------------------------------- 1 | #include "gfx_heap.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | GX2Texture * 9 | WHBGfxLoadGFDTexture(uint32_t index, 10 | const void *file) 11 | { 12 | uint32_t headerSize, imageSize; 13 | GX2Texture *texture = NULL; 14 | 15 | if (index >= GFDGetTextureCount(file)) { 16 | WHBLogPrintf("%s: invalid GFD texture index %u", __FUNCTION__, index); 17 | goto error; 18 | } 19 | 20 | headerSize = GFDGetTextureHeaderSize(index, file); 21 | imageSize = GFDGetTextureImageSize(index, file); 22 | 23 | if (!headerSize || !imageSize) { 24 | goto error; 25 | } 26 | 27 | texture = (GX2Texture *)GfxHeapAllocMEM2(headerSize, 64); 28 | if (!texture) { 29 | WHBLogPrintf("%s: GfxHeapAllocMEM2(0x%X, 64) failed", __FUNCTION__, 30 | headerSize); 31 | goto error; 32 | } 33 | 34 | if (!GFDGetGX2RTexture(texture, index, file)) { 35 | goto error; 36 | } 37 | 38 | return texture; 39 | 40 | error: 41 | if (texture) { 42 | GX2RDestroySurfaceEx(&texture->surface, 0); 43 | GfxHeapFreeMEM2(texture); 44 | } 45 | 46 | return NULL; 47 | } 48 | 49 | BOOL 50 | WHBGfxFreeTexture(GX2Texture *texture) 51 | { 52 | GX2RDestroySurfaceEx(&texture->surface, 0); 53 | GfxHeapFreeMEM2(texture); 54 | return TRUE; 55 | } 56 | -------------------------------------------------------------------------------- /include/coreinit/coroutine.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup coreinit_coroutine Coroutines 6 | * \ingroup coreinit 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | typedef struct OSCoroutine OSCoroutine; 15 | 16 | struct OSCoroutine 17 | { 18 | uint32_t nia; 19 | uint32_t cr; 20 | uint32_t ugqr1; 21 | uint32_t stack; 22 | uint32_t sda2Base; 23 | uint32_t sdaBase; 24 | uint32_t gpr[18]; 25 | double fpr[18]; 26 | double psr[18]; 27 | }; 28 | WUT_CHECK_OFFSET(OSCoroutine, 0x00, nia); 29 | WUT_CHECK_OFFSET(OSCoroutine, 0x04, cr); 30 | WUT_CHECK_OFFSET(OSCoroutine, 0x08, ugqr1); 31 | WUT_CHECK_OFFSET(OSCoroutine, 0x0C, stack); 32 | WUT_CHECK_OFFSET(OSCoroutine, 0x10, sda2Base); 33 | WUT_CHECK_OFFSET(OSCoroutine, 0x14, sdaBase); 34 | WUT_CHECK_OFFSET(OSCoroutine, 0x18, gpr); 35 | WUT_CHECK_OFFSET(OSCoroutine, 0x60, fpr); 36 | WUT_CHECK_OFFSET(OSCoroutine, 0xF0, psr); 37 | WUT_CHECK_SIZE(OSCoroutine, 0x180); 38 | 39 | void 40 | OSInitCoroutine(OSCoroutine *coroutine, 41 | void *entry, 42 | void *stack); 43 | 44 | uint32_t 45 | OSLoadCoroutine(OSCoroutine *coroutine, 46 | uint32_t result); 47 | 48 | uint32_t 49 | OSSaveCoroutine(OSCoroutine *coroutine); 50 | 51 | void 52 | OSSwitchCoroutine(OSCoroutine *from, 53 | OSCoroutine *to); 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | /** @} */ 60 | -------------------------------------------------------------------------------- /include/coreinit/threadqueue.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup coreinit_threadq Thread Queue 6 | * \ingroup coreinit 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | typedef struct OSThread OSThread; 15 | 16 | typedef struct OSThreadLink OSThreadLink; 17 | typedef struct OSThreadQueue OSThreadQueue; 18 | typedef struct OSThreadSimpleQueue OSThreadSimpleQueue; 19 | 20 | struct OSThreadLink 21 | { 22 | OSThread *prev; 23 | OSThread *next; 24 | }; 25 | WUT_CHECK_OFFSET(OSThreadLink, 0x00, prev); 26 | WUT_CHECK_OFFSET(OSThreadLink, 0x04, next); 27 | WUT_CHECK_SIZE(OSThreadLink, 0x8); 28 | 29 | struct OSThreadQueue 30 | { 31 | OSThread *head; 32 | OSThread *tail; 33 | void *parent; 34 | WUT_UNKNOWN_BYTES(4); 35 | }; 36 | WUT_CHECK_OFFSET(OSThreadQueue, 0x00, head); 37 | WUT_CHECK_OFFSET(OSThreadQueue, 0x04, tail); 38 | WUT_CHECK_OFFSET(OSThreadQueue, 0x08, parent); 39 | WUT_CHECK_SIZE(OSThreadQueue, 0x10); 40 | 41 | struct OSThreadSimpleQueue 42 | { 43 | OSThread *head; 44 | OSThread *tail; 45 | }; 46 | WUT_CHECK_OFFSET(OSThreadSimpleQueue, 0x00, head); 47 | WUT_CHECK_OFFSET(OSThreadSimpleQueue, 0x04, tail); 48 | WUT_CHECK_SIZE(OSThreadSimpleQueue, 0x08); 49 | 50 | void 51 | OSInitThreadQueue(OSThreadQueue *queue); 52 | 53 | void 54 | OSInitThreadQueueEx(OSThreadQueue *queue, 55 | void *parent); 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | /** @} */ 62 | -------------------------------------------------------------------------------- /include/curl/stdcheaders.h: -------------------------------------------------------------------------------- 1 | #ifndef __STDC_HEADERS_H 2 | #define __STDC_HEADERS_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at http://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | 25 | #include 26 | 27 | size_t fread (void *, size_t, size_t, FILE *); 28 | size_t fwrite (const void *, size_t, size_t, FILE *); 29 | 30 | int strcasecmp(const char *, const char *); 31 | int strncasecmp(const char *, const char *, size_t); 32 | 33 | #endif /* __STDC_HEADERS_H */ 34 | -------------------------------------------------------------------------------- /libraries/wutdevoptab/devoptab_fs_stat.c: -------------------------------------------------------------------------------- 1 | #include "devoptab_fs.h" 2 | 3 | int 4 | __wut_fs_stat(struct _reent *r, 5 | const char *path, 6 | struct stat *st) 7 | { 8 | int fd; 9 | FSStatus status; 10 | FSCmdBlock cmd; 11 | 12 | if (!path || !st) { 13 | r->_errno = EINVAL; 14 | return -1; 15 | } 16 | 17 | char *fixedPath = __wut_fs_fixpath(r, path); 18 | if (!fixedPath) { 19 | return -1; 20 | } 21 | 22 | FSInitCmdBlock(&cmd); 23 | 24 | // First try open as file 25 | status = FSOpenFile(__wut_devoptab_fs_client, &cmd, fixedPath, "r", 26 | (FSFileHandle*)&fd, FS_ERROR_FLAG_ALL); 27 | if (status >= 0) { 28 | __wut_fs_file_t tmpfd = { .fd = fd }; 29 | status = __wut_fs_fstat(r, &tmpfd, st); 30 | FSCloseFile(__wut_devoptab_fs_client, &cmd, fd, FS_ERROR_FLAG_ALL); 31 | free(fixedPath); 32 | return status; 33 | } 34 | 35 | // File failed, so lets try open as directory 36 | status = FSOpenDir(__wut_devoptab_fs_client, &cmd, fixedPath, 37 | (FSDirectoryHandle*)&fd, FS_ERROR_FLAG_ALL); 38 | free(fixedPath); 39 | if (status < 0) { 40 | r->_errno = __wut_fs_translate_error(status); 41 | return -1; 42 | } 43 | 44 | memset(st, 0, sizeof(struct stat)); 45 | st->st_nlink = 1; 46 | st->st_mode = S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO; 47 | FSCloseDir(__wut_devoptab_fs_client, &cmd, fd, FS_ERROR_FLAG_ALL); 48 | return 0; 49 | } 50 | -------------------------------------------------------------------------------- /include/gx2/clear.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "enum.h" 4 | 5 | /** 6 | * \defgroup gx2_clear Clear 7 | * \ingroup gx2 8 | * @{ 9 | */ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef struct GX2ColorBuffer GX2ColorBuffer; 16 | typedef struct GX2DepthBuffer GX2DepthBuffer; 17 | 18 | void 19 | GX2ClearColor(GX2ColorBuffer *colorBuffer, 20 | float red, 21 | float green, 22 | float blue, 23 | float alpha); 24 | 25 | void 26 | GX2ClearDepthStencilEx(GX2DepthBuffer *depthBuffer, 27 | float depth, 28 | uint8_t stencil, 29 | GX2ClearFlags clearMode); 30 | 31 | void 32 | GX2ClearBuffersEx(GX2ColorBuffer *colorBuffer, 33 | GX2DepthBuffer *depthBuffer, 34 | float red, 35 | float green, 36 | float blue, 37 | float alpha, 38 | float depth, 39 | uint8_t stencil, 40 | GX2ClearFlags clearMode); 41 | 42 | void 43 | GX2SetClearDepth(GX2DepthBuffer *depthBuffer, 44 | float depth); 45 | 46 | void 47 | GX2SetClearStencil(GX2DepthBuffer *depthBuffer, 48 | uint8_t stencil); 49 | 50 | void 51 | GX2SetClearDepthStencil(GX2DepthBuffer *depthBuffer, 52 | float depth, 53 | uint8_t stencil); 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | /** @} */ 60 | -------------------------------------------------------------------------------- /include/wut_structsize.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | // Ensure structs are correct size & offsets 6 | #if defined(static_assert) || defined(__cplusplus) 7 | # define WUT_CHECK_SIZE(Type, Size) \ 8 | static_assert(sizeof(Type) == Size, \ 9 | #Type " must be " #Size " bytes") 10 | 11 | # define WUT_CHECK_OFFSET(Type, Offset, Field) \ 12 | static_assert(offsetof(Type, Field) == Offset, \ 13 | #Type "::" #Field " must be at offset " #Offset) 14 | #else 15 | # define WUT_CHECK_SIZE(Type, Size) 16 | # define WUT_CHECK_OFFSET(Type, Offset, Field) 17 | #endif 18 | 19 | // Workaround weird macro concat ## behaviour 20 | #define WUT_PP_CAT(a, b) WUT_PP_CAT_I(a, b) 21 | #define WUT_PP_CAT_I(a, b) WUT_PP_CAT_II(~, a ## b) 22 | #define WUT_PP_CAT_II(p, res) res 23 | 24 | // Allow us to easily add UNKNOWN / PADDING bytes into our structs, 25 | // generates unique variable names using __COUNTER__ 26 | #define WUT_UNKNOWN_BYTES(Size) char WUT_PP_CAT(__unk, __COUNTER__) [Size] 27 | #define WUT_PADDING_BYTES(Size) WUT_UNKNOWN_BYTES(Size) 28 | 29 | // Unknown struct size 30 | #define WUT_UNKNOWN_SIZE(x) 31 | 32 | // Marks a struct as packed 33 | #define WUT_PACKED __attribute__((__packed__)) 34 | 35 | // Sets alignment for a struct 36 | #if defined(__alignas_is_defined) || defined(__cplusplus) 37 | #define WUT_ALIGNAS(x) alignas(x) 38 | #elif defined(__GNUC__) || defined(__clang__) 39 | #define WUT_ALIGNAS(x) __attribute__((__aligned__(x))) 40 | #endif 41 | -------------------------------------------------------------------------------- /cafe/swkbd.def: -------------------------------------------------------------------------------- 1 | :NAME swkbd 2 | 3 | :TEXT 4 | SwkbdAppearInputForm__3RplFRCQ3_2nn5swkbd9AppearArg 5 | SwkbdAppearKeyboard__3RplFRCQ3_2nn5swkbd11KeyboardArg 6 | SwkbdCalcSubThreadFont__3RplFv 7 | SwkbdCalcSubThreadPredict__3RplFv 8 | SwkbdCalc__3RplFRCQ3_2nn5swkbd14ControllerInfo 9 | SwkbdConfirmUnfixAll__3RplFv 10 | SwkbdCreate__3RplFPUcQ3_2nn5swkbd10RegionTypeUiP8FSClient 11 | SwkbdDestroy__3RplFv 12 | SwkbdDisappearInputForm__3RplFv 13 | SwkbdDisappearKeyboard__3RplFv 14 | SwkbdDrawDRC__3RplFv 15 | SwkbdDrawTV__3RplFv 16 | SwkbdGetDrawStringInfo__3RplFPQ3_2nn5swkbd14DrawStringInfo 17 | SwkbdGetInputFormString__3RplFv 18 | SwkbdGetKeyboardCondition__3RplFPQ3_2nn5swkbd17KeyboardCondition 19 | SwkbdGetStateInputForm__3RplFv 20 | SwkbdGetStateKeyboard__3RplFv 21 | SwkbdInactivateSelectCursor__3RplFv 22 | SwkbdInitLearnDic__3RplFPv 23 | SwkbdIsCoveredWithSubWindow__3RplFv 24 | SwkbdIsDecideCancelButton__3RplFPb 25 | SwkbdIsDecideOkButton__3RplFPb 26 | SwkbdIsKeyboardTarget__3RplFPQ3_2nn5swkbd14IEventReceiver 27 | SwkbdIsNeedCalcSubThreadFont__3RplFv 28 | SwkbdIsNeedCalcSubThreadPredict__3RplFv 29 | SwkbdIsSelectCursorActive__3RplFv 30 | SwkbdMuteAllSound__3RplFb 31 | SwkbdSetControllerRemo__3RplFQ3_2nn5swkbd14ControllerType 32 | SwkbdSetCursorPos__3RplFi 33 | SwkbdSetEnableOkButton__3RplFb 34 | SwkbdSetInputFormString__3RplFPCw 35 | SwkbdSetReceiver__3RplFRCQ3_2nn5swkbd11ReceiverArg 36 | SwkbdSetSelectFrom__3RplFi 37 | SwkbdSetUserControllerEventObj__3RplFPQ3_2nn5swkbd19IControllerEventObj 38 | SwkbdSetUserSoundObj__3RplFPQ3_2nn5swkbd9ISoundObj 39 | SwkbdSetVersion__3RplFi 40 | -------------------------------------------------------------------------------- /include/coreinit/atomic64.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup coreinit_atomic64 Atomic Operations 64 bit 6 | * \ingroup coreinit 7 | * 8 | * These functions are used for atomically operating on 64 bit values in memory. 9 | * @{ 10 | */ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | uint64_t 17 | OSGetAtomic64(volatile uint64_t *ptr); 18 | 19 | uint64_t 20 | OSSetAtomic64(volatile uint64_t *ptr, 21 | uint64_t value); 22 | 23 | BOOL 24 | OSCompareAndSwapAtomic64(volatile uint64_t *ptr, 25 | uint64_t compare, 26 | uint64_t value); 27 | 28 | BOOL 29 | OSCompareAndSwapAtomicEx64(volatile uint64_t *ptr, 30 | uint64_t compare, 31 | uint64_t value, 32 | uint64_t *old); 33 | 34 | uint64_t 35 | OSSwapAtomic64(volatile uint64_t *ptr, 36 | uint64_t value); 37 | 38 | int64_t 39 | OSAddAtomic64(volatile int64_t *ptr, 40 | int64_t value); 41 | 42 | uint64_t 43 | OSAndAtomic64(volatile uint64_t *ptr, 44 | uint64_t value); 45 | 46 | uint64_t 47 | OSOrAtomic64(volatile uint64_t *ptr, 48 | uint64_t value); 49 | 50 | uint64_t 51 | OSXorAtomic64(volatile uint64_t *ptr, 52 | uint64_t value); 53 | 54 | BOOL 55 | OSTestAndClearAtomic64(volatile uint64_t *ptr, 56 | uint32_t bit); 57 | 58 | BOOL 59 | OSTestAndSetAtomic64(volatile uint64_t *ptr, 60 | uint32_t bit); 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | /** @} */ 67 | -------------------------------------------------------------------------------- /cafe/nn_spm.def: -------------------------------------------------------------------------------- 1 | :NAME nn_spm 2 | 3 | :TEXT 4 | CancelWaitStateUpdated__Q2_2nn3spmFv 5 | ClearExtendedStorage__Q2_2nn3spmFv 6 | Compare__Q3_2nn3spm8VolumeIdCFRCQ3_2nn3spm8VolumeId 7 | FilterBriefTitleList__Q2_2nn3spmFP22MCP_TitleListBriefTypeUi 8 | FilterTitleList__Q2_2nn3spmFP17MCP_TitleListTypeUi 9 | Finalize__Q2_2nn3spmFv 10 | FindStorageByVolumeId__Q2_2nn3spmFPQ3_2nn3spm12StorageIndexRCQ3_2nn3spm8VolumeId 11 | GetDefaultExtendedStorageVolumeId__Q2_2nn3spmFv 12 | GetExtendedStorageIndex__Q2_2nn3spmFPQ3_2nn3spm12StorageIndex 13 | GetPreviousExtendedStorageVolumeId__Q2_2nn3spmFPbPQ3_2nn3spm8VolumeId 14 | GetStorageInfo__Q2_2nn3spmFPQ3_2nn3spm11StorageInfoQ3_2nn3spm12StorageIndex 15 | GetStorageList__Q2_2nn3spmFPQ3_2nn3spm15StorageListItemUi 16 | GetUsbDetectionMaxTimeMilliSeconds__Q2_2nn3spmFv 17 | GetUsbDetectionRestTimeMilliSeconds__Q2_2nn3spmFv 18 | Initialize__Q2_2nn3spmFv 19 | IsDefaultTimedOut__Q2_2nn3spmFv 20 | IsStorageMaybePcFormatted__Q2_2nn3spmFPbQ3_2nn3spm12StorageIndex 21 | IsStorageMaybeWfsFormatted__Q2_2nn3spmFPbQ3_2nn3spm12StorageIndex 22 | NeedsManualExtendedStorageResolutionImpl__Q2_2nn3spmFPb 23 | NeedsManualExtendedStorageResolution__Q2_2nn3spmFv 24 | ReadRawStorageHead512__Q2_2nn3spmFQ3_2nn3spm12StorageIndexPc 25 | SetAutoFatal__Q2_2nn3spmFb 26 | SetDefaultExtendedStorageVolumeId__Q2_2nn3spmFRCQ3_2nn3spm8VolumeId 27 | SetExtendedStorage__Q2_2nn3spmFQ3_2nn3spm12StorageIndex 28 | SetResolveManuallyOnWarmBoot__Q2_2nn3spmFb 29 | StopFatalDetection__Q2_2nn3spmFv 30 | WaitStateUpdated__Q2_2nn3spmFPUL 31 | __CPR86__FormatExternalStorage__Q2_2nn3spmFPQ3_2nn3spm12StorageIndexiQ3_2nn3spmJ45JPi 32 | __ct__Q3_2nn3spm8VolumeIdFPCc 33 | -------------------------------------------------------------------------------- /include/coreinit/fastmutex.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "threadqueue.h" 4 | 5 | /** 6 | * \defgroup coreinit_fastmutex Fast Mutex 7 | * \ingroup coreinit 8 | * 9 | * Similar to OSMutex but tries to acquire the mutex without using the global 10 | * scheduler lock, and does not test for thread cancel. 11 | * @{ 12 | */ 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | typedef struct OSFastMutex OSFastMutex; 19 | typedef struct OSFastMutexLink OSFastMutexLink; 20 | typedef struct OSFastCondition OSFastCondition; 21 | 22 | struct OSFastMutexLink 23 | { 24 | OSFastMutex *next; 25 | OSFastMutex *prev; 26 | }; 27 | WUT_CHECK_OFFSET(OSFastMutexLink, 0x00, next); 28 | WUT_CHECK_OFFSET(OSFastMutexLink, 0x04, prev); 29 | WUT_CHECK_SIZE(OSFastMutexLink, 0x08); 30 | 31 | #define OS_FAST_MUTEX_TAG 0x664D7458u 32 | 33 | struct OSFastMutex 34 | { 35 | uint32_t tag; 36 | const char *name; 37 | WUT_UNKNOWN_BYTES(4); 38 | OSThreadSimpleQueue queue; 39 | OSFastMutexLink link; 40 | WUT_UNKNOWN_BYTES(16); 41 | }; 42 | WUT_CHECK_OFFSET(OSFastMutex, 0x00, tag); 43 | WUT_CHECK_OFFSET(OSFastMutex, 0x04, name); 44 | WUT_CHECK_OFFSET(OSFastMutex, 0x0c, queue); 45 | WUT_CHECK_OFFSET(OSFastMutex, 0x14, link); 46 | WUT_CHECK_SIZE(OSFastMutex, 0x2c); 47 | 48 | void 49 | OSFastMutex_Init(OSFastMutex *mutex, 50 | const char *name); 51 | 52 | void 53 | OSFastMutex_Lock(OSFastMutex *mutex); 54 | 55 | void 56 | OSFastMutex_Unlock(OSFastMutex *mutex); 57 | 58 | BOOL 59 | OSFastMutex_TryLock(OSFastMutex *mutex); 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | /** @} */ 66 | -------------------------------------------------------------------------------- /libraries/wutdevoptab/devoptab_fs_open.c: -------------------------------------------------------------------------------- 1 | #include "devoptab_fs.h" 2 | 3 | int 4 | __wut_fs_open(struct _reent *r, 5 | void *fileStruct, 6 | const char *path, 7 | int flags, 8 | int mode) 9 | { 10 | FSFileHandle fd; 11 | FSStatus status; 12 | FSCmdBlock cmd; 13 | const char *fsMode; 14 | __wut_fs_file_t *file; 15 | 16 | if (!fileStruct || !path) { 17 | r->_errno = EINVAL; 18 | return -1; 19 | } 20 | 21 | // Map flags to open modes 22 | if (flags == 0) { 23 | fsMode = "r"; 24 | } else if (flags == 2) { 25 | fsMode = "r+"; 26 | } else if (flags == 0x601) { 27 | fsMode = "w"; 28 | } else if(flags == 0x602) { 29 | fsMode = "w+"; 30 | } else if(flags == 0x209) { 31 | fsMode = "a"; 32 | } else if(flags == 0x20A) { 33 | fsMode = "a+"; 34 | } else { 35 | r->_errno = EINVAL; 36 | return -1; 37 | } 38 | 39 | char *fixedPath = __wut_fs_fixpath(r,path); 40 | if (!fixedPath) { 41 | return -1; 42 | } 43 | 44 | // Open the file 45 | FSInitCmdBlock(&cmd); 46 | status = FSOpenFile(__wut_devoptab_fs_client, &cmd, fixedPath, fsMode, &fd, 47 | FS_ERROR_FLAG_ALL); 48 | free(fixedPath); 49 | if (status < 0) { 50 | r->_errno = __wut_fs_translate_error(status); 51 | return -1; 52 | } 53 | 54 | file = (__wut_fs_file_t *)fileStruct; 55 | file->fd = fd; 56 | file->flags = (flags & (O_ACCMODE|O_APPEND|O_SYNC)); 57 | FSGetPosFile(__wut_devoptab_fs_client, &cmd, fd, &file->offset, FS_ERROR_FLAG_ALL); 58 | return 0; 59 | } 60 | -------------------------------------------------------------------------------- /include/sys/ioccom.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /* 4 | * Ioctl's have the command encoded in the lower word, and the size of 5 | * any in or out parameters in the upper word. The high 3 bits of the 6 | * upper word are used to encode the in/out status of the parameter. 7 | */ 8 | #define IOCPARM_SHIFT 13 /* number of bits for ioctl size */ 9 | #define IOCPARM_MASK ((1 << IOCPARM_SHIFT) - 1) /* parameter length mask */ 10 | #define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK) 11 | #define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16)) 12 | #define IOCGROUP(x) (((x) >> 8) & 0xff) 13 | 14 | #define IOCPARM_MAX (1 << IOCPARM_SHIFT) /* max size of ioctl */ 15 | #define IOC_VOID 0x20000000 /* no parameters */ 16 | #define IOC_OUT 0x40000000 /* copy out parameters */ 17 | #define IOC_IN 0x80000000 /* copy in parameters */ 18 | #define IOC_INOUT (IOC_IN|IOC_OUT) 19 | #define IOC_DIRMASK (IOC_VOID|IOC_OUT|IOC_IN) 20 | 21 | #define _IOC(inout,group,num,len) ((int) \ 22 | ((inout) | (((len) & IOCPARM_MASK) << 16) | ((group) << 8) | (num))) 23 | #define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0) 24 | #define _IOWINT(g,n) _IOC(IOC_VOID, (g), (n), sizeof(int)) 25 | #define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t)) 26 | #define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t)) 27 | /* this should be _IORW, but stdio got there first */ 28 | #define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t)) 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | int ioctl(int fd, 35 | int request, 36 | ...); 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | -------------------------------------------------------------------------------- /cafe/drmapp.def: -------------------------------------------------------------------------------- 1 | :NAME drmapp 2 | 3 | :TEXT 4 | AocChkGetJumpCode__3RplFv 5 | AocChkGetState__3RplFv 6 | AocChkIsFinished__3RplFv 7 | AocChkIsHomeButtonAllowed__3RplFv 8 | AocChkIsPowerButtonAllowed__3RplFv 9 | AocChkStart__3RplFRCQ3_2nn6drmapp8StartArg 10 | AppChkGetState__3RplFv 11 | AppChkIsFinished__3RplFv 12 | AppChkIsHomeButtonAllowed__3RplFv 13 | AppChkIsPowerButtonAllowed__3RplFv 14 | AppChkStart__3RplFRCQ3_2nn6drmapp8StartArg 15 | Calculate__3RplFRCQ3_2nn6drmapp14ControllerInfo 16 | DrawDRC__3RplFv 17 | DrawTV__3RplFv 18 | Finalize__3RplFv 19 | Initialize__3RplFRCQ3_2nn6drmapp13InitializeArg 20 | InstallerGetState__3RplFv 21 | InstallerIsFinished__3RplFv 22 | InstallerIsHomeButtonAllowed__3RplFv 23 | InstallerIsPowerButtonAllowed__3RplFv 24 | InstallerStart__3RplFRCQ3_2nn6drmapp8StartArg 25 | IsProgressBarVisible__3RplFv 26 | NupChkGetState__3RplFPi 27 | NupChkIsFinished__3RplFv 28 | NupChkIsHomeButtonAllowed__3RplFv 29 | NupChkIsPowerButtonAllowed__3RplFv 30 | NupChkIsSyncButtonAllowed__3RplFv 31 | NupChkStart__3RplFRCQ3_2nn6drmapp8StartArg 32 | NupDlGetState__3RplFPi 33 | NupDlIsFinished__3RplFv 34 | NupDlIsHomeButtonAllowed__3RplFv 35 | NupDlIsPowerButtonAllowed__3RplFv 36 | NupDlStart__3RplFRCQ3_2nn6drmapp8StartArg 37 | PatchChkGetJumpCode__3RplFv 38 | PatchChkGetState__3RplFv 39 | PatchChkIsFinished__3RplFv 40 | PatchChkIsHomeButtonAllowed__3RplFv 41 | PatchChkIsPowerButtonAllowed__3RplFv 42 | PatchChkStart__3RplFRCQ3_2nn6drmapp8StartArg 43 | TicketChkGetState__3RplFv 44 | TicketChkIsFinished__3RplFv 45 | TicketChkIsHomeButtonAllowed__3RplFv 46 | TicketChkIsPowerButtonAllowed__3RplFv 47 | TicketChkStart__3RplFRCQ3_2nn6drmapp8StartArg 48 | -------------------------------------------------------------------------------- /include/gx2/display.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "enum.h" 4 | #include "surface.h" 5 | 6 | /** 7 | * \defgroup gx2_display Display 8 | * \ingroup gx2 9 | * @{ 10 | */ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | void 17 | GX2SetTVEnable(BOOL enable); 18 | 19 | void 20 | GX2SetDRCEnable(BOOL enable); 21 | 22 | void 23 | GX2CalcTVSize(GX2TVRenderMode tvRenderMode, 24 | GX2SurfaceFormat surfaceFormat, 25 | GX2BufferingMode bufferingMode, 26 | uint32_t *size, 27 | uint32_t *unkOut); 28 | 29 | void 30 | GX2CalcDRCSize(GX2DrcRenderMode drcRenderMode, 31 | GX2SurfaceFormat surfaceFormat, 32 | GX2BufferingMode bufferingMode, 33 | uint32_t *size, 34 | uint32_t *unkOut); 35 | 36 | void 37 | GX2SetTVBuffer(void *buffer, 38 | uint32_t size, 39 | GX2TVRenderMode tvRenderMode, 40 | GX2SurfaceFormat surfaceFormat, 41 | GX2BufferingMode bufferingMode); 42 | 43 | void 44 | GX2SetDRCBuffer(void *buffer, 45 | uint32_t size, 46 | GX2DrcRenderMode drcRenderMode, 47 | GX2SurfaceFormat surfaceFormat, 48 | GX2BufferingMode bufferingMode); 49 | 50 | void 51 | GX2SetTVScale(uint32_t x, 52 | uint32_t y); 53 | 54 | void 55 | GX2SetDRCScale(uint32_t x, 56 | uint32_t y); 57 | 58 | GX2TVScanMode 59 | GX2GetSystemTVScanMode(); 60 | 61 | GX2DrcRenderMode 62 | GX2GetSystemDRCScanMode(); 63 | 64 | GX2DrcRenderMode 65 | GX2GetSystemDRCMode(); 66 | 67 | #ifdef __cplusplus 68 | } 69 | #endif 70 | 71 | /** @} */ 72 | -------------------------------------------------------------------------------- /include/coreinit/memunitheap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "memheap.h" 4 | 5 | /** 6 | * \defgroup coreinit_unitheap Unit Heap 7 | * \ingroup coreinit 8 | * @{ 9 | */ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef struct MEMUnitHeap MEMUnitHeap; 16 | typedef struct MEMUnitHeapFreeBlock MEMUnitHeapFreeBlock; 17 | 18 | struct MEMUnitHeapFreeBlock 19 | { 20 | MEMUnitHeapFreeBlock *next; 21 | }; 22 | WUT_CHECK_OFFSET(MEMUnitHeapFreeBlock, 0x00, next); 23 | WUT_CHECK_SIZE(MEMUnitHeapFreeBlock, 0x04); 24 | 25 | struct WUT_PACKED MEMUnitHeap 26 | { 27 | MEMHeapHeader header; 28 | MEMUnitHeapFreeBlock *freeBlocks; 29 | uint32_t blockSize; 30 | }; 31 | WUT_CHECK_OFFSET(MEMUnitHeap, 0x00, header); 32 | WUT_CHECK_OFFSET(MEMUnitHeap, 0x40, freeBlocks); 33 | WUT_CHECK_OFFSET(MEMUnitHeap, 0x44, blockSize); 34 | WUT_CHECK_SIZE(MEMUnitHeap, 0x48); 35 | 36 | MEMHeapHandle 37 | MEMCreateUnitHeapEx(void *heap, 38 | uint32_t size, 39 | uint32_t blockSize, 40 | int32_t alignment, 41 | uint16_t flags); 42 | 43 | void * 44 | MEMDestroyUnitHeap(MEMHeapHandle heap); 45 | 46 | void * 47 | MEMAllocFromUnitHeap(MEMHeapHandle heap); 48 | 49 | void 50 | MEMFreeToUnitHeap(MEMHeapHandle heap, 51 | void *block); 52 | 53 | void 54 | MEMiDumpUnitHeap(MEMHeapHandle heap); 55 | 56 | uint32_t 57 | MEMCountFreeBlockForUnitHeap(MEMHeapHandle heap); 58 | 59 | uint32_t 60 | MEMCalcHeapSizeForUnitHeap(uint32_t blockSize, 61 | uint32_t count, 62 | int32_t alignment); 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | 68 | /** @} */ 69 | -------------------------------------------------------------------------------- /include/gx2/draw.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "enum.h" 4 | 5 | /** 6 | * \defgroup gx2_draw Draw 7 | * \ingroup gx2 8 | * @{ 9 | */ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | void 16 | GX2SetAttribBuffer(uint32_t index, 17 | uint32_t size, 18 | uint32_t stride, 19 | const void *buffer); 20 | 21 | void 22 | GX2DrawEx(GX2PrimitiveMode mode, 23 | uint32_t count, 24 | uint32_t offset, 25 | uint32_t numInstances); 26 | 27 | void 28 | GX2DrawEx2(GX2PrimitiveMode mode, 29 | uint32_t count, 30 | uint32_t offset, 31 | uint32_t numInstances, 32 | uint32_t baseInstance); 33 | 34 | void 35 | GX2DrawIndexedEx(GX2PrimitiveMode mode, 36 | uint32_t count, 37 | GX2IndexType indexType, 38 | const void *indices, 39 | uint32_t offset, 40 | uint32_t numInstances); 41 | 42 | void 43 | GX2DrawIndexedEx2(GX2PrimitiveMode mode, 44 | uint32_t count, 45 | GX2IndexType indexType, 46 | const void *indices, 47 | uint32_t offset, 48 | uint32_t numInstances, 49 | uint32_t baseInstance); 50 | 51 | void 52 | GX2DrawIndexedImmediateEx(GX2PrimitiveMode mode, 53 | uint32_t count, 54 | GX2IndexType indexType, 55 | const void *indices, 56 | uint32_t offset, 57 | uint32_t numInstances); 58 | 59 | void 60 | GX2SetPrimitiveRestartIndex(uint32_t index); 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | /** @} */ 67 | -------------------------------------------------------------------------------- /libraries/wutsocket/ioctl.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | #include 3 | 4 | int 5 | ioctl(int fd, 6 | int request, 7 | ...) 8 | { 9 | void *data; 10 | va_list args; 11 | int sockfd; 12 | int rc; 13 | 14 | va_start(args, request); 15 | data = (request & IOC_INOUT) ? va_arg(args, void *) : NULL; 16 | va_end(args); 17 | 18 | if(data == NULL && (request & IOC_INOUT) && IOCPARM_LEN(request) != 0) { 19 | errno = EFAULT; 20 | return -1; 21 | } 22 | 23 | sockfd = __wut_get_nsysnet_fd(fd); 24 | if (sockfd == -1) { 25 | return -1; 26 | } 27 | 28 | switch(request) { 29 | case FIONBIO: { 30 | int flags = fcntl(fd, F_GETFL, 0); 31 | if(flags == -1) { 32 | return -1; 33 | } 34 | flags = *(int *)data != 0 ? (flags | O_NONBLOCK) : (flags & ~O_NONBLOCK); 35 | return fcntl(fd, F_SETFL, flags); 36 | } 37 | case FIONREAD: { 38 | socklen_t optlen = sizeof(int32_t); 39 | rc = RPLWRAP(getsockopt)(sockfd, 40 | SOL_SOCKET, 41 | SO_RXDATA, 42 | data, 43 | &optlen); 44 | return __wut_get_nsysnet_result(NULL, rc); 45 | } 46 | case FIONWRITE: { 47 | socklen_t optlen = sizeof(int32_t); 48 | rc = RPLWRAP(getsockopt)(sockfd, 49 | SOL_SOCKET, 50 | SO_TXDATA, 51 | data, 52 | &optlen); 53 | return __wut_get_nsysnet_result(NULL, rc); 54 | } 55 | default: 56 | break; 57 | } 58 | 59 | return -1; 60 | } 61 | -------------------------------------------------------------------------------- /include/coreinit/memlist.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup coreinit_memlist Memory List 6 | * \ingroup coreinit 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | typedef struct MEMMemoryLink MEMMemoryLink; 15 | typedef struct MEMMemoryList MEMMemoryList; 16 | 17 | struct MEMMemoryLink 18 | { 19 | void *prev; 20 | void *next; 21 | }; 22 | WUT_CHECK_OFFSET(MEMMemoryLink, 0x0, prev); 23 | WUT_CHECK_OFFSET(MEMMemoryLink, 0x4, next); 24 | WUT_CHECK_SIZE(MEMMemoryLink, 0x8); 25 | 26 | struct MEMMemoryList 27 | { 28 | void *head; 29 | void *tail; 30 | uint16_t count; 31 | uint16_t offsetToMemoryLink; 32 | }; 33 | WUT_CHECK_OFFSET(MEMMemoryList, 0x0, head); 34 | WUT_CHECK_OFFSET(MEMMemoryList, 0x4, tail); 35 | WUT_CHECK_OFFSET(MEMMemoryList, 0x8, count); 36 | WUT_CHECK_OFFSET(MEMMemoryList, 0xa, offsetToMemoryLink); 37 | WUT_CHECK_SIZE(MEMMemoryList, 0xc); 38 | 39 | void 40 | MEMInitList(MEMMemoryList *list, 41 | uint16_t offsetToMemoryLink); 42 | 43 | void 44 | MEMAppendListObject(MEMMemoryList *list, 45 | void *object); 46 | 47 | void 48 | MEMPrependListObject(MEMMemoryList *list, 49 | void *object); 50 | 51 | void 52 | MEMInsertListObject(MEMMemoryList *list, 53 | void *before, 54 | void *object); 55 | 56 | void 57 | MEMRemoveListObject(MEMMemoryList *list, 58 | void *object); 59 | 60 | void * 61 | MEMGetNextListObject(MEMMemoryList *list, 62 | void *object); 63 | 64 | void * 65 | MEMGetPrevListObject(MEMMemoryList *list, 66 | void *object); 67 | 68 | void * 69 | MEMGetNthListObject(MEMMemoryList *list, 70 | uint16_t n); 71 | 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | 76 | /** @} */ 77 | -------------------------------------------------------------------------------- /samples/cmake/helloworld_cpp/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | int 13 | hello_thread() 14 | { 15 | int last_tm_sec = -1; 16 | uint32_t ip = 0; 17 | WHBLogPrintf("Hello World from a std::thread!"); 18 | 19 | if (!nn::ac::GetAssignedAddress(&ip)) { 20 | WHBLogPrintf("GetAssignedAddress failed!"); 21 | } 22 | 23 | WHBLogPrintf("My IP is: %u.%u.%u.%u", 24 | (ip >> 24) & 0xFF, 25 | (ip >> 16) & 0xFF, 26 | (ip >> 8) & 0xFF, 27 | (ip >> 0) & 0xFF); 28 | 29 | while(WHBProcIsRunning()) { 30 | OSCalendarTime tm; 31 | OSTicksToCalendarTime(OSGetTime(), &tm); 32 | 33 | if (tm.tm_sec != last_tm_sec) { 34 | WHBLogPrintf("%02d/%02d/%04d %02d:%02d:%02d I'm still here.", 35 | tm.tm_mday, tm.tm_mon, tm.tm_year, 36 | tm.tm_hour, tm.tm_min, tm.tm_sec); 37 | last_tm_sec = tm.tm_sec; 38 | } 39 | 40 | WHBLogConsoleDraw(); 41 | OSSleepTicks(OSMillisecondsToTicks(100)); 42 | } 43 | 44 | WHBLogPrintf("Exiting... good bye."); 45 | WHBLogConsoleDraw(); 46 | OSSleepTicks(OSMillisecondsToTicks(1000)); 47 | return 0; 48 | } 49 | 50 | int 51 | main(int argc, char **argv) 52 | { 53 | nn::ac::ConfigIdNum configId; 54 | 55 | nn::ac::Initialize(); 56 | nn::ac::GetStartupId(&configId); 57 | nn::ac::Connect(configId); 58 | 59 | WHBProcInit(); 60 | WHBLogConsoleInit(); 61 | 62 | std::thread t(hello_thread); 63 | t.join(); 64 | 65 | WHBLogConsoleFree(); 66 | WHBProcShutdown(); 67 | 68 | nn::ac::Finalize(); 69 | return 0; 70 | } 71 | -------------------------------------------------------------------------------- /samples/make/helloworld_cpp/source/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | int 13 | hello_thread() 14 | { 15 | int last_tm_sec = -1; 16 | uint32_t ip = 0; 17 | WHBLogPrintf("Hello World from a std::thread!"); 18 | 19 | if (!nn::ac::GetAssignedAddress(&ip)) { 20 | WHBLogPrintf("GetAssignedAddress failed!"); 21 | } 22 | 23 | WHBLogPrintf("My IP is: %u.%u.%u.%u", 24 | (ip >> 24) & 0xFF, 25 | (ip >> 16) & 0xFF, 26 | (ip >> 8) & 0xFF, 27 | (ip >> 0) & 0xFF); 28 | 29 | while(WHBProcIsRunning()) { 30 | OSCalendarTime tm; 31 | OSTicksToCalendarTime(OSGetTime(), &tm); 32 | 33 | if (tm.tm_sec != last_tm_sec) { 34 | WHBLogPrintf("%02d/%02d/%04d %02d:%02d:%02d I'm still here.", 35 | tm.tm_mday, tm.tm_mon, tm.tm_year, 36 | tm.tm_hour, tm.tm_min, tm.tm_sec); 37 | last_tm_sec = tm.tm_sec; 38 | } 39 | 40 | WHBLogConsoleDraw(); 41 | OSSleepTicks(OSMillisecondsToTicks(100)); 42 | } 43 | 44 | WHBLogPrintf("Exiting... good bye."); 45 | WHBLogConsoleDraw(); 46 | OSSleepTicks(OSMillisecondsToTicks(1000)); 47 | return 0; 48 | } 49 | 50 | int 51 | main(int argc, char **argv) 52 | { 53 | nn::ac::ConfigIdNum configId; 54 | 55 | nn::ac::Initialize(); 56 | nn::ac::GetStartupId(&configId); 57 | nn::ac::Connect(configId); 58 | 59 | WHBProcInit(); 60 | WHBLogConsoleInit(); 61 | 62 | std::thread t(hello_thread); 63 | t.join(); 64 | 65 | WHBLogConsoleFree(); 66 | WHBProcShutdown(); 67 | 68 | nn::ac::Finalize(); 69 | return 0; 70 | } 71 | -------------------------------------------------------------------------------- /include/gx2/event.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include "enum.h" 5 | 6 | /** 7 | * \defgroup gx2_event Event 8 | * \ingroup gx2 9 | * @{ 10 | */ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | typedef struct GX2DisplayListOverrunData GX2DisplayListOverrunData; 17 | typedef void (*GX2EventCallbackFunction)(GX2EventType, void *); 18 | 19 | struct GX2DisplayListOverrunData 20 | { 21 | //! Pointer to overrun display list 22 | void *oldList; 23 | 24 | //! Size of overrun display list 25 | uint32_t oldSize; 26 | 27 | //! Pointer to new display list 28 | void *newList; 29 | 30 | //! Size of new display list 31 | uint32_t newSize; 32 | 33 | WUT_UNKNOWN_BYTES(8); 34 | }; 35 | WUT_CHECK_OFFSET(GX2DisplayListOverrunData, 0x00, oldList); 36 | WUT_CHECK_OFFSET(GX2DisplayListOverrunData, 0x04, oldSize); 37 | WUT_CHECK_OFFSET(GX2DisplayListOverrunData, 0x08, newList); 38 | WUT_CHECK_OFFSET(GX2DisplayListOverrunData, 0x0C, newSize); 39 | WUT_CHECK_SIZE(GX2DisplayListOverrunData, 0x18); 40 | 41 | BOOL 42 | GX2DrawDone(); 43 | 44 | void 45 | GX2WaitForVsync(); 46 | 47 | void 48 | GX2WaitForFlip(); 49 | 50 | void 51 | GX2SetEventCallback(GX2EventType type, 52 | GX2EventCallbackFunction func, 53 | void *userData); 54 | 55 | void 56 | GX2GetEventCallback(GX2EventType type, 57 | GX2EventCallbackFunction *funcOut, 58 | void **userDataOut); 59 | 60 | OSTime 61 | GX2GetRetiredTimeStamp(); 62 | 63 | OSTime 64 | GX2GetLastSubmittedTimeStamp(); 65 | 66 | void 67 | GX2GetSwapStatus(uint32_t *swapCount, 68 | uint32_t *flipCount, 69 | OSTime *lastFlip, 70 | OSTime *lastVsync); 71 | 72 | BOOL 73 | GX2WaitTimeStamp(OSTime time); 74 | 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | 79 | /** @} */ 80 | -------------------------------------------------------------------------------- /libraries/wutdevoptab/devoptab_fs_seek.c: -------------------------------------------------------------------------------- 1 | #include "devoptab_fs.h" 2 | 3 | off_t 4 | __wut_fs_seek(struct _reent *r, 5 | void *fd, 6 | off_t pos, 7 | int whence) 8 | { 9 | FSStatus status; 10 | FSCmdBlock cmd; 11 | FSStat fsStat; 12 | uint64_t offset; 13 | __wut_fs_file_t *file; 14 | 15 | if (!fd) { 16 | r->_errno = EINVAL; 17 | return -1; 18 | } 19 | 20 | FSInitCmdBlock(&cmd); 21 | file = (__wut_fs_file_t *)fd; 22 | status = FSGetStatFile(__wut_devoptab_fs_client, &cmd, file->fd, &fsStat, 23 | FS_ERROR_FLAG_ALL); 24 | if (status < 0) { 25 | r->_errno = __wut_fs_translate_error(status); 26 | return -1; 27 | } 28 | 29 | // Find the offset to see from 30 | switch(whence) { 31 | // Set absolute position; start offset is 0 32 | case SEEK_SET: 33 | offset = 0; 34 | break; 35 | 36 | // Set position relative to the current position 37 | case SEEK_CUR: 38 | offset = file->offset; 39 | break; 40 | 41 | // Set position relative to the end of the file 42 | case SEEK_END: 43 | offset = fsStat.size; 44 | break; 45 | 46 | // An invalid option was provided 47 | default: 48 | r->_errno = EINVAL; 49 | return -1; 50 | } 51 | 52 | // TODO: A better check that prevents overflow. 53 | if(pos < 0 && offset < -pos) { 54 | // Don't allow seek to before the beginning of the file 55 | r->_errno = EINVAL; 56 | return -1; 57 | } 58 | 59 | // Update the current offset 60 | file->offset = offset + pos; 61 | status = FSSetPosFile(__wut_devoptab_fs_client, &cmd, file->fd, file->offset, 62 | FS_ERROR_FLAG_ALL); 63 | if (status < 0) { 64 | r->_errno = __wut_fs_translate_error(status); 65 | return -1; 66 | } 67 | 68 | return file->offset; 69 | } 70 | -------------------------------------------------------------------------------- /include/coreinit/exception.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "context.h" 4 | 5 | /** 6 | * \defgroup coreinit_exception Exception Handling 7 | * \ingroup coreinit 8 | * @{ 9 | */ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef BOOL (*OSExceptionCallbackFn)(OSContext *context); 16 | 17 | typedef enum OSExceptionMode 18 | { 19 | OS_EXCEPTION_MODE_SYSTEM = 0, 20 | OS_EXCEPTION_MODE_THREAD = 1, 21 | OS_EXCEPTION_MODE_GLOBAL = 2, 22 | OS_EXCEPTION_MODE_THREAD_ALL_CORES = 3, 23 | OS_EXCEPTION_MODE_GLOBAL_ALL_CORES = 4, 24 | } OSExceptionMode; 25 | 26 | typedef enum OSExceptionType 27 | { 28 | OS_EXCEPTION_TYPE_SYSTEM_RESET = 0, 29 | OS_EXCEPTION_TYPE_MACHINE_CHECK = 1, 30 | OS_EXCEPTION_TYPE_DSI = 2, 31 | OS_EXCEPTION_TYPE_ISI = 3, 32 | OS_EXCEPTION_TYPE_EXTERNAL_INTERRUPT = 4, 33 | OS_EXCEPTION_TYPE_ALIGNMENT = 5, 34 | OS_EXCEPTION_TYPE_PROGRAM = 6, 35 | OS_EXCEPTION_TYPE_FLOATING_POINT = 7, 36 | OS_EXCEPTION_TYPE_DECREMENTER = 8, 37 | OS_EXCEPTION_TYPE_SYSTEM_CALL = 9, 38 | OS_EXCEPTION_TYPE_TRACE = 10, 39 | OS_EXCEPTION_TYPE_PERFORMANCE_MONITOR = 11, 40 | OS_EXCEPTION_TYPE_BREAKPOINT = 12, 41 | OS_EXCEPTION_TYPE_SYSTEM_INTERRUPT = 13, 42 | OS_EXCEPTION_TYPE_ICI = 14, 43 | } OSExceptionType; 44 | 45 | OSExceptionCallbackFn 46 | OSSetExceptionCallback(OSExceptionType exceptionType, 47 | OSExceptionCallbackFn callback); 48 | 49 | OSExceptionCallbackFn 50 | OSSetExceptionCallbackEx(OSExceptionMode mode, 51 | OSExceptionType exceptionType, 52 | OSExceptionCallbackFn callback); 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | /** @} */ 59 | -------------------------------------------------------------------------------- /include/coreinit/debug.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup coreinit_debug Debug 6 | * \ingroup coreinit 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | typedef void (*DisassemblyPrintFn)(const char *fmt, ...); 15 | typedef uint32_t (*DisassemblyFindSymbolFn)(uint32_t addr, char *symbolNameBuf, uint32_t symbolNameBufSize); 16 | 17 | typedef enum DisassemblePPCFlags 18 | { 19 | DISASSEMBLE_PPC_FLAGS_NONE = 0, 20 | } DisassemblePPCFlags; 21 | 22 | 23 | void 24 | OSConsoleWrite(const char *msg, 25 | uint32_t size); 26 | 27 | 28 | void 29 | OSReport(const char *fmt, ...); 30 | 31 | 32 | void 33 | OSReportVerbose(const char *fmt, ...); 34 | 35 | 36 | void 37 | OSReportInfo(const char *fmt, ...); 38 | 39 | 40 | void 41 | OSReportWarn(const char *fmt, ...); 42 | 43 | 44 | void 45 | OSPanic(const char *file, 46 | uint32_t line, 47 | const char *fmt, ...); 48 | 49 | 50 | void 51 | OSFatal(const char *msg); 52 | 53 | 54 | uint32_t 55 | OSGetSymbolName(uint32_t addr, 56 | char *symbolNameBuf, 57 | uint32_t symbolNameBufSize); 58 | 59 | 60 | uint32_t 61 | OSGetUPID(); 62 | 63 | BOOL 64 | OSIsDebuggerInitialized(); 65 | 66 | BOOL 67 | OSIsDebuggerPresent(); 68 | 69 | BOOL 70 | OSIsECOBoot(); 71 | 72 | BOOL 73 | OSIsECOMode(); 74 | 75 | BOOL 76 | DisassemblePPCOpcode(uint32_t *opcode, 77 | char *buffer, 78 | uint32_t bufferSize, 79 | DisassemblyFindSymbolFn findSymbolFn, 80 | DisassemblePPCFlags flags); 81 | 82 | void 83 | DisassemblePPCRange(void *start, 84 | void *end, 85 | DisassemblyPrintFn printFn, 86 | DisassemblyFindSymbolFn findSymbolFn, 87 | DisassemblePPCFlags flags); 88 | 89 | #ifdef __cplusplus 90 | } 91 | #endif 92 | 93 | /** @} */ 94 | -------------------------------------------------------------------------------- /include/sndcore2/core.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "result.h" 4 | 5 | /** 6 | * \defgroup sndcore2_core Core 7 | * \ingroup sndcore2 8 | * 9 | * @{ 10 | */ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | typedef struct AXProfile AXProfile; 17 | typedef struct AXInitParams AXInitParams; 18 | 19 | typedef void(*AXFrameCallback)(void); 20 | 21 | //! A value from enum AX_INIT_RENDERER. 22 | typedef uint32_t AXInitRenderer; 23 | 24 | //! A value from enum AX_INIT_PIPELINE. 25 | typedef uint32_t AXInitPipeline; 26 | 27 | enum AX_INIT_RENDERER 28 | { 29 | AX_INIT_RENDERER_32KHZ = 0, 30 | AX_INIT_RENDERER_48KHZ = 1, 31 | }; 32 | 33 | enum AX_INIT_PIPELINE 34 | { 35 | AX_INIT_PIPELINE_SINGLE = 0, 36 | AX_INIT_PIPELINE_FOUR_STAGE = 1, 37 | }; 38 | 39 | struct AXProfile 40 | { 41 | // Unknown 42 | }; 43 | 44 | struct AXInitParams 45 | { 46 | AXInitRenderer renderer; 47 | WUT_UNKNOWN_BYTES(4); 48 | AXInitPipeline pipeline; 49 | }; 50 | WUT_CHECK_OFFSET(AXInitParams, 0x00, renderer); 51 | WUT_CHECK_OFFSET(AXInitParams, 0x08, pipeline); 52 | WUT_CHECK_SIZE(AXInitParams, 0x0C); 53 | 54 | void 55 | AXInit(); 56 | 57 | void 58 | AXQuit(); 59 | 60 | void 61 | AXInitWithParams(AXInitParams *params); 62 | 63 | BOOL 64 | AXIsInit(); 65 | 66 | void 67 | AXInitProfile(AXProfile *profile, 68 | uint32_t count); 69 | 70 | uint32_t 71 | AXGetSwapProfile(AXProfile *profile, 72 | uint32_t count); 73 | 74 | AXResult 75 | AXSetDefaultMixerSelect(uint32_t unk0); 76 | 77 | AXResult 78 | AXRegisterAppFrameCallback(AXFrameCallback callback); 79 | 80 | AXResult 81 | AXDeregisterAppFrameCallback(AXFrameCallback callback); 82 | 83 | AXFrameCallback 84 | AXRegisterFrameCallback(AXFrameCallback callback); 85 | 86 | uint32_t 87 | AXGetInputSamplesPerFrame(); 88 | 89 | uint32_t 90 | AXGetInputSamplesPerSec(); 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | /** @} */ 97 | -------------------------------------------------------------------------------- /libraries/wutdevoptab/devoptab_fs_utils.c: -------------------------------------------------------------------------------- 1 | #include "devoptab_fs.h" 2 | 3 | char * 4 | __wut_fs_fixpath(struct _reent *r, 5 | const char *path) 6 | { 7 | char *p; 8 | char *fixedPath; 9 | 10 | if (!path) { 11 | r->_errno = EINVAL; 12 | return NULL; 13 | } 14 | 15 | p = strchr(path, ':') + 1; 16 | if (!strchr(path, ':')) { 17 | p = (char*)path; 18 | } 19 | 20 | if (strlen(p) > PATH_MAX) { 21 | r->_errno = ENAMETOOLONG; 22 | return NULL; 23 | } 24 | 25 | fixedPath = memalign(0x40, PATH_MAX + 1); 26 | if (!fixedPath) { 27 | r->_errno = ENOMEM; 28 | return NULL; 29 | } 30 | 31 | // cwd is handled by coreinit, so just strip the 'device:' if it exists 32 | strcpy(fixedPath, p); 33 | return fixedPath; 34 | } 35 | 36 | int 37 | __wut_fs_translate_error(FSStatus error) 38 | { 39 | switch ((int32_t)error) { 40 | case FS_STATUS_END: 41 | return ENOENT; 42 | case FS_STATUS_CANCELLED: 43 | return EINVAL; 44 | case FS_STATUS_EXISTS: 45 | return EEXIST; 46 | case FS_STATUS_MEDIA_ERROR: 47 | return EIO; 48 | case FS_STATUS_NOT_FOUND: 49 | return ENOENT; 50 | case FS_STATUS_PERMISSION_ERROR: 51 | return EPERM; 52 | case FS_STATUS_STORAGE_FULL: 53 | return ENOSPC; 54 | case FS_ERROR_ALREADY_EXISTS: 55 | return EEXIST; 56 | case FS_ERROR_BUSY: 57 | return EBUSY; 58 | case FS_ERROR_CANCELLED: 59 | return ECANCELED; 60 | case FS_STATUS_FILE_TOO_BIG: 61 | return EFBIG; 62 | case FS_ERROR_INVALID_PATH: 63 | return ENAMETOOLONG; 64 | case FS_ERROR_NOT_DIR: 65 | return ENOTDIR; 66 | case FS_ERROR_NOT_FILE: 67 | return EISDIR; 68 | case FS_ERROR_OUT_OF_RANGE: 69 | return ESPIPE; 70 | case FS_ERROR_UNSUPPORTED_COMMAND: 71 | return ENOTSUP; 72 | case FS_ERROR_WRITE_PROTECTED: 73 | return EROFS; 74 | default: 75 | return (int)error; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /include/gx2/context.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * \defgroup gx2_context Context State 6 | * \ingroup gx2 7 | * @{ 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | typedef struct GX2ShadowState GX2ShadowState; 15 | typedef struct GX2ContextState GX2ContextState; 16 | 17 | struct GX2ShadowState 18 | { 19 | uint32_t config[0xB00]; 20 | uint32_t context[0x400]; 21 | uint32_t alu[0x800]; 22 | uint32_t loop[0x60]; 23 | WUT_PADDING_BYTES((0x80 - 0x60) * 4); 24 | uint32_t resource[0xD9E]; 25 | WUT_PADDING_BYTES((0xDC0 - 0xD9E) * 4); 26 | uint32_t sampler[0xA2]; 27 | WUT_PADDING_BYTES((0xC0 - 0xA2) * 4); 28 | }; 29 | WUT_CHECK_OFFSET(GX2ShadowState, 0x0000, config); 30 | WUT_CHECK_OFFSET(GX2ShadowState, 0x2C00, context); 31 | WUT_CHECK_OFFSET(GX2ShadowState, 0x3C00, alu); 32 | WUT_CHECK_OFFSET(GX2ShadowState, 0x5C00, loop); 33 | WUT_CHECK_OFFSET(GX2ShadowState, 0x5E00, resource); 34 | WUT_CHECK_OFFSET(GX2ShadowState, 0x9500, sampler); 35 | WUT_CHECK_SIZE(GX2ShadowState, 0x9800); 36 | 37 | struct GX2ContextState 38 | { 39 | GX2ShadowState shadowState; 40 | WUT_UNKNOWN_BYTES(4); 41 | uint32_t shadowDisplayListSize; 42 | WUT_UNKNOWN_BYTES(0x9e00 - 0x9808); 43 | uint32_t shadowDisplayList[192]; 44 | }; 45 | WUT_CHECK_OFFSET(GX2ContextState, 0x0000, shadowState); 46 | WUT_CHECK_OFFSET(GX2ContextState, 0x9804, shadowDisplayListSize); 47 | WUT_CHECK_OFFSET(GX2ContextState, 0x9e00, shadowDisplayList); 48 | WUT_CHECK_SIZE(GX2ContextState, 0xa100); 49 | 50 | void 51 | GX2SetupContextStateEx(GX2ContextState *state, 52 | BOOL unk1); 53 | 54 | void 55 | GX2GetContextStateDisplayList(const GX2ContextState *state, 56 | void *outDisplayList, 57 | uint32_t *outSize); 58 | 59 | void 60 | GX2SetContextState(GX2ContextState *state); 61 | 62 | void 63 | GX2SetDefaultState(); 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | 69 | /** @} */ 70 | -------------------------------------------------------------------------------- /libraries/wutnewlib/wut_sbrk.c: -------------------------------------------------------------------------------- 1 | #include "wut_newlib.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | extern uint32_t __attribute__((weak)) __wut_heap_max_size; 9 | 10 | static MEMHeapHandle sHeapHandle = NULL; 11 | static void *sHeapBase = NULL; 12 | static uint32_t sHeapMaxSize = 0; 13 | static volatile uint32_t sHeapSize = 0; 14 | 15 | void * 16 | __wut_sbrk_r(struct _reent *r, 17 | ptrdiff_t incr) 18 | { 19 | uint32_t oldSize, newSize; 20 | 21 | do { 22 | oldSize = sHeapSize; 23 | newSize = oldSize + incr; 24 | 25 | if (newSize > sHeapMaxSize) { 26 | r->_errno = ENOMEM; 27 | return (void *)-1; 28 | } 29 | } while (!OSCompareAndSwapAtomic(&sHeapSize, oldSize, newSize)); 30 | 31 | return ((uint8_t *)sHeapBase) + oldSize; 32 | } 33 | 34 | void 35 | __init_wut_sbrk_heap() 36 | { 37 | if (sHeapBase) { 38 | // Already initialised 39 | return; 40 | } 41 | 42 | if (&__wut_heap_max_size) { 43 | // Use default heap 44 | sHeapBase = MEMAllocFromDefaultHeap(__wut_heap_max_size); 45 | sHeapMaxSize = __wut_heap_max_size; 46 | } else { 47 | // No max size specified, use 90% of base MEM2 heap 48 | sHeapHandle = MEMGetBaseHeapHandle(MEM_BASE_HEAP_MEM2); 49 | 50 | uint32_t freeSize = MEMGetAllocatableSizeForExpHeapEx(sHeapHandle, 4); 51 | sHeapMaxSize = (uint32_t)(0.9f * (float)freeSize) & ~0xFFF; 52 | 53 | sHeapBase = MEMAllocFromExpHeapEx(sHeapHandle, sHeapMaxSize, 4); 54 | } 55 | 56 | sHeapSize = 0; 57 | } 58 | 59 | void 60 | __fini_wut_sbrk_heap() 61 | { 62 | if (!sHeapBase) { 63 | // Already finalised 64 | return; 65 | } 66 | 67 | if (sHeapHandle) { 68 | MEMFreeToExpHeap(sHeapHandle, sHeapBase); 69 | } else { 70 | MEMFreeToDefaultHeap(sHeapBase); 71 | } 72 | 73 | sHeapBase = NULL; 74 | sHeapSize = 0; 75 | sHeapMaxSize = 0; 76 | } 77 | -------------------------------------------------------------------------------- /include/gx2r/buffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "resource.h" 4 | 5 | /** 6 | * \defgroup gx2r_buffer Buffer 7 | * \ingroup gx2r 8 | * @{ 9 | */ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef struct GX2RBuffer GX2RBuffer; 16 | 17 | struct GX2RBuffer 18 | { 19 | GX2RResourceFlags flags; 20 | uint32_t elemSize; 21 | uint32_t elemCount; 22 | void *buffer; 23 | }; 24 | WUT_CHECK_SIZE(GX2RBuffer, 0x10); 25 | WUT_CHECK_OFFSET(GX2RBuffer, 0x00, flags); 26 | WUT_CHECK_OFFSET(GX2RBuffer, 0x04, elemSize); 27 | WUT_CHECK_OFFSET(GX2RBuffer, 0x08, elemCount); 28 | WUT_CHECK_OFFSET(GX2RBuffer, 0x0C, buffer); 29 | 30 | BOOL 31 | GX2RBufferExists(GX2RBuffer *buffer); 32 | 33 | BOOL 34 | GX2RCreateBuffer(GX2RBuffer *buffer); 35 | 36 | BOOL 37 | GX2RCreateBufferUserMemory(GX2RBuffer *buffer, 38 | void *memory, 39 | uint32_t size); 40 | 41 | void 42 | GX2RDestroyBufferEx(GX2RBuffer *buffer, 43 | GX2RResourceFlags flags); 44 | 45 | uint32_t 46 | GX2RGetBufferAlignment(GX2RResourceFlags flags); 47 | 48 | uint32_t 49 | GX2RGetBufferAllocationSize(GX2RBuffer *buffer); 50 | 51 | void 52 | GX2RInvalidateBuffer(GX2RBuffer *buffer, 53 | GX2RResourceFlags flags); 54 | 55 | void * 56 | GX2RLockBufferEx(GX2RBuffer *buffer, 57 | GX2RResourceFlags flags); 58 | 59 | void 60 | GX2RUnlockBufferEx(GX2RBuffer *buffer, 61 | GX2RResourceFlags flags); 62 | 63 | void 64 | GX2RSetVertexUniformBlock(GX2RBuffer *buffer, 65 | uint32_t location, 66 | uint32_t offset); 67 | 68 | void 69 | GX2RSetPixelUniformBlock(GX2RBuffer *buffer, 70 | uint32_t location, 71 | uint32_t offset); 72 | 73 | void 74 | GX2RSetGeometryUniformBlock(GX2RBuffer *buffer, 75 | uint32_t location, 76 | uint32_t offset); 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | 82 | /** @} */ 83 | -------------------------------------------------------------------------------- /libraries/libwhb/src/sdcard.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | static BOOL 6 | sMounted = FALSE; 7 | 8 | static char 9 | sMountPath[128] = { 0 }; 10 | 11 | static FSClient 12 | sClient; 13 | 14 | BOOL 15 | WHBMountSdCard() 16 | { 17 | FSCmdBlock cmd; 18 | FSMountSource mountSource; 19 | FSStatus result; 20 | 21 | if (sMounted) { 22 | return TRUE; 23 | } 24 | 25 | FSInit(); 26 | 27 | result = FSAddClient(&sClient, FS_ERROR_FLAG_ALL); 28 | if (result != FS_STATUS_OK) { 29 | WHBLogPrintf("%s: FSAddClient error %d", __FUNCTION__, result); 30 | return FALSE; 31 | } 32 | 33 | FSInitCmdBlock(&cmd); 34 | result = FSGetMountSource(&sClient, &cmd, FS_MOUNT_SOURCE_SD, &mountSource, FS_ERROR_FLAG_ALL); 35 | if (result < 0) { 36 | WHBLogPrintf("%s: FSGetMountSource error %d", __FUNCTION__, result); 37 | goto fail; 38 | } 39 | 40 | result = FSMount(&sClient, &cmd, &mountSource, sMountPath, sizeof(sMountPath), FS_ERROR_FLAG_ALL); 41 | if (result < 0) { 42 | WHBLogPrintf("%s: FSMount error %d", __FUNCTION__, result); 43 | goto fail; 44 | } 45 | 46 | sMounted = TRUE; 47 | return TRUE; 48 | 49 | fail: 50 | FSDelClient(&sClient, FS_ERROR_FLAG_ALL); 51 | return FALSE; 52 | } 53 | 54 | char * 55 | WHBGetSdCardMountPath() 56 | { 57 | return sMountPath; 58 | } 59 | 60 | BOOL 61 | WHBUnmountSdCard() 62 | { 63 | FSCmdBlock cmd; 64 | FSStatus result; 65 | 66 | if (!sMounted) { 67 | return TRUE; 68 | } 69 | 70 | FSInitCmdBlock(&cmd); 71 | 72 | result = FSUnmount(&sClient, &cmd, sMountPath, FS_ERROR_FLAG_ALL); 73 | if (result < 0) { 74 | WHBLogPrintf("%s: FSUnmount error %d", __FUNCTION__, result); 75 | return FALSE; 76 | } 77 | 78 | result = FSDelClient(&sClient, FS_ERROR_FLAG_ALL); 79 | if (result < 0) { 80 | WHBLogPrintf("%s: FSDelClient error %d", __FUNCTION__, result); 81 | return FALSE; 82 | } 83 | 84 | sMounted = FALSE; 85 | return TRUE; 86 | } 87 | -------------------------------------------------------------------------------- /cafe/nn_pdm.def: -------------------------------------------------------------------------------- 1 | :NAME nn_pdm 2 | 3 | :TEXT 4 | ClearPlayData__Q2_2nn3pdmFUi 5 | CloseAllFiles__Q2_2nn3pdmFv 6 | Convert__Q2_2nn3pdmFi 7 | CreateWiiReturnSaveData__Q2_2nn3pdmFi 8 | Finalize__Q2_2nn3pdmFv 9 | GetPlayDiaryLength__Q2_2nn3pdmFPii 10 | GetPlayDiaryMaxLength__Q2_2nn3pdmFPi 11 | GetPlayDiaryStart__Q2_2nn3pdmFPii 12 | GetPlayDiary__Q2_2nn3pdmFPQ3_2nn3pdm9PlayDiaryiT2 13 | GetPlayDiary__Q2_2nn3pdmFPiPQ3_2nn3pdm9PlayDiaryiT3 14 | GetPlayEventMaxLength__Q2_2nn3pdmFPi 15 | GetPlayEvent__Q2_2nn3pdmFPiPQ3_2nn3pdm9PlayEventiT3 16 | GetPlayLogEx__Q2_2nn3pdmFPiPQ3_2nn3pdm7PlayLogiT3Q3_2nn3pdm12TitleIdStyle 17 | GetPlayLogLength__Q2_2nn3pdmFPii 18 | GetPlayLogMaxLength__Q2_2nn3pdmFPi 19 | GetPlayLogStart__Q2_2nn3pdmFPii 20 | GetPlayLog__Q2_2nn3pdmFPQ3_2nn3pdm7PlayLogiT2 21 | GetPlayLog__Q2_2nn3pdmFPiPQ3_2nn3pdm7PlayLogiT3 22 | GetPlayStatsLength__Q2_2nn3pdmFPii 23 | GetPlayStatsMaxLength__Q2_2nn3pdmFPi 24 | GetPlayStatsOfTitleId__Q2_2nn3pdmFPQ3_2nn3pdm9PlayStatsiUL 25 | GetPlayStats__Q2_2nn3pdmFPQ3_2nn3pdm9PlayStatsiT2 26 | GetPlayStats__Q2_2nn3pdmFPiPQ3_2nn3pdm9PlayStatsiT3 27 | Initialize__Q2_2nn3pdmFv 28 | NotifyChangeAccountBeginEvent__Q2_2nn3pdmFi 29 | NotifyChangeAccountBeginEvent__Q2_2nn3pdmFv 30 | NotifyChangeAccountEndEvent__Q2_2nn3pdmFi 31 | NotifyChangeAccountEndEvent__Q2_2nn3pdmFv 32 | NotifyEnterCompatibleModeEvent__Q2_2nn3pdmFv 33 | NotifyEnterHaiModeEvent__Q2_2nn3pdmFv 34 | NotifyPlayEvent__Q2_2nn3pdmFUi 35 | NotifyPlayEvent__Q2_2nn3pdmFUiN21UL 36 | NotifyPlayEvent__Q2_2nn3pdmFUii 37 | NotifySetTimeBeginEvent__Q2_2nn3pdmFv 38 | NotifySetTimeEndEvent__Q2_2nn3pdmFv 39 | PDMCloseAllFiles 40 | PDMFinalize 41 | PDMInitialize 42 | PDMNotifyChangeAccountBeginEvent 43 | PDMNotifyChangeAccountEndEvent 44 | PDMNotifyEnterCompatibleModeEvent 45 | PDMNotifyEnterHaiModeEvent 46 | PDMNotifyPlayEvent 47 | PDMNotifySetTimeBeginEvent 48 | PDMNotifySetTimeEndEvent 49 | SetPlayDiary__Q2_2nn3pdmFPCQ3_2nn3pdm9PlayDiaryiN22 50 | SetPlayEvent__Q2_2nn3pdmFPCQ3_2nn3pdm9PlayEventiT2 51 | SetPlayLog__Q2_2nn3pdmFPCQ3_2nn3pdm7PlayLogiN22 52 | SetPlayStats__Q2_2nn3pdmFPCQ3_2nn3pdm9PlayStatsiT2 53 | WaitForConvertDone__Q2_2nn3pdmFv 54 | -------------------------------------------------------------------------------- /include/dmae/mem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "sync.h" 4 | 5 | /** 6 | * \defgroup dmae_mem Memory Operations 7 | * \ingroup dmae 8 | * @{ 9 | */ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | //! DMAE Memory endian swappng mode. 16 | typedef enum 17 | { 18 | //! No memory swapping. 19 | DMAE_SWAP_NONE = 0, 20 | //! 16 bit memory swapping. 21 | DMAE_SWAP_16 = 1, 22 | //! 32 bit memory swapping. 23 | DMAE_SWAP_32 = 2, 24 | //! 64 bit memory swapping. 25 | DMAE_SWAP_64 = 3, 26 | } DMAESwapMode; 27 | 28 | /** 29 | * Starts a DMAE copy operation. 30 | * 31 | * \param dst 32 | * Pointer to the destination buffer. 33 | * 34 | * \param src 35 | * Pointer to the source buffer. 36 | * 37 | * \param wordCount 38 | * Number of 32 bit words to copy. 39 | * 40 | * \param swap 41 | * Memory endian swapping mode. 42 | * 43 | * \return 44 | * DMAE operations queue timestamp. 45 | */ 46 | DMAETimeStamp 47 | DMAECopyMem(void *dst, 48 | const void *src, 49 | uint32_t wordCount, 50 | DMAESwapMode swap); 51 | 52 | /** 53 | * Starts a DMAE fill operation. 54 | * 55 | * \param dst 56 | * Pointer to the destination buffer. 57 | * 58 | * \param val 59 | * The value to fill the destination buffer. 60 | * 61 | * \param wordCount 62 | * Number of 32 bit words to fill. 63 | * 64 | * \return 65 | * DMAE operations queue timestamp. 66 | */ 67 | DMAETimeStamp 68 | DMAEFillMem(void *dst, 69 | uint32_t val, 70 | uint32_t wordCount); 71 | 72 | /** 73 | * Starts a DMAE fill operation for a physical address. 74 | * 75 | * \param dst 76 | * Pointer to the destination buffer (physical address). 77 | * 78 | * \param val 79 | * The value to fill the destination buffer. 80 | * 81 | * \param wordCount 82 | * Number of 32 bit words to fill. 83 | * 84 | * \return 85 | * DMAE operations queue timestamp. 86 | */ 87 | DMAETimeStamp 88 | DMAEFillMemPhys(void *dst, 89 | uint32_t val, 90 | uint32_t wordCount); 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | /** @} */ 97 | -------------------------------------------------------------------------------- /include/gx2/sampler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "enum.h" 4 | 5 | /** 6 | * \defgroup gx2_sampler Sampler 7 | * \ingroup gx2 8 | * @{ 9 | */ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef struct GX2Sampler GX2Sampler; 16 | 17 | struct GX2Sampler 18 | { 19 | uint32_t regs[3]; 20 | }; 21 | WUT_CHECK_SIZE(GX2Sampler, 12); 22 | 23 | void 24 | GX2InitSampler(GX2Sampler *sampler, 25 | GX2TexClampMode clampMode, 26 | GX2TexXYFilterMode minMagFilterMode); 27 | 28 | void 29 | GX2InitSamplerBorderType(GX2Sampler *sampler, 30 | GX2TexBorderType borderType); 31 | 32 | void 33 | GX2InitSamplerClamping(GX2Sampler *sampler, 34 | GX2TexClampMode clampX, 35 | GX2TexClampMode clampY, 36 | GX2TexClampMode clampZ); 37 | 38 | void 39 | GX2InitSamplerDepthCompare(GX2Sampler *sampler, 40 | GX2CompareFunction depthCompare); 41 | 42 | void 43 | GX2InitSamplerFilterAdjust(GX2Sampler *sampler, 44 | BOOL highPrecision, 45 | GX2TexMipPerfMode perfMip, 46 | GX2TexZPerfMode perfZ); 47 | 48 | void 49 | GX2InitSamplerLOD(GX2Sampler *sampler, 50 | float lodMin, 51 | float lodMax, 52 | float lodBias); 53 | 54 | void 55 | GX2InitSamplerLODAdjust(GX2Sampler *sampler, 56 | float unk1, 57 | BOOL unk2); 58 | 59 | void 60 | GX2InitSamplerRoundingMode(GX2Sampler *sampler, 61 | GX2RoundingMode roundingMode); 62 | 63 | void 64 | GX2InitSamplerXYFilter(GX2Sampler *sampler, 65 | GX2TexXYFilterMode filterMag, 66 | GX2TexXYFilterMode filterMin, 67 | GX2TexAnisoRatio maxAniso); 68 | 69 | void 70 | GX2InitSamplerZMFilter(GX2Sampler *sampler, 71 | GX2TexZFilterMode filterZ, 72 | GX2TexMipFilterMode filterMip); 73 | 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | 78 | /** @} */ 79 | -------------------------------------------------------------------------------- /cafe/nn_ccr.def: -------------------------------------------------------------------------------- 1 | :NAME nn_ccr 2 | 3 | :TEXT 4 | CCRSysCaffeineBootCheck 5 | CCRSysCaffeineBootCheckAbort 6 | CCRSysCaffeineDisplayNotification 7 | CCRSysCaffeineDisplayNotificationAbort 8 | CCRSysCaffeineGetAppLaunchParam 9 | CCRSysCaffeineGetEnableFlag 10 | CCRSysCaffeineGetNotificationReadCount 11 | CCRSysCaffeineGetNotificationSoundMode 12 | CCRSysCaffeineInitializeSettings 13 | CCRSysCaffeineSetCaffeineSlot 14 | CCRSysCaffeineSetDRCEnableFlag 15 | CCRSysCaffeineSetEnableFlag 16 | CCRSysCaffeineSetInitialBootFlag 17 | CCRSysCaffeineSetNotificationInfo 18 | CCRSysCaffeineSetNotificationReadCount 19 | CCRSysCaffeineSetNotificationSoundMode 20 | CCRSysCaffeineSyncEnableFlag 21 | CCRSysCaffeineUpdate 22 | CCRSysCaffeineUpdateAbort 23 | CCRSysCaffeineUpdateEx 24 | CCRSysChangeDRCStateForBGUP 25 | CCRSysDRCFWUpdate 26 | CCRSysDRCFWUpdateForward 27 | CCRSysDRCShutdown 28 | CCRSysDRHReset 29 | CCRSysDbgGetDRHStateChangeFlag 30 | CCRSysDbgSetDRHStateChangeFlag 31 | CCRSysExit 32 | CCRSysGetAudioMode 33 | CCRSysGetCurrentLCDMode 34 | CCRSysGetInitBootFlag 35 | CCRSysGetLCDCabcMode 36 | CCRSysGetLCDMode 37 | CCRSysGetLanguage 38 | CCRSysGetMessageLEDMode 39 | CCRSysGetPairingState 40 | CCRSysGetPincode 41 | CCRSysGetRemoteInfo 42 | CCRSysGetRumbleMode 43 | CCRSysGetTVControlId 44 | CCRSysGetUpdateState 45 | CCRSysGetVersionCheckFlag 46 | CCRSysInit 47 | CCRSysInitializeSettings 48 | CCRSysInvalidatePairing 49 | CCRSysIsRemoteValid 50 | CCRSysNeedsDRCFWUpdate 51 | CCRSysSetAudioMode 52 | CCRSysSetCurrentLCDMode 53 | CCRSysSetInitBootFlag 54 | CCRSysSetLCDCabcMode 55 | CCRSysSetLCDMode 56 | CCRSysSetLCDMute 57 | CCRSysSetLanguage 58 | CCRSysSetMessageLEDMode 59 | CCRSysSetRemoteInfo 60 | CCRSysSetRumbleMode 61 | CCRSysSetSystemTime 62 | CCRSysSetVersionCheckFlag 63 | CCRSysSetVideoQuality 64 | CCRSysStartPairing 65 | CCRSysStopPairing 66 | CCRSysTestTVControl 67 | CCRSysWlChannelScan 68 | CCRSysWlGetChannelStats 69 | CCRSysWlGetWorkSize 70 | CCRSysWlSetWorkarea 71 | CCRSysWlUpdateCondition 72 | __CCRSysCaffeineSetEnableFlag 73 | __CCRSysDRCFWUpdate 74 | __CCRSysDRCIsAttached 75 | __CCRSysInitReattach 76 | __CCRSysLanguageUpdate 77 | __CCRSysNeedsDRCFWUpdate 78 | __CCRSysWaitReattach 79 | -------------------------------------------------------------------------------- /libraries/wutsocket/poll.c: -------------------------------------------------------------------------------- 1 | #include "wut_socket.h" 2 | 3 | int 4 | poll(struct pollfd *fds, 5 | nfds_t nfds, 6 | int timeout) 7 | { 8 | int cnv_nfds = 0, rc, i; 9 | nsysnet_fd_set cnv_rd, cnv_wr, cnv_ex; 10 | struct nsysnet_timeval cnv_timeout; 11 | 12 | if (!fds) { 13 | errno = EINVAL; 14 | return -1; 15 | } 16 | 17 | NSYSNET_FD_ZERO(&cnv_rd); 18 | NSYSNET_FD_ZERO(&cnv_wr); 19 | NSYSNET_FD_ZERO(&cnv_ex); 20 | 21 | for (i = 0; i < nfds; i++) { 22 | int cnv_fd; 23 | 24 | if (fds[i].fd < 0) { 25 | continue; 26 | } 27 | 28 | cnv_fd = __wut_get_nsysnet_fd(fds[i].fd); 29 | if (cnv_fd == -1) { 30 | return -1; 31 | } 32 | 33 | if ((cnv_fd + 1) > cnv_nfds) { 34 | cnv_nfds = cnv_fd + 1; 35 | } 36 | 37 | if (fds[i].events & POLLIN) { 38 | NSYSNET_FD_SET(cnv_fd, &cnv_rd); 39 | } 40 | if (fds[i].events & POLLOUT) { 41 | NSYSNET_FD_SET(cnv_fd, &cnv_wr); 42 | } 43 | if (fds[i].events & POLLPRI) { 44 | NSYSNET_FD_SET(cnv_fd, &cnv_ex); 45 | } 46 | } 47 | 48 | if (timeout >= 0) { 49 | cnv_timeout.tv_sec = timeout / 1000; 50 | cnv_timeout.tv_usec = (timeout % 1000) * 1000; 51 | } 52 | 53 | rc = RPLWRAP(select)(cnv_nfds, &cnv_rd, &cnv_wr, &cnv_ex, 54 | (timeout >= 0) ? &cnv_timeout : NULL); 55 | 56 | rc = __wut_get_nsysnet_result(NULL, rc); 57 | if (rc == -1) { 58 | return rc; 59 | } 60 | 61 | for (i = 0; i < nfds; i++) { 62 | int cnv_fd; 63 | 64 | fds[i].revents = 0; 65 | 66 | if (fds[i].fd < 0) { 67 | continue; 68 | } 69 | 70 | cnv_fd = __wut_get_nsysnet_fd(fds[i].fd); 71 | if (cnv_fd == -1) { 72 | continue; 73 | } 74 | 75 | if (NSYSNET_FD_ISSET(cnv_fd, &cnv_rd)) { 76 | fds[i].revents |= POLLIN; 77 | } 78 | if (NSYSNET_FD_ISSET(cnv_fd, &cnv_wr)) { 79 | fds[i].revents |= POLLOUT; 80 | } 81 | if (NSYSNET_FD_ISSET(cnv_fd, &cnv_ex)) { 82 | fds[i].revents |= POLLPRI; 83 | } 84 | } 85 | 86 | return rc; 87 | } 88 | -------------------------------------------------------------------------------- /include/sndcore2/device.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "result.h" 4 | 5 | /** 6 | * \defgroup sndcore2_device Device 7 | * \ingroup sndcore2 8 | * 9 | * @{ 10 | */ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | typedef void(*AXDeviceFinalMixCallback)(void*); 17 | typedef void(*AXAuxCallback)(void*, void*); 18 | 19 | //! A value from enum AX_DEVICE_MODE. 20 | typedef uint32_t AXDeviceMode; 21 | 22 | //! A value from enum AX_DEVICE_TYPE. 23 | typedef uint32_t AXDeviceType; 24 | 25 | enum AX_DEVICE_MODE 26 | { 27 | // Unknown 28 | AX_DEVICE_MODE_UNKNOWN 29 | }; 30 | 31 | enum AX_DEVICE_TYPE 32 | { 33 | AX_DEVICE_TYPE_TV = 0, 34 | AX_DEVICE_TYPE_DRC = 1, 35 | AX_DEVICE_TYPE_CONTROLLER = 2, 36 | }; 37 | 38 | AXResult 39 | AXGetDeviceMode(AXDeviceType type, 40 | AXDeviceMode *mode); 41 | 42 | AXResult 43 | AXGetDeviceFinalMixCallback(AXDeviceType type, 44 | AXDeviceFinalMixCallback *func); 45 | 46 | AXResult 47 | AXRegisterDeviceFinalMixCallback(AXDeviceType type, 48 | AXDeviceFinalMixCallback func); 49 | 50 | AXResult 51 | AXGetAuxCallback(AXDeviceType type, 52 | uint32_t unk0, 53 | uint32_t unk1, 54 | AXAuxCallback *callback, 55 | void **userData); 56 | 57 | AXResult 58 | AXRegisterAuxCallback(AXDeviceType type, 59 | uint32_t unk0, 60 | uint32_t unk1, 61 | AXAuxCallback callback, 62 | void *userData); 63 | 64 | AXResult 65 | AXSetDeviceLinearUpsampler(AXDeviceType type, 66 | uint32_t unk0, 67 | uint32_t unk1); 68 | 69 | AXResult 70 | AXSetDeviceCompressor(AXDeviceType type, 71 | uint32_t unk0); 72 | 73 | AXResult 74 | AXSetDeviceUpsampleStage(AXDeviceType type, 75 | BOOL postFinalMix); 76 | 77 | AXResult 78 | AXSetDeviceVolume(AXDeviceType type, 79 | uint32_t id, 80 | uint16_t volume); 81 | 82 | #ifdef __cplusplus 83 | } 84 | #endif 85 | 86 | /** @} */ 87 | -------------------------------------------------------------------------------- /include/sndcore2/drcvs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "result.h" 4 | 5 | /** 6 | * \defgroup sndcore2_drcvs DRC VS 7 | * \ingroup sndcore2 8 | * 9 | * @{ 10 | */ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | //! A value from enum AX_DRC_VS_MODE. 17 | typedef uint32_t AXDRCVSMode; 18 | 19 | //! A value from enum AX_DRC_VS_OUTPUT. 20 | typedef uint32_t AXDRCVSOutput; 21 | 22 | //! A value from enum AX_DRC_VS_LC. 23 | typedef uint32_t AXDRCVSLC; 24 | 25 | //! A value from enum AX_DRC_VS_SPEAKER_POS. 26 | typedef uint32_t AXDRCVSSpeakerPosition; 27 | 28 | //! A value from enum AX_DRC_VS_SURROUND_GAIN. 29 | typedef uint32_t AXDRCVSSurroundLevelGain; 30 | 31 | enum AX_DRC_VS_MODE 32 | { 33 | // Unknown 34 | AX_DRC_VS_MODE_UNKNOWN 35 | }; 36 | 37 | enum AX_DRC_VS_OUTPUT 38 | { 39 | // Unknown 40 | AX_DRC_VS_OUTPUT_UNKNOWN 41 | }; 42 | 43 | enum AX_DRC_VS_LC 44 | { 45 | // Unknown 46 | AX_DRC_VS_LC_UNKNOWN 47 | }; 48 | 49 | enum AX_DRC_VS_SPEAKER_POS 50 | { 51 | // Unknown 52 | AX_DRC_VS_SPEAKER_POS_UNKNOWN 53 | }; 54 | 55 | enum AX_DRC_VS_SURROUND_GAIN 56 | { 57 | // Unknown 58 | AX_DRC_VS_SURROUND_GAIN_UNKNOWN 59 | }; 60 | 61 | AXResult 62 | AXGetDRCVSMode(AXDRCVSMode *mode); 63 | 64 | AXResult 65 | AXSetDRCVSMode(AXDRCVSMode mode); 66 | 67 | AXResult 68 | AXSetDRCVSDownmixBalance(AXDRCVSOutput output, 69 | float balance); 70 | 71 | AXResult 72 | AXSetDRCVSLC(AXDRCVSLC lc); 73 | 74 | AXResult 75 | AXSetDRCVSLimiter(BOOL limit); 76 | 77 | AXResult 78 | AXSetDRCVSLimiterThreshold(float threshold); 79 | 80 | AXResult 81 | AXSetDRCVSOutputGain(AXDRCVSOutput output, 82 | float gain); 83 | 84 | AXResult 85 | AXSetDRCVSSpeakerPosition(AXDRCVSOutput output, 86 | AXDRCVSSpeakerPosition pos); 87 | 88 | AXResult 89 | AXSetDRCVSSurroundDepth(AXDRCVSOutput output, 90 | float depth); 91 | 92 | AXResult 93 | AXSetDRCVSSurroundLevelGain(AXDRCVSSurroundLevelGain gain); 94 | 95 | #ifdef __cplusplus 96 | } 97 | #endif 98 | 99 | /** @} */ 100 | -------------------------------------------------------------------------------- /cafe/vpad.def: -------------------------------------------------------------------------------- 1 | :NAME vpad 2 | 3 | :TEXT 4 | VPADCalcTPCalibrationParam 5 | VPADControlMotor 6 | VPADDisableGyroAccRevise 7 | VPADDisableGyroDirRevise 8 | VPADDisableGyroZeroPlay 9 | VPADDisableLStickZeroClamp 10 | VPADDisablePowerButton 11 | VPADDisableRStickZeroClamp 12 | VPADDisableStickCrossClamp 13 | VPADEnableGyroAccRevise 14 | VPADEnableGyroDirRevise 15 | VPADEnableGyroZeroPlay 16 | VPADEnableLStickZeroClamp 17 | VPADEnablePowerButton 18 | VPADEnableRStickZeroClamp 19 | VPADEnableStickCrossClamp 20 | VPADGetAccParam 21 | VPADGetAccPlayMode 22 | VPADGetButtonProcMode 23 | VPADGetCrossStickEmulationParamsL 24 | VPADGetCrossStickEmulationParamsR 25 | VPADGetGyroAccReviseParam 26 | VPADGetGyroDirReviseParam 27 | VPADGetGyroMagReviseParam 28 | VPADGetGyroZeroDriftMode 29 | VPADGetGyroZeroPlayParam 30 | VPADGetLStickClampThreshold 31 | VPADGetLcdMode 32 | VPADGetRStickClampThreshold 33 | VPADGetTPCalibratedPoint 34 | VPADGetTPCalibratedPointEx 35 | VPADGetTPCalibrationParam 36 | VPADGetTVMenuStatus 37 | VPADInit 38 | VPADInitGyroAccReviseParam 39 | VPADInitGyroDirReviseParam 40 | VPADInitGyroZeroDriftMode 41 | VPADInitGyroZeroPlayParam 42 | VPADIsEnableGyroAccRevise 43 | VPADIsEnableGyroDirRevise 44 | VPADIsEnableGyroZeroDrift 45 | VPADIsEnableGyroZeroPlay 46 | VPADIsStartedGyroMagRevise 47 | VPADRead 48 | VPADResetAccToDefault 49 | VPADResetTPToDefault 50 | VPADSetAccParam 51 | VPADSetAccPlayMode 52 | VPADSetAudioVolumeOverride 53 | VPADSetBtnRepeat 54 | VPADSetButtonProcMode 55 | VPADSetCrossStickEmulationParamsL 56 | VPADSetCrossStickEmulationParamsR 57 | VPADSetGyroAccReviseParam 58 | VPADSetGyroAngle 59 | VPADSetGyroDirReviseBase 60 | VPADSetGyroDirReviseParam 61 | VPADSetGyroDirection 62 | VPADSetGyroDirectionMag 63 | VPADSetGyroMagReviseParam 64 | VPADSetGyroMagnification 65 | VPADSetGyroZeroDriftMode 66 | VPADSetGyroZeroPlayParam 67 | VPADSetLStickClampThreshold 68 | VPADSetLcdMode 69 | VPADSetRStickClampThreshold 70 | VPADSetSamplingCallback 71 | VPADSetSensorBar 72 | VPADSetStickOrigin 73 | VPADSetTPCalibrationParam 74 | VPADSetTVMenuInvalid 75 | VPADShutdown 76 | VPADStartAccCalibration 77 | VPADStartGyroMagRevise 78 | VPADStopGyroMagRevise 79 | VPADStopMotor 80 | VPADWriteTPCalibrationValueToEEPROM 81 | -------------------------------------------------------------------------------- /include/coreinit/condition.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "threadqueue.h" 4 | 5 | /** 6 | * \defgroup coreinit_cond Condition Variable 7 | * \ingroup coreinit 8 | * 9 | * Standard condition variable implementation. 10 | * 11 | * Similar to std::condition_variable. 12 | * @{ 13 | */ 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | typedef struct OSCondition OSCondition; 20 | typedef struct OSMutex OSMutex; 21 | 22 | #define OS_CONDITION_TAG 0x634E6456u 23 | 24 | struct OSCondition 25 | { 26 | //! Should always be set to the value OS_CONDITION_TAG. 27 | uint32_t tag; 28 | 29 | //! Name set by OSInitCondEx. 30 | const char *name; 31 | 32 | WUT_UNKNOWN_BYTES(4); 33 | 34 | //! Queue of threads currently waiting on condition with OSWaitCond. 35 | OSThreadQueue queue; 36 | }; 37 | WUT_CHECK_OFFSET(OSCondition, 0x00, tag); 38 | WUT_CHECK_OFFSET(OSCondition, 0x04, name); 39 | WUT_CHECK_OFFSET(OSCondition, 0x0c, queue); 40 | WUT_CHECK_SIZE(OSCondition, 0x1c); 41 | 42 | 43 | /** 44 | * Initialise a condition variable structure. 45 | */ 46 | void 47 | OSInitCond(OSCondition *condition); 48 | 49 | 50 | /** 51 | * Initialise a condition variable structure with a name. 52 | */ 53 | void 54 | OSInitCondEx(OSCondition *condition, 55 | const char *name); 56 | 57 | 58 | /** 59 | * Sleep the current thread until the condition variable has been signalled. 60 | * 61 | * The mutex must be locked when entering this function. 62 | * Will unlock the mutex and then sleep, reacquiring the mutex when woken. 63 | * 64 | * Similar to std::condition_variable::wait. 65 | */ 66 | void 67 | OSWaitCond(OSCondition *condition, 68 | OSMutex *mutex); 69 | 70 | 71 | /** 72 | * Will wake up any threads waiting on the condition with OSWaitCond. 73 | * 74 | * Similar to std::condition_variable::notify_all. 75 | */ 76 | void 77 | OSSignalCond(OSCondition *condition); 78 | 79 | 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | 84 | /** @} */ 85 | -------------------------------------------------------------------------------- /cafe/nn_save.def: -------------------------------------------------------------------------------- 1 | :NAME nn_save 2 | 3 | :TEXT 4 | SAVEChangeDir 5 | SAVEChangeDirAsync 6 | SAVEChangeGroupAndOthersMode 7 | SAVEChangeGroupAndOthersModeAsync 8 | SAVEChangeGroupMode 9 | SAVEChangeGroupModeAsync 10 | SAVECheckSaveDirRequiredUpdate 11 | SAVEFlushQuota 12 | SAVEFlushQuotaAsync 13 | SAVEGetFreeSpaceSize 14 | SAVEGetFreeSpaceSizeAsync 15 | SAVEGetFreeSpaceSizeOfDevice 16 | SAVEGetNoDeleteGroupSaveDirPath 17 | SAVEGetNoDeleteSaveDataPath 18 | SAVEGetSharedDataTitlePath 19 | SAVEGetSharedSaveDataPath 20 | SAVEGetStat 21 | SAVEGetStatAsync 22 | SAVEGetStatOtherApplication 23 | SAVEGetStatOtherApplicationAsync 24 | SAVEGetStatOtherDemoApplication 25 | SAVEGetStatOtherDemoApplicationAsync 26 | SAVEGetStatOtherDemoApplicationVariation 27 | SAVEGetStatOtherDemoApplicationVariationAsync 28 | SAVEGetStatOtherNormalApplication 29 | SAVEGetStatOtherNormalApplicationAsync 30 | SAVEGetStatOtherNormalApplicationVariation 31 | SAVEGetStatOtherNormalApplicationVariationAsync 32 | SAVEInit 33 | SAVEInitAccountSaveDir 34 | SAVEInitCommonSaveDir 35 | SAVEInitNoDeleteGroupSaveDir 36 | SAVEInitSaveDir 37 | SAVEInitSaveDirByAppMeta 38 | SAVEMakeDir 39 | SAVEMakeDirAsync 40 | SAVEOpenDir 41 | SAVEOpenDirAsync 42 | SAVEOpenDirOtherApplication 43 | SAVEOpenDirOtherApplicationAsync 44 | SAVEOpenDirOtherDemoApplication 45 | SAVEOpenDirOtherDemoApplicationAsync 46 | SAVEOpenDirOtherDemoApplicationVariation 47 | SAVEOpenDirOtherDemoApplicationVariationAsync 48 | SAVEOpenDirOtherNormalApplication 49 | SAVEOpenDirOtherNormalApplicationAsync 50 | SAVEOpenDirOtherNormalApplicationVariation 51 | SAVEOpenDirOtherNormalApplicationVariationAsync 52 | SAVEOpenFile 53 | SAVEOpenFileAsync 54 | SAVEOpenFileOtherApplication 55 | SAVEOpenFileOtherApplicationAsync 56 | SAVEOpenFileOtherDemoApplication 57 | SAVEOpenFileOtherDemoApplicationAsync 58 | SAVEOpenFileOtherDemoApplicationVariation 59 | SAVEOpenFileOtherDemoApplicationVariationAsync 60 | SAVEOpenFileOtherNormalApplication 61 | SAVEOpenFileOtherNormalApplicationAsync 62 | SAVEOpenFileOtherNormalApplicationVariation 63 | SAVEOpenFileOtherNormalApplicationVariationAsync 64 | SAVERemove 65 | SAVERemoveAsync 66 | SAVERename 67 | SAVERenameAsync 68 | SAVERollbackQuota 69 | SAVERollbackQuotaAsync 70 | SAVEShutdown 71 | SAVEUpdateSaveDir 72 | -------------------------------------------------------------------------------- /cafe/nn_dlp.def: -------------------------------------------------------------------------------- 1 | :NAME nn_dlp 2 | 3 | :TEXT 4 | AcceptClient__Q4_2nn3dlp4Cafe6ServerSFUs 5 | AcceptClient__Q5_2nn3dlp4Cafe6detail9ServerIpcSFUs 6 | CloseSessions__Q4_2nn3dlp4Cafe6ServerSFv 7 | CloseSessions__Q5_2nn3dlp4Cafe6detail9ServerIpcSFv 8 | DisconnectClient__Q4_2nn3dlp4Cafe6ServerSFUs 9 | DisconnectClient__Q5_2nn3dlp4Cafe6detail9ServerIpcSFUs 10 | FinalizeServerIpc__Q4_2nn3dlp4Cafe6detailFv 11 | Finalize__Q4_2nn3dlp4Cafe6ServerSFv 12 | Finalize__Q5_2nn3dlp4Cafe6detail9ServerIpcSFv 13 | GetClientInfo__Q4_2nn3dlp4Cafe6ServerSFPQ4_2nn3uds4Cafe15NodeInformationUs 14 | GetClientInfo__Q5_2nn3dlp4Cafe6detail9ServerIpcSFPQ4_2nn3uds4Cafe15NodeInformationUs 15 | GetClientState__Q4_2nn3dlp4Cafe6ServerSFPQ4_2nn3dlp4Cafe11ClientStatePUiT2Us 16 | GetClientState__Q4_2nn3dlp4Cafe6ServerSFPQ4_2nn3dlp4Cafe11ClientStateUs 17 | GetClientStatus__Q5_2nn3dlp4Cafe6detail9ServerIpcSFPQ4_2nn3dlp4Cafe12ClientStatusUs 18 | GetConnectingClients__Q4_2nn3dlp4Cafe6ServerSFPUsT1Us 19 | GetConnectingClients__Q5_2nn3dlp4Cafe6detail9ServerIpcSFPUsT1Us 20 | GetDupNoticeNeed__Q5_2nn3dlp4Cafe6detail9ServerIpcSFPb 21 | GetInternalState__Q4_2nn3dlp4Cafe13ServerPrivateSFPQ4_2nn3dlp4Cafe11ServerState 22 | GetState__Q4_2nn3dlp4Cafe6ServerSFPQ4_2nn3dlp4Cafe11ServerState 23 | GetState__Q5_2nn3dlp4Cafe6detail9ServerIpcSFPQ4_2nn3dlp4Cafe11ServerState 24 | InitializePrivate__Q5_2nn3dlp4Cafe6detail9ServerIpcSFUcUiT1N22RCQ4_2nn3cfg3CTR8UserNameULb 25 | InitializeServerIpc__Q4_2nn3dlp4Cafe6detailFv 26 | Initialize__Q4_2nn3dlp4Cafe13ServerPrivateSFPbUcUiT2N23PQ4_2nn3cfg3CTR8UserName 27 | Initialize__Q4_2nn3dlp4Cafe13ServerPrivateSFUcUiT1N22PQ4_2nn3cfg3CTR8UserName 28 | Initialize__Q4_2nn3dlp4Cafe6ServerSFPbUcUiT2PQ4_2nn3cfg3CTR8UserName 29 | Initialize__Q4_2nn3dlp4Cafe6ServerSFUcUiT1PQ4_2nn3cfg3CTR8UserName 30 | Initialize__Q5_2nn3dlp4Cafe6detail9ServerIpcSFUcUiT1RCQ4_2nn3cfg3CTR8UserNameULb 31 | OpenSessions__Q4_2nn3dlp4Cafe6ServerSFbUc 32 | OpenSessions__Q5_2nn3dlp4Cafe6detail9ServerIpcSFbUc 33 | PollStateChange__Q4_2nn3dlp4Cafe6ServerSFUc 34 | PollStateChange__Q5_2nn3dlp4Cafe6detail9ServerIpcSFv 35 | RebootAllClients__Q4_2nn3dlp4Cafe6ServerSFPCc 36 | RebootAllClients__Q5_2nn3dlp4Cafe6detail9ServerIpcSFPCc 37 | StartDistribute__Q4_2nn3dlp4Cafe6ServerSFv 38 | StartDistribute__Q5_2nn3dlp4Cafe6detail9ServerIpcSFv 39 | --------------------------------------------------------------------------------