From f45c8e8505f88169eed56e6ed06cda5ef5097a72 Mon Sep 17 00:00:00 2001 From: GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com> Date: Thu, 3 Oct 2024 21:35:22 +0200 Subject: [PATCH] Run clang-format `find . -regex '.*\.\(cpp\|hpp\|cu\|cuh\|c\|h\)' -exec clang-format -style=file -i {} \;` --- include/avm/drc.h | 14 +- include/avm/tv.h | 24 +- include/camera/camera.h | 62 +- include/coreinit/alarm.h | 2 +- include/coreinit/bsp.h | 70 +- include/coreinit/cache.h | 2 +- include/coreinit/codegen.h | 8 +- include/coreinit/context.h | 7 +- include/coreinit/cosreport.h | 32 +- include/coreinit/debug.h | 3 +- include/coreinit/dynload.h | 134 +-- include/coreinit/event.h | 4 +- include/coreinit/exception.h | 40 +- include/coreinit/fiber.h | 3 +- include/coreinit/filesystem.h | 512 +++++----- include/coreinit/filesystem_fsa.h | 658 ++++++------ include/coreinit/im.h | 38 +- include/coreinit/internal.h | 2 +- include/coreinit/interrupts.h | 4 +- include/coreinit/ios.h | 92 +- include/coreinit/ipcbufpool.h | 89 +- include/coreinit/kernel.h | 182 ++-- include/coreinit/launch.h | 2 +- include/coreinit/mcp.h | 107 +- include/coreinit/memallocator.h | 16 +- include/coreinit/memexpheap.h | 15 +- include/coreinit/memfrmheap.h | 6 +- include/coreinit/memheap.h | 24 +- include/coreinit/memory.h | 10 +- include/coreinit/memorymap.h | 10 +- include/coreinit/messagequeue.h | 28 +- include/coreinit/performancemonitor.h | 246 ++--- include/coreinit/savedframe.h | 8 +- include/coreinit/scheduler.h | 12 +- include/coreinit/screen.h | 4 +- include/coreinit/smd.h | 160 +-- include/coreinit/taskqueue.h | 20 +- include/coreinit/thread.h | 75 +- include/coreinit/time.h | 18 +- include/coreinit/title.h | 3 +- include/coreinit/transition.h | 5 +- include/coreinit/userconfig.h | 128 +-- include/erreula/rpl_interface.h | 70 +- include/gx2/debug.h | 14 +- include/gx2/enum.h | 820 +++++++-------- include/gx2/shaders.h | 13 +- include/gx2/surface.h | 9 +- include/gx2/utils.h | 26 +- include/gx2r/mem.h | 2 +- include/gx2r/resource.h | 50 +- include/h264/stream.h | 20 +- include/mic/mic.h | 32 +- include/netdb.h | 28 +- include/netinet/in.h | 10 +- include/netinet/tcp.h | 12 +- include/nfc/nfc.h | 151 ++- include/nn/ac/ac_cpp.h | 11 +- include/nn/acp.h | 4 +- include/nn/acp/device.h | 17 +- include/nn/acp/drcled_c.h | 2 +- include/nn/acp/drcled_cpp.h | 16 +- include/nn/acp/result.h | 167 ++-- include/nn/acp/save.h | 17 +- include/nn/acp/title.h | 241 ++--- include/nn/act/client_cpp.h | 48 +- include/nn/ccr/sys.h | 22 +- include/nn/ccr/sys_caffeine.h | 8 +- include/nn/cfg/CTR.h | 12 +- include/nn/cmpt/cmpt.h | 17 +- include/nn/dlp/Cafe.h | 600 +++++------ include/nn/erreula/erreula_cpp.h | 50 +- include/nn/ffl/miidata.h | 19 +- include/nn/fp/fp_cpp.h | 348 +++---- include/nn/hpad/hpad.h | 34 +- include/nn/idb.h | 2 +- include/nn/nfp.h | 2 +- include/nn/nfp/amiibo_settings_cpp.h | 12 +- include/nn/nfp/nfp_cpp.h | 66 +- include/nn/pdm/pdm_cpp.h | 62 +- include/nn/result.h | 305 +++--- include/nn/save/save.h | 8 +- include/nn/sl/CacheManager.h | 194 ++-- include/nn/sl/Condition.h | 230 +++-- include/nn/sl/DataCreator.h | 175 ++-- include/nn/sl/DrcManager.h | 182 ++-- include/nn/sl/FileStream.h | 125 ++- include/nn/sl/IAccountInfoAccessor.h | 85 +- include/nn/sl/IBlackListAccessor.h | 109 +- include/nn/sl/IDefaultTitleAccessor.h | 85 +- include/nn/sl/IDiscCachedTitleAccessor.h | 85 +- include/nn/sl/IIconInfoAccessor.h | 115 ++- include/nn/sl/IInstalledTitleListAccessor.h | 85 +- include/nn/sl/IKillerNotificationAccessor.h | 85 +- include/nn/sl/ILaunchedTitleListAccessor.h | 97 +- include/nn/sl/IMetaInfoAccessor.h | 109 +- include/nn/sl/IPreferentialTitleAccessor.h | 85 +- include/nn/sl/ISerializer.h | 171 ++-- include/nn/sl/ISettingAccessor.h | 85 +- include/nn/sl/IStream.h | 136 +-- include/nn/sl/ITimeAccessor.h | 95 +- include/nn/sl/ITitleIconCache.h | 143 +-- include/nn/sl/ITitleListAccessor.h | 109 +- include/nn/sl/ITransferrer.h | 125 ++- include/nn/sl/IUpdatePackageAccessor.h | 115 ++- include/nn/sl/IWhiteListAccessor.h | 109 +- include/nn/sl/KillerNotification.h | 420 ++++---- include/nn/sl/KillerNotificationSelector.h | 317 +++--- .../KillerNotificationTransferRecordManager.h | 421 ++++---- .../KillerNotificationTransferRecordStream.h | 113 ++- include/nn/sl/LaunchInfoDatabase.h | 328 +++--- include/nn/sl/QuickStartApplicationSelector.h | 249 ++--- include/nn/sl/TitleIconCache.h | 205 ++-- include/nn/sl/TitleListCache.h | 630 ++++++------ .../sl/details/IAccountInfoAccessorDetails.h | 116 ++- .../nn/sl/details/IBlackListAccessorDetails.h | 116 ++- .../sl/details/IDefaultTitleAccessorDetails.h | 112 ++- .../details/IDiscCachedTitleAccessorDetails.h | 112 ++- .../nn/sl/details/IIconInfoAccessorDetails.h | 167 ++-- .../IInstalledTitleListAccessorDetails.h | 112 ++- .../IKillerNotificationAccessorDetails.h | 136 +-- ...NotificationTransferRecordManagerDetails.h | 383 +++---- .../ILaunchedTitleListAccessoDetails.h | 140 +-- .../nn/sl/details/IMetaInfoAccessorDetails.h | 112 ++- .../IPreferentialTitleAccessorDetails.h | 112 ++- include/nn/sl/details/ISerializerDetails.h | 226 +++-- .../nn/sl/details/ISettingAccessorDetails.h | 158 +-- include/nn/sl/details/IStreamDetails.h | 136 +-- include/nn/sl/details/ITimeAccessorDetails.h | 173 ++-- .../nn/sl/details/ITitleIconCacheDetails.h | 223 +++-- .../nn/sl/details/ITitleListAccessorDetails.h | 112 ++- include/nn/sl/details/ITransferrerDetails.h | 232 +++-- .../details/IUpdatePackageAccessorDetails.h | 166 +-- .../nn/sl/details/IWhiteListAccessorDetails.h | 112 ++- include/nn/sl/sl_cpp.h | 542 +++++----- include/nn/spm/storage.h | 39 +- include/nn/swkbd/swkbd_cpp.h | 102 +- include/nn/temp/temp.h | 8 +- include/nn/uds/Cafe.h | 943 +++++++++--------- include/nn/uds/NodeInformation.h | 46 +- include/nn/uds/ScrambledLocalFriendCode.h | 40 +- include/nsysccr/cdc.h | 72 +- include/nsysccr/irda.h | 48 +- include/nsyshid/hid.h | 22 +- include/nsyskbd/nsyskbd.h | 76 +- include/nsysnet/_socket.h | 14 +- include/nsysnet/netconfig.h | 246 +++-- include/nsysnet/nssl.h | 372 +++---- include/nsysnet/socket.h | 19 +- include/nsysuhs/uhs.h | 270 ++--- include/nsysuhs/uhs_usbspec.h | 82 +- include/ntag/ntag.h | 45 +- include/padscore/kpad.h | 28 +- include/padscore/wbc.h | 2 +- include/padscore/wpad.h | 74 +- include/poll.h | 13 +- include/sndcore2/core.h | 42 +- include/sndcore2/device.h | 10 +- include/sndcore2/result.h | 10 +- include/sndcore2/voice.h | 40 +- include/swkbd/rpl_interface.h | 111 ++- include/sys/filio.h | 31 +- include/sys/ioccom.h | 42 +- include/sys/socket.h | 85 +- include/sysapp/args.h | 26 +- include/sysapp/launch.h | 103 +- include/sysapp/switch.h | 36 +- include/sysapp/title.h | 24 +- include/tve/cec.h | 34 +- include/vpad/input.h | 86 +- include/vpadbase/base.h | 8 +- include/wut.h | 2 +- include/wut_structsize.h | 26 +- include/wut_types.h | 69 +- libraries/libgfd/include/gfd.h | 16 +- libraries/libgfd/src/gfd.c | 166 +-- libraries/libirc/include/irc/irc.h | 29 +- libraries/libirc/src/cdc.c | 214 ++-- libraries/libirc/src/irc.c | 27 +- libraries/libwhb/include/whb/file.h | 2 +- libraries/libwhb/include/whb/libmanager.h | 4 +- libraries/libwhb/src/console.c | 12 +- libraries/libwhb/src/crash.c | 42 +- libraries/libwhb/src/file.c | 14 +- libraries/libwhb/src/gfx.c | 148 ++- libraries/libwhb/src/gfx_heap.c | 6 +- libraries/libwhb/src/gfx_shader.c | 90 +- libraries/libwhb/src/gfx_texture.c | 8 +- libraries/libwhb/src/log.c | 18 +- libraries/libwhb/src/log_cafe.c | 7 +- libraries/libwhb/src/log_module.c | 12 +- libraries/libwhb/src/log_udp.c | 16 +- libraries/libwhb/src/proc.c | 10 +- libraries/libwhb/src/sdcard.c | 10 +- libraries/nn_erreula/nn_erreula.cpp | 146 +-- libraries/nn_idb/include/nn/idb/IDBReader.h | 98 +- libraries/nn_idb/include/nn/idb/idb_cpp.h | 98 +- libraries/nn_idb/src/IDBReader.cpp | 280 +++--- libraries/nn_sl/IAccountInfoAccessor.cpp | 21 +- libraries/nn_sl/IBlackListAccessor.cpp | 21 +- libraries/nn_sl/IDefaultTitleAccessor.cpp | 21 +- libraries/nn_sl/IDiscCachedTitleAccessor.cpp | 21 +- libraries/nn_sl/IIconInfoAccessor.cpp | 21 +- .../nn_sl/IInstalledTitleListAccessor.cpp | 21 +- .../nn_sl/IKillerNotificationAccessor.cpp | 21 +- .../nn_sl/ILaunchedTitleListAccessor.cpp | 48 +- libraries/nn_sl/IMetaInfoAccessor.cpp | 21 +- .../nn_sl/IPreferentialTitleAccessor.cpp | 21 +- libraries/nn_sl/ISerializer.cpp | 73 +- libraries/nn_sl/ISettingAccessor.cpp | 21 +- libraries/nn_sl/ITimeAccessor.cpp | 21 +- libraries/nn_sl/ITitleIconCache.cpp | 21 +- libraries/nn_sl/ITitleListAccessor.cpp | 21 +- libraries/nn_sl/ITransferrer.cpp | 21 +- libraries/nn_sl/IUpdatePackageAccessor.cpp | 21 +- libraries/nn_sl/IWhiteListAccessor.cpp | 21 +- ...illerNotificationTransferRecordManager.cpp | 21 +- ...KillerNotificationTransferRecordStream.cpp | 21 +- libraries/nn_sl/TitleListCache.cpp | 21 +- libraries/nn_swkbd/nn_swkbd.cpp | 222 ++--- libraries/wutcrt/wut_crt.c | 24 +- libraries/wutcrt/wut_preinit.c | 15 +- libraries/wutdefaultheap/wut_defaultheap.c | 10 +- libraries/wutdevoptab/MutexWrapper.h | 31 +- libraries/wutdevoptab/devoptab_fsa.cpp | 25 +- libraries/wutdevoptab/devoptab_fsa.h | 182 ++-- libraries/wutdevoptab/devoptab_fsa_chdir.cpp | 9 +- libraries/wutdevoptab/devoptab_fsa_chmod.cpp | 9 +- libraries/wutdevoptab/devoptab_fsa_close.cpp | 9 +- .../wutdevoptab/devoptab_fsa_dirclose.cpp | 9 +- .../wutdevoptab/devoptab_fsa_dirnext.cpp | 13 +- .../wutdevoptab/devoptab_fsa_diropen.cpp | 13 +- .../wutdevoptab/devoptab_fsa_dirreset.cpp | 9 +- libraries/wutdevoptab/devoptab_fsa_fstat.cpp | 9 +- libraries/wutdevoptab/devoptab_fsa_fsync.cpp | 9 +- libraries/wutdevoptab/devoptab_fsa_mkdir.cpp | 7 +- libraries/wutdevoptab/devoptab_fsa_open.cpp | 34 +- libraries/wutdevoptab/devoptab_fsa_read.cpp | 22 +- libraries/wutdevoptab/devoptab_fsa_rename.cpp | 7 +- libraries/wutdevoptab/devoptab_fsa_rmdir.cpp | 7 +- libraries/wutdevoptab/devoptab_fsa_seek.cpp | 25 +- libraries/wutdevoptab/devoptab_fsa_stat.cpp | 7 +- .../wutdevoptab/devoptab_fsa_statvfs.cpp | 19 +- .../wutdevoptab/devoptab_fsa_truncate.cpp | 9 +- libraries/wutdevoptab/devoptab_fsa_unlink.cpp | 7 +- libraries/wutdevoptab/devoptab_fsa_utils.cpp | 56 +- libraries/wutdevoptab/devoptab_fsa_write.cpp | 22 +- libraries/wutmalloc/wut_malloc.c | 9 +- libraries/wutnewlib/wut_clock.c | 8 +- libraries/wutnewlib/wut_clock.h | 18 +- libraries/wutnewlib/wut_gettod_r.c | 4 +- libraries/wutnewlib/wut_lock.c | 6 +- libraries/wutnewlib/wut_nanosleep.c | 4 +- libraries/wutnewlib/wut_newlib.c | 148 ++- libraries/wutnewlib/wut_newlib.h | 51 +- libraries/wutnewlib/wut_reent.c | 4 +- libraries/wutnewlib/wut_sbrk.c | 18 +- libraries/wutnewlib/wut_thread_specific.c | 11 +- libraries/wutnewlib/wut_thread_specific.h | 13 +- libraries/wutsocket/NSSLCreateConnection.c | 2 + libraries/wutsocket/accept.c | 7 +- libraries/wutsocket/addrinfo.c | 4 +- libraries/wutsocket/bind.c | 1 - libraries/wutsocket/connect.c | 8 +- libraries/wutsocket/fcntl.c | 6 +- libraries/wutsocket/getpeername.c | 1 - libraries/wutsocket/getsockname.c | 1 - libraries/wutsocket/getsockopt.c | 1 - libraries/wutsocket/host.c | 4 +- libraries/wutsocket/hostid.c | 2 +- libraries/wutsocket/ioctl.c | 10 +- libraries/wutsocket/listen.c | 1 - libraries/wutsocket/recv.c | 1 - libraries/wutsocket/recvfrom.c | 1 - libraries/wutsocket/select.c | 2 +- libraries/wutsocket/send.c | 3 +- libraries/wutsocket/sendto.c | 1 - libraries/wutsocket/setsockopt.c | 1 - libraries/wutsocket/shutdown.c | 1 - libraries/wutsocket/sockatmark.c | 5 +- libraries/wutsocket/socket.c | 1 - libraries/wutsocket/stubs.c | 12 +- libraries/wutsocket/wut_socket.h | 27 +- libraries/wutsocket/wut_socket_close.c | 3 +- libraries/wutsocket/wut_socket_common.c | 12 +- libraries/wutsocket/wut_socket_open.c | 1 - libraries/wutsocket/wut_socket_read.c | 3 +- libraries/wutsocket/wut_socket_write.c | 3 +- libraries/wutstdc++/wut_gthread.cpp | 187 ++-- libraries/wutstdc++/wut_gthread.h | 27 +- libraries/wutstdc++/wut_gthread_cond.cpp | 13 +- libraries/wutstdc++/wut_gthread_keys.cpp | 15 +- libraries/wutstdc++/wut_gthread_once.cpp | 2 +- libraries/wutstdc++/wut_gthread_thread.cpp | 8 +- samples/cmake/custom_default_heap/main.c | 22 +- samples/cmake/erreula/main.cpp | 27 +- samples/cmake/gx2_triangle/main.c | 67 +- samples/cmake/helloworld/main.c | 6 +- samples/cmake/helloworld_cpp/main.cpp | 12 +- samples/cmake/my_first_rpl/my_first_rpl.h | 3 +- samples/cmake/my_first_rpl/my_first_rpx.c | 4 +- samples/cmake/swkbd/main.cpp | 13 +- samples/make/helloworld/source/main.c | 6 +- samples/make/helloworld_cpp/source/main.cpp | 12 +- tests/test_compile_headers_as_c11/main.c | 3 +- tests/test_compile_headers_as_c99/main.c | 3 +- tests/test_compile_headers_as_cpp/main.cpp | 3 +- .../test_compile_headers_list.h | 54 +- 307 files changed, 12149 insertions(+), 10457 deletions(-) diff --git a/include/avm/drc.h b/include/avm/drc.h index 954d5d165..573297d25 100644 --- a/include/avm/drc.h +++ b/include/avm/drc.h @@ -13,24 +13,24 @@ extern "C" { typedef enum AVMDrcScanMode { - AVM_DRC_SCAN_MODE_UNKNOWN_0 = 0, - AVM_DRC_SCAN_MODE_UNKNOWN_1 = 1, - AVM_DRC_SCAN_MODE_UNKNOWN_3 = 3, + AVM_DRC_SCAN_MODE_UNKNOWN_0 = 0, + AVM_DRC_SCAN_MODE_UNKNOWN_1 = 1, + AVM_DRC_SCAN_MODE_UNKNOWN_3 = 3, AVM_DRC_SCAN_MODE_UNKNOWN_255 = 255, } AVMDrcScanMode; typedef enum AVMDrcMode { - AVM_DRC_MODE_NONE = 0, + AVM_DRC_MODE_NONE = 0, AVM_DRC_MODE_SINGLE = 1, AVM_DRC_MODE_DOUBLE = 2, } AVMDrcMode; typedef enum AVMDrcSystemAudioMode { - AVM_DRC_SYSTEM_AUDIO_MODE_UNKNOWN_0 = 0, // mono? - AVM_DRC_SYSTEM_AUDIO_MODE_UNKNOWN_1 = 1, // stereo? - AVM_DRC_SYSTEM_AUDIO_MODE_SURROUND = 2, + AVM_DRC_SYSTEM_AUDIO_MODE_UNKNOWN_0 = 0, // mono? + AVM_DRC_SYSTEM_AUDIO_MODE_UNKNOWN_1 = 1, // stereo? + AVM_DRC_SYSTEM_AUDIO_MODE_SURROUND = 2, } AVMDrcSystemAudioMode; /** diff --git a/include/avm/tv.h b/include/avm/tv.h index 60981c409..ac2b7d0a3 100644 --- a/include/avm/tv.h +++ b/include/avm/tv.h @@ -22,18 +22,18 @@ typedef enum AVMTvAspectRatio typedef enum AVMTvResolution { - AVM_TV_RESOLUTION_576I = 1, - AVM_TV_RESOLUTION_480I = 2, - AVM_TV_RESOLUTION_480P = 3, - AVM_TV_RESOLUTION_720P = 4, - AVM_TV_RESOLUTION_720P_3D = 5, - AVM_TV_RESOLUTION_1080I = 6, - AVM_TV_RESOLUTION_1080P = 7, - AVM_TV_RESOLUTION_480I_PAL60 = 10, - AVM_TV_RESOLUTION_576P = 11, - AVM_TV_RESOLUTION_720P_50HZ = 12, - AVM_TV_RESOLUTION_1080I_50HZ = 13, - AVM_TV_RESOLUTION_1080P_50HZ = 14, + AVM_TV_RESOLUTION_576I = 1, + AVM_TV_RESOLUTION_480I = 2, + AVM_TV_RESOLUTION_480P = 3, + AVM_TV_RESOLUTION_720P = 4, + AVM_TV_RESOLUTION_720P_3D = 5, + AVM_TV_RESOLUTION_1080I = 6, + AVM_TV_RESOLUTION_1080P = 7, + AVM_TV_RESOLUTION_480I_PAL60 = 10, + AVM_TV_RESOLUTION_576P = 11, + AVM_TV_RESOLUTION_720P_50HZ = 12, + AVM_TV_RESOLUTION_1080I_50HZ = 13, + AVM_TV_RESOLUTION_1080P_50HZ = 14, } AVMTvResolution; typedef enum AVMTvVideoRegion diff --git a/include/camera/camera.h b/include/camera/camera.h index 55c457ec0..a7c351421 100644 --- a/include/camera/camera.h +++ b/include/camera/camera.h @@ -12,13 +12,13 @@ extern "C" { #endif -#define CAMERA_WIDTH 640 -#define CAMERA_PITCH 768 -#define CAMERA_HEIGHT 480 +#define CAMERA_WIDTH 640 +#define CAMERA_PITCH 768 +#define CAMERA_HEIGHT 480 -#define CAMERA_Y_BUFFER_SIZE (CAMERA_PITCH * CAMERA_HEIGHT) -#define CAMERA_UV_BUFFER_SIZE (CAMERA_PITCH * CAMERA_HEIGHT / 2) -#define CAMERA_YUV_BUFFER_SIZE (CAMERA_Y_BUFFER_SIZE + CAMERA_UV_BUFFER_SIZE) +#define CAMERA_Y_BUFFER_SIZE (CAMERA_PITCH * CAMERA_HEIGHT) +#define CAMERA_UV_BUFFER_SIZE (CAMERA_PITCH * CAMERA_HEIGHT / 2) +#define CAMERA_YUV_BUFFER_SIZE (CAMERA_Y_BUFFER_SIZE + CAMERA_UV_BUFFER_SIZE) #define CAMERA_YUV_BUFFER_ALIGNMENT 256 @@ -34,35 +34,35 @@ typedef struct CAMSurface CAMSurface; typedef enum CamError { - CAMERA_ERROR_OK = 0, - CAMERA_ERROR_INVALID_ARG = -1, - CAMERA_ERROR_INVALID_HANDLE = -2, - CAMERA_ERROR_TOO_MANY_SURFACES = -4, - CAMERA_ERROR_INSUFFICIENT_MEMORY = -5, - CAMERA_ERROR_NOT_READY = -6, - CAMERA_ERROR_UNINITIALIZED = -8, - CAMERA_ERROR_UVC = -9, - CAMERA_ERROR_UVD_CONTEXT = -10, - CAMERA_ERROR_DEVICE_IN_USE = -12, - CAMERA_ERROR_UVD_SESSION = -13, - CAMERA_ERROR_SEGMENT_VIOLATION = -15 + CAMERA_ERROR_OK = 0, + CAMERA_ERROR_INVALID_ARG = -1, + CAMERA_ERROR_INVALID_HANDLE = -2, + CAMERA_ERROR_TOO_MANY_SURFACES = -4, + CAMERA_ERROR_INSUFFICIENT_MEMORY = -5, + CAMERA_ERROR_NOT_READY = -6, + CAMERA_ERROR_UNINITIALIZED = -8, + CAMERA_ERROR_UVC = -9, + CAMERA_ERROR_UVD_CONTEXT = -10, + CAMERA_ERROR_DEVICE_IN_USE = -12, + CAMERA_ERROR_UVD_SESSION = -13, + CAMERA_ERROR_SEGMENT_VIOLATION = -15 } CamError; typedef enum CamFps { - CAMERA_FPS_15 = 0, - CAMERA_FPS_30 = 1 + CAMERA_FPS_15 = 0, + CAMERA_FPS_30 = 1 } CamFps; typedef enum CamStreamType { - CAMERA_STREAM_TYPE_1 = 0 + CAMERA_STREAM_TYPE_1 = 0 } CamStreamType; typedef enum CamEventType { - CAMERA_DECODE_DONE = 0, - CAMERA_DRC_DETACH = 1 + CAMERA_DECODE_DONE = 0, + CAMERA_DRC_DETACH = 1 } CamEventType; struct CAMEventData @@ -74,7 +74,7 @@ struct CAMEventData struct { //! Pointer to the buffer of the decoded image - void* surfaceBuffer; + void *surfaceBuffer; //! Handle of instance CAMHandle handle; //! TRUE if decode failed @@ -100,7 +100,7 @@ WUT_CHECK_OFFSET(CAMEventData, 0x08, detach.handle); WUT_CHECK_OFFSET(CAMEventData, 0x04, args); WUT_CHECK_SIZE(CAMEventData, 0x10); -typedef void(*CAMEventHandler)(CAMEventData *camEventData); +typedef void (*CAMEventHandler)(CAMEventData *camEventData); struct CAMMode { @@ -192,26 +192,26 @@ WUT_CHECK_SIZE(CAMSurface, 0x20); * Initialize the camera * \returns camera handle on success, and -1 on failure */ -CAMHandle +CAMHandle CAMInit(int instance, CAMSetupInfo *setupInfo, CAMError *err); /** * Deinitialize and clean up */ -void +void CAMExit(CAMHandle handle); /** * Start recording and decoding frames */ -CAMError +CAMError CAMOpen(CAMHandle handle); /** * Stops recording and decoding. * Automatically called when the process is moved to background */ -CAMError +CAMError CAMClose(CAMHandle handle); /** @@ -228,13 +228,13 @@ CAMGetMemReq(CAMStreamInfo *streamInfo); * Up to 20 surfaces may be queued. * Surface data is returned in the NV12 format */ -CAMError +CAMError CAMSubmitTargetSurface(CAMHandle handle, CAMSurface *surface); /** * Checks whether memory is segmented correctly to be used with the camera library */ -CAMError +CAMError CAMCheckMemSegmentation(void *pMem, uint32_t size); #ifdef __cplusplus diff --git a/include/coreinit/alarm.h b/include/coreinit/alarm.h index 74349ec06..520824d28 100644 --- a/include/coreinit/alarm.h +++ b/include/coreinit/alarm.h @@ -1,8 +1,8 @@ #pragma once #include +#include "context.h" #include "threadqueue.h" #include "time.h" -#include "context.h" /** * \defgroup coreinit_alarms Alarms diff --git a/include/coreinit/bsp.h b/include/coreinit/bsp.h index 6193dc08e..3f926f53b 100644 --- a/include/coreinit/bsp.h +++ b/include/coreinit/bsp.h @@ -18,45 +18,45 @@ typedef uint32_t BSPConsoleTypeRaw; typedef enum BSPErrors { - BSP_ERROR_OK = 0, - BSP_ERROR_IOS_ERROR = 0x40, - BSP_ERROR_RESPONSE_TOO_LARGE = 0x80, + BSP_ERROR_OK = 0, + BSP_ERROR_IOS_ERROR = 0x40, + BSP_ERROR_RESPONSE_TOO_LARGE = 0x80, } BSPErrors; typedef enum BSPHardwareVersions { - BSP_HARDWARE_VERSION_UNKNOWN = 0x00000000, - - // vWii Hardware Versions - BSP_HARDWARE_VERSION_HOLLYWOOD_ENG_SAMPLE_1 = 0x00000001, - BSP_HARDWARE_VERSION_HOLLYWOOD_ENG_SAMPLE_2 = 0x10000001, - BSP_HARDWARE_VERSION_HOLLYWOOD_PROD_FOR_WII = 0x10100001, - BSP_HARDWARE_VERSION_HOLLYWOOD_CORTADO = 0x10100008, - BSP_HARDWARE_VERSION_HOLLYWOOD_CORTADO_ESPRESSO = 0x1010000C, - BSP_HARDWARE_VERSION_BOLLYWOOD = 0x20000001, - BSP_HARDWARE_VERSION_BOLLYWOOD_PROD_FOR_WII = 0x20100001, - - // WiiU Hardware Versions - BSP_HARDWARE_VERSION_LATTE_A11_EV = 0x21100010, - BSP_HARDWARE_VERSION_LATTE_A11_CAT = 0x21100020, - BSP_HARDWARE_VERSION_LATTE_A12_EV = 0x21200010, - BSP_HARDWARE_VERSION_LATTE_A12_CAT = 0x21200020, - BSP_HARDWARE_VERSION_LATTE_A2X_EV = 0x22100010, - BSP_HARDWARE_VERSION_LATTE_A2X_CAT = 0x22100020, - BSP_HARDWARE_VERSION_LATTE_A3X_EV = 0x23100010, - BSP_HARDWARE_VERSION_LATTE_A3X_CAT = 0x23100020, - BSP_HARDWARE_VERSION_LATTE_A3X_CAFE = 0x23100028, - BSP_HARDWARE_VERSION_LATTE_A4X_EV = 0x24100010, - BSP_HARDWARE_VERSION_LATTE_A4X_CAT = 0x24100020, - BSP_HARDWARE_VERSION_LATTE_A4X_CAFE = 0x24100028, - BSP_HARDWARE_VERSION_LATTE_A5X_EV = 0x25100010, - BSP_HARDWARE_VERSION_LATTE_A5X_EV_Y = 0x25100011, - BSP_HARDWARE_VERSION_LATTE_A5X_CAT = 0x25100020, - BSP_HARDWARE_VERSION_LATTE_A5X_CAFE = 0x25100028, - BSP_HARDWARE_VERSION_LATTE_B1X_EV = 0x26100010, - BSP_HARDWARE_VERSION_LATTE_B1X_EV_Y = 0x26100011, - BSP_HARDWARE_VERSION_LATTE_B1X_CAT = 0x26100020, - BSP_HARDWARE_VERSION_LATTE_B1X_CAFE = 0x26100028 + BSP_HARDWARE_VERSION_UNKNOWN = 0x00000000, + + // vWii Hardware Versions + BSP_HARDWARE_VERSION_HOLLYWOOD_ENG_SAMPLE_1 = 0x00000001, + BSP_HARDWARE_VERSION_HOLLYWOOD_ENG_SAMPLE_2 = 0x10000001, + BSP_HARDWARE_VERSION_HOLLYWOOD_PROD_FOR_WII = 0x10100001, + BSP_HARDWARE_VERSION_HOLLYWOOD_CORTADO = 0x10100008, + BSP_HARDWARE_VERSION_HOLLYWOOD_CORTADO_ESPRESSO = 0x1010000C, + BSP_HARDWARE_VERSION_BOLLYWOOD = 0x20000001, + BSP_HARDWARE_VERSION_BOLLYWOOD_PROD_FOR_WII = 0x20100001, + + // WiiU Hardware Versions + BSP_HARDWARE_VERSION_LATTE_A11_EV = 0x21100010, + BSP_HARDWARE_VERSION_LATTE_A11_CAT = 0x21100020, + BSP_HARDWARE_VERSION_LATTE_A12_EV = 0x21200010, + BSP_HARDWARE_VERSION_LATTE_A12_CAT = 0x21200020, + BSP_HARDWARE_VERSION_LATTE_A2X_EV = 0x22100010, + BSP_HARDWARE_VERSION_LATTE_A2X_CAT = 0x22100020, + BSP_HARDWARE_VERSION_LATTE_A3X_EV = 0x23100010, + BSP_HARDWARE_VERSION_LATTE_A3X_CAT = 0x23100020, + BSP_HARDWARE_VERSION_LATTE_A3X_CAFE = 0x23100028, + BSP_HARDWARE_VERSION_LATTE_A4X_EV = 0x24100010, + BSP_HARDWARE_VERSION_LATTE_A4X_CAT = 0x24100020, + BSP_HARDWARE_VERSION_LATTE_A4X_CAFE = 0x24100028, + BSP_HARDWARE_VERSION_LATTE_A5X_EV = 0x25100010, + BSP_HARDWARE_VERSION_LATTE_A5X_EV_Y = 0x25100011, + BSP_HARDWARE_VERSION_LATTE_A5X_CAT = 0x25100020, + BSP_HARDWARE_VERSION_LATTE_A5X_CAFE = 0x25100028, + BSP_HARDWARE_VERSION_LATTE_B1X_EV = 0x26100010, + BSP_HARDWARE_VERSION_LATTE_B1X_EV_Y = 0x26100011, + BSP_HARDWARE_VERSION_LATTE_B1X_CAT = 0x26100020, + BSP_HARDWARE_VERSION_LATTE_B1X_CAFE = 0x26100028 } BSPHardwareVersions; BSPError diff --git a/include/coreinit/cache.h b/include/coreinit/cache.h index ee96b8b94..b6b09d98f 100644 --- a/include/coreinit/cache.h +++ b/include/coreinit/cache.h @@ -191,7 +191,7 @@ DCTouchRange(void *addr, void ICInvalidateRange(void *addr, uint32_t size); - + void OSMemoryBarrier(); diff --git a/include/coreinit/codegen.h b/include/coreinit/codegen.h index e2c1ab907..54e5f6852 100644 --- a/include/coreinit/codegen.h +++ b/include/coreinit/codegen.h @@ -33,10 +33,10 @@ extern "C" { //! The memory permissions for the codegen area. typedef enum OSCodegenSecMode { - //! The area can be read or written to, but not executed. - CODEGEN_RW_ = 0, - //! The area can be read or executed, but not written to. - CODEGEN_R_X = 1, + //! The area can be read or written to, but not executed. + CODEGEN_RW_ = 0, + //! The area can be read or executed, but not written to. + CODEGEN_R_X = 1, } OSCodegenSecMode; /** diff --git a/include/coreinit/context.h b/include/coreinit/context.h index 3ab2c4763..288005afa 100644 --- a/include/coreinit/context.h +++ b/include/coreinit/context.h @@ -15,9 +15,10 @@ extern "C" { //! A bitfield of enum OS_CONTEXT_STATE. typedef uint16_t OSContextState; -enum OS_CONTEXT_STATE { - OS_CONTEXT_STATE_OSCALLBACK = 1 << 3, - OS_CONTEXT_STATE_USERMODE_SAVED = 1 << 4 +enum OS_CONTEXT_STATE +{ + OS_CONTEXT_STATE_OSCALLBACK = 1 << 3, + OS_CONTEXT_STATE_USERMODE_SAVED = 1 << 4 }; typedef struct OSContext OSContext; diff --git a/include/coreinit/cosreport.h b/include/coreinit/cosreport.h index b9547697b..59d265e61 100644 --- a/include/coreinit/cosreport.h +++ b/include/coreinit/cosreport.h @@ -12,44 +12,46 @@ extern "C" { #endif -typedef enum COSReportLevel{ - COS_REPORT_LEVEL_ERROR = 0, - COS_REPORT_LEVEL_WARN = 1, - COS_REPORT_LEVEL_INFO = 2, - COS_REPORT_LEVEL_VERBOSE = 3, +typedef enum COSReportLevel +{ + COS_REPORT_LEVEL_ERROR = 0, + COS_REPORT_LEVEL_WARN = 1, + COS_REPORT_LEVEL_INFO = 2, + COS_REPORT_LEVEL_VERBOSE = 3, } COSReportLevel; -typedef enum COSReportModule{ - COS_REPORT_MODULE_UNKNOWN_0 = 0, - COS_REPORT_MODULE_UNKNOWN_1 = 1, - COS_REPORT_MODULE_UNKNOWN_2 = 2, - COS_REPORT_MODULE_UNKNOWN_5 = 5, +typedef enum COSReportModule +{ + COS_REPORT_MODULE_UNKNOWN_0 = 0, + COS_REPORT_MODULE_UNKNOWN_1 = 1, + COS_REPORT_MODULE_UNKNOWN_2 = 2, + COS_REPORT_MODULE_UNKNOWN_5 = 5, } COSReportModule; void COSVReport(COSReportModule module, COSReportLevel level, - const char* fmt, + const char *fmt, ...); void COSError(COSReportModule module, - const char* fmt, + const char *fmt, ...); void COSInfo(COSReportModule module, - const char* fmt, + const char *fmt, ...); void COSVerbose(COSReportModule module, - const char* fmt, + const char *fmt, ...); void COSWarn(COSReportModule module, - const char* fmt, + const char *fmt, ...); #ifdef __cplusplus diff --git a/include/coreinit/debug.h b/include/coreinit/debug.h index 7a10b9063..747742a9d 100644 --- a/include/coreinit/debug.h +++ b/include/coreinit/debug.h @@ -48,7 +48,8 @@ OSReportWarn(const char *fmt, ...); void OSPanic(const char *file, uint32_t line, - const char *fmt, ...); + const char *fmt, + ...); void diff --git a/include/coreinit/dynload.h b/include/coreinit/dynload.h index 760e06e6d..e82e34378 100644 --- a/include/coreinit/dynload.h +++ b/include/coreinit/dynload.h @@ -23,31 +23,32 @@ typedef struct OSDynLoad_InternalData OSDynLoad_InternalData; typedef enum OSDynLoad_Error { - OS_DYNLOAD_OK = 0, - OS_DYNLOAD_OUT_OF_MEMORY = 0xBAD10002, - OS_DYNLOAD_INVALID_NOTIFY_PTR = 0xBAD1000E, - OS_DYNLOAD_INVALID_MODULE_NAME_PTR = 0xBAD1000F, - OS_DYNLOAD_INVALID_MODULE_NAME = 0xBAD10010, - OS_DYNLOAD_INVALID_ACQUIRE_PTR = 0xBAD10011, - OS_DYNLOAD_EMPTY_MODULE_NAME = 0xBAD10012, - OS_DYNLOAD_INVALID_ALLOCATOR_PTR = 0xBAD10017, - OS_DYNLOAD_OUT_OF_SYSTEM_MEMORY = 0xBAD1002F, - OS_DYNLOAD_TLS_ALLOCATOR_LOCKED = 0xBAD10031, - OS_DYNLOAD_MODULE_NOT_FOUND = 0xFFFFFFFA, + OS_DYNLOAD_OK = 0, + OS_DYNLOAD_OUT_OF_MEMORY = 0xBAD10002, + OS_DYNLOAD_INVALID_NOTIFY_PTR = 0xBAD1000E, + OS_DYNLOAD_INVALID_MODULE_NAME_PTR = 0xBAD1000F, + OS_DYNLOAD_INVALID_MODULE_NAME = 0xBAD10010, + OS_DYNLOAD_INVALID_ACQUIRE_PTR = 0xBAD10011, + OS_DYNLOAD_EMPTY_MODULE_NAME = 0xBAD10012, + OS_DYNLOAD_INVALID_ALLOCATOR_PTR = 0xBAD10017, + OS_DYNLOAD_OUT_OF_SYSTEM_MEMORY = 0xBAD1002F, + OS_DYNLOAD_TLS_ALLOCATOR_LOCKED = 0xBAD10031, + OS_DYNLOAD_MODULE_NOT_FOUND = 0xFFFFFFFA, } OSDynLoad_Error; typedef OSDynLoad_Error (*OSDynLoadAllocFn)(int32_t size, int32_t align, void **outAddr); typedef void (*OSDynLoadFreeFn)(void *addr); -typedef enum OSDynLoad_ExportType { - OS_DYNLOAD_EXPORT_FUNC = 0, - OS_DYNLOAD_EXPORT_DATA = 1, +typedef enum OSDynLoad_ExportType +{ + OS_DYNLOAD_EXPORT_FUNC = 0, + OS_DYNLOAD_EXPORT_DATA = 1, } OSDynLoad_ExportType; typedef enum OSDynLoad_EntryReason { - OS_DYNLOAD_LOADED = 1, - OS_DYNLOAD_UNLOADED = 2, + OS_DYNLOAD_LOADED = 1, + OS_DYNLOAD_UNLOADED = 2, } OSDynLoad_EntryReason; struct OSDynLoad_NotifyData @@ -97,18 +98,18 @@ WUT_CHECK_SIZE(OSDynLoad_LoaderHeapStatistics, 0x18); struct OSDynLoad_LoaderUserFileInfo { - uint32_t size; - uint32_t magic; - uint32_t pathStringLength; - char *pathString; - uint32_t fileInfoFlags; - int16_t tlsModuleIndex; - int16_t tlsAlignShift; - void *tlsAddressStart; - uint32_t tlsSectionSize; - uint32_t shstrndx; - uint32_t titleLocation; - WUT_UNKNOWN_BYTES(0x60 - 0x28); + uint32_t size; + uint32_t magic; + uint32_t pathStringLength; + char *pathString; + uint32_t fileInfoFlags; + int16_t tlsModuleIndex; + int16_t tlsAlignShift; + void *tlsAddressStart; + uint32_t tlsSectionSize; + uint32_t shstrndx; + uint32_t titleLocation; + WUT_UNKNOWN_BYTES(0x60 - 0x28); }; WUT_CHECK_OFFSET(OSDynLoad_LoaderUserFileInfo, 0x00, size); WUT_CHECK_OFFSET(OSDynLoad_LoaderUserFileInfo, 0x04, magic); @@ -126,17 +127,18 @@ WUT_CHECK_SIZE(OSDynLoad_LoaderUserFileInfo, 0x60); struct OSDynLoad_LoaderSectionInfo { - uint32_t type; - uint32_t flags; - void *address; - - union { - //! Size of the section, set when type != SHT_RPL_IMPORTS - uint32_t size; - - //! Name offset of the section, set when type == SHT_RPL_IMPORTS - uint32_t name; - }; + uint32_t type; + uint32_t flags; + void *address; + + union + { + //! Size of the section, set when type != SHT_RPL_IMPORTS + uint32_t size; + + //! Name offset of the section, set when type == SHT_RPL_IMPORTS + uint32_t name; + }; }; WUT_CHECK_OFFSET(OSDynLoad_LoaderSectionInfo, 0x00, type); WUT_CHECK_OFFSET(OSDynLoad_LoaderSectionInfo, 0x04, flags); @@ -148,29 +150,29 @@ WUT_CHECK_SIZE(OSDynLoad_LoaderSectionInfo, 0x10); struct OSDynLoad_InternalData { - uint32_t handle; - void *loaderHandle; - char *moduleName; - uint32_t moduleNameLen; - uint32_t sectionInfoCount; - OSDynLoad_LoaderSectionInfo *sectionInfo; - OSDynLoad_InternalData **importModules; - uint32_t importModuleCount; - uint32_t userFileInfoSize; - OSDynLoad_LoaderUserFileInfo *userFileInfo; - OSDynLoad_NotifyData *notifyData; - void *entryPoint; - uint32_t dataSectionSize; - void *dataSection; - uint32_t loadSectionSize; - void *loadSection; - OSDynLoadFreeFn dynLoadFreeFn; - void *codeExports; - uint32_t numCodeExports; - void *dataExports; - uint32_t numDataExports; - OSDynLoad_InternalData *next; - WUT_UNKNOWN_BYTES(0x94 - 0x58); + uint32_t handle; + void *loaderHandle; + char *moduleName; + uint32_t moduleNameLen; + uint32_t sectionInfoCount; + OSDynLoad_LoaderSectionInfo *sectionInfo; + OSDynLoad_InternalData **importModules; + uint32_t importModuleCount; + uint32_t userFileInfoSize; + OSDynLoad_LoaderUserFileInfo *userFileInfo; + OSDynLoad_NotifyData *notifyData; + void *entryPoint; + uint32_t dataSectionSize; + void *dataSection; + uint32_t loadSectionSize; + void *loadSection; + OSDynLoadFreeFn dynLoadFreeFn; + void *codeExports; + uint32_t numCodeExports; + void *dataExports; + uint32_t numDataExports; + OSDynLoad_InternalData *next; + WUT_UNKNOWN_BYTES(0x94 - 0x58); }; WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x00, handle); WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x04, loaderHandle); @@ -198,8 +200,8 @@ WUT_CHECK_SIZE(OSDynLoad_InternalData, 0x94); typedef enum OSDynLoad_NotifyReason { - OS_DYNLOAD_NOTIFY_UNLOADED = 0, - OS_DYNLOAD_NOTIFY_LOADED = 1 + OS_DYNLOAD_NOTIFY_UNLOADED = 0, + OS_DYNLOAD_NOTIFY_LOADED = 1 } OSDynLoad_NotifyReason; typedef void (*OSDynLoadNotifyFunc)(OSDynLoad_Module module, @@ -328,14 +330,14 @@ OSDynLoad_IsModuleLoaded(char const *name, * Registers a callback that's called whenever a new .rpl is loaded or unloaded **/ OSDynLoad_Error -OSDynLoad_AddNotifyCallback(OSDynLoadNotifyFunc notifyFn, +OSDynLoad_AddNotifyCallback(OSDynLoadNotifyFunc notifyFn, void *userContext); /** * Removes a previously added a callback **/ OSDynLoad_Error -OSDynLoad_DelNotifyCallback(OSDynLoadNotifyFunc notifyFn, +OSDynLoad_DelNotifyCallback(OSDynLoadNotifyFunc notifyFn, void *userContext); /** diff --git a/include/coreinit/event.h b/include/coreinit/event.h index 7d94397f1..98a46d03e 100644 --- a/include/coreinit/event.h +++ b/include/coreinit/event.h @@ -22,10 +22,10 @@ typedef struct OSEvent OSEvent; typedef enum OSEventMode { //! A manual event will only reset when OSResetEvent is called. - OS_EVENT_MODE_MANUAL = 0, + OS_EVENT_MODE_MANUAL = 0, //! An auto event will reset everytime a thread is woken. - OS_EVENT_MODE_AUTO = 1, + OS_EVENT_MODE_AUTO = 1, } OSEventMode; #define OS_EVENT_TAG 0x65566E54u diff --git a/include/coreinit/exception.h b/include/coreinit/exception.h index 6d17e69b8..60ba71bb8 100644 --- a/include/coreinit/exception.h +++ b/include/coreinit/exception.h @@ -16,30 +16,30 @@ typedef BOOL (*OSExceptionCallbackFn)(OSContext *context); typedef enum OSExceptionMode { - OS_EXCEPTION_MODE_SYSTEM = 0, - OS_EXCEPTION_MODE_THREAD = 1, - OS_EXCEPTION_MODE_GLOBAL = 2, - OS_EXCEPTION_MODE_THREAD_ALL_CORES = 3, - OS_EXCEPTION_MODE_GLOBAL_ALL_CORES = 4, + OS_EXCEPTION_MODE_SYSTEM = 0, + OS_EXCEPTION_MODE_THREAD = 1, + OS_EXCEPTION_MODE_GLOBAL = 2, + OS_EXCEPTION_MODE_THREAD_ALL_CORES = 3, + OS_EXCEPTION_MODE_GLOBAL_ALL_CORES = 4, } OSExceptionMode; typedef enum OSExceptionType { - OS_EXCEPTION_TYPE_SYSTEM_RESET = 0, - OS_EXCEPTION_TYPE_MACHINE_CHECK = 1, - OS_EXCEPTION_TYPE_DSI = 2, - OS_EXCEPTION_TYPE_ISI = 3, - OS_EXCEPTION_TYPE_EXTERNAL_INTERRUPT = 4, - OS_EXCEPTION_TYPE_ALIGNMENT = 5, - OS_EXCEPTION_TYPE_PROGRAM = 6, - OS_EXCEPTION_TYPE_FLOATING_POINT = 7, - OS_EXCEPTION_TYPE_DECREMENTER = 8, - OS_EXCEPTION_TYPE_SYSTEM_CALL = 9, - OS_EXCEPTION_TYPE_TRACE = 10, - OS_EXCEPTION_TYPE_PERFORMANCE_MONITOR = 11, - OS_EXCEPTION_TYPE_BREAKPOINT = 12, - OS_EXCEPTION_TYPE_SYSTEM_INTERRUPT = 13, - OS_EXCEPTION_TYPE_ICI = 14, + OS_EXCEPTION_TYPE_SYSTEM_RESET = 0, + OS_EXCEPTION_TYPE_MACHINE_CHECK = 1, + OS_EXCEPTION_TYPE_DSI = 2, + OS_EXCEPTION_TYPE_ISI = 3, + OS_EXCEPTION_TYPE_EXTERNAL_INTERRUPT = 4, + OS_EXCEPTION_TYPE_ALIGNMENT = 5, + OS_EXCEPTION_TYPE_PROGRAM = 6, + OS_EXCEPTION_TYPE_FLOATING_POINT = 7, + OS_EXCEPTION_TYPE_DECREMENTER = 8, + OS_EXCEPTION_TYPE_SYSTEM_CALL = 9, + OS_EXCEPTION_TYPE_TRACE = 10, + OS_EXCEPTION_TYPE_PERFORMANCE_MONITOR = 11, + OS_EXCEPTION_TYPE_BREAKPOINT = 12, + OS_EXCEPTION_TYPE_SYSTEM_INTERRUPT = 13, + OS_EXCEPTION_TYPE_ICI = 14, } OSExceptionType; OSExceptionCallbackFn diff --git a/include/coreinit/fiber.h b/include/coreinit/fiber.h index 1c5b1e1e4..dae860384 100644 --- a/include/coreinit/fiber.h +++ b/include/coreinit/fiber.h @@ -13,8 +13,7 @@ extern "C" { #endif typedef void (*OSFiberEntryFn)(); -typedef void (*OSFiberExEntryFn)(uint32_t arg1, uint32_t arg2, - uint32_t arg3, uint32_t arg4); +typedef void (*OSFiberExEntryFn)(uint32_t arg1, uint32_t arg2, uint32_t arg3, uint32_t arg4); int32_t OSSwitchFiber(OSFiberEntryFn entry, diff --git a/include/coreinit/filesystem.h b/include/coreinit/filesystem.h index 3dd8b7528..3c3409911 100644 --- a/include/coreinit/filesystem.h +++ b/include/coreinit/filesystem.h @@ -1,10 +1,10 @@ #pragma once #include +#include +#include +#include #include #include -#include -#include -#include /** * \defgroup coreinit_fs Filesystem @@ -25,7 +25,7 @@ extern "C" { #endif -#define FS_MAX_PATH (0x27F) +#define FS_MAX_PATH (0x27F) #define FS_MODE_LENGTH (0x10) typedef uint32_t FSDirectoryHandle; @@ -52,100 +52,100 @@ typedef struct FSVolumeInfo FSVolumeInfo; typedef enum FSErrorFlag { - FS_ERROR_FLAG_NONE = 0x0, - FS_ERROR_FLAG_MAX = 0x1, - FS_ERROR_FLAG_ALREADY_OPEN = 0x2, - FS_ERROR_FLAG_EXISTS = 0x4, - FS_ERROR_FLAG_NOT_FOUND = 0x8, - FS_ERROR_FLAG_NOT_FILE = 0x10, - FS_ERROR_FLAG_NOT_DIR = 0x20, - FS_ERROR_FLAG_ACCESS_ERROR = 0x40, - FS_ERROR_FLAG_PERMISSION_ERROR = 0x80, - FS_ERROR_FLAG_FILE_TOO_BIG = 0x100, - FS_ERROR_FLAG_STORAGE_FULL = 0x200, - FS_ERROR_FLAG_UNSUPPORTED_CMD = 0x400, - FS_ERROR_FLAG_JOURNAL_FULL = 0x800, - FS_ERROR_FLAG_ALL = 0xFFFFFFFF, + FS_ERROR_FLAG_NONE = 0x0, + FS_ERROR_FLAG_MAX = 0x1, + FS_ERROR_FLAG_ALREADY_OPEN = 0x2, + FS_ERROR_FLAG_EXISTS = 0x4, + FS_ERROR_FLAG_NOT_FOUND = 0x8, + FS_ERROR_FLAG_NOT_FILE = 0x10, + FS_ERROR_FLAG_NOT_DIR = 0x20, + FS_ERROR_FLAG_ACCESS_ERROR = 0x40, + FS_ERROR_FLAG_PERMISSION_ERROR = 0x80, + FS_ERROR_FLAG_FILE_TOO_BIG = 0x100, + FS_ERROR_FLAG_STORAGE_FULL = 0x200, + FS_ERROR_FLAG_UNSUPPORTED_CMD = 0x400, + FS_ERROR_FLAG_JOURNAL_FULL = 0x800, + FS_ERROR_FLAG_ALL = 0xFFFFFFFF, } FSErrorFlag; typedef enum FSStatus { - FS_STATUS_OK = 0, - FS_STATUS_CANCELLED = -1, - FS_STATUS_END = -2, - FS_STATUS_MAX = -3, - FS_STATUS_ALREADY_OPEN = -4, - FS_STATUS_EXISTS = -5, - FS_STATUS_NOT_FOUND = -6, - FS_STATUS_NOT_FILE = -7, - FS_STATUS_NOT_DIR = -8, - FS_STATUS_ACCESS_ERROR = -9, - FS_STATUS_PERMISSION_ERROR = -10, - FS_STATUS_FILE_TOO_BIG = -11, - FS_STATUS_STORAGE_FULL = -12, - FS_STATUS_JOURNAL_FULL = -13, - FS_STATUS_UNSUPPORTED_CMD = -14, - FS_STATUS_MEDIA_NOT_READY = -15, - FS_STATUS_MEDIA_ERROR = -17, - FS_STATUS_CORRUPTED = -18, - FS_STATUS_FATAL_ERROR = -0x400, + FS_STATUS_OK = 0, + FS_STATUS_CANCELLED = -1, + FS_STATUS_END = -2, + FS_STATUS_MAX = -3, + FS_STATUS_ALREADY_OPEN = -4, + FS_STATUS_EXISTS = -5, + FS_STATUS_NOT_FOUND = -6, + FS_STATUS_NOT_FILE = -7, + FS_STATUS_NOT_DIR = -8, + FS_STATUS_ACCESS_ERROR = -9, + FS_STATUS_PERMISSION_ERROR = -10, + FS_STATUS_FILE_TOO_BIG = -11, + FS_STATUS_STORAGE_FULL = -12, + FS_STATUS_JOURNAL_FULL = -13, + FS_STATUS_UNSUPPORTED_CMD = -14, + FS_STATUS_MEDIA_NOT_READY = -15, + FS_STATUS_MEDIA_ERROR = -17, + FS_STATUS_CORRUPTED = -18, + FS_STATUS_FATAL_ERROR = -0x400, } FSStatus; typedef enum FSError { - FS_ERROR_OK = 0, - FS_ERROR_NOT_INIT = -0x30001, - FS_ERROR_BUSY = -0x30002, - FS_ERROR_CANCELLED = -0x30003, - FS_ERROR_END_OF_DIR = -0x30004, - FS_ERROR_END_OF_FILE = -0x30005, - FS_ERROR_MAX_MOUNT_POINTS = -0x30010, - FS_ERROR_MAX_VOLUMES = -0x30011, - FS_ERROR_MAX_CLIENTS = -0x30012, - FS_ERROR_MAX_FILES = -0x30013, - FS_ERROR_MAX_DIRS = -0x30014, - FS_ERROR_ALREADY_OPEN = -0x30015, - FS_ERROR_ALREADY_EXISTS = -0x30016, - FS_ERROR_NOT_FOUND = -0x30017, - FS_ERROR_NOT_EMPTY = -0x30018, - FS_ERROR_ACCESS_ERROR = -0x30019, - FS_ERROR_PERMISSION_ERROR = -0x3001A, - FS_ERROR_DATA_CORRUPTED = -0x3001B, - FS_ERROR_STORAGE_FULL = -0x3001C, - FS_ERROR_JOURNAL_FULL = -0x3001D, - FS_ERROR_UNAVAILABLE_COMMAND = -0x3001F, - FS_ERROR_UNSUPPORTED_COMMAND = -0x30020, - FS_ERROR_INVALID_PARAM = -0x30021, - FS_ERROR_INVALID_PATH = -0x30022, - FS_ERROR_INVALID_BUFFER = -0x30023, - FS_ERROR_INVALID_ALIGNMENT = -0x30024, - FS_ERROR_INVALID_CLIENTHANDLE = -0x30025, - FS_ERROR_INVALID_FILEHANDLE = -0x30026, - FS_ERROR_INVALID_DIRHANDLE = -0x30027, - FS_ERROR_NOT_FILE = -0x30028, - FS_ERROR_NOT_DIR = -0x30029, - FS_ERROR_FILE_TOO_BIG = -0x3002A, - FS_ERROR_OUT_OF_RANGE = -0x3002B, - FS_ERROR_OUT_OF_RESOURCES = -0x3002C, - FS_ERROR_MEDIA_NOT_READY = -0x30040, - FS_ERROR_MEDIA_ERROR = -0x30041, - FS_ERROR_WRITE_PROTECTED = -0x30042, - FS_ERROR_INVALID_MEDIA = -0x30043, + FS_ERROR_OK = 0, + FS_ERROR_NOT_INIT = -0x30001, + FS_ERROR_BUSY = -0x30002, + FS_ERROR_CANCELLED = -0x30003, + FS_ERROR_END_OF_DIR = -0x30004, + FS_ERROR_END_OF_FILE = -0x30005, + FS_ERROR_MAX_MOUNT_POINTS = -0x30010, + FS_ERROR_MAX_VOLUMES = -0x30011, + FS_ERROR_MAX_CLIENTS = -0x30012, + FS_ERROR_MAX_FILES = -0x30013, + FS_ERROR_MAX_DIRS = -0x30014, + FS_ERROR_ALREADY_OPEN = -0x30015, + FS_ERROR_ALREADY_EXISTS = -0x30016, + FS_ERROR_NOT_FOUND = -0x30017, + FS_ERROR_NOT_EMPTY = -0x30018, + FS_ERROR_ACCESS_ERROR = -0x30019, + FS_ERROR_PERMISSION_ERROR = -0x3001A, + FS_ERROR_DATA_CORRUPTED = -0x3001B, + FS_ERROR_STORAGE_FULL = -0x3001C, + FS_ERROR_JOURNAL_FULL = -0x3001D, + FS_ERROR_UNAVAILABLE_COMMAND = -0x3001F, + FS_ERROR_UNSUPPORTED_COMMAND = -0x30020, + FS_ERROR_INVALID_PARAM = -0x30021, + FS_ERROR_INVALID_PATH = -0x30022, + FS_ERROR_INVALID_BUFFER = -0x30023, + FS_ERROR_INVALID_ALIGNMENT = -0x30024, + FS_ERROR_INVALID_CLIENTHANDLE = -0x30025, + FS_ERROR_INVALID_FILEHANDLE = -0x30026, + FS_ERROR_INVALID_DIRHANDLE = -0x30027, + FS_ERROR_NOT_FILE = -0x30028, + FS_ERROR_NOT_DIR = -0x30029, + FS_ERROR_FILE_TOO_BIG = -0x3002A, + FS_ERROR_OUT_OF_RANGE = -0x3002B, + FS_ERROR_OUT_OF_RESOURCES = -0x3002C, + FS_ERROR_MEDIA_NOT_READY = -0x30040, + FS_ERROR_MEDIA_ERROR = -0x30041, + FS_ERROR_WRITE_PROTECTED = -0x30042, + FS_ERROR_INVALID_MEDIA = -0x30043, } FSError; typedef enum FSMode { - FS_MODE_READ_OWNER = 0x400, - FS_MODE_WRITE_OWNER = 0x200, - FS_MODE_EXEC_OWNER = 0x100, + FS_MODE_READ_OWNER = 0x400, + FS_MODE_WRITE_OWNER = 0x200, + FS_MODE_EXEC_OWNER = 0x100, - FS_MODE_READ_GROUP = 0x040, - FS_MODE_WRITE_GROUP = 0x020, - FS_MODE_EXEC_GROUP = 0x010, + FS_MODE_READ_GROUP = 0x040, + FS_MODE_WRITE_GROUP = 0x020, + FS_MODE_EXEC_GROUP = 0x010, - FS_MODE_READ_OTHER = 0x004, - FS_MODE_WRITE_OTHER = 0x002, - FS_MODE_EXEC_OTHER = 0x001, + FS_MODE_READ_OTHER = 0x004, + FS_MODE_WRITE_OTHER = 0x002, + FS_MODE_EXEC_OTHER = 0x001, } FSMode; //! Flags for \link FSStat \endlink. @@ -153,81 +153,83 @@ typedef enum FSMode typedef enum FSStatFlags { //! The retrieved file entry is a (link to a) directory. - FS_STAT_DIRECTORY = 0x80000000, + FS_STAT_DIRECTORY = 0x80000000, //! The retrieved file entry also has a quota set. - FS_STAT_QUOTA = 0x60000000, + FS_STAT_QUOTA = 0x60000000, //! The retrieved file entry is a (link to a) file. - FS_STAT_FILE = 0x01000000, + FS_STAT_FILE = 0x01000000, //! The retrieved file entry also is encrypted and can't be opened (see vWii files for example). - FS_STAT_ENCRYPTED_FILE = 0x00800000, + FS_STAT_ENCRYPTED_FILE = 0x00800000, //! The retrieved file entry also is a link to a different file on the filesystem. //! Note: It's currently not known how one can read the linked-to file entry. - FS_STAT_LINK = 0x00010000, + FS_STAT_LINK = 0x00010000, } FSStatFlags; typedef enum FSVolumeState { - FS_VOLUME_STATE_INITIAL = 0, - FS_VOLUME_STATE_READY = 1, - FS_VOLUME_STATE_NO_MEDIA = 2, - FS_VOLUME_STATE_INVALID_MEDIA = 3, - FS_VOLUME_STATE_DIRTY_MEDIA = 4, - FS_VOLUME_STATE_WRONG_MEDIA = 5, - FS_VOLUME_STATE_MEDIA_ERROR = 6, - FS_VOLUME_STATE_DATA_CORRUPTED = 7, - FS_VOLUME_STATE_WRITE_PROTECTED = 8, - FS_VOLUME_STATE_JOURNAL_FULL = 9, - FS_VOLUME_STATE_FATAL = 10, - FS_VOLUME_STATE_INVALID = 11, + FS_VOLUME_STATE_INITIAL = 0, + FS_VOLUME_STATE_READY = 1, + FS_VOLUME_STATE_NO_MEDIA = 2, + FS_VOLUME_STATE_INVALID_MEDIA = 3, + FS_VOLUME_STATE_DIRTY_MEDIA = 4, + FS_VOLUME_STATE_WRONG_MEDIA = 5, + FS_VOLUME_STATE_MEDIA_ERROR = 6, + FS_VOLUME_STATE_DATA_CORRUPTED = 7, + FS_VOLUME_STATE_WRITE_PROTECTED = 8, + FS_VOLUME_STATE_JOURNAL_FULL = 9, + FS_VOLUME_STATE_FATAL = 10, + FS_VOLUME_STATE_INVALID = 11, } FSVolumeState; -typedef enum FSMediaState { - FS_MEDIA_STATE_READY = 0, - FS_MEDIA_STATE_NO_MEDIA = 1, - FS_MEDIA_STATE_INVALID_MEDIA = 2, - FS_MEDIA_STATE_DIRTY_MEDIA = 3, - FS_MEDIA_STATE_MEDIA_ERROR = 4, +typedef enum FSMediaState +{ + FS_MEDIA_STATE_READY = 0, + FS_MEDIA_STATE_NO_MEDIA = 1, + FS_MEDIA_STATE_INVALID_MEDIA = 2, + FS_MEDIA_STATE_DIRTY_MEDIA = 3, + FS_MEDIA_STATE_MEDIA_ERROR = 4, } FSMediaState; -typedef enum FSMountSourceType { - FS_MOUNT_SOURCE_SD = 0, - FS_MOUNT_SOURCE_UNK = 1, +typedef enum FSMountSourceType +{ + FS_MOUNT_SOURCE_SD = 0, + FS_MOUNT_SOURCE_UNK = 1, } FSMountSourceType; typedef enum FSOpenFileFlags { //! Open file normally - FS_OPEN_FLAG_NONE = (0 << 0), + FS_OPEN_FLAG_NONE = (0 << 0), //! Open (new) unencrypted file. Used for vWii files since it allows for direct access without the Wii U filesystem through it's block address. - FS_OPEN_FLAG_UNENCRYPTED = (1 << 0), + FS_OPEN_FLAG_UNENCRYPTED = (1 << 0), //! Preallocates new file size using given size FS_OPEN_FLAG_PREALLOC_SIZE = (1 << 1) } FSOpenFileFlags; -typedef void(*FSAsyncCallback)(FSClient *, FSCmdBlock *, FSStatus, uint32_t); -typedef void(*FSStateChangeCallback)(FSClient *, FSVolumeState, void *); +typedef void (*FSAsyncCallback)(FSClient *, FSCmdBlock *, FSStatus, uint32_t); +typedef void (*FSStateChangeCallback)(FSClient *, FSVolumeState, void *); struct FSFsm { - WUT_UNKNOWN_BYTES(0x38); + WUT_UNKNOWN_BYTES(0x38); }; WUT_CHECK_SIZE(FSFsm, 0x38); struct FSCmdQueue { - WUT_UNKNOWN_BYTES(0x44); + WUT_UNKNOWN_BYTES(0x44); }; WUT_CHECK_SIZE(FSCmdQueue, 0x44); struct FSMessage { - //! Message data - void *data; + //! Message data + void *data; - WUT_UNKNOWN_BYTES(8); + WUT_UNKNOWN_BYTES(8); - //! Type of message - OSFunctionType type; + //! Type of message + OSFunctionType type; }; WUT_CHECK_OFFSET(FSMessage, 0x00, data); WUT_CHECK_OFFSET(FSMessage, 0x0C, type); @@ -238,8 +240,8 @@ WUT_CHECK_SIZE(FSMessage, 0x10); */ struct FSClientBodyLink { - FSClientBody* next; - FSClientBody* prev; + FSClientBody *next; + FSClientBody *prev; }; WUT_CHECK_OFFSET(FSClientBodyLink, 0x00, next); WUT_CHECK_OFFSET(FSClientBodyLink, 0x04, prev); @@ -247,52 +249,52 @@ WUT_CHECK_SIZE(FSClientBodyLink, 0x8); struct FSClientBody { - WUT_UNKNOWN_BYTES(0x1444); + WUT_UNKNOWN_BYTES(0x1444); - //! IOSHandle returned from fsaShimOpen. - IOSHandle clientHandle; + //! IOSHandle returned from fsaShimOpen. + IOSHandle clientHandle; - //! State machine. - FSFsm fsm; + //! State machine. + FSFsm fsm; - //! Command queue of FS commands. - FSCmdQueue cmdQueue; + //! Command queue of FS commands. + FSCmdQueue cmdQueue; - //! The last dequeued command. - FSCmdBlockBody* lastDequeuedCommand; + //! The last dequeued command. + FSCmdBlockBody *lastDequeuedCommand; - //! Emulated error, set with FSSetEmulatedError. - FSError emulatedError; + //! Emulated error, set with FSSetEmulatedError. + FSError emulatedError; - WUT_UNKNOWN_BYTES(0x1560 - 0x14CC); + WUT_UNKNOWN_BYTES(0x1560 - 0x14CC); - //! Mutex used to protect FSClientBody data. - OSFastMutex mutex; + //! Mutex used to protect FSClientBody data. + OSFastMutex mutex; - WUT_UNKNOWN_BYTES(4); + WUT_UNKNOWN_BYTES(4); - //! Alarm used by fsm for unknown reasons. - OSAlarm fsmAlarm; + //! Alarm used by fsm for unknown reasons. + OSAlarm fsmAlarm; - //! Error of last FS command. - FSError lastError; + //! Error of last FS command. + FSError lastError; - bool isLastErrorWithoutVolume; + bool isLastErrorWithoutVolume; - //! Message used to send FsCmdHandler message when FSA async callback is received. - FSMessage fsCmdHandlerMsg; + //! Message used to send FsCmdHandler message when FSA async callback is received. + FSMessage fsCmdHandlerMsg; - //! Device name of the last mount source returned by FSGetMountSourceNext. - char lastMountSourceDevice[0x10]; + //! Device name of the last mount source returned by FSGetMountSourceNext. + char lastMountSourceDevice[0x10]; - //! Mount source type to find with FSGetMountSourceNext. - FSMountSourceType findMountSourceType; + //! Mount source type to find with FSGetMountSourceNext. + FSMountSourceType findMountSourceType; - //! Link used for linked list of clients. - FSClientBodyLink link; + //! Link used for linked list of clients. + FSClientBodyLink link; - //! Pointer to unaligned FSClient structure. - FSClient* client; + //! Pointer to unaligned FSClient structure. + FSClient *client; }; WUT_CHECK_OFFSET(FSClientBody, 0x1444, clientHandle); WUT_CHECK_OFFSET(FSClientBody, 0x1448, fsm); @@ -397,10 +399,11 @@ WUT_CHECK_OFFSET(FSAsyncResult, 0x20, block); WUT_CHECK_OFFSET(FSAsyncResult, 0x24, status); WUT_CHECK_SIZE(FSAsyncResult, 0x28); -struct FSCmdBlockBody { - WUT_UNKNOWN_BYTES(0x96C); - FSAsyncResult asyncResult; - WUT_UNKNOWN_BYTES(0x68); +struct FSCmdBlockBody +{ + WUT_UNKNOWN_BYTES(0x96C); + FSAsyncResult asyncResult; + WUT_UNKNOWN_BYTES(0x68); }; WUT_CHECK_OFFSET(FSCmdBlockBody, 0x96C, asyncResult); WUT_CHECK_SIZE(FSCmdBlockBody, 0x9FC); @@ -419,19 +422,20 @@ struct FSMountSource }; WUT_CHECK_SIZE(FSMountSource, 0x300); -struct WUT_PACKED FSVolumeInfo { - uint32_t flags; - FSMediaState mediaState; - WUT_UNKNOWN_BYTES(0x4); - uint32_t unk0x0C; - uint32_t unk0x10; - int32_t unk0x14; - int32_t unk0x18; - WUT_UNKNOWN_BYTES(0x10); - char volumeLabel[128]; - char volumeId[128]; - char devicePath[16]; - char mountPath[128]; +struct WUT_PACKED FSVolumeInfo +{ + uint32_t flags; + FSMediaState mediaState; + WUT_UNKNOWN_BYTES(0x4); + uint32_t unk0x0C; + uint32_t unk0x10; + int32_t unk0x14; + int32_t unk0x18; + WUT_UNKNOWN_BYTES(0x10); + char volumeLabel[128]; + char volumeId[128]; + char devicePath[16]; + char mountPath[128]; }; WUT_CHECK_OFFSET(FSVolumeInfo, 0x00, flags); WUT_CHECK_OFFSET(FSVolumeInfo, 0x04, mediaState); @@ -450,22 +454,24 @@ WUT_CHECK_SIZE(FSVolumeInfo, 444); * Get an aligned FSClientBody from an FSClient. */ static inline FSClientBody * -FSGetClientBody(FSClient *client) { +FSGetClientBody(FSClient *client) +{ if (!client) { return NULL; } - return (FSClientBody *) ((((uint32_t) client) + 0x3F) & ~0x3F); + return (FSClientBody *)((((uint32_t)client) + 0x3F) & ~0x3F); } /** * Get an aligned FSCmdBlockBody from an FSCmdBlock. */ static inline FSCmdBlockBody * -FSGetCmdBlockBody(FSCmdBlock *cmdBlock) { +FSGetCmdBlockBody(FSCmdBlock *cmdBlock) +{ if (!cmdBlock) { return NULL; } - return (FSCmdBlockBody *) ((((uint32_t) cmdBlock) + 0x3F) & ~0x3F); + return (FSCmdBlockBody *)((((uint32_t)cmdBlock) + 0x3F) & ~0x3F); } void @@ -536,16 +542,16 @@ FSGetStatAsync(FSClient *client, FSStatus FSRemove(FSClient *client, - FSCmdBlock *block, - const char *path, - FSErrorFlag errorMask); + FSCmdBlock *block, + const char *path, + FSErrorFlag errorMask); FSStatus FSRemoveAsync(FSClient *client, - FSCmdBlock *block, - const char *path, - FSErrorFlag errorMask, - FSAsyncData *asyncData); + FSCmdBlock *block, + const char *path, + FSErrorFlag errorMask, + FSAsyncData *asyncData); FSStatus @@ -624,10 +630,10 @@ FSMakeDir(FSClient *client, FSStatus FSMakeDirAsync(FSClient *client, - FSCmdBlock *block, - const char *path, - FSErrorFlag errorMask, - FSAsyncData *asyncData); + FSCmdBlock *block, + const char *path, + FSErrorFlag errorMask, + FSAsyncData *asyncData); FSStatus FSReadDir(FSClient *client, @@ -646,9 +652,9 @@ FSReadDirAsync(FSClient *client, FSStatus FSRewindDir(FSClient *client, - FSCmdBlock *block, - FSDirectoryHandle handle, - FSErrorFlag errorMask); + FSCmdBlock *block, + FSDirectoryHandle handle, + FSErrorFlag errorMask); FSStatus FSCloseDir(FSClient *client, @@ -657,18 +663,18 @@ FSCloseDir(FSClient *client, FSErrorFlag errorMask); FSStatus -FSGetVolumeInfo(FSClient *client, - FSCmdBlock *block, - const char *path, - FSVolumeInfo *volumeInfo, - FSErrorFlag errorMask); +FSGetVolumeInfo(FSClient *client, + FSCmdBlock *block, + const char *path, + FSVolumeInfo *volumeInfo, + FSErrorFlag errorMask); FSStatus -FSGetVolumeInfoAsync(FSClient *client, - FSCmdBlock *block, - const char *path, - FSVolumeInfo *volumeInfo, - FSErrorFlag errorMask, +FSGetVolumeInfoAsync(FSClient *client, + FSCmdBlock *block, + const char *path, + FSVolumeInfo *volumeInfo, + FSErrorFlag errorMask, FSAsyncData *asyncData); FSStatus @@ -770,47 +776,47 @@ FSReadFileWithPosAsync(FSClient *client, FSStatus FSWriteFile(FSClient *client, - FSCmdBlock *block, - uint8_t *buffer, - uint32_t size, - uint32_t count, - FSFileHandle handle, - uint32_t unk1, - FSErrorFlag errorMask); + FSCmdBlock *block, + uint8_t *buffer, + uint32_t size, + uint32_t count, + FSFileHandle handle, + uint32_t unk1, + FSErrorFlag errorMask); FSStatus FSWriteFileAsync(FSClient *client, - FSCmdBlock *block, - uint8_t *buffer, - uint32_t size, - uint32_t count, - FSFileHandle handle, - uint32_t unk1, - FSErrorFlag errorMask, - FSAsyncData *asyncData); + FSCmdBlock *block, + uint8_t *buffer, + uint32_t size, + uint32_t count, + FSFileHandle handle, + uint32_t unk1, + FSErrorFlag errorMask, + FSAsyncData *asyncData); FSStatus FSWriteFileWithPos(FSClient *client, - FSCmdBlock *block, - uint8_t *buffer, - uint32_t size, - uint32_t count, - uint32_t pos, - FSFileHandle handle, - uint32_t unk1, - FSErrorFlag errorMask); + FSCmdBlock *block, + uint8_t *buffer, + uint32_t size, + uint32_t count, + uint32_t pos, + FSFileHandle handle, + uint32_t unk1, + FSErrorFlag errorMask); FSStatus FSWriteFileWithPosAsync(FSClient *client, - FSCmdBlock *block, - uint8_t *buffer, - uint32_t size, - uint32_t count, - uint32_t pos, - FSFileHandle handle, - uint32_t unk1, - FSErrorFlag errorMask, - FSAsyncData *asyncData); + FSCmdBlock *block, + uint8_t *buffer, + uint32_t size, + uint32_t count, + uint32_t pos, + FSFileHandle handle, + uint32_t unk1, + FSErrorFlag errorMask, + FSAsyncData *asyncData); FSStatus FSGetPosFile(FSClient *client, @@ -844,44 +850,44 @@ FSSetPosFileAsync(FSClient *client, FSStatus FSFlushFile(FSClient *client, - FSCmdBlock *block, - FSFileHandle handle, - FSErrorFlag errorMask); + FSCmdBlock *block, + FSFileHandle handle, + FSErrorFlag errorMask); FSStatus FSFlushFileAsync(FSClient *client, - FSCmdBlock *block, - FSFileHandle handle, - FSErrorFlag errorMask, - FSAsyncData *asyncData); + FSCmdBlock *block, + FSFileHandle handle, + FSErrorFlag errorMask, + FSAsyncData *asyncData); FSStatus FSTruncateFile(FSClient *client, - FSCmdBlock *block, - FSFileHandle handle, - FSErrorFlag errorMask); + FSCmdBlock *block, + FSFileHandle handle, + FSErrorFlag errorMask); FSStatus FSTruncateFileAsync(FSClient *client, - FSCmdBlock *block, - FSFileHandle handle, - FSErrorFlag errorMask, - FSAsyncData *asyncData); + FSCmdBlock *block, + FSFileHandle handle, + FSErrorFlag errorMask, + FSAsyncData *asyncData); FSStatus FSRename(FSClient *client, - FSCmdBlock *block, - const char *oldPath, - const char *newPath, - FSErrorFlag errorMask); + FSCmdBlock *block, + const char *oldPath, + const char *newPath, + FSErrorFlag errorMask); FSStatus FSRenameAsync(FSClient *client, - FSCmdBlock *block, - const char *oldPath, - const char *newPath, - FSErrorFlag errorMask, - FSAsyncData *asyncData); + FSCmdBlock *block, + const char *oldPath, + const char *newPath, + FSErrorFlag errorMask, + FSAsyncData *asyncData); FSVolumeState FSGetVolumeState(FSClient *client); diff --git a/include/coreinit/filesystem_fsa.h b/include/coreinit/filesystem_fsa.h index fd05e2afb..c45886c34 100644 --- a/include/coreinit/filesystem_fsa.h +++ b/include/coreinit/filesystem_fsa.h @@ -82,19 +82,21 @@ typedef void (*FSAAsyncCallbackFn)(FSError result, /** * Block information. */ -struct FSABlockInfo { - WUT_UNKNOWN_BYTES(0x14); +struct FSABlockInfo +{ + WUT_UNKNOWN_BYTES(0x14); }; WUT_CHECK_SIZE(FSABlockInfo, 0x14); /** * Device information. */ -struct FSADeviceInfo { - WUT_UNKNOWN_BYTES(0x08); - uint64_t deviceSizeInSectors; - uint32_t deviceSectorSize; - WUT_UNKNOWN_BYTES(0x14); +struct FSADeviceInfo +{ + WUT_UNKNOWN_BYTES(0x08); + uint64_t deviceSizeInSectors; + uint32_t deviceSectorSize; + WUT_UNKNOWN_BYTES(0x14); }; WUT_CHECK_OFFSET(FSADeviceInfo, 0x08, deviceSizeInSectors); WUT_CHECK_OFFSET(FSADeviceInfo, 0x10, deviceSectorSize); @@ -103,38 +105,43 @@ WUT_CHECK_SIZE(FSADeviceInfo, 0x28); /** * File System information. */ -struct FSAFileSystemInfo { - WUT_UNKNOWN_BYTES(0x1E); +struct FSAFileSystemInfo +{ + WUT_UNKNOWN_BYTES(0x1E); }; WUT_CHECK_SIZE(FSAFileSystemInfo, 0x1E); -typedef enum FSAMountPriority { - FSA_MOUNT_PRIORITY_BASE = 0x1, - FSA_MOUNT_PRIORITY_RAM_DISK_CACHE = 0x4, - FSA_MOUNT_PRIORITY_TITLE_UPDATE = 0x9, - FSA_MOUNT_PRIORITY_UNMOUNT_ALL = 0x80000000, +typedef enum FSAMountPriority +{ + FSA_MOUNT_PRIORITY_BASE = 0x1, + FSA_MOUNT_PRIORITY_RAM_DISK_CACHE = 0x4, + FSA_MOUNT_PRIORITY_TITLE_UPDATE = 0x9, + FSA_MOUNT_PRIORITY_UNMOUNT_ALL = 0x80000000, } FSAMountPriority; -typedef enum FSAQueryInfoType { - FSA_QUERY_INFO_FREE_SPACE_SIZE = 0x0, - FSA_QUERY_INFO_DIR_SIZE = 0x1, - FSA_QUERY_INFO_ENTRY_NUM = 0x2, - FSA_QUERY_INFO_FILE_SYSTEM_INFO = 0x3, - FSA_QUERY_INFO_DEVICE_INFO = 0x4, - FSA_QUERY_INFO_STAT = 0x5, - FSA_QUERY_INFO_BAD_BLOCK_INFO = 0x6, - FSA_QUERY_INFO_JOURNAL_FREE_SPACE_SIZE = 0x7, - FSA_QUERY_INFO_FRAGMENT_BLOCK_INFO = 0x8, +typedef enum FSAQueryInfoType +{ + FSA_QUERY_INFO_FREE_SPACE_SIZE = 0x0, + FSA_QUERY_INFO_DIR_SIZE = 0x1, + FSA_QUERY_INFO_ENTRY_NUM = 0x2, + FSA_QUERY_INFO_FILE_SYSTEM_INFO = 0x3, + FSA_QUERY_INFO_DEVICE_INFO = 0x4, + FSA_QUERY_INFO_STAT = 0x5, + FSA_QUERY_INFO_BAD_BLOCK_INFO = 0x6, + FSA_QUERY_INFO_JOURNAL_FREE_SPACE_SIZE = 0x7, + FSA_QUERY_INFO_FRAGMENT_BLOCK_INFO = 0x8, } FSAQueryInfoType; -typedef enum FSAReadFlag { - FSA_READ_FLAG_NONE = 0x0, - FSA_READ_FLAG_READ_WITH_POS = 0x1 +typedef enum FSAReadFlag +{ + FSA_READ_FLAG_NONE = 0x0, + FSA_READ_FLAG_READ_WITH_POS = 0x1 } FSAReadFlag; -typedef enum FSAWriteFlag { - FSA_WRITE_FLAG_NONE = 0x0, - FSA_WRITE_FLAG_READ_WITH_POS = 0x1 +typedef enum FSAWriteFlag +{ + FSA_WRITE_FLAG_NONE = 0x0, + FSA_WRITE_FLAG_READ_WITH_POS = 0x1 } FSAWriteFlag; /** @@ -142,33 +149,36 @@ typedef enum FSAWriteFlag { */ struct FSAProcessInfo { - uint64_t titleId; - uint32_t processId; - uint32_t groupId; + uint64_t titleId; + uint32_t processId; + uint32_t groupId; }; WUT_CHECK_OFFSET(FSAProcessInfo, 0x00, titleId); WUT_CHECK_OFFSET(FSAProcessInfo, 0x08, processId); WUT_CHECK_OFFSET(FSAProcessInfo, 0x0C, groupId); WUT_CHECK_SIZE(FSAProcessInfo, 0x10); -struct FSARequestRawOpen { - char path[0x280]; +struct FSARequestRawOpen +{ + char path[0x280]; }; WUT_CHECK_OFFSET(FSARequestRawOpen, 0x0, path); WUT_CHECK_SIZE(FSARequestRawOpen, 0x280); -struct FSARequestRawClose { - int32_t handle; +struct FSARequestRawClose +{ + int32_t handle; }; WUT_CHECK_OFFSET(FSARequestRawClose, 0x0, handle); WUT_CHECK_SIZE(FSARequestRawClose, 0x04); -struct WUT_PACKED FSARequestRawRead { - WUT_UNKNOWN_BYTES(0x4); - uint64_t blocks_offset; - uint32_t count; - uint32_t size; - uint32_t device_handle; +struct WUT_PACKED FSARequestRawRead +{ + WUT_UNKNOWN_BYTES(0x4); + uint64_t blocks_offset; + uint32_t count; + uint32_t size; + uint32_t device_handle; }; WUT_CHECK_OFFSET(FSARequestRawRead, 0x04, blocks_offset); WUT_CHECK_OFFSET(FSARequestRawRead, 0x0C, count); @@ -176,12 +186,13 @@ WUT_CHECK_OFFSET(FSARequestRawRead, 0x10, size); WUT_CHECK_OFFSET(FSARequestRawRead, 0x14, device_handle); WUT_CHECK_SIZE(FSARequestRawRead, 0x18); -struct WUT_PACKED FSARequestRawWrite { - WUT_UNKNOWN_BYTES(0x4); - uint64_t blocks_offset; - uint32_t count; - uint32_t size; - uint32_t device_handle; +struct WUT_PACKED FSARequestRawWrite +{ + WUT_UNKNOWN_BYTES(0x4); + uint64_t blocks_offset; + uint32_t count; + uint32_t size; + uint32_t device_handle; }; WUT_CHECK_OFFSET(FSARequestRawWrite, 0x04, blocks_offset); WUT_CHECK_OFFSET(FSARequestRawWrite, 0x0C, count); @@ -194,10 +205,10 @@ WUT_CHECK_SIZE(FSARequestRawWrite, 0x18); */ struct FSARequestAppendFile { - uint32_t size; - uint32_t count; - FSAFileHandle handle; - uint32_t unk0x0C; + uint32_t size; + uint32_t count; + FSAFileHandle handle; + uint32_t unk0x0C; }; WUT_CHECK_OFFSET(FSARequestAppendFile, 0x0, size); WUT_CHECK_OFFSET(FSARequestAppendFile, 0x4, count); @@ -210,7 +221,7 @@ WUT_CHECK_SIZE(FSARequestAppendFile, 0x10); */ struct FSARequestChangeDir { - char path[FS_MAX_PATH +1]; + char path[FS_MAX_PATH + 1]; }; WUT_CHECK_OFFSET(FSARequestChangeDir, 0x0, path); WUT_CHECK_SIZE(FSARequestChangeDir, 0x280); @@ -221,9 +232,9 @@ WUT_CHECK_SIZE(FSARequestChangeDir, 0x280); */ struct FSARequestChangeMode { - char path[FS_MAX_PATH +1]; - uint32_t mode1; - uint32_t mode2; + char path[FS_MAX_PATH + 1]; + uint32_t mode1; + uint32_t mode2; }; WUT_CHECK_OFFSET(FSARequestChangeMode, 0x0, path); WUT_CHECK_OFFSET(FSARequestChangeMode, 0x280, mode1); @@ -236,7 +247,7 @@ WUT_CHECK_SIZE(FSARequestChangeMode, 0x288); */ struct FSARequestCloseDir { - FSADirectoryHandle handle; + FSADirectoryHandle handle; }; WUT_CHECK_OFFSET(FSARequestCloseDir, 0x0, handle); WUT_CHECK_SIZE(FSARequestCloseDir, 0x4); @@ -247,7 +258,7 @@ WUT_CHECK_SIZE(FSARequestCloseDir, 0x4); */ struct FSARequestCloseFile { - FSAFileHandle handle; + FSAFileHandle handle; }; WUT_CHECK_OFFSET(FSARequestCloseFile, 0x0, handle); WUT_CHECK_SIZE(FSARequestCloseFile, 0x4); @@ -258,7 +269,7 @@ WUT_CHECK_SIZE(FSARequestCloseFile, 0x4); */ struct FSARequestFlushFile { - FSAFileHandle handle; + FSAFileHandle handle; }; WUT_CHECK_OFFSET(FSARequestFlushFile, 0x0, handle); WUT_CHECK_SIZE(FSARequestFlushFile, 0x4); @@ -269,7 +280,7 @@ WUT_CHECK_SIZE(FSARequestFlushFile, 0x4); */ struct FSARequestFlushQuota { - char path[FS_MAX_PATH +1]; + char path[FS_MAX_PATH + 1]; }; WUT_CHECK_OFFSET(FSARequestFlushQuota, 0x0, path); WUT_CHECK_SIZE(FSARequestFlushQuota, 0x280); @@ -280,8 +291,8 @@ WUT_CHECK_SIZE(FSARequestFlushQuota, 0x280); */ struct FSARequestGetInfoByQuery { - char path[FS_MAX_PATH +1]; - FSAQueryInfoType type; + char path[FS_MAX_PATH + 1]; + FSAQueryInfoType type; }; WUT_CHECK_OFFSET(FSARequestGetInfoByQuery, 0x0, path); WUT_CHECK_OFFSET(FSARequestGetInfoByQuery, 0x280, type); @@ -293,7 +304,7 @@ WUT_CHECK_SIZE(FSARequestGetInfoByQuery, 0x284); */ struct FSARequestGetPosFile { - FSAFileHandle handle; + FSAFileHandle handle; }; WUT_CHECK_OFFSET(FSARequestGetPosFile, 0x0, handle); WUT_CHECK_SIZE(FSARequestGetPosFile, 0x4); @@ -304,7 +315,7 @@ WUT_CHECK_SIZE(FSARequestGetPosFile, 0x4); */ struct FSARequestIsEof { - FSAFileHandle handle; + FSAFileHandle handle; }; WUT_CHECK_OFFSET(FSARequestIsEof, 0x0, handle); WUT_CHECK_SIZE(FSARequestIsEof, 0x4); @@ -315,8 +326,8 @@ WUT_CHECK_SIZE(FSARequestIsEof, 0x4); */ struct FSARequestMakeDir { - char path[FS_MAX_PATH +1]; - uint32_t permission; + char path[FS_MAX_PATH + 1]; + uint32_t permission; }; WUT_CHECK_OFFSET(FSARequestMakeDir, 0x0, path); WUT_CHECK_OFFSET(FSARequestMakeDir, 0x280, permission); @@ -327,9 +338,9 @@ WUT_CHECK_SIZE(FSARequestMakeDir, 0x284); */ struct WUT_PACKED FSARequestMakeQuota { - char path[FS_MAX_PATH +1]; - uint32_t mode; - uint64_t size; + char path[FS_MAX_PATH + 1]; + uint32_t mode; + uint64_t size; }; WUT_CHECK_OFFSET(FSARequestMakeQuota, 0x0, path); WUT_CHECK_OFFSET(FSARequestMakeQuota, 0x280, mode); @@ -342,11 +353,11 @@ WUT_CHECK_SIZE(FSARequestMakeQuota, 0x28C); */ struct FSARequestMount { - char path[FS_MAX_PATH +1]; - char target[FS_MAX_PATH +1]; - uint32_t unk0x500; - void* unkBuf; - uint32_t unkBufLen; + char path[FS_MAX_PATH + 1]; + char target[FS_MAX_PATH + 1]; + uint32_t unk0x500; + void *unkBuf; + uint32_t unkBufLen; }; WUT_CHECK_OFFSET(FSARequestMount, 0x0, path); WUT_CHECK_OFFSET(FSARequestMount, 0x280, target); @@ -361,12 +372,12 @@ WUT_CHECK_SIZE(FSARequestMount, 0x50C); */ struct WUT_PACKED FSARequestMountWithProcess { - char path[FS_MAX_PATH +1]; - char target[FS_MAX_PATH +1]; - FSAMountPriority priority; - FSAProcessInfo process; - void* unkBuf; - uint32_t unkBufLen; + char path[FS_MAX_PATH + 1]; + char target[FS_MAX_PATH + 1]; + FSAMountPriority priority; + FSAProcessInfo process; + void *unkBuf; + uint32_t unkBufLen; }; WUT_CHECK_OFFSET(FSARequestMountWithProcess, 0x0, path); WUT_CHECK_OFFSET(FSARequestMountWithProcess, 0x280, target); @@ -382,7 +393,7 @@ WUT_CHECK_SIZE(FSARequestMountWithProcess, 0x51C); */ struct FSARequestOpenDir { - char path[FS_MAX_PATH +1]; + char path[FS_MAX_PATH + 1]; }; WUT_CHECK_OFFSET(FSARequestOpenDir, 0x0, path); WUT_CHECK_SIZE(FSARequestOpenDir, 0x280); @@ -392,11 +403,11 @@ WUT_CHECK_SIZE(FSARequestOpenDir, 0x280); */ struct FSARequestOpenFile { - char path[FS_MAX_PATH +1]; - char mode[FS_MODE_LENGTH]; - uint32_t unk0x290; - uint32_t unk0x294; - uint32_t unk0x298; + char path[FS_MAX_PATH + 1]; + char mode[FS_MODE_LENGTH]; + uint32_t unk0x290; + uint32_t unk0x294; + uint32_t unk0x298; }; WUT_CHECK_OFFSET(FSARequestOpenFile, 0x0, path); WUT_CHECK_OFFSET(FSARequestOpenFile, 0x280, mode); @@ -411,7 +422,7 @@ WUT_CHECK_SIZE(FSARequestOpenFile, 0x29C); */ struct FSARequestReadDir { - FSADirectoryHandle handle; + FSADirectoryHandle handle; }; WUT_CHECK_OFFSET(FSARequestReadDir, 0x0, handle); WUT_CHECK_SIZE(FSARequestReadDir, 0x4); @@ -422,13 +433,13 @@ WUT_CHECK_SIZE(FSARequestReadDir, 0x4); */ struct FSARequestReadFile { - //! Virtual pointer used only by Cafe, for IOS we should use ioctlv.vecs[1] - uint8_t* buffer; - uint32_t size; - uint32_t count; - FSAFilePosition pos; - FSAFileHandle handle; - FSAReadFlag readFlags; + //! Virtual pointer used only by Cafe, for IOS we should use ioctlv.vecs[1] + uint8_t *buffer; + uint32_t size; + uint32_t count; + FSAFilePosition pos; + FSAFileHandle handle; + FSAReadFlag readFlags; }; WUT_CHECK_OFFSET(FSARequestReadFile, 0x00, buffer); WUT_CHECK_OFFSET(FSARequestReadFile, 0x04, size); @@ -444,7 +455,7 @@ WUT_CHECK_SIZE(FSARequestReadFile, 0x18); */ struct FSARequestRemove { - char path[FS_MAX_PATH +1]; + char path[FS_MAX_PATH + 1]; }; WUT_CHECK_OFFSET(FSARequestRemove, 0x0, path); WUT_CHECK_SIZE(FSARequestRemove, 0x280); @@ -455,8 +466,8 @@ WUT_CHECK_SIZE(FSARequestRemove, 0x280); */ struct FSARequestRename { - char oldPath[FS_MAX_PATH +1]; - char newPath[FS_MAX_PATH +1]; + char oldPath[FS_MAX_PATH + 1]; + char newPath[FS_MAX_PATH + 1]; }; WUT_CHECK_OFFSET(FSARequestRename, 0x0, oldPath); WUT_CHECK_OFFSET(FSARequestRename, 0x280, newPath); @@ -468,7 +479,7 @@ WUT_CHECK_SIZE(FSARequestRename, 0x500); */ struct FSARequestRewindDir { - FSADirectoryHandle handle; + FSADirectoryHandle handle; }; WUT_CHECK_OFFSET(FSARequestRewindDir, 0x0, handle); WUT_CHECK_SIZE(FSARequestRewindDir, 0x4); @@ -479,8 +490,8 @@ WUT_CHECK_SIZE(FSARequestRewindDir, 0x4); */ struct FSARequestSetPosFile { - FSAFileHandle handle; - FSAFilePosition pos; + FSAFileHandle handle; + FSAFilePosition pos; }; WUT_CHECK_OFFSET(FSARequestSetPosFile, 0x0, handle); WUT_CHECK_OFFSET(FSARequestSetPosFile, 0x4, pos); @@ -492,7 +503,7 @@ WUT_CHECK_SIZE(FSARequestSetPosFile, 0x8); */ struct FSARequestStatFile { - FSAFileHandle handle; + FSAFileHandle handle; }; WUT_CHECK_OFFSET(FSARequestStatFile, 0x0, handle); WUT_CHECK_SIZE(FSARequestStatFile, 0x4); @@ -503,7 +514,7 @@ WUT_CHECK_SIZE(FSARequestStatFile, 0x4); */ struct FSARequestTruncateFile { - FSAFileHandle handle; + FSAFileHandle handle; }; WUT_CHECK_OFFSET(FSARequestTruncateFile, 0x0, handle); WUT_CHECK_SIZE(FSARequestTruncateFile, 0x4); @@ -514,8 +525,8 @@ WUT_CHECK_SIZE(FSARequestTruncateFile, 0x4); */ struct FSARequestUnmount { - char path[FS_MAX_PATH +1]; - uint32_t unk0x280; + char path[FS_MAX_PATH + 1]; + uint32_t unk0x280; }; WUT_CHECK_OFFSET(FSARequestUnmount, 0x0, path); WUT_CHECK_OFFSET(FSARequestUnmount, 0x280, unk0x280); @@ -527,9 +538,9 @@ WUT_CHECK_SIZE(FSARequestUnmount, 0x284); */ struct WUT_PACKED FSARequestUnmountWithProcess { - char path[FS_MAX_PATH +1]; - FSAMountPriority priority; - FSAProcessInfo process; + char path[FS_MAX_PATH + 1]; + FSAMountPriority priority; + FSAProcessInfo process; }; WUT_CHECK_OFFSET(FSARequestUnmountWithProcess, 0x0, path); WUT_CHECK_OFFSET(FSARequestUnmountWithProcess, 0x280, priority); @@ -542,13 +553,13 @@ WUT_CHECK_SIZE(FSARequestUnmountWithProcess, 0x294); */ struct FSARequestWriteFile { - //! Virtual pointer used only by Cafe, for IOS we should use ioctlv.vecs[1] - const uint8_t* buffer; - uint32_t size; - uint32_t count; - FSAFilePosition pos; - FSAFileHandle handle; - FSAWriteFlag writeFlags; + //! Virtual pointer used only by Cafe, for IOS we should use ioctlv.vecs[1] + const uint8_t *buffer; + uint32_t size; + uint32_t count; + FSAFilePosition pos; + FSAFileHandle handle; + FSAWriteFlag writeFlags; }; WUT_CHECK_OFFSET(FSARequestWriteFile, 0x00, buffer); WUT_CHECK_OFFSET(FSARequestWriteFile, 0x04, size); @@ -560,108 +571,112 @@ WUT_CHECK_SIZE(FSARequestWriteFile, 0x18); struct FSARequestChangeOwner { - char path[FS_MAX_PATH +1]; - WUT_UNKNOWN_BYTES(4); - uint32_t owner; - WUT_UNKNOWN_BYTES(4); - uint32_t group; + char path[FS_MAX_PATH + 1]; + WUT_UNKNOWN_BYTES(4); + uint32_t owner; + WUT_UNKNOWN_BYTES(4); + uint32_t group; }; WUT_CHECK_OFFSET(FSARequestChangeOwner, 0x0, path); WUT_CHECK_OFFSET(FSARequestChangeOwner, 0x284, owner); WUT_CHECK_OFFSET(FSARequestChangeOwner, 0x28C, group); WUT_CHECK_SIZE(FSARequestChangeOwner, 0x290); -struct FSARequest { - FSError emulatedError; - - union { - FSARequestRawOpen rawOpen; - FSARequestRawClose rawClose; - FSARequestRawRead rawRead; - FSARequestRawWrite rawWrite; - FSARequestAppendFile appendFile; - FSARequestChangeDir changeDir; - FSARequestChangeMode changeMode; - FSARequestCloseDir closeDir; - FSARequestCloseFile closeFile; - FSARequestFlushFile flushFile; - FSARequestFlushQuota flushQuota; - FSARequestGetInfoByQuery getInfoByQuery; - FSARequestGetPosFile getPosFile; - FSARequestIsEof isEof; - FSARequestMakeDir makeDir; - FSARequestMakeQuota makeQuota; - FSARequestMount mount; - FSARequestMountWithProcess mountWithProcess; - FSARequestOpenDir openDir; - FSARequestOpenFile openFile; - FSARequestReadDir readDir; - FSARequestReadFile readFile; - FSARequestRemove remove; - FSARequestRename rename; - FSARequestRewindDir rewindDir; - FSARequestSetPosFile setPosFile; - FSARequestStatFile statFile; - FSARequestTruncateFile truncateFile; - FSARequestUnmount unmount; - FSARequestUnmountWithProcess unmountWithProcess; - FSARequestWriteFile writeFile; - FSARequestChangeOwner changeOwner; - WUT_UNKNOWN_BYTES(0x51C); - }; +struct FSARequest +{ + FSError emulatedError; + + union + { + FSARequestRawOpen rawOpen; + FSARequestRawClose rawClose; + FSARequestRawRead rawRead; + FSARequestRawWrite rawWrite; + FSARequestAppendFile appendFile; + FSARequestChangeDir changeDir; + FSARequestChangeMode changeMode; + FSARequestCloseDir closeDir; + FSARequestCloseFile closeFile; + FSARequestFlushFile flushFile; + FSARequestFlushQuota flushQuota; + FSARequestGetInfoByQuery getInfoByQuery; + FSARequestGetPosFile getPosFile; + FSARequestIsEof isEof; + FSARequestMakeDir makeDir; + FSARequestMakeQuota makeQuota; + FSARequestMount mount; + FSARequestMountWithProcess mountWithProcess; + FSARequestOpenDir openDir; + FSARequestOpenFile openFile; + FSARequestReadDir readDir; + FSARequestReadFile readFile; + FSARequestRemove remove; + FSARequestRename rename; + FSARequestRewindDir rewindDir; + FSARequestSetPosFile setPosFile; + FSARequestStatFile statFile; + FSARequestTruncateFile truncateFile; + FSARequestUnmount unmount; + FSARequestUnmountWithProcess unmountWithProcess; + FSARequestWriteFile writeFile; + FSARequestChangeOwner changeOwner; + WUT_UNKNOWN_BYTES(0x51C); + }; }; WUT_CHECK_OFFSET(FSARequest, 0x00, emulatedError); WUT_CHECK_OFFSET(FSARequest, 0x04, rawOpen); WUT_CHECK_SIZE(FSARequest, 0x520); -struct FSAResponseRawOpen { - int handle; +struct FSAResponseRawOpen +{ + int handle; }; WUT_CHECK_OFFSET(FSAResponseRawOpen, 0x0, handle); WUT_CHECK_SIZE(FSAResponseRawOpen, 0x4); struct FSAResponseGetCwd { - char path[FS_MAX_PATH +1]; + char path[FS_MAX_PATH + 1]; }; WUT_CHECK_OFFSET(FSAResponseGetCwd, 0x0, path); WUT_CHECK_SIZE(FSAResponseGetCwd, 0x280); struct FSAResponseGetFileBlockAddress { - uint32_t address; + uint32_t address; }; WUT_CHECK_OFFSET(FSAResponseGetFileBlockAddress, 0x0, address); WUT_CHECK_SIZE(FSAResponseGetFileBlockAddress, 0x4); struct FSAResponseGetPosFile { - FSAFilePosition pos; + FSAFilePosition pos; }; WUT_CHECK_OFFSET(FSAResponseGetPosFile, 0x0, pos); WUT_CHECK_SIZE(FSAResponseGetPosFile, 0x4); struct FSAResponseGetVolumeInfo { - FSAVolumeInfo volumeInfo; + FSAVolumeInfo volumeInfo; }; WUT_CHECK_OFFSET(FSAResponseGetVolumeInfo, 0x0, volumeInfo); WUT_CHECK_SIZE(FSAResponseGetVolumeInfo, 0x1BC); struct WUT_PACKED FSAResponseGetInfoByQuery { - union WUT_PACKED { - FSABlockInfo badBlockInfo; - FSADeviceInfo deviceInfo; - uint64_t dirSize; - FSAEntryNum entryNum; - FSAFileSystemInfo fileSystemInfo; - FSABlockInfo fragmentBlockInfo; - uint64_t freeSpaceSize; - uint64_t journalFreeSpaceSize; - FSAStat stat; - }; + union WUT_PACKED + { + FSABlockInfo badBlockInfo; + FSADeviceInfo deviceInfo; + uint64_t dirSize; + FSAEntryNum entryNum; + FSAFileSystemInfo fileSystemInfo; + FSABlockInfo fragmentBlockInfo; + uint64_t freeSpaceSize; + uint64_t journalFreeSpaceSize; + FSAStat stat; + }; }; WUT_CHECK_OFFSET(FSAResponseGetInfoByQuery, 0x0, badBlockInfo); WUT_CHECK_OFFSET(FSAResponseGetInfoByQuery, 0x0, deviceInfo); @@ -676,149 +691,154 @@ WUT_CHECK_SIZE(FSAResponseGetInfoByQuery, 0x64); struct FSAResponseOpenFile { - FSAFileHandle handle; + FSAFileHandle handle; }; WUT_CHECK_OFFSET(FSAResponseOpenFile, 0x0, handle); WUT_CHECK_SIZE(FSAResponseOpenFile, 0x4); struct FSAResponseOpenDir { - FSADirectoryHandle handle; + FSADirectoryHandle handle; }; WUT_CHECK_OFFSET(FSAResponseOpenDir, 0x0, handle); WUT_CHECK_SIZE(FSAResponseOpenDir, 0x4); struct FSAResponseReadDir { - FSADirectoryEntry entry; + FSADirectoryEntry entry; }; WUT_CHECK_OFFSET(FSAResponseReadDir, 0x0, entry); WUT_CHECK_SIZE(FSAResponseReadDir, 0x164); struct FSAResponseStatFile { - FSAStat stat; + FSAStat stat; }; WUT_CHECK_OFFSET(FSAResponseStatFile, 0x0, stat); WUT_CHECK_SIZE(FSAResponseStatFile, 0x64); -struct WUT_PACKED FSAResponse { - uint32_t word0; - union WUT_PACKED { - FSAResponseRawOpen rawOpen; - FSAResponseGetCwd getCwd; - FSAResponseGetFileBlockAddress getFileBlockAddress; - FSAResponseGetPosFile getPosFile; - FSAResponseGetVolumeInfo getVolumeInfo; - FSAResponseGetInfoByQuery getInfoByQuery; - FSAResponseOpenDir openDir; - FSAResponseOpenFile openFile; - FSAResponseReadDir readDir; - FSAResponseStatFile statFile; - WUT_UNKNOWN_BYTES(0x28F); - }; +struct WUT_PACKED FSAResponse +{ + uint32_t word0; + union WUT_PACKED + { + FSAResponseRawOpen rawOpen; + FSAResponseGetCwd getCwd; + FSAResponseGetFileBlockAddress getFileBlockAddress; + FSAResponseGetPosFile getPosFile; + FSAResponseGetVolumeInfo getVolumeInfo; + FSAResponseGetInfoByQuery getInfoByQuery; + FSAResponseOpenDir openDir; + FSAResponseOpenFile openFile; + FSAResponseReadDir readDir; + FSAResponseStatFile statFile; + WUT_UNKNOWN_BYTES(0x28F); + }; }; WUT_CHECK_OFFSET(FSAResponse, 0x0, word0); WUT_CHECK_OFFSET(FSAResponse, 0x4, rawOpen); WUT_CHECK_SIZE(FSAResponse, 0x293); -enum FSACommandEnum { - FSA_COMMAND_INVALID = 0x0, - FSA_COMMAND_MOUNT = 0x1, - FSA_COMMAND_UNMOUNT = 0x2, - FSA_COMMAND_GET_VOLUME_INFO = 0x3, - FSA_COMMAND_GET_ATTACH = 0x4, - FSA_COMMAND_CHANGE_DIR = 0x5, - FSA_COMMAND_GET_CWD = 0x6, - FSA_COMMAND_MAKE_DIR = 0x7, - FSA_COMMAND_REMOVE = 0x8, - FSA_COMMAND_RENAME = 0x9, - FSA_COMMAND_OPEN_DIR = 0xA, - FSA_COMMAND_READ_DIR = 0xB, - FSA_COMMAND_REWIND_DIR = 0xC, - FSA_COMMAND_CLOSE_DIR = 0xD, - FSA_COMMAND_OPEN_FILE = 0xE, - FSA_COMMAND_READ_FILE = 0xF, - FSA_COMMAND_WRITE_FILE = 0x10, - FSA_COMMAND_GET_POS_FILE = 0x11, - FSA_COMMAND_SET_POS_FILE = 0x12, - FSA_COMMAND_IS_EOF = 0x13, - FSA_COMMAND_STAT_FILE = 0x14, - FSA_COMMAND_CLOSE_FILE = 0x15, - FSA_COMMAND_GET_ERROR = 0x16, - FSA_COMMAND_FLUSH_FILE = 0x17, - FSA_COMMAND_GET_INFO_BY_QUERY = 0x18, - FSA_COMMAND_APPEND_FILE = 0x19, - FSA_COMMAND_TRUNCATE_FILE = 0x1A, - FSA_COMMAND_FLUSH_VOLUME = 0x1B, - FSA_COMMAND_ROLLBACK_VOLUME = 0x1C, - FSA_COMMAND_MAKE_QUOTA = 0x1D, - FSA_COMMAND_FLUSH_QUOTA = 0x1E, - FSA_COMMAND_ROLLBACK_QUOTA = 0x1F, - FSA_COMMAND_CHANGE_MODE = 0x20, - FSA_COMMAND_OPEN_FILE_BY_STAT = 0x21, - FSA_COMMAND_REGISTER_FLUSH_QUOTA = 0x22, - FSA_COMMAND_FLUSH_MULTI_QUOTA = 0x23, - FSA_COMMAND_GET_FILE_BLOCK_ADDRESS = 0x25, - FSA_COMMAND_ADD_USER_PROCESS = 0x65, - FSA_COMMAND_DEL_USER_PROCESS = 0x66, - FSA_COMMAND_MOUNT_WITH_PROCESS = 0x67, - FSA_COMMAND_UNMOUNT_WITH_PROCESS = 0x68, - FSA_COMMAND_FORMAT = 0x69, - FSA_COMMAND_RAW_OPEN = 0x6A, - FSA_COMMAND_RAW_READ = 0x6B, - FSA_COMMAND_RAW_WRITE = 0x6C, - FSA_COMMAND_RAW_CLOSE = 0x6D, - FSA_COMMAND_GET_LAST_FAILED_VOLUME = 0x6E, - FSA_COMMAND_GET_VOLUME_EXISTENCE = 0x6F, - FSA_COMMAND_CHANGE_OWNER = 0x70, - FSA_COMMAND_CANCEL_GET_ATTACH = 0x71, - FSA_COMMAND_REMOVE_QUOTA = 0x72, - FSA_COMMAND_SET_CLIENT_PRIORITY = 0x73, - FSA_COMMAND_APPLY_MEMORY_CACHE = 0x74, - FSA_COMMAND_MAKE_LINK = 0x75, - FSA_COMMAND_XFER_PARAMS = 0x76, - FSA_COMMAND_EXEC_DEBUG_PROC = 0x78, - FSA_COMMAND_DEBUG_SET_TITLE_ID = 0x79, - FSA_COMMAND_DEBUG_SET_CAPABILITY = 0x7A, - FSA_COMMAND_SET_PROCESS_CONFIG = 0x82, - FSA_COMMAND_CONFIG_SET_MEMORY_CACHE = 0x83, - FSA_COMMAND_CONFIG_UNSET_MEMORY_CACHE = 0x84, - FSA_COMMAND_CONFIG_SET_PRF2_CHAR_CODE = 0x85, - FSA_COMMAND_GET_PROC_RESOURCE_USAGE = 0x8C, - FSA_COMMAND_GET_ALL_RESOURCE_USAGE = 0x8D, - FSA_COMMAND_SEND_PROFILE_CMD = 0x8E, +enum FSACommandEnum +{ + FSA_COMMAND_INVALID = 0x0, + FSA_COMMAND_MOUNT = 0x1, + FSA_COMMAND_UNMOUNT = 0x2, + FSA_COMMAND_GET_VOLUME_INFO = 0x3, + FSA_COMMAND_GET_ATTACH = 0x4, + FSA_COMMAND_CHANGE_DIR = 0x5, + FSA_COMMAND_GET_CWD = 0x6, + FSA_COMMAND_MAKE_DIR = 0x7, + FSA_COMMAND_REMOVE = 0x8, + FSA_COMMAND_RENAME = 0x9, + FSA_COMMAND_OPEN_DIR = 0xA, + FSA_COMMAND_READ_DIR = 0xB, + FSA_COMMAND_REWIND_DIR = 0xC, + FSA_COMMAND_CLOSE_DIR = 0xD, + FSA_COMMAND_OPEN_FILE = 0xE, + FSA_COMMAND_READ_FILE = 0xF, + FSA_COMMAND_WRITE_FILE = 0x10, + FSA_COMMAND_GET_POS_FILE = 0x11, + FSA_COMMAND_SET_POS_FILE = 0x12, + FSA_COMMAND_IS_EOF = 0x13, + FSA_COMMAND_STAT_FILE = 0x14, + FSA_COMMAND_CLOSE_FILE = 0x15, + FSA_COMMAND_GET_ERROR = 0x16, + FSA_COMMAND_FLUSH_FILE = 0x17, + FSA_COMMAND_GET_INFO_BY_QUERY = 0x18, + FSA_COMMAND_APPEND_FILE = 0x19, + FSA_COMMAND_TRUNCATE_FILE = 0x1A, + FSA_COMMAND_FLUSH_VOLUME = 0x1B, + FSA_COMMAND_ROLLBACK_VOLUME = 0x1C, + FSA_COMMAND_MAKE_QUOTA = 0x1D, + FSA_COMMAND_FLUSH_QUOTA = 0x1E, + FSA_COMMAND_ROLLBACK_QUOTA = 0x1F, + FSA_COMMAND_CHANGE_MODE = 0x20, + FSA_COMMAND_OPEN_FILE_BY_STAT = 0x21, + FSA_COMMAND_REGISTER_FLUSH_QUOTA = 0x22, + FSA_COMMAND_FLUSH_MULTI_QUOTA = 0x23, + FSA_COMMAND_GET_FILE_BLOCK_ADDRESS = 0x25, + FSA_COMMAND_ADD_USER_PROCESS = 0x65, + FSA_COMMAND_DEL_USER_PROCESS = 0x66, + FSA_COMMAND_MOUNT_WITH_PROCESS = 0x67, + FSA_COMMAND_UNMOUNT_WITH_PROCESS = 0x68, + FSA_COMMAND_FORMAT = 0x69, + FSA_COMMAND_RAW_OPEN = 0x6A, + FSA_COMMAND_RAW_READ = 0x6B, + FSA_COMMAND_RAW_WRITE = 0x6C, + FSA_COMMAND_RAW_CLOSE = 0x6D, + FSA_COMMAND_GET_LAST_FAILED_VOLUME = 0x6E, + FSA_COMMAND_GET_VOLUME_EXISTENCE = 0x6F, + FSA_COMMAND_CHANGE_OWNER = 0x70, + FSA_COMMAND_CANCEL_GET_ATTACH = 0x71, + FSA_COMMAND_REMOVE_QUOTA = 0x72, + FSA_COMMAND_SET_CLIENT_PRIORITY = 0x73, + FSA_COMMAND_APPLY_MEMORY_CACHE = 0x74, + FSA_COMMAND_MAKE_LINK = 0x75, + FSA_COMMAND_XFER_PARAMS = 0x76, + FSA_COMMAND_EXEC_DEBUG_PROC = 0x78, + FSA_COMMAND_DEBUG_SET_TITLE_ID = 0x79, + FSA_COMMAND_DEBUG_SET_CAPABILITY = 0x7A, + FSA_COMMAND_SET_PROCESS_CONFIG = 0x82, + FSA_COMMAND_CONFIG_SET_MEMORY_CACHE = 0x83, + FSA_COMMAND_CONFIG_UNSET_MEMORY_CACHE = 0x84, + FSA_COMMAND_CONFIG_SET_PRF2_CHAR_CODE = 0x85, + FSA_COMMAND_GET_PROC_RESOURCE_USAGE = 0x8C, + FSA_COMMAND_GET_ALL_RESOURCE_USAGE = 0x8D, + FSA_COMMAND_SEND_PROFILE_CMD = 0x8E, }; -enum FSAIpcRequestTypeEnum { - FSA_IPC_REQUEST_IOCTL = 0, - FSA_IPC_REQUEST_IOCTLV = 1, +enum FSAIpcRequestTypeEnum +{ + FSA_IPC_REQUEST_IOCTL = 0, + FSA_IPC_REQUEST_IOCTLV = 1, }; -struct FSAAsyncResult { - //! Queue to put a message on when command is complete. - OSMessageQueue *ioMsgQueue; +struct FSAAsyncResult +{ + //! Queue to put a message on when command is complete. + OSMessageQueue *ioMsgQueue; - //! Message used for ioMsgQueue. - FSMessage msg; + //! Message used for ioMsgQueue. + FSMessage msg; - //! Callback to call when the command is complete. - FSAAsyncCallbackFn userCallback; + //! Callback to call when the command is complete. + FSAAsyncCallbackFn userCallback; - //! Result. - FSError error; + //! Result. + FSError error; - //! FSA command. - FSACommand command; + //! FSA command. + FSACommand command; - //! Pointer to allocated FSA IPC Request. - FSARequest *request; + //! Pointer to allocated FSA IPC Request. + FSARequest *request; - //! Pointer to allocated FSA IPC Response. - FSAResponse *response; + //! Pointer to allocated FSA IPC Response. + FSAResponse *response; - //! Callback to call when the command is complete. - void *userContext; + //! Callback to call when the command is complete. + void *userContext; }; WUT_CHECK_OFFSET(FSAAsyncResult, 0x00, ioMsgQueue); WUT_CHECK_OFFSET(FSAAsyncResult, 0x04, msg); @@ -830,37 +850,38 @@ WUT_CHECK_OFFSET(FSAAsyncResult, 0x24, response); WUT_CHECK_OFFSET(FSAAsyncResult, 0x28, userContext); WUT_CHECK_SIZE(FSAAsyncResult, 0x2C); -struct WUT_PACKED FSAShimBuffer { - //! Buffer for FSA IPC request. - FSARequest request; - WUT_UNKNOWN_BYTES(0x60); +struct WUT_PACKED FSAShimBuffer +{ + //! Buffer for FSA IPC request. + FSARequest request; + WUT_UNKNOWN_BYTES(0x60); - //! Buffer for FSA IPC response. - FSAResponse response; - WUT_UNKNOWN_BYTES(0x880 - 0x813); + //! Buffer for FSA IPC response. + FSAResponse response; + WUT_UNKNOWN_BYTES(0x880 - 0x813); - //! Memory to use for ioctlv calls, unknown maximum count - but at least 3. - IOSVec ioctlvVec[3]; + //! Memory to use for ioctlv calls, unknown maximum count - but at least 3. + IOSVec ioctlvVec[3]; - WUT_UNKNOWN_BYTES(0x900 - 0x8A4); + WUT_UNKNOWN_BYTES(0x900 - 0x8A4); - //! Command for FSA. - FSACommand command; + //! Command for FSA. + FSACommand command; - //! Handle to FSA device. - uint32_t clientHandle; + //! Handle to FSA device. + uint32_t clientHandle; - //! IOS IPC request type to use. - FSAIpcRequestType ipcReqType; + //! IOS IPC request type to use. + FSAIpcRequestType ipcReqType; - //! Number of ioctlv input vectors. - uint8_t ioctlvVecIn; + //! Number of ioctlv input vectors. + uint8_t ioctlvVecIn; - //! Number of ioctlv output vectors. - uint8_t ioctlvVecOut; + //! Number of ioctlv output vectors. + uint8_t ioctlvVecOut; - //! FSAAsyncResult used for FSA* functions. - FSAAsyncResult fsaAsyncResult; + //! FSAAsyncResult used for FSA* functions. + FSAAsyncResult fsaAsyncResult; }; WUT_CHECK_OFFSET(FSAShimBuffer, 0x0, request); WUT_CHECK_OFFSET(FSAShimBuffer, 0x580, response); @@ -879,31 +900,34 @@ typedef void (*FSAClientAttachAsyncCallbackFn)(FSError result, FSAResponse *response, void *userContext); -struct FSAClientAttachAsyncData { - //! Callback to call when an attach has happened. - FSAClientAttachAsyncCallbackFn userCallback; +struct FSAClientAttachAsyncData +{ + //! Callback to call when an attach has happened. + FSAClientAttachAsyncCallbackFn userCallback; - //! Callback context - void *userContext; + //! Callback context + void *userContext; - //! Queue to put a message on when command is complete. - OSMessageQueue *ioMsgQueue; + //! Queue to put a message on when command is complete. + OSMessageQueue *ioMsgQueue; }; WUT_CHECK_OFFSET(FSAClientAttachAsyncData, 0x00, userCallback); WUT_CHECK_OFFSET(FSAClientAttachAsyncData, 0x04, userContext); WUT_CHECK_OFFSET(FSAClientAttachAsyncData, 0x08, ioMsgQueue); WUT_CHECK_SIZE(FSAClientAttachAsyncData, 0xC); -typedef enum FSAMountFlags { - FSA_MOUNT_FLAG_LOCAL_MOUNT = 0, - FSA_MOUNT_FLAG_BIND_MOUNT = 1, - FSA_MOUNT_FLAG_GLOBAL_MOUNT = 2, +typedef enum FSAMountFlags +{ + FSA_MOUNT_FLAG_LOCAL_MOUNT = 0, + FSA_MOUNT_FLAG_BIND_MOUNT = 1, + FSA_MOUNT_FLAG_GLOBAL_MOUNT = 2, } FSAMountFlags; -typedef enum FSAUnmountFlags { - FSA_UNMOUNT_FLAG_NONE = 0x00000000, - FSA_UNMOUNT_FLAG_FORCE = 0x00000002, - FSA_UNMOUNT_FLAG_BIND_MOUNT = 0x80000000, +typedef enum FSAUnmountFlags +{ + FSA_UNMOUNT_FLAG_NONE = 0x00000000, + FSA_UNMOUNT_FLAG_FORCE = 0x00000002, + FSA_UNMOUNT_FLAG_BIND_MOUNT = 0x80000000, } FSAUnmountFlags; FSError diff --git a/include/coreinit/im.h b/include/coreinit/im.h index cf192a284..ed21c2c73 100644 --- a/include/coreinit/im.h +++ b/include/coreinit/im.h @@ -30,12 +30,12 @@ typedef enum IMPadType typedef enum IMDeviceState { - IM_DEVICE_STATE_CLEAR = 0, - IM_DEVICE_STATE_INACTIVE = 1, - IM_DEVICE_STATE_ACTIVE = 2, - IM_DEVICE_STATE_HOME = 3, - IM_DEVICE_STATE_POWER = 4, - IM_DEVICE_STATE_SYNC = 5, + IM_DEVICE_STATE_CLEAR = 0, + IM_DEVICE_STATE_INACTIVE = 1, + IM_DEVICE_STATE_ACTIVE = 2, + IM_DEVICE_STATE_HOME = 3, + IM_DEVICE_STATE_POWER = 4, + IM_DEVICE_STATE_SYNC = 5, } IMDeviceState; struct WUT_PACKED IMRequest @@ -97,18 +97,18 @@ WUT_CHECK_SIZE(IMDeviceStateEx, 0xC); typedef enum IMParameter { - IM_PARAMETER_INACTIVE_SECONDS = 0, - IM_PARAMETER_DIM_ENABLED = 1, - IM_PARAMETER_DIM_PERIOD = 2, - IM_PARAMETER_APD_ENABLED = 3, - IM_PARAMETER_APD_PERIOD = 4, - IM_PARAMETER_RESET_ENABLE = 5, - IM_PARAMETER_RESET_SECONDS = 6, - IM_PARAMETER_POWER_OFF_ENABLE = 7, - IM_PARAMETER_APD_OCCURED = 8, - IM_PARAMETER_DIM_ENABLE_TV = 9, - IM_PARAMETER_DIM_ENABLE_DRC = 10, - IM_PARAMETER_MAX = 11, + IM_PARAMETER_INACTIVE_SECONDS = 0, + IM_PARAMETER_DIM_ENABLED = 1, + IM_PARAMETER_DIM_PERIOD = 2, + IM_PARAMETER_APD_ENABLED = 3, + IM_PARAMETER_APD_PERIOD = 4, + IM_PARAMETER_RESET_ENABLE = 5, + IM_PARAMETER_RESET_SECONDS = 6, + IM_PARAMETER_POWER_OFF_ENABLE = 7, + IM_PARAMETER_APD_OCCURED = 8, + IM_PARAMETER_DIM_ENABLE_TV = 9, + IM_PARAMETER_DIM_ENABLE_DRC = 10, + IM_PARAMETER_MAX = 11, } IMParameter; typedef enum IMTimer @@ -158,7 +158,7 @@ IM_GetParameter(IOSHandle handle, void *asyncCallbackContext); IOSError -IM_GetParameters(IMParameters* parameters); +IM_GetParameters(IMParameters *parameters); IOSError IM_GetNvParameter(IOSHandle handle, diff --git a/include/coreinit/internal.h b/include/coreinit/internal.h index bd0f08731..e2ae8a80c 100644 --- a/include/coreinit/internal.h +++ b/include/coreinit/internal.h @@ -6,7 +6,7 @@ extern "C" { #endif int -__os_snprintf(char *buf, size_t n, const char *format, ... ); +__os_snprintf(char *buf, size_t n, const char *format, ...); #ifdef __cplusplus } diff --git a/include/coreinit/interrupts.h b/include/coreinit/interrupts.h index aef43dfa2..a83f40063 100644 --- a/include/coreinit/interrupts.h +++ b/include/coreinit/interrupts.h @@ -29,8 +29,8 @@ typedef enum OSInterruptType OS_INTERRUPT_TYPE_AHB = 12 } OSInterruptType; -typedef void(*OSUserInterruptHandler)(OSInterruptType type, OSContext* interruptedContext); - +typedef void (*OSUserInterruptHandler)(OSInterruptType type, OSContext *interruptedContext); + BOOL OSEnableInterrupts(); diff --git a/include/coreinit/ios.h b/include/coreinit/ios.h index 3716e17f3..ea2a46b23 100644 --- a/include/coreinit/ios.h +++ b/include/coreinit/ios.h @@ -16,56 +16,56 @@ typedef int32_t IOSHandle; typedef enum IOSOpenMode { - IOS_OPEN_READ = 1 << 0, - IOS_OPEN_WRITE = 1 << 1, - IOS_OPEN_READWRITE = IOS_OPEN_READ | IOS_OPEN_WRITE, + IOS_OPEN_READ = 1 << 0, + IOS_OPEN_WRITE = 1 << 1, + IOS_OPEN_READWRITE = IOS_OPEN_READ | IOS_OPEN_WRITE, } IOSOpenMode; typedef enum IOSError { - IOS_ERROR_OK = 0, - IOS_ERROR_ACCESS = -1, - IOS_ERROR_EXISTS = -2, - IOS_ERROR_INTR = -3, - IOS_ERROR_INVALID = -4, - IOS_ERROR_MAX = -5, - IOS_ERROR_NOEXISTS = -6, - IOS_ERROR_QEMPTY = -7, - IOS_ERROR_QFULL = -8, - IOS_ERROR_UNKNOWN = -9, - IOS_ERROR_NOTREADY = -10, - IOS_ERROR_ECC = -11, - IOS_ERROR_ECCCRIT = -12, - IOS_ERROR_BADBLOCK = -13, - IOS_ERROR_INVALIDOBJTYPE = -14, - IOS_ERROR_INVALIDRNG = -15, - IOS_ERROR_INVALIDFLAG = -16, - IOS_ERROR_INVALIDFORMAT = -17, - IOS_ERROR_INVALIDVERSION = -18, - IOS_ERROR_INVALIDSIGNER = -19, - IOS_ERROR_FAILCHECKVALUE = -20, - IOS_ERROR_FAILINTERNAL = -21, - IOS_ERROR_FAILALLOC = -22, - IOS_ERROR_INVALIDSIZE = -23, - IOS_ERROR_NOLINK = -24, - IOS_ERROR_ANFAILED = -25, - IOS_ERROR_MAXSEMCOUNT = -26, - IOS_ERROR_SEMUNAVAILABLE = -27, - IOS_ERROR_INVALIDHANDLE = -28, - IOS_ERROR_INVALIDARG = -29, - IOS_ERROR_NORESOURCE = -30, - IOS_ERROR_BUSY = -31, - IOS_ERROR_TIMEOUT = -32, - IOS_ERROR_ALIGNMENT = -33, - IOS_ERROR_BSP = -34, - IOS_ERROR_DATAPENDING = -35, - IOS_ERROR_EXPIRED = -36, - IOS_ERROR_NOREADACCESS = -37, - IOS_ERROR_NOWRITEACCESS = -38, - IOS_ERROR_NOREADWRITEACCESS = -39, - IOS_ERROR_CLIENTTXNLIMIT = -40, - IOS_ERROR_STALEHANDLE = -41, - IOS_ERROR_UNKNOWNVALUE = -42, + IOS_ERROR_OK = 0, + IOS_ERROR_ACCESS = -1, + IOS_ERROR_EXISTS = -2, + IOS_ERROR_INTR = -3, + IOS_ERROR_INVALID = -4, + IOS_ERROR_MAX = -5, + IOS_ERROR_NOEXISTS = -6, + IOS_ERROR_QEMPTY = -7, + IOS_ERROR_QFULL = -8, + IOS_ERROR_UNKNOWN = -9, + IOS_ERROR_NOTREADY = -10, + IOS_ERROR_ECC = -11, + IOS_ERROR_ECCCRIT = -12, + IOS_ERROR_BADBLOCK = -13, + IOS_ERROR_INVALIDOBJTYPE = -14, + IOS_ERROR_INVALIDRNG = -15, + IOS_ERROR_INVALIDFLAG = -16, + IOS_ERROR_INVALIDFORMAT = -17, + IOS_ERROR_INVALIDVERSION = -18, + IOS_ERROR_INVALIDSIGNER = -19, + IOS_ERROR_FAILCHECKVALUE = -20, + IOS_ERROR_FAILINTERNAL = -21, + IOS_ERROR_FAILALLOC = -22, + IOS_ERROR_INVALIDSIZE = -23, + IOS_ERROR_NOLINK = -24, + IOS_ERROR_ANFAILED = -25, + IOS_ERROR_MAXSEMCOUNT = -26, + IOS_ERROR_SEMUNAVAILABLE = -27, + IOS_ERROR_INVALIDHANDLE = -28, + IOS_ERROR_INVALIDARG = -29, + IOS_ERROR_NORESOURCE = -30, + IOS_ERROR_BUSY = -31, + IOS_ERROR_TIMEOUT = -32, + IOS_ERROR_ALIGNMENT = -33, + IOS_ERROR_BSP = -34, + IOS_ERROR_DATAPENDING = -35, + IOS_ERROR_EXPIRED = -36, + IOS_ERROR_NOREADACCESS = -37, + IOS_ERROR_NOWRITEACCESS = -38, + IOS_ERROR_NOREADWRITEACCESS = -39, + IOS_ERROR_CLIENTTXNLIMIT = -40, + IOS_ERROR_STALEHANDLE = -41, + IOS_ERROR_UNKNOWNVALUE = -42, } IOSError; struct IOSVec diff --git a/include/coreinit/ipcbufpool.h b/include/coreinit/ipcbufpool.h index 40065c00a..2b69572af 100644 --- a/include/coreinit/ipcbufpool.h +++ b/include/coreinit/ipcbufpool.h @@ -1,8 +1,8 @@ #pragma once #include -#include "mutex.h" #include "ios.h" +#include "mutex.h" #ifdef __cplusplus extern "C" { @@ -17,21 +17,22 @@ typedef struct IPCBufPool IPCBufPool; * * Functions similar to a ring buffer. */ -struct IPCBufPoolFIFO { - //! The current message index to push to. - int32_t pushIndex; +struct IPCBufPoolFIFO +{ + //! The current message index to push to. + int32_t pushIndex; - //! The current message index to pop from. - int32_t popIndex; + //! The current message index to pop from. + int32_t popIndex; - //! The number of messages in the queue. - int32_t count; + //! The number of messages in the queue. + int32_t count; - //! Tracks the total number of messages in the count. - int32_t maxCount; + //! Tracks the total number of messages in the count. + int32_t maxCount; - //! Messages in the queue. - void **messages; + //! Messages in the queue. + void **messages; }; WUT_CHECK_OFFSET(IPCBufPoolFIFO, 0x00, pushIndex); WUT_CHECK_OFFSET(IPCBufPoolFIFO, 0x04, popIndex); @@ -43,15 +44,16 @@ WUT_CHECK_SIZE(IPCBufPoolFIFO, 0x14); /** * Attributes returned by IPCBufPoolGetAttributes. */ -struct IPCBufPoolAttributes { - //! Size of a message in the buffer pool. - uint32_t messageSize; +struct IPCBufPoolAttributes +{ + //! Size of a message in the buffer pool. + uint32_t messageSize; - //! Size of the buffer pool. - uint32_t poolSize; + //! Size of the buffer pool. + uint32_t poolSize; - //! Number of pending messages in the pool fifo. - uint32_t numMessages; + //! Number of pending messages in the pool fifo. + uint32_t numMessages; }; WUT_CHECK_OFFSET(IPCBufPoolAttributes, 0x00, messageSize); WUT_CHECK_OFFSET(IPCBufPoolAttributes, 0x04, poolSize); @@ -63,41 +65,42 @@ WUT_CHECK_SIZE(IPCBufPoolAttributes, 0x0C); /** * A simple message buffer pool used for IPC communication. */ -struct IPCBufPool { - //! Magic header always set to IPCBufPool::MagicHeader. - uint32_t magic; +struct IPCBufPool +{ + //! Magic header always set to IPCBufPool::MagicHeader. + uint32_t magic; - //! Pointer to buffer used for this IPCBufPool. - void *buffer; + //! Pointer to buffer used for this IPCBufPool. + void *buffer; - //! Size of buffer. - uint32_t size; + //! Size of buffer. + uint32_t size; - uint32_t unk0x0C; - uint32_t unk0x10; + uint32_t unk0x0C; + uint32_t unk0x10; - //! Message size from IPCBufPoolCreate. - uint32_t messageSize0x14; + //! Message size from IPCBufPoolCreate. + uint32_t messageSize0x14; - //! Message size from IPCBufPoolCreate. - uint32_t messageSize0x18; + //! Message size from IPCBufPoolCreate. + uint32_t messageSize0x18; - //! Number of messages in the IPCBufPoolFIFO. - uint32_t messageCount; + //! Number of messages in the IPCBufPoolFIFO. + uint32_t messageCount; - //! Pointer to start of messages. - void *messages; + //! Pointer to start of messages. + void *messages; - //! Number of bytes used for the message pointers in IPCBufPoolFIFO. - uint32_t *messageIndexSize; + //! Number of bytes used for the message pointers in IPCBufPoolFIFO. + uint32_t *messageIndexSize; - //! FIFO queue of messages. - IPCBufPoolFIFO fifo; + //! FIFO queue of messages. + IPCBufPoolFIFO fifo; - //! Mutex used to secure access to fifo. - OSMutex mutex; + //! Mutex used to secure access to fifo. + OSMutex mutex; - WUT_UNKNOWN_BYTES(0x04); + WUT_UNKNOWN_BYTES(0x04); }; WUT_CHECK_OFFSET(IPCBufPool, 0x00, magic); WUT_CHECK_OFFSET(IPCBufPool, 0x04, buffer); diff --git a/include/coreinit/kernel.h b/include/coreinit/kernel.h index 2515db718..577e7f54d 100644 --- a/include/coreinit/kernel.h +++ b/include/coreinit/kernel.h @@ -12,86 +12,90 @@ extern "C" { #endif -typedef enum OSICICommand { - OS_ICI_COMMAND_INVALID_IC_RANGE = 1, - OS_ICI_COMMAND_RESCHEDULE_CORE = 2, - OS_ICI_COMMAND_HALT_CORE = 3, - OS_ICI_COMMAND_PROC_EXIT = 4, - OS_ICI_COMMAND_SET_DABR = 5, - OS_ICI_COMMAND_PROC_SCHED = 6, - OS_ICI_COMMAND_FAST_BG_EXIT = 7, - OS_ICI_COMMAND_IOP_SHELL_CORE_TRACE = 8, - OS_ICI_COMMAND_SYSTEM_FATAL = 9, - OS_ICI_COMMAND_SET_IABR = 10, - OS_ICI_COMMAND_PANIC_0X15 = 0xB, - OS_ICI_COMMAND_PROC_KILL = 0xC, - OS_ICI_COMMAND_PROC_CRASH = 0xD, - OS_ICI_COMMAND_UNKNOWN = 0xE, // Waits for rendezvous, then updates heartbeat - OS_ICI_COMMAND_OVERLAY_ARENA = 0xF, +typedef enum OSICICommand +{ + OS_ICI_COMMAND_INVALID_IC_RANGE = 1, + OS_ICI_COMMAND_RESCHEDULE_CORE = 2, + OS_ICI_COMMAND_HALT_CORE = 3, + OS_ICI_COMMAND_PROC_EXIT = 4, + OS_ICI_COMMAND_SET_DABR = 5, + OS_ICI_COMMAND_PROC_SCHED = 6, + OS_ICI_COMMAND_FAST_BG_EXIT = 7, + OS_ICI_COMMAND_IOP_SHELL_CORE_TRACE = 8, + OS_ICI_COMMAND_SYSTEM_FATAL = 9, + OS_ICI_COMMAND_SET_IABR = 10, + OS_ICI_COMMAND_PANIC_0X15 = 0xB, + OS_ICI_COMMAND_PROC_KILL = 0xC, + OS_ICI_COMMAND_PROC_CRASH = 0xD, + OS_ICI_COMMAND_UNKNOWN = 0xE, // Waits for rendezvous, then updates heartbeat + OS_ICI_COMMAND_OVERLAY_ARENA = 0xF, } OSICICommand; -typedef void (*OSExceptionCallbackExFn)(OSExceptionType exceptionType, OSContext * interruptedContext, OSContext *cbContext); +typedef void (*OSExceptionCallbackExFn)(OSExceptionType exceptionType, OSContext *interruptedContext, OSContext *cbContext); typedef void (*KernelTimerCallbackFn)(OSExceptionType exception, OSContext *interruptedContext, OSContext *currentContext); typedef uint32_t KernelTimerHandle; -typedef struct OSExceptionChainInfo { - OSExceptionCallbackExFn callback; - void *stack; - OSContext *context; +typedef struct OSExceptionChainInfo +{ + OSExceptionCallbackExFn callback; + void *stack; + OSContext *context; } OSExceptionChainInfo; WUT_CHECK_OFFSET(OSExceptionChainInfo, 0, callback); WUT_CHECK_OFFSET(OSExceptionChainInfo, 4, stack); WUT_CHECK_OFFSET(OSExceptionChainInfo, 8, context); WUT_CHECK_SIZE(OSExceptionChainInfo, 12); -typedef struct KernelInfo0 { - struct CoreinitInfo { - void *loaderHandle; - void *textAddr; - uint32_t textOffset; - uint32_t textSize; - void *dataAddr; - uint32_t dataOffset; - uint32_t dataSize; - void *loadAddr; - uint32_t loadOffset; - uint32_t loadSize; - }; - - int32_t upid; - int32_t rampid; - uint32_t appFlags; - void *dataAreaStart; - void *dataAreaEnd; - void *physDataAreaStart; - void *physDataAreaEnd; - void *physAvailStart; - void *physAvailEnd; - void *physCodeGenStart; - void *physCodeGenEnd; - void *sdaBase; - void *sda2Base; - uint32_t systemHeapSize; - void *stackEnd0; - void *stackEnd1; - void *stackEnd2; - void *stackBase0; - void *stackBase1; - void *stackBase2; - void *exceptionStackEnd0; - void *exceptionStackEnd1; - void *exceptionStackEnd2; - void *exceptionStackBase0; - void *exceptionStackBase1; - void *exceptionStackBase2; - void *lockedCacheBase0; - void *lockedCacheBase1; - void *lockedCacheBase2; - struct CoreinitInfo coreinit; - uint32_t unk0x9C; - uint64_t titleId; +typedef struct KernelInfo0 +{ + struct CoreinitInfo + { + void *loaderHandle; + void *textAddr; + uint32_t textOffset; + uint32_t textSize; + void *dataAddr; + uint32_t dataOffset; + uint32_t dataSize; + void *loadAddr; + uint32_t loadOffset; + uint32_t loadSize; + }; + + int32_t upid; + int32_t rampid; + uint32_t appFlags; + void *dataAreaStart; + void *dataAreaEnd; + void *physDataAreaStart; + void *physDataAreaEnd; + void *physAvailStart; + void *physAvailEnd; + void *physCodeGenStart; + void *physCodeGenEnd; + void *sdaBase; + void *sda2Base; + uint32_t systemHeapSize; + void *stackEnd0; + void *stackEnd1; + void *stackEnd2; + void *stackBase0; + void *stackBase1; + void *stackBase2; + void *exceptionStackEnd0; + void *exceptionStackEnd1; + void *exceptionStackEnd2; + void *exceptionStackBase0; + void *exceptionStackBase1; + void *exceptionStackBase2; + void *lockedCacheBase0; + void *lockedCacheBase1; + void *lockedCacheBase2; + struct CoreinitInfo coreinit; + uint32_t unk0x9C; + uint64_t titleId; } KernelInfo0; WUT_CHECK_OFFSET(KernelInfo0, 0x00, upid); WUT_CHECK_OFFSET(KernelInfo0, 0x04, rampid); @@ -127,23 +131,43 @@ WUT_CHECK_OFFSET(KernelInfo0, 0x9C, unk0x9C); WUT_CHECK_OFFSET(KernelInfo0, 0xA0, titleId); WUT_CHECK_SIZE(KernelInfo0, 0xA8); -typedef struct KernelInfo6 { - uint64_t osTitleId; - uint32_t unk0x08; - WUT_PADDING_BYTES(0x108 - 0xC); +typedef struct KernelInfo6 +{ + uint64_t osTitleId; + uint32_t unk0x08; + WUT_PADDING_BYTES(0x108 - 0xC); } KernelInfo6; WUT_CHECK_OFFSET(KernelInfo6, 0x00, osTitleId); WUT_CHECK_OFFSET(KernelInfo6, 0x08, unk0x08); WUT_CHECK_SIZE(KernelInfo6, 0x108); -void __KernelSetUserModeExHandler(OSExceptionType exceptionType, OSExceptionChainInfo *chainInfo, OSExceptionChainInfo *prevChainInfo); - -KernelTimerHandle __KernelAllocateTimer(KernelTimerCallbackFn, void *exceptionStack, OSContext *context); -uint32_t __KernelPrimeTimer(KernelTimerHandle handle, uint64_t startTimeInTicks, uint64_t intervalInTicks, uint32_t unknown); - -void __KernelSendICI(OSICICommand cmd, void *arg1, uint32_t unknown1, uint32_t unknown2); - -void __KernelGetInfo(uint32_t type, void *outBuffer, uint32_t outBufferSize, uint32_t core); +void +__KernelSetUserModeExHandler(OSExceptionType exceptionType, + OSExceptionChainInfo *chainInfo, + OSExceptionChainInfo *prevChainInfo); + +KernelTimerHandle +__KernelAllocateTimer(KernelTimerCallbackFn, + void *exceptionStack, + OSContext *context); + +uint32_t +__KernelPrimeTimer(KernelTimerHandle handle, + uint64_t startTimeInTicks, + uint64_t intervalInTicks, + uint32_t unknown); + +void +__KernelSendICI(OSICICommand cmd, + void *arg1, + uint32_t unknown1, + uint32_t unknown2); + +void +__KernelGetInfo(uint32_t type, + void *outBuffer, + uint32_t outBufferSize, + uint32_t core); static inline void __KernelGetInfo0(KernelInfo0 *outBuffer, uint32_t core) diff --git a/include/coreinit/launch.h b/include/coreinit/launch.h index cf94b3887..951f3b3eb 100644 --- a/include/coreinit/launch.h +++ b/include/coreinit/launch.h @@ -20,7 +20,7 @@ extern "C" { /** * Magic title ID used for triggering a full system reboot. */ -#define OS_TITLE_ID_REBOOT 0xFFFFFFFFFFFFFFFEllu +#define OS_TITLE_ID_REBOOT 0xFFFFFFFFFFFFFFFEllu /** * Forces a OS relaunch on the next title launch. diff --git a/include/coreinit/mcp.h b/include/coreinit/mcp.h index a8865dba8..5b4f2ffb4 100644 --- a/include/coreinit/mcp.h +++ b/include/coreinit/mcp.h @@ -24,74 +24,74 @@ typedef struct MCPTitleListType MCPTitleListType; typedef enum MCPAppType { - MCP_APP_TYPE_GAME_UPDATE = 0x0800001B, - MCP_APP_TYPE_GAME_DLC = 0x0800000E, - MCP_APP_TYPE_BOOT1 = 0x10000009, - MCP_APP_TYPE_SYSTEM_LIBRARIES = 0x1000000A, - MCP_APP_TYPE_BLUETOOTH_FIRMWARE = 0x10000012, - MCP_APP_TYPE_DRC_FIRMWARE = 0x10000013, - MCP_APP_TYPE_DRH_FIRMWARE = 0x10000014, - MCP_APP_TYPE_SYSTEM_VERSION = 0x10000015, - MCP_APP_TYPE_DRC_LANGUAGE = 0x1000001A, - MCP_APP_TYPE_EXCEPTIONS_DATA = 0x18000010, - MCP_APP_TYPE_SHARED_DATA = 0x1800001C, - MCP_APP_TYPE_CERT_STORE = 0x1800001E, - MCP_APP_TYPE_PATCH_MAP_DATA = 0x18000023, - MCP_APP_TYPE_WAGONU_MIGRATION_LIST = 0x18000029, - MCP_APP_TYPE_CAFFEINE_TITLE_LIST = 0x18000030, - MCP_APP_TYPE_MCP_TITLE_LIST = 0x18000031, - MCP_APP_TYPE_GAME = 0x80000000, - MCP_APP_TYPE_GAME_WII = 0x8000002E, - MCP_APP_TYPE_SYSTEM_MENU = 0x90000001, - MCP_APP_TYPE_SYSTEM_UPDATER = 0x9000000B, - MCP_APP_TYPE_SYSTEM_APPS = 0x90000020, - MCP_APP_TYPE_ACCOUNT_APPS = 0x90000021, - MCP_APP_TYPE_SYSTEM_SETTINGS = 0x90000022, - MCP_APP_TYPE_ECO_PROCESS = 0x9000002F, - MCP_APP_TYPE_EMANUAL = 0xD0000003, - MCP_APP_TYPE_HOME_MENU = 0xD0000004, - MCP_APP_TYPE_ERROR_DISPLAY = 0xD0000005, - MCP_APP_TYPE_BROWSER = 0xD0000006, - MCP_APP_TYPE_MIIVERSE_POST = 0xD000000D, - MCP_APP_TYPE_MIIVERSE = 0xD0000016, - MCP_APP_TYPE_ESHOP = 0xD0000017, - MCP_APP_TYPE_FRIEND_LIST = 0xD0000018, - MCP_APP_TYPE_DOWNLOAD_MANAGEMENT = 0xD0000019, - MCP_APP_TYPE_AOC_OVERLAY = 0xD000002C, - MCP_APP_TYPE_AMIIBO_SETTINGS = 0xD0000033, + MCP_APP_TYPE_GAME_UPDATE = 0x0800001B, + MCP_APP_TYPE_GAME_DLC = 0x0800000E, + MCP_APP_TYPE_BOOT1 = 0x10000009, + MCP_APP_TYPE_SYSTEM_LIBRARIES = 0x1000000A, + MCP_APP_TYPE_BLUETOOTH_FIRMWARE = 0x10000012, + MCP_APP_TYPE_DRC_FIRMWARE = 0x10000013, + MCP_APP_TYPE_DRH_FIRMWARE = 0x10000014, + MCP_APP_TYPE_SYSTEM_VERSION = 0x10000015, + MCP_APP_TYPE_DRC_LANGUAGE = 0x1000001A, + MCP_APP_TYPE_EXCEPTIONS_DATA = 0x18000010, + MCP_APP_TYPE_SHARED_DATA = 0x1800001C, + MCP_APP_TYPE_CERT_STORE = 0x1800001E, + MCP_APP_TYPE_PATCH_MAP_DATA = 0x18000023, + MCP_APP_TYPE_WAGONU_MIGRATION_LIST = 0x18000029, + MCP_APP_TYPE_CAFFEINE_TITLE_LIST = 0x18000030, + MCP_APP_TYPE_MCP_TITLE_LIST = 0x18000031, + MCP_APP_TYPE_GAME = 0x80000000, + MCP_APP_TYPE_GAME_WII = 0x8000002E, + MCP_APP_TYPE_SYSTEM_MENU = 0x90000001, + MCP_APP_TYPE_SYSTEM_UPDATER = 0x9000000B, + MCP_APP_TYPE_SYSTEM_APPS = 0x90000020, + MCP_APP_TYPE_ACCOUNT_APPS = 0x90000021, + MCP_APP_TYPE_SYSTEM_SETTINGS = 0x90000022, + MCP_APP_TYPE_ECO_PROCESS = 0x9000002F, + MCP_APP_TYPE_EMANUAL = 0xD0000003, + MCP_APP_TYPE_HOME_MENU = 0xD0000004, + MCP_APP_TYPE_ERROR_DISPLAY = 0xD0000005, + MCP_APP_TYPE_BROWSER = 0xD0000006, + MCP_APP_TYPE_MIIVERSE_POST = 0xD000000D, + MCP_APP_TYPE_MIIVERSE = 0xD0000016, + MCP_APP_TYPE_ESHOP = 0xD0000017, + MCP_APP_TYPE_FRIEND_LIST = 0xD0000018, + MCP_APP_TYPE_DOWNLOAD_MANAGEMENT = 0xD0000019, + MCP_APP_TYPE_AOC_OVERLAY = 0xD000002C, + MCP_APP_TYPE_AMIIBO_SETTINGS = 0xD0000033, } MCPAppType; typedef enum MCPDeviceType { - MCP_DEVICE_TYPE_AUTO = 1, /* returns result for ODD, MLC and USB */ - MCP_DEVICE_TYPE_ODD = 2, - MCP_DEVICE_TYPE_MLC = 3, - MCP_DEVICE_TYPE_USB = 4, + MCP_DEVICE_TYPE_AUTO = 1, /* returns result for ODD, MLC and USB */ + MCP_DEVICE_TYPE_ODD = 2, + MCP_DEVICE_TYPE_MLC = 3, + MCP_DEVICE_TYPE_USB = 4, /* any value >= 5 is MCP_DEVICE_TYPE_AUTO */ } MCPDeviceType; typedef enum MCPDeviceFlags { - MCP_DEVICE_FLAG_UNK_1 = 0x1, - MCP_DEVICE_FLAG_UNK_2 = 0x2, - MCP_DEVICE_FLAG_UNK_4 = 0x4, - MCP_DEVICE_FLAG_UNK_8 = 0x8, + MCP_DEVICE_FLAG_UNK_1 = 0x1, + MCP_DEVICE_FLAG_UNK_2 = 0x2, + MCP_DEVICE_FLAG_UNK_4 = 0x4, + MCP_DEVICE_FLAG_UNK_8 = 0x8, } MCPDeviceFlags; typedef enum MCPInstallTarget { - MCP_INSTALL_TARGET_MLC = 0, - MCP_INSTALL_TARGET_USB = 1, + MCP_INSTALL_TARGET_MLC = 0, + MCP_INSTALL_TARGET_USB = 1, } MCPInstallTarget; typedef enum MCPRegion { - MCP_REGION_JAPAN = 0x01, - MCP_REGION_USA = 0x02, - MCP_REGION_EUROPE = 0x04, - MCP_REGION_CHINA = 0x10, - MCP_REGION_KOREA = 0x20, - MCP_REGION_TAIWAN = 0x40, + MCP_REGION_JAPAN = 0x01, + MCP_REGION_USA = 0x02, + MCP_REGION_EUROPE = 0x04, + MCP_REGION_CHINA = 0x10, + MCP_REGION_KOREA = 0x20, + MCP_REGION_TAIWAN = 0x40, } MCPRegion; typedef enum MCPCompatAVFile @@ -382,8 +382,9 @@ MCP_ChangeEcoSettings(int32_t handle, uint32_t maxOnTime, uint16_t defaultOffTime); -static inline const char* -MCP_GetDeviceNameByDeviceType(MCPDeviceType deviceType) { +static inline const char * +MCP_GetDeviceNameByDeviceType(MCPDeviceType deviceType) +{ switch (deviceType) { case MCP_DEVICE_TYPE_AUTO: return "auto"; diff --git a/include/coreinit/memallocator.h b/include/coreinit/memallocator.h index 8e9c2ffad..03e17c418 100644 --- a/include/coreinit/memallocator.h +++ b/include/coreinit/memallocator.h @@ -17,17 +17,18 @@ extern "C" { typedef struct MEMAllocatorFunctions MEMAllocatorFunctions; typedef struct MEMAllocator MEMAllocator; -typedef void * (*MEMAllocatorAllocFn)(MEMAllocator *allocator, uint32_t size); -typedef void (*MEMAllocatorFreeFn) (MEMAllocator *allocator, void *ptr); +typedef void *(*MEMAllocatorAllocFn)(MEMAllocator *allocator, uint32_t size); +typedef void (*MEMAllocatorFreeFn)(MEMAllocator *allocator, void *ptr); //! Holds context information that will be used to allocate and free memory. -struct MEMAllocator { +struct MEMAllocator +{ //! Points to the alloc/free functions. MEMAllocatorFunctions *funcs; //! The heap handle. - MEMHeapHandle heap; + MEMHeapHandle heap; //! The alignment the allocator will use. - uint32_t align; + uint32_t align; WUT_UNKNOWN_BYTES(4); }; WUT_CHECK_OFFSET(MEMAllocator, 0x0, funcs); @@ -36,9 +37,10 @@ WUT_CHECK_OFFSET(MEMAllocator, 0x8, align); WUT_CHECK_SIZE(MEMAllocator, 0x10); //! The alloc/free functions. -struct MEMAllocatorFunctions { +struct MEMAllocatorFunctions +{ MEMAllocatorAllocFn alloc; - MEMAllocatorFreeFn free; + MEMAllocatorFreeFn free; }; WUT_CHECK_OFFSET(MEMAllocatorFunctions, 0x0, alloc); WUT_CHECK_OFFSET(MEMAllocatorFunctions, 0x4, free); diff --git a/include/coreinit/memexpheap.h b/include/coreinit/memexpheap.h index 1d6fe1e0d..a218e4450 100644 --- a/include/coreinit/memexpheap.h +++ b/include/coreinit/memexpheap.h @@ -16,25 +16,24 @@ typedef struct MEMExpHeap MEMExpHeap; typedef struct MEMExpHeapBlock MEMExpHeapBlock; typedef struct MEMExpHeapBlockList MEMExpHeapBlockList; -typedef void (*MEMExpHeapBlockVisitor)(void *block, MEMHeapHandle heap, - void *context); +typedef void (*MEMExpHeapBlockVisitor)(void *block, MEMHeapHandle heap, void *context); typedef enum MEMExpHeapMode { - MEM_EXP_HEAP_MODE_FIRST_FREE = 0, - MEM_EXP_HEAP_MODE_NEAREST_SIZE = 1, + MEM_EXP_HEAP_MODE_FIRST_FREE = 0, + MEM_EXP_HEAP_MODE_NEAREST_SIZE = 1, } MEMExpHeapMode; typedef enum MEMExpHeapDirection { - MEM_EXP_HEAP_DIR_FROM_TOP = 0, - MEM_EXP_HEAP_DIR_FROM_BOTTOM = 1, + MEM_EXP_HEAP_DIR_FROM_TOP = 0, + MEM_EXP_HEAP_DIR_FROM_BOTTOM = 1, } MEMExpHeapDirection; typedef enum MEMExpHeapCheckFlags { - MEM_EXP_HEAP_CHECK_FLAGS_NONE = 0, - MEM_EXP_HEAP_CHECK_FLAGS_LOG_ERRORS = 1, + MEM_EXP_HEAP_CHECK_FLAGS_NONE = 0, + MEM_EXP_HEAP_CHECK_FLAGS_LOG_ERRORS = 1, } MEMExpHeapCheckFlags; struct MEMExpHeapBlock diff --git a/include/coreinit/memfrmheap.h b/include/coreinit/memfrmheap.h index 731286095..ee816d94e 100644 --- a/include/coreinit/memfrmheap.h +++ b/include/coreinit/memfrmheap.h @@ -14,9 +14,9 @@ extern "C" { typedef enum MEMFrmHeapFreeMode { - MEM_FRM_HEAP_FREE_HEAD = 1 << 0, - MEM_FRM_HEAP_FREE_TAIL = 1 << 1, - MEM_FRM_HEAP_FREE_ALL = MEM_FRM_HEAP_FREE_HEAD | MEM_FRM_HEAP_FREE_TAIL, + MEM_FRM_HEAP_FREE_HEAD = 1 << 0, + MEM_FRM_HEAP_FREE_TAIL = 1 << 1, + MEM_FRM_HEAP_FREE_ALL = MEM_FRM_HEAP_FREE_HEAD | MEM_FRM_HEAP_FREE_TAIL, } MEMFrmHeapFreeMode; typedef struct MEMFrmHeap MEMFrmHeap; diff --git a/include/coreinit/memheap.h b/include/coreinit/memheap.h index a9e17001e..ae9ecd125 100644 --- a/include/coreinit/memheap.h +++ b/include/coreinit/memheap.h @@ -1,7 +1,7 @@ #pragma once #include -#include "spinlock.h" #include "memlist.h" +#include "spinlock.h" /** * \defgroup coreinit_memheap Common Memory Heap @@ -20,9 +20,9 @@ typedef MEMHeapHeader *MEMHeapHandle; typedef enum MEMBaseHeapType { - MEM_BASE_HEAP_MEM1 = 0, - MEM_BASE_HEAP_MEM2 = 1, - MEM_BASE_HEAP_FG = 8, + MEM_BASE_HEAP_MEM1 = 0, + MEM_BASE_HEAP_MEM2 = 1, + MEM_BASE_HEAP_FG = 8, } MEMBaseHeapType; typedef enum MEMHeapFillType @@ -34,18 +34,18 @@ typedef enum MEMHeapFillType typedef enum MEMHeapTag { - MEM_BLOCK_HEAP_TAG = 0x424C4B48u, - MEM_EXPANDED_HEAP_TAG = 0x45585048u, - MEM_FRAME_HEAP_TAG = 0x46524D48u, - MEM_UNIT_HEAP_TAG = 0x554E5448u, - MEM_USER_HEAP_TAG = 0x55535248u, + MEM_BLOCK_HEAP_TAG = 0x424C4B48u, + MEM_EXPANDED_HEAP_TAG = 0x45585048u, + MEM_FRAME_HEAP_TAG = 0x46524D48u, + MEM_UNIT_HEAP_TAG = 0x554E5448u, + MEM_USER_HEAP_TAG = 0x55535248u, } MEMHeapTag; typedef enum MEMHeapFlags { - MEM_HEAP_FLAG_ZERO_ALLOCATED = 1 << 0, - MEM_HEAP_FLAG_DEBUG_MODE = 1 << 1, - MEM_HEAP_FLAG_USE_LOCK = 1 << 2, + MEM_HEAP_FLAG_ZERO_ALLOCATED = 1 << 0, + MEM_HEAP_FLAG_DEBUG_MODE = 1 << 1, + MEM_HEAP_FLAG_USE_LOCK = 1 << 2, } MEMHeapFlags; struct MEMHeapHeader diff --git a/include/coreinit/memory.h b/include/coreinit/memory.h index cc0e047e1..d47d8ac6d 100644 --- a/include/coreinit/memory.h +++ b/include/coreinit/memory.h @@ -20,11 +20,11 @@ typedef enum OSMemoryType typedef enum OSSharedDataType { - OS_SHAREDDATATYPE_FONT_CHINESE = 0, - OS_SHAREDDATATYPE_FONT_KOREAN = 1, - OS_SHAREDDATATYPE_FONT_STANDARD = 2, - OS_SHAREDDATATYPE_FONT_TAIWANESE = 3, - OS_SHAREDDATATYPE_FONT_MAX = 4, + OS_SHAREDDATATYPE_FONT_CHINESE = 0, + OS_SHAREDDATATYPE_FONT_KOREAN = 1, + OS_SHAREDDATATYPE_FONT_STANDARD = 2, + OS_SHAREDDATATYPE_FONT_TAIWANESE = 3, + OS_SHAREDDATATYPE_FONT_MAX = 4, } OSSharedDataType; BOOL diff --git a/include/coreinit/memorymap.h b/include/coreinit/memorymap.h index 261a0e555..bf8671c9b 100644 --- a/include/coreinit/memorymap.h +++ b/include/coreinit/memorymap.h @@ -14,11 +14,11 @@ extern "C" { typedef enum OSMemoryMapMode { - OS_MAP_MEMORY_INVALID = 0, - OS_MAP_MEMORY_READ_ONLY = 1, - OS_MAP_MEMORY_READ_WRITE = 2, - OS_MAP_MEMORY_FREE = 3, - OS_MAP_MEMORY_ALLOCATED = 4, + OS_MAP_MEMORY_INVALID = 0, + OS_MAP_MEMORY_READ_ONLY = 1, + OS_MAP_MEMORY_READ_WRITE = 2, + OS_MAP_MEMORY_FREE = 3, + OS_MAP_MEMORY_ALLOCATED = 4, } OSMemoryMapMode; #define OS_PAGE_SIZE (128 * 1024) diff --git a/include/coreinit/messagequeue.h b/include/coreinit/messagequeue.h index 0b0c29200..19665b2e5 100644 --- a/include/coreinit/messagequeue.h +++ b/include/coreinit/messagequeue.h @@ -17,24 +17,24 @@ typedef struct OSMessageQueue OSMessageQueue; typedef enum OSMessageFlags { - OS_MESSAGE_FLAGS_NONE = 0, - OS_MESSAGE_FLAGS_BLOCKING = 1 << 0, - OS_MESSAGE_FLAGS_HIGH_PRIORITY = 1 << 1, + OS_MESSAGE_FLAGS_NONE = 0, + OS_MESSAGE_FLAGS_BLOCKING = 1 << 0, + OS_MESSAGE_FLAGS_HIGH_PRIORITY = 1 << 1, } OSMessageFlags; typedef enum OSFunctionType { - OS_FUNCTION_TYPE_HIO_OPEN = 1, - OS_FUNCTION_TYPE_HIO_READ_ASYNC = 2, - OS_FUNCTION_TYPE_HIO_WRITE_ASYNC = 3, - OS_FUNCTION_TYPE_FSA_CMD_ASYNC = 4, - OS_FUNCTION_TYPE_FSA_PR_CMD_ASYNC = 5, - OS_FUNCTION_TYPE_FSA_PR_CMD_ASYNC_NO_ALLOC = 6, - OS_FUNCTION_TYPE_FSA_ATTACH_EVENT = 7, - OS_FUNCTION_TYPE_FS_CMD_ASYNC = 8, - OS_FUNCTION_TYPE_FS_CMD_HANDLER = 9, - OS_FUNCTION_TYPE_FS_ATTACH_EVENT = 10, - OS_FUNCTION_TYPE_FS_STATE_CHANGE_EVENT = 11, + OS_FUNCTION_TYPE_HIO_OPEN = 1, + OS_FUNCTION_TYPE_HIO_READ_ASYNC = 2, + OS_FUNCTION_TYPE_HIO_WRITE_ASYNC = 3, + OS_FUNCTION_TYPE_FSA_CMD_ASYNC = 4, + OS_FUNCTION_TYPE_FSA_PR_CMD_ASYNC = 5, + OS_FUNCTION_TYPE_FSA_PR_CMD_ASYNC_NO_ALLOC = 6, + OS_FUNCTION_TYPE_FSA_ATTACH_EVENT = 7, + OS_FUNCTION_TYPE_FS_CMD_ASYNC = 8, + OS_FUNCTION_TYPE_FS_CMD_HANDLER = 9, + OS_FUNCTION_TYPE_FS_ATTACH_EVENT = 10, + OS_FUNCTION_TYPE_FS_STATE_CHANGE_EVENT = 11, } OSFunctionType; struct OSMessage diff --git a/include/coreinit/performancemonitor.h b/include/coreinit/performancemonitor.h index 248626c57..90f2261b3 100644 --- a/include/coreinit/performancemonitor.h +++ b/include/coreinit/performancemonitor.h @@ -15,13 +15,14 @@ extern "C" { /// Used to tell OSSetPerformanceMonitor() which arguments are valid. -typedef enum OSPerfMonArg { - OS_PM_ARG_MMCR0 = 1u << 0u, - OS_PM_ARG_MMCR1 = 1u << 1u, - OS_PM_ARG_PMC1 = 1u << 2u, - OS_PM_ARG_PMC2 = 1u << 3u, - OS_PM_ARG_PMC3 = 1u << 4u, - OS_PM_ARG_PMC4 = 1u << 5u, +typedef enum OSPerfMonArg +{ + OS_PM_ARG_MMCR0 = 1u << 0u, + OS_PM_ARG_MMCR1 = 1u << 1u, + OS_PM_ARG_PMC1 = 1u << 2u, + OS_PM_ARG_PMC2 = 1u << 3u, + OS_PM_ARG_PMC3 = 1u << 4u, + OS_PM_ARG_PMC4 = 1u << 5u, } OSPerfMonArg; /** @@ -29,49 +30,50 @@ typedef enum OSPerfMonArg { * * \sa OSSetPerformanceMonitor */ -typedef enum OSPerfMonMMCR0Flags { - OS_PM_MMCR0_PMC1_CURRENT = 0b0000000u << 6, - OS_PM_MMCR0_PMC1_CPU_CYCLES = 0b0000001u << 6, - OS_PM_MMCR0_PMC1_INSTRUCTIONS_COMPLETED = 0b0000010u << 6, - OS_PM_MMCR0_PMC1_TBL_RISING_TRANSITIONS = 0b0000011u << 6, - OS_PM_MMCR0_PMC1_INSTRUCTIONS_DISPATCHED = 0b0000100u << 6, - OS_PM_MMCR0_PMC1_EIEIO_INSTRUCTIONS_COMPLETED = 0b0000101u << 6, - OS_PM_MMCR0_PMC1_ITLB_SEARCH_CYCLES = 0b0000110u << 6, - OS_PM_MMCR0_PMC1_L2_HITS = 0b0000111u << 6, - OS_PM_MMCR0_PMC1_INSTRUCTIONS_EA_DELIVERED = 0b0001000u << 6, - OS_PM_MMCR0_PMC1_INSTRUCTIONS_COMPLETED_MATCHES_IABR = 0b0001001u << 6, - OS_PM_MMCR0_PMC1_SLOW_L1_MISSES = 0b0001010u << 6, - OS_PM_MMCR0_PMC1_UNRESOLVED_BRANCHES = 0b0001011u << 6, - OS_PM_MMCR0_PMC1_UNRESOLVED_STALL_CYCLES = 0b0001100u << 6, - OS_PM_MMCR0_PMC1_L1_SHARED_STORES = 0b0001110u << 6, - OS_PM_MMCR0_PMC1_L2_SHARED_INTERVENTIONS = 0b0001111u << 6, - OS_PM_MMCR0_PMC1_CACHE_PARADOXES = 0b0010000u << 6, - OS_PM_MMCR0_PMC1_CIU_LOAD_REQUESTS = 0b0010100u << 6, - OS_PM_MMCR0_PMC1_BIU_ADDRESS_ONLY_REQUESTS = 0b0010101u << 6, - OS_PM_MMCR0_PMC1_CIU_PARADOXES = 0b0010110u << 6, - OS_PM_MMCR0_PMC1_60XE_BUS_DATA_BEATS = 0b0010111u << 6, - - OS_PM_MMCR0_PMC2_CURRENT = 0b000000u, - OS_PM_MMCR0_PMC2_CPU_CYCLES = 0b000001u, - OS_PM_MMCR0_PMC2_INSTRUCTIONS_COMPLETED = 0b000010u, - OS_PM_MMCR0_PMC2_TBL_RISING_TRANSITIONS = 0b000011u, - OS_PM_MMCR0_PMC2_INSTRUCTIONS_DISPATCHED = 0b000100u, - OS_PM_MMCR0_PMC2_L1_ICACHE_MISSES = 0b000101u, - OS_PM_MMCR0_PMC2_ITLB_MISSES = 0b000110u, - OS_PM_MMCR0_PMC2_L2_INSTRUCTION_MISSES = 0b000111u, - OS_PM_MMCR0_PMC2_PRED_BRANCHES_NOT_TAKEN = 0b001000u, - OS_PM_MMCR0_PMC2_RESERVED_LOADS = 0b001010u, - OS_PM_MMCR0_PMC2_LOADS_AND_STORES = 0b001011u, - OS_PM_MMCR0_PMC2_CACHE_SNOOPS = 0b001100u, - OS_PM_MMCR0_PMC2_L1_TO_L2_CASTOUTS = 0b001101u, - OS_PM_MMCR0_PMC2_SYSTEM_UNIT_INSTRUCTIONS = 0b001110u, - OS_PM_MMCR0_PMC2_L1_INSTRUCTION_MISS_CYCLES = 0b001111u, - OS_PM_MMCR0_PMC2_FIRST_SPECULATIVE_BRANCH_RESOLVES = 0b010000u, - OS_PM_MMCR0_PMC2_L2_SHARED_STORES = 0b010001u, - OS_PM_MMCR0_PMC2_L1_SHARED_INTERVENTIONS = 0b010010u, - OS_PM_MMCR0_PMC2_CIU_STORE_REQUESTS = 0b010100u, - OS_PM_MMCR0_PMC2_SLOW_OUTSTANDING_BIU_TRANSACTIONS = 0b010101u, - OS_PM_MMCR0_PMC2_CIU_MODIFIED_INTERVENTIONS = 0b010110u, +typedef enum OSPerfMonMMCR0Flags +{ + OS_PM_MMCR0_PMC1_CURRENT = 0b0000000u << 6, + OS_PM_MMCR0_PMC1_CPU_CYCLES = 0b0000001u << 6, + OS_PM_MMCR0_PMC1_INSTRUCTIONS_COMPLETED = 0b0000010u << 6, + OS_PM_MMCR0_PMC1_TBL_RISING_TRANSITIONS = 0b0000011u << 6, + OS_PM_MMCR0_PMC1_INSTRUCTIONS_DISPATCHED = 0b0000100u << 6, + OS_PM_MMCR0_PMC1_EIEIO_INSTRUCTIONS_COMPLETED = 0b0000101u << 6, + OS_PM_MMCR0_PMC1_ITLB_SEARCH_CYCLES = 0b0000110u << 6, + OS_PM_MMCR0_PMC1_L2_HITS = 0b0000111u << 6, + OS_PM_MMCR0_PMC1_INSTRUCTIONS_EA_DELIVERED = 0b0001000u << 6, + OS_PM_MMCR0_PMC1_INSTRUCTIONS_COMPLETED_MATCHES_IABR = 0b0001001u << 6, + OS_PM_MMCR0_PMC1_SLOW_L1_MISSES = 0b0001010u << 6, + OS_PM_MMCR0_PMC1_UNRESOLVED_BRANCHES = 0b0001011u << 6, + OS_PM_MMCR0_PMC1_UNRESOLVED_STALL_CYCLES = 0b0001100u << 6, + OS_PM_MMCR0_PMC1_L1_SHARED_STORES = 0b0001110u << 6, + OS_PM_MMCR0_PMC1_L2_SHARED_INTERVENTIONS = 0b0001111u << 6, + OS_PM_MMCR0_PMC1_CACHE_PARADOXES = 0b0010000u << 6, + OS_PM_MMCR0_PMC1_CIU_LOAD_REQUESTS = 0b0010100u << 6, + OS_PM_MMCR0_PMC1_BIU_ADDRESS_ONLY_REQUESTS = 0b0010101u << 6, + OS_PM_MMCR0_PMC1_CIU_PARADOXES = 0b0010110u << 6, + OS_PM_MMCR0_PMC1_60XE_BUS_DATA_BEATS = 0b0010111u << 6, + + OS_PM_MMCR0_PMC2_CURRENT = 0b000000u, + OS_PM_MMCR0_PMC2_CPU_CYCLES = 0b000001u, + OS_PM_MMCR0_PMC2_INSTRUCTIONS_COMPLETED = 0b000010u, + OS_PM_MMCR0_PMC2_TBL_RISING_TRANSITIONS = 0b000011u, + OS_PM_MMCR0_PMC2_INSTRUCTIONS_DISPATCHED = 0b000100u, + OS_PM_MMCR0_PMC2_L1_ICACHE_MISSES = 0b000101u, + OS_PM_MMCR0_PMC2_ITLB_MISSES = 0b000110u, + OS_PM_MMCR0_PMC2_L2_INSTRUCTION_MISSES = 0b000111u, + OS_PM_MMCR0_PMC2_PRED_BRANCHES_NOT_TAKEN = 0b001000u, + OS_PM_MMCR0_PMC2_RESERVED_LOADS = 0b001010u, + OS_PM_MMCR0_PMC2_LOADS_AND_STORES = 0b001011u, + OS_PM_MMCR0_PMC2_CACHE_SNOOPS = 0b001100u, + OS_PM_MMCR0_PMC2_L1_TO_L2_CASTOUTS = 0b001101u, + OS_PM_MMCR0_PMC2_SYSTEM_UNIT_INSTRUCTIONS = 0b001110u, + OS_PM_MMCR0_PMC2_L1_INSTRUCTION_MISS_CYCLES = 0b001111u, + OS_PM_MMCR0_PMC2_FIRST_SPECULATIVE_BRANCH_RESOLVES = 0b010000u, + OS_PM_MMCR0_PMC2_L2_SHARED_STORES = 0b010001u, + OS_PM_MMCR0_PMC2_L1_SHARED_INTERVENTIONS = 0b010010u, + OS_PM_MMCR0_PMC2_CIU_STORE_REQUESTS = 0b010100u, + OS_PM_MMCR0_PMC2_SLOW_OUTSTANDING_BIU_TRANSACTIONS = 0b010101u, + OS_PM_MMCR0_PMC2_CIU_MODIFIED_INTERVENTIONS = 0b010110u, } OSPerfMonMMCR0Flags; /** @@ -79,48 +81,49 @@ typedef enum OSPerfMonMMCR0Flags { * * \sa OSSetPerformanceMonitor */ -typedef enum OSPerfMonMMCR1Flags { - OS_PM_MMCR1_PMC3_CURRENT = 0b00000u << 27, - OS_PM_MMCR1_PMC3_CPU_CYCLES = 0b00001u << 27, - OS_PM_MMCR1_PMC3_INSTRUCTIONS_COMPLETED = 0b00010u << 27, - OS_PM_MMCR1_PMC3_TBL_RISING_TRANSITIONS = 0b00011u << 27, - OS_PM_MMCR1_PMC3_INSTRUCTIONS_DISPATCHED = 0b00100u << 27, - OS_PM_MMCR1_PMC3_L1_DCACHE_MISSES = 0b00101u << 27, - OS_PM_MMCR1_PMC3_DTLB_MISSES = 0b00110u << 27, - OS_PM_MMCR1_PMC3_L2_DATA_MISSES = 0b00111u << 27, - OS_PM_MMCR1_PMC3_PRED_BRANCHES_TAKEN = 0b01000u << 27, - OS_PM_MMCR1_PMC3_COND_STORES_COMPLETED = 0b01010u << 27, - OS_PM_MMCR1_PMC3_FPU_INSTRUCTIONS_COMPLETED = 0b01011u << 27, - OS_PM_MMCR1_PMC3_L2_CASTOUTS_BY_SNOOPS = 0b01100u << 27, - OS_PM_MMCR1_PMC3_L2_CACHE_OPERATIONS = 0b01101u << 27, - OS_PM_MMCR1_PMC3_L1_LOAD_MISS_CYCLES = 0b01111u << 27, - OS_PM_MMCR1_PMC3_SECOND_SPECULATIVE_BRANCH_RESOLVES = 0b10000u << 27, - OS_PM_MMCR1_PMC3_BPU_STALL_LR_CR_CYCLES = 0b10001u << 27, - OS_PM_MMCR1_PMC3_L1_MODIFIED_INTERVENTIONS = 0b10010u << 27, - OS_PM_MMCR1_PMC3_ICBI_SNOOPS = 0b10011u << 27, - OS_PM_MMCR1_PMC3_CIU_ADDRESS_ONLY_REQUESTS = 0b10100u << 27, - OS_PM_MMCR1_PMC3_BIU_LOAD_REQUESTS = 0b10101u << 27, - OS_PM_MMCR1_PMC3_CIU_SHARED_INTERVENTIONS = 0b10110u << 27, - - OS_PM_MMCR1_PMC4_CURRENT = 0b00000u << 22, - OS_PM_MMCR1_PMC4_CPU_CYCLES = 0b00001u << 22, - OS_PM_MMCR1_PMC4_INSTRUCTIONS_COMPLETED = 0b00010u << 22, - OS_PM_MMCR1_PMC4_TBL_RISING_TRANSITIONS = 0b00011u << 22, - OS_PM_MMCR1_PMC4_INSTRUCTIONS_DISPATCHED = 0b00100u << 22, - OS_PM_MMCR1_PMC4_L2_CASTOUTS = 0b00101u << 22, - OS_PM_MMCR1_PMC4_DTLB_SEARCH_CYCLES = 0b00110u << 22, - OS_PM_MMCR1_PMC4_BRANCHES_MISPREDICTED = 0b01000u << 22, - OS_PM_MMCR1_PMC4_INTACT_COND_STORES_COMPLETED = 0b01010u << 22, - OS_PM_MMCR1_PMC4_SYNC_INSTRUCTIONS_COMPLETED = 0b01011u << 22, - OS_PM_MMCR1_PMC4_SNOOP_RETRIES = 0b01100u << 22, - OS_PM_MMCR1_PMC4_INTEGER_OPERATIONS = 0b01101u << 22, - OS_PM_MMCR1_PMC4_BPU_STALL_TWO_BRANCHES_CYCLES = 0b01110u << 22, - OS_PM_MMCR1_PMC4_L2_MODIFIED_INTERVENTIONS = 0b10000u << 22, - OS_PM_MMCR1_PMC4_TLBIE_SNOOPS = 0b10001u << 22, - OS_PM_MMCR1_PMC4_L2_BANK_REFRESH_OVERFLOWS = 0b10010u << 22, - OS_PM_MMCR1_PMC4_CIU_ARTRY_COUNT = 0b10100u << 22, - OS_PM_MMCR1_PMC4_BIU_STORE_REQUESTS = 0b10101u << 22, - OS_PM_MMCR1_PMC4_CIU_TWO_CORE_SHARED_INTERVENTIONS = 0b10110u << 22, +typedef enum OSPerfMonMMCR1Flags +{ + OS_PM_MMCR1_PMC3_CURRENT = 0b00000u << 27, + OS_PM_MMCR1_PMC3_CPU_CYCLES = 0b00001u << 27, + OS_PM_MMCR1_PMC3_INSTRUCTIONS_COMPLETED = 0b00010u << 27, + OS_PM_MMCR1_PMC3_TBL_RISING_TRANSITIONS = 0b00011u << 27, + OS_PM_MMCR1_PMC3_INSTRUCTIONS_DISPATCHED = 0b00100u << 27, + OS_PM_MMCR1_PMC3_L1_DCACHE_MISSES = 0b00101u << 27, + OS_PM_MMCR1_PMC3_DTLB_MISSES = 0b00110u << 27, + OS_PM_MMCR1_PMC3_L2_DATA_MISSES = 0b00111u << 27, + OS_PM_MMCR1_PMC3_PRED_BRANCHES_TAKEN = 0b01000u << 27, + OS_PM_MMCR1_PMC3_COND_STORES_COMPLETED = 0b01010u << 27, + OS_PM_MMCR1_PMC3_FPU_INSTRUCTIONS_COMPLETED = 0b01011u << 27, + OS_PM_MMCR1_PMC3_L2_CASTOUTS_BY_SNOOPS = 0b01100u << 27, + OS_PM_MMCR1_PMC3_L2_CACHE_OPERATIONS = 0b01101u << 27, + OS_PM_MMCR1_PMC3_L1_LOAD_MISS_CYCLES = 0b01111u << 27, + OS_PM_MMCR1_PMC3_SECOND_SPECULATIVE_BRANCH_RESOLVES = 0b10000u << 27, + OS_PM_MMCR1_PMC3_BPU_STALL_LR_CR_CYCLES = 0b10001u << 27, + OS_PM_MMCR1_PMC3_L1_MODIFIED_INTERVENTIONS = 0b10010u << 27, + OS_PM_MMCR1_PMC3_ICBI_SNOOPS = 0b10011u << 27, + OS_PM_MMCR1_PMC3_CIU_ADDRESS_ONLY_REQUESTS = 0b10100u << 27, + OS_PM_MMCR1_PMC3_BIU_LOAD_REQUESTS = 0b10101u << 27, + OS_PM_MMCR1_PMC3_CIU_SHARED_INTERVENTIONS = 0b10110u << 27, + + OS_PM_MMCR1_PMC4_CURRENT = 0b00000u << 22, + OS_PM_MMCR1_PMC4_CPU_CYCLES = 0b00001u << 22, + OS_PM_MMCR1_PMC4_INSTRUCTIONS_COMPLETED = 0b00010u << 22, + OS_PM_MMCR1_PMC4_TBL_RISING_TRANSITIONS = 0b00011u << 22, + OS_PM_MMCR1_PMC4_INSTRUCTIONS_DISPATCHED = 0b00100u << 22, + OS_PM_MMCR1_PMC4_L2_CASTOUTS = 0b00101u << 22, + OS_PM_MMCR1_PMC4_DTLB_SEARCH_CYCLES = 0b00110u << 22, + OS_PM_MMCR1_PMC4_BRANCHES_MISPREDICTED = 0b01000u << 22, + OS_PM_MMCR1_PMC4_INTACT_COND_STORES_COMPLETED = 0b01010u << 22, + OS_PM_MMCR1_PMC4_SYNC_INSTRUCTIONS_COMPLETED = 0b01011u << 22, + OS_PM_MMCR1_PMC4_SNOOP_RETRIES = 0b01100u << 22, + OS_PM_MMCR1_PMC4_INTEGER_OPERATIONS = 0b01101u << 22, + OS_PM_MMCR1_PMC4_BPU_STALL_TWO_BRANCHES_CYCLES = 0b01110u << 22, + OS_PM_MMCR1_PMC4_L2_MODIFIED_INTERVENTIONS = 0b10000u << 22, + OS_PM_MMCR1_PMC4_TLBIE_SNOOPS = 0b10001u << 22, + OS_PM_MMCR1_PMC4_L2_BANK_REFRESH_OVERFLOWS = 0b10010u << 22, + OS_PM_MMCR1_PMC4_CIU_ARTRY_COUNT = 0b10100u << 22, + OS_PM_MMCR1_PMC4_BIU_STORE_REQUESTS = 0b10101u << 22, + OS_PM_MMCR1_PMC4_CIU_TWO_CORE_SHARED_INTERVENTIONS = 0b10110u << 22, } OSPerfMonMMCR1Flags; /** @@ -139,64 +142,61 @@ typedef enum OSPerfMonMMCR1Flags { * \param pmc3 Value to write to register PMC3. * \param pmc4 Value to write to register PMC4. */ -void OSSetPerformanceMonitor(uint32_t arg_mask, - uint32_t mmcr0, - uint32_t mmcr1, - uint32_t pmc1, - uint32_t pmc2, - uint32_t pmc3, - uint32_t pmc4); +void +OSSetPerformanceMonitor(uint32_t arg_mask, + uint32_t mmcr0, + uint32_t mmcr1, + uint32_t pmc1, + uint32_t pmc2, + uint32_t pmc3, + uint32_t pmc4); /** * Convenience function to read from UPMC1. */ -static inline -uint32_t +static inline uint32_t OSGetUPMC1() { - uint32_t result; - asm("mfupmc1 %[result]" - : [result] "=r"(result)); - return result; + uint32_t result; + asm("mfupmc1 %[result]" + : [result] "=r"(result)); + return result; } /** * Convenience function to read from UPMC2. */ -static inline -uint32_t +static inline uint32_t OSGetUPMC2() { - uint32_t result; - asm("mfupmc2 %[result]" - : [result] "=r"(result)); - return result; + uint32_t result; + asm("mfupmc2 %[result]" + : [result] "=r"(result)); + return result; } /** * Convenience function to read from UPMC3. */ -static inline -uint32_t +static inline uint32_t OSGetUPMC3() { - uint32_t result; - asm("mfupmc3 %[result]" - : [result] "=r"(result)); - return result; + uint32_t result; + asm("mfupmc3 %[result]" + : [result] "=r"(result)); + return result; } /** * Convenience function to read from UPMC4. */ -static inline -uint32_t +static inline uint32_t OSGetUPMC4() { - uint32_t result; - asm("mfupmc4 %[result]" - : [result] "=r"(result)); - return result; + uint32_t result; + asm("mfupmc4 %[result]" + : [result] "=r"(result)); + return result; } #ifdef __cplusplus diff --git a/include/coreinit/savedframe.h b/include/coreinit/savedframe.h index bf5fa89f8..e778298ed 100644 --- a/include/coreinit/savedframe.h +++ b/include/coreinit/savedframe.h @@ -13,14 +13,14 @@ extern "C" { typedef enum OSSavedFrameType { - OS_SAVED_FRAME_A = 0, - OS_SAVED_FRAME_B = 1, + OS_SAVED_FRAME_A = 0, + OS_SAVED_FRAME_B = 1, } OSSavedFrameType; typedef enum OSSavedFrameScreen { - OS_SAVED_FRAME_SCREEN_TV = 2, - OS_SAVED_FRAME_SCREEN_DRC = 4, + OS_SAVED_FRAME_SCREEN_TV = 2, + OS_SAVED_FRAME_SCREEN_DRC = 4, } OSSavedFrameScreen; uint32_t diff --git a/include/coreinit/scheduler.h b/include/coreinit/scheduler.h index 488fc4725..db59056d2 100644 --- a/include/coreinit/scheduler.h +++ b/include/coreinit/scheduler.h @@ -11,7 +11,7 @@ extern "C" { #endif -extern void* __OSSchedulerLock; +extern void *__OSSchedulerLock; void __OSEnableScheduler(); @@ -20,17 +20,17 @@ void __OSDisableScheduler(); void -__OSLockScheduler(void* lockId); +__OSLockScheduler(void *lockId); void -__OSUnlockScheduler(void* lockId); +__OSUnlockScheduler(void *lockId); BOOL -OSIsSchedulerLocked(void* lockId); +OSIsSchedulerLocked(void *lockId); void -__OSTryLockScheduler(void* lockId); - +__OSTryLockScheduler(void *lockId); + void __OSTouchSchedulerLock(); diff --git a/include/coreinit/screen.h b/include/coreinit/screen.h index 84e58dc4b..86136aed3 100644 --- a/include/coreinit/screen.h +++ b/include/coreinit/screen.h @@ -44,9 +44,9 @@ extern "C" { typedef enum OSScreenID { //! Represents the TV connected to the system. - SCREEN_TV = 0, + SCREEN_TV = 0, //! Represents the screen in the DRC (gamepad). - SCREEN_DRC = 1, + SCREEN_DRC = 1, } OSScreenID; /** diff --git a/include/coreinit/smd.h b/include/coreinit/smd.h index a6e2c146b..c4bc42512 100644 --- a/include/coreinit/smd.h +++ b/include/coreinit/smd.h @@ -26,39 +26,39 @@ typedef struct SmdSimpleBufPool SmdSimpleBufPool; typedef enum SmdLockType { - //! Locking is done with a mutex - SMD_LOCK_TYPE_MUTEX = 0, - //! Locking is done by disabling interrupts - SMD_LOCK_TYPE_DISABLE_INTERRUPTS = 1, - //! No locking is done - SMD_LOCK_TYPE_NONE = 2, + //! Locking is done with a mutex + SMD_LOCK_TYPE_MUTEX = 0, + //! Locking is done by disabling interrupts + SMD_LOCK_TYPE_DISABLE_INTERRUPTS = 1, + //! No locking is done + SMD_LOCK_TYPE_NONE = 2, } SmdLockType; typedef enum SmdPpcState { - SMD_PPC_STATE_INVALID = 0, - SMD_PPC_STATE_INITIALIZED = 1, - SMD_PPC_STATE_CLOSED = 2, - SMD_PPC_STATE_OPENED = 3, + SMD_PPC_STATE_INVALID = 0, + SMD_PPC_STATE_INITIALIZED = 1, + SMD_PPC_STATE_CLOSED = 2, + SMD_PPC_STATE_OPENED = 3, } SmdPpcState; typedef enum SmdInterfaceState { - SMD_INTERFACE_STATE_OPENED = 0x2222, - SMD_INTERFACE_STATE_CLOSED = 0x3333, + SMD_INTERFACE_STATE_OPENED = 0x2222, + SMD_INTERFACE_STATE_CLOSED = 0x3333, } SmdInterfaceState; typedef enum SmdElementType { - SMD_ELEMENT_TYPE_MESSAGE = 0, - SMD_ELEMENT_TYPE_VECTOR_SPEC = 1, - SMD_ELEMENT_TYPE_VECTOR = 2, + SMD_ELEMENT_TYPE_MESSAGE = 0, + SMD_ELEMENT_TYPE_VECTOR_SPEC = 1, + SMD_ELEMENT_TYPE_VECTOR = 2, } SmdElementType; struct SmdVectorSpec { - void *ptr; - uint32_t size; + void *ptr; + uint32_t size; }; WUT_CHECK_OFFSET(SmdVectorSpec, 0x00, ptr); WUT_CHECK_OFFSET(SmdVectorSpec, 0x04, size); @@ -66,9 +66,9 @@ WUT_CHECK_SIZE(SmdVectorSpec, 0x8); struct SmdVector { - uint32_t command; - int32_t count; - SmdVectorSpec vecs[4]; + uint32_t command; + int32_t count; + SmdVectorSpec vecs[4]; }; WUT_CHECK_OFFSET(SmdVector, 0x00, command); WUT_CHECK_OFFSET(SmdVector, 0x04, count); @@ -77,13 +77,14 @@ WUT_CHECK_SIZE(SmdVector, 0x28); struct SmdElement { - SmdElementType type; - uint32_t size; - union { - uint8_t data[0xf8]; - SmdVector spec; - uint32_t vectorPaddr; - }; + SmdElementType type; + uint32_t size; + union + { + uint8_t data[0xf8]; + SmdVector spec; + uint32_t vectorPaddr; + }; }; WUT_CHECK_OFFSET(SmdElement, 0x00, type); WUT_CHECK_OFFSET(SmdElement, 0x04, size); @@ -94,13 +95,14 @@ WUT_CHECK_SIZE(SmdElement, 0x100); struct SmdReceiveData { - SmdElementType type; - uint32_t size; - union { - uint8_t message[0x80]; - SmdVector spec; - SmdVector *vector; - }; + SmdElementType type; + uint32_t size; + union + { + uint8_t message[0x80]; + SmdVector spec; + SmdVector *vector; + }; }; WUT_CHECK_OFFSET(SmdReceiveData, 0x00, type); WUT_CHECK_OFFSET(SmdReceiveData, 0x04, size); @@ -111,16 +113,16 @@ WUT_CHECK_SIZE(SmdReceiveData, 0x88); struct SmdInterface { - SmdInterfaceState state; - WUT_PADDING_BYTES(0x7C); - uint32_t elementCount; - WUT_PADDING_BYTES(0x7C); - int32_t readOffset; - WUT_PADDING_BYTES(0x7C); - int32_t writeOffset; - WUT_PADDING_BYTES(0x7C); - uint32_t bufPaddr; - WUT_PADDING_BYTES(0x7C); + SmdInterfaceState state; + WUT_PADDING_BYTES(0x7C); + uint32_t elementCount; + WUT_PADDING_BYTES(0x7C); + int32_t readOffset; + WUT_PADDING_BYTES(0x7C); + int32_t writeOffset; + WUT_PADDING_BYTES(0x7C); + uint32_t bufPaddr; + WUT_PADDING_BYTES(0x7C); }; WUT_CHECK_OFFSET(SmdInterface, 0x000, state); WUT_CHECK_OFFSET(SmdInterface, 0x080, elementCount); @@ -131,13 +133,13 @@ WUT_CHECK_SIZE(SmdInterface, 0x280); struct SmdCtrlTable { - char name[0x10]; - uint32_t reusedCount; - WUT_PADDING_BYTES(0x6C); - SmdInterface iopInterface; - WUT_PADDING_BYTES(0x40); - SmdInterface ppcInterface; - WUT_PADDING_BYTES(0x40); + char name[0x10]; + uint32_t reusedCount; + WUT_PADDING_BYTES(0x6C); + SmdInterface iopInterface; + WUT_PADDING_BYTES(0x40); + SmdInterface ppcInterface; + WUT_PADDING_BYTES(0x40); }; WUT_CHECK_OFFSET(SmdCtrlTable, 0x000, name); WUT_CHECK_OFFSET(SmdCtrlTable, 0x010, reusedCount); @@ -147,12 +149,12 @@ WUT_CHECK_SIZE(SmdCtrlTable, 0x600); struct SmdPpcCtrlTableVectors { - SmdCtrlTable *ctrlTable; - uint32_t ctrlTableSize; - SmdElement *writeBuf; - uint32_t writeBufSize; - SmdElement *readBuf; - uint32_t readBufSize; + SmdCtrlTable *ctrlTable; + uint32_t ctrlTableSize; + SmdElement *writeBuf; + uint32_t writeBufSize; + SmdElement *readBuf; + uint32_t readBufSize; }; WUT_CHECK_OFFSET(SmdPpcCtrlTableVectors, 0x00, ctrlTable); WUT_CHECK_OFFSET(SmdPpcCtrlTableVectors, 0x04, ctrlTableSize); @@ -164,15 +166,15 @@ WUT_CHECK_SIZE(SmdPpcCtrlTableVectors, 0x18); struct SmdPpc { - SmdPpc *self; - SmdCtrlTable *ctrlTable; - SmdLockType lockType; - OSMutex mutex; - uint32_t messageCount; - SmdElement *writeBuf; - SmdElement *readBuf; - SmdPpcState state; - WUT_PADDING_BYTES(0x38); + SmdPpc *self; + SmdCtrlTable *ctrlTable; + SmdLockType lockType; + OSMutex mutex; + uint32_t messageCount; + SmdElement *writeBuf; + SmdElement *readBuf; + SmdPpcState state; + WUT_PADDING_BYTES(0x38); }; WUT_CHECK_OFFSET(SmdPpc, 0x00, self); WUT_CHECK_OFFSET(SmdPpc, 0x04, ctrlTable); @@ -186,19 +188,19 @@ WUT_CHECK_SIZE(SmdPpc, 0x80); struct SmdSimpleBufPool { - SmdSimpleBufPool *self; - OSMutex mutex; - void *poolData; - uint32_t poolDataSize; - SmdLockType lockType; - uint32_t allocSize; - uint32_t realAllocSize; - uint32_t maxAllocCount; - void *allocPoolStart; - void *allocPoolEnd; - uint32_t elementsIn; - uint32_t freeErrorCount; - WUT_PADDING_BYTES(0x28); + SmdSimpleBufPool *self; + OSMutex mutex; + void *poolData; + uint32_t poolDataSize; + SmdLockType lockType; + uint32_t allocSize; + uint32_t realAllocSize; + uint32_t maxAllocCount; + void *allocPoolStart; + void *allocPoolEnd; + uint32_t elementsIn; + uint32_t freeErrorCount; + WUT_PADDING_BYTES(0x28); }; WUT_CHECK_OFFSET(SmdSimpleBufPool, 0x00, self); WUT_CHECK_OFFSET(SmdSimpleBufPool, 0x04, mutex); diff --git a/include/coreinit/taskqueue.h b/include/coreinit/taskqueue.h index 374cfdd3b..ba13a4794 100644 --- a/include/coreinit/taskqueue.h +++ b/include/coreinit/taskqueue.h @@ -21,19 +21,19 @@ typedef uint32_t (*MPTaskFunc)(uint32_t, uint32_t); typedef enum MPTaskState { - MP_TASK_STATE_INITIALISED = 1 << 0, - MP_TASK_STATE_READY = 1 << 1, - MP_TASK_STATE_RUNNING = 1 << 2, - MP_TASK_STATE_FINISHED = 1 << 3, + MP_TASK_STATE_INITIALISED = 1 << 0, + MP_TASK_STATE_READY = 1 << 1, + MP_TASK_STATE_RUNNING = 1 << 2, + MP_TASK_STATE_FINISHED = 1 << 3, } MPTaskState; typedef enum MPTaskQueueState { - MP_TASK_QUEUE_STATE_INITIALISED = 1 << 0, - MP_TASK_QUEUE_STATE_READY = 1 << 1, - MP_TASK_QUEUE_STATE_STOPPING = 1 << 2, - MP_TASK_QUEUE_STATE_STOPPED = 1 << 3, - MP_TASK_QUEUE_STATE_FINISHED = 1 << 4, + MP_TASK_QUEUE_STATE_INITIALISED = 1 << 0, + MP_TASK_QUEUE_STATE_READY = 1 << 1, + MP_TASK_QUEUE_STATE_STOPPING = 1 << 2, + MP_TASK_QUEUE_STATE_STOPPED = 1 << 3, + MP_TASK_QUEUE_STATE_FINISHED = 1 << 4, } MPTaskQueueState; #pragma pack(push, 1) @@ -177,7 +177,7 @@ MPInitTask(MPTask *task, uint32_t userArg2); BOOL -MPTermTask(MPTask* task); +MPTermTask(MPTask *task); BOOL MPGetTaskInfo(MPTask *task, diff --git a/include/coreinit/thread.h b/include/coreinit/thread.h index 64f0f3ff1..a56ab63ae 100644 --- a/include/coreinit/thread.h +++ b/include/coreinit/thread.h @@ -3,9 +3,9 @@ #include #include "alarm.h" #include "context.h" -#include "time.h" -#include "threadqueue.h" #include "exception.h" +#include "threadqueue.h" +#include "time.h" /** * \defgroup coreinit_thread Thread @@ -60,73 +60,74 @@ typedef void (*OSThreadDeallocatorFn)(OSThread *thread, void *stack); typedef enum OSThreadSpecificID { //! These can be used by applications - OS_THREAD_SPECIFIC_0 = 0, - OS_THREAD_SPECIFIC_1 = 1, - OS_THREAD_SPECIFIC_2 = 2, - OS_THREAD_SPECIFIC_3 = 3, - OS_THREAD_SPECIFIC_4 = 4, - OS_THREAD_SPECIFIC_5 = 5, - OS_THREAD_SPECIFIC_6 = 6, - OS_THREAD_SPECIFIC_7 = 7, - OS_THREAD_SPECIFIC_8 = 8, - OS_THREAD_SPECIFIC_9 = 9, - OS_THREAD_SPECIFIC_10 = 10, - OS_THREAD_SPECIFIC_11 = 11, - OS_THREAD_SPECIFIC_12 = 12, - OS_THREAD_SPECIFIC_13 = 13, + OS_THREAD_SPECIFIC_0 = 0, + OS_THREAD_SPECIFIC_1 = 1, + OS_THREAD_SPECIFIC_2 = 2, + OS_THREAD_SPECIFIC_3 = 3, + OS_THREAD_SPECIFIC_4 = 4, + OS_THREAD_SPECIFIC_5 = 5, + OS_THREAD_SPECIFIC_6 = 6, + OS_THREAD_SPECIFIC_7 = 7, + OS_THREAD_SPECIFIC_8 = 8, + OS_THREAD_SPECIFIC_9 = 9, + OS_THREAD_SPECIFIC_10 = 10, + OS_THREAD_SPECIFIC_11 = 11, + OS_THREAD_SPECIFIC_12 = 12, + OS_THREAD_SPECIFIC_13 = 13, //! These are reserved to wut for internal use - OS_THREAD_SPECIFIC_WUT_RESERVED_0 = 14, - OS_THREAD_SPECIFIC_WUT_RESERVED_1 = 15, + OS_THREAD_SPECIFIC_WUT_RESERVED_0 = 14, + OS_THREAD_SPECIFIC_WUT_RESERVED_1 = 15, } OSThreadSpecificID; enum OS_THREAD_STATE { - OS_THREAD_STATE_NONE = 0, + OS_THREAD_STATE_NONE = 0, //! Thread is ready to run - OS_THREAD_STATE_READY = 1 << 0, + OS_THREAD_STATE_READY = 1 << 0, //! Thread is running - OS_THREAD_STATE_RUNNING = 1 << 1, + OS_THREAD_STATE_RUNNING = 1 << 1, //! Thread is waiting, i.e. on a mutex - OS_THREAD_STATE_WAITING = 1 << 2, + OS_THREAD_STATE_WAITING = 1 << 2, //! Thread is about to terminate - OS_THREAD_STATE_MORIBUND = 1 << 3, + OS_THREAD_STATE_MORIBUND = 1 << 3, }; enum OS_THREAD_REQUEST { - OS_THREAD_REQUEST_NONE = 0, - OS_THREAD_REQUEST_SUSPEND = 1, - OS_THREAD_REQUEST_CANCEL = 2, + OS_THREAD_REQUEST_NONE = 0, + OS_THREAD_REQUEST_SUSPEND = 1, + OS_THREAD_REQUEST_CANCEL = 2, }; enum OS_THREAD_ATTRIB { //! Allow the thread to run on CPU0. - OS_THREAD_ATTRIB_AFFINITY_CPU0 = 1 << 0, + OS_THREAD_ATTRIB_AFFINITY_CPU0 = 1 << 0, //! Allow the thread to run on CPU1. - OS_THREAD_ATTRIB_AFFINITY_CPU1 = 1 << 1, + OS_THREAD_ATTRIB_AFFINITY_CPU1 = 1 << 1, //! Allow the thread to run on CPU2. - OS_THREAD_ATTRIB_AFFINITY_CPU2 = 1 << 2, + OS_THREAD_ATTRIB_AFFINITY_CPU2 = 1 << 2, //! Allow the thread to run any CPU. - OS_THREAD_ATTRIB_AFFINITY_ANY = ((1 << 0) | (1 << 1) | (1 << 2)), + OS_THREAD_ATTRIB_AFFINITY_ANY = ((1 << 0) | (1 << 1) | (1 << 2)), //! Start the thread detached. - OS_THREAD_ATTRIB_DETACHED = 1 << 3, + OS_THREAD_ATTRIB_DETACHED = 1 << 3, //! Enables tracking of stack usage. - OS_THREAD_ATTRIB_STACK_USAGE = 1 << 5, + OS_THREAD_ATTRIB_STACK_USAGE = 1 << 5, - OS_THREAD_ATTRIB_UNKNOWN = 1 << 7 + OS_THREAD_ATTRIB_UNKNOWN = 1 << 7 }; -enum OS_THREAD_TYPE { +enum OS_THREAD_TYPE +{ OS_THREAD_TYPE_DRIVER = 0, OS_THREAD_TYPE_IO = 1, OS_THREAD_TYPE_APP = 2 @@ -169,7 +170,7 @@ WUT_CHECK_SIZE(OSFastMutexQueue, 0x08); struct OSTLSSection { - void* data; + void *data; WUT_UNKNOWN_BYTES(4); }; WUT_CHECK_OFFSET(OSTLSSection, 0x00, data); @@ -309,10 +310,10 @@ struct WUT_ALIGNAS(8) OSThread WUT_UNKNOWN_BYTES(0x2); //! TLS Sections - OSTLSSection* tlsSections; + OSTLSSection *tlsSections; //! The fast mutex we are currently waiting for - OSFastMutex* fastMutex; + OSFastMutex *fastMutex; //! The fast mutexes we are currently contended on OSFastMutexQueue contendedFastMutexes; diff --git a/include/coreinit/time.h b/include/coreinit/time.h index ffa363f68..5cc3201d6 100644 --- a/include/coreinit/time.h +++ b/include/coreinit/time.h @@ -53,17 +53,17 @@ WUT_CHECK_OFFSET(OSCalendarTime, 0x20, tm_msec); WUT_CHECK_OFFSET(OSCalendarTime, 0x24, tm_usec); WUT_CHECK_SIZE(OSCalendarTime, 0x28); -#define OSTimerClockSpeed ((OSGetSystemInfo()->busClockSpeed) / 4) +#define OSTimerClockSpeed ((OSGetSystemInfo()->busClockSpeed) / 4) -#define OSSecondsToTicks(val) ((uint64_t)(val) * (uint64_t)OSTimerClockSpeed) -#define OSMillisecondsToTicks(val) (((uint64_t)(val) * (uint64_t)OSTimerClockSpeed) / 1000ull) -#define OSMicrosecondsToTicks(val) (((uint64_t)(val) * (uint64_t)OSTimerClockSpeed) / 1000000ull) -#define OSNanosecondsToTicks(val) (((uint64_t)(val) * ((uint64_t)OSTimerClockSpeed) / 31250ull) / 32000ull) +#define OSSecondsToTicks(val) ((uint64_t)(val) * (uint64_t)OSTimerClockSpeed) +#define OSMillisecondsToTicks(val) (((uint64_t)(val) * (uint64_t)OSTimerClockSpeed) / 1000ull) +#define OSMicrosecondsToTicks(val) (((uint64_t)(val) * (uint64_t)OSTimerClockSpeed) / 1000000ull) +#define OSNanosecondsToTicks(val) (((uint64_t)(val) * ((uint64_t)OSTimerClockSpeed) / 31250ull) / 32000ull) -#define OSTicksToSeconds(val) ((uint64_t)(val) / (uint64_t)OSTimerClockSpeed) -#define OSTicksToMilliseconds(val) (((uint64_t)(val) * 1000ull) / (uint64_t)OSTimerClockSpeed) -#define OSTicksToMicroseconds(val) (((uint64_t)(val) * 1000000ull) / (uint64_t)OSTimerClockSpeed) -#define OSTicksToNanoseconds(val) (((uint64_t)(val) * 32000ull) / ((uint64_t)OSTimerClockSpeed / 31250ull)) +#define OSTicksToSeconds(val) ((uint64_t)(val) / (uint64_t)OSTimerClockSpeed) +#define OSTicksToMilliseconds(val) (((uint64_t)(val) * 1000ull) / (uint64_t)OSTimerClockSpeed) +#define OSTicksToMicroseconds(val) (((uint64_t)(val) * 1000000ull) / (uint64_t)OSTimerClockSpeed) +#define OSTicksToNanoseconds(val) (((uint64_t)(val) * 32000ull) / ((uint64_t)OSTimerClockSpeed / 31250ull)) OSTime OSGetTime(); diff --git a/include/coreinit/title.h b/include/coreinit/title.h index a0787d41e..b5c9a6fa6 100644 --- a/include/coreinit/title.h +++ b/include/coreinit/title.h @@ -11,7 +11,8 @@ extern "C" { #endif -uint64_t OSGetTitleID(void); +uint64_t +OSGetTitleID(void); #ifdef __cplusplus } diff --git a/include/coreinit/transition.h b/include/coreinit/transition.h index 10ab6a2aa..c25c94924 100644 --- a/include/coreinit/transition.h +++ b/include/coreinit/transition.h @@ -9,8 +9,9 @@ extern "C" { int __OSGetSavedAudioFlags(); -int __OSGetTransitionAudioBuffer(void **buffer, - uint32_t *size); +int +__OSGetTransitionAudioBuffer(void **buffer, + uint32_t *size); void __OSSetTransitionAudioSize(uint32_t size); diff --git a/include/coreinit/userconfig.h b/include/coreinit/userconfig.h index 358111b92..f4d794fd8 100644 --- a/include/coreinit/userconfig.h +++ b/include/coreinit/userconfig.h @@ -20,75 +20,75 @@ typedef struct UCAsyncParams UCAsyncParams; typedef enum UCCommand { - UC_CMD_READ_SYS_CONFIG = 0x30, - UC_CMD_WRITE_SYS_CONFIG = 0x31, - UC_CMD_DELETE_SYS_CONFIG = 0x32, - UC_CMD_QUERY_SYS_CONFIG = 0x33, - UC_CMD_LIST_SYS_CONFIG = 0x34, + UC_CMD_READ_SYS_CONFIG = 0x30, + UC_CMD_WRITE_SYS_CONFIG = 0x31, + UC_CMD_DELETE_SYS_CONFIG = 0x32, + UC_CMD_QUERY_SYS_CONFIG = 0x33, + UC_CMD_LIST_SYS_CONFIG = 0x34, } UCCommand; typedef enum UCDataType { - UC_DATATYPE_UNDEFINED = 0x00, - UC_DATATYPE_UNSIGNED_BYTE = 0x01, - UC_DATATYPE_UNSIGNED_SHORT = 0x02, - UC_DATATYPE_UNSIGNED_INT = 0x03, - UC_DATATYPE_SIGNED_INT = 0x04, - UC_DATATYPE_FLOAT = 0x05, - UC_DATATYPE_STRING = 0x06, - UC_DATATYPE_HEXBINARY = 0x07, - UC_DATATYPE_COMPLEX = 0x08, - UC_DATATYPE_INVALID = 0xFF, + UC_DATATYPE_UNDEFINED = 0x00, + UC_DATATYPE_UNSIGNED_BYTE = 0x01, + UC_DATATYPE_UNSIGNED_SHORT = 0x02, + UC_DATATYPE_UNSIGNED_INT = 0x03, + UC_DATATYPE_SIGNED_INT = 0x04, + UC_DATATYPE_FLOAT = 0x05, + UC_DATATYPE_STRING = 0x06, + UC_DATATYPE_HEXBINARY = 0x07, + UC_DATATYPE_COMPLEX = 0x08, + UC_DATATYPE_INVALID = 0xFF, } UCDataType; typedef enum UCErrors { - UC_ERROR_OK = 0, - UC_ERROR_ERROR = -1, - UC_ERROR_OTHER = -0x200001, - UC_ERROR_SYSTEM = -0x200002, - UC_ERROR_ALLOC = -0x200003, - UC_ERROR_OPCODE = -0x200004, - UC_ERROR_INVALID_PARAM = -0x200005, - UC_ERROR_INVALID_TYPE = -0x200006, - UC_ERROR_UNSUPPORTED = -0x200007, - UC_ERROR_NON_LEAF_NODE = -0x200008, - UC_ERROR_KEY_NOT_FOUND = -0x200009, - UC_ERROR_MODIFY = -0x20000A, - UC_ERROR_STRING_TOO_LONG = -0x20000B, - UC_ERROR_ROOT_KEYS_DIFFER = -0x20000C, - UC_ERROR_INVALID_LOCATION = -0x20000D, - UC_ERROR_BAD_COMMENT = -0x20000E, - UC_ERROR_READ_ACCESS = -0x20000F, - UC_ERROR_WRITE_ACCESS = -0x200010, - UC_ERROR_CREATE_ACCESS = -0x200011, - UC_ERROR_FILE_SYS_NAME = -0x200012, - UC_ERROR_FILE_SYS_INIT = -0x200013, - UC_ERROR_FILE_SYS_MOUNT = -0x200014, - UC_ERROR_FILE_OPEN = -0x200015, - UC_ERROR_FILE_STAT = -0x200016, - UC_ERROR_FILE_READ = -0x200017, - UC_ERROR_FILE_WRITE = -0x200018, - UC_ERROR_FILE_TOO_BIG = -0x200019, - UC_ERROR_FILE_REMOVE = -0x20001A, - UC_ERROR_FILE_RENAME = -0x20001B, - UC_ERROR_FILE_CLOSE = -0x20001C, - UC_ERROR_FILE_SEEK = -0x20001D, - UC_ERROR_FILE_CONFIRM = -0x20001E, - UC_ERROR_FILE_BACKUP = -0x20001F, - UC_ERROR_MALFORMED_XML = -0x200020, - UC_ERROR_VERSION = -0x200021, - UC_ERROR_NO_IPC_BUFFERS = -0x200022, - UC_ERROR_FILE_LOCK_NEEDED = -0x200024, - UC_ERROR_SYS_PROT = -0x200028, + UC_ERROR_OK = 0, + UC_ERROR_ERROR = -1, + UC_ERROR_OTHER = -0x200001, + UC_ERROR_SYSTEM = -0x200002, + UC_ERROR_ALLOC = -0x200003, + UC_ERROR_OPCODE = -0x200004, + UC_ERROR_INVALID_PARAM = -0x200005, + UC_ERROR_INVALID_TYPE = -0x200006, + UC_ERROR_UNSUPPORTED = -0x200007, + UC_ERROR_NON_LEAF_NODE = -0x200008, + UC_ERROR_KEY_NOT_FOUND = -0x200009, + UC_ERROR_MODIFY = -0x20000A, + UC_ERROR_STRING_TOO_LONG = -0x20000B, + UC_ERROR_ROOT_KEYS_DIFFER = -0x20000C, + UC_ERROR_INVALID_LOCATION = -0x20000D, + UC_ERROR_BAD_COMMENT = -0x20000E, + UC_ERROR_READ_ACCESS = -0x20000F, + UC_ERROR_WRITE_ACCESS = -0x200010, + UC_ERROR_CREATE_ACCESS = -0x200011, + UC_ERROR_FILE_SYS_NAME = -0x200012, + UC_ERROR_FILE_SYS_INIT = -0x200013, + UC_ERROR_FILE_SYS_MOUNT = -0x200014, + UC_ERROR_FILE_OPEN = -0x200015, + UC_ERROR_FILE_STAT = -0x200016, + UC_ERROR_FILE_READ = -0x200017, + UC_ERROR_FILE_WRITE = -0x200018, + UC_ERROR_FILE_TOO_BIG = -0x200019, + UC_ERROR_FILE_REMOVE = -0x20001A, + UC_ERROR_FILE_RENAME = -0x20001B, + UC_ERROR_FILE_CLOSE = -0x20001C, + UC_ERROR_FILE_SEEK = -0x20001D, + UC_ERROR_FILE_CONFIRM = -0x20001E, + UC_ERROR_FILE_BACKUP = -0x20001F, + UC_ERROR_MALFORMED_XML = -0x200020, + UC_ERROR_VERSION = -0x200021, + UC_ERROR_NO_IPC_BUFFERS = -0x200022, + UC_ERROR_FILE_LOCK_NEEDED = -0x200024, + UC_ERROR_SYS_PROT = -0x200028, } UCErrors; typedef enum UCFileSys { - UC_FILE_SYS_INVALID = 0x00, - UC_FILE_SYS_SYS = 0x01, - UC_FILE_SYS_SLC = 0x02, - UC_FILE_SYS_RAM = 0x03, + UC_FILE_SYS_INVALID = 0x00, + UC_FILE_SYS_SYS = 0x01, + UC_FILE_SYS_SLC = 0x02, + UC_FILE_SYS_RAM = 0x03, } UCFileSys; #pragma pack(push, 1) @@ -118,13 +118,13 @@ typedef void (*UCAsyncCallbackFn)(UCError result, #pragma pack(push, 1) struct UCAsyncParams { - UCAsyncCallbackFn callback; - void *context; - UCCommand command; - uint32_t unk0x0C; - uint32_t count; - UCSysConfig *settings; - IOSVec *vecs; + UCAsyncCallbackFn callback; + void *context; + UCCommand command; + uint32_t unk0x0C; + uint32_t count; + UCSysConfig *settings; + IOSVec *vecs; }; #pragma pack(pop) WUT_CHECK_OFFSET(UCAsyncParams, 0x00, callback); diff --git a/include/erreula/rpl_interface.h b/include/erreula/rpl_interface.h index 87440e96b..186d8a7a8 100644 --- a/include/erreula/rpl_interface.h +++ b/include/erreula/rpl_interface.h @@ -17,30 +17,52 @@ struct FSClient; namespace Rpl { -void ErrEulaSetVersion(int version); -bool ErrEulaJump(const char *buffer, uint32_t bufferSize); -void ErrEulaPlayAppearSE(bool playAppearSoundEffect); -bool ErrEulaIsSelectCursorActive(); -void ErrEulaChangeLang(nn::erreula::LangType language); -void ErrEulaDisappearHomeNixSign(); -bool ErrEulaIsAppearHomeNixSign(); -void ErrEulaAppearHomeNixSign(const nn::erreula::HomeNixSignArg &arg); -void ErrEulaSetControllerRemo(nn::erreula::ControllerType controller); -int32_t ErrEulaGetSelectButtonNumError(); -int32_t ErrEulaGetResultCode(); -nn::erreula::ResultType ErrEulaGetResultType(); -nn::erreula::State ErrEulaGetStateErrorViewer(); -bool ErrEulaIsDecideSelectRightButtonError(); -bool ErrEulaIsDecideSelectLeftButtonError(); -bool ErrEulaIsDecideSelectButtonError(); -void ErrEulaDisappearError(); -void ErrEulaAppearError(const nn::erreula::AppearArg &arg); -void ErrEulaCalc(const nn::erreula::ControllerInfo &controllerInfo); -void ErrEulaDrawDRC(); -void ErrEulaDrawTV(); -void ErrEulaDestroy(); -void ErrEulaCreate(void *workMemory, nn::erreula::RegionType region, - nn::erreula::LangType language, FSClient *fsClient); +void +ErrEulaSetVersion(int version); +bool +ErrEulaJump(const char *buffer, uint32_t bufferSize); +void +ErrEulaPlayAppearSE(bool playAppearSoundEffect); +bool +ErrEulaIsSelectCursorActive(); +void +ErrEulaChangeLang(nn::erreula::LangType language); +void +ErrEulaDisappearHomeNixSign(); +bool +ErrEulaIsAppearHomeNixSign(); +void +ErrEulaAppearHomeNixSign(const nn::erreula::HomeNixSignArg &arg); +void +ErrEulaSetControllerRemo(nn::erreula::ControllerType controller); +int32_t +ErrEulaGetSelectButtonNumError(); +int32_t +ErrEulaGetResultCode(); +nn::erreula::ResultType +ErrEulaGetResultType(); +nn::erreula::State +ErrEulaGetStateErrorViewer(); +bool +ErrEulaIsDecideSelectRightButtonError(); +bool +ErrEulaIsDecideSelectLeftButtonError(); +bool +ErrEulaIsDecideSelectButtonError(); +void +ErrEulaDisappearError(); +void +ErrEulaAppearError(const nn::erreula::AppearArg &arg); +void +ErrEulaCalc(const nn::erreula::ControllerInfo &controllerInfo); +void +ErrEulaDrawDRC(); +void +ErrEulaDrawTV(); +void +ErrEulaDestroy(); +void +ErrEulaCreate(void *workMemory, nn::erreula::RegionType region, nn::erreula::LangType language, FSClient *fsClient); } // namespace Rpl diff --git a/include/gx2/debug.h b/include/gx2/debug.h index 91d1c6de6..b02b9c9d8 100644 --- a/include/gx2/debug.h +++ b/include/gx2/debug.h @@ -16,27 +16,27 @@ typedef struct GX2DebugCaptureInterface GX2DebugCaptureInterface; typedef enum GX2DebugCaptureInterfaceVersion { - GX2_DEBUG_CAPTURE_INTERFACE_VERSION = 1, + GX2_DEBUG_CAPTURE_INTERFACE_VERSION = 1, } GX2DebugCaptureInterfaceVersion; //! Options for \link GX2DebugCaptureStart \endlink. typedef enum GX2DebugCaptureStartFlags { //! When set \link GX2DebugCaptureStart \endlink will call \link GX2DrawDone \endlink before the capture is started. - GX2_DEBUG_CAPTURE_START_FLAGS_NONE = 0, + GX2_DEBUG_CAPTURE_START_FLAGS_NONE = 0, //! When set \link GX2DebugCaptureStart \endlink will NOT call \link GX2DrawDone \endlink. - GX2_DEBUG_CAPTURE_START_FLAGS_DISABLE_GX2DRAWDONE = 1, + GX2_DEBUG_CAPTURE_START_FLAGS_DISABLE_GX2DRAWDONE = 1, } GX2DebugCaptureStartFlags; //! Options for \link GX2DebugCaptureEnd \endlink. typedef enum GX2DebugCaptureEndFlags { //! When set \link GX2DebugCaptureEnd \endlink will call \link GX2Flush \endlink before the capture is completed. - GX2_DEBUG_CAPTURE_END_FLAGS_NONE = 0, + GX2_DEBUG_CAPTURE_END_FLAGS_NONE = 0, //! When set \link GX2DebugCaptureEnd \endlink will NOT call \link GX2Flush \endlink. - GX2_DEBUG_CAPTURE_END_FLAGS_DISABLE_GX2FLUSH = 1, + GX2_DEBUG_CAPTURE_END_FLAGS_DISABLE_GX2FLUSH = 1, } GX2DebugCaptureEndFlags; struct GX2DebugCaptureInterface @@ -140,7 +140,7 @@ GX2DebugCaptureEnd(GX2DebugCaptureEndFlags flags); * Equivalent to calling GX2DebugCaptureFrames(filename, 1) */ void -GX2DebugCaptureFrame(const char* filename); +GX2DebugCaptureFrame(const char *filename); /** @@ -152,7 +152,7 @@ GX2DebugCaptureFrame(const char* filename); * Capture begins and ends during GX2SwapScanBuffers. */ void -GX2DebugCaptureFrames(const char* filename, +GX2DebugCaptureFrames(const char *filename, uint32_t count); #ifdef __cplusplus diff --git a/include/gx2/enum.h b/include/gx2/enum.h index a507545b6..23763f03d 100644 --- a/include/gx2/enum.h +++ b/include/gx2/enum.h @@ -11,188 +11,188 @@ extern "C" { #endif -#define GX2_FALSE (0) -#define GX2_TRUE (1) -#define GX2_DISABLE (0) -#define GX2_ENABLE (1) +#define GX2_FALSE (0) +#define GX2_TRUE (1) +#define GX2_DISABLE (0) +#define GX2_ENABLE (1) -#define GX2_COMMAND_BUFFER_ALIGNMENT (0x40) -#define GX2_CONTEXT_STATE_ALIGNMENT (0x100) -#define GX2_SCAN_BUFFER_ALIGNMENT (0x1000) -#define GX2_SHADER_PROGRAM_ALIGNMENT (0x100) -#define GX2_VERTEX_BUFFER_ALIGNMENT (0x40) -#define GX2_INDEX_BUFFER_ALIGNMENT (0x20) -#define GX2_UNIFORM_BLOCK_ALIGNMENT (0x100) +#define GX2_COMMAND_BUFFER_ALIGNMENT (0x40) +#define GX2_CONTEXT_STATE_ALIGNMENT (0x100) +#define GX2_SCAN_BUFFER_ALIGNMENT (0x1000) +#define GX2_SHADER_PROGRAM_ALIGNMENT (0x100) +#define GX2_VERTEX_BUFFER_ALIGNMENT (0x40) +#define GX2_INDEX_BUFFER_ALIGNMENT (0x20) +#define GX2_UNIFORM_BLOCK_ALIGNMENT (0x100) -#define GX2_COMMAND_BUFFER_SIZE (0x400000) +#define GX2_COMMAND_BUFFER_SIZE (0x400000) typedef enum GX2AAMode { - GX2_AA_MODE1X = 0, - GX2_AA_MODE2X = 1, - GX2_AA_MODE4X = 2, - GX2_AA_MODE8X = 3, + GX2_AA_MODE1X = 0, + GX2_AA_MODE2X = 1, + GX2_AA_MODE4X = 2, + GX2_AA_MODE8X = 3, } GX2AAMode; typedef enum GX2AlphaToMaskMode { - GX2_ALPHA_TO_MASK_MODE_NON_DITHERED = 0, - GX2_ALPHA_TO_MASK_MODE_DITHER_0 = 1, - GX2_ALPHA_TO_MASK_MODE_DITHER_90 = 2, - GX2_ALPHA_TO_MASK_MODE_DITHER_180 = 3, - GX2_ALPHA_TO_MASK_MODE_DITHER_270 = 4, + GX2_ALPHA_TO_MASK_MODE_NON_DITHERED = 0, + GX2_ALPHA_TO_MASK_MODE_DITHER_0 = 1, + GX2_ALPHA_TO_MASK_MODE_DITHER_90 = 2, + GX2_ALPHA_TO_MASK_MODE_DITHER_180 = 3, + GX2_ALPHA_TO_MASK_MODE_DITHER_270 = 4, } GX2AlphaToMaskMode; typedef enum GX2AspectRatio { - GX2_ASPECT_RATIO_4_3 = 0, - GX2_ASPECT_RATIO_16_9 = 1, + GX2_ASPECT_RATIO_4_3 = 0, + GX2_ASPECT_RATIO_16_9 = 1, } GX2AspectRatio; typedef enum GX2AttribFormat { - GX2_ATTRIB_TYPE_8 = 0x00, - GX2_ATTRIB_TYPE_4_4 = 0x01, - GX2_ATTRIB_TYPE_16 = 0x02, - GX2_ATTRIB_TYPE_16_FLOAT = 0x03, - GX2_ATTRIB_TYPE_8_8 = 0x04, - GX2_ATTRIB_TYPE_32 = 0x05, - GX2_ATTRIB_TYPE_32_FLOAT = 0x06, - GX2_ATTRIB_TYPE_16_16 = 0x07, - GX2_ATTRIB_TYPE_16_16_FLOAT = 0x08, - GX2_ATTRIB_TYPE_10_11_11_FLOAT = 0x09, - GX2_ATTRIB_TYPE_8_8_8_8 = 0x0A, - GX2_ATTRIB_TYPE_10_10_10_2 = 0x0B, - GX2_ATTRIB_TYPE_32_32 = 0x0C, - GX2_ATTRIB_TYPE_32_32_FLOAT = 0x0D, - GX2_ATTRIB_TYPE_16_16_16_16 = 0x0E, - GX2_ATTRIB_TYPE_16_16_16_16_FLOAT = 0x0F, - GX2_ATTRIB_TYPE_32_32_32 = 0x10, - GX2_ATTRIB_TYPE_32_32_32_FLOAT = 0x11, - GX2_ATTRIB_TYPE_32_32_32_32 = 0x12, - GX2_ATTRIB_TYPE_32_32_32_32_FLOAT = 0x13, - - GX2_ATTRIB_FLAG_INTEGER = 0x100, - GX2_ATTRIB_FLAG_SIGNED = 0x200, - GX2_ATTRIB_FLAG_DEGAMMA = 0x400, - GX2_ATTRIB_FLAG_SCALED = 0x800, - - GX2_ATTRIB_FORMAT_UNORM_8 = GX2_ATTRIB_TYPE_8, - GX2_ATTRIB_FORMAT_UNORM_8_8 = GX2_ATTRIB_TYPE_8_8, - GX2_ATTRIB_FORMAT_UNORM_8_8_8_8 = GX2_ATTRIB_TYPE_8_8_8_8, - - GX2_ATTRIB_FORMAT_UINT_8 = GX2_ATTRIB_FLAG_INTEGER | GX2_ATTRIB_TYPE_8, - GX2_ATTRIB_FORMAT_UINT_8_8 = GX2_ATTRIB_FLAG_INTEGER | GX2_ATTRIB_TYPE_8_8, - GX2_ATTRIB_FORMAT_UINT_8_8_8_8 = GX2_ATTRIB_FLAG_INTEGER | GX2_ATTRIB_TYPE_8_8_8_8, - - GX2_ATTRIB_FORMAT_SNORM_8 = GX2_ATTRIB_FLAG_SIGNED | GX2_ATTRIB_TYPE_8, - GX2_ATTRIB_FORMAT_SNORM_8_8 = GX2_ATTRIB_FLAG_SIGNED | GX2_ATTRIB_TYPE_8_8, - GX2_ATTRIB_FORMAT_SNORM_8_8_8_8 = GX2_ATTRIB_FLAG_SIGNED | GX2_ATTRIB_TYPE_8_8_8_8, - - GX2_ATTRIB_FORMAT_SINT_8 = GX2_ATTRIB_FLAG_SIGNED | GX2_ATTRIB_FLAG_INTEGER | GX2_ATTRIB_TYPE_8, - GX2_ATTRIB_FORMAT_SINT_8_8 = GX2_ATTRIB_FLAG_SIGNED | GX2_ATTRIB_FLAG_INTEGER | GX2_ATTRIB_TYPE_8_8, - GX2_ATTRIB_FORMAT_SINT_8_8_8_8 = GX2_ATTRIB_FLAG_SIGNED | GX2_ATTRIB_FLAG_INTEGER | GX2_ATTRIB_TYPE_8_8_8_8, - - GX2_ATTRIB_FORMAT_FLOAT_32 = GX2_ATTRIB_FLAG_SCALED | GX2_ATTRIB_TYPE_32_FLOAT, - GX2_ATTRIB_FORMAT_FLOAT_32_32 = GX2_ATTRIB_FLAG_SCALED | GX2_ATTRIB_TYPE_32_32_FLOAT, - GX2_ATTRIB_FORMAT_FLOAT_32_32_32 = GX2_ATTRIB_FLAG_SCALED | GX2_ATTRIB_TYPE_32_32_32_FLOAT, - GX2_ATTRIB_FORMAT_FLOAT_32_32_32_32 = GX2_ATTRIB_FLAG_SCALED | GX2_ATTRIB_TYPE_32_32_32_32_FLOAT, + GX2_ATTRIB_TYPE_8 = 0x00, + GX2_ATTRIB_TYPE_4_4 = 0x01, + GX2_ATTRIB_TYPE_16 = 0x02, + GX2_ATTRIB_TYPE_16_FLOAT = 0x03, + GX2_ATTRIB_TYPE_8_8 = 0x04, + GX2_ATTRIB_TYPE_32 = 0x05, + GX2_ATTRIB_TYPE_32_FLOAT = 0x06, + GX2_ATTRIB_TYPE_16_16 = 0x07, + GX2_ATTRIB_TYPE_16_16_FLOAT = 0x08, + GX2_ATTRIB_TYPE_10_11_11_FLOAT = 0x09, + GX2_ATTRIB_TYPE_8_8_8_8 = 0x0A, + GX2_ATTRIB_TYPE_10_10_10_2 = 0x0B, + GX2_ATTRIB_TYPE_32_32 = 0x0C, + GX2_ATTRIB_TYPE_32_32_FLOAT = 0x0D, + GX2_ATTRIB_TYPE_16_16_16_16 = 0x0E, + GX2_ATTRIB_TYPE_16_16_16_16_FLOAT = 0x0F, + GX2_ATTRIB_TYPE_32_32_32 = 0x10, + GX2_ATTRIB_TYPE_32_32_32_FLOAT = 0x11, + GX2_ATTRIB_TYPE_32_32_32_32 = 0x12, + GX2_ATTRIB_TYPE_32_32_32_32_FLOAT = 0x13, + + GX2_ATTRIB_FLAG_INTEGER = 0x100, + GX2_ATTRIB_FLAG_SIGNED = 0x200, + GX2_ATTRIB_FLAG_DEGAMMA = 0x400, + GX2_ATTRIB_FLAG_SCALED = 0x800, + + GX2_ATTRIB_FORMAT_UNORM_8 = GX2_ATTRIB_TYPE_8, + GX2_ATTRIB_FORMAT_UNORM_8_8 = GX2_ATTRIB_TYPE_8_8, + GX2_ATTRIB_FORMAT_UNORM_8_8_8_8 = GX2_ATTRIB_TYPE_8_8_8_8, + + GX2_ATTRIB_FORMAT_UINT_8 = GX2_ATTRIB_FLAG_INTEGER | GX2_ATTRIB_TYPE_8, + GX2_ATTRIB_FORMAT_UINT_8_8 = GX2_ATTRIB_FLAG_INTEGER | GX2_ATTRIB_TYPE_8_8, + GX2_ATTRIB_FORMAT_UINT_8_8_8_8 = GX2_ATTRIB_FLAG_INTEGER | GX2_ATTRIB_TYPE_8_8_8_8, + + GX2_ATTRIB_FORMAT_SNORM_8 = GX2_ATTRIB_FLAG_SIGNED | GX2_ATTRIB_TYPE_8, + GX2_ATTRIB_FORMAT_SNORM_8_8 = GX2_ATTRIB_FLAG_SIGNED | GX2_ATTRIB_TYPE_8_8, + GX2_ATTRIB_FORMAT_SNORM_8_8_8_8 = GX2_ATTRIB_FLAG_SIGNED | GX2_ATTRIB_TYPE_8_8_8_8, + + GX2_ATTRIB_FORMAT_SINT_8 = GX2_ATTRIB_FLAG_SIGNED | GX2_ATTRIB_FLAG_INTEGER | GX2_ATTRIB_TYPE_8, + GX2_ATTRIB_FORMAT_SINT_8_8 = GX2_ATTRIB_FLAG_SIGNED | GX2_ATTRIB_FLAG_INTEGER | GX2_ATTRIB_TYPE_8_8, + GX2_ATTRIB_FORMAT_SINT_8_8_8_8 = GX2_ATTRIB_FLAG_SIGNED | GX2_ATTRIB_FLAG_INTEGER | GX2_ATTRIB_TYPE_8_8_8_8, + + GX2_ATTRIB_FORMAT_FLOAT_32 = GX2_ATTRIB_FLAG_SCALED | GX2_ATTRIB_TYPE_32_FLOAT, + GX2_ATTRIB_FORMAT_FLOAT_32_32 = GX2_ATTRIB_FLAG_SCALED | GX2_ATTRIB_TYPE_32_32_FLOAT, + GX2_ATTRIB_FORMAT_FLOAT_32_32_32 = GX2_ATTRIB_FLAG_SCALED | GX2_ATTRIB_TYPE_32_32_32_FLOAT, + GX2_ATTRIB_FORMAT_FLOAT_32_32_32_32 = GX2_ATTRIB_FLAG_SCALED | GX2_ATTRIB_TYPE_32_32_32_32_FLOAT, } GX2AttribFormat; WUT_ENUM_BITMASK_TYPE(GX2AttribFormat) typedef enum GX2AttribIndexType { - GX2_ATTRIB_INDEX_PER_VERTEX = 0, - GX2_ATTRIB_INDEX_PER_INSTANCE = 1, + GX2_ATTRIB_INDEX_PER_VERTEX = 0, + GX2_ATTRIB_INDEX_PER_INSTANCE = 1, } GX2AttribIndexType; typedef enum GX2BlendMode { - GX2_BLEND_MODE_ZERO = 0, - GX2_BLEND_MODE_ONE = 1, - GX2_BLEND_MODE_SRC_COLOR = 2, - GX2_BLEND_MODE_INV_SRC_COLOR = 3, - GX2_BLEND_MODE_SRC_ALPHA = 4, - GX2_BLEND_MODE_INV_SRC_ALPHA = 5, - GX2_BLEND_MODE_DST_ALPHA = 6, - GX2_BLEND_MODE_INV_DST_ALPHA = 7, - GX2_BLEND_MODE_DST_COLOR = 8, - GX2_BLEND_MODE_INV_DST_COLOR = 9, - GX2_BLEND_MODE_SRC_ALPHA_SAT = 10, - GX2_BLEND_MODE_BOTH_SRC_ALPHA = 11, - GX2_BLEND_MODE_BOTH_INV_SRC_ALPHA = 12, - GX2_BLEND_MODE_BLEND_FACTOR = 13, - GX2_BLEND_MODE_INV_BLEND_FACTOR = 14, - GX2_BLEND_MODE_SRC1_COLOR = 15, - GX2_BLEND_MODE_INV_SRC1_COLOR = 16, - GX2_BLEND_MODE_SRC1_ALPHA = 17, - GX2_BLEND_MODE_INV_SRC1_ALPHA = 18, - GX2_BLEND_MODE_CONSTANT_ALPHA = 19, - GX2_BLEND_MODE_INV_CONSTANT_ALPHA = 20, + GX2_BLEND_MODE_ZERO = 0, + GX2_BLEND_MODE_ONE = 1, + GX2_BLEND_MODE_SRC_COLOR = 2, + GX2_BLEND_MODE_INV_SRC_COLOR = 3, + GX2_BLEND_MODE_SRC_ALPHA = 4, + GX2_BLEND_MODE_INV_SRC_ALPHA = 5, + GX2_BLEND_MODE_DST_ALPHA = 6, + GX2_BLEND_MODE_INV_DST_ALPHA = 7, + GX2_BLEND_MODE_DST_COLOR = 8, + GX2_BLEND_MODE_INV_DST_COLOR = 9, + GX2_BLEND_MODE_SRC_ALPHA_SAT = 10, + GX2_BLEND_MODE_BOTH_SRC_ALPHA = 11, + GX2_BLEND_MODE_BOTH_INV_SRC_ALPHA = 12, + GX2_BLEND_MODE_BLEND_FACTOR = 13, + GX2_BLEND_MODE_INV_BLEND_FACTOR = 14, + GX2_BLEND_MODE_SRC1_COLOR = 15, + GX2_BLEND_MODE_INV_SRC1_COLOR = 16, + GX2_BLEND_MODE_SRC1_ALPHA = 17, + GX2_BLEND_MODE_INV_SRC1_ALPHA = 18, + GX2_BLEND_MODE_CONSTANT_ALPHA = 19, + GX2_BLEND_MODE_INV_CONSTANT_ALPHA = 20, } GX2BlendMode; typedef enum GX2BlendCombineMode { - GX2_BLEND_COMBINE_MODE_ADD = 0, - GX2_BLEND_COMBINE_MODE_SUB = 1, - GX2_BLEND_COMBINE_MODE_MIN = 2, - GX2_BLEND_COMBINE_MODE_MAX = 3, - GX2_BLEND_COMBINE_MODE_REV_SUB = 4, + GX2_BLEND_COMBINE_MODE_ADD = 0, + GX2_BLEND_COMBINE_MODE_SUB = 1, + GX2_BLEND_COMBINE_MODE_MIN = 2, + GX2_BLEND_COMBINE_MODE_MAX = 3, + GX2_BLEND_COMBINE_MODE_REV_SUB = 4, } GX2BlendCombineMode; typedef enum GX2BufferingMode { - GX2_BUFFERING_MODE_SINGLE = 1, - GX2_BUFFERING_MODE_DOUBLE = 2, - GX2_BUFFERING_MODE_TRIPLE = 3, + GX2_BUFFERING_MODE_SINGLE = 1, + GX2_BUFFERING_MODE_DOUBLE = 2, + GX2_BUFFERING_MODE_TRIPLE = 3, } GX2BufferingMode; typedef enum GX2ChannelMask { - GX2_CHANNEL_MASK_R = 1, - GX2_CHANNEL_MASK_G = 2, - GX2_CHANNEL_MASK_RG = 3, - GX2_CHANNEL_MASK_B = 4, - GX2_CHANNEL_MASK_RB = 5, - GX2_CHANNEL_MASK_GB = 6, - GX2_CHANNEL_MASK_RGB = 7, - GX2_CHANNEL_MASK_A = 8, - GX2_CHANNEL_MASK_RA = 9, - GX2_CHANNEL_MASK_GA = 10, - GX2_CHANNEL_MASK_RGA = 11, - GX2_CHANNEL_MASK_BA = 12, - GX2_CHANNEL_MASK_RBA = 13, - GX2_CHANNEL_MASK_GBA = 14, - GX2_CHANNEL_MASK_RGBA = 15, + GX2_CHANNEL_MASK_R = 1, + GX2_CHANNEL_MASK_G = 2, + GX2_CHANNEL_MASK_RG = 3, + GX2_CHANNEL_MASK_B = 4, + GX2_CHANNEL_MASK_RB = 5, + GX2_CHANNEL_MASK_GB = 6, + GX2_CHANNEL_MASK_RGB = 7, + GX2_CHANNEL_MASK_A = 8, + GX2_CHANNEL_MASK_RA = 9, + GX2_CHANNEL_MASK_GA = 10, + GX2_CHANNEL_MASK_RGA = 11, + GX2_CHANNEL_MASK_BA = 12, + GX2_CHANNEL_MASK_RBA = 13, + GX2_CHANNEL_MASK_GBA = 14, + GX2_CHANNEL_MASK_RGBA = 15, } GX2ChannelMask; typedef enum GX2ClearFlags { - GX2_CLEAR_FLAGS_DEPTH = 1, - GX2_CLEAR_FLAGS_STENCIL = 2, - GX2_CLEAR_FLAGS_BOTH = (GX2_CLEAR_FLAGS_DEPTH | GX2_CLEAR_FLAGS_STENCIL), + GX2_CLEAR_FLAGS_DEPTH = 1, + GX2_CLEAR_FLAGS_STENCIL = 2, + GX2_CLEAR_FLAGS_BOTH = (GX2_CLEAR_FLAGS_DEPTH | GX2_CLEAR_FLAGS_STENCIL), } GX2ClearFlags; WUT_ENUM_BITMASK_TYPE(GX2ClearFlags) typedef enum GX2CompareFunction { - GX2_COMPARE_FUNC_NEVER = 0, - GX2_COMPARE_FUNC_LESS = 1, - GX2_COMPARE_FUNC_EQUAL = 2, - GX2_COMPARE_FUNC_LEQUAL = 3, - GX2_COMPARE_FUNC_GREATER = 4, - GX2_COMPARE_FUNC_NOT_EQUAL = 5, - GX2_COMPARE_FUNC_GEQUAL = 6, - GX2_COMPARE_FUNC_ALWAYS = 7, + GX2_COMPARE_FUNC_NEVER = 0, + GX2_COMPARE_FUNC_LESS = 1, + GX2_COMPARE_FUNC_EQUAL = 2, + GX2_COMPARE_FUNC_LEQUAL = 3, + GX2_COMPARE_FUNC_GREATER = 4, + GX2_COMPARE_FUNC_NOT_EQUAL = 5, + GX2_COMPARE_FUNC_GEQUAL = 6, + GX2_COMPARE_FUNC_ALWAYS = 7, } GX2CompareFunction; typedef enum GX2DrcRenderMode { - GX2_DRC_RENDER_MODE_DISABLED = 0, - GX2_DRC_RENDER_MODE_SINGLE = 1, - GX2_DRC_RENDER_MODE_DOUBLE = 2, + GX2_DRC_RENDER_MODE_DISABLED = 0, + GX2_DRC_RENDER_MODE_SINGLE = 1, + GX2_DRC_RENDER_MODE_DOUBLE = 2, } GX2DrcRenderMode; typedef enum GX2EventType @@ -206,10 +206,10 @@ typedef enum GX2EventType typedef enum GX2EndianSwapMode { - GX2_ENDIAN_SWAP_NONE = 0, - GX2_ENDIAN_SWAP_8_IN_16 = 1, - GX2_ENDIAN_SWAP_8_IN_32 = 2, - GX2_ENDIAN_SWAP_DEFAULT = 3, + GX2_ENDIAN_SWAP_NONE = 0, + GX2_ENDIAN_SWAP_8_IN_16 = 1, + GX2_ENDIAN_SWAP_8_IN_32 = 2, + GX2_ENDIAN_SWAP_DEFAULT = 3, } GX2EndianSwapMode; typedef enum GX2FetchShaderType @@ -222,401 +222,401 @@ typedef enum GX2FetchShaderType typedef enum GX2FrontFace { - GX2_FRONT_FACE_CCW = 0, - GX2_FRONT_FACE_CW = 1, + GX2_FRONT_FACE_CCW = 0, + GX2_FRONT_FACE_CW = 1, } GX2FrontFace; typedef enum GX2IndexType { - GX2_INDEX_TYPE_U16_LE = 0, - GX2_INDEX_TYPE_U32_LE = 1, - GX2_INDEX_TYPE_U16 = 4, - GX2_INDEX_TYPE_U32 = 9, + GX2_INDEX_TYPE_U16_LE = 0, + GX2_INDEX_TYPE_U32_LE = 1, + GX2_INDEX_TYPE_U16 = 4, + GX2_INDEX_TYPE_U32 = 9, } GX2IndexType; typedef enum GX2InvalidateMode { - GX2_INVALIDATE_MODE_NONE = 0, - GX2_INVALIDATE_MODE_ATTRIBUTE_BUFFER = 1 << 0, - GX2_INVALIDATE_MODE_TEXTURE = 1 << 1, - GX2_INVALIDATE_MODE_UNIFORM_BLOCK = 1 << 2, - GX2_INVALIDATE_MODE_SHADER = 1 << 3, - GX2_INVALIDATE_MODE_COLOR_BUFFER = 1 << 4, - GX2_INVALIDATE_MODE_DEPTH_BUFFER = 1 << 5, - GX2_INVALIDATE_MODE_CPU = 1 << 6, - GX2_INVALIDATE_MODE_STREAM_OUT_BUFFER = 1 << 7, - GX2_INVALIDATE_MODE_EXPORT_BUFFER = 1 << 8, - GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER= GX2_INVALIDATE_MODE_CPU | GX2_INVALIDATE_MODE_ATTRIBUTE_BUFFER, - GX2_INVALIDATE_MODE_CPU_TEXTURE = GX2_INVALIDATE_MODE_CPU | GX2_INVALIDATE_MODE_TEXTURE, - GX2_INVALIDATE_MODE_CPU_SHADER = GX2_INVALIDATE_MODE_CPU | GX2_INVALIDATE_MODE_SHADER, + GX2_INVALIDATE_MODE_NONE = 0, + GX2_INVALIDATE_MODE_ATTRIBUTE_BUFFER = 1 << 0, + GX2_INVALIDATE_MODE_TEXTURE = 1 << 1, + GX2_INVALIDATE_MODE_UNIFORM_BLOCK = 1 << 2, + GX2_INVALIDATE_MODE_SHADER = 1 << 3, + GX2_INVALIDATE_MODE_COLOR_BUFFER = 1 << 4, + GX2_INVALIDATE_MODE_DEPTH_BUFFER = 1 << 5, + GX2_INVALIDATE_MODE_CPU = 1 << 6, + GX2_INVALIDATE_MODE_STREAM_OUT_BUFFER = 1 << 7, + GX2_INVALIDATE_MODE_EXPORT_BUFFER = 1 << 8, + GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER = GX2_INVALIDATE_MODE_CPU | GX2_INVALIDATE_MODE_ATTRIBUTE_BUFFER, + GX2_INVALIDATE_MODE_CPU_TEXTURE = GX2_INVALIDATE_MODE_CPU | GX2_INVALIDATE_MODE_TEXTURE, + GX2_INVALIDATE_MODE_CPU_SHADER = GX2_INVALIDATE_MODE_CPU | GX2_INVALIDATE_MODE_SHADER, } GX2InvalidateMode; WUT_ENUM_BITMASK_TYPE(GX2InvalidateMode) typedef enum GX2InitAttributes { - GX2_INIT_END = 0, - GX2_INIT_CMD_BUF_BASE = 1, - GX2_INIT_CMD_BUF_POOL_SIZE = 2, - GX2_INIT_ARGC = 7, - GX2_INIT_ARGV = 8, - GX2_INIT_PROFILE_MODE = 9, - GX2_INIT_TOSS_STAGE = 10, - GX2_INIT_APP_IO_THREAD_STACK_SIZE = 11, + GX2_INIT_END = 0, + GX2_INIT_CMD_BUF_BASE = 1, + GX2_INIT_CMD_BUF_POOL_SIZE = 2, + GX2_INIT_ARGC = 7, + GX2_INIT_ARGV = 8, + GX2_INIT_PROFILE_MODE = 9, + GX2_INIT_TOSS_STAGE = 10, + GX2_INIT_APP_IO_THREAD_STACK_SIZE = 11, } GX2InitAttributes; typedef enum GX2LogicOp { - GX2_LOGIC_OP_CLEAR = 0x00, - GX2_LOGIC_OP_NOR = 0x11, - GX2_LOGIC_OP_INV_AND = 0x22, - GX2_LOGIC_OP_INV_COPY = 0x33, - GX2_LOGIC_OP_REV_AND = 0x44, - GX2_LOGIC_OP_INV = 0x55, - GX2_LOGIC_OP_XOR = 0x66, - GX2_LOGIC_OP_NOT_AND = 0x77, - GX2_LOGIC_OP_AND = 0x88, - GX2_LOGIC_OP_EQUIV = 0x99, - GX2_LOGIC_OP_NOP = 0xAA, - GX2_LOGIC_OP_INV_OR = 0xBB, - GX2_LOGIC_OP_COPY = 0xCC, - GX2_LOGIC_OP_REV_OR = 0xDD, - GX2_LOGIC_OP_OR = 0xEE, - GX2_LOGIC_OP_SET = 0xFF, + GX2_LOGIC_OP_CLEAR = 0x00, + GX2_LOGIC_OP_NOR = 0x11, + GX2_LOGIC_OP_INV_AND = 0x22, + GX2_LOGIC_OP_INV_COPY = 0x33, + GX2_LOGIC_OP_REV_AND = 0x44, + GX2_LOGIC_OP_INV = 0x55, + GX2_LOGIC_OP_XOR = 0x66, + GX2_LOGIC_OP_NOT_AND = 0x77, + GX2_LOGIC_OP_AND = 0x88, + GX2_LOGIC_OP_EQUIV = 0x99, + GX2_LOGIC_OP_NOP = 0xAA, + GX2_LOGIC_OP_INV_OR = 0xBB, + GX2_LOGIC_OP_COPY = 0xCC, + GX2_LOGIC_OP_REV_OR = 0xDD, + GX2_LOGIC_OP_OR = 0xEE, + GX2_LOGIC_OP_SET = 0xFF, } GX2LogicOp; typedef enum GX2PrimitiveMode { - GX2_PRIMITIVE_MODE_POINTS = 1, - GX2_PRIMITIVE_MODE_LINES = 2, - GX2_PRIMITIVE_MODE_LINE_STRIP = 3, - GX2_PRIMITIVE_MODE_TRIANGLES = 4, - GX2_PRIMITIVE_MODE_TRIANGLE_FAN = 5, - GX2_PRIMITIVE_MODE_TRIANGLE_STRIP = 6, - GX2_PRIMITIVE_MODE_LINES_ADJACENCY = 10, - GX2_PRIMITIVE_MODE_LINE_STRIP_ADJACENCY = 11, - GX2_PRIMITIVE_MODE_TRIANGLES_ADJACENCY = 12, - GX2_PRIMITIVE_MODE_TRIANGLE_STRIP_ADJACENCY = 13, - GX2_PRIMITIVE_MODE_RECTS = 17, - GX2_PRIMITIVE_MODE_LINE_LOOP = 18, - GX2_PRIMITIVE_MODE_QUADS = 19, - GX2_PRIMITIVE_MODE_QUAD_STRIP = 20, + GX2_PRIMITIVE_MODE_POINTS = 1, + GX2_PRIMITIVE_MODE_LINES = 2, + GX2_PRIMITIVE_MODE_LINE_STRIP = 3, + GX2_PRIMITIVE_MODE_TRIANGLES = 4, + GX2_PRIMITIVE_MODE_TRIANGLE_FAN = 5, + GX2_PRIMITIVE_MODE_TRIANGLE_STRIP = 6, + GX2_PRIMITIVE_MODE_LINES_ADJACENCY = 10, + GX2_PRIMITIVE_MODE_LINE_STRIP_ADJACENCY = 11, + GX2_PRIMITIVE_MODE_TRIANGLES_ADJACENCY = 12, + GX2_PRIMITIVE_MODE_TRIANGLE_STRIP_ADJACENCY = 13, + GX2_PRIMITIVE_MODE_RECTS = 17, + GX2_PRIMITIVE_MODE_LINE_LOOP = 18, + GX2_PRIMITIVE_MODE_QUADS = 19, + GX2_PRIMITIVE_MODE_QUAD_STRIP = 20, } GX2PrimitiveMode; typedef enum GX2PolygonMode { - GX2_POLYGON_MODE_POINT = 0, - GX2_POLYGON_MODE_LINE = 1, - GX2_POLYGON_MODE_TRIANGLE = 2, + GX2_POLYGON_MODE_POINT = 0, + GX2_POLYGON_MODE_LINE = 1, + GX2_POLYGON_MODE_TRIANGLE = 2, } GX2PolygonMode; typedef enum GX2RenderTarget { - GX2_RENDER_TARGET_0 = 0, - GX2_RENDER_TARGET_1 = 1, - GX2_RENDER_TARGET_2 = 2, - GX2_RENDER_TARGET_3 = 3, - GX2_RENDER_TARGET_4 = 4, - GX2_RENDER_TARGET_5 = 5, - GX2_RENDER_TARGET_6 = 6, - GX2_RENDER_TARGET_7 = 7, + GX2_RENDER_TARGET_0 = 0, + GX2_RENDER_TARGET_1 = 1, + GX2_RENDER_TARGET_2 = 2, + GX2_RENDER_TARGET_3 = 3, + GX2_RENDER_TARGET_4 = 4, + GX2_RENDER_TARGET_5 = 5, + GX2_RENDER_TARGET_6 = 6, + GX2_RENDER_TARGET_7 = 7, } GX2RenderTarget; typedef enum GX2RoundingMode { - GX2_ROUNDING_MODE_ROUND_TO_EVEN = 0, - GX2_ROUNDING_MODE_TRUNCATE = 1, + GX2_ROUNDING_MODE_ROUND_TO_EVEN = 0, + GX2_ROUNDING_MODE_TRUNCATE = 1, } GX2RoundingMode; typedef enum GX2SamplerVarType { - GX2_SAMPLER_VAR_TYPE_SAMPLER_1D = 0, - GX2_SAMPLER_VAR_TYPE_SAMPLER_2D = 1, - GX2_SAMPLER_VAR_TYPE_SAMPLER_3D = 3, - GX2_SAMPLER_VAR_TYPE_SAMPLER_CUBE = 4, + GX2_SAMPLER_VAR_TYPE_SAMPLER_1D = 0, + GX2_SAMPLER_VAR_TYPE_SAMPLER_2D = 1, + GX2_SAMPLER_VAR_TYPE_SAMPLER_3D = 3, + GX2_SAMPLER_VAR_TYPE_SAMPLER_CUBE = 4, } GX2SamplerVarType; typedef enum GX2ScanTarget { - GX2_SCAN_TARGET_TV0 = 1 << 0, - GX2_SCAN_TARGET_TV1 = 1 << 1, - GX2_SCAN_TARGET_DRC0 = 1 << 2, - GX2_SCAN_TARGET_DRC1 = 1 << 3, - GX2_SCAN_TARGET_TV = GX2_SCAN_TARGET_TV0, - GX2_SCAN_TARGET_DRC = GX2_SCAN_TARGET_DRC0, + GX2_SCAN_TARGET_TV0 = 1 << 0, + GX2_SCAN_TARGET_TV1 = 1 << 1, + GX2_SCAN_TARGET_DRC0 = 1 << 2, + GX2_SCAN_TARGET_DRC1 = 1 << 3, + GX2_SCAN_TARGET_TV = GX2_SCAN_TARGET_TV0, + GX2_SCAN_TARGET_DRC = GX2_SCAN_TARGET_DRC0, } GX2ScanTarget; WUT_ENUM_BITMASK_TYPE(GX2ScanTarget) typedef enum GX2ShaderMode { - GX2_SHADER_MODE_UNIFORM_REGISTER = 0, - GX2_SHADER_MODE_UNIFORM_BLOCK = 1, - GX2_SHADER_MODE_GEOMETRY_SHADER = 2, - GX2_SHADER_MODE_COMPUTE_SHADER = 3, + GX2_SHADER_MODE_UNIFORM_REGISTER = 0, + GX2_SHADER_MODE_UNIFORM_BLOCK = 1, + GX2_SHADER_MODE_GEOMETRY_SHADER = 2, + GX2_SHADER_MODE_COMPUTE_SHADER = 3, } GX2ShaderMode; typedef enum GX2ShaderVarType { - GX2_SHADER_VAR_TYPE_VOID = 0, - GX2_SHADER_VAR_TYPE_BOOL = 1, - GX2_SHADER_VAR_TYPE_INT = 2, - GX2_SHADER_VAR_TYPE_UINT = 3, - GX2_SHADER_VAR_TYPE_FLOAT = 4, - GX2_SHADER_VAR_TYPE_DOUBLE = 5, - GX2_SHADER_VAR_TYPE_DOUBLE2 = 6, - GX2_SHADER_VAR_TYPE_DOUBLE3 = 7, - GX2_SHADER_VAR_TYPE_DOUBLE4 = 8, - GX2_SHADER_VAR_TYPE_FLOAT2 = 9, - GX2_SHADER_VAR_TYPE_FLOAT3 = 10, - GX2_SHADER_VAR_TYPE_FLOAT4 = 11, - GX2_SHADER_VAR_TYPE_BOOL2 = 12, - GX2_SHADER_VAR_TYPE_BOOL3 = 13, - GX2_SHADER_VAR_TYPE_BOOL4 = 14, - GX2_SHADER_VAR_TYPE_INT2 = 15, - GX2_SHADER_VAR_TYPE_INT3 = 16, - GX2_SHADER_VAR_TYPE_INT4 = 17, - GX2_SHADER_VAR_TYPE_UINT2 = 18, - GX2_SHADER_VAR_TYPE_UINT3 = 19, - GX2_SHADER_VAR_TYPE_UINT4 = 20, - GX2_SHADER_VAR_TYPE_FLOAT2X2 = 21, - GX2_SHADER_VAR_TYPE_FLOAT2X3 = 22, - GX2_SHADER_VAR_TYPE_FLOAT2X4 = 23, - GX2_SHADER_VAR_TYPE_FLOAT3X2 = 24, - GX2_SHADER_VAR_TYPE_FLOAT3X3 = 25, - GX2_SHADER_VAR_TYPE_FLOAT3X4 = 26, - GX2_SHADER_VAR_TYPE_FLOAT4X2 = 27, - GX2_SHADER_VAR_TYPE_FLOAT4X3 = 28, - GX2_SHADER_VAR_TYPE_FLOAT4X4 = 29, - GX2_SHADER_VAR_TYPE_DOUBLE2X2 = 30, - GX2_SHADER_VAR_TYPE_DOUBLE2X3 = 31, - GX2_SHADER_VAR_TYPE_DOUBLE2X4 = 32, - GX2_SHADER_VAR_TYPE_DOUBLE3X2 = 33, - GX2_SHADER_VAR_TYPE_DOUBLE3X3 = 34, - GX2_SHADER_VAR_TYPE_DOUBLE3X4 = 35, - GX2_SHADER_VAR_TYPE_DOUBLE4X2 = 36, - GX2_SHADER_VAR_TYPE_DOUBLE4X3 = 37, - GX2_SHADER_VAR_TYPE_DOUBLE4X4 = 38, + GX2_SHADER_VAR_TYPE_VOID = 0, + GX2_SHADER_VAR_TYPE_BOOL = 1, + GX2_SHADER_VAR_TYPE_INT = 2, + GX2_SHADER_VAR_TYPE_UINT = 3, + GX2_SHADER_VAR_TYPE_FLOAT = 4, + GX2_SHADER_VAR_TYPE_DOUBLE = 5, + GX2_SHADER_VAR_TYPE_DOUBLE2 = 6, + GX2_SHADER_VAR_TYPE_DOUBLE3 = 7, + GX2_SHADER_VAR_TYPE_DOUBLE4 = 8, + GX2_SHADER_VAR_TYPE_FLOAT2 = 9, + GX2_SHADER_VAR_TYPE_FLOAT3 = 10, + GX2_SHADER_VAR_TYPE_FLOAT4 = 11, + GX2_SHADER_VAR_TYPE_BOOL2 = 12, + GX2_SHADER_VAR_TYPE_BOOL3 = 13, + GX2_SHADER_VAR_TYPE_BOOL4 = 14, + GX2_SHADER_VAR_TYPE_INT2 = 15, + GX2_SHADER_VAR_TYPE_INT3 = 16, + GX2_SHADER_VAR_TYPE_INT4 = 17, + GX2_SHADER_VAR_TYPE_UINT2 = 18, + GX2_SHADER_VAR_TYPE_UINT3 = 19, + GX2_SHADER_VAR_TYPE_UINT4 = 20, + GX2_SHADER_VAR_TYPE_FLOAT2X2 = 21, + GX2_SHADER_VAR_TYPE_FLOAT2X3 = 22, + GX2_SHADER_VAR_TYPE_FLOAT2X4 = 23, + GX2_SHADER_VAR_TYPE_FLOAT3X2 = 24, + GX2_SHADER_VAR_TYPE_FLOAT3X3 = 25, + GX2_SHADER_VAR_TYPE_FLOAT3X4 = 26, + GX2_SHADER_VAR_TYPE_FLOAT4X2 = 27, + GX2_SHADER_VAR_TYPE_FLOAT4X3 = 28, + GX2_SHADER_VAR_TYPE_FLOAT4X4 = 29, + GX2_SHADER_VAR_TYPE_DOUBLE2X2 = 30, + GX2_SHADER_VAR_TYPE_DOUBLE2X3 = 31, + GX2_SHADER_VAR_TYPE_DOUBLE2X4 = 32, + GX2_SHADER_VAR_TYPE_DOUBLE3X2 = 33, + GX2_SHADER_VAR_TYPE_DOUBLE3X3 = 34, + GX2_SHADER_VAR_TYPE_DOUBLE3X4 = 35, + GX2_SHADER_VAR_TYPE_DOUBLE4X2 = 36, + GX2_SHADER_VAR_TYPE_DOUBLE4X3 = 37, + GX2_SHADER_VAR_TYPE_DOUBLE4X4 = 38, } GX2ShaderVarType; typedef enum GX2StencilFunction { - GX2_STENCIL_FUNCTION_KEEP = 0, - GX2_STENCIL_FUNCTION_ZERO = 1, - GX2_STENCIL_FUNCTION_REPLACE = 2, - GX2_STENCIL_FUNCTION_INCR_CLAMP = 3, - GX2_STENCIL_FUNCTION_DECR_CLAMP = 4, - GX2_STENCIL_FUNCTION_INV = 5, - GX2_STENCIL_FUNCTION_INCR_WRAP = 6, - GX2_STENCIL_FUNCTION_DECR_WRAP = 7, + GX2_STENCIL_FUNCTION_KEEP = 0, + GX2_STENCIL_FUNCTION_ZERO = 1, + GX2_STENCIL_FUNCTION_REPLACE = 2, + GX2_STENCIL_FUNCTION_INCR_CLAMP = 3, + GX2_STENCIL_FUNCTION_DECR_CLAMP = 4, + GX2_STENCIL_FUNCTION_INV = 5, + GX2_STENCIL_FUNCTION_INCR_WRAP = 6, + GX2_STENCIL_FUNCTION_DECR_WRAP = 7, } GX2StencilFunction; typedef enum GX2SurfaceDim { - GX2_SURFACE_DIM_TEXTURE_1D = 0, - GX2_SURFACE_DIM_TEXTURE_2D = 1, - GX2_SURFACE_DIM_TEXTURE_3D = 2, - GX2_SURFACE_DIM_TEXTURE_CUBE = 3, - GX2_SURFACE_DIM_TEXTURE_1D_ARRAY = 4, - GX2_SURFACE_DIM_TEXTURE_2D_ARRAY = 5, - GX2_SURFACE_DIM_TEXTURE_2D_MSAA = 6, - GX2_SURFACE_DIM_TEXTURE_2D_MSAA_ARRAY = 7, + GX2_SURFACE_DIM_TEXTURE_1D = 0, + GX2_SURFACE_DIM_TEXTURE_2D = 1, + GX2_SURFACE_DIM_TEXTURE_3D = 2, + GX2_SURFACE_DIM_TEXTURE_CUBE = 3, + GX2_SURFACE_DIM_TEXTURE_1D_ARRAY = 4, + GX2_SURFACE_DIM_TEXTURE_2D_ARRAY = 5, + GX2_SURFACE_DIM_TEXTURE_2D_MSAA = 6, + GX2_SURFACE_DIM_TEXTURE_2D_MSAA_ARRAY = 7, } GX2SurfaceDim; typedef enum GX2SurfaceFormat { - GX2_SURFACE_FORMAT_INVALID = 0x00, - GX2_SURFACE_FORMAT_UNORM_R4_G4 = 0x02, - GX2_SURFACE_FORMAT_UNORM_R4_G4_B4_A4 = 0x0b, - GX2_SURFACE_FORMAT_UNORM_R8 = 0x01, - GX2_SURFACE_FORMAT_UNORM_R8_G8 = 0x07, - GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8 = 0x01a, - GX2_SURFACE_FORMAT_UNORM_R16 = 0x05, - GX2_SURFACE_FORMAT_UNORM_R16_G16 = 0x0f, - GX2_SURFACE_FORMAT_UNORM_R16_G16_B16_A16 = 0x01f, - GX2_SURFACE_FORMAT_UNORM_R5_G6_B5 = 0x08, - GX2_SURFACE_FORMAT_UNORM_R5_G5_B5_A1 = 0x0a, - GX2_SURFACE_FORMAT_UNORM_A1_B5_G5_R5 = 0x0c, - GX2_SURFACE_FORMAT_UNORM_R24_X8 = 0x011, - GX2_SURFACE_FORMAT_UNORM_A2_B10_G10_R10 = 0x01b, - GX2_SURFACE_FORMAT_UNORM_R10_G10_B10_A2 = 0x019, - GX2_SURFACE_FORMAT_UNORM_BC1 = 0x031, - GX2_SURFACE_FORMAT_UNORM_BC2 = 0x032, - GX2_SURFACE_FORMAT_UNORM_BC3 = 0x033, - GX2_SURFACE_FORMAT_UNORM_BC4 = 0x034, - GX2_SURFACE_FORMAT_UNORM_BC5 = 0x035, - GX2_SURFACE_FORMAT_UNORM_NV12 = 0x081, - - GX2_SURFACE_FORMAT_UINT_R8 = 0x101, - GX2_SURFACE_FORMAT_UINT_R8_G8 = 0x107, - GX2_SURFACE_FORMAT_UINT_R8_G8_B8_A8 = 0x11a, - GX2_SURFACE_FORMAT_UINT_R16 = 0x105, - GX2_SURFACE_FORMAT_UINT_R16_G16 = 0x10f, - GX2_SURFACE_FORMAT_UINT_R16_G16_B16_A16 = 0x11f, - GX2_SURFACE_FORMAT_UINT_R32 = 0x10d, - GX2_SURFACE_FORMAT_UINT_R32_G32 = 0x11d, - GX2_SURFACE_FORMAT_UINT_R32_G32_B32_A32 = 0x122, - GX2_SURFACE_FORMAT_UINT_A2_B10_G10_R10 = 0x11b, - GX2_SURFACE_FORMAT_UINT_R10_G10_B10_A2 = 0x119, - GX2_SURFACE_FORMAT_UINT_X24_G8 = 0x111, - GX2_SURFACE_FORMAT_UINT_G8_X24 = 0x11c, - - GX2_SURFACE_FORMAT_SNORM_R8 = 0x201, - GX2_SURFACE_FORMAT_SNORM_R8_G8 = 0x207, - GX2_SURFACE_FORMAT_SNORM_R8_G8_B8_A8 = 0x21a, - GX2_SURFACE_FORMAT_SNORM_R16 = 0x205, - GX2_SURFACE_FORMAT_SNORM_R16_G16 = 0x20f, - GX2_SURFACE_FORMAT_SNORM_R16_G16_B16_A16 = 0x21f, - GX2_SURFACE_FORMAT_SNORM_R10_G10_B10_A2 = 0x219, - GX2_SURFACE_FORMAT_SNORM_BC4 = 0x234, - GX2_SURFACE_FORMAT_SNORM_BC5 = 0x235, - - GX2_SURFACE_FORMAT_SINT_R8 = 0x301, - GX2_SURFACE_FORMAT_SINT_R8_G8 = 0x307, - GX2_SURFACE_FORMAT_SINT_R8_G8_B8_A8 = 0x31a, - GX2_SURFACE_FORMAT_SINT_R16 = 0x305, - GX2_SURFACE_FORMAT_SINT_R16_G16 = 0x30f, - GX2_SURFACE_FORMAT_SINT_R16_G16_B16_A16 = 0x31f, - GX2_SURFACE_FORMAT_SINT_R32 = 0x30d, - GX2_SURFACE_FORMAT_SINT_R32_G32 = 0x31d, - GX2_SURFACE_FORMAT_SINT_R32_G32_B32_A32 = 0x322, - GX2_SURFACE_FORMAT_SINT_R10_G10_B10_A2 = 0x319, - - GX2_SURFACE_FORMAT_SRGB_R8_G8_B8_A8 = 0x41a, - GX2_SURFACE_FORMAT_SRGB_BC1 = 0x431, - GX2_SURFACE_FORMAT_SRGB_BC2 = 0x432, - GX2_SURFACE_FORMAT_SRGB_BC3 = 0x433, - - GX2_SURFACE_FORMAT_FLOAT_R32 = 0x80e, - GX2_SURFACE_FORMAT_FLOAT_R32_G32 = 0x81e, - GX2_SURFACE_FORMAT_FLOAT_R32_G32_B32_A32 = 0x823, - GX2_SURFACE_FORMAT_FLOAT_R16 = 0x806, - GX2_SURFACE_FORMAT_FLOAT_R16_G16 = 0x810, - GX2_SURFACE_FORMAT_FLOAT_R16_G16_B16_A16 = 0x820, - GX2_SURFACE_FORMAT_FLOAT_R11_G11_B10 = 0x816, - GX2_SURFACE_FORMAT_FLOAT_D24_S8 = 0x811, - GX2_SURFACE_FORMAT_FLOAT_X8_X24 = 0x81c, + GX2_SURFACE_FORMAT_INVALID = 0x00, + GX2_SURFACE_FORMAT_UNORM_R4_G4 = 0x02, + GX2_SURFACE_FORMAT_UNORM_R4_G4_B4_A4 = 0x0b, + GX2_SURFACE_FORMAT_UNORM_R8 = 0x01, + GX2_SURFACE_FORMAT_UNORM_R8_G8 = 0x07, + GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8 = 0x01a, + GX2_SURFACE_FORMAT_UNORM_R16 = 0x05, + GX2_SURFACE_FORMAT_UNORM_R16_G16 = 0x0f, + GX2_SURFACE_FORMAT_UNORM_R16_G16_B16_A16 = 0x01f, + GX2_SURFACE_FORMAT_UNORM_R5_G6_B5 = 0x08, + GX2_SURFACE_FORMAT_UNORM_R5_G5_B5_A1 = 0x0a, + GX2_SURFACE_FORMAT_UNORM_A1_B5_G5_R5 = 0x0c, + GX2_SURFACE_FORMAT_UNORM_R24_X8 = 0x011, + GX2_SURFACE_FORMAT_UNORM_A2_B10_G10_R10 = 0x01b, + GX2_SURFACE_FORMAT_UNORM_R10_G10_B10_A2 = 0x019, + GX2_SURFACE_FORMAT_UNORM_BC1 = 0x031, + GX2_SURFACE_FORMAT_UNORM_BC2 = 0x032, + GX2_SURFACE_FORMAT_UNORM_BC3 = 0x033, + GX2_SURFACE_FORMAT_UNORM_BC4 = 0x034, + GX2_SURFACE_FORMAT_UNORM_BC5 = 0x035, + GX2_SURFACE_FORMAT_UNORM_NV12 = 0x081, + + GX2_SURFACE_FORMAT_UINT_R8 = 0x101, + GX2_SURFACE_FORMAT_UINT_R8_G8 = 0x107, + GX2_SURFACE_FORMAT_UINT_R8_G8_B8_A8 = 0x11a, + GX2_SURFACE_FORMAT_UINT_R16 = 0x105, + GX2_SURFACE_FORMAT_UINT_R16_G16 = 0x10f, + GX2_SURFACE_FORMAT_UINT_R16_G16_B16_A16 = 0x11f, + GX2_SURFACE_FORMAT_UINT_R32 = 0x10d, + GX2_SURFACE_FORMAT_UINT_R32_G32 = 0x11d, + GX2_SURFACE_FORMAT_UINT_R32_G32_B32_A32 = 0x122, + GX2_SURFACE_FORMAT_UINT_A2_B10_G10_R10 = 0x11b, + GX2_SURFACE_FORMAT_UINT_R10_G10_B10_A2 = 0x119, + GX2_SURFACE_FORMAT_UINT_X24_G8 = 0x111, + GX2_SURFACE_FORMAT_UINT_G8_X24 = 0x11c, + + GX2_SURFACE_FORMAT_SNORM_R8 = 0x201, + GX2_SURFACE_FORMAT_SNORM_R8_G8 = 0x207, + GX2_SURFACE_FORMAT_SNORM_R8_G8_B8_A8 = 0x21a, + GX2_SURFACE_FORMAT_SNORM_R16 = 0x205, + GX2_SURFACE_FORMAT_SNORM_R16_G16 = 0x20f, + GX2_SURFACE_FORMAT_SNORM_R16_G16_B16_A16 = 0x21f, + GX2_SURFACE_FORMAT_SNORM_R10_G10_B10_A2 = 0x219, + GX2_SURFACE_FORMAT_SNORM_BC4 = 0x234, + GX2_SURFACE_FORMAT_SNORM_BC5 = 0x235, + + GX2_SURFACE_FORMAT_SINT_R8 = 0x301, + GX2_SURFACE_FORMAT_SINT_R8_G8 = 0x307, + GX2_SURFACE_FORMAT_SINT_R8_G8_B8_A8 = 0x31a, + GX2_SURFACE_FORMAT_SINT_R16 = 0x305, + GX2_SURFACE_FORMAT_SINT_R16_G16 = 0x30f, + GX2_SURFACE_FORMAT_SINT_R16_G16_B16_A16 = 0x31f, + GX2_SURFACE_FORMAT_SINT_R32 = 0x30d, + GX2_SURFACE_FORMAT_SINT_R32_G32 = 0x31d, + GX2_SURFACE_FORMAT_SINT_R32_G32_B32_A32 = 0x322, + GX2_SURFACE_FORMAT_SINT_R10_G10_B10_A2 = 0x319, + + GX2_SURFACE_FORMAT_SRGB_R8_G8_B8_A8 = 0x41a, + GX2_SURFACE_FORMAT_SRGB_BC1 = 0x431, + GX2_SURFACE_FORMAT_SRGB_BC2 = 0x432, + GX2_SURFACE_FORMAT_SRGB_BC3 = 0x433, + + GX2_SURFACE_FORMAT_FLOAT_R32 = 0x80e, + GX2_SURFACE_FORMAT_FLOAT_R32_G32 = 0x81e, + GX2_SURFACE_FORMAT_FLOAT_R32_G32_B32_A32 = 0x823, + GX2_SURFACE_FORMAT_FLOAT_R16 = 0x806, + GX2_SURFACE_FORMAT_FLOAT_R16_G16 = 0x810, + GX2_SURFACE_FORMAT_FLOAT_R16_G16_B16_A16 = 0x820, + GX2_SURFACE_FORMAT_FLOAT_R11_G11_B10 = 0x816, + GX2_SURFACE_FORMAT_FLOAT_D24_S8 = 0x811, + GX2_SURFACE_FORMAT_FLOAT_X8_X24 = 0x81c, } GX2SurfaceFormat; typedef enum GX2SurfaceUse { - GX2_SURFACE_USE_NONE = 0, - GX2_SURFACE_USE_TEXTURE = 1 << 0, - GX2_SURFACE_USE_COLOR_BUFFER = 1 << 1, - GX2_SURFACE_USE_DEPTH_BUFFER = 1 << 2, - GX2_SURFACE_USE_SCAN_BUFFER = 1 << 3, - GX2_SURFACE_USE_TV = 1 << 31, - GX2_SURFACE_USE_TEXTURE_COLOR_BUFFER_TV = (GX2_SURFACE_USE_TEXTURE | GX2_SURFACE_USE_COLOR_BUFFER | GX2_SURFACE_USE_TV) + GX2_SURFACE_USE_NONE = 0, + GX2_SURFACE_USE_TEXTURE = 1 << 0, + GX2_SURFACE_USE_COLOR_BUFFER = 1 << 1, + GX2_SURFACE_USE_DEPTH_BUFFER = 1 << 2, + GX2_SURFACE_USE_SCAN_BUFFER = 1 << 3, + GX2_SURFACE_USE_TV = 1 << 31, + GX2_SURFACE_USE_TEXTURE_COLOR_BUFFER_TV = (GX2_SURFACE_USE_TEXTURE | GX2_SURFACE_USE_COLOR_BUFFER | GX2_SURFACE_USE_TV) } GX2SurfaceUse; WUT_ENUM_BITMASK_TYPE(GX2SurfaceUse) typedef enum GX2TessellationMode { - GX2_TESSELLATION_MODE_DISCRETE = 0, - GX2_TESSELLATION_MODE_CONTINUOUS = 1, - GX2_TESSELLATION_MODE_ADAPTIVE = 2, + GX2_TESSELLATION_MODE_DISCRETE = 0, + GX2_TESSELLATION_MODE_CONTINUOUS = 1, + GX2_TESSELLATION_MODE_ADAPTIVE = 2, } GX2TessellationMode; typedef enum GX2TexBorderType { - GX2_TEX_BORDER_TYPE_TRANSPARENT_BLACK = 0, - GX2_TEX_BORDER_TYPE_BLACK = 1, - GX2_TEX_BORDER_TYPE_WHITE = 2, - GX2_TEX_BORDER_TYPE_VARIABLE = 3, + GX2_TEX_BORDER_TYPE_TRANSPARENT_BLACK = 0, + GX2_TEX_BORDER_TYPE_BLACK = 1, + GX2_TEX_BORDER_TYPE_WHITE = 2, + GX2_TEX_BORDER_TYPE_VARIABLE = 3, } GX2TexBorderType; typedef enum GX2TexClampMode { - GX2_TEX_CLAMP_MODE_WRAP = 0, - GX2_TEX_CLAMP_MODE_MIRROR = 1, - GX2_TEX_CLAMP_MODE_CLAMP = 2, - GX2_TEX_CLAMP_MODE_MIRROR_ONCE = 3, - GX2_TEX_CLAMP_MODE_CLAMP_HALF_BORDER = 4, - GX2_TEX_CLAMP_MODE_MIRROR_ONCE_HALF_BORDER = 5, - GX2_TEX_CLAMP_MODE_CLAMP_BORDER = 6, - GX2_TEX_CLAMP_MODE_MIRROR_ONCE_BORDER = 7, + GX2_TEX_CLAMP_MODE_WRAP = 0, + GX2_TEX_CLAMP_MODE_MIRROR = 1, + GX2_TEX_CLAMP_MODE_CLAMP = 2, + GX2_TEX_CLAMP_MODE_MIRROR_ONCE = 3, + GX2_TEX_CLAMP_MODE_CLAMP_HALF_BORDER = 4, + GX2_TEX_CLAMP_MODE_MIRROR_ONCE_HALF_BORDER = 5, + GX2_TEX_CLAMP_MODE_CLAMP_BORDER = 6, + GX2_TEX_CLAMP_MODE_MIRROR_ONCE_BORDER = 7, } GX2TexClampMode; typedef enum GX2TexMipFilterMode { - GX2_TEX_MIP_FILTER_MODE_NONE = 0, - GX2_TEX_MIP_FILTER_MODE_POINT = 1, - GX2_TEX_MIP_FILTER_MODE_LINEAR = 2, + GX2_TEX_MIP_FILTER_MODE_NONE = 0, + GX2_TEX_MIP_FILTER_MODE_POINT = 1, + GX2_TEX_MIP_FILTER_MODE_LINEAR = 2, } GX2TexMipFilterMode; typedef enum GX2TexMipPerfMode { - GX2_TEX_MIP_PERF_MODE_DISABLE = 0, + GX2_TEX_MIP_PERF_MODE_DISABLE = 0, } GX2TexMipPerfMode; typedef enum GX2TexXYFilterMode { - GX2_TEX_XY_FILTER_MODE_POINT = 0, - GX2_TEX_XY_FILTER_MODE_LINEAR = 1, - GX2_TEX_XY_FILTER_MODE_BICUBIC = 2, + GX2_TEX_XY_FILTER_MODE_POINT = 0, + GX2_TEX_XY_FILTER_MODE_LINEAR = 1, + GX2_TEX_XY_FILTER_MODE_BICUBIC = 2, } GX2TexXYFilterMode; typedef enum GX2TexAnisoRatio { - GX2_TEX_ANISO_RATIO_NONE = 0, - GX2_TEX_ANISO_RATIO_2_TO_1 = 1, - GX2_TEX_ANISO_RATIO_4_TO_1 = 2, - GX2_TEX_ANISO_RATIO_8_TO_1 = 3, - GX2_TEX_ANISO_RATIO_16_TO_1 = 4, + GX2_TEX_ANISO_RATIO_NONE = 0, + GX2_TEX_ANISO_RATIO_2_TO_1 = 1, + GX2_TEX_ANISO_RATIO_4_TO_1 = 2, + GX2_TEX_ANISO_RATIO_8_TO_1 = 3, + GX2_TEX_ANISO_RATIO_16_TO_1 = 4, } GX2TexAnisoRatio; typedef enum GX2TexZFilterMode { - GX2_TEX_Z_FILTER_MODE_NONE = 0, - GX2_TEX_Z_FILTER_MODE_POINT = 1, - GX2_TEX_Z_FILTER_MODE_LINEAR = 2, + GX2_TEX_Z_FILTER_MODE_NONE = 0, + GX2_TEX_Z_FILTER_MODE_POINT = 1, + GX2_TEX_Z_FILTER_MODE_LINEAR = 2, } GX2TexZFilterMode; typedef enum GX2TexZPerfMode { - GX2_TEX_Z_PERF_MODE_DISABLED = 0, + GX2_TEX_Z_PERF_MODE_DISABLED = 0, } GX2TexZPerfMode; typedef enum GX2TileMode { - GX2_TILE_MODE_DEFAULT = 0, - GX2_TILE_MODE_LINEAR_ALIGNED = 1, - GX2_TILE_MODE_TILED_1D_THIN1 = 2, - GX2_TILE_MODE_TILED_1D_THICK = 3, - GX2_TILE_MODE_TILED_2D_THIN1 = 4, - GX2_TILE_MODE_TILED_2D_THIN2 = 5, - GX2_TILE_MODE_TILED_2D_THIN4 = 6, - GX2_TILE_MODE_TILED_2D_THICK = 7, - GX2_TILE_MODE_TILED_2B_THIN1 = 8, - GX2_TILE_MODE_TILED_2B_THIN2 = 9, - GX2_TILE_MODE_TILED_2B_THIN4 = 10, - GX2_TILE_MODE_TILED_2B_THICK = 11, - GX2_TILE_MODE_TILED_3D_THIN1 = 12, - GX2_TILE_MODE_TILED_3D_THICK = 13, - GX2_TILE_MODE_TILED_3B_THIN1 = 14, - GX2_TILE_MODE_TILED_3B_THICK = 15, - GX2_TILE_MODE_LINEAR_SPECIAL = 16, + GX2_TILE_MODE_DEFAULT = 0, + GX2_TILE_MODE_LINEAR_ALIGNED = 1, + GX2_TILE_MODE_TILED_1D_THIN1 = 2, + GX2_TILE_MODE_TILED_1D_THICK = 3, + GX2_TILE_MODE_TILED_2D_THIN1 = 4, + GX2_TILE_MODE_TILED_2D_THIN2 = 5, + GX2_TILE_MODE_TILED_2D_THIN4 = 6, + GX2_TILE_MODE_TILED_2D_THICK = 7, + GX2_TILE_MODE_TILED_2B_THIN1 = 8, + GX2_TILE_MODE_TILED_2B_THIN2 = 9, + GX2_TILE_MODE_TILED_2B_THIN4 = 10, + GX2_TILE_MODE_TILED_2B_THICK = 11, + GX2_TILE_MODE_TILED_3D_THIN1 = 12, + GX2_TILE_MODE_TILED_3D_THICK = 13, + GX2_TILE_MODE_TILED_3B_THIN1 = 14, + GX2_TILE_MODE_TILED_3B_THICK = 15, + GX2_TILE_MODE_LINEAR_SPECIAL = 16, } GX2TileMode; typedef enum GX2TVRenderMode { - GX2_TV_RENDER_MODE_DISABLED = 0, - GX2_TV_RENDER_MODE_STANDARD_480P = 1, - GX2_TV_RENDER_MODE_WIDE_480P = 2, - GX2_TV_RENDER_MODE_WIDE_720P = 3, - GX2_TV_RENDER_MODE_WIDE_1080P = 5, + GX2_TV_RENDER_MODE_DISABLED = 0, + GX2_TV_RENDER_MODE_STANDARD_480P = 1, + GX2_TV_RENDER_MODE_WIDE_480P = 2, + GX2_TV_RENDER_MODE_WIDE_720P = 3, + GX2_TV_RENDER_MODE_WIDE_1080P = 5, } GX2TVRenderMode; typedef enum GX2TVScanMode { - GX2_TV_SCAN_MODE_NONE = 0, - GX2_TV_SCAN_MODE_576I = 1, - GX2_TV_SCAN_MODE_480I = 2, - GX2_TV_SCAN_MODE_480P = 3, - GX2_TV_SCAN_MODE_720P = 4, - GX2_TV_SCAN_MODE_1080I = 6, - GX2_TV_SCAN_MODE_1080P = 7, + GX2_TV_SCAN_MODE_NONE = 0, + GX2_TV_SCAN_MODE_576I = 1, + GX2_TV_SCAN_MODE_480I = 2, + GX2_TV_SCAN_MODE_480P = 3, + GX2_TV_SCAN_MODE_720P = 4, + GX2_TV_SCAN_MODE_1080I = 6, + GX2_TV_SCAN_MODE_1080P = 7, } GX2TVScanMode; #ifdef __cplusplus diff --git a/include/gx2/shaders.h b/include/gx2/shaders.h index a89519370..c27d03a96 100644 --- a/include/gx2/shaders.h +++ b/include/gx2/shaders.h @@ -1,9 +1,9 @@ #pragma once -#include #include +#include #include "enum.h" -#include "sampler.h" #include "gx2r/buffer.h" +#include "sampler.h" /** * \defgroup gx2_shader Shaders @@ -427,9 +427,12 @@ GX2SetGeometryUniformBlock(uint32_t location, void GX2SetShaderModeEx(GX2ShaderMode mode, - uint32_t numVsGpr, uint32_t numVsStackEntries, - uint32_t numGsGpr, uint32_t numGsStackEntries, - uint32_t numPsGpr, uint32_t numPsStackEntries); + uint32_t numVsGpr, + uint32_t numVsStackEntries, + uint32_t numGsGpr, + uint32_t numGsStackEntries, + uint32_t numPsGpr, + uint32_t numPsStackEntries); void GX2SetStreamOutEnable(BOOL enable); diff --git a/include/gx2/surface.h b/include/gx2/surface.h index e4f4e779f..ee27e96a3 100644 --- a/include/gx2/surface.h +++ b/include/gx2/surface.h @@ -1,6 +1,6 @@ #pragma once -#include #include +#include #include "enum.h" /** @@ -28,7 +28,8 @@ struct GX2Surface uint32_t mipLevels; GX2SurfaceFormat format; GX2AAMode aa; - union { + union + { GX2SurfaceUse use; GX2RResourceFlags resourceFlags; }; @@ -185,8 +186,8 @@ GX2CopySurfaceEx(const GX2Surface *src, GX2Point *dstPoints); void -GX2ResolveAAColorBuffer(const GX2ColorBuffer * srcColorBuffer, - GX2Surface * dstSurface, +GX2ResolveAAColorBuffer(const GX2ColorBuffer *srcColorBuffer, + GX2Surface *dstSurface, uint32_t dstMip, uint32_t dstSlice); diff --git a/include/gx2/utils.h b/include/gx2/utils.h index adc2f23ae..c6c5cb102 100644 --- a/include/gx2/utils.h +++ b/include/gx2/utils.h @@ -13,19 +13,19 @@ extern "C" { typedef enum GX2_SQ_SEL { - GX2_SQ_SEL_X = 0, - GX2_SQ_SEL_Y = 1, - GX2_SQ_SEL_Z = 2, - GX2_SQ_SEL_W = 3, - - GX2_SQ_SEL_R = 0, - GX2_SQ_SEL_G = 1, - GX2_SQ_SEL_B = 2, - GX2_SQ_SEL_A = 3, - - GX2_SQ_SEL_0 = 4, - GX2_SQ_SEL_1 = 5, - GX2_SQ_SEL_MASK = 7, + GX2_SQ_SEL_X = 0, + GX2_SQ_SEL_Y = 1, + GX2_SQ_SEL_Z = 2, + GX2_SQ_SEL_W = 3, + + GX2_SQ_SEL_R = 0, + GX2_SQ_SEL_G = 1, + GX2_SQ_SEL_B = 2, + GX2_SQ_SEL_A = 3, + + GX2_SQ_SEL_0 = 4, + GX2_SQ_SEL_1 = 5, + GX2_SQ_SEL_MASK = 7, } GX2_SQ_SEL; #define GX2_SEL_MASK(x, y, z, w) (((x) << 24) | ((y) << 16) | ((z) << 8) | (w)) diff --git a/include/gx2r/mem.h b/include/gx2r/mem.h index 4afc4ef75..e762e8eb1 100644 --- a/include/gx2r/mem.h +++ b/include/gx2r/mem.h @@ -12,7 +12,7 @@ extern "C" { #endif -typedef void * (*GX2RAllocFunction)(GX2RResourceFlags, uint32_t, uint32_t); +typedef void *(*GX2RAllocFunction)(GX2RResourceFlags, uint32_t, uint32_t); typedef void (*GX2RFreeFunction)(GX2RResourceFlags, void *); void diff --git a/include/gx2r/resource.h b/include/gx2r/resource.h index 83855a9ca..55e3616f9 100644 --- a/include/gx2r/resource.h +++ b/include/gx2r/resource.h @@ -14,79 +14,79 @@ extern "C" { typedef enum GX2RResourceFlags { //! No resource flags specified - GX2R_RESOURCE_BIND_NONE = 0, + GX2R_RESOURCE_BIND_NONE = 0, //! This resource is to be used as a texture - GX2R_RESOURCE_BIND_TEXTURE = 1 << 0, + GX2R_RESOURCE_BIND_TEXTURE = 1 << 0, //! This resource is to be used as a colour buffer - GX2R_RESOURCE_BIND_COLOR_BUFFER = 1 << 1, + GX2R_RESOURCE_BIND_COLOR_BUFFER = 1 << 1, //! This resource is to be used as a depth buffer - GX2R_RESOURCE_BIND_DEPTH_BUFFER = 1 << 2, + GX2R_RESOURCE_BIND_DEPTH_BUFFER = 1 << 2, //! This resource is to be used as a scan buffer - GX2R_RESOURCE_BIND_SCAN_BUFFER = 1 << 3, + GX2R_RESOURCE_BIND_SCAN_BUFFER = 1 << 3, //! This resource is to be used as a vertex buffer - GX2R_RESOURCE_BIND_VERTEX_BUFFER = 1 << 4, + GX2R_RESOURCE_BIND_VERTEX_BUFFER = 1 << 4, //! This resource is to be used as a index buffer - GX2R_RESOURCE_BIND_INDEX_BUFFER = 1 << 5, + GX2R_RESOURCE_BIND_INDEX_BUFFER = 1 << 5, //! This resource is to be used as a uniform block - GX2R_RESOURCE_BIND_UNIFORM_BLOCK = 1 << 6, + GX2R_RESOURCE_BIND_UNIFORM_BLOCK = 1 << 6, //! This resource is to be used as a shader program - GX2R_RESOURCE_BIND_SHADER_PROGRAM = 1 << 7, + GX2R_RESOURCE_BIND_SHADER_PROGRAM = 1 << 7, //! This resource is to be used as a stream output - GX2R_RESOURCE_BIND_STREAM_OUTPUT = 1 << 8, + GX2R_RESOURCE_BIND_STREAM_OUTPUT = 1 << 8, //! This resource is to be used as a display list - GX2R_RESOURCE_BIND_DISPLAY_LIST = 1 << 9, + GX2R_RESOURCE_BIND_DISPLAY_LIST = 1 << 9, //! This resource is to be used as a geometry shader ring buffer - GX2R_RESOURCE_BIND_GS_RING_BUFFER = 1 << 10, + GX2R_RESOURCE_BIND_GS_RING_BUFFER = 1 << 10, //! Invalidate resource for a CPU read - GX2R_RESOURCE_USAGE_CPU_READ = 1 << 11, + GX2R_RESOURCE_USAGE_CPU_READ = 1 << 11, //! Invalidate resource for a CPU write - GX2R_RESOURCE_USAGE_CPU_WRITE = 1 << 12, + GX2R_RESOURCE_USAGE_CPU_WRITE = 1 << 12, //! Invalidate resource for a GPU read - GX2R_RESOURCE_USAGE_GPU_READ = 1 << 13, + GX2R_RESOURCE_USAGE_GPU_READ = 1 << 13, //! Invalidate resource for a GPU write - GX2R_RESOURCE_USAGE_GPU_WRITE = 1 << 14, + GX2R_RESOURCE_USAGE_GPU_WRITE = 1 << 14, //! Invalidate resource for a DMA read - GX2R_RESOURCE_USAGE_DMA_READ = 1 << 15, + GX2R_RESOURCE_USAGE_DMA_READ = 1 << 15, //! Invalidate resource for a DMA write - GX2R_RESOURCE_USAGE_DMA_WRITE = 1 << 16, + GX2R_RESOURCE_USAGE_DMA_WRITE = 1 << 16, //! Force resource allocation to be in MEM1 - GX2R_RESOURCE_USAGE_FORCE_MEM1 = 1 << 17, + GX2R_RESOURCE_USAGE_FORCE_MEM1 = 1 << 17, //! Force resource allocation to be in MEM2 - GX2R_RESOURCE_USAGE_FORCE_MEM2 = 1 << 18, + GX2R_RESOURCE_USAGE_FORCE_MEM2 = 1 << 18, //! Disable CPU invalidation - GX2R_RESOURCE_DISABLE_CPU_INVALIDATE = 1 << 20, + GX2R_RESOURCE_DISABLE_CPU_INVALIDATE = 1 << 20, //! Disable GPU invalidation - GX2R_RESOURCE_DISABLE_GPU_INVALIDATE = 1 << 21, + GX2R_RESOURCE_DISABLE_GPU_INVALIDATE = 1 << 21, //! Resource is locked for read-only access - GX2R_RESOURCE_LOCKED_READ_ONLY = 1 << 22, + GX2R_RESOURCE_LOCKED_READ_ONLY = 1 << 22, //! Resource was allocated by GX2R. - GX2R_RESOURCE_GX2R_ALLOCATED = 1 << 29, + GX2R_RESOURCE_GX2R_ALLOCATED = 1 << 29, //! Resource is locked for all access - GX2R_RESOURCE_LOCKED = 1 << 30, + GX2R_RESOURCE_LOCKED = 1 << 30, } GX2RResourceFlags; WUT_ENUM_BITMASK_TYPE(GX2RResourceFlags) diff --git a/include/h264/stream.h b/include/h264/stream.h index 2bee3be94..fdeb544a4 100644 --- a/include/h264/stream.h +++ b/include/h264/stream.h @@ -20,30 +20,30 @@ typedef void (*H264DECFptrOutputFn)(H264DecodeOutput *output); typedef enum H264Error { //! No errors. - H264_ERROR_OK = 0, + H264_ERROR_OK = 0, //! Invalid picture parameter set. - H264_ERROR_INVALID_PPS = 24, + H264_ERROR_INVALID_PPS = 24, //! Invalid sequence parameter set. - H264_ERROR_INVALID_SPS = 26, + H264_ERROR_INVALID_SPS = 26, //! Invalid slice header. - H264_ERROR_INVALID_SLICEHEADER = 61, + H264_ERROR_INVALID_SLICEHEADER = 61, //! Generic h264 error. - H264_ERROR_GENERIC = 0x1000000, + H264_ERROR_GENERIC = 0x1000000, //! Invalid parameters passed. - H264_ERROR_INVALID_PARAMETER = 0x1010000, + H264_ERROR_INVALID_PARAMETER = 0x1010000, //! The amount of memory provided to the h264 library //! is insufficient. - H264_ERROR_OUT_OF_MEMORY = 0x1020000, + H264_ERROR_OUT_OF_MEMORY = 0x1020000, //! Invalid h264 stream profile. Only the baseline (66), //! main (77) and high (100) profiles are allowed. - H264_ERROR_INVALID_PROFILE = 0x1080000, + H264_ERROR_INVALID_PROFILE = 0x1080000, } H264Error; struct WUT_PACKED H264DecodedVuiParameters @@ -167,10 +167,10 @@ struct WUT_PACKED H264DecodeOutput { //! Number of frames output int32_t frameCount; - + //! Frames H264DecodeResult **decodeResults; - + //! User memory pointer passed into SetParam void *userMemory; }; diff --git a/include/mic/mic.h b/include/mic/mic.h index 1a56fe374..39f7865cc 100644 --- a/include/mic/mic.h +++ b/include/mic/mic.h @@ -18,12 +18,12 @@ typedef struct MICStatus MICStatus; typedef enum MICError { - MIC_ERROR_OK = 0, - MIC_ERROR_NOT_OPENED = -1, - MIC_ERROR_INVALID_HANDLE = -2, - MIC_ERROR_INIT = -5, - MIC_ERROR_ALREADY_CLOSED = -7, - MIC_ERROR_INVALID_INSTANCE = -8, + MIC_ERROR_OK = 0, + MIC_ERROR_NOT_OPENED = -1, + MIC_ERROR_INVALID_HANDLE = -2, + MIC_ERROR_INIT = -5, + MIC_ERROR_ALREADY_CLOSED = -7, + MIC_ERROR_INVALID_INSTANCE = -8, } MICError; typedef enum MICInstance @@ -46,7 +46,7 @@ WUT_CHECK_SIZE(MICWorkMemory, 0x08); struct MICStatus { - int state; // 1 << 1 = Open + int state; // 1 << 1 = Open int availableData; int bufferPos; }; @@ -59,23 +59,31 @@ WUT_CHECK_SIZE(MICStatus, 0x0C); * The second parameter to MICInit is unused, any value is valid. */ MICHandle -MICInit(MICInstance instance, int unused, MICWorkMemory *workMemory, +MICInit(MICInstance instance, + int unused, + MICWorkMemory *workMemory, MICError *outError); MICError MICOpen(MICHandle handle); MICError -MICGetState(MICHandle handle, int state, uint32_t *outStateVal); +MICGetState(MICHandle handle, + int state, + uint32_t *outStateVal); MICError -MICSetState(MICHandle handle, int state, uint32_t stateVal); +MICSetState(MICHandle handle, + int state, + uint32_t stateVal); MICError -MICGetStatus(MICHandle handle, MICStatus *outStatus); +MICGetStatus(MICHandle handle, + MICStatus *outStatus); MICError -MICSetDataConsumed(MICHandle handle, int dataAmountConsumed); +MICSetDataConsumed(MICHandle handle, + int dataAmountConsumed); MICError MICClose(MICHandle handle); diff --git a/include/netdb.h b/include/netdb.h index 1165dab38..b93672e74 100644 --- a/include/netdb.h +++ b/include/netdb.h @@ -6,30 +6,30 @@ extern int h_errno; struct hostent { - char *h_name; + char *h_name; char **h_aliases; - int h_addrtype; - int h_length; + int h_addrtype; + int h_length; char **h_addr_list; -#define h_addr h_addr_list[0] +#define h_addr h_addr_list[0] }; struct servent { - char *s_name; + char *s_name; char **s_aliases; - int s_port; - char *s_proto; + int s_port; + char *s_proto; }; struct addrinfo { - int ai_flags; - int ai_family; - int ai_socktype; - int ai_protocol; - socklen_t ai_addrlen; - char *ai_canonname; + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; + socklen_t ai_addrlen; + char *ai_canonname; struct sockaddr *ai_addr; struct addrinfo *ai_next; }; @@ -86,7 +86,7 @@ gethostbyname(const char *name); struct hostent * gethostbyaddr(const void *addr, - socklen_t len, + socklen_t len, int type); struct hostent * diff --git a/include/netinet/in.h b/include/netinet/in.h index 856b60a6e..84b8c7dab 100644 --- a/include/netinet/in.h +++ b/include/netinet/in.h @@ -27,15 +27,15 @@ typedef uint32_t in_addr_t; struct in_addr { - in_addr_t s_addr; + in_addr_t s_addr; }; struct sockaddr_in { - sa_family_t sin_family; - in_port_t sin_port; - struct in_addr sin_addr; - unsigned char sin_zero[8]; + sa_family_t sin_family; + in_port_t sin_port; + struct in_addr sin_addr; + unsigned char sin_zero[8]; }; struct ip_mreq diff --git a/include/netinet/tcp.h b/include/netinet/tcp.h index 918476244..e31052eb6 100644 --- a/include/netinet/tcp.h +++ b/include/netinet/tcp.h @@ -1,9 +1,9 @@ #pragma once -#define SOL_TCP 6 +#define SOL_TCP 6 -#define TCP_ACKDELAYTIME 0x2001 -#define TCP_NOACKDELAY 0x2002 -#define TCP_MAXSEG 0x2003 -#define TCP_NODELAY 0x2004 -#define TCP_UNKNOWN 0x2005 // amount of mss received before sending an ack +#define TCP_ACKDELAYTIME 0x2001 +#define TCP_NOACKDELAY 0x2002 +#define TCP_MAXSEG 0x2003 +#define TCP_NODELAY 0x2004 +#define TCP_UNKNOWN 0x2005 // amount of mss received before sending an ack diff --git a/include/nfc/nfc.h b/include/nfc/nfc.h index e0923f17d..7cc02f7a9 100644 --- a/include/nfc/nfc.h +++ b/include/nfc/nfc.h @@ -25,29 +25,29 @@ typedef struct NFCReadT2TResult NFCReadT2TResult; typedef enum NFCMode { - NFC_MODE_INVALID = -1, + NFC_MODE_INVALID = -1, //! NFC is idle - NFC_MODE_IDLE = 0, + NFC_MODE_IDLE = 0, //! NFC is discovering / has an active tag - NFC_MODE_ACTIVE = 1, + NFC_MODE_ACTIVE = 1, } NFCMode; typedef enum NFCProtocolEnum { - NFC_PROTOCOL_UNKNOWN = 0x00, - NFC_PROTOCOL_T1T = 0x01, - NFC_PROTOCOL_T2T = 0x02, - NFC_PROTOCOL_T3T = 0x03, - NFC_PROTOCOL_ISO_DEP = 0x04, - NFC_PROTOCOL_15693 = 0x83, + NFC_PROTOCOL_UNKNOWN = 0x00, + NFC_PROTOCOL_T1T = 0x01, + NFC_PROTOCOL_T2T = 0x02, + NFC_PROTOCOL_T3T = 0x03, + NFC_PROTOCOL_ISO_DEP = 0x04, + NFC_PROTOCOL_15693 = 0x83, } NFCProtocolEnum; typedef enum NFCTechnologyEnum { - NFC_TECHNOLOGY_A = 0x00, - NFC_TECHNOLOGY_B = 0x01, - NFC_TECHNOLOGY_F = 0x02, - NFC_TECHNOLOGY_ISO15693 = 0x06, + NFC_TECHNOLOGY_A = 0x00, + NFC_TECHNOLOGY_B = 0x01, + NFC_TECHNOLOGY_F = 0x02, + NFC_TECHNOLOGY_ISO15693 = 0x06, } NFCTechnologyEnum; typedef enum NFCTechnologyMaskEnum @@ -161,10 +161,9 @@ WUT_CHECK_SIZE(NFCReadT2TResult, 0x3A9); * \param userContext * User provided value. */ -typedef void -(*NFCCallbackFn)(VPADChan chan, - NFCError error, - void *userContext); +typedef void (*NFCCallbackFn)(VPADChan chan, + NFCError error, + void *userContext); /** * Callback function for \link NFCSetTagDetectCallback \endlink. @@ -178,10 +177,9 @@ typedef void * \param userContext * User provided value. */ -typedef void -(*NFCTagDetectCallbackFn)(VPADChan chan, - BOOL hasTag, - void *userContext); +typedef void (*NFCTagDetectCallbackFn)(VPADChan chan, + BOOL hasTag, + void *userContext); /** * Callback function for \link NFCDetect \endlink. @@ -207,14 +205,13 @@ typedef void * \param userContext * User provided value. */ -typedef void -(*NFCDetectCallbackFn)(VPADChan chan, - NFCError error, - NFCUid *uid, - BOOL readOnly, - BOOL hasLockedData, - NFCNDEFFlags flags, - void *userContext); +typedef void (*NFCDetectCallbackFn)(VPADChan chan, + NFCError error, + NFCUid *uid, + BOOL readOnly, + BOOL hasLockedData, + NFCNDEFFlags flags, + void *userContext); /** * Callback function for \link NFCSendRawData \endlink and variations. @@ -234,12 +231,11 @@ typedef void * \param userContext * User provided value. */ -typedef void -(*NFCRawDataCallbackFn)(VPADChan chan, - NFCError error, - uint32_t responseSize, - void *responseData, - void *userContext); +typedef void (*NFCRawDataCallbackFn)(VPADChan chan, + NFCError error, + uint32_t responseSize, + void *responseData, + void *userContext); /** * Callback function for \link NFCSendRawDataTwice \endlink and variations. @@ -262,15 +258,14 @@ typedef void * \param userContext * User provided value. */ -typedef void -(*NFCRawDataTwiceCallbackFn)(VPADChan chan, - NFCError error, - uint8_t numCompleted, - uint32_t response0Size, - void *response0Data, - uint32_t response1Size, - void *response1Data, - void *userContext); +typedef void (*NFCRawDataTwiceCallbackFn)(VPADChan chan, + NFCError error, + uint8_t numCompleted, + uint32_t response0Size, + void *response0Data, + uint32_t response1Size, + void *response1Data, + void *userContext); /** * Callback function for \link NFCRead \endlink. @@ -302,16 +297,15 @@ typedef void * \param userContext * User provided value. */ -typedef void -(*NFCReadCallbackFn)(VPADChan chan, - NFCError error, - NFCUid *uid, - BOOL readOnly, - uint32_t dataSize, - void *data, - uint32_t lockedDataSize, - void *lockedData, - void *userContext); +typedef void (*NFCReadCallbackFn)(VPADChan chan, + NFCError error, + NFCUid *uid, + BOOL readOnly, + uint32_t dataSize, + void *data, + uint32_t lockedDataSize, + void *lockedData, + void *userContext); /** * Callback function for \link NFCReadT2T \endlink. @@ -346,17 +340,16 @@ typedef void * \param userContext * User provided value. */ -typedef void -(*NFCReadT2TCallbackFn)(VPADChan chan, - NFCError error, - uint8_t rfDiscId, - NFCProtocol protocol, - NFCTechnology technology, - uint8_t uidSize, - uint8_t *uid, - NFCNTAGVersion *version, - NFCReadT2TResult *result, - void *userContext); +typedef void (*NFCReadT2TCallbackFn)(VPADChan chan, + NFCError error, + uint8_t rfDiscId, + NFCProtocol protocol, + NFCTechnology technology, + uint8_t uidSize, + uint8_t *uid, + NFCNTAGVersion *version, + NFCReadT2TResult *result, + void *userContext); /** * Callback function for \link NFCGetTagInfo \endlink. @@ -373,11 +366,10 @@ typedef void * \param userContext * User provided value. */ -typedef void -(*NFCGetTagInfoCallbackFn)(VPADChan chan, - NFCError error, - NFCTagInfo *tagInfo, - void *userContext); +typedef void (*NFCGetTagInfoCallbackFn)(VPADChan chan, + NFCError error, + NFCTagInfo *tagInfo, + void *userContext); /** * Callback function for \link NFCGetTagInfoMulti \endlink. @@ -397,14 +389,13 @@ typedef void * \param userContext * User provided value. */ -typedef void -(*NFCGetTagInfoMultiCallbackFn)(VPADChan chan, - NFCError error, - uint8_t numTagInfos, - NFCTagInfo *tagInfo0, - NFCTagInfo *tagInfo1, - NFCTagInfo *tagInfo2, - void *userContext); +typedef void (*NFCGetTagInfoMultiCallbackFn)(VPADChan chan, + NFCError error, + uint8_t numTagInfos, + NFCTagInfo *tagInfo0, + NFCTagInfo *tagInfo1, + NFCTagInfo *tagInfo2, + void *userContext); /** * Initializes the NFC library. @@ -1155,6 +1146,7 @@ NFCSetReadOnly(VPADChan chan, * \return * 0 on success. */ +// clang-format off NFCError NFCReadT2T(VPADChan chan, uint32_t discoveryTimeout, @@ -1170,6 +1162,7 @@ NFCReadT2T(VPADChan chan, uint8_t authenticate, NFCReadT2TCallbackFn callback, void *userContext); +// clang-format on /** * Write data to a Type 2 NTAG. @@ -1231,6 +1224,7 @@ NFCReadT2T(VPADChan chan, * \return * 0 on success. */ +// clang-format off NFCError NFCWriteT2T(VPADChan chan, uint16_t discoveryTimeout, @@ -1247,6 +1241,7 @@ NFCWriteT2T(VPADChan chan, uint8_t authenticate, uint8_t activate, NFCCallbackFn callback, void *userContext); +// clang-format on /** * Get the UID and other parameters from activation event data. diff --git a/include/nn/ac/ac_cpp.h b/include/nn/ac/ac_cpp.h index 2e637a187..3d0030e4c 100644 --- a/include/nn/ac/ac_cpp.h +++ b/include/nn/ac/ac_cpp.h @@ -31,14 +31,15 @@ using ConfigIdNum = uint32_t; * The configuration for a given network profile (from 1 to 6). * \sa NetConfCfg */ -using Config = NetConfCfg; +using Config = NetConfCfg; -using ErrorCode = uint32_t; +using ErrorCode = uint32_t; -enum Status { +enum Status +{ STATUS_FAILED = -1, - STATUS_OK = 0, - STATUS_PROCESSING = 1, + STATUS_OK = 0, + STATUS_PROCESSING = 1, }; diff --git a/include/nn/acp.h b/include/nn/acp.h index 920aea933..c5e4ede95 100644 --- a/include/nn/acp.h +++ b/include/nn/acp.h @@ -7,8 +7,8 @@ #include #include +#include +#include #include #include #include -#include -#include diff --git a/include/nn/acp/device.h b/include/nn/acp/device.h index ca161a1dc..b97c95145 100644 --- a/include/nn/acp/device.h +++ b/include/nn/acp/device.h @@ -12,17 +12,18 @@ extern "C" { #endif -typedef enum ACPDeviceType { - ACP_DEVICE_TYPE_AUTO = 1, - ACP_DEVICE_TYPE_ODD = 2, - ACP_DEVICE_TYPE_HFIODISC = 2, /* when ApplicationDevice is emulated */ - ACP_DEVICE_TYPE_MLC = 3, - ACP_DEVICE_TYPE_HFIOMLC = 3, /* when ApplicationDevice is emulated */ - ACP_DEVICE_TYPE_USB = 4, +typedef enum ACPDeviceType +{ + ACP_DEVICE_TYPE_AUTO = 1, + ACP_DEVICE_TYPE_ODD = 2, + ACP_DEVICE_TYPE_HFIODISC = 2, /* when ApplicationDevice is emulated */ + ACP_DEVICE_TYPE_MLC = 3, + ACP_DEVICE_TYPE_HFIOMLC = 3, /* when ApplicationDevice is emulated */ + ACP_DEVICE_TYPE_USB = 4, } ACPDeviceType; ACPResult -ACPCheckApplicationDeviceEmulation(BOOL* emulation); +ACPCheckApplicationDeviceEmulation(BOOL *emulation); #ifdef __cplusplus } diff --git a/include/nn/acp/drcled_c.h b/include/nn/acp/drcled_c.h index fd3e9bd38..7c9d74353 100644 --- a/include/nn/acp/drcled_c.h +++ b/include/nn/acp/drcled_c.h @@ -1,8 +1,8 @@ #pragma once #include -#include #include +#include #ifdef __cplusplus extern "C" { diff --git a/include/nn/acp/drcled_cpp.h b/include/nn/acp/drcled_cpp.h index df89ad849..0601a1704 100644 --- a/include/nn/acp/drcled_cpp.h +++ b/include/nn/acp/drcled_cpp.h @@ -1,14 +1,16 @@ #pragma once #include -#include #include +#include #ifdef __cplusplus -namespace nn { +namespace nn +{ -namespace acp { +namespace acp +{ typedef uint8_t DrcLedStatus; typedef uint32_t DrcLedPattern; @@ -24,7 +26,7 @@ SetDrcLedDummyPowerStat(uint8_t unk1) void SetDrcLedTimerLength(uint64_t unk1, - uint64_t unk2) + uint64_t unk2) asm("SetDrcLedTimerLength__Q2_2nn3acpFULT1"); void @@ -41,13 +43,13 @@ TurnOffDrcLedTest(uint8_t unk1) void TurnOnDrcLed(uint32_t unk1, - DrcLedPattern pattern) + DrcLedPattern pattern) asm("TurnOnDrcLed__Q2_2nn3acpFUiQ3_2nn3acp13DrcLedPattern"); void TurnOnDrcLedTest(uint8_t unk1, - uint32_t unk2, - DrcLedPattern pattern) + uint32_t unk2, + DrcLedPattern pattern) asm("TurnOnDrcLedTest__Q2_2nn3acpFUcUiQ3_2nn3acp13DrcLedPattern"); } //namespace acp diff --git a/include/nn/acp/result.h b/include/nn/acp/result.h index eaff90e62..fd5c2429e 100644 --- a/include/nn/acp/result.h +++ b/include/nn/acp/result.h @@ -8,89 +8,90 @@ * @{ */ -typedef enum ACPResult { - ACP_RESULT_SUCCESS = 0, - - ACP_RESULT_INVALID = -200, - ACP_RESULT_INVALID_PARAMETER = -201, - ACP_RESULT_INVALID_FILE = -202, - ACP_RESULT_INVALID_XML_FILE = -203, - ACP_RESULT_FILE_ACCESS_MODE = -204, - ACP_RESULT_INVALID_NETWORK_TIME = -205, - - ACP_RESULT_NOT_FOUND = -500, - ACP_RESULT_FILE_NOT_FOUND = -501, - ACP_RESULT_DIR_NOT_FOUND = -502, - ACP_RESULT_DEVICE_NOT_FOUND = -503, - ACP_RESULT_TITLE_NOT_FOUND = -504, - ACP_RESULT_APPLICATION_NOT_FOUND = -505, - ACP_RESULT_SYSTEM_CONFIG_NOT_FOUND = -506, - ACP_RESULT_XML_ITEM_NOT_FOUND = -507, - - ACP_RESULT_ALREADY_EXISTS = -600, - ACP_RESULT_FILE_ALREADY_EXISTS = -601, - ACP_RESULT_DIR_ALREADY_EXISTS = -602, - - ACP_RESULT_ALREADY_DONE = -700, - - ACP_RESULT_AUTHENTICATION = -1000, - ACP_RESULT_INVALID_REGION = -1001, - ACP_RESULT_RESTRICTED_RATING = -1002, - ACP_RESULT_NOT_PRESENT_RATING = -1003, - ACP_RESULT_PENDING_RATING = -1004, - ACP_RESULT_NET_SETTING_REQUIRED = -1005, - ACP_RESULT_NET_ACCOUNT_REQUIRED = -1006, - ACP_RESULT_NET_ACCOUNT_ERROR = -1007, - ACP_RESULT_BROWSER_REQUIRED = -1008, - ACP_RESULT_OLV_REQUIRED = -1009, - ACP_RESULT_PINCODE_REQUIRED = -1010, - ACP_RESULT_INCORRECT_PINCODE = -1011, - ACP_RESULT_INVALID_LOGO = -1012, - ACP_RESULT_DEMO_EXPIRED_NUMBER = -1013, - ACP_RESULT_DRC_REQUIRED = -1014, - - ACP_RESULT_NO_PERMISSION = -1100, - ACP_RESULT_NO_FILE_PERMISSION = -1101, - ACP_RESULT_NO_DIR_PERMISSION = -1102, - - ACP_RESULT_BUSY = -1300, - ACP_RESULT_USB_STORAGE_NOT_READY = -1301, - - ACP_RESULT_CANCELLED = -1400, - - ACP_RESULT_RESOURCE = -1500, - ACP_RESULT_DEVICE_FULL = -1501, - ACP_RESULT_JOURNAL_FULL = -1502, - ACP_RESULT_SYSTEM_MEMORY = -1503, - ACP_RESULT_FS_RESOURCE = -1504, - ACP_RESULT_IPC_RESOURCE = -1505, - - ACP_RESULT_NOT_INITIALISED = -1600, - - ACP_RESULT_ACCOUNT_ERROR = -1700, - - ACP_RESULT_UNSUPPORTED = -1800, - - ACP_RESULT_DATA_CORRUPTED = -2000, - ACP_RESULT_DEVICE = -2001, - ACP_RESULT_SLC_DATA_CORRUPTED = -2002, - ACP_RESULT_MLC_DATA_CORRUPTED = -2003, - ACP_RESULT_USB_DATA_CORRUPTED = -2004, - - ACP_RESULT_MEDIA = -2100, - ACP_RESULT_MEDIA_NOT_READY = -2101, - ACP_RESULT_MEDIA_BROKEN = -2102, - ACP_RESULT_ODD_MEDIA_NOT_READY = -2103, - ACP_RESULT_ODD_MEDIA_BROKEN = -2104, - ACP_RESULT_USB_MEDIA_NOT_READY = -2105, - ACP_RESULT_USB_MEDIA_BROKEN = -2106, - ACP_RESULT_MEDIA_WRITE_PROTECTED = -2107, - ACP_RESULT_USB_WRITE_PROTECTED = -2108, - - ACP_RESULT_MII = -2200, - ACP_RESULT_ENCRYPTION_ERROR = -2201, - - ACP_RESULT_GENERIC_ERROR = -4096, +typedef enum ACPResult +{ + ACP_RESULT_SUCCESS = 0, + + ACP_RESULT_INVALID = -200, + ACP_RESULT_INVALID_PARAMETER = -201, + ACP_RESULT_INVALID_FILE = -202, + ACP_RESULT_INVALID_XML_FILE = -203, + ACP_RESULT_FILE_ACCESS_MODE = -204, + ACP_RESULT_INVALID_NETWORK_TIME = -205, + + ACP_RESULT_NOT_FOUND = -500, + ACP_RESULT_FILE_NOT_FOUND = -501, + ACP_RESULT_DIR_NOT_FOUND = -502, + ACP_RESULT_DEVICE_NOT_FOUND = -503, + ACP_RESULT_TITLE_NOT_FOUND = -504, + ACP_RESULT_APPLICATION_NOT_FOUND = -505, + ACP_RESULT_SYSTEM_CONFIG_NOT_FOUND = -506, + ACP_RESULT_XML_ITEM_NOT_FOUND = -507, + + ACP_RESULT_ALREADY_EXISTS = -600, + ACP_RESULT_FILE_ALREADY_EXISTS = -601, + ACP_RESULT_DIR_ALREADY_EXISTS = -602, + + ACP_RESULT_ALREADY_DONE = -700, + + ACP_RESULT_AUTHENTICATION = -1000, + ACP_RESULT_INVALID_REGION = -1001, + ACP_RESULT_RESTRICTED_RATING = -1002, + ACP_RESULT_NOT_PRESENT_RATING = -1003, + ACP_RESULT_PENDING_RATING = -1004, + ACP_RESULT_NET_SETTING_REQUIRED = -1005, + ACP_RESULT_NET_ACCOUNT_REQUIRED = -1006, + ACP_RESULT_NET_ACCOUNT_ERROR = -1007, + ACP_RESULT_BROWSER_REQUIRED = -1008, + ACP_RESULT_OLV_REQUIRED = -1009, + ACP_RESULT_PINCODE_REQUIRED = -1010, + ACP_RESULT_INCORRECT_PINCODE = -1011, + ACP_RESULT_INVALID_LOGO = -1012, + ACP_RESULT_DEMO_EXPIRED_NUMBER = -1013, + ACP_RESULT_DRC_REQUIRED = -1014, + + ACP_RESULT_NO_PERMISSION = -1100, + ACP_RESULT_NO_FILE_PERMISSION = -1101, + ACP_RESULT_NO_DIR_PERMISSION = -1102, + + ACP_RESULT_BUSY = -1300, + ACP_RESULT_USB_STORAGE_NOT_READY = -1301, + + ACP_RESULT_CANCELLED = -1400, + + ACP_RESULT_RESOURCE = -1500, + ACP_RESULT_DEVICE_FULL = -1501, + ACP_RESULT_JOURNAL_FULL = -1502, + ACP_RESULT_SYSTEM_MEMORY = -1503, + ACP_RESULT_FS_RESOURCE = -1504, + ACP_RESULT_IPC_RESOURCE = -1505, + + ACP_RESULT_NOT_INITIALISED = -1600, + + ACP_RESULT_ACCOUNT_ERROR = -1700, + + ACP_RESULT_UNSUPPORTED = -1800, + + ACP_RESULT_DATA_CORRUPTED = -2000, + ACP_RESULT_DEVICE = -2001, + ACP_RESULT_SLC_DATA_CORRUPTED = -2002, + ACP_RESULT_MLC_DATA_CORRUPTED = -2003, + ACP_RESULT_USB_DATA_CORRUPTED = -2004, + + ACP_RESULT_MEDIA = -2100, + ACP_RESULT_MEDIA_NOT_READY = -2101, + ACP_RESULT_MEDIA_BROKEN = -2102, + ACP_RESULT_ODD_MEDIA_NOT_READY = -2103, + ACP_RESULT_ODD_MEDIA_BROKEN = -2104, + ACP_RESULT_USB_MEDIA_NOT_READY = -2105, + ACP_RESULT_USB_MEDIA_BROKEN = -2106, + ACP_RESULT_MEDIA_WRITE_PROTECTED = -2107, + ACP_RESULT_USB_WRITE_PROTECTED = -2108, + + ACP_RESULT_MII = -2200, + ACP_RESULT_ENCRYPTION_ERROR = -2201, + + ACP_RESULT_GENERIC_ERROR = -4096, } ACPResult; WUT_CHECK_SIZE(ACPResult, 0x4); diff --git a/include/nn/acp/save.h b/include/nn/acp/save.h index a39c8374c..41123d9f3 100644 --- a/include/nn/acp/save.h +++ b/include/nn/acp/save.h @@ -1,7 +1,7 @@ #pragma once #include -#include #include +#include /** * \defgroup nn_acp_save Save @@ -18,16 +18,17 @@ extern "C" { typedef uint64_t ACPTitleId; typedef struct ACPSaveDirInfo ACPSaveDirInfo; -struct WUT_PACKED ACPSaveDirInfo { - WUT_UNKNOWN_BYTES(0x8); - uint32_t persistentId; - WUT_UNKNOWN_BYTES(0x14); - char path[0x40]; - WUT_PADDING_BYTES(0x80 - 0x60); +struct WUT_PACKED ACPSaveDirInfo +{ + WUT_UNKNOWN_BYTES(0x8); + uint32_t persistentId; + WUT_UNKNOWN_BYTES(0x14); + char path[0x40]; + WUT_PADDING_BYTES(0x80 - 0x60); }; WUT_CHECK_OFFSET(ACPSaveDirInfo, 0x08, persistentId); WUT_CHECK_OFFSET(ACPSaveDirInfo, 0x20, path); -WUT_CHECK_SIZE(ACPSaveDirInfo,0x80); +WUT_CHECK_SIZE(ACPSaveDirInfo, 0x80); ACPResult ACPCreateSaveDir(uint32_t persistentId, diff --git a/include/nn/acp/title.h b/include/nn/acp/title.h index 3be9db0ec..ef205fbd9 100644 --- a/include/nn/acp/title.h +++ b/include/nn/acp/title.h @@ -1,9 +1,9 @@ #pragma once #include -#include -#include #include +#include +#include /** * \defgroup nn_acp_title Title @@ -20,114 +20,115 @@ extern "C" { typedef uint64_t ACPTitleId; typedef struct ACPMetaXml ACPMetaXml; -struct WUT_PACKED ACPMetaXml { - uint64_t title_id; - uint64_t boss_id; - uint64_t os_version; - uint64_t app_size; - uint64_t common_save_size; - uint64_t account_save_size; - uint64_t common_boss_size; - uint64_t account_boss_size; - uint64_t join_game_mode_mask; - uint32_t version; - char product_code[32]; - char content_platform[32]; - char company_code[8]; - char mastering_date[32]; - uint32_t logo_type; - uint32_t app_launch_type; - uint32_t invisible_flag; - uint32_t no_managed_flag; - uint32_t no_event_log; - uint32_t no_icon_database; - uint32_t launching_flag; - uint32_t install_flag; - uint32_t closing_msg; - uint32_t title_version; - uint32_t group_id; - uint32_t save_no_rollback; - uint32_t bg_daemon_enable; - uint32_t join_game_id; - uint32_t olv_accesskey; - uint32_t wood_tin; - uint32_t e_manual; - uint32_t e_manual_version; - uint32_t region; - uint32_t pc_cero; - uint32_t pc_esrb; - uint32_t pc_bbfc; - uint32_t pc_usk; - uint32_t pc_pegi_gen; - uint32_t pc_pegi_fin; - uint32_t pc_pegi_prt; - uint32_t pc_pegi_bbfc; - uint32_t pc_cob; - uint32_t pc_grb; - uint32_t pc_cgsrr; - uint32_t pc_oflc; - uint32_t pc_reserved0; - uint32_t pc_reserved1; - uint32_t pc_reserved2; - uint32_t pc_reserved3; - uint32_t ext_dev_nunchaku; - uint32_t ext_dev_classic; - uint32_t ext_dev_urcc; - uint32_t ext_dev_board; - uint32_t ext_dev_usb_keyboard; - uint32_t ext_dev_etc; - char ext_dev_etc_name[512]; - uint32_t eula_version; - uint32_t drc_use; - uint32_t network_use; - uint32_t online_account_use; - uint32_t direct_boot; - uint32_t reserved_flag0; - uint32_t reserved_flag1; - uint32_t reserved_flag2; - uint32_t reserved_flag3; - uint32_t reserved_flag4; - uint32_t reserved_flag5; - uint32_t reserved_flag6; - uint32_t reserved_flag7; - char longname_ja[512]; - char longname_en[512]; - char longname_fr[512]; - char longname_de[512]; - char longname_it[512]; - char longname_es[512]; - char longname_zhs[512]; - char longname_ko[512]; - char longname_nl[512]; - char longname_pt[512]; - char longname_ru[512]; - char longname_zht[512]; - char shortname_ja[256]; - char shortname_en[256]; - char shortname_fr[256]; - char shortname_de[256]; - char shortname_it[256]; - char shortname_es[256]; - char shortname_zhs[256]; - char shortname_ko[256]; - char shortname_nl[256]; - char shortname_pt[256]; - char shortname_ru[256]; - char shortname_zht[256]; - char publisher_ja[256]; - char publisher_en[256]; - char publisher_fr[256]; - char publisher_de[256]; - char publisher_it[256]; - char publisher_es[256]; - char publisher_zhs[256]; - char publisher_ko[256]; - char publisher_nl[256]; - char publisher_pt[256]; - char publisher_ru[256]; - char publisher_zht[256]; - uint32_t add_on_unique_id[32]; - WUT_UNKNOWN_BYTES(52); +struct WUT_PACKED ACPMetaXml +{ + uint64_t title_id; + uint64_t boss_id; + uint64_t os_version; + uint64_t app_size; + uint64_t common_save_size; + uint64_t account_save_size; + uint64_t common_boss_size; + uint64_t account_boss_size; + uint64_t join_game_mode_mask; + uint32_t version; + char product_code[32]; + char content_platform[32]; + char company_code[8]; + char mastering_date[32]; + uint32_t logo_type; + uint32_t app_launch_type; + uint32_t invisible_flag; + uint32_t no_managed_flag; + uint32_t no_event_log; + uint32_t no_icon_database; + uint32_t launching_flag; + uint32_t install_flag; + uint32_t closing_msg; + uint32_t title_version; + uint32_t group_id; + uint32_t save_no_rollback; + uint32_t bg_daemon_enable; + uint32_t join_game_id; + uint32_t olv_accesskey; + uint32_t wood_tin; + uint32_t e_manual; + uint32_t e_manual_version; + uint32_t region; + uint32_t pc_cero; + uint32_t pc_esrb; + uint32_t pc_bbfc; + uint32_t pc_usk; + uint32_t pc_pegi_gen; + uint32_t pc_pegi_fin; + uint32_t pc_pegi_prt; + uint32_t pc_pegi_bbfc; + uint32_t pc_cob; + uint32_t pc_grb; + uint32_t pc_cgsrr; + uint32_t pc_oflc; + uint32_t pc_reserved0; + uint32_t pc_reserved1; + uint32_t pc_reserved2; + uint32_t pc_reserved3; + uint32_t ext_dev_nunchaku; + uint32_t ext_dev_classic; + uint32_t ext_dev_urcc; + uint32_t ext_dev_board; + uint32_t ext_dev_usb_keyboard; + uint32_t ext_dev_etc; + char ext_dev_etc_name[512]; + uint32_t eula_version; + uint32_t drc_use; + uint32_t network_use; + uint32_t online_account_use; + uint32_t direct_boot; + uint32_t reserved_flag0; + uint32_t reserved_flag1; + uint32_t reserved_flag2; + uint32_t reserved_flag3; + uint32_t reserved_flag4; + uint32_t reserved_flag5; + uint32_t reserved_flag6; + uint32_t reserved_flag7; + char longname_ja[512]; + char longname_en[512]; + char longname_fr[512]; + char longname_de[512]; + char longname_it[512]; + char longname_es[512]; + char longname_zhs[512]; + char longname_ko[512]; + char longname_nl[512]; + char longname_pt[512]; + char longname_ru[512]; + char longname_zht[512]; + char shortname_ja[256]; + char shortname_en[256]; + char shortname_fr[256]; + char shortname_de[256]; + char shortname_it[256]; + char shortname_es[256]; + char shortname_zhs[256]; + char shortname_ko[256]; + char shortname_nl[256]; + char shortname_pt[256]; + char shortname_ru[256]; + char shortname_zht[256]; + char publisher_ja[256]; + char publisher_en[256]; + char publisher_fr[256]; + char publisher_de[256]; + char publisher_it[256]; + char publisher_es[256]; + char publisher_zhs[256]; + char publisher_ko[256]; + char publisher_nl[256]; + char publisher_pt[256]; + char publisher_ru[256]; + char publisher_zht[256]; + uint32_t add_on_unique_id[32]; + WUT_UNKNOWN_BYTES(52); }; WUT_CHECK_OFFSET(ACPMetaXml, 0x00, title_id); WUT_CHECK_OFFSET(ACPMetaXml, 0x08, boss_id); @@ -235,13 +236,13 @@ WUT_CHECK_OFFSET(ACPMetaXml, 0x308C, publisher_pt); WUT_CHECK_OFFSET(ACPMetaXml, 0x318C, publisher_ru); WUT_CHECK_OFFSET(ACPMetaXml, 0x328C, publisher_zht); WUT_CHECK_OFFSET(ACPMetaXml, 0x338C, add_on_unique_id); -WUT_CHECK_SIZE(ACPMetaXml,0x3440); +WUT_CHECK_SIZE(ACPMetaXml, 0x3440); ACPResult -ACPAssignTitlePatch(MCPTitleListType* titleInfo); +ACPAssignTitlePatch(MCPTitleListType *titleInfo); ACPResult -ACPGetTitleIdOfMainApplication(ACPTitleId* titleId); +ACPGetTitleIdOfMainApplication(ACPTitleId *titleId); /** * Gets the MetaXML for a given title id @@ -264,8 +265,9 @@ RPLWRAP(ACPGetTitleMetaXml)(ACPTitleId titleId, */ static inline ACPResult ACPGetTitleMetaXml(ACPTitleId titleId, - ACPMetaXml *metaXml) { - if ((uintptr_t) metaXml & 0x3F) { + ACPMetaXml *metaXml) +{ + if ((uintptr_t)metaXml & 0x3F) { return ACP_RESULT_INVALID_PARAMETER; } return RPLWRAP(ACPGetTitleMetaXml)(titleId, metaXml); @@ -289,8 +291,9 @@ RPLWRAP(ACPGetTitleSaveMetaXml)(uint64_t titleId, static inline ACPResult ACPGetTitleSaveMetaXml(ACPTitleId titleId, ACPMetaXml *metaXml, - ACPDeviceType deviceType) { - if ((uintptr_t) metaXml & 0x3F) { + ACPDeviceType deviceType) +{ + if ((uintptr_t)metaXml & 0x3F) { return ACP_RESULT_INVALID_PARAMETER; } return RPLWRAP(ACPGetTitleSaveMetaXml)(titleId, metaXml, deviceType); @@ -303,13 +306,13 @@ ACPGetTitleMetaDir(ACPTitleId titleId, ACPResult ACPGetTitleMetaDirByDevice(ACPTitleId titleId, - char* directory, + char *directory, size_t directoryLen, ACPDeviceType deviceType); ACPResult ACPGetTitleMetaDirByTitleListType(MCPTitleListType titleListType, - char* directory, + char *directory, size_t directoryLen); #ifdef __cplusplus diff --git a/include/nn/act/client_cpp.h b/include/nn/act/client_cpp.h index e4f3e47a1..13b62b6a2 100644 --- a/include/nn/act/client_cpp.h +++ b/include/nn/act/client_cpp.h @@ -1,7 +1,7 @@ #pragma once #include -#include #include +#include /** * \defgroup nn_act_client Accounts Client API @@ -12,25 +12,27 @@ #ifdef __cplusplus -namespace nn { +namespace nn +{ -namespace act { +namespace act +{ //https://github.com/decaf-emu/decaf-emu/blob/master/src/libdecaf/src/nn/act/nn_act_types.h -using ACTLoadOption = uint32_t; -using SlotNo = uint8_t; -using LocalFriendCode = uint64_t; -using PersistentId = uint32_t; -using PrincipalId = uint32_t; -using SimpleAddressId = uint32_t; -using TransferrableId = uint64_t; +using ACTLoadOption = uint32_t; +using SlotNo = uint8_t; +using LocalFriendCode = uint64_t; +using PersistentId = uint32_t; +using PrincipalId = uint32_t; +using SimpleAddressId = uint32_t; +using TransferrableId = uint64_t; -static constexpr size_t AccountIdSize = 17; -static constexpr size_t DeviceHashSize = 8; +static constexpr size_t AccountIdSize = 17; +static constexpr size_t DeviceHashSize = 8; static constexpr size_t NfsPasswordSize = 17; -static constexpr size_t MiiNameSize = 11; -static constexpr size_t UuidSize = 16; +static constexpr size_t MiiNameSize = 11; +static constexpr size_t UuidSize = 16; //https://github.com/decaf-emu/decaf-emu/blob/master/src/libdecaf/src/cafe/libraries/nn_act/nn_act_client.cpp @@ -53,11 +55,11 @@ GetAccountIdEx(char outAccountId[AccountIdSize], SlotNo slot) asm("GetAccountIdEx__Q2_2nn3actFPcUc"); nn::Result -GetBirthday(uint16_t* outYear, uint8_t* outMonth, uint8_t* outDay) +GetBirthday(uint16_t *outYear, uint8_t *outMonth, uint8_t *outDay) asm("GetBirthday__Q2_2nn3actFPUsPUcT2"); nn::Result -GetBirthdayEx(uint16_t* outYear, uint8_t* outMonth, uint8_t* outDay, SlotNo slot) +GetBirthdayEx(uint16_t *outYear, uint8_t *outMonth, uint8_t *outDay, SlotNo slot) asm("GetBirthdayEx__Q2_2nn3actFPUsPUcT2Uc"); SlotNo @@ -69,19 +71,19 @@ GetDeviceHash(char outHash[DeviceHashSize]) asm("GetDeviceHash__Q2_2nn3actFPUL"); nn::Result -LoadConsoleAccount(SlotNo slot, ACTLoadOption unk1, char const * unk2, bool unk3) +LoadConsoleAccount(SlotNo slot, ACTLoadOption unk1, char const *unk2, bool unk3) asm("LoadConsoleAccount__Q2_2nn3actFUc13ACTLoadOptionPCcb"); nn::Result -GetMii(FFLStoreData* mii) +GetMii(FFLStoreData *mii) asm("GetMii__Q2_2nn3actFP12FFLStoreData"); nn::Result -GetMiiEx(FFLStoreData* mii, SlotNo slot) +GetMiiEx(FFLStoreData *mii, SlotNo slot) asm("GetMiiEx__Q2_2nn3actFP12FFLStoreDataUc"); nn::Result -GetMiiImageEx(size_t* outImageSize, void* buffer, size_t bufferSize, int unk, SlotNo slot) +GetMiiImageEx(size_t *outImageSize, void *buffer, size_t bufferSize, int unk, SlotNo slot) asm("GetMiiImageEx__Q2_2nn3actFPUiPvUi15ACTMiiImageTypeUc"); nn::Result @@ -125,7 +127,7 @@ GetPrincipalId(void) asm("GetPrincipalId__Q2_2nn3actFv"); nn::Result -GetPrincipalIdEx(PrincipalId* outId, SlotNo slot) +GetPrincipalIdEx(PrincipalId *outId, SlotNo slot) asm("GetPrincipalIdEx__Q2_2nn3actFPUiUc"); SimpleAddressId @@ -133,7 +135,7 @@ GetSimpleAddressId(void) asm("GetSimpleAddressId__Q2_2nn3actFv"); nn::Result -GetSimpleAddressId(SimpleAddressId* outId, SlotNo slot) +GetSimpleAddressId(SimpleAddressId *outId, SlotNo slot) asm("GetSimpleAddressIdEx__Q2_2nn3actFPUiUc"); SlotNo @@ -145,7 +147,7 @@ GetTransferableId(uint32_t unk1) asm("GetTransferableId__Q2_2nn3actFUi"); nn::Result -GetTransferableIdEx(TransferrableId* outId, uint32_t unk1, SlotNo slot) +GetTransferableIdEx(TransferrableId *outId, uint32_t unk1, SlotNo slot) asm("GetTransferableIdEx__Q2_2nn3actFPULUiUc"); nn::Result diff --git a/include/nn/ccr/sys.h b/include/nn/ccr/sys.h index 44e8762ca..8dd882a53 100644 --- a/include/nn/ccr/sys.h +++ b/include/nn/ccr/sys.h @@ -18,27 +18,27 @@ typedef struct CCRSysUpdateState CCRSysUpdateState; typedef enum CCRSysPairingState { //! Pairing is complete / hasn't started yet - CCR_SYS_PAIRING_FINISHED = 0, + CCR_SYS_PAIRING_FINISHED = 0, //! Pairing is in progress - CCR_SYS_PAIRING_IN_PROGRESS = 1, + CCR_SYS_PAIRING_IN_PROGRESS = 1, //! Pairing timed out - CCR_SYS_PAIRING_TIMED_OUT = 2, + CCR_SYS_PAIRING_TIMED_OUT = 2, } CCRSysPairingState; typedef enum CCRSysInitBootFlag { - CCR_SYS_BOOT_FLAG_NONE = 0, - //! Shows "Turn on the TV and Wii U Console.." text on next DRC boot - CCR_SYS_BOOT_FLAG_FIRST_BOOT = 1, + CCR_SYS_BOOT_FLAG_NONE = 0, + //! Shows "Turn on the TV and Wii U Console.." text on next DRC boot + CCR_SYS_BOOT_FLAG_FIRST_BOOT = 1, } CCRSysInitBootFlag; typedef enum CCRSysLCDMode { - CCR_SYS_LCD_MODE_BRIGHTNESS_1 = 1, - CCR_SYS_LCD_MODE_BRIGHTNESS_2 = 2, - CCR_SYS_LCD_MODE_BRIGHTNESS_3 = 3, - CCR_SYS_LCD_MODE_BRIGHTNESS_4 = 4, - CCR_SYS_LCD_MODE_BRIGHTNESS_5 = 5, + CCR_SYS_LCD_MODE_BRIGHTNESS_1 = 1, + CCR_SYS_LCD_MODE_BRIGHTNESS_2 = 2, + CCR_SYS_LCD_MODE_BRIGHTNESS_3 = 3, + CCR_SYS_LCD_MODE_BRIGHTNESS_4 = 4, + CCR_SYS_LCD_MODE_BRIGHTNESS_5 = 5, } CCRSysLCDMode; struct CCRSysUpdateState diff --git a/include/nn/ccr/sys_caffeine.h b/include/nn/ccr/sys_caffeine.h index ccbd62e81..addf9fb32 100644 --- a/include/nn/ccr/sys_caffeine.h +++ b/include/nn/ccr/sys_caffeine.h @@ -16,16 +16,16 @@ typedef struct CCRAppLaunchParam CCRAppLaunchParam; struct WUT_PACKED CCRAppLaunchParam { - uint64_t launchInfoDatabaseEntryId; // id used in the \link nn::sl::LaunchInfoDatabase - char uuid[16]; // account uuid - WUT_UNKNOWN_BYTES(0xE7); + uint64_t launchInfoDatabaseEntryId; // id used in the \link nn::sl::LaunchInfoDatabase + char uuid[16]; // account uuid + WUT_UNKNOWN_BYTES(0xE7); }; WUT_CHECK_OFFSET(CCRAppLaunchParam, 0x00, launchInfoDatabaseEntryId); WUT_CHECK_OFFSET(CCRAppLaunchParam, 0x08, uuid); WUT_CHECK_SIZE(CCRAppLaunchParam, 0xFF); void -CCRSysCaffeineGetAppLaunchParam(CCRAppLaunchParam * data); +CCRSysCaffeineGetAppLaunchParam(CCRAppLaunchParam *data); uint32_t CCRSysCaffeineBootCheck(); diff --git a/include/nn/cfg/CTR.h b/include/nn/cfg/CTR.h index 122f0d8a4..3bdea7ef5 100644 --- a/include/nn/cfg/CTR.h +++ b/include/nn/cfg/CTR.h @@ -4,14 +4,18 @@ #ifdef __cplusplus -namespace nn { +namespace nn +{ -namespace cfg { +namespace cfg +{ -namespace CTR { +namespace CTR +{ //! Represents a console username, used in UDS and DLP -struct UserName { +struct UserName +{ char16_t name[12]; }; WUT_CHECK_SIZE(UserName, 0x18); diff --git a/include/nn/cmpt/cmpt.h b/include/nn/cmpt/cmpt.h index 8c8c37f86..d1d7e2dde 100644 --- a/include/nn/cmpt/cmpt.h +++ b/include/nn/cmpt/cmpt.h @@ -12,10 +12,11 @@ extern "C" { #endif -typedef enum CmptScreenType { - CMPT_SCREEN_TYPE_TV = 1, - CMPT_SCREEN_TYPE_DRC, - CMPT_SCREEN_TYPE_BOTH, +typedef enum CmptScreenType +{ + CMPT_SCREEN_TYPE_TV = 1, + CMPT_SCREEN_TYPE_DRC, + CMPT_SCREEN_TYPE_BOTH, } CmptScreenType; /** @@ -26,7 +27,7 @@ typedef enum CmptScreenType { * 0 on success. */ int32_t -CMPTGetDataSize(uint32_t* outSize); +CMPTGetDataSize(uint32_t *outSize); /** * Launches the specified vWii title. @@ -35,7 +36,7 @@ CMPTGetDataSize(uint32_t* outSize); * 0 on success. */ int32_t -CMPTLaunchTitle(void* dataBuffer, uint32_t bufferSize, uint64_t titleId); +CMPTLaunchTitle(void *dataBuffer, uint32_t bufferSize, uint64_t titleId); /** * Launches vWii System Menu. @@ -44,7 +45,7 @@ CMPTLaunchTitle(void* dataBuffer, uint32_t bufferSize, uint64_t titleId); * 0 on success. */ int32_t -CMPTLaunchMenu(void* dataBuffer, uint32_t bufferSize); +CMPTLaunchMenu(void *dataBuffer, uint32_t bufferSize); /** * Launches vWii Data Management. @@ -53,7 +54,7 @@ CMPTLaunchMenu(void* dataBuffer, uint32_t bufferSize); * 0 on success. */ int32_t -CMPTLaunchDataManager(void* dataBuffer, uint32_t bufferSize); +CMPTLaunchDataManager(void *dataBuffer, uint32_t bufferSize); /** * Sets the screen type. diff --git a/include/nn/dlp/Cafe.h b/include/nn/dlp/Cafe.h index ffd3bec7a..f555d4061 100644 --- a/include/nn/dlp/Cafe.h +++ b/include/nn/dlp/Cafe.h @@ -1,8 +1,8 @@ #pragma once #include -#include #include +#include #include /** @@ -14,314 +14,340 @@ #ifdef __cplusplus -namespace nn { +namespace nn +{ -namespace dlp { +namespace dlp +{ -namespace Cafe { - enum PollStateChangeFlags : uint8_t { - //! Prevents \c PollStateChange from blocking if no new data is available - DLP_POLL_NONBLOCK = 1 << 0, - }; - WUT_CHECK_SIZE(PollStateChangeFlags, 0x1); +namespace Cafe +{ +enum PollStateChangeFlags : uint8_t +{ + //! Prevents \c PollStateChange from blocking if no new data is available + DLP_POLL_NONBLOCK = 1 << 0, +}; +WUT_CHECK_SIZE(PollStateChangeFlags, 0x1); - //! Represents the client state - enum class ClientState : uint32_t { - //! The client is accepted for the DLP child distribution - Accepted = 5, - //! The client is receiving the distributed DLP child - Receiving = 6, - //! The client has received the distribution and is ready to boot the DLP child - Ready = 7, - //! The client is connected to the session and pending to be accepted - Connecting = 64 - }; - WUT_CHECK_SIZE(ClientState, 0x4); +//! Represents the client state +enum class ClientState : uint32_t +{ + //! The client is accepted for the DLP child distribution + Accepted = 5, + //! The client is receiving the distributed DLP child + Receiving = 6, + //! The client has received the distribution and is ready to boot the DLP child + Ready = 7, + //! The client is connected to the session and pending to be accepted + Connecting = 64 +}; +WUT_CHECK_SIZE(ClientState, 0x4); - //! Represents the server state. All values between 3 and 7 are considered internal state - enum class ServerState : uint32_t { - //! The server is not initialized - Uninitialized = 0, - //! The server is initialized but there is no active network - Idle = 1, - //! The server is open to new connections - Open = 2, - //! The server is distributing the DLP child to the clients - DistributingInternal = 7, - //! The server has distributed the DLP child - Distributed = 8, - //! The server has finished distribution and clients are booted into the DLP child - Finished = 9, - //! The server failed to distribute the DLP child to the clients - Failed = 10, - //! Public value for internal states - Distributing = 11 - }; - WUT_CHECK_SIZE(ServerState, 0x4); +//! Represents the server state. All values between 3 and 7 are considered internal state +enum class ServerState : uint32_t +{ + //! The server is not initialized + Uninitialized = 0, + //! The server is initialized but there is no active network + Idle = 1, + //! The server is open to new connections + Open = 2, + //! The server is distributing the DLP child to the clients + DistributingInternal = 7, + //! The server has distributed the DLP child + Distributed = 8, + //! The server has finished distribution and clients are booted into the DLP child + Finished = 9, + //! The server failed to distribute the DLP child to the clients + Failed = 10, + //! Public value for internal states + Distributing = 11 +}; +WUT_CHECK_SIZE(ServerState, 0x4); - class Server { - public: - /** - * Accepts a client into the DLP child distribution. - * - * \param nodeId - * The node ID of the client. - */ - static nn::Result - AcceptClient(uint16_t nodeId) asm("AcceptClient__Q4_2nn3dlp4Cafe6ServerSFUs"); +class Server +{ +public: + /** + * Accepts a client into the DLP child distribution. + * + * \param nodeId + * The node ID of the client. + */ + static nn::Result + AcceptClient(uint16_t nodeId) + asm("AcceptClient__Q4_2nn3dlp4Cafe6ServerSFUs"); - /** - * Closes the DLP session. - */ - static nn::Result - CloseSessions() asm("CloseSessions__Q4_2nn3dlp4Cafe6ServerSFv"); + /** + * Closes the DLP session. + */ + static nn::Result + CloseSessions() + asm("CloseSessions__Q4_2nn3dlp4Cafe6ServerSFv"); - /** - * Disconnects a client from the DLP session. This cannot be done after starting distribution. - * - * \param nodeId - * The node ID of the client. - */ - static nn::Result - DisconnectClient(uint16_t nodeId) asm("DisconnectClient__Q4_2nn3dlp4Cafe6ServerSFUs"); + /** + * Disconnects a client from the DLP session. This cannot be done after starting distribution. + * + * \param nodeId + * The node ID of the client. + */ + static nn::Result + DisconnectClient(uint16_t nodeId) + asm("DisconnectClient__Q4_2nn3dlp4Cafe6ServerSFUs"); - /** - * Finalizes DLP. - */ - static nn::Result - Finalize() asm("Finalize__Q4_2nn3dlp4Cafe6ServerSFv"); + /** + * Finalizes DLP. + */ + static nn::Result + Finalize() + asm("Finalize__Q4_2nn3dlp4Cafe6ServerSFv"); - /** - * Gets information about a client. - * - * \param clientInfo - * Pointer where the client information is written. - * - * \param nodeId - * Node ID of the client. - */ - static nn::Result - GetClientInfo(nn::uds::Cafe::NodeInformation *clientInfo, uint16_t nodeId) asm("GetClientInfo__Q4_2nn3dlp4Cafe6ServerSFPQ4_2nn3uds4Cafe15NodeInformationUs"); + /** + * Gets information about a client. + * + * \param clientInfo + * Pointer where the client information is written. + * + * \param nodeId + * Node ID of the client. + */ + static nn::Result + GetClientInfo(nn::uds::Cafe::NodeInformation *clientInfo, uint16_t nodeId) + asm("GetClientInfo__Q4_2nn3dlp4Cafe6ServerSFPQ4_2nn3uds4Cafe15NodeInformationUs"); - /** - * Gets a client state. - * - * \param state - * Pointer where the client state is filled in. - * - * \param nodeId - * Node ID of the client. - */ - static nn::Result - GetClientState(ClientState *state, uint16_t nodeId) asm("GetClientState__Q4_2nn3dlp4Cafe6ServerSFPQ4_2nn3dlp4Cafe11ClientStateUs"); + /** + * Gets a client state. + * + * \param state + * Pointer where the client state is filled in. + * + * \param nodeId + * Node ID of the client. + */ + static nn::Result + GetClientState(ClientState *state, uint16_t nodeId) + asm("GetClientState__Q4_2nn3dlp4Cafe6ServerSFPQ4_2nn3dlp4Cafe11ClientStateUs"); - /** - * Gets a client state. - * - * \param state - * Pointer where the client state is filled in. - * - * \param unitsTotal - * Pointer filled with the total number of units being distributed. - * Only filled when starting distribution and the DLP child isn't cached. - * - * \param unitsReceived - * Pointer filled with the number of units that the client has received. - * Only filled when starting distribution and the DLP child isn't cached. - * - * \param nodeId - * Node ID of the client. - */ - static nn::Result - GetClientState(ClientState *state, - uint32_t *unitsTotal, - uint32_t *unitsReceived, - uint16_t nodeId) asm("GetClientState__Q4_2nn3dlp4Cafe6ServerSFPQ4_2nn3dlp4Cafe11ClientStatePUiT2Us"); + /** + * Gets a client state. + * + * \param state + * Pointer where the client state is filled in. + * + * \param unitsTotal + * Pointer filled with the total number of units being distributed. + * Only filled when starting distribution and the DLP child isn't cached. + * + * \param unitsReceived + * Pointer filled with the number of units that the client has received. + * Only filled when starting distribution and the DLP child isn't cached. + * + * \param nodeId + * Node ID of the client. + */ + static nn::Result + GetClientState(ClientState *state, + uint32_t *unitsTotal, + uint32_t *unitsReceived, + uint16_t nodeId) + asm("GetClientState__Q4_2nn3dlp4Cafe6ServerSFPQ4_2nn3dlp4Cafe11ClientStatePUiT2Us"); - /** - * Gets the clients that are connected to the DLP session. - * - * \param receivedLength - * Pointer where the number of clients written to the array is stored. - * - * \param connectingClients - * Array where the node IDs of the clients are written. - * - * \param length - * Number of nodes that the \c connectingClients array can hold. - */ - static nn::Result - GetConnectingClients(uint16_t *receivedLength, - uint16_t *connectingClients, - uint16_t length) asm("GetConnectingClients__Q4_2nn3dlp4Cafe6ServerSFPUsT1Us"); + /** + * Gets the clients that are connected to the DLP session. + * + * \param receivedLength + * Pointer where the number of clients written to the array is stored. + * + * \param connectingClients + * Array where the node IDs of the clients are written. + * + * \param length + * Number of nodes that the \c connectingClients array can hold. + */ + static nn::Result + GetConnectingClients(uint16_t *receivedLength, + uint16_t *connectingClients, + uint16_t length) + asm("GetConnectingClients__Q4_2nn3dlp4Cafe6ServerSFPUsT1Us"); - /** - * Gets the server state. Internal states are filtered as \link Distributing \endlink . - * - * \param state - * Pointer where the server state is written. - */ - static nn::Result - GetState(ServerState *state) asm("GetState__Q4_2nn3dlp4Cafe6ServerSFPQ4_2nn3dlp4Cafe11ServerState"); + /** + * Gets the server state. Internal states are filtered as \link Distributing \endlink . + * + * \param state + * Pointer where the server state is written. + */ + static nn::Result + GetState(ServerState *state) + asm("GetState__Q4_2nn3dlp4Cafe6ServerSFPQ4_2nn3dlp4Cafe11ServerState"); - /** - * Initializes DLP. - * - * \param maxClientNum - * Maximum number of clients allowed for distribution. Must be between 1 and 8 inclusively. - * - * \param uniqueId - * Unique ID of the DLP child to be distributed. - * - * \param childIndex - * Index of the DLP child to be distributed. - * - * \param userName - * Username that will be displayed to the clients. If \c NULL, the Mii name will be used. - */ - static nn::Result - Initialize(uint8_t maxClientNum, - uint32_t uniqueId, - uint8_t childIndex, - nn::cfg::CTR::UserName *userName) asm("Initialize__Q4_2nn3dlp4Cafe6ServerSFUcUiT1PQ4_2nn3cfg3CTR8UserName"); + /** + * Initializes DLP. + * + * \param maxClientNum + * Maximum number of clients allowed for distribution. Must be between 1 and 8 inclusively. + * + * \param uniqueId + * Unique ID of the DLP child to be distributed. + * + * \param childIndex + * Index of the DLP child to be distributed. + * + * \param userName + * Username that will be displayed to the clients. If \c NULL, the Mii name will be used. + */ + static nn::Result + Initialize(uint8_t maxClientNum, + uint32_t uniqueId, + uint8_t childIndex, + nn::cfg::CTR::UserName *userName) + asm("Initialize__Q4_2nn3dlp4Cafe6ServerSFUcUiT1PQ4_2nn3cfg3CTR8UserName"); - /** - * Initializes DLP. - * - * \param dupNoticeNeed - * Unknown output bool, always false on the Wii U. - * - * \param maxClientNum - * Maximum number of clients allowed for distribution. Must be between 1 and 8 inclusively. - * - * \param uniqueId - * Unique ID of the DLP child to be distributed. - * - * \param childIndex - * Index of the DLP child to be distributed. - * - * \param userName - * Username that will be displayed to the clients. If \c NULL, the Mii name will be used. - */ - static nn::Result - Initialize(bool *dupNoticeNeed, - uint8_t maxClientNum, - uint32_t uniqueId, - uint8_t childIndex, - nn::cfg::CTR::UserName *userName) asm("Initialize__Q4_2nn3dlp4Cafe6ServerSFPbUcUiT2PQ4_2nn3cfg3CTR8UserName"); + /** + * Initializes DLP. + * + * \param dupNoticeNeed + * Unknown output bool, always false on the Wii U. + * + * \param maxClientNum + * Maximum number of clients allowed for distribution. Must be between 1 and 8 inclusively. + * + * \param uniqueId + * Unique ID of the DLP child to be distributed. + * + * \param childIndex + * Index of the DLP child to be distributed. + * + * \param userName + * Username that will be displayed to the clients. If \c NULL, the Mii name will be used. + */ + static nn::Result + Initialize(bool *dupNoticeNeed, + uint8_t maxClientNum, + uint32_t uniqueId, + uint8_t childIndex, + nn::cfg::CTR::UserName *userName) + asm("Initialize__Q4_2nn3dlp4Cafe6ServerSFPbUcUiT2PQ4_2nn3cfg3CTR8UserName"); - /** - * Opens the DLP session. - * - * \param isManualAccept - * If set, all clients must be accepted to allow them to join the session. - * - * \param channel - * The channel to be used for hosting the session. Use 0 to choose a channel automatically. - * Must be either 0, 1, 6 or 11. - */ - static nn::Result - OpenSessions(bool isManualAccept, uint8_t channel) asm("OpenSessions__Q4_2nn3dlp4Cafe6ServerSFbUc"); + /** + * Opens the DLP session. + * + * \param isManualAccept + * If set, all clients must be accepted to allow them to join the session. + * + * \param channel + * The channel to be used for hosting the session. Use 0 to choose a channel automatically. + * Must be either 0, 1, 6 or 11. + */ + static nn::Result + OpenSessions(bool isManualAccept, uint8_t channel) + asm("OpenSessions__Q4_2nn3dlp4Cafe6ServerSFbUc"); - /** - * Checks if the server state chas changed, and waits until it changes if specified. - * - * \param flags - * Flags, see \link PollStateChangeFlags \endlink for all flags. - */ - static nn::Result - PollStateChange(uint8_t flags) asm("PollStateChange__Q4_2nn3dlp4Cafe6ServerSFUc"); + /** + * Checks if the server state chas changed, and waits until it changes if specified. + * + * \param flags + * Flags, see \link PollStateChangeFlags \endlink for all flags. + */ + static nn::Result + PollStateChange(uint8_t flags) + asm("PollStateChange__Q4_2nn3dlp4Cafe6ServerSFUc"); - /** - * Reboots all clients into the Download Play child. - * - * \param passPhrase - * Passphrase to be used by the client when connecting to the main UDS network. - * If \c NULL, it will be set to an empty string. - */ - static nn::Result - RebootAllClients(const char *passPhrase) asm("RebootAllClients__Q4_2nn3dlp4Cafe6ServerSFPCc"); + /** + * Reboots all clients into the Download Play child. + * + * \param passPhrase + * Passphrase to be used by the client when connecting to the main UDS network. + * If \c NULL, it will be set to an empty string. + */ + static nn::Result + RebootAllClients(const char *passPhrase) + asm("RebootAllClients__Q4_2nn3dlp4Cafe6ServerSFPCc"); - /** - * Starts distribution of the Download Play child. - */ - static nn::Result - StartDistribution() asm("StartDistribute__Q4_2nn3dlp4Cafe6ServerSFv"); - }; + /** + * Starts distribution of the Download Play child. + */ + static nn::Result + StartDistribution() + asm("StartDistribute__Q4_2nn3dlp4Cafe6ServerSFv"); +}; - class ServerPrivate { - public: - /** - * Gets the server state. Internal states are not filtered. - * - * \param state - * Pointer where the server state is written. - */ - static nn::Result - GetInternalState(ServerState *state) asm("GetInternalState__Q4_2nn3dlp4Cafe13ServerPrivateSFPQ4_2nn3dlp4Cafe11ServerState"); +class ServerPrivate +{ +public: + /** + * Gets the server state. Internal states are not filtered. + * + * \param state + * Pointer where the server state is written. + */ + static nn::Result + GetInternalState(ServerState *state) + asm("GetInternalState__Q4_2nn3dlp4Cafe13ServerPrivateSFPQ4_2nn3dlp4Cafe11ServerState"); - /** - * Initializes DLP. - * - * \param maxClientNum - * Maximum number of clients allowed for distribution. Must be between 1 and 8 inclusively. - * - * \param uniqueId - * Unique ID of the DLP child to be distributed. - * - * \param childIndex - * Index of the DLP child to be distributed. - * - * \param blockBufferSize - * Unknown parameter (default: 0xC000). Must be bigger than 0x4000 and smaller than 0x80000 inclusively. - * - * \param blockBufferNum - * Unknown parameter (default: 2). Must be a number between 2 and 4 inclusively. - * - * \param userName - * Username that will be displayed to the clients. If \c NULL, the Mii name will be used. - */ - static nn::Result - Initialize(uint8_t maxClientNum, - uint32_t uniqueId, - uint8_t childIndex, - uint32_t blockBufferSize, - uint32_t blockBufferNum, - nn::cfg::CTR::UserName *userName) asm("Initialize__Q4_2nn3dlp4Cafe13ServerPrivateSFUcUiT1N22PQ4_2nn3cfg3CTR8UserName"); + /** + * Initializes DLP. + * + * \param maxClientNum + * Maximum number of clients allowed for distribution. Must be between 1 and 8 inclusively. + * + * \param uniqueId + * Unique ID of the DLP child to be distributed. + * + * \param childIndex + * Index of the DLP child to be distributed. + * + * \param blockBufferSize + * Unknown parameter (default: 0xC000). Must be bigger than 0x4000 and smaller than 0x80000 inclusively. + * + * \param blockBufferNum + * Unknown parameter (default: 2). Must be a number between 2 and 4 inclusively. + * + * \param userName + * Username that will be displayed to the clients. If \c NULL, the Mii name will be used. + */ + static nn::Result + Initialize(uint8_t maxClientNum, + uint32_t uniqueId, + uint8_t childIndex, + uint32_t blockBufferSize, + uint32_t blockBufferNum, + nn::cfg::CTR::UserName *userName) + asm("Initialize__Q4_2nn3dlp4Cafe13ServerPrivateSFUcUiT1N22PQ4_2nn3cfg3CTR8UserName"); - /** - * Initializes DLP. - * - * \param dupNoticeNeed - * Unknown output bool, always false on the Wii U. - * - * \param maxClientNum - * Maximum number of clients allowed for distribution. Must be between 1 and 8 inclusively. - * - * \param uniqueId - * Unique ID of the DLP child to be distributed. - * - * \param childIndex - * Index of the DLP child to be distributed. - * - * \param blockBufferSize - * Unknown parameter (default: 0xC000). Must be bigger than 0x4000 and smaller than 0x80000 inclusively. - * - * \param blockBufferNum - * Unknown parameter (default: 2). Must be a number between 2 and 4 inclusively. - * - * \param userName - * Username that will be displayed to the clients. If \c NULL, the Mii name will be used. - */ - static nn::Result - Initialize(bool *dupNoticeNeed, - uint8_t maxClientNum, - uint32_t uniqueId, - uint8_t childIndex, - uint32_t blockBufferSize, - uint32_t blockBufferNum, - nn::cfg::CTR::UserName *userName) asm("Initialize__Q4_2nn3dlp4Cafe13ServerPrivateSFPbUcUiT2N23PQ4_2nn3cfg3CTR8UserName"); - }; + /** + * Initializes DLP. + * + * \param dupNoticeNeed + * Unknown output bool, always false on the Wii U. + * + * \param maxClientNum + * Maximum number of clients allowed for distribution. Must be between 1 and 8 inclusively. + * + * \param uniqueId + * Unique ID of the DLP child to be distributed. + * + * \param childIndex + * Index of the DLP child to be distributed. + * + * \param blockBufferSize + * Unknown parameter (default: 0xC000). Must be bigger than 0x4000 and smaller than 0x80000 inclusively. + * + * \param blockBufferNum + * Unknown parameter (default: 2). Must be a number between 2 and 4 inclusively. + * + * \param userName + * Username that will be displayed to the clients. If \c NULL, the Mii name will be used. + */ + static nn::Result + Initialize(bool *dupNoticeNeed, + uint8_t maxClientNum, + uint32_t uniqueId, + uint8_t childIndex, + uint32_t blockBufferSize, + uint32_t blockBufferNum, + nn::cfg::CTR::UserName *userName) + asm("Initialize__Q4_2nn3dlp4Cafe13ServerPrivateSFPbUcUiT2N23PQ4_2nn3cfg3CTR8UserName"); +}; } // namespace Cafe } // namespace dlp diff --git a/include/nn/erreula/erreula_cpp.h b/include/nn/erreula/erreula_cpp.h index ddb88fdc0..86b6a1f60 100644 --- a/include/nn/erreula/erreula_cpp.h +++ b/include/nn/erreula/erreula_cpp.h @@ -3,8 +3,8 @@ #include #include #include -#include #include +#include /** * \defgroup nn_erreula_erreula Error Viewer @@ -24,19 +24,19 @@ namespace erreula enum class ControllerType { - WiiRemote0 = 0, - WiiRemote1 = 1, - WiiRemote2 = 2, - WiiRemote3 = 3, - DrcGamepad = 4, + WiiRemote0 = 0, + WiiRemote1 = 1, + WiiRemote2 = 2, + WiiRemote3 = 3, + DrcGamepad = 4, }; enum class ErrorType { - Code = 0, - Message = 1, - Message1Button = 2, - Message2Button = 3, + Code = 0, + Message = 1, + Message1Button = 2, + Message2Button = 3, }; enum class LangType @@ -58,20 +58,20 @@ enum class LangType enum class RegionType { - Japan = 0, - USA = 1, - Europe = 2, - China = 3, - Korea = 4, - Taiwan = 5, + Japan = 0, + USA = 1, + Europe = 2, + China = 3, + Korea = 4, + Taiwan = 5, }; enum class ResultType { - None = 0, + None = 0, //! The user exited the error viewer - Exited = 1, + Exited = 1, // TODO: More result types }; @@ -79,28 +79,28 @@ enum class ResultType enum class RenderTarget { //! Render only to TV - Tv = 0, + Tv = 0, //! Render only to DRC gamepad - Drc = 1, + Drc = 1, //! Render to both TV and Gamepad - Both = 2, + Both = 2, }; enum class State { //! The error viewer is completely hidden. - Hidden = 0, + Hidden = 0, //! The error viewer is drawing the fade-in animation. - FadeIn = 1, + FadeIn = 1, //! The error viewer is done drawing the fade in animation and completely visible. - Visible = 2, + Visible = 2, //! The error viewer is drawing the fade-out animation. - FadeOut = 3, + FadeOut = 3, }; struct ErrorArg diff --git a/include/nn/ffl/miidata.h b/include/nn/ffl/miidata.h index 0632089ab..1c8ee8a14 100644 --- a/include/nn/ffl/miidata.h +++ b/include/nn/ffl/miidata.h @@ -14,13 +14,15 @@ extern "C" { // https://github.com/decaf-emu/decaf-emu/blob/master/src/libdecaf/src/nn/ffl/nn_ffl_miidata.h -typedef enum FFLCreateIDFlags { - FFL_CREATE_ID_FLAG_WII_U = 0x1 | 0x4, +typedef enum FFLCreateIDFlags +{ + FFL_CREATE_ID_FLAG_WII_U = 0x1 | 0x4, FFL_CREATE_ID_FLAG_TEMPORARY = 0x2, - FFL_CREATE_ID_FLAG_NORMAL = 0x8, + FFL_CREATE_ID_FLAG_NORMAL = 0x8, } FFLCreateIDFlags; -typedef struct WUT_PACKED FFLCreateID { +typedef struct WUT_PACKED FFLCreateID +{ FFLCreateIDFlags flags : 4; uint32_t timestamp : 28; @@ -31,7 +33,8 @@ WUT_CHECK_OFFSET(FFLCreateID, 4, deviceHash); WUT_CHECK_SIZE(FFLCreateID, 10); //Note: the endian may be wrong here -typedef struct WUT_PACKED FFLiMiiDataCore { +typedef struct WUT_PACKED FFLiMiiDataCore +{ // 0x00 uint8_t birth_platform : 4; uint8_t unk_0x00_b4 : 4; @@ -150,14 +153,16 @@ WUT_CHECK_OFFSET(FFLiMiiDataCore, 0x2F, fatness); WUT_CHECK_OFFSET(FFLiMiiDataCore, 0x33, hair_type); WUT_CHECK_SIZE(FFLiMiiDataCore, 0x48); -typedef struct WUT_PACKED FFLiMiiDataOfficial { +typedef struct WUT_PACKED FFLiMiiDataOfficial +{ FFLiMiiDataCore core; uint16_t creator_name[10]; } FFLiMiiDataOfficial; WUT_CHECK_OFFSET(FFLiMiiDataOfficial, 0x48, creator_name); WUT_CHECK_SIZE(FFLiMiiDataOfficial, 0x5C); -typedef struct WUT_PACKED FFLStoreData { +typedef struct WUT_PACKED FFLStoreData +{ FFLiMiiDataOfficial data; uint16_t unk_0x5C; uint16_t checksum; diff --git a/include/nn/fp/fp_cpp.h b/include/nn/fp/fp_cpp.h index 8f4f0815c..97414a799 100644 --- a/include/nn/fp/fp_cpp.h +++ b/include/nn/fp/fp_cpp.h @@ -1,8 +1,8 @@ #pragma once #include -#include -#include #include +#include +#include /** * \defgroup nn_fp_fp Friends Presence @@ -22,36 +22,36 @@ namespace fp enum NotificationType { - NOTIFICATION_ONLINE = 1, - NOTIFICATION_OFFLINE = 2, - NOTIFICATION_PREFERENCE = 3, - NOTIFICATION_FRIEND_ONLINE = 4, - NOTIFICATION_FRIEND_OFFLINE = 5, - NOTIFICATION_FRIEND_PRESENCE = 6, - NOTIFICATION_FRIEND_MII = 7, - NOTIFICATION_FRIEND_PROFILE = 8, - NOTIFICATION_FRIEND_ADDED = 9, - NOTIFICATION_FRIEND_REMOVED = 10, - NOTIFICATION_MY_REQUEST_ADDED = 11, - NOTIFICATION_MY_REQUEST_REMOVED = 12, - NOTIFICATION_MY_REQUEST_UPDATED = 13, - NOTIFICATION_BLACKLIST_ADDED = 14, - NOTIFICATION_BLACKLIST_REMOVED = 15, - NOTIFICATION_BLACKLIST_UPDATED = 16, - NOTIFICATION_REQUEST_ADDED = 17, - NOTIFICATION_REQUEST_REMOVED = 18, - - //! TODO: find all notification types + NOTIFICATION_ONLINE = 1, + NOTIFICATION_OFFLINE = 2, + NOTIFICATION_PREFERENCE = 3, + NOTIFICATION_FRIEND_ONLINE = 4, + NOTIFICATION_FRIEND_OFFLINE = 5, + NOTIFICATION_FRIEND_PRESENCE = 6, + NOTIFICATION_FRIEND_MII = 7, + NOTIFICATION_FRIEND_PROFILE = 8, + NOTIFICATION_FRIEND_ADDED = 9, + NOTIFICATION_FRIEND_REMOVED = 10, + NOTIFICATION_MY_REQUEST_ADDED = 11, + NOTIFICATION_MY_REQUEST_REMOVED = 12, + NOTIFICATION_MY_REQUEST_UPDATED = 13, + NOTIFICATION_BLACKLIST_ADDED = 14, + NOTIFICATION_BLACKLIST_REMOVED = 15, + NOTIFICATION_BLACKLIST_UPDATED = 16, + NOTIFICATION_REQUEST_ADDED = 17, + NOTIFICATION_REQUEST_REMOVED = 18, + + //! TODO: find all notification types }; struct DateTime { - uint16_t year; - uint8_t month; - uint8_t day; - uint8_t hour; // hour-1 - uint8_t minutes; - uint8_t seconds; // unsure - uint8_t milliseconds; // unsure + uint16_t year; + uint8_t month; + uint8_t day; + uint8_t hour; // hour-1 + uint8_t minutes; + uint8_t seconds; // unsure + uint8_t milliseconds; // unsure }; WUT_CHECK_OFFSET(DateTime, 0x00, year); WUT_CHECK_OFFSET(DateTime, 0x02, month); @@ -64,19 +64,19 @@ WUT_CHECK_SIZE(DateTime, 0x08); struct GameKey { - uint64_t titleId; - uint16_t unk_0x8; - uint32_t unk_0xC; + uint64_t titleId; + uint16_t unk_0x8; + uint32_t unk_0xC; }; WUT_CHECK_OFFSET(GameKey, 0x00, titleId); WUT_CHECK_SIZE(GameKey, 0x10); struct RecentPlayRecord { - nn::act::PrincipalId principalId; - uint16_t unk_0x04; - char16_t inGameName[nn::act::AccountIdSize]; - char16_t myMiiName[nn::act::AccountIdSize]; + nn::act::PrincipalId principalId; + uint16_t unk_0x04; + char16_t inGameName[nn::act::AccountIdSize]; + char16_t myMiiName[nn::act::AccountIdSize]; }; WUT_CHECK_OFFSET(RecentPlayRecord, 0x00, principalId); WUT_CHECK_OFFSET(RecentPlayRecord, 0x04, unk_0x04); @@ -86,9 +86,9 @@ WUT_CHECK_SIZE(RecentPlayRecord, 0x4C); struct RecentPlayRecordEx { - RecentPlayRecord playRecord; - GameKey game; - DateTime date; + RecentPlayRecord playRecord; + GameKey game; + DateTime date; }; WUT_CHECK_OFFSET(RecentPlayRecordEx, 0x00, playRecord); WUT_CHECK_OFFSET(RecentPlayRecordEx, 0x50, game); @@ -97,23 +97,23 @@ WUT_CHECK_SIZE(RecentPlayRecordEx, 0x68); struct Preference { - bool unk_0x00; - bool unk_0x01; - bool unk_0x02; - WUT_PADDING_BYTES(1); + bool unk_0x00; + bool unk_0x01; + bool unk_0x02; + WUT_PADDING_BYTES(1); }; WUT_CHECK_SIZE(Preference, 0x04); struct GameMode { - BOOL joinAvailabilityFlag; - uint32_t matchmakeSystemType; // 2 ?? - uint32_t joinGameId; - uint32_t joinGameMode; - //! only set when joinAvailabilityFlag is TRUE - nn::act::PrincipalId ownerPrincipalId; - uint32_t joinGroupId; - uint8_t applicationArg[0x14]; + BOOL joinAvailabilityFlag; + uint32_t matchmakeSystemType; // 2 ?? + uint32_t joinGameId; + uint32_t joinGameMode; + //! only set when joinAvailabilityFlag is TRUE + nn::act::PrincipalId ownerPrincipalId; + uint32_t joinGroupId; + uint8_t applicationArg[0x14]; }; WUT_CHECK_OFFSET(GameMode, 0x00, joinAvailabilityFlag); WUT_CHECK_OFFSET(GameMode, 0x04, matchmakeSystemType); @@ -126,10 +126,10 @@ WUT_CHECK_SIZE(GameMode, 0x2C); struct Presence { - GameMode gameMode; - uint8_t region; - uint8_t language; - uint8_t platform; + GameMode gameMode; + uint8_t region; + uint8_t language; + uint8_t platform; }; WUT_CHECK_OFFSET(Presence, 0x00, gameMode); WUT_CHECK_OFFSET(Presence, 0x2C, region); @@ -139,8 +139,8 @@ WUT_CHECK_SIZE(Presence, 0x30); struct FriendPresence : Presence { - bool isOnline; - bool isValid; + bool isOnline; + bool isValid; }; WUT_CHECK_OFFSET(FriendPresence, 0x30, isOnline); WUT_CHECK_OFFSET(FriendPresence, 0x31, isValid); @@ -148,7 +148,7 @@ WUT_CHECK_SIZE(FriendPresence, 0x34); struct MyPresence : Presence { - char16_t presenceText[64]; + char16_t presenceText[64]; }; WUT_CHECK_OFFSET(MyPresence, 0x30, presenceText); WUT_CHECK_SIZE(MyPresence, 0xB0); @@ -156,29 +156,29 @@ WUT_CHECK_SIZE(MyPresence, 0xB0); //! TODO: find member types and names struct BasicInfo { - WUT_UNKNOWN_BYTES(0x68); + WUT_UNKNOWN_BYTES(0x68); }; WUT_CHECK_SIZE(BasicInfo, 0x68); //! TODO: find member types and names struct BlackListedPrincipal { - WUT_UNKNOWN_BYTES(0xB0); + WUT_UNKNOWN_BYTES(0xB0); }; WUT_CHECK_SIZE(BlackListedPrincipal, 0xB0); //! TODO: find member types and names struct Profile { - WUT_UNKNOWN_BYTES(4); + WUT_UNKNOWN_BYTES(4); }; WUT_CHECK_SIZE(Profile, 0x04); struct Comment { - uint8_t unk_0x00; // probably bool isVisible - uint8_t unk_0x01; // probably bool - char16_t comment[17]; + uint8_t unk_0x00; // probably bool isVisible + uint8_t unk_0x01; // probably bool + char16_t comment[17]; }; WUT_CHECK_OFFSET(Comment, 0x00, unk_0x00); WUT_CHECK_OFFSET(Comment, 0x01, unk_0x01); @@ -187,487 +187,487 @@ WUT_CHECK_SIZE(Comment, 0x24); struct FriendData { - /*! TODO: find types and names */ - WUT_UNKNOWN_BYTES(0x228); + /*! TODO: find types and names */ + WUT_UNKNOWN_BYTES(0x228); }; WUT_CHECK_SIZE(FriendData, 0x228); struct GameModeDescription { - /*! TODO: find size and member types/names */ + /*! TODO: find size and member types/names */ }; struct FriendRequest { - /* Notes: + /* Notes: * MaxCharsOnKBD = char16_t[63] * Real Buffer prolly = char16_t[64] **/ - WUT_UNKNOWN_BYTES(0x164); + WUT_UNKNOWN_BYTES(0x164); }; WUT_CHECK_SIZE(FriendRequest, 0x164); -typedef void(*FPAsyncCallback)(nn::Result, void *); -typedef void(*NotificationHandlerFn)(nn::fp::NotificationType, nn::act::PrincipalId, void *); +typedef void (*FPAsyncCallback)(nn::Result, void *); +typedef void (*NotificationHandlerFn)(nn::fp::NotificationType, nn::act::PrincipalId, void *); nn::Result -AcceptFriendRequestAsync(nn::act::LocalFriendCode/*unsure*/, FPAsyncCallback, void *) - asm("AcceptFriendRequestAsync__Q2_2nn2fpFULPFQ2_2nn6ResultPv_vPv"); +AcceptFriendRequestAsync(nn::act::LocalFriendCode /*unsure*/, FPAsyncCallback, void *) + asm("AcceptFriendRequestAsync__Q2_2nn2fpFULPFQ2_2nn6ResultPv_vPv"); nn::Result AddBlackListAsync(nn::act::PrincipalId, nn::fp::GameKey *, FPAsyncCallback, void *) - asm("AddBlackListAsync__Q2_2nn2fpFUiPCQ3_2nn2fp7GameKeyPFQ2_2nn6ResultPv_vPv"); + asm("AddBlackListAsync__Q2_2nn2fpFUiPCQ3_2nn2fp7GameKeyPFQ2_2nn6ResultPv_vPv"); nn::Result AddBlackListAsync(nn::act::PrincipalId, FPAsyncCallback, void *) - asm("AddBlackListAsync__Q2_2nn2fpFUiPFQ2_2nn6ResultPv_vPv"); + asm("AddBlackListAsync__Q2_2nn2fpFUiPFQ2_2nn6ResultPv_vPv"); nn::Result -AddFriendAsync(char nnid[nn::act::AccountIdSize]/*unsure*/, FPAsyncCallback, void *) - asm("AddFriendAsync__Q2_2nn2fpFPCcPFQ2_2nn6ResultPv_vPv"); +AddFriendAsync(char nnid[nn::act::AccountIdSize] /*unsure*/, FPAsyncCallback, void *) + asm("AddFriendAsync__Q2_2nn2fpFPCcPFQ2_2nn6ResultPv_vPv"); nn::Result AddFriendAsync(nn::act::PrincipalId /*unsure*/, FPAsyncCallback, void *) - asm("AddFriendAsync__Q2_2nn2fpFUiPFQ2_2nn6ResultPv_vPv"); + asm("AddFriendAsync__Q2_2nn2fpFUiPFQ2_2nn6ResultPv_vPv"); nn::Result AddFriendRequestAsync(const nn::fp::RecentPlayRecordEx *, const char16_t *, FPAsyncCallback, void *) - asm("AddFriendRequestAsync__Q2_2nn2fpFPCQ3_2nn2fp18RecentPlayRecordExPCwPFQ2_2nn6ResultPv_vPv"); + asm("AddFriendRequestAsync__Q2_2nn2fpFPCQ3_2nn2fp18RecentPlayRecordExPCwPFQ2_2nn6ResultPv_vPv"); nn::Result AddFriendRequestAsync(unsigned int, unsigned char, const char16_t *, unsigned char, const char16_t *, FPAsyncCallback, void *) - asm("AddFriendRequestAsync__Q2_2nn2fpFUiUcPCwT2T3PFQ2_2nn6ResultPv_vPv"); + asm("AddFriendRequestAsync__Q2_2nn2fpFUiUcPCwT2T3PFQ2_2nn6ResultPv_vPv"); nn::Result AddFriendRequestNoTitleAsync(unsigned int, unsigned char, const char16_t *, unsigned char, const char16_t *, FPAsyncCallback, void *) - asm("AddFriendRequestNoTitleAsync__Q2_2nn2fpFUiUcPCwT2T3PFQ2_2nn6ResultPv_vPv"); + asm("AddFriendRequestNoTitleAsync__Q2_2nn2fpFUiUcPCwT2T3PFQ2_2nn6ResultPv_vPv"); nn::Result AddRecentPlayRecordEx(const nn::fp::RecentPlayRecordEx *, unsigned int) - asm("AddRecentPlayRecordEx__Q2_2nn2fpFPCQ3_2nn2fp18RecentPlayRecordExUi"); + asm("AddRecentPlayRecordEx__Q2_2nn2fpFPCQ3_2nn2fp18RecentPlayRecordExUi"); nn::Result AddRecentPlayRecord(const nn::fp::RecentPlayRecord *, unsigned int) - asm("AddRecentPlayRecord__Q2_2nn2fpFPCQ3_2nn2fp16RecentPlayRecordUi"); + asm("AddRecentPlayRecord__Q2_2nn2fpFPCQ3_2nn2fp16RecentPlayRecordUi"); nn::Result -CancelFriendRequestAsync(nn::act::LocalFriendCode/*unsure*/, FPAsyncCallback, void *) - asm("CancelFriendRequestAsync__Q2_2nn2fpFULPFQ2_2nn6ResultPv_vPv"); +CancelFriendRequestAsync(nn::act::LocalFriendCode /*unsure*/, FPAsyncCallback, void *) + asm("CancelFriendRequestAsync__Q2_2nn2fpFULPFQ2_2nn6ResultPv_vPv"); nn::Result CheckSettingStatusAsync(unsigned char *, FPAsyncCallback, void *) - asm("CheckSettingStatusAsync__Q2_2nn2fpFPUcPFQ2_2nn6ResultPv_vPv"); + asm("CheckSettingStatusAsync__Q2_2nn2fpFPUcPFQ2_2nn6ResultPv_vPv"); nn::Result ClearLedEvent(void) - asm("ClearLedEvent__Q2_2nn2fpFv"); + asm("ClearLedEvent__Q2_2nn2fpFv"); nn::Result DeleteFriendFlagsAsync(const unsigned int *, unsigned int, unsigned int, FPAsyncCallback, void *) - asm("DeleteFriendFlagsAsync__Q2_2nn2fpFPCUiUiT2PFQ2_2nn6ResultPv_vPv"); + asm("DeleteFriendFlagsAsync__Q2_2nn2fpFPCUiUiT2PFQ2_2nn6ResultPv_vPv"); nn::Result -DeleteFriendRequestAsync(nn::act::LocalFriendCode/*unsure*/, FPAsyncCallback, void *) - asm("DeleteFriendRequestAsync__Q2_2nn2fpFULPFQ2_2nn6ResultPv_vPv"); +DeleteFriendRequestAsync(nn::act::LocalFriendCode /*unsure*/, FPAsyncCallback, void *) + asm("DeleteFriendRequestAsync__Q2_2nn2fpFULPFQ2_2nn6ResultPv_vPv"); nn::Result DeleteRecentPlayRecordAll(void) - asm("DeleteRecentPlayRecordAll__Q2_2nn2fpFv"); + asm("DeleteRecentPlayRecordAll__Q2_2nn2fpFv"); nn::Result DeleteSaveDirectory(unsigned int) - asm("DeleteSaveDirectory__Q2_2nn2fpFUi"); + asm("DeleteSaveDirectory__Q2_2nn2fpFUi"); nn::Result -DenyFriendRequestAsync(nn::act::LocalFriendCode/*unsure*/, FPAsyncCallback, void *) - asm("DenyFriendRequestAsync__Q2_2nn2fpFULPFQ2_2nn6ResultPv_vPv"); +DenyFriendRequestAsync(nn::act::LocalFriendCode /*unsure*/, FPAsyncCallback, void *) + asm("DenyFriendRequestAsync__Q2_2nn2fpFULPFQ2_2nn6ResultPv_vPv"); nn::Result DetectNatPropertiesAsync(unsigned char *, unsigned char *, unsigned int *, FPAsyncCallback, void *) - asm("DetectNatPropertiesAsync__Q2_2nn2fpFPUcT1PUiPFQ2_2nn6ResultPv_vPv"); + asm("DetectNatPropertiesAsync__Q2_2nn2fpFPUcT1PUiPFQ2_2nn6ResultPv_vPv"); nn::Result FinalizeAdmin(void) - asm("FinalizeAdmin__Q2_2nn2fpFv"); + asm("FinalizeAdmin__Q2_2nn2fpFv"); nn::Result Finalize(void) - asm("Finalize__Q2_2nn2fpFv"); + asm("Finalize__Q2_2nn2fpFv"); nn::Result GetBasicInfoAsync(nn::fp::BasicInfo *, unsigned int *, unsigned int, FPAsyncCallback, void *) - asm("GetBasicInfoAsync__Q2_2nn2fpFPQ3_2nn2fp9BasicInfoPCUiUiPFQ2_2nn6ResultPv_vPv"); + asm("GetBasicInfoAsync__Q2_2nn2fpFPQ3_2nn2fp9BasicInfoPCUiUiPFQ2_2nn6ResultPv_vPv"); nn::Result GetBlackListAccountId(char *outAccountIds, unsigned int *, unsigned int) - asm("GetBlackListAccountId__Q2_2nn2fpFPA17_cPCUiUi"); + asm("GetBlackListAccountId__Q2_2nn2fpFPA17_cPCUiUi"); nn::Result GetBlackListAdditionalTime(nn::fp::DateTime *, unsigned int *, unsigned int) - asm("GetBlackListAdditionalTime__Q2_2nn2fpFPQ3_2nn2fp8DateTimePCUiUi"); + asm("GetBlackListAdditionalTime__Q2_2nn2fpFPQ3_2nn2fp8DateTimePCUiUi"); nn::Result GetBlackListEx(nn::fp::BlackListedPrincipal *outBlackList, unsigned int *, unsigned int) - asm("GetBlackListEx__Q2_2nn2fpFPQ3_2nn2fp20BlackListedPrincipalPCUiUi"); + asm("GetBlackListEx__Q2_2nn2fpFPQ3_2nn2fp20BlackListedPrincipalPCUiUi"); nn::Result -GetBlackList(nn::act::PrincipalId *outBlackListPrincipalBuffer, unsigned int *outBlackListPrincipalBufferSize, unsigned int/*unk*/, unsigned int maxReadCount) - asm("GetBlackList__Q2_2nn2fpFPUiT1UiT3"); +GetBlackList(nn::act::PrincipalId *outBlackListPrincipalBuffer, unsigned int *outBlackListPrincipalBufferSize, unsigned int /*unk*/, unsigned int maxReadCount) + asm("GetBlackList__Q2_2nn2fpFPUiT1UiT3"); nn::Result GetFriendAccountId(char *outAccountIdBuffer, nn::act::PrincipalId *principalBuffer, unsigned int accountIdBufferSize) - asm("GetFriendAccountId__Q2_2nn2fpFPA17_cPCUiUi"); + asm("GetFriendAccountId__Q2_2nn2fpFPA17_cPCUiUi"); nn::Result GetFriendApprovalTime(nn::fp::DateTime *outDateTime, unsigned int *, unsigned int) - asm("GetFriendApprovalTime__Q2_2nn2fpFPQ3_2nn2fp8DateTimePCUiUi"); + asm("GetFriendApprovalTime__Q2_2nn2fpFPQ3_2nn2fp8DateTimePCUiUi"); nn::Result GetFriendComment(nn::fp::Comment *outComment, unsigned int *, unsigned int) - asm("GetFriendComment__Q2_2nn2fpFPQ3_2nn2fp7CommentPCUiUi"); + asm("GetFriendComment__Q2_2nn2fpFPQ3_2nn2fp7CommentPCUiUi"); nn::Result GetFriendListAll(unsigned int *, unsigned int *, unsigned int, unsigned int) - asm("GetFriendListAll__Q2_2nn2fpFPUiT1UiT3"); + asm("GetFriendListAll__Q2_2nn2fpFPUiT1UiT3"); nn::Result GetFriendListEx(nn::fp::FriendData *outFriendData, nn::act::PrincipalId *principalBuffer, unsigned int count) - asm("GetFriendListEx__Q2_2nn2fpFPQ3_2nn2fp10FriendDataPCUiUi"); + asm("GetFriendListEx__Q2_2nn2fpFPQ3_2nn2fp10FriendDataPCUiUi"); nn::Result -GetFriendList(nn::act::PrincipalId *outPrincipalBuffer, unsigned int *outPrincipalBufferReadCount, unsigned int unkn/*slotId maybe*/, unsigned int principalBufferSize) - asm("GetFriendList__Q2_2nn2fpFPUiT1UiT3"); +GetFriendList(nn::act::PrincipalId *outPrincipalBuffer, unsigned int *outPrincipalBufferReadCount, unsigned int unkn /*slotId maybe*/, unsigned int principalBufferSize) + asm("GetFriendList__Q2_2nn2fpFPUiT1UiT3"); nn::Result GetFriendMii(FFLStoreData *outMiiData, nn::act::PrincipalId *principalBuffer, unsigned int count) - asm("GetFriendMii__Q2_2nn2fpFP12FFLStoreDataPCUiUi"); + asm("GetFriendMii__Q2_2nn2fpFP12FFLStoreDataPCUiUi"); nn::Result GetFriendPlayingGame(nn::fp::GameKey *outGameKey, nn::fp::GameModeDescription *outGameModeDescription, nn::act::PrincipalId *principalBuffer, unsigned int maxReadCount) - asm("GetFriendPlayingGame__Q2_2nn2fpFPQ3_2nn2fp7GameKeyPQ3_2nn2fp19GameModeDescriptionPCUiUi"); + asm("GetFriendPlayingGame__Q2_2nn2fpFPQ3_2nn2fp7GameKeyPQ3_2nn2fp19GameModeDescriptionPCUiUi"); nn::Result GetFriendPresenceEx(nn::fp::FriendPresence *, nn::act::PrincipalId *principalBuffer, unsigned int maxReadCount) - asm("GetFriendPresenceEx__Q2_2nn2fpFPQ3_2nn2fp14FriendPresencePCUiUi"); + asm("GetFriendPresenceEx__Q2_2nn2fpFPQ3_2nn2fp14FriendPresencePCUiUi"); nn::Result GetFriendPresence(nn::fp::FriendPresence *, nn::act::PrincipalId *principalBuffer, unsigned int count) - asm("GetFriendPresence__Q2_2nn2fpFPQ3_2nn2fp14FriendPresencePCUiUi"); + asm("GetFriendPresence__Q2_2nn2fpFPQ3_2nn2fp14FriendPresencePCUiUi"); nn::Result GetFriendProfile(nn::fp::Profile *, nn::act::PrincipalId *principalBuffer, unsigned int readCount) - asm("GetFriendProfile__Q2_2nn2fpFPQ3_2nn2fp7ProfilePCUiUi"); + asm("GetFriendProfile__Q2_2nn2fpFPQ3_2nn2fp7ProfilePCUiUi"); nn::Result GetFriendRelationship(uint8_t *outRelationshipNum, nn::act::PrincipalId *principalBuffer, unsigned int count) - asm("GetFriendRelationship__Q2_2nn2fpFPUcPCUiUi"); + asm("GetFriendRelationship__Q2_2nn2fpFPUcPCUiUi"); nn::Result GetFriendRequestAccountId(char *outAccountIds, nn::act::PrincipalId *principalBuffer, unsigned int count) - asm("GetFriendRequestAccountId__Q2_2nn2fpFPA17_cPCUiUi"); + asm("GetFriendRequestAccountId__Q2_2nn2fpFPA17_cPCUiUi"); nn::Result GetFriendRequestListEx(nn::fp::FriendRequest *, nn::act::PrincipalId *principalBuffer, unsigned int count) - asm("GetFriendRequestListEx__Q2_2nn2fpFPQ3_2nn2fp13FriendRequestPCUiUi"); + asm("GetFriendRequestListEx__Q2_2nn2fpFPQ3_2nn2fp13FriendRequestPCUiUi"); nn::Result -GetFriendRequestList(nn::act::PrincipalId *outBuffer, unsigned int *outReadCount, unsigned int/*unk*/, unsigned int count) - asm("GetFriendRequestList__Q2_2nn2fpFPUiT1UiT3"); +GetFriendRequestList(nn::act::PrincipalId *outBuffer, unsigned int *outReadCount, unsigned int /*unk*/, unsigned int count) + asm("GetFriendRequestList__Q2_2nn2fpFPUiT1UiT3"); nn::Result GetFriendRequestMessageId(unsigned long long *outMessageIds, unsigned int *, unsigned int) - asm("GetFriendRequestMessageId__Q2_2nn2fpFPULPCUiUi"); + asm("GetFriendRequestMessageId__Q2_2nn2fpFPULPCUiUi"); nn::Result GetFriendScreenName(char16_t outScreenName[nn::act::MiiNameSize], unsigned int *, unsigned int, bool, unsigned char *) - asm("GetFriendScreenName__Q2_2nn2fpFPA11_wPCUiUibPUc"); + asm("GetFriendScreenName__Q2_2nn2fpFPA11_wPCUiUibPUc"); nn::Result GetFriendSortTime(nn::fp::DateTime *, nn::act::PrincipalId *principalBuffer, unsigned int count) - asm("GetFriendSortTime__Q2_2nn2fpFPQ3_2nn2fp8DateTimePCUiUi"); + asm("GetFriendSortTime__Q2_2nn2fpFPQ3_2nn2fp8DateTimePCUiUi"); nn::Result GetLastLedEvent(unsigned int *, unsigned int *) - asm("GetLastLedEvent__Q2_2nn2fpFPUiT1"); + asm("GetLastLedEvent__Q2_2nn2fpFPUiT1"); nn::Result GetMyAccountId(char *outAccountId) - asm("GetMyAccountId__Q2_2nn2fpFPc"); + asm("GetMyAccountId__Q2_2nn2fpFPc"); nn::Result GetMyComment(nn::fp::Comment *outComment) - asm("GetMyComment__Q2_2nn2fpFPQ3_2nn2fp7Comment"); + asm("GetMyComment__Q2_2nn2fpFPQ3_2nn2fp7Comment"); nn::Result GetMyMii(FFLStoreData *outMiiData) - asm("GetMyMii__Q2_2nn2fpFP12FFLStoreData"); + asm("GetMyMii__Q2_2nn2fpFP12FFLStoreData"); nn::Result GetMyPlayingGame(nn::fp::GameKey *outPlayingGmae) - asm("GetMyPlayingGame__Q2_2nn2fpFPQ3_2nn2fp7GameKey"); + asm("GetMyPlayingGame__Q2_2nn2fpFPQ3_2nn2fp7GameKey"); nn::Result GetMyPreference(nn::fp::Preference *outPreference) - asm("GetMyPreference__Q2_2nn2fpFPQ3_2nn2fp10Preference"); + asm("GetMyPreference__Q2_2nn2fpFPQ3_2nn2fp10Preference"); nn::Result GetMyPresence(nn::fp::MyPresence *outMyPresence) - asm("GetMyPresence__Q2_2nn2fpFPQ3_2nn2fp10MyPresence"); + asm("GetMyPresence__Q2_2nn2fpFPQ3_2nn2fp10MyPresence"); nn::act::PrincipalId GetMyPrincipalId(void) - asm("GetMyPrincipalId__Q2_2nn2fpFv"); + asm("GetMyPrincipalId__Q2_2nn2fpFv"); nn::Result GetMyProfile(nn::fp::Profile *outProfile) - asm("GetMyProfile__Q2_2nn2fpFPQ3_2nn2fp7Profile"); + asm("GetMyProfile__Q2_2nn2fpFPQ3_2nn2fp7Profile"); nn::Result GetMyScreenName(char16_t *outScreenName) - asm("GetMyScreenName__Q2_2nn2fpFPw"); + asm("GetMyScreenName__Q2_2nn2fpFPw"); nn::Result GetRecentPlayRecord(nn::fp::RecentPlayRecordEx *outPlayRecordBuffer, unsigned int *outPlayRecordBufferSize, unsigned int, unsigned int maxReadCount) - asm("GetRecentPlayRecord__Q2_2nn2fpFPQ3_2nn2fp18RecentPlayRecordExPUiUiT3"); + asm("GetRecentPlayRecord__Q2_2nn2fpFPQ3_2nn2fp18RecentPlayRecordExPUiUiT3"); nn::Result GetRequestBlockSettingAsync(unsigned char *, unsigned int *, unsigned int, FPAsyncCallback, void *) - asm("GetRequestBlockSettingAsync__Q2_2nn2fpFPUcPCUiUiPFQ2_2nn6ResultPv_vPv"); + asm("GetRequestBlockSettingAsync__Q2_2nn2fpFPUcPCUiUiPFQ2_2nn6ResultPv_vPv"); bool HasLoggedIn(void) - asm("HasLoggedIn__Q2_2nn2fpFv"); + asm("HasLoggedIn__Q2_2nn2fpFv"); nn::Result InitializeAdmin(void) - asm("InitializeAdmin__Q2_2nn2fpFv"); + asm("InitializeAdmin__Q2_2nn2fpFv"); nn::Result Initialize(void) - asm("Initialize__Q2_2nn2fpFv"); + asm("Initialize__Q2_2nn2fpFv"); bool IsFriendRequestAllowed(void) - asm("IsFriendRequestAllowed__Q2_2nn2fpFv"); + asm("IsFriendRequestAllowed__Q2_2nn2fpFv"); bool IsInitializedAdmin(void) - asm("IsInitializedAdmin__Q2_2nn2fpFv"); + asm("IsInitializedAdmin__Q2_2nn2fpFv"); bool IsInitialized(void) - asm("IsInitialized__Q2_2nn2fpFv"); + asm("IsInitialized__Q2_2nn2fpFv"); bool -IsInvitation(nn::fp::GameMode *, nn::act::PrincipalId myPrincipalId, unsigned int/*unk*/) - asm("IsInvitation__Q2_2nn2fpFPCQ3_2nn2fp8GameModeUiT2"); +IsInvitation(nn::fp::GameMode *, nn::act::PrincipalId myPrincipalId, unsigned int /*unk*/) + asm("IsInvitation__Q2_2nn2fpFPCQ3_2nn2fp8GameModeUiT2"); bool IsJoinableForFriendListViewer(nn::fp::FriendPresence *, unsigned int, unsigned long long) - asm("IsJoinableForFriendListViewer__Q2_2nn2fpFPCQ3_2nn2fp14FriendPresenceUiUL"); + asm("IsJoinableForFriendListViewer__Q2_2nn2fpFPCQ3_2nn2fp14FriendPresenceUiUL"); bool IsJoinableForFriendListViewer(nn::fp::Presence *, unsigned int, unsigned long long) - asm("IsJoinableForFriendListViewer__Q2_2nn2fpFPCQ3_2nn2fp8PresenceUiUL"); + asm("IsJoinableForFriendListViewer__Q2_2nn2fpFPCQ3_2nn2fp8PresenceUiUL"); bool IsJoinable(nn::fp::FriendPresence *, unsigned long long) - asm("IsJoinable__Q2_2nn2fpFPCQ3_2nn2fp14FriendPresenceUL"); + asm("IsJoinable__Q2_2nn2fpFPCQ3_2nn2fp14FriendPresenceUL"); bool IsOnline(void) - asm("IsOnline__Q2_2nn2fpFv"); + asm("IsOnline__Q2_2nn2fpFv"); bool IsPreferenceValid(void) - asm("IsPreferenceValid__Q2_2nn2fpFv"); + asm("IsPreferenceValid__Q2_2nn2fpFv"); bool IsRecentPlayRecordCorrupted(void) - asm("IsRecentPlayRecordCorrupted__Q2_2nn2fpFv"); + asm("IsRecentPlayRecordCorrupted__Q2_2nn2fpFv"); bool IsRequestBlockForced(void) - asm("IsRequestBlockForced__Q2_2nn2fpFv"); + asm("IsRequestBlockForced__Q2_2nn2fpFv"); nn::Result LoginAsync(FPAsyncCallback, void *) - asm("LoginAsync__Q2_2nn2fpFPFQ2_2nn6ResultPv_vPv"); + asm("LoginAsync__Q2_2nn2fpFPFQ2_2nn6ResultPv_vPv"); nn::Result Logout(void) - asm("Logout__Q2_2nn2fpFv"); + asm("Logout__Q2_2nn2fpFv"); nn::Result MarkFriendRequestsAsReceivedAsync(unsigned long long *, unsigned int, FPAsyncCallback, void *) - asm("MarkFriendRequestsAsReceivedAsync__Q2_2nn2fpFPCULUiPFQ2_2nn6ResultPv_vPv"); + asm("MarkFriendRequestsAsReceivedAsync__Q2_2nn2fpFPCULUiPFQ2_2nn6ResultPv_vPv"); nn::Result RegisterAccountAsync(FPAsyncCallback, void *) - asm("RegisterAccountAsync__Q2_2nn2fpFPFQ2_2nn6ResultPv_vPv"); + asm("RegisterAccountAsync__Q2_2nn2fpFPFQ2_2nn6ResultPv_vPv"); nn::Result RemoveBlackListAsync(unsigned int, FPAsyncCallback, void *) - asm("RemoveBlackListAsync__Q2_2nn2fpFUiPFQ2_2nn6ResultPv_vPv"); + asm("RemoveBlackListAsync__Q2_2nn2fpFUiPFQ2_2nn6ResultPv_vPv"); nn::Result RemoveFriendAsync(unsigned int, FPAsyncCallback, void *) - asm("RemoveFriendAsync__Q2_2nn2fpFUiPFQ2_2nn6ResultPv_vPv"); + asm("RemoveFriendAsync__Q2_2nn2fpFUiPFQ2_2nn6ResultPv_vPv"); uint32_t -ResultToErrorCode(nn::Result) - asm("ResultToErrorCode__Q2_2nn2fpFQ2_2nn6Result"); + ResultToErrorCode(nn::Result) + asm("ResultToErrorCode__Q2_2nn2fpFQ2_2nn6Result"); nn::Result SetInvitationParameter(nn::fp::GameMode *, unsigned int *, unsigned int, bool) - asm("SetInvitationParameter__Q2_2nn2fpFPQ3_2nn2fp8GameModePCUiUib"); + asm("SetInvitationParameter__Q2_2nn2fpFPQ3_2nn2fp8GameModePCUiUib"); nn::Result -SetLedEventMask(uint32_t) - asm("SetLedEventMask__Q2_2nn2fpFUi"); + SetLedEventMask(uint32_t) + asm("SetLedEventMask__Q2_2nn2fpFUi"); nn::Result SetNotificationHandler(uint32_t /*notificationFlags = 1 << NotificationType */, NotificationHandlerFn, void *) - asm("SetNotificationHandler__Q2_2nn2fpFUiPFQ3_2nn2fp16NotificationTypeUiPv_vPv"); + asm("SetNotificationHandler__Q2_2nn2fpFUiPFQ3_2nn2fp16NotificationTypeUiPv_vPv"); nn::Result UnlockParentalControlTemporarily(const char pinCode[5]) - asm("UnlockParentalControlTemporarily__Q2_2nn2fpFPCc"); + asm("UnlockParentalControlTemporarily__Q2_2nn2fpFPCc"); nn::Result UpdateCommentAsync(const char16_t *, FPAsyncCallback, void *) - asm("UpdateCommentAsync__Q2_2nn2fpFPCwPFQ2_2nn6ResultPv_vPv"); + asm("UpdateCommentAsync__Q2_2nn2fpFPCwPFQ2_2nn6ResultPv_vPv"); nn::Result UpdateGameModeDescription(const char16_t *description) - asm("UpdateGameModeDescription__Q2_2nn2fpFPCw"); + asm("UpdateGameModeDescription__Q2_2nn2fpFPCw"); nn::Result UpdateGameModeEx(nn::fp::GameMode *, const char16_t *) - asm("UpdateGameModeEx__Q2_2nn2fpFPCQ3_2nn2fp8GameModePCw"); + asm("UpdateGameModeEx__Q2_2nn2fpFPCQ3_2nn2fp8GameModePCw"); nn::Result UpdateGameModeForOverlayApplication(nn::fp::GameMode *, const char16_t *) - asm("UpdateGameModeForOverlayApplication__Q2_2nn2fpFPCQ3_2nn2fp8GameModePCw"); + asm("UpdateGameModeForOverlayApplication__Q2_2nn2fpFPCQ3_2nn2fp8GameModePCw"); nn::Result UpdateGameMode(nn::fp::GameMode *, const char16_t *) - asm("UpdateGameMode__Q2_2nn2fpFPCQ3_2nn2fp8GameModePCw"); + asm("UpdateGameMode__Q2_2nn2fpFPCQ3_2nn2fp8GameModePCw"); nn::Result UpdateGameMode(nn::fp::GameMode *, const char16_t *, unsigned int) - asm("UpdateGameMode__Q2_2nn2fpFPCQ3_2nn2fp8GameModePCwUi"); + asm("UpdateGameMode__Q2_2nn2fpFPCQ3_2nn2fp8GameModePCwUi"); nn::Result UpdateMiiAsync(FFLStoreData *, char16_t *, FPAsyncCallback, void *) - asm("UpdateMiiAsync__Q2_2nn2fpFPC12FFLStoreDataPCwPFQ2_2nn6ResultPv_vPv"); + asm("UpdateMiiAsync__Q2_2nn2fpFPC12FFLStoreDataPCwPFQ2_2nn6ResultPv_vPv"); nn::Result UpdateMiiAsync(FFLStoreData *miiData, FPAsyncCallback, void *) - asm("UpdateMiiAsync__Q2_2nn2fpFPC12FFLStoreDataPFQ2_2nn6ResultPv_vPv"); + asm("UpdateMiiAsync__Q2_2nn2fpFPC12FFLStoreDataPFQ2_2nn6ResultPv_vPv"); nn::Result UpdatePlayingGame(nn::fp::GameKey *, unsigned int) - asm("UpdatePlayingGame__Q2_2nn2fpFPCQ3_2nn2fp7GameKeyUi"); + asm("UpdatePlayingGame__Q2_2nn2fpFPCQ3_2nn2fp7GameKeyUi"); nn::Result UpdatePlayingOverlayApplication(nn::fp::GameKey *, unsigned int) - asm("UpdatePlayingOverlayApplication__Q2_2nn2fpFPCQ3_2nn2fp7GameKeyUi"); + asm("UpdatePlayingOverlayApplication__Q2_2nn2fpFPCQ3_2nn2fp7GameKeyUi"); nn::Result UpdatePreferenceAsync(nn::fp::Preference *, FPAsyncCallback, void *) - asm("UpdatePreferenceAsync__Q2_2nn2fpFPCQ3_2nn2fp10PreferencePFQ2_2nn6ResultPv_vPv"); + asm("UpdatePreferenceAsync__Q2_2nn2fpFPCQ3_2nn2fp10PreferencePFQ2_2nn6ResultPv_vPv"); } // namespace fp } // namespace nn diff --git a/include/nn/hpad/hpad.h b/include/nn/hpad/hpad.h index 9dfc60109..2b723079b 100644 --- a/include/nn/hpad/hpad.h +++ b/include/nn/hpad/hpad.h @@ -13,17 +13,17 @@ extern "C" { #endif //! The minimum value of the stick axis -#define HPAD_STICK_AXIS_MIN -56 +#define HPAD_STICK_AXIS_MIN -56 //! The maximum value of the stick axis -#define HPAD_STICK_AXIS_MAX 56 +#define HPAD_STICK_AXIS_MAX 56 //! The minimum value of the substick axis #define HPAD_SUBSTICK_AXIS_MIN -44 //! The maximum value of the substick axis -#define HPAD_SUBSTICK_AXIS_MAX 44 +#define HPAD_SUBSTICK_AXIS_MAX 44 //! The minimum value of the trigger -#define HPAD_TRIGGER_MIN 0 +#define HPAD_TRIGGER_MIN 0 //! The maximum value of the trigger -#define HPAD_TRIGGER_MAX 150 +#define HPAD_TRIGGER_MAX 150 typedef struct HPADStatus HPADStatus; typedef struct HPADGGGGStatus HPADGGGGStatus; @@ -50,18 +50,18 @@ typedef enum HPADGGGGChan typedef enum HPADButtons { - HPAD_BUTTON_A = 0x0001, - HPAD_BUTTON_B = 0x0002, - HPAD_BUTTON_X = 0x0004, - HPAD_BUTTON_Y = 0x0008, - HPAD_BUTTON_LEFT = 0x0010, - HPAD_BUTTON_RIGHT = 0x0020, - HPAD_BUTTON_DOWN = 0x0040, - HPAD_BUTTON_UP = 0x0080, - HPAD_BUTTON_START = 0x0100, - HPAD_TRIGGER_Z = 0x0200, - HPAD_TRIGGER_R = 0x0400, - HPAD_TRIGGER_L = 0x0800, + HPAD_BUTTON_A = 0x0001, + HPAD_BUTTON_B = 0x0002, + HPAD_BUTTON_X = 0x0004, + HPAD_BUTTON_Y = 0x0008, + HPAD_BUTTON_LEFT = 0x0010, + HPAD_BUTTON_RIGHT = 0x0020, + HPAD_BUTTON_DOWN = 0x0040, + HPAD_BUTTON_UP = 0x0080, + HPAD_BUTTON_START = 0x0100, + HPAD_TRIGGER_Z = 0x0200, + HPAD_TRIGGER_R = 0x0400, + HPAD_TRIGGER_L = 0x0800, HPAD_STICK_EMULATION_LEFT = 0x00001000, HPAD_STICK_EMULATION_RIGHT = 0x00002000, diff --git a/include/nn/idb.h b/include/nn/idb.h index 920bace3e..97f4abcfa 100644 --- a/include/nn/idb.h +++ b/include/nn/idb.h @@ -4,5 +4,5 @@ * \defgroup nn_idb nn_idb */ -#include #include +#include diff --git a/include/nn/nfp.h b/include/nn/nfp.h index 580da5f62..c7e14f3d5 100644 --- a/include/nn/nfp.h +++ b/include/nn/nfp.h @@ -5,5 +5,5 @@ * Nintendo Figurine (amiibo) Platform library. */ -#include #include +#include diff --git a/include/nn/nfp/amiibo_settings_cpp.h b/include/nn/nfp/amiibo_settings_cpp.h index 15a8dd992..e3fe6f142 100644 --- a/include/nn/nfp/amiibo_settings_cpp.h +++ b/include/nn/nfp/amiibo_settings_cpp.h @@ -12,18 +12,20 @@ #ifdef __cplusplus -namespace nn { +namespace nn +{ -namespace nfp { +namespace nfp +{ enum class AmiiboSettingsMode : uint32_t { //! Open the Mii and Name register menu - Register = 0, + Register = 0, //! Open the "Delete Game Data" menu - DeleteGameData = 1, + DeleteGameData = 1, //! Open the "Restore" menu - Restore = 2, + Restore = 2, }; WUT_CHECK_SIZE(AmiiboSettingsMode, 0x4); diff --git a/include/nn/nfp/nfp_cpp.h b/include/nn/nfp/nfp_cpp.h index c55820df9..a3afa8ff0 100644 --- a/include/nn/nfp/nfp_cpp.h +++ b/include/nn/nfp/nfp_cpp.h @@ -1,9 +1,9 @@ #pragma once #include -#include -#include #include #include +#include +#include /** * \defgroup nn_nfp @@ -14,61 +14,63 @@ #ifdef __cplusplus -namespace nn { +namespace nn +{ -namespace nfp { +namespace nfp +{ //! NN_NFP result descriptions for \link nn::Result::GetDescription \endlink. -enum ResultDescription +enum ResultDescription { // Usage results - RESULT_OUT_OF_RANGE = 0x03700, - RESULT_INVALID_PARAM = 0x03780, - RESULT_INVALID_ALIGNMENT = 0x03800, + RESULT_OUT_OF_RANGE = 0x03700, + RESULT_INVALID_PARAM = 0x03780, + RESULT_INVALID_ALIGNMENT = 0x03800, // Status results - RESULT_INVALID_STATE = 0x06400, - RESULT_INVALID_TAG = 0x0c800, - RESULT_INVALID_TAG_INFO = 0x0ca80, - RESULT_NO_BACKUPENTRY = 0x0e580, - RESULT_NO_REGISTER_INFO = 0x10900, - RESULT_APP_AREA_MISSING = 0x10400, - RESULT_APP_AREA_TAGID_MISMATCH = 0x11d00, - RESULT_APP_AREA_ALREADY_EXISTS = 0x10e00, - RESULT_APP_AREA_ACCESS_ID_MISMATCH = 0x11300, - RESULT_NO_BACKUP_SAVEDATA = 0x38880, - RESULT_SYSTEM_ERROR = 0x3e880, + RESULT_INVALID_STATE = 0x06400, + RESULT_INVALID_TAG = 0x0c800, + RESULT_INVALID_TAG_INFO = 0x0ca80, + RESULT_NO_BACKUPENTRY = 0x0e580, + RESULT_NO_REGISTER_INFO = 0x10900, + RESULT_APP_AREA_MISSING = 0x10400, + RESULT_APP_AREA_TAGID_MISMATCH = 0x11d00, + RESULT_APP_AREA_ALREADY_EXISTS = 0x10e00, + RESULT_APP_AREA_ACCESS_ID_MISMATCH = 0x11300, + RESULT_NO_BACKUP_SAVEDATA = 0x38880, + RESULT_SYSTEM_ERROR = 0x3e880, // Fatal results - RESULT_FATAL = 0x5db00, + RESULT_FATAL = 0x5db00, }; enum class NfpState : uint32_t { //! nn_nfp is uninitialized - Uninitialized = 0, + Uninitialized = 0, //! nn_nfp has been initialized - Initialized = 1, + Initialized = 1, //! Searching for a tag - Searching = 2, + Searching = 2, //! A tag has been found - Found = 3, + Found = 3, //! Tag was removed - Removed = 4, + Removed = 4, //! The tag is mounted - Mounted = 5, - Unknown6 = 6, + Mounted = 5, + Unknown6 = 6, //! The tag was mounted in ROM mode - MountedROM = 7, + MountedROM = 7, }; WUT_CHECK_SIZE(NfpState, 0x4); enum class AdminFlags : uint8_t { - //! The tag was registered and contains register info - IsRegistered = 1 << 0, + //! The tag was registered and contains register info + IsRegistered = 1 << 0, //! The tag contains an application area - HasApplicationData = 1 << 1, + HasApplicationData = 1 << 1, }; WUT_CHECK_SIZE(AdminFlags, 0x1); @@ -101,7 +103,7 @@ struct ApplicationAreaCreateInfo //! The access ID with which the area should be created uint32_t accessID; //! The initial data to write to the area - void* data; + void *data; //! The size of the data uint32_t size; //! reserved bytes, must be set to 0 diff --git a/include/nn/pdm/pdm_cpp.h b/include/nn/pdm/pdm_cpp.h index 5df326257..26439390f 100644 --- a/include/nn/pdm/pdm_cpp.h +++ b/include/nn/pdm/pdm_cpp.h @@ -10,19 +10,21 @@ #ifdef __cplusplus -namespace nn { +namespace nn +{ -namespace pdm { +namespace pdm +{ //! Flags for PlayDiary typedef enum PlayDiaryFlags : uint16_t { - PLAYDIARY_FLAG_DEFAULT = 0x0000, + PLAYDIARY_FLAG_DEFAULT = 0x0000, //! Set when the user played in Wii Mode //! Note: Title Id should be ffff ffff ffff ffff when set - PLAYDIARY_FLAG_PLAYED_IN_WII_MODE = 0x0100, - PLAYDIARY_FLAG_UNKNOWN_0A00 = 0x0a00 + PLAYDIARY_FLAG_PLAYED_IN_WII_MODE = 0x0100, + PLAYDIARY_FLAG_UNKNOWN_0A00 = 0x0a00 } PlayDiaryFlags; WUT_CHECK_SIZE(PlayDiaryFlags, 0x02); @@ -54,11 +56,11 @@ struct WUT_PACKED PlayStats uint16_t times_played; //! Date when the title was first played in days since 01/01/2000 uint16_t first_time_played; - //! Date when the title was last played in days since 01/01/2000 + //! Date when the title was last played in days since 01/01/2000 uint16_t last_time_played; //! Unknown seems to be always 0x0000 - WUT_UNKNOWN_BYTES(2); + WUT_UNKNOWN_BYTES(2); }; WUT_CHECK_OFFSET(PlayStats, 0x00, title_id); WUT_CHECK_OFFSET(PlayStats, 0x08, playtime); @@ -89,21 +91,21 @@ WUT_CHECK_OFFSET(PlayLog, 0x00, title_id); * \return * 0 on success. */ -uint32_t +uint32_t Initialize() asm("Initialize__Q2_2nn3pdmFv"); /** * Finalize PDM. */ -void +void Finalize() asm("Finalize__Q2_2nn3pdmFv"); /** * Close all opened PDM Files. */ -void +void CloseAllFiles() asm("CloseAllFiles__Q2_2nn3pdmFv"); @@ -123,7 +125,7 @@ Convert(uint32_t userId) * \return * 0 on success. */ -uint32_t +uint32_t WaitForConvertDone() asm("WaitForConvertDone__Q2_2nn3pdmFv"); @@ -138,7 +140,7 @@ WaitForConvertDone() * 0 on success. */ uint32_t -GetPlayDiaryMaxLength(uint32_t* outMaxLength) +GetPlayDiaryMaxLength(uint32_t *outMaxLength) asm("GetPlayDiaryMaxLength__Q2_2nn3pdmFPi"); /** @@ -154,7 +156,7 @@ GetPlayDiaryMaxLength(uint32_t* outMaxLength) * 0 on success. */ uint32_t -GetPlayDiaryLength(uint32_t* outLength, uint32_t userId) +GetPlayDiaryLength(uint32_t *outLength, uint32_t userId) asm("GetPlayDiaryLength__Q2_2nn3pdmFPii"); /** @@ -170,7 +172,7 @@ GetPlayDiaryLength(uint32_t* outLength, uint32_t userId) * 0 on success. */ uint32_t -GetPlayDiaryStart(uint32_t* outStart, uint32_t userId) +GetPlayDiaryStart(uint32_t *outStart, uint32_t userId) asm("GetPlayDiaryStart__Q2_2nn3pdmFPii"); /** @@ -195,7 +197,7 @@ GetPlayDiaryStart(uint32_t* outStart, uint32_t userId) * 0 on success. */ uint32_t -GetPlayDiary(uint32_t* outAmount, PlayDiary* outPlayDiaries, uint32_t userId, uint32_t amount) +GetPlayDiary(uint32_t *outAmount, PlayDiary *outPlayDiaries, uint32_t userId, uint32_t amount) asm("GetPlayDiary__Q2_2nn3pdmFPiPQ3_2nn3pdm9PlayDiaryiT3"); /** @@ -217,7 +219,7 @@ GetPlayDiary(uint32_t* outAmount, PlayDiary* outPlayDiaries, uint32_t userId, ui * May be smaller than the amount passed to the function. */ uint32_t -GetPlayDiary(PlayDiary* outPlayDiaries, uint32_t userId, uint32_t amount) +GetPlayDiary(PlayDiary *outPlayDiaries, uint32_t userId, uint32_t amount) asm("GetPlayDiary__Q2_2nn3pdmFPQ3_2nn3pdm9PlayDiaryiT2"); /** @@ -231,7 +233,7 @@ GetPlayDiary(PlayDiary* outPlayDiaries, uint32_t userId, uint32_t amount) * 0 on success. */ uint32_t -GetPlayEventMaxLength(uint32_t* outMaxLength) +GetPlayEventMaxLength(uint32_t *outMaxLength) asm("GetPlayEventMaxLength__Q2_2nn3pdmFPi"); /** @@ -256,7 +258,7 @@ GetPlayEventMaxLength(uint32_t* outMaxLength) * 0 on success. */ uint32_t -GetPlayEvent(uint32_t* outAmount, PlayEvent* outPlayEvents, uint32_t userId, uint32_t amount) +GetPlayEvent(uint32_t *outAmount, PlayEvent *outPlayEvents, uint32_t userId, uint32_t amount) asm("GetPlayEvent__Q2_2nn3pdmFPiPQ3_2nn3pdm9PlayEventiT3"); /** @@ -270,7 +272,7 @@ GetPlayEvent(uint32_t* outAmount, PlayEvent* outPlayEvents, uint32_t userId, uin * 0 on success. */ uint32_t -GetPlayLogMaxLength(uint32_t* outMaxLength) +GetPlayLogMaxLength(uint32_t *outMaxLength) asm("GetPlayLogMaxLength__Q2_2nn3pdmFPi"); /** @@ -286,7 +288,7 @@ GetPlayLogMaxLength(uint32_t* outMaxLength) * 0 on success. */ uint32_t -GetPlayLogLength(uint32_t* outLength, uint32_t userId) +GetPlayLogLength(uint32_t *outLength, uint32_t userId) asm("GetPlayLogLength__Q2_2nn3pdmFPii"); /** @@ -302,7 +304,7 @@ GetPlayLogLength(uint32_t* outLength, uint32_t userId) * 0 on success. */ uint32_t -GetPlayLogStart(uint32_t* outStart, uint32_t userId) +GetPlayLogStart(uint32_t *outStart, uint32_t userId) asm("GetPlayLogStart__Q2_2nn3pdmFPii"); /** @@ -327,7 +329,7 @@ GetPlayLogStart(uint32_t* outStart, uint32_t userId) * 0 on success. */ uint32_t -GetPlayLog(uint32_t* outAmount, PlayLog* outPlayLogs, uint32_t userId, uint32_t amount) +GetPlayLog(uint32_t *outAmount, PlayLog *outPlayLogs, uint32_t userId, uint32_t amount) asm("GetPlayLog__Q2_2nn3pdmFPiPQ3_2nn3pdm7PlayLogiT3"); /** @@ -349,7 +351,7 @@ GetPlayLog(uint32_t* outAmount, PlayLog* outPlayLogs, uint32_t userId, uint32_t * May be smaller than the amount passed to the function. */ uint32_t -GetPlayLog(PlayLog* outPlayLogs, uint32_t userId, uint32_t amount) +GetPlayLog(PlayLog *outPlayLogs, uint32_t userId, uint32_t amount) asm("GetPlayLog__Q2_2nn3pdmFPQ3_2nn3pdm7PlayLogiT2"); /** @@ -363,7 +365,7 @@ GetPlayLog(PlayLog* outPlayLogs, uint32_t userId, uint32_t amount) * 0 on success. */ uint32_t -GetPlayStatsMaxLength(uint32_t* outMaxLength) +GetPlayStatsMaxLength(uint32_t *outMaxLength) asm("GetPlayStatsMaxLength__Q2_2nn3pdmFPi"); /** @@ -379,7 +381,7 @@ GetPlayStatsMaxLength(uint32_t* outMaxLength) * 0 on success. */ uint32_t -GetPlayStatsLength(uint32_t* outLength, uint32_t userId) +GetPlayStatsLength(uint32_t *outLength, uint32_t userId) asm("GetPlayStatsLength__Q2_2nn3pdmFPii"); /** @@ -399,7 +401,7 @@ GetPlayStatsLength(uint32_t* outLength, uint32_t userId) * 0 on success */ uint32_t -GetPlayStatsOfTitleId(PlayStats* outPlayStats, uint32_t userId, uint64_t titleId) +GetPlayStatsOfTitleId(PlayStats *outPlayStats, uint32_t userId, uint64_t titleId) asm("GetPlayStatsOfTitleId__Q2_2nn3pdmFPQ3_2nn3pdm9PlayStatsiUL"); /** @@ -424,7 +426,7 @@ GetPlayStatsOfTitleId(PlayStats* outPlayStats, uint32_t userId, uint64_t titleId * 0 on success. */ uint32_t -GetPlayStats(uint32_t* outAmount, PlayStats* outPlayStats, uint32_t userId, uint32_t amount) +GetPlayStats(uint32_t *outAmount, PlayStats *outPlayStats, uint32_t userId, uint32_t amount) asm("GetPlayStats__Q2_2nn3pdmFPiPQ3_2nn3pdm9PlayStatsiT3"); /** @@ -446,14 +448,14 @@ GetPlayStats(uint32_t* outAmount, PlayStats* outPlayStats, uint32_t userId, uint * May be smaller than the amount passed to the function. */ uint32_t -GetPlayStats(PlayStats* outPlayStats, uint32_t userId, uint32_t amount) +GetPlayStats(PlayStats *outPlayStats, uint32_t userId, uint32_t amount) asm("GetPlayStats__Q2_2nn3pdmFPQ3_2nn3pdm9PlayStatsiT2"); -void +void NotifySetTimeBeginEvent() asm("NotifySetTimeBeginEvent__Q2_2nn3pdmFv"); -void +void NotifySetTimeEndEvent() asm("NotifySetTimeEndEvent__Q2_2nn3pdmFv"); diff --git a/include/nn/result.h b/include/nn/result.h index a1d2deedf..fc32595c1 100644 --- a/include/nn/result.h +++ b/include/nn/result.h @@ -34,7 +34,8 @@ struct NNResult * \sa * - \link NNResult_IsFailure \endlink */ -static inline int NNResult_IsSuccess(NNResult result) +static inline int +NNResult_IsSuccess(NNResult result) { return result.value >= 0; } @@ -51,7 +52,8 @@ static inline int NNResult_IsSuccess(NNResult result) * \sa * - \link NNResult_IsSuccess \endlink */ -static inline int NNResult_IsFailure(NNResult result) +static inline int +NNResult_IsFailure(NNResult result) { return result.value < 0; } @@ -69,162 +71,162 @@ class Result public: enum Level { - LEVEL_SUCCESS = 0, - LEVEL_FATAL = -1, - LEVEL_USAGE = -2, - LEVEL_STATUS = -3, - LEVEL_END = -7, + LEVEL_SUCCESS = 0, + LEVEL_FATAL = -1, + LEVEL_USAGE = -2, + LEVEL_STATUS = -3, + LEVEL_END = -7, }; enum LegacyLevel { - LEVEL_INFO = 1, - LEVEL_RESET = -4, - LEVEL_REINIT = -5, - LEVEL_PERMANENT = -6, - LEVEL_TEMPORARY = -7, + LEVEL_INFO = 1, + LEVEL_RESET = -4, + LEVEL_REINIT = -5, + LEVEL_PERMANENT = -6, + LEVEL_TEMPORARY = -7, }; enum Module { - RESULT_MODULE_COMMON = 0, - RESULT_MODULE_NN_IPC = 1, - RESULT_MODULE_NN_BOSS = 2, - RESULT_MODULE_NN_ACP = 3, - RESULT_MODULE_NN_IOS = 4, - RESULT_MODULE_NN_NIM = 5, - RESULT_MODULE_NN_PDM = 6, - RESULT_MODULE_NN_ACT = 7, - RESULT_MODULE_NN_NGC = 8, - RESULT_MODULE_NN_ECA = 9, - RESULT_MODULE_NN_NUP = 10, - RESULT_MODULE_NN_NDM = 11, - RESULT_MODULE_NN_FP = 12, - RESULT_MODULE_NN_AC = 13, - RESULT_MODULE_NN_CONNTEST = 14, - RESULT_MODULE_NN_DRMAPP = 15, - RESULT_MODULE_NN_TELNET = 16, - RESULT_MODULE_NN_OLV = 17, - RESULT_MODULE_NN_VCTL = 18, - RESULT_MODULE_NN_NEIA = 19, - RESULT_MODULE_NN_SPM = 20, - RESULT_MODULE_NN_EMD = 21, - RESULT_MODULE_NN_EC = 22, - RESULT_MODULE_NN_CIA = 23, - RESULT_MODULE_NN_SL = 24, - RESULT_MODULE_NN_ECO = 25, - RESULT_MODULE_NN_TRIAL = 26, - RESULT_MODULE_NN_NFP = 27, - RESULT_MODULE_NN_TEST = 125, + RESULT_MODULE_COMMON = 0, + RESULT_MODULE_NN_IPC = 1, + RESULT_MODULE_NN_BOSS = 2, + RESULT_MODULE_NN_ACP = 3, + RESULT_MODULE_NN_IOS = 4, + RESULT_MODULE_NN_NIM = 5, + RESULT_MODULE_NN_PDM = 6, + RESULT_MODULE_NN_ACT = 7, + RESULT_MODULE_NN_NGC = 8, + RESULT_MODULE_NN_ECA = 9, + RESULT_MODULE_NN_NUP = 10, + RESULT_MODULE_NN_NDM = 11, + RESULT_MODULE_NN_FP = 12, + RESULT_MODULE_NN_AC = 13, + RESULT_MODULE_NN_CONNTEST = 14, + RESULT_MODULE_NN_DRMAPP = 15, + RESULT_MODULE_NN_TELNET = 16, + RESULT_MODULE_NN_OLV = 17, + RESULT_MODULE_NN_VCTL = 18, + RESULT_MODULE_NN_NEIA = 19, + RESULT_MODULE_NN_SPM = 20, + RESULT_MODULE_NN_EMD = 21, + RESULT_MODULE_NN_EC = 22, + RESULT_MODULE_NN_CIA = 23, + RESULT_MODULE_NN_SL = 24, + RESULT_MODULE_NN_ECO = 25, + RESULT_MODULE_NN_TRIAL = 26, + RESULT_MODULE_NN_NFP = 27, + RESULT_MODULE_NN_TEST = 125, }; enum LegacyModule { - MODULE_COMMON = 0, - MODULE_NN_KERNEL = 1, - MODULE_NN_UTIL = 2, - MODULE_NN_FILE_SERVER = 3, - MODULE_NN_LOADER_SERVER = 4, - MODULE_NN_TCB = 5, - MODULE_NN_OS = 6, - MODULE_NN_DBG = 7, - MODULE_NN_DMNT = 8, - MODULE_NN_PDN = 9, - MODULE_NN_GX = 0xA, - MODULE_NN_I2C = 0xB, - MODULE_NN_GPIO = 0xC, - MODULE_NN_DD = 0xD, - MODULE_NN_CODEC = 0xE, - MODULE_NN_SPI = 0xF, - MODULE_NN_PXI = 0x10, - MODULE_NN_FS = 0x11, - MODULE_NN_DI = 0x12, - MODULE_NN_HID = 0x13, - MODULE_NN_CAMERA = 0x14, - MODULE_NN_PI = 0x15, - MODULE_NN_PM = 0x16, - MODULE_NN_PMLOW = 0x17, - MODULE_NN_FSI = 0x18, - MODULE_NN_SRV = 0x19, - MODULE_NN_NDM = 0x1A, - MODULE_NN_NWM = 0x1B, - MODULE_NN_SOCKET = 0x1C, - MODULE_NN_LDR = 0x1D, - MODULE_NN_ACC = 0x1E, - MODULE_NN_ROMFS = 0x1F, - MODULE_NN_AM = 0x20, - MODULE_NN_HIO = 0x21, - MODULE_NN_UPDATER = 0x22, - MODULE_NN_MIC = 0x23, - MODULE_NN_FND = 0x24, - MODULE_NN_MP = 0x25, - MODULE_NN_MPWL = 0x26, - MODULE_NN_AC = 0x27, - MODULE_NN_HTTP = 0x28, - MODULE_NN_DSP = 0x29, - MODULE_NN_SND = 0x2A, - MODULE_NN_DLP = 0x2B, - MODULE_NN_HIOLOW = 0x2C, - MODULE_NN_CSND = 0x2D, - MODULE_NN_SSL = 0x2E, - MODULE_NN_AMLOW = 0x2F, - MODULE_NN_NEX = 0x30, - MODULE_NN_FRIENDS = 0x31, - MODULE_NN_RDT = 0x32, - MODULE_NN_APPLET = 0x33, - MODULE_NN_NIM = 0x34, - MODULE_NN_PTM = 0x35, - MODULE_NN_MIDI = 0x36, - MODULE_NN_MC = 0x37, - MODULE_NN_SWC = 0x38, - MODULE_NN_FATFS = 0x39, - MODULE_NN_NGC = 0x3A, - MODULE_NN_CARD = 0x3B, - MODULE_NN_CARDNOR = 0x3C, - MODULE_NN_SDMC = 0x3D, - MODULE_NN_BOSS = 0x3E, - MODULE_NN_DBM = 0x3F, - MODULE_NN_CFG = 0x40, - MODULE_NN_PS = 0x41, - MODULE_NN_CEC = 0x42, - MODULE_NN_IR = 0x43, - MODULE_NN_UDS = 0x44, - MODULE_NN_PL = 0x45, - MODULE_NN_CUP = 0x46, - MODULE_NN_GYROSCOPE = 0x47, - MODULE_NN_MCU = 0x48, - MODULE_NN_NS = 0x49, - MODULE_NN_NEWS = 0x4A, - MODULE_NN_RO = 0x4B, - MODULE_NN_GD = 0x4C, - MODULE_NN_CARDSPI = 0x4D, - MODULE_NN_EC = 0x4E, - MODULE_NN_WEBBRS = 0x4F, - MODULE_NN_TEST = 0x50, - MODULE_NN_ENC = 0x51, - MODULE_NN_PIA = 0x52, - MODULE_APPLICATION = 0x1FE, + MODULE_COMMON = 0, + MODULE_NN_KERNEL = 1, + MODULE_NN_UTIL = 2, + MODULE_NN_FILE_SERVER = 3, + MODULE_NN_LOADER_SERVER = 4, + MODULE_NN_TCB = 5, + MODULE_NN_OS = 6, + MODULE_NN_DBG = 7, + MODULE_NN_DMNT = 8, + MODULE_NN_PDN = 9, + MODULE_NN_GX = 0xA, + MODULE_NN_I2C = 0xB, + MODULE_NN_GPIO = 0xC, + MODULE_NN_DD = 0xD, + MODULE_NN_CODEC = 0xE, + MODULE_NN_SPI = 0xF, + MODULE_NN_PXI = 0x10, + MODULE_NN_FS = 0x11, + MODULE_NN_DI = 0x12, + MODULE_NN_HID = 0x13, + MODULE_NN_CAMERA = 0x14, + MODULE_NN_PI = 0x15, + MODULE_NN_PM = 0x16, + MODULE_NN_PMLOW = 0x17, + MODULE_NN_FSI = 0x18, + MODULE_NN_SRV = 0x19, + MODULE_NN_NDM = 0x1A, + MODULE_NN_NWM = 0x1B, + MODULE_NN_SOCKET = 0x1C, + MODULE_NN_LDR = 0x1D, + MODULE_NN_ACC = 0x1E, + MODULE_NN_ROMFS = 0x1F, + MODULE_NN_AM = 0x20, + MODULE_NN_HIO = 0x21, + MODULE_NN_UPDATER = 0x22, + MODULE_NN_MIC = 0x23, + MODULE_NN_FND = 0x24, + MODULE_NN_MP = 0x25, + MODULE_NN_MPWL = 0x26, + MODULE_NN_AC = 0x27, + MODULE_NN_HTTP = 0x28, + MODULE_NN_DSP = 0x29, + MODULE_NN_SND = 0x2A, + MODULE_NN_DLP = 0x2B, + MODULE_NN_HIOLOW = 0x2C, + MODULE_NN_CSND = 0x2D, + MODULE_NN_SSL = 0x2E, + MODULE_NN_AMLOW = 0x2F, + MODULE_NN_NEX = 0x30, + MODULE_NN_FRIENDS = 0x31, + MODULE_NN_RDT = 0x32, + MODULE_NN_APPLET = 0x33, + MODULE_NN_NIM = 0x34, + MODULE_NN_PTM = 0x35, + MODULE_NN_MIDI = 0x36, + MODULE_NN_MC = 0x37, + MODULE_NN_SWC = 0x38, + MODULE_NN_FATFS = 0x39, + MODULE_NN_NGC = 0x3A, + MODULE_NN_CARD = 0x3B, + MODULE_NN_CARDNOR = 0x3C, + MODULE_NN_SDMC = 0x3D, + MODULE_NN_BOSS = 0x3E, + MODULE_NN_DBM = 0x3F, + MODULE_NN_CFG = 0x40, + MODULE_NN_PS = 0x41, + MODULE_NN_CEC = 0x42, + MODULE_NN_IR = 0x43, + MODULE_NN_UDS = 0x44, + MODULE_NN_PL = 0x45, + MODULE_NN_CUP = 0x46, + MODULE_NN_GYROSCOPE = 0x47, + MODULE_NN_MCU = 0x48, + MODULE_NN_NS = 0x49, + MODULE_NN_NEWS = 0x4A, + MODULE_NN_RO = 0x4B, + MODULE_NN_GD = 0x4C, + MODULE_NN_CARDSPI = 0x4D, + MODULE_NN_EC = 0x4E, + MODULE_NN_WEBBRS = 0x4F, + MODULE_NN_TEST = 0x50, + MODULE_NN_ENC = 0x51, + MODULE_NN_PIA = 0x52, + MODULE_APPLICATION = 0x1FE, }; enum LegacySummary { - SUMMARY_SUCCESS = 0, - SUMMARY_NOTHING_HAPPENED = 1, - SUMMARY_WOULD_BLOCK = 2, - SUMMARY_OUT_OF_RESOURCE = 3, - SUMMARY_NOT_FOUND = 4, - SUMMARY_INVALID_STATE = 5, - SUMMARY_NOT_SUPPORTED = 6, - SUMMARY_INVALID_ARGUMENT = 7, - SUMMARY_WRONG_ARGUMENT = 8, - SUMMARY_CANCELLED = 9, - SUMMARY_STATUS_CHANGED = 10, - SUMMARY_INTERNAL = 11, + SUMMARY_SUCCESS = 0, + SUMMARY_NOTHING_HAPPENED = 1, + SUMMARY_WOULD_BLOCK = 2, + SUMMARY_OUT_OF_RESOURCE = 3, + SUMMARY_NOT_FOUND = 4, + SUMMARY_INVALID_STATE = 5, + SUMMARY_NOT_SUPPORTED = 6, + SUMMARY_INVALID_ARGUMENT = 7, + SUMMARY_WRONG_ARGUMENT = 8, + SUMMARY_CANCELLED = 9, + SUMMARY_STATUS_CHANGED = 10, + SUMMARY_INTERNAL = 11, }; enum LegacySignature { - SIGNATURE_IS_LEGACY = 3, + SIGNATURE_IS_LEGACY = 3, }; public: @@ -252,7 +254,8 @@ class Result * \sa * - \link IsSuccess \endlink */ - bool IsFailure() const + bool + IsFailure() const { return !IsSuccess(); } @@ -266,22 +269,26 @@ class Result * \sa * - \link IsFailure \endlink */ - bool IsSuccess() const + bool + IsSuccess() const { return mValue >= 0; // level >= 0 } - bool IsLegacy() const + bool + IsLegacy() const { return ((mValue >> 27) & 0x3) == SIGNATURE_IS_LEGACY; } - unsigned GetDescription() const + unsigned + GetDescription() const { return mValue & (IsLegacy() ? 0x3FF : 0xFFFFF); } - int GetLevel() const + int + GetLevel() const { if (IsLegacy()) { return (mValue << 14) >> 28; // cause arithmetic shift @@ -290,12 +297,14 @@ class Result return mValue >> 29; } - unsigned GetModule() const + unsigned + GetModule() const { return (mValue >> 20) & (IsLegacy() ? 0x7F : 0x1FF); } - unsigned GetSummary() const + unsigned + GetSummary() const { if (IsLegacy()) { return (mValue >> 10) & 0xF; @@ -316,12 +325,14 @@ class Result return result; } - bool operator==(const Result &other) const + bool + operator==(const Result &other) const { return mValue == other.mValue; } - bool operator!=(const Result &other) const + bool + operator!=(const Result &other) const { return mValue != other.mValue; } diff --git a/include/nn/save/save.h b/include/nn/save/save.h index 99c6fe19b..4683cdefc 100644 --- a/include/nn/save/save.h +++ b/include/nn/save/save.h @@ -1,8 +1,8 @@ #pragma once #include -#include #include +#include #ifdef __cplusplus extern "C" { @@ -10,9 +10,9 @@ extern "C" { typedef enum SAVEStatus { - SAVE_STATUS_OK = 0, - SAVE_STATUS_NOT_FOUND = -6, - SAVE_STATUS_STORAGE_FULL = -12, + SAVE_STATUS_OK = 0, + SAVE_STATUS_NOT_FOUND = -6, + SAVE_STATUS_STORAGE_FULL = -12, } SAVEStatus; SAVEStatus diff --git a/include/nn/sl/CacheManager.h b/include/nn/sl/CacheManager.h index 4e4d911b3..a80015af5 100644 --- a/include/nn/sl/CacheManager.h +++ b/include/nn/sl/CacheManager.h @@ -1,95 +1,123 @@ #pragma once +#include #include #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - namespace details { - typedef struct WUT_PACKED CacheManagerInternal { - ISerializerInternal *quickStartTitleInfoSerializer; - ISerializerInternal *killerNotificationSerializer; - ISerializerInternal *jumpTitleInfoSerializer; - } CacheManagerInternal; - WUT_CHECK_SIZE(CacheManagerInternal, 0x0c); - WUT_CHECK_OFFSET(CacheManagerInternal, 0x00, quickStartTitleInfoSerializer); - WUT_CHECK_OFFSET(CacheManagerInternal, 0x04, killerNotificationSerializer); - WUT_CHECK_OFFSET(CacheManagerInternal, 0x08, jumpTitleInfoSerializer); - - extern "C" CacheManagerInternal *__ct__Q3_2nn2sl12CacheManagerFv(CacheManagerInternal *); - extern "C" void SetupInitialCache__Q3_2nn2sl12CacheManagerFv(CacheManagerInternal *); - extern "C" nn::Result GetKillerNotificationCache__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl18KillerNotificationPQ3_2nn2sl9TitleInfo(CacheManagerInternal *, KillerNotification *, TitleInfo *); - extern "C" nn::Result GetQuickStartCache__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl9TitleInfoi(CacheManagerInternal *, TitleInfo *, int); - extern "C" nn::Result Get__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl9TitleInfoiPQ3_2nn2sl18KillerNotificationT1(CacheManagerInternal *, TitleInfo *, int, KillerNotification *, TitleInfo *); - extern "C" nn::Result Initialize__Q3_2nn2sl12CacheManagerFRQ3_2nn2sl39ISerializer__tm__20_Q3_2nn2sl9TitleInfoRQ3_2nn2sl49ISerializer__tm__30_Q3_2nn2sl18KillerNotificationT1( - CacheManagerInternal *, - ISerializerInternal *, - ISerializerInternal *, - ISerializerInternal *); - } // namespace details - - class CacheManager { - public: - CacheManager() : mQuickStartTitleInfoSerializer(nullptr), - mKillerNotificationSerializer(nullptr), - mJumpTitleInfoSerializer(nullptr) { - if (__ct__Q3_2nn2sl12CacheManagerFv(&mInstance) != nullptr) { - mQuickStartTitleInfoSerializer = details::SerializerFromPtr(mInstance.quickStartTitleInfoSerializer); - mKillerNotificationSerializer = details::SerializerFromPtr(mInstance.killerNotificationSerializer); - mJumpTitleInfoSerializer = details::SerializerFromPtr(mInstance.jumpTitleInfoSerializer); - } - } - - [[nodiscard]] details::ISerializerBase &GetQuickStartTitleInfoSerializer() { - return mQuickStartTitleInfoSerializer; - } - - [[nodiscard]] details::ISerializerBase &GetKillerNotificationSerializer() { - return mKillerNotificationSerializer; - } - - [[nodiscard]] details::ISerializerBase &GetJumpTitleInfoSerializer() { - return mJumpTitleInfoSerializer; - } - - void SetupInitialCache() { - SetupInitialCache__Q3_2nn2sl12CacheManagerFv(&mInstance); - } - - nn::Result GetKillerNotificationCache(KillerNotification *u1, TitleInfo *u2) { - return GetKillerNotificationCache__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl18KillerNotificationPQ3_2nn2sl9TitleInfo(&mInstance, u1, u2); - } - - nn::Result GetQuickStartCache(TitleInfo *u1, int u2) { - return GetQuickStartCache__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl9TitleInfoi(&mInstance, u1, u2); - } - - nn::Result Get(TitleInfo *u1, int u2, KillerNotification *u3, TitleInfo *u4) { - return Get__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl9TitleInfoiPQ3_2nn2sl18KillerNotificationT1(&mInstance, u1, u2, u3, u4); - } - - void Initialize(details::ISerializerBase &quickStartTitleInfoSerializer, details::ISerializerBase &killerNotificationSerializer, details::ISerializerBase &jumpTitleInfoSerializer) { - Initialize__Q3_2nn2sl12CacheManagerFRQ3_2nn2sl39ISerializer__tm__20_Q3_2nn2sl9TitleInfoRQ3_2nn2sl49ISerializer__tm__30_Q3_2nn2sl18KillerNotificationT1(&mInstance, - quickStartTitleInfoSerializer.GetInternal(), - killerNotificationSerializer.GetInternal(), - jumpTitleInfoSerializer.GetInternal()); - mQuickStartTitleInfoSerializer = details::SerializerFromPtr(quickStartTitleInfoSerializer.GetInternal()); - mKillerNotificationSerializer = details::SerializerFromPtr(killerNotificationSerializer.GetInternal()); - mJumpTitleInfoSerializer = details::SerializerFromPtr(jumpTitleInfoSerializer.GetInternal()); - } - - ~CacheManager() = default; - - private: - details::CacheManagerInternal mInstance{}; - details::SerializerFromPtr mQuickStartTitleInfoSerializer; - details::SerializerFromPtr mKillerNotificationSerializer; - details::SerializerFromPtr mJumpTitleInfoSerializer; - }; +namespace nn::sl +{ +namespace details +{ +typedef struct WUT_PACKED CacheManagerInternal +{ + ISerializerInternal *quickStartTitleInfoSerializer; + ISerializerInternal *killerNotificationSerializer; + ISerializerInternal *jumpTitleInfoSerializer; +} CacheManagerInternal; +WUT_CHECK_SIZE(CacheManagerInternal, 0x0c); +WUT_CHECK_OFFSET(CacheManagerInternal, 0x00, quickStartTitleInfoSerializer); +WUT_CHECK_OFFSET(CacheManagerInternal, 0x04, killerNotificationSerializer); +WUT_CHECK_OFFSET(CacheManagerInternal, 0x08, jumpTitleInfoSerializer); + +extern "C" CacheManagerInternal * +__ct__Q3_2nn2sl12CacheManagerFv(CacheManagerInternal *); +extern "C" void +SetupInitialCache__Q3_2nn2sl12CacheManagerFv(CacheManagerInternal *); +extern "C" nn::Result +GetKillerNotificationCache__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl18KillerNotificationPQ3_2nn2sl9TitleInfo(CacheManagerInternal *, KillerNotification *, TitleInfo *); +extern "C" nn::Result +GetQuickStartCache__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl9TitleInfoi(CacheManagerInternal *, TitleInfo *, int); +extern "C" nn::Result +Get__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl9TitleInfoiPQ3_2nn2sl18KillerNotificationT1(CacheManagerInternal *, TitleInfo *, int, KillerNotification *, TitleInfo *); +extern "C" nn::Result +Initialize__Q3_2nn2sl12CacheManagerFRQ3_2nn2sl39ISerializer__tm__20_Q3_2nn2sl9TitleInfoRQ3_2nn2sl49ISerializer__tm__30_Q3_2nn2sl18KillerNotificationT1( + CacheManagerInternal *, + ISerializerInternal *, + ISerializerInternal *, + ISerializerInternal *); +} // namespace details + +class CacheManager +{ +public: + CacheManager() : + mQuickStartTitleInfoSerializer(nullptr), + mKillerNotificationSerializer(nullptr), + mJumpTitleInfoSerializer(nullptr) + { + if (__ct__Q3_2nn2sl12CacheManagerFv(&mInstance) != nullptr) { + mQuickStartTitleInfoSerializer = details::SerializerFromPtr(mInstance.quickStartTitleInfoSerializer); + mKillerNotificationSerializer = details::SerializerFromPtr(mInstance.killerNotificationSerializer); + mJumpTitleInfoSerializer = details::SerializerFromPtr(mInstance.jumpTitleInfoSerializer); + } + } + + [[nodiscard]] details::ISerializerBase & + GetQuickStartTitleInfoSerializer() + { + return mQuickStartTitleInfoSerializer; + } + + [[nodiscard]] details::ISerializerBase & + GetKillerNotificationSerializer() + { + return mKillerNotificationSerializer; + } + + [[nodiscard]] details::ISerializerBase & + GetJumpTitleInfoSerializer() + { + return mJumpTitleInfoSerializer; + } + + void + SetupInitialCache() + { + SetupInitialCache__Q3_2nn2sl12CacheManagerFv(&mInstance); + } + + nn::Result + GetKillerNotificationCache(KillerNotification *u1, TitleInfo *u2) + { + return GetKillerNotificationCache__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl18KillerNotificationPQ3_2nn2sl9TitleInfo(&mInstance, u1, u2); + } + + nn::Result + GetQuickStartCache(TitleInfo *u1, int u2) + { + return GetQuickStartCache__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl9TitleInfoi(&mInstance, u1, u2); + } + + nn::Result + Get(TitleInfo *u1, int u2, KillerNotification *u3, TitleInfo *u4) + { + return Get__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl9TitleInfoiPQ3_2nn2sl18KillerNotificationT1(&mInstance, u1, u2, u3, u4); + } + + void + Initialize(details::ISerializerBase &quickStartTitleInfoSerializer, details::ISerializerBase &killerNotificationSerializer, details::ISerializerBase &jumpTitleInfoSerializer) + { + Initialize__Q3_2nn2sl12CacheManagerFRQ3_2nn2sl39ISerializer__tm__20_Q3_2nn2sl9TitleInfoRQ3_2nn2sl49ISerializer__tm__30_Q3_2nn2sl18KillerNotificationT1(&mInstance, + quickStartTitleInfoSerializer.GetInternal(), + killerNotificationSerializer.GetInternal(), + jumpTitleInfoSerializer.GetInternal()); + mQuickStartTitleInfoSerializer = details::SerializerFromPtr(quickStartTitleInfoSerializer.GetInternal()); + mKillerNotificationSerializer = details::SerializerFromPtr(killerNotificationSerializer.GetInternal()); + mJumpTitleInfoSerializer = details::SerializerFromPtr(jumpTitleInfoSerializer.GetInternal()); + } + + ~CacheManager() = default; + +private: + details::CacheManagerInternal mInstance{}; + details::SerializerFromPtr mQuickStartTitleInfoSerializer; + details::SerializerFromPtr mKillerNotificationSerializer; + details::SerializerFromPtr mJumpTitleInfoSerializer; +}; } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/Condition.h b/include/nn/sl/Condition.h index b2e99e83c..7612ecd36 100644 --- a/include/nn/sl/Condition.h +++ b/include/nn/sl/Condition.h @@ -1,114 +1,144 @@ #pragma once +#include #include #include #include #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - namespace details { - typedef struct WUT_PACKED ConditionInternal { - ISettingAccessorInternal *settingAccessor; - IUpdatePackageAccessorInternal *updatePackageAccessor; - ISerializerInternal *previousSendingTimeSerializer; - ITimeAccessorInternal *timeAccessor; - void *vtable; - } ConditionInternal; - WUT_CHECK_SIZE(ConditionInternal, 0x14); - WUT_CHECK_OFFSET(ConditionInternal, 0x00, settingAccessor); - WUT_CHECK_OFFSET(ConditionInternal, 0x04, updatePackageAccessor); - WUT_CHECK_OFFSET(ConditionInternal, 0x08, previousSendingTimeSerializer); - WUT_CHECK_OFFSET(ConditionInternal, 0x0C, timeAccessor); - WUT_CHECK_OFFSET(ConditionInternal, 0x10, vtable); - - extern "C" ConditionInternal *__ct__Q3_2nn2sl9ConditionFv(ConditionInternal *); - extern "C" nn::Result GetEnability__Q3_2nn2sl9ConditionCFv(ConditionInternal *); - extern "C" nn::Result StoreCurrentTimeAsPreviousSendingTime__Q3_2nn2sl9ConditionCFv(ConditionInternal *); - extern "C" nn::Result NeedsUpdate__Q3_2nn2sl9ConditionCFv(ConditionInternal *); - extern "C" nn::Result GetPreviousSendingTime__Q3_2nn2sl9ConditionCFPL(ConditionInternal *, int64_t *outTime); - extern "C" void Initialize__Q3_2nn2sl9ConditionFRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl22IUpdatePackageAccessorRQ3_2nn2sl20ISerializer__tm__2_LRQ3_2nn2sl13ITimeAccessor(ConditionInternal *, - ISettingAccessorInternal *, - IUpdatePackageAccessorInternal *, - ISerializerInternal *, - ITimeAccessorInternal *); - } // namespace details - - class Condition { - public: - Condition() : mSettingAccessor(nullptr), - mUpdatePackageAccessor(nullptr), - mPreviousSendingTimeSerializer(nullptr), - mTimeAccessor(nullptr) { - if (__ct__Q3_2nn2sl9ConditionFv(&mInstance) != nullptr) { - mSettingAccessor = details::SettingAccessorFromPtr(mInstance.settingAccessor); - mUpdatePackageAccessor = details::UpdatePackageAccessorFromPtr(mInstance.updatePackageAccessor); - mPreviousSendingTimeSerializer = details::SerializerFromPtr(mInstance.previousSendingTimeSerializer); - mTimeAccessor = details::TimeAccessorFromPtr(mInstance.timeAccessor); - } - } - - ~Condition() = default; - - [[nodiscard]] details::ISettingAccessorBase &GetSettingAccessor() { - return mSettingAccessor; - } - - [[nodiscard]] details::IUpdatePackageAccessorBase &GetUpdatePackageAccessor() { - return mUpdatePackageAccessor; - } - - [[nodiscard]] details::ISerializerBase &GetPreviousSendingTimeSerializer() { - return mPreviousSendingTimeSerializer; - } - - [[nodiscard]] details::ITimeAccessorBase &GetTimeAccessor() { - return mTimeAccessor; - } - - nn::Result GetEnability() { - return GetEnability__Q3_2nn2sl9ConditionCFv(&mInstance); - } - - nn::Result NeedsUpdate() { - return NeedsUpdate__Q3_2nn2sl9ConditionCFv(&mInstance); - } - - nn::Result StoreCurrentTimeAsPreviousSendingTime() { - return StoreCurrentTimeAsPreviousSendingTime__Q3_2nn2sl9ConditionCFv(&mInstance); - } - - nn::Result GetPreviousSendingTime(int64_t *outTime) { - return GetPreviousSendingTime__Q3_2nn2sl9ConditionCFPL(&mInstance, outTime); - } - - void Initialize(details::ISettingAccessorBase &settingAccessor, - details::IUpdatePackageAccessorBase &updatePackageAccessor, - details::ISerializerBase &previousSendingTimeSerializer, - details::ITimeAccessorBase &timeAccessor) { - Initialize__Q3_2nn2sl9ConditionFRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl22IUpdatePackageAccessorRQ3_2nn2sl20ISerializer__tm__2_LRQ3_2nn2sl13ITimeAccessor( - &mInstance, - settingAccessor.GetInternal(), - updatePackageAccessor.GetInternal(), - previousSendingTimeSerializer.GetInternal(), - timeAccessor.GetInternal()); - mSettingAccessor = details::SettingAccessorFromPtr(settingAccessor.GetInternal()); - mUpdatePackageAccessor = details::UpdatePackageAccessorFromPtr(updatePackageAccessor.GetInternal()); - mPreviousSendingTimeSerializer = details::SerializerFromPtr(previousSendingTimeSerializer.GetInternal()); - mTimeAccessor = details::TimeAccessorFromPtr(timeAccessor.GetInternal()); - } - - private: - details::ConditionInternal mInstance = {}; - details::SettingAccessorFromPtr mSettingAccessor; - details::UpdatePackageAccessorFromPtr mUpdatePackageAccessor; - details::SerializerFromPtr mPreviousSendingTimeSerializer; - details::TimeAccessorFromPtr mTimeAccessor; - }; +namespace nn::sl +{ +namespace details +{ +typedef struct WUT_PACKED ConditionInternal +{ + ISettingAccessorInternal *settingAccessor; + IUpdatePackageAccessorInternal *updatePackageAccessor; + ISerializerInternal *previousSendingTimeSerializer; + ITimeAccessorInternal *timeAccessor; + void *vtable; +} ConditionInternal; +WUT_CHECK_SIZE(ConditionInternal, 0x14); +WUT_CHECK_OFFSET(ConditionInternal, 0x00, settingAccessor); +WUT_CHECK_OFFSET(ConditionInternal, 0x04, updatePackageAccessor); +WUT_CHECK_OFFSET(ConditionInternal, 0x08, previousSendingTimeSerializer); +WUT_CHECK_OFFSET(ConditionInternal, 0x0C, timeAccessor); +WUT_CHECK_OFFSET(ConditionInternal, 0x10, vtable); + +extern "C" ConditionInternal * +__ct__Q3_2nn2sl9ConditionFv(ConditionInternal *); +extern "C" nn::Result +GetEnability__Q3_2nn2sl9ConditionCFv(ConditionInternal *); +extern "C" nn::Result +StoreCurrentTimeAsPreviousSendingTime__Q3_2nn2sl9ConditionCFv(ConditionInternal *); +extern "C" nn::Result +NeedsUpdate__Q3_2nn2sl9ConditionCFv(ConditionInternal *); +extern "C" nn::Result +GetPreviousSendingTime__Q3_2nn2sl9ConditionCFPL(ConditionInternal *, int64_t *outTime); +extern "C" void +Initialize__Q3_2nn2sl9ConditionFRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl22IUpdatePackageAccessorRQ3_2nn2sl20ISerializer__tm__2_LRQ3_2nn2sl13ITimeAccessor(ConditionInternal *, + ISettingAccessorInternal *, + IUpdatePackageAccessorInternal *, + ISerializerInternal *, + ITimeAccessorInternal *); +} // namespace details + +class Condition +{ +public: + Condition() : + mSettingAccessor(nullptr), + mUpdatePackageAccessor(nullptr), + mPreviousSendingTimeSerializer(nullptr), + mTimeAccessor(nullptr) + { + if (__ct__Q3_2nn2sl9ConditionFv(&mInstance) != nullptr) { + mSettingAccessor = details::SettingAccessorFromPtr(mInstance.settingAccessor); + mUpdatePackageAccessor = details::UpdatePackageAccessorFromPtr(mInstance.updatePackageAccessor); + mPreviousSendingTimeSerializer = details::SerializerFromPtr(mInstance.previousSendingTimeSerializer); + mTimeAccessor = details::TimeAccessorFromPtr(mInstance.timeAccessor); + } + } + + ~Condition() = default; + + [[nodiscard]] details::ISettingAccessorBase & + GetSettingAccessor() + { + return mSettingAccessor; + } + + [[nodiscard]] details::IUpdatePackageAccessorBase & + GetUpdatePackageAccessor() + { + return mUpdatePackageAccessor; + } + + [[nodiscard]] details::ISerializerBase & + GetPreviousSendingTimeSerializer() + { + return mPreviousSendingTimeSerializer; + } + + [[nodiscard]] details::ITimeAccessorBase & + GetTimeAccessor() + { + return mTimeAccessor; + } + + nn::Result + GetEnability() + { + return GetEnability__Q3_2nn2sl9ConditionCFv(&mInstance); + } + + nn::Result + NeedsUpdate() + { + return NeedsUpdate__Q3_2nn2sl9ConditionCFv(&mInstance); + } + + nn::Result + StoreCurrentTimeAsPreviousSendingTime() + { + return StoreCurrentTimeAsPreviousSendingTime__Q3_2nn2sl9ConditionCFv(&mInstance); + } + + nn::Result + GetPreviousSendingTime(int64_t *outTime) + { + return GetPreviousSendingTime__Q3_2nn2sl9ConditionCFPL(&mInstance, outTime); + } + + void + Initialize(details::ISettingAccessorBase &settingAccessor, + details::IUpdatePackageAccessorBase &updatePackageAccessor, + details::ISerializerBase &previousSendingTimeSerializer, + details::ITimeAccessorBase &timeAccessor) + { + Initialize__Q3_2nn2sl9ConditionFRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl22IUpdatePackageAccessorRQ3_2nn2sl20ISerializer__tm__2_LRQ3_2nn2sl13ITimeAccessor( + &mInstance, + settingAccessor.GetInternal(), + updatePackageAccessor.GetInternal(), + previousSendingTimeSerializer.GetInternal(), + timeAccessor.GetInternal()); + mSettingAccessor = details::SettingAccessorFromPtr(settingAccessor.GetInternal()); + mUpdatePackageAccessor = details::UpdatePackageAccessorFromPtr(updatePackageAccessor.GetInternal()); + mPreviousSendingTimeSerializer = details::SerializerFromPtr(previousSendingTimeSerializer.GetInternal()); + mTimeAccessor = details::TimeAccessorFromPtr(timeAccessor.GetInternal()); + } + +private: + details::ConditionInternal mInstance = {}; + details::SettingAccessorFromPtr mSettingAccessor; + details::UpdatePackageAccessorFromPtr mUpdatePackageAccessor; + details::SerializerFromPtr mPreviousSendingTimeSerializer; + details::TimeAccessorFromPtr mTimeAccessor; +}; } // namespace nn::sl diff --git a/include/nn/sl/DataCreator.h b/include/nn/sl/DataCreator.h index c2a88b235..d7a32af63 100644 --- a/include/nn/sl/DataCreator.h +++ b/include/nn/sl/DataCreator.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -8,92 +9,122 @@ #include #include #include -#include #ifdef __cplusplus -namespace nn ::sl { - namespace details { - typedef struct WUT_PACKED DataCreatorInternal { - IIconInfoAccessorInternal *iconInfoAccessor; - IAccountInfoAccessorInternal *accountInfoAccessor; - ISettingAccessorInternal *settingInfoAccessor; - ITitleIconCacheInternal *titleIconCache; - void *vtable; - } DataCreatorInternal; - WUT_CHECK_SIZE(DataCreatorInternal, 0x14); - WUT_CHECK_OFFSET(DataCreatorInternal, 0x00, iconInfoAccessor); - WUT_CHECK_OFFSET(DataCreatorInternal, 0x04, accountInfoAccessor); - WUT_CHECK_OFFSET(DataCreatorInternal, 0x08, settingInfoAccessor); - WUT_CHECK_OFFSET(DataCreatorInternal, 0x0c, titleIconCache); - WUT_CHECK_OFFSET(DataCreatorInternal, 0x10, vtable); +namespace nn ::sl +{ +namespace details +{ +typedef struct WUT_PACKED DataCreatorInternal +{ + IIconInfoAccessorInternal *iconInfoAccessor; + IAccountInfoAccessorInternal *accountInfoAccessor; + ISettingAccessorInternal *settingInfoAccessor; + ITitleIconCacheInternal *titleIconCache; + void *vtable; +} DataCreatorInternal; +WUT_CHECK_SIZE(DataCreatorInternal, 0x14); +WUT_CHECK_OFFSET(DataCreatorInternal, 0x00, iconInfoAccessor); +WUT_CHECK_OFFSET(DataCreatorInternal, 0x04, accountInfoAccessor); +WUT_CHECK_OFFSET(DataCreatorInternal, 0x08, settingInfoAccessor); +WUT_CHECK_OFFSET(DataCreatorInternal, 0x0c, titleIconCache); +WUT_CHECK_OFFSET(DataCreatorInternal, 0x10, vtable); - extern "C" DataCreatorInternal *__ct__Q3_2nn2sl11DataCreatorFv(DataCreatorInternal *); - extern "C" nn::Result Create__Q3_2nn2sl11DataCreatorFPQ3_2nn2sl16TransferableInfoPCQ3_2nn2sl9TitleInfoiRCQ3_2nn2sl18KillerNotificationRCQ3_2nn2sl9TitleInfoRQ3_2nn2sl18LaunchInfoDatabase( - DataCreatorInternal *, TransferableInfo *, const TitleInfo *, int, const KillerNotification &, const TitleInfo &, LaunchInfoDatabase &); - extern "C" nn::Result Initialize__Q3_2nn2sl11DataCreatorFRQ3_2nn2sl17IIconInfoAccessorRQ3_2nn2sl20IAccountInfoAccessorRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl15ITitleIconCache( - DataCreatorInternal *, IIconInfoAccessorInternal *, IAccountInfoAccessorInternal *, ISettingAccessorInternal *, ITitleIconCacheInternal *); - } // namespace details +extern "C" DataCreatorInternal * +__ct__Q3_2nn2sl11DataCreatorFv(DataCreatorInternal *); +extern "C" nn::Result +Create__Q3_2nn2sl11DataCreatorFPQ3_2nn2sl16TransferableInfoPCQ3_2nn2sl9TitleInfoiRCQ3_2nn2sl18KillerNotificationRCQ3_2nn2sl9TitleInfoRQ3_2nn2sl18LaunchInfoDatabase( + DataCreatorInternal *, + TransferableInfo *, + const TitleInfo *, + int, + const KillerNotification &, + const TitleInfo &, + LaunchInfoDatabase &); +extern "C" nn::Result +Initialize__Q3_2nn2sl11DataCreatorFRQ3_2nn2sl17IIconInfoAccessorRQ3_2nn2sl20IAccountInfoAccessorRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl15ITitleIconCache( + DataCreatorInternal *, + IIconInfoAccessorInternal *, + IAccountInfoAccessorInternal *, + ISettingAccessorInternal *, + ITitleIconCacheInternal *); +} // namespace details - class DataCreator { - public: - DataCreator() : mIconInfoAccessor(nullptr), - mAccountInfoAccessor(nullptr), - mSettingAccessor(nullptr), - mTitleIconCache(nullptr) { - if (__ct__Q3_2nn2sl11DataCreatorFv(&mInstance) != nullptr) { - mIconInfoAccessor = details::IconInfoAccessorFromPtr(mInstance.iconInfoAccessor); - mAccountInfoAccessor = details::AccountInfoAccessorFromPtr(mInstance.accountInfoAccessor); - mSettingAccessor = details::SettingAccessorFromPtr(mInstance.settingInfoAccessor); - mTitleIconCache = details::TitleIconCacheFromPtr(mInstance.titleIconCache); - } - } +class DataCreator +{ +public: + DataCreator() : + mIconInfoAccessor(nullptr), + mAccountInfoAccessor(nullptr), + mSettingAccessor(nullptr), + mTitleIconCache(nullptr) + { + if (__ct__Q3_2nn2sl11DataCreatorFv(&mInstance) != nullptr) { + mIconInfoAccessor = details::IconInfoAccessorFromPtr(mInstance.iconInfoAccessor); + mAccountInfoAccessor = details::AccountInfoAccessorFromPtr(mInstance.accountInfoAccessor); + mSettingAccessor = details::SettingAccessorFromPtr(mInstance.settingInfoAccessor); + mTitleIconCache = details::TitleIconCacheFromPtr(mInstance.titleIconCache); + } + } - [[nodiscard]] details::IIconInfoAccessorBase &getIconInfoAccessor() { - return mIconInfoAccessor; - } + [[nodiscard]] details::IIconInfoAccessorBase & + getIconInfoAccessor() + { + return mIconInfoAccessor; + } - [[nodiscard]] details::IAccountInfoAccessorBase &getAccountInfoAccessor() { - return mAccountInfoAccessor; - } + [[nodiscard]] details::IAccountInfoAccessorBase & + getAccountInfoAccessor() + { + return mAccountInfoAccessor; + } - [[nodiscard]] details::ISettingAccessorBase &getSettingAccessor() { - return mSettingAccessor; - } + [[nodiscard]] details::ISettingAccessorBase & + getSettingAccessor() + { + return mSettingAccessor; + } - [[nodiscard]] details::ITitleIconCacheBase &getTitleIconCache() { - return mTitleIconCache; - } + [[nodiscard]] details::ITitleIconCacheBase & + getTitleIconCache() + { + return mTitleIconCache; + } - nn::Result Create(TransferableInfo *outTransferableInfo, - const TitleInfo *quickstartTitleInfos, - int numQuickstartTitleInfos, - const KillerNotification &killerNotification, - const TitleInfo &killerNotificationTitleInfo, - LaunchInfoDatabase &launchInfoDatabase) { - return details::Create__Q3_2nn2sl11DataCreatorFPQ3_2nn2sl16TransferableInfoPCQ3_2nn2sl9TitleInfoiRCQ3_2nn2sl18KillerNotificationRCQ3_2nn2sl9TitleInfoRQ3_2nn2sl18LaunchInfoDatabase( - &mInstance, outTransferableInfo, quickstartTitleInfos, numQuickstartTitleInfos, killerNotification, killerNotificationTitleInfo, launchInfoDatabase); - } + nn::Result + Create(TransferableInfo *outTransferableInfo, + const TitleInfo *quickstartTitleInfos, + int numQuickstartTitleInfos, + const KillerNotification &killerNotification, + const TitleInfo &killerNotificationTitleInfo, + LaunchInfoDatabase &launchInfoDatabase) + { + return details::Create__Q3_2nn2sl11DataCreatorFPQ3_2nn2sl16TransferableInfoPCQ3_2nn2sl9TitleInfoiRCQ3_2nn2sl18KillerNotificationRCQ3_2nn2sl9TitleInfoRQ3_2nn2sl18LaunchInfoDatabase( + &mInstance, outTransferableInfo, quickstartTitleInfos, numQuickstartTitleInfos, killerNotification, killerNotificationTitleInfo, launchInfoDatabase); + } - void Initialize(details::IIconInfoAccessorBase &iconInfoAccessor, details::IAccountInfoAccessorBase &accountInfoAccessor, details::ISettingAccessorBase &settingAccessor, details::ITitleIconCacheBase &titleIconCache) { - details::Initialize__Q3_2nn2sl11DataCreatorFRQ3_2nn2sl17IIconInfoAccessorRQ3_2nn2sl20IAccountInfoAccessorRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl15ITitleIconCache( - &mInstance, iconInfoAccessor.GetInternal(), accountInfoAccessor.GetInternal(), settingAccessor.GetInternal(), titleIconCache.GetInternal()); - mIconInfoAccessor = details::IconInfoAccessorFromPtr(mInstance.iconInfoAccessor); - mAccountInfoAccessor = details::AccountInfoAccessorFromPtr(mInstance.accountInfoAccessor); - mSettingAccessor = details::SettingAccessorFromPtr(mInstance.settingInfoAccessor); - mTitleIconCache = details::TitleIconCacheFromPtr(mInstance.titleIconCache); - } + void + Initialize(details::IIconInfoAccessorBase &iconInfoAccessor, details::IAccountInfoAccessorBase &accountInfoAccessor, details::ISettingAccessorBase &settingAccessor, details::ITitleIconCacheBase &titleIconCache) + { + details::Initialize__Q3_2nn2sl11DataCreatorFRQ3_2nn2sl17IIconInfoAccessorRQ3_2nn2sl20IAccountInfoAccessorRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl15ITitleIconCache( + &mInstance, iconInfoAccessor.GetInternal(), accountInfoAccessor.GetInternal(), settingAccessor.GetInternal(), titleIconCache.GetInternal()); + mIconInfoAccessor = details::IconInfoAccessorFromPtr(mInstance.iconInfoAccessor); + mAccountInfoAccessor = details::AccountInfoAccessorFromPtr(mInstance.accountInfoAccessor); + mSettingAccessor = details::SettingAccessorFromPtr(mInstance.settingInfoAccessor); + mTitleIconCache = details::TitleIconCacheFromPtr(mInstance.titleIconCache); + } - ~DataCreator() = default; + ~DataCreator() = default; - private: - details::DataCreatorInternal mInstance = {}; - details::IconInfoAccessorFromPtr mIconInfoAccessor; - details::AccountInfoAccessorFromPtr mAccountInfoAccessor; - details::SettingAccessorFromPtr mSettingAccessor; - details::TitleIconCacheFromPtr mTitleIconCache; - }; +private: + details::DataCreatorInternal mInstance = {}; + details::IconInfoAccessorFromPtr mIconInfoAccessor; + details::AccountInfoAccessorFromPtr mAccountInfoAccessor; + details::SettingAccessorFromPtr mSettingAccessor; + details::TitleIconCacheFromPtr mTitleIconCache; +}; }; // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/DrcManager.h b/include/nn/sl/DrcManager.h index a96d339ef..82e7f273f 100644 --- a/include/nn/sl/DrcManager.h +++ b/include/nn/sl/DrcManager.h @@ -1,91 +1,119 @@ #pragma once +#include #include #include #include #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - - namespace details { - typedef struct WUT_PACKED DrcManagerInternal { - ITransferrerInternal *drcTransferrer; - ISettingAccessorInternal *settingsAccessor; - ITimeAccessorInternal *timeAccessor; - void *vtable; - } DrcManagerInternal; - WUT_CHECK_SIZE(DrcManagerInternal, 0x10); - WUT_CHECK_OFFSET(DrcManagerInternal, 0x00, drcTransferrer); - WUT_CHECK_OFFSET(DrcManagerInternal, 0x04, settingsAccessor); - WUT_CHECK_OFFSET(DrcManagerInternal, 0x08, timeAccessor); - WUT_CHECK_OFFSET(DrcManagerInternal, 0x0C, vtable); - - extern "C" DrcManagerInternal *__ct__Q3_2nn2sl10DrcManagerFv(DrcManagerInternal *); - extern "C" nn::Result CancelTransfer__Q3_2nn2sl10DrcManagerFv(DrcManagerInternal *); - extern "C" nn::Result PushNotification__Q3_2nn2sl10DrcManagerFPbPCQ3_2nn2sl18KillerNotificationbT3L(DrcManagerInternal *, bool *, const KillerNotification *, bool, bool, uint64_t); - extern "C" nn::Result Transfer__Q3_2nn2sl10DrcManagerFRCQ3_2nn2sl16TransferableInfobQ4_2nn2sl12ITransferrer12TransferMode(DrcManagerInternal *, TransferableInfo *, bool, TransferMode); - - extern "C" nn::Result Initialize__Q3_2nn2sl10DrcManagerFRQ3_2nn2sl12ITransferrerRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl13ITimeAccessor( - DrcManagerInternal *, ITransferrerInternal *, ISettingAccessorInternal *, ITimeAccessorInternal *); - } // namespace details - class DrcManager { - public: - DrcManager() : mTransferrer(nullptr), - mSettingAccessor(nullptr), - mTimeAccessor(nullptr) { - if (__ct__Q3_2nn2sl10DrcManagerFv(&mInstance) != nullptr) { - mTransferrer = details::TransferrerFromPtr(mInstance.drcTransferrer); - mSettingAccessor = details::SettingAccessorFromPtr(mInstance.settingsAccessor); - mTimeAccessor = details::TimeAccessorFromPtr(mInstance.timeAccessor); - } - } - - ~DrcManager() = default; - - details::ITransferrerBase &GetTransferrer() { - return mTransferrer; - } - - details::ISettingAccessorBase &GetSettingAccessor() { - return mSettingAccessor; - } - - details::ITimeAccessorBase &GetTimeAccessor() { - return mTimeAccessor; - } - - nn::Result CancelTransfer() { - return CancelTransfer__Q3_2nn2sl10DrcManagerFv(&mInstance); - } - - nn::Result PushNotification(bool *u1, const KillerNotification *u2, bool u3, bool u4, uint64_t u5) { - return PushNotification__Q3_2nn2sl10DrcManagerFPbPCQ3_2nn2sl18KillerNotificationbT3L(&mInstance, u1, u2, u3, u4, u5); - } - - nn::Result Transfer(TransferableInfo *u1, bool u2, TransferMode u3) { - return Transfer__Q3_2nn2sl10DrcManagerFRCQ3_2nn2sl16TransferableInfobQ4_2nn2sl12ITransferrer12TransferMode(&mInstance, u1, u2, u3); - } - - void Initialize(details::ITransferrerBase &transferrer, details::ISettingAccessorBase &settingAccessor, details::ITimeAccessorBase &timeAccessor) { - Initialize__Q3_2nn2sl10DrcManagerFRQ3_2nn2sl12ITransferrerRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl13ITimeAccessor( - &mInstance, - transferrer.GetInternal(), - settingAccessor.GetInternal(), - timeAccessor.GetInternal()); - } - - private: - details::DrcManagerInternal mInstance = {}; - - details::TransferrerFromPtr mTransferrer; - details::SettingAccessorFromPtr mSettingAccessor; - details::TimeAccessorFromPtr mTimeAccessor; - }; +namespace nn::sl +{ + +namespace details +{ +typedef struct WUT_PACKED DrcManagerInternal +{ + ITransferrerInternal *drcTransferrer; + ISettingAccessorInternal *settingsAccessor; + ITimeAccessorInternal *timeAccessor; + void *vtable; +} DrcManagerInternal; +WUT_CHECK_SIZE(DrcManagerInternal, 0x10); +WUT_CHECK_OFFSET(DrcManagerInternal, 0x00, drcTransferrer); +WUT_CHECK_OFFSET(DrcManagerInternal, 0x04, settingsAccessor); +WUT_CHECK_OFFSET(DrcManagerInternal, 0x08, timeAccessor); +WUT_CHECK_OFFSET(DrcManagerInternal, 0x0C, vtable); + +extern "C" DrcManagerInternal * +__ct__Q3_2nn2sl10DrcManagerFv(DrcManagerInternal *); +extern "C" nn::Result +CancelTransfer__Q3_2nn2sl10DrcManagerFv(DrcManagerInternal *); +extern "C" nn::Result +PushNotification__Q3_2nn2sl10DrcManagerFPbPCQ3_2nn2sl18KillerNotificationbT3L(DrcManagerInternal *, bool *, const KillerNotification *, bool, bool, uint64_t); +extern "C" nn::Result +Transfer__Q3_2nn2sl10DrcManagerFRCQ3_2nn2sl16TransferableInfobQ4_2nn2sl12ITransferrer12TransferMode(DrcManagerInternal *, TransferableInfo *, bool, TransferMode); + +extern "C" nn::Result +Initialize__Q3_2nn2sl10DrcManagerFRQ3_2nn2sl12ITransferrerRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl13ITimeAccessor( + DrcManagerInternal *, + ITransferrerInternal *, + ISettingAccessorInternal *, + ITimeAccessorInternal *); +} // namespace details +class DrcManager +{ +public: + DrcManager() : + mTransferrer(nullptr), + mSettingAccessor(nullptr), + mTimeAccessor(nullptr) + { + if (__ct__Q3_2nn2sl10DrcManagerFv(&mInstance) != nullptr) { + mTransferrer = details::TransferrerFromPtr(mInstance.drcTransferrer); + mSettingAccessor = details::SettingAccessorFromPtr(mInstance.settingsAccessor); + mTimeAccessor = details::TimeAccessorFromPtr(mInstance.timeAccessor); + } + } + + ~DrcManager() = default; + + details::ITransferrerBase & + GetTransferrer() + { + return mTransferrer; + } + + details::ISettingAccessorBase & + GetSettingAccessor() + { + return mSettingAccessor; + } + + details::ITimeAccessorBase & + GetTimeAccessor() + { + return mTimeAccessor; + } + + nn::Result + CancelTransfer() + { + return CancelTransfer__Q3_2nn2sl10DrcManagerFv(&mInstance); + } + + nn::Result + PushNotification(bool *u1, const KillerNotification *u2, bool u3, bool u4, uint64_t u5) + { + return PushNotification__Q3_2nn2sl10DrcManagerFPbPCQ3_2nn2sl18KillerNotificationbT3L(&mInstance, u1, u2, u3, u4, u5); + } + + nn::Result + Transfer(TransferableInfo *u1, bool u2, TransferMode u3) + { + return Transfer__Q3_2nn2sl10DrcManagerFRCQ3_2nn2sl16TransferableInfobQ4_2nn2sl12ITransferrer12TransferMode(&mInstance, u1, u2, u3); + } + + void + Initialize(details::ITransferrerBase &transferrer, details::ISettingAccessorBase &settingAccessor, details::ITimeAccessorBase &timeAccessor) + { + Initialize__Q3_2nn2sl10DrcManagerFRQ3_2nn2sl12ITransferrerRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl13ITimeAccessor( + &mInstance, + transferrer.GetInternal(), + settingAccessor.GetInternal(), + timeAccessor.GetInternal()); + } + +private: + details::DrcManagerInternal mInstance = {}; + + details::TransferrerFromPtr mTransferrer; + details::SettingAccessorFromPtr mSettingAccessor; + details::TimeAccessorFromPtr mTimeAccessor; +}; } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/FileStream.h b/include/nn/sl/FileStream.h index cd6cb3b94..4f7d20f0a 100644 --- a/include/nn/sl/FileStream.h +++ b/include/nn/sl/FileStream.h @@ -1,73 +1,94 @@ #pragma once +#include #include #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - namespace details { - typedef struct WUT_PACKED FileStreamInternal { - void *vtable; - FSClient *fsClient; - FSCmdBlock *fsCmdBlock; - FSFileHandle fileHandle; - } FileStreamInternal; - WUT_CHECK_SIZE(FileStreamInternal, 0x10); - WUT_CHECK_OFFSET(FileStreamInternal, 0x00, vtable); - WUT_CHECK_OFFSET(FileStreamInternal, 0x04, fsClient); - WUT_CHECK_OFFSET(FileStreamInternal, 0x08, fsCmdBlock); - WUT_CHECK_OFFSET(FileStreamInternal, 0x0C, fileHandle); +namespace nn::sl +{ +namespace details +{ +typedef struct WUT_PACKED FileStreamInternal +{ + void *vtable; + FSClient *fsClient; + FSCmdBlock *fsCmdBlock; + FSFileHandle fileHandle; +} FileStreamInternal; +WUT_CHECK_SIZE(FileStreamInternal, 0x10); +WUT_CHECK_OFFSET(FileStreamInternal, 0x00, vtable); +WUT_CHECK_OFFSET(FileStreamInternal, 0x04, fsClient); +WUT_CHECK_OFFSET(FileStreamInternal, 0x08, fsCmdBlock); +WUT_CHECK_OFFSET(FileStreamInternal, 0x0C, fileHandle); - extern "C" nn::Result Initialize__Q3_2nn2sl10FileStreamFP8FSClientP10FSCmdBlockPCcT3(FileStreamInternal *, FSClient *, FSCmdBlock *, char const *, char const *); - extern "C" FileStreamInternal *__ct__Q3_2nn2sl10FileStreamFv(FileStreamInternal *); - extern "C" void __dt__Q3_2nn2sl10FileStreamFv(FileStreamInternal *, int); - } // namespace details +extern "C" nn::Result +Initialize__Q3_2nn2sl10FileStreamFP8FSClientP10FSCmdBlockPCcT3(FileStreamInternal *, FSClient *, FSCmdBlock *, char const *, char const *); +extern "C" FileStreamInternal * +__ct__Q3_2nn2sl10FileStreamFv(FileStreamInternal *); +extern "C" void +__dt__Q3_2nn2sl10FileStreamFv(FileStreamInternal *, int); +} // namespace details - class FileStream : public details::IStreamBase { - public: - FileStream() { - __ct__Q3_2nn2sl10FileStreamFv(&mInstance); - } +class FileStream : public details::IStreamBase +{ +public: + FileStream() + { + __ct__Q3_2nn2sl10FileStreamFv(&mInstance); + } - ~FileStream() override { - __dt__Q3_2nn2sl10FileStreamFv(&mInstance, 2); - } + ~FileStream() override + { + __dt__Q3_2nn2sl10FileStreamFv(&mInstance, 2); + } - nn::Result Read(uint32_t *bytesRead, void *buffer, uint32_t readSize) override { - auto *base = reinterpret_cast(&mInstance); - return base->vtable->ReadFn(base, bytesRead, buffer, readSize); - } - nn::Result Write(uint32_t *bytesWritten, void *buffer, uint32_t readSize) override { - auto *base = reinterpret_cast(&mInstance); - return base->vtable->WriteFn(base, bytesWritten, buffer, readSize); - } - nn::Result GetSize(uint32_t *fileSize) override { - auto *base = reinterpret_cast(&mInstance); - return base->vtable->GetSizeFn(base, fileSize); - } - nn::Result Seek(int32_t offset, nn::sl::SeekOrigin seekOrigin) override { - auto *base = reinterpret_cast(&mInstance); - return base->vtable->SeekFn(base, offset, seekOrigin); - } + nn::Result + Read(uint32_t *bytesRead, void *buffer, uint32_t readSize) override + { + auto *base = reinterpret_cast(&mInstance); + return base->vtable->ReadFn(base, bytesRead, buffer, readSize); + } + nn::Result + Write(uint32_t *bytesWritten, void *buffer, uint32_t readSize) override + { + auto *base = reinterpret_cast(&mInstance); + return base->vtable->WriteFn(base, bytesWritten, buffer, readSize); + } + nn::Result + GetSize(uint32_t *fileSize) override + { + auto *base = reinterpret_cast(&mInstance); + return base->vtable->GetSizeFn(base, fileSize); + } + nn::Result + Seek(int32_t offset, nn::sl::SeekOrigin seekOrigin) override + { + auto *base = reinterpret_cast(&mInstance); + return base->vtable->SeekFn(base, offset, seekOrigin); + } - /** + /** * The given client and cmd must be valid during the whole liftime of the filestream */ - nn::Result Initialize(FSClient *client, FSCmdBlock *cmdBlock, char const *path, char const *mode) { - return Initialize__Q3_2nn2sl10FileStreamFP8FSClientP10FSCmdBlockPCcT3(&mInstance, client, cmdBlock, path, mode); - } + nn::Result + Initialize(FSClient *client, FSCmdBlock *cmdBlock, char const *path, char const *mode) + { + return Initialize__Q3_2nn2sl10FileStreamFP8FSClientP10FSCmdBlockPCcT3(&mInstance, client, cmdBlock, path, mode); + } - details::IStreamInternal *GetInternal() override { - return reinterpret_cast(&mInstance); - } + details::IStreamInternal * + GetInternal() override + { + return reinterpret_cast(&mInstance); + } - private: - details::FileStreamInternal mInstance = {}; - }; +private: + details::FileStreamInternal mInstance = {}; +}; }; // namespace nn::sl diff --git a/include/nn/sl/IAccountInfoAccessor.h b/include/nn/sl/IAccountInfoAccessor.h index 9bd6f284d..1f8bcea43 100644 --- a/include/nn/sl/IAccountInfoAccessor.h +++ b/include/nn/sl/IAccountInfoAccessor.h @@ -1,55 +1,70 @@ #pragma once +#include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class IAccountInfoAccessor : public details::IAccountInfoAccessorBase { +namespace nn::sl +{ +class IAccountInfoAccessor : public details::IAccountInfoAccessorBase +{ - public: - IAccountInfoAccessor() { - InitInternalVtable(); - } +public: + IAccountInfoAccessor() + { + InitInternalVtable(); + } - IAccountInfoAccessor(IAccountInfoAccessor &src) { - InitInternalVtable(); - } + IAccountInfoAccessor(IAccountInfoAccessor &src) + { + InitInternalVtable(); + } - IAccountInfoAccessor &operator=(const IAccountInfoAccessor &other) { - InitInternalVtable(); - return *this; - } + IAccountInfoAccessor & + operator=(const IAccountInfoAccessor &other) + { + InitInternalVtable(); + return *this; + } - IAccountInfoAccessor &operator=(IAccountInfoAccessor &&src) noexcept { - InitInternalVtable(); - return *this; - } + IAccountInfoAccessor & + operator=(IAccountInfoAccessor &&src) noexcept + { + InitInternalVtable(); + return *this; + } - ~IAccountInfoAccessor() override = default; + ~IAccountInfoAccessor() override = default; - private: - static nn::Result GetWrapper(details::IAccountInfoAccessorInternal *instance, AccountInfo *outAccountInfo) { - return instance->vtable->instance->Get(outAccountInfo); - } +private: + static nn::Result + GetWrapper(details::IAccountInfoAccessorInternal *instance, AccountInfo *outAccountInfo) + { + return instance->vtable->instance->Get(outAccountInfo); + } - details::IAccountInfoAccessorInternal *GetInternal() override { - return &mInstance; - } + details::IAccountInfoAccessorInternal * + GetInternal() override + { + return &mInstance; + } - void InitInternalVtable() { - mVTable = {.instance = this, - .GetFn = &GetWrapper}; - mInstance.vtable = &mVTable; - } + void + InitInternalVtable() + { + mVTable = {.instance = this, + .GetFn = &GetWrapper}; + mInstance.vtable = &mVTable; + } - details::IAccountInfoAccessorInternal mInstance{}; - details::IAccountInfoAccessorInternalVTable mVTable{}; - }; + details::IAccountInfoAccessorInternal mInstance{}; + details::IAccountInfoAccessorInternalVTable mVTable{}; +}; - details::IAccountInfoAccessorBase &GetDefaultAccountInfoAccessor(); +details::IAccountInfoAccessorBase & +GetDefaultAccountInfoAccessor(); } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/IBlackListAccessor.h b/include/nn/sl/IBlackListAccessor.h index 1203d6131..4284dec17 100644 --- a/include/nn/sl/IBlackListAccessor.h +++ b/include/nn/sl/IBlackListAccessor.h @@ -1,58 +1,73 @@ #pragma once +#include #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - - class IBlackListAccessor : public details::IBlackListAccessorBase { - - public: - IBlackListAccessor() { - InitInternalVtable(); - } - - - IBlackListAccessor(IBlackListAccessor &src) { - InitInternalVtable(); - } - - IBlackListAccessor &operator=(const IBlackListAccessor &other) { - InitInternalVtable(); - return *this; - } - - IBlackListAccessor &operator=(IBlackListAccessor &&src) noexcept { - InitInternalVtable(); - return *this; - } - - ~IBlackListAccessor() override = default; - - private: - static nn::Result GetWrapper(details::IBlackListAccessorInternal *instance, nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos) { - return instance->vtable->instance->Get(outTitleInfos, outTitleInfosSize, maxTitleInfos); - } - - details::IBlackListAccessorInternal *GetInternal() override { - return &mInstance; - } - - void InitInternalVtable() { - mVTable = {.instance = this, - .GetFn = &GetWrapper}; - mInstance.vtable = &mVTable; - } - - details::IBlackListAccessorInternal mInstance{}; - details::IBlackListAccessorInternalVTable mVTable{}; - }; - - details::IBlackListAccessorBase &GetDefaultBlackListAccessor(); +namespace nn::sl +{ + +class IBlackListAccessor : public details::IBlackListAccessorBase +{ + +public: + IBlackListAccessor() + { + InitInternalVtable(); + } + + + IBlackListAccessor(IBlackListAccessor &src) + { + InitInternalVtable(); + } + + IBlackListAccessor & + operator=(const IBlackListAccessor &other) + { + InitInternalVtable(); + return *this; + } + + IBlackListAccessor & + operator=(IBlackListAccessor &&src) noexcept + { + InitInternalVtable(); + return *this; + } + + ~IBlackListAccessor() override = default; + +private: + static nn::Result + GetWrapper(details::IBlackListAccessorInternal *instance, nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos) + { + return instance->vtable->instance->Get(outTitleInfos, outTitleInfosSize, maxTitleInfos); + } + + details::IBlackListAccessorInternal * + GetInternal() override + { + return &mInstance; + } + + void + InitInternalVtable() + { + mVTable = {.instance = this, + .GetFn = &GetWrapper}; + mInstance.vtable = &mVTable; + } + + details::IBlackListAccessorInternal mInstance{}; + details::IBlackListAccessorInternalVTable mVTable{}; +}; + +details::IBlackListAccessorBase & +GetDefaultBlackListAccessor(); } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/IDefaultTitleAccessor.h b/include/nn/sl/IDefaultTitleAccessor.h index 261eef40d..13ccac995 100644 --- a/include/nn/sl/IDefaultTitleAccessor.h +++ b/include/nn/sl/IDefaultTitleAccessor.h @@ -1,57 +1,72 @@ #pragma once +#include #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { +namespace nn::sl +{ - class IDefaultTitleAccessor : public details::IDefaultTitleAccessorBase { +class IDefaultTitleAccessor : public details::IDefaultTitleAccessorBase +{ - public: - IDefaultTitleAccessor() { - InitInternalVtable(); - } +public: + IDefaultTitleAccessor() + { + InitInternalVtable(); + } - IDefaultTitleAccessor(IDefaultTitleAccessor &src) { - InitInternalVtable(); - } + IDefaultTitleAccessor(IDefaultTitleAccessor &src) + { + InitInternalVtable(); + } - IDefaultTitleAccessor &operator=(const IDefaultTitleAccessor &other) { - InitInternalVtable(); - return *this; - } + IDefaultTitleAccessor & + operator=(const IDefaultTitleAccessor &other) + { + InitInternalVtable(); + return *this; + } - IDefaultTitleAccessor &operator=(IDefaultTitleAccessor &&src) noexcept { - InitInternalVtable(); - return *this; - } + IDefaultTitleAccessor & + operator=(IDefaultTitleAccessor &&src) noexcept + { + InitInternalVtable(); + return *this; + } - ~IDefaultTitleAccessor() override = default; + ~IDefaultTitleAccessor() override = default; - private: - static nn::Result GetWrapper(details::IDefaultTitleAccessorInternal *instance, nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos) { - return instance->vtable->instance->Get(outTitleInfos, outTitleInfosSize, maxTitleInfos); - } +private: + static nn::Result + GetWrapper(details::IDefaultTitleAccessorInternal *instance, nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos) + { + return instance->vtable->instance->Get(outTitleInfos, outTitleInfosSize, maxTitleInfos); + } - details::IDefaultTitleAccessorInternal *GetInternal() override { - return &mInstance; - } + details::IDefaultTitleAccessorInternal * + GetInternal() override + { + return &mInstance; + } - void InitInternalVtable() { - mVTable = {.instance = this, - .GetFn = &GetWrapper}; - mInstance.vtable = &mVTable; - } + void + InitInternalVtable() + { + mVTable = {.instance = this, + .GetFn = &GetWrapper}; + mInstance.vtable = &mVTable; + } - details::IDefaultTitleAccessorInternal mInstance{}; - details::IDefaultTitleAccessorInternalVTable mVTable{}; - }; + details::IDefaultTitleAccessorInternal mInstance{}; + details::IDefaultTitleAccessorInternalVTable mVTable{}; +}; - details::IDefaultTitleAccessorBase &GetDefaultDefaultTitleAccessor(); +details::IDefaultTitleAccessorBase & +GetDefaultDefaultTitleAccessor(); } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/IDiscCachedTitleAccessor.h b/include/nn/sl/IDiscCachedTitleAccessor.h index 4b02a5a6c..57bc88009 100644 --- a/include/nn/sl/IDiscCachedTitleAccessor.h +++ b/include/nn/sl/IDiscCachedTitleAccessor.h @@ -1,57 +1,72 @@ #pragma once +#include #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { +namespace nn::sl +{ - class DiscCachedTitleAccessor : public details::IDiscCachedTitleAccessorBase { +class DiscCachedTitleAccessor : public details::IDiscCachedTitleAccessorBase +{ - public: - DiscCachedTitleAccessor() { - InitInternalVtable(); - } +public: + DiscCachedTitleAccessor() + { + InitInternalVtable(); + } - DiscCachedTitleAccessor(DiscCachedTitleAccessor &src) { - InitInternalVtable(); - } + DiscCachedTitleAccessor(DiscCachedTitleAccessor &src) + { + InitInternalVtable(); + } - DiscCachedTitleAccessor &operator=(const DiscCachedTitleAccessor &other) { - InitInternalVtable(); - return *this; - } + DiscCachedTitleAccessor & + operator=(const DiscCachedTitleAccessor &other) + { + InitInternalVtable(); + return *this; + } - DiscCachedTitleAccessor &operator=(DiscCachedTitleAccessor &&src) noexcept { - InitInternalVtable(); - return *this; - } + DiscCachedTitleAccessor & + operator=(DiscCachedTitleAccessor &&src) noexcept + { + InitInternalVtable(); + return *this; + } - ~DiscCachedTitleAccessor() override = default; + ~DiscCachedTitleAccessor() override = default; - private: - static nn::Result GetWrapper(details::IDiscCachedTitleAccessorInternal *instance, nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos) { - return instance->vtable->instance->Get(outTitleInfos, outTitleInfosSize, maxTitleInfos); - } +private: + static nn::Result + GetWrapper(details::IDiscCachedTitleAccessorInternal *instance, nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos) + { + return instance->vtable->instance->Get(outTitleInfos, outTitleInfosSize, maxTitleInfos); + } - details::IDiscCachedTitleAccessorInternal *GetInternal() override { - return &mInstance; - } + details::IDiscCachedTitleAccessorInternal * + GetInternal() override + { + return &mInstance; + } - void InitInternalVtable() { - mVTable = {.instance = this, - .GetFn = &GetWrapper}; - mInstance.vtable = &mVTable; - } + void + InitInternalVtable() + { + mVTable = {.instance = this, + .GetFn = &GetWrapper}; + mInstance.vtable = &mVTable; + } - details::IDiscCachedTitleAccessorInternal mInstance{}; - details::IDiscCachedTitleAccessorInternalVTable mVTable{}; - }; + details::IDiscCachedTitleAccessorInternal mInstance{}; + details::IDiscCachedTitleAccessorInternalVTable mVTable{}; +}; - details::IDiscCachedTitleAccessorBase &GetDefaultDiscCachedTitleAccessor(); +details::IDiscCachedTitleAccessorBase & +GetDefaultDiscCachedTitleAccessor(); } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/IIconInfoAccessor.h b/include/nn/sl/IIconInfoAccessor.h index 2e8ea3f68..7d2069b23 100644 --- a/include/nn/sl/IIconInfoAccessor.h +++ b/include/nn/sl/IIconInfoAccessor.h @@ -1,60 +1,77 @@ #pragma once +#include #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class IIconInfoAccessor : public details::IIconInfoAccessorBase { - - public: - IIconInfoAccessor() { - InitInternalVtable(); - } - - IIconInfoAccessor(IIconInfoAccessor &src) { - InitInternalVtable(); - } - - IIconInfoAccessor &operator=(const IIconInfoAccessor &other) { - InitInternalVtable(); - return *this; - } - - IIconInfoAccessor &operator=(IIconInfoAccessor &&src) noexcept { - InitInternalVtable(); - return *this; - } - - ~IIconInfoAccessor() override = default; - - private: - static nn::Result GetTitleIconInfoWrapper(details::IIconInfoAccessorInternal *instance, nn::sl::IconInfo *outIconInfo, const nn::sl::TitleInfo &titleInfo, nn::sl::Language language) { - return instance->vtable->instance->GetTitleIconInfo(outIconInfo, titleInfo, language); - } - static nn::Result GetMiiIconWrapper(details::IIconInfoAccessorInternal *instance, void *buffer, uint32_t buffer_size, uint32_t slot) { - return instance->vtable->instance->GetMiiIcon(buffer, buffer_size, slot); - } - - details::IIconInfoAccessorInternal *GetInternal() override { - return &mInstance; - } - - void InitInternalVtable() { - mVTable = {.instance = this, - .GetTitleIconInfoFn = GetTitleIconInfoWrapper, - .GetMiiIconFn = GetMiiIconWrapper}; - mInstance.vtable = &mVTable; - } - - details::IIconInfoAccessorInternal mInstance{}; - details::IIconInfoAccessorInternalVTable mVTable{}; - }; - - details::IIconInfoAccessorBase &GetDefaultIconInfoAccessor(); +namespace nn::sl +{ +class IIconInfoAccessor : public details::IIconInfoAccessorBase +{ + +public: + IIconInfoAccessor() + { + InitInternalVtable(); + } + + IIconInfoAccessor(IIconInfoAccessor &src) + { + InitInternalVtable(); + } + + IIconInfoAccessor & + operator=(const IIconInfoAccessor &other) + { + InitInternalVtable(); + return *this; + } + + IIconInfoAccessor & + operator=(IIconInfoAccessor &&src) noexcept + { + InitInternalVtable(); + return *this; + } + + ~IIconInfoAccessor() override = default; + +private: + static nn::Result + GetTitleIconInfoWrapper(details::IIconInfoAccessorInternal *instance, nn::sl::IconInfo *outIconInfo, const nn::sl::TitleInfo &titleInfo, nn::sl::Language language) + { + return instance->vtable->instance->GetTitleIconInfo(outIconInfo, titleInfo, language); + } + static nn::Result + GetMiiIconWrapper(details::IIconInfoAccessorInternal *instance, void *buffer, uint32_t buffer_size, uint32_t slot) + { + return instance->vtable->instance->GetMiiIcon(buffer, buffer_size, slot); + } + + details::IIconInfoAccessorInternal * + GetInternal() override + { + return &mInstance; + } + + void + InitInternalVtable() + { + mVTable = {.instance = this, + .GetTitleIconInfoFn = GetTitleIconInfoWrapper, + .GetMiiIconFn = GetMiiIconWrapper}; + mInstance.vtable = &mVTable; + } + + details::IIconInfoAccessorInternal mInstance{}; + details::IIconInfoAccessorInternalVTable mVTable{}; +}; + +details::IIconInfoAccessorBase & +GetDefaultIconInfoAccessor(); } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/IInstalledTitleListAccessor.h b/include/nn/sl/IInstalledTitleListAccessor.h index 36e06a879..401b1903a 100644 --- a/include/nn/sl/IInstalledTitleListAccessor.h +++ b/include/nn/sl/IInstalledTitleListAccessor.h @@ -1,57 +1,72 @@ #pragma once +#include #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class IInstalledTitleListAccessor : public details::IInstalledTitleListAccessorBase { +namespace nn::sl +{ +class IInstalledTitleListAccessor : public details::IInstalledTitleListAccessorBase +{ - public: - IInstalledTitleListAccessor() { - InitInternalVtable(); - } +public: + IInstalledTitleListAccessor() + { + InitInternalVtable(); + } - IInstalledTitleListAccessor(IInstalledTitleListAccessor &src) { - InitInternalVtable(); - } + IInstalledTitleListAccessor(IInstalledTitleListAccessor &src) + { + InitInternalVtable(); + } - IInstalledTitleListAccessor &operator=(const IInstalledTitleListAccessor &other) { - InitInternalVtable(); - return *this; - } + IInstalledTitleListAccessor & + operator=(const IInstalledTitleListAccessor &other) + { + InitInternalVtable(); + return *this; + } - IInstalledTitleListAccessor &operator=(IInstalledTitleListAccessor &&src) noexcept { - InitInternalVtable(); - return *this; - } + IInstalledTitleListAccessor & + operator=(IInstalledTitleListAccessor &&src) noexcept + { + InitInternalVtable(); + return *this; + } - ~IInstalledTitleListAccessor() override = default; + ~IInstalledTitleListAccessor() override = default; - private: - static nn::Result GetWrapper(details::IInstalledTitleListAccessorInternal *instance, nn::sl::TitleInfo *outInstalledTitleInfos, int *outInstalledTitleInfosSize, int maxInstalledTitleInfos) { - return instance->vtable->instance->Get(outInstalledTitleInfos, outInstalledTitleInfosSize, maxInstalledTitleInfos); - } +private: + static nn::Result + GetWrapper(details::IInstalledTitleListAccessorInternal *instance, nn::sl::TitleInfo *outInstalledTitleInfos, int *outInstalledTitleInfosSize, int maxInstalledTitleInfos) + { + return instance->vtable->instance->Get(outInstalledTitleInfos, outInstalledTitleInfosSize, maxInstalledTitleInfos); + } - details::IInstalledTitleListAccessorInternal *GetInternal() override { - return &mInstance; - } + details::IInstalledTitleListAccessorInternal * + GetInternal() override + { + return &mInstance; + } - void InitInternalVtable() { - mVTable = {.instance = this, - .GetFn = &GetWrapper}; - mInstance.vtable = &mVTable; - } + void + InitInternalVtable() + { + mVTable = {.instance = this, + .GetFn = &GetWrapper}; + mInstance.vtable = &mVTable; + } - details::IInstalledTitleListAccessorInternal mInstance{}; - details::IInstalledTitleListAccessorInternalVTable mVTable{}; - }; + details::IInstalledTitleListAccessorInternal mInstance{}; + details::IInstalledTitleListAccessorInternalVTable mVTable{}; +}; - details::IInstalledTitleListAccessorBase &GetDefaultInstalledTitleListAccessor(); +details::IInstalledTitleListAccessorBase & +GetDefaultInstalledTitleListAccessor(); } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/IKillerNotificationAccessor.h b/include/nn/sl/IKillerNotificationAccessor.h index 60c42e48a..93aa3bc82 100644 --- a/include/nn/sl/IKillerNotificationAccessor.h +++ b/include/nn/sl/IKillerNotificationAccessor.h @@ -1,56 +1,71 @@ #pragma once +#include #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class IKillerNotificationAccessor : public details::IKillerNotificationAccessorBase { +namespace nn::sl +{ +class IKillerNotificationAccessor : public details::IKillerNotificationAccessorBase +{ - public: - IKillerNotificationAccessor() { - InitInternalVtable(); - } +public: + IKillerNotificationAccessor() + { + InitInternalVtable(); + } - IKillerNotificationAccessor(IKillerNotificationAccessor &src) { - InitInternalVtable(); - } + IKillerNotificationAccessor(IKillerNotificationAccessor &src) + { + InitInternalVtable(); + } - IKillerNotificationAccessor &operator=(const IKillerNotificationAccessor &other) { - InitInternalVtable(); - return *this; - } + IKillerNotificationAccessor & + operator=(const IKillerNotificationAccessor &other) + { + InitInternalVtable(); + return *this; + } - IKillerNotificationAccessor &operator=(IKillerNotificationAccessor &&src) noexcept { - InitInternalVtable(); - return *this; - } + IKillerNotificationAccessor & + operator=(IKillerNotificationAccessor &&src) noexcept + { + InitInternalVtable(); + return *this; + } - ~IKillerNotificationAccessor() override = default; + ~IKillerNotificationAccessor() override = default; - private: - static nn::Result GetWrapper(details::IKillerNotificationAccessorInternal *instance, KillerNotification *outBuffer, int *outNum, int outBufferNum) { - return instance->vtable->instance->Get(outBuffer, outNum, outBufferNum); - } +private: + static nn::Result + GetWrapper(details::IKillerNotificationAccessorInternal *instance, KillerNotification *outBuffer, int *outNum, int outBufferNum) + { + return instance->vtable->instance->Get(outBuffer, outNum, outBufferNum); + } - details::IKillerNotificationAccessorInternal *GetInternal() override { - return &mInstance; - } + details::IKillerNotificationAccessorInternal * + GetInternal() override + { + return &mInstance; + } - void InitInternalVtable() { - mVTable = {.instance = this, - .GetFn = &GetWrapper}; - mInstance.vtable = &mVTable; - } + void + InitInternalVtable() + { + mVTable = {.instance = this, + .GetFn = &GetWrapper}; + mInstance.vtable = &mVTable; + } - details::IKillerNotificationAccessorInternal mInstance{}; - details::IKillerNotificationAccessorInternalVTable mVTable{}; - }; + details::IKillerNotificationAccessorInternal mInstance{}; + details::IKillerNotificationAccessorInternalVTable mVTable{}; +}; - details::IKillerNotificationAccessorBase &GetDefaultKillerNotificationAccessor(); +details::IKillerNotificationAccessorBase & +GetDefaultKillerNotificationAccessor(); } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/ILaunchedTitleListAccessor.h b/include/nn/sl/ILaunchedTitleListAccessor.h index 342a38499..892c344e3 100644 --- a/include/nn/sl/ILaunchedTitleListAccessor.h +++ b/include/nn/sl/ILaunchedTitleListAccessor.h @@ -1,61 +1,78 @@ #pragma once +#include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class ILaunchedTitleListAccessor : public details::ILaunchedTitleListAccessorBase { +namespace nn::sl +{ +class ILaunchedTitleListAccessor : public details::ILaunchedTitleListAccessorBase +{ - public: - ILaunchedTitleListAccessor() { - InitInternalVtable(); - } +public: + ILaunchedTitleListAccessor() + { + InitInternalVtable(); + } - ILaunchedTitleListAccessor(ILaunchedTitleListAccessor &src) { - InitInternalVtable(); - } + ILaunchedTitleListAccessor(ILaunchedTitleListAccessor &src) + { + InitInternalVtable(); + } - ILaunchedTitleListAccessor &operator=(const ILaunchedTitleListAccessor &other) { - InitInternalVtable(); - return *this; - } + ILaunchedTitleListAccessor & + operator=(const ILaunchedTitleListAccessor &other) + { + InitInternalVtable(); + return *this; + } - ILaunchedTitleListAccessor &operator=(ILaunchedTitleListAccessor &&src) noexcept { - InitInternalVtable(); - return *this; - } + ILaunchedTitleListAccessor & + operator=(ILaunchedTitleListAccessor &&src) noexcept + { + InitInternalVtable(); + return *this; + } - ~ILaunchedTitleListAccessor() override = default; + ~ILaunchedTitleListAccessor() override = default; - private: - static nn::Result GetByAccountWrapper(details::ILaunchedTitleListAccessorInternal *instance, nn::sl::TitleInfo *outTitleInfos, int *outTitleInfoSize, int inTitleInfosSize, int userId) { - return instance->vtable->instance->GetByAccount(outTitleInfos, outTitleInfoSize, inTitleInfosSize, userId); - } +private: + static nn::Result + GetByAccountWrapper(details::ILaunchedTitleListAccessorInternal *instance, nn::sl::TitleInfo *outTitleInfos, int *outTitleInfoSize, int inTitleInfosSize, int userId) + { + return instance->vtable->instance->GetByAccount(outTitleInfos, outTitleInfoSize, inTitleInfosSize, userId); + } - details::ILaunchedTitleListAccessorInternal *GetInternal() override { - return &mInstance; - } + details::ILaunchedTitleListAccessorInternal * + GetInternal() override + { + return &mInstance; + } - void InitInternalVtable() { - mVTable = {.instance = this, - .GetByAccountFn = &GetByAccountWrapper}; - mInstance.vtable = &mVTable; - } + void + InitInternalVtable() + { + mVTable = {.instance = this, + .GetByAccountFn = &GetByAccountWrapper}; + mInstance.vtable = &mVTable; + } - details::ILaunchedTitleListAccessorInternal mInstance{}; - details::ILaunchedTitleListAccessorInternalVTable mVTable{}; - }; + details::ILaunchedTitleListAccessorInternal mInstance{}; + details::ILaunchedTitleListAccessorInternalVTable mVTable{}; +}; - enum LaunchedTitleListAccessorType { - TITLE_LIST_ACCESSOR_LAUNCHED_TITLES = 0, - TITLE_LIST_ACCESSOR_PLAY_STATS = 1, - }; +enum LaunchedTitleListAccessorType +{ + TITLE_LIST_ACCESSOR_LAUNCHED_TITLES = 0, + TITLE_LIST_ACCESSOR_PLAY_STATS = 1, +}; - details::ILaunchedTitleListAccessorBase &GetDefaultLaunchedTitleListAccessor(LaunchedTitleListAccessorType type); - details::ILaunchedTitleListAccessorBase &GetDefaultLaunchedTitleListAccessor(); +details::ILaunchedTitleListAccessorBase & +GetDefaultLaunchedTitleListAccessor(LaunchedTitleListAccessorType type); +details::ILaunchedTitleListAccessorBase & +GetDefaultLaunchedTitleListAccessor(); } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/IMetaInfoAccessor.h b/include/nn/sl/IMetaInfoAccessor.h index fa10d05e9..239699b1a 100644 --- a/include/nn/sl/IMetaInfoAccessor.h +++ b/include/nn/sl/IMetaInfoAccessor.h @@ -1,58 +1,73 @@ #pragma once +#include #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - - class MetaInfoAccessor : public details::IMetaInfoAccessorBase { - - public: - MetaInfoAccessor() { - InitInternalVtable(); - } - - - MetaInfoAccessor(MetaInfoAccessor &src) { - InitInternalVtable(); - } - - MetaInfoAccessor &operator=(const MetaInfoAccessor &other) { - InitInternalVtable(); - return *this; - } - - MetaInfoAccessor &operator=(MetaInfoAccessor &&src) noexcept { - InitInternalVtable(); - return *this; - } - - ~MetaInfoAccessor() override = default; - - private: - static nn::Result GetWrapper(details::IMetaInfoAccessorInternal *instance, nn::sl::TitleMetaInfo *outMetaInfo, const nn::sl::TitleInfo &titleInfo) { - return instance->vtable->instance->Get(outMetaInfo, titleInfo); - } - - details::IMetaInfoAccessorInternal *GetInternal() override { - return &mInstance; - } - - void InitInternalVtable() { - mVTable = {.instance = this, - .GetFn = &GetWrapper}; - mInstance.vtable = &mVTable; - } - - details::IMetaInfoAccessorInternal mInstance{}; - details::IMetaInfoAccessorInternalVTable mVTable{}; - }; - - details::IMetaInfoAccessorBase &GetDefaultMetaInfoAccessor(); +namespace nn::sl +{ + +class MetaInfoAccessor : public details::IMetaInfoAccessorBase +{ + +public: + MetaInfoAccessor() + { + InitInternalVtable(); + } + + + MetaInfoAccessor(MetaInfoAccessor &src) + { + InitInternalVtable(); + } + + MetaInfoAccessor & + operator=(const MetaInfoAccessor &other) + { + InitInternalVtable(); + return *this; + } + + MetaInfoAccessor & + operator=(MetaInfoAccessor &&src) noexcept + { + InitInternalVtable(); + return *this; + } + + ~MetaInfoAccessor() override = default; + +private: + static nn::Result + GetWrapper(details::IMetaInfoAccessorInternal *instance, nn::sl::TitleMetaInfo *outMetaInfo, const nn::sl::TitleInfo &titleInfo) + { + return instance->vtable->instance->Get(outMetaInfo, titleInfo); + } + + details::IMetaInfoAccessorInternal * + GetInternal() override + { + return &mInstance; + } + + void + InitInternalVtable() + { + mVTable = {.instance = this, + .GetFn = &GetWrapper}; + mInstance.vtable = &mVTable; + } + + details::IMetaInfoAccessorInternal mInstance{}; + details::IMetaInfoAccessorInternalVTable mVTable{}; +}; + +details::IMetaInfoAccessorBase & +GetDefaultMetaInfoAccessor(); } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/IPreferentialTitleAccessor.h b/include/nn/sl/IPreferentialTitleAccessor.h index 71766134f..58c0f8a51 100644 --- a/include/nn/sl/IPreferentialTitleAccessor.h +++ b/include/nn/sl/IPreferentialTitleAccessor.h @@ -1,55 +1,70 @@ #pragma once +#include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class IPreferentialTitleAccessor : public details::IPreferentialTitleAccessorBase { +namespace nn::sl +{ +class IPreferentialTitleAccessor : public details::IPreferentialTitleAccessorBase +{ - public: - IPreferentialTitleAccessor() { - InitInternalVtable(); - } +public: + IPreferentialTitleAccessor() + { + InitInternalVtable(); + } - IPreferentialTitleAccessor(IPreferentialTitleAccessor &src) { - InitInternalVtable(); - } + IPreferentialTitleAccessor(IPreferentialTitleAccessor &src) + { + InitInternalVtable(); + } - IPreferentialTitleAccessor &operator=(const IPreferentialTitleAccessor &other) { - InitInternalVtable(); - return *this; - } + IPreferentialTitleAccessor & + operator=(const IPreferentialTitleAccessor &other) + { + InitInternalVtable(); + return *this; + } - IPreferentialTitleAccessor &operator=(IPreferentialTitleAccessor &&src) noexcept { - InitInternalVtable(); - return *this; - } + IPreferentialTitleAccessor & + operator=(IPreferentialTitleAccessor &&src) noexcept + { + InitInternalVtable(); + return *this; + } - ~IPreferentialTitleAccessor() override = default; + ~IPreferentialTitleAccessor() override = default; - private: - static nn::Result GetWrapper(details::IPreferentialTitleAccessorInternal *instance, TitleInfo *outTitleInfo, uint32_t *outTitleInfoSize, int maxTitleInfo, uint32_t u1) { - return instance->vtable->instance->Get(outTitleInfo, outTitleInfoSize, maxTitleInfo, u1); - } +private: + static nn::Result + GetWrapper(details::IPreferentialTitleAccessorInternal *instance, TitleInfo *outTitleInfo, uint32_t *outTitleInfoSize, int maxTitleInfo, uint32_t u1) + { + return instance->vtable->instance->Get(outTitleInfo, outTitleInfoSize, maxTitleInfo, u1); + } - details::IPreferentialTitleAccessorInternal *GetInternal() override { - return &mInstance; - } + details::IPreferentialTitleAccessorInternal * + GetInternal() override + { + return &mInstance; + } - void InitInternalVtable() { - mVTable = {.instance = this, - .GetFn = &GetWrapper}; - mInstance.vtable = &mVTable; - } + void + InitInternalVtable() + { + mVTable = {.instance = this, + .GetFn = &GetWrapper}; + mInstance.vtable = &mVTable; + } - details::IPreferentialTitleAccessorInternal mInstance{}; - details::IPreferentialTitleAccessorInternalVTable mVTable{}; - }; + details::IPreferentialTitleAccessorInternal mInstance{}; + details::IPreferentialTitleAccessorInternalVTable mVTable{}; +}; - details::IPreferentialTitleAccessorBase &GetDefaultPreferentialTitleAccessor(); +details::IPreferentialTitleAccessorBase & +GetDefaultPreferentialTitleAccessor(); } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/ISerializer.h b/include/nn/sl/ISerializer.h index 8c474017a..b6f994120 100644 --- a/include/nn/sl/ISerializer.h +++ b/include/nn/sl/ISerializer.h @@ -1,85 +1,112 @@ #pragma once +#include #include #include #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - template - class ISerializer : public details::ISerializerBase { - - public: - ISerializer() { - InitInternalVtable(); - } - - ISerializer(ISerializer &src) { - InitInternalVtable(); - } - - ISerializer &operator=(const ISerializer &other) { - InitInternalVtable(); - return *this; - } - - ISerializer &operator=(ISerializer &&src) noexcept { - InitInternalVtable(); - return *this; - } - - nn::Result Serialize(T *buffer, uint32_t num) { - return details::ISerializerBase::Serialize(buffer, num * sizeof(buffer)); - } - - nn::Result Deserialize(T *buffer, uint32_t num) { - return details::ISerializerBase::Deserialize(buffer, num * sizeof(buffer)); - } - - ~ISerializer() override = default; - - private: - static nn::Result SerializeWrapper(details::ISerializerInternal *instance, void *buffer, uint32_t size) { - return details::ISerializerBase::instance->vtable->instance->Serialize(buffer, size); - } - - static nn::Result DeserializeWrapper(details::ISerializerInternal *instance, void *buffer, uint32_t size) { - return details::ISerializerBase::instance->vtable->instance->Deserialize(buffer, size); - } - - static nn::Result GetCountWrapper(details::ISerializerInternal *instance, uint32_t *outCount) { - return details::ISerializerBase::instance->vtable->instance->GetCount(outCount); - } - - details::ISerializerInternal *GetInternal() override { - return &mInstance; - } - - void InitInternalVtable() { - mVTable = {.instance = this, - .SerializeFn = &SerializeWrapper, - .DeserializeFn = &DeserializeWrapper, - .GetCountFn = &GetCountWrapper}; - mInstance.vtable = &mVTable; - } - - details::ISerializerInternal mInstance{}; - details::ISerializerInternalVTable mVTable{}; - }; - - details::ISerializerBase &GetDefaultIconInfoSerializer(); - - details::ISerializerBase &GetDefaultQuickStartTitleInfoSerializer(); - - details::ISerializerBase &GetDefaultKillerNotificationSerializer(); - - details::ISerializerBase &GetDefaultJumpTitleInfoSerializer(); - - details::ISerializerBase &GetDefaultPreviousSendingTimeSerializer(); +namespace nn::sl +{ +template +class ISerializer : public details::ISerializerBase +{ + +public: + ISerializer() + { + InitInternalVtable(); + } + + ISerializer(ISerializer &src) + { + InitInternalVtable(); + } + + ISerializer & + operator=(const ISerializer &other) + { + InitInternalVtable(); + return *this; + } + + ISerializer & + operator=(ISerializer &&src) noexcept + { + InitInternalVtable(); + return *this; + } + + nn::Result + Serialize(T *buffer, uint32_t num) + { + return details::ISerializerBase::Serialize(buffer, num * sizeof(buffer)); + } + + nn::Result + Deserialize(T *buffer, uint32_t num) + { + return details::ISerializerBase::Deserialize(buffer, num * sizeof(buffer)); + } + + ~ISerializer() override = default; + +private: + static nn::Result + SerializeWrapper(details::ISerializerInternal *instance, void *buffer, uint32_t size) + { + return details::ISerializerBase::instance->vtable->instance->Serialize(buffer, size); + } + + static nn::Result + DeserializeWrapper(details::ISerializerInternal *instance, void *buffer, uint32_t size) + { + return details::ISerializerBase::instance->vtable->instance->Deserialize(buffer, size); + } + + static nn::Result + GetCountWrapper(details::ISerializerInternal *instance, uint32_t *outCount) + { + return details::ISerializerBase::instance->vtable->instance->GetCount(outCount); + } + + details::ISerializerInternal * + GetInternal() override + { + return &mInstance; + } + + void + InitInternalVtable() + { + mVTable = {.instance = this, + .SerializeFn = &SerializeWrapper, + .DeserializeFn = &DeserializeWrapper, + .GetCountFn = &GetCountWrapper}; + mInstance.vtable = &mVTable; + } + + details::ISerializerInternal mInstance{}; + details::ISerializerInternalVTable mVTable{}; +}; + +details::ISerializerBase & +GetDefaultIconInfoSerializer(); + +details::ISerializerBase & +GetDefaultQuickStartTitleInfoSerializer(); + +details::ISerializerBase & +GetDefaultKillerNotificationSerializer(); + +details::ISerializerBase & +GetDefaultJumpTitleInfoSerializer(); + +details::ISerializerBase & +GetDefaultPreviousSendingTimeSerializer(); } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/ISettingAccessor.h b/include/nn/sl/ISettingAccessor.h index 80b6b5d6b..6f9933500 100644 --- a/include/nn/sl/ISettingAccessor.h +++ b/include/nn/sl/ISettingAccessor.h @@ -1,56 +1,71 @@ #pragma once +#include #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class ISettingAccessor : public details::ISettingAccessorBase { +namespace nn::sl +{ +class ISettingAccessor : public details::ISettingAccessorBase +{ - public: - ISettingAccessor() { - InitInternalVtable(); - } +public: + ISettingAccessor() + { + InitInternalVtable(); + } - ISettingAccessor(ISettingAccessor &src) { - InitInternalVtable(); - } + ISettingAccessor(ISettingAccessor &src) + { + InitInternalVtable(); + } - ISettingAccessor &operator=(const ISettingAccessor &other) { - InitInternalVtable(); - return *this; - } + ISettingAccessor & + operator=(const ISettingAccessor &other) + { + InitInternalVtable(); + return *this; + } - ISettingAccessor &operator=(ISettingAccessor &&src) noexcept { - InitInternalVtable(); - return *this; - } + ISettingAccessor & + operator=(ISettingAccessor &&src) noexcept + { + InitInternalVtable(); + return *this; + } - ~ISettingAccessor() override = default; + ~ISettingAccessor() override = default; - private: - static nn::Result GetWrapper(details::ISettingAccessorInternal *instance, Setting *outSetting) { - return instance->vtable->instance->Get(outSetting); - } +private: + static nn::Result + GetWrapper(details::ISettingAccessorInternal *instance, Setting *outSetting) + { + return instance->vtable->instance->Get(outSetting); + } - details::ISettingAccessorInternal *GetInternal() override { - return &mInstance; - } + details::ISettingAccessorInternal * + GetInternal() override + { + return &mInstance; + } - void InitInternalVtable() { - mVTable = {.instance = this, - .GetFn = &GetWrapper}; - mInstance.vtable = &mVTable; - } + void + InitInternalVtable() + { + mVTable = {.instance = this, + .GetFn = &GetWrapper}; + mInstance.vtable = &mVTable; + } - details::ISettingAccessorInternal mInstance{}; - details::ISettingAccessorInternalVTable mVTable{}; - }; + details::ISettingAccessorInternal mInstance{}; + details::ISettingAccessorInternalVTable mVTable{}; +}; - details::ISettingAccessorBase &GetDefaultSettingAccessor(); +details::ISettingAccessorBase & +GetDefaultSettingAccessor(); } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/IStream.h b/include/nn/sl/IStream.h index 2d7128915..79db23f45 100644 --- a/include/nn/sl/IStream.h +++ b/include/nn/sl/IStream.h @@ -1,69 +1,89 @@ #pragma once +#include #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class IStream : public details::IStreamBase { - - public: - IStream() { - InitInternalVtable(); - } - - IStream(IStream &src) { - InitInternalVtable(); - } - - IStream &operator=(const IStream &other) { - InitInternalVtable(); - return *this; - } - - IStream &operator=(IStream &&src) noexcept { - InitInternalVtable(); - return *this; - } - - ~IStream() override = default; - - private: - static nn::Result ReadWrapper(details::IStreamInternal *instance, uint32_t *bytesRead, void *buffer, uint32_t readSize) { - return instance->vtable->instance->Read(bytesRead, buffer, readSize); - } - - static nn::Result WriteWrapper(details::IStreamInternal *instance, uint32_t *bytesWritten, void *buffer, uint32_t readSize) { - return instance->vtable->instance->Write(bytesWritten, buffer, readSize); - } - - static nn::Result GetSizeWrapper(details::IStreamInternal *instance, uint32_t *fileSize) { - return instance->vtable->instance->GetSize(fileSize); - } - - static nn::Result SeekWrapper(details::IStreamInternal *instance, int32_t offset, nn::sl::SeekOrigin seekOrigin) { - return instance->vtable->instance->Seek(offset, seekOrigin); - } - - details::IStreamInternal *GetInternal() override { - return &mInstance; - } - - void InitInternalVtable() { - mVTable = {.instance = this, - .ReadFn = &ReadWrapper, - .WriteFn = &WriteWrapper, - .GetSizeFn = &GetSizeWrapper, - .SeekFn = &SeekWrapper}; - mInstance.vtable = &mVTable; - } - - details::IStreamInternal mInstance{}; - details::IStreamInternalVTable mVTable{}; - }; +namespace nn::sl +{ +class IStream : public details::IStreamBase +{ + +public: + IStream() + { + InitInternalVtable(); + } + + IStream(IStream &src) + { + InitInternalVtable(); + } + + IStream & + operator=(const IStream &other) + { + InitInternalVtable(); + return *this; + } + + IStream & + operator=(IStream &&src) noexcept + { + InitInternalVtable(); + return *this; + } + + ~IStream() override = default; + +private: + static nn::Result + ReadWrapper(details::IStreamInternal *instance, uint32_t *bytesRead, void *buffer, uint32_t readSize) + { + return instance->vtable->instance->Read(bytesRead, buffer, readSize); + } + + static nn::Result + WriteWrapper(details::IStreamInternal *instance, uint32_t *bytesWritten, void *buffer, uint32_t readSize) + { + return instance->vtable->instance->Write(bytesWritten, buffer, readSize); + } + + static nn::Result + GetSizeWrapper(details::IStreamInternal *instance, uint32_t *fileSize) + { + return instance->vtable->instance->GetSize(fileSize); + } + + static nn::Result + SeekWrapper(details::IStreamInternal *instance, int32_t offset, nn::sl::SeekOrigin seekOrigin) + { + return instance->vtable->instance->Seek(offset, seekOrigin); + } + + details::IStreamInternal * + GetInternal() override + { + return &mInstance; + } + + void + InitInternalVtable() + { + mVTable = {.instance = this, + .ReadFn = &ReadWrapper, + .WriteFn = &WriteWrapper, + .GetSizeFn = &GetSizeWrapper, + .SeekFn = &SeekWrapper}; + mInstance.vtable = &mVTable; + } + + details::IStreamInternal mInstance{}; + details::IStreamInternalVTable mVTable{}; +}; } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/ITimeAccessor.h b/include/nn/sl/ITimeAccessor.h index 1bfc8ad15..24342b426 100644 --- a/include/nn/sl/ITimeAccessor.h +++ b/include/nn/sl/ITimeAccessor.h @@ -1,62 +1,79 @@ #pragma once +#include #include #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { +namespace nn::sl +{ - class ITimeAccessor : public details::ITimeAccessorBase { +class ITimeAccessor : public details::ITimeAccessorBase +{ - public: - ITimeAccessor() { - InitInternalVtable(); - } +public: + ITimeAccessor() + { + InitInternalVtable(); + } - ITimeAccessor(ITimeAccessor &src) { - InitInternalVtable(); - } + ITimeAccessor(ITimeAccessor &src) + { + InitInternalVtable(); + } - ITimeAccessor &operator=(const ITimeAccessor &other) { - InitInternalVtable(); - return *this; - } + ITimeAccessor & + operator=(const ITimeAccessor &other) + { + InitInternalVtable(); + return *this; + } - ITimeAccessor &operator=(ITimeAccessor &&src) noexcept { - InitInternalVtable(); - return *this; - } + ITimeAccessor & + operator=(ITimeAccessor &&src) noexcept + { + InitInternalVtable(); + return *this; + } - ~ITimeAccessor() override = default; + ~ITimeAccessor() override = default; - private: - static nn::Result GetNetworkTimeWrapper(details::ITimeAccessorInternal *instance, OSTime *timeOut, bool *successOut) { - return instance->vtable->instance->GetNetworkTime(timeOut, successOut); - } - static nn::Result GetLocalTimeWrapper(details::ITimeAccessorInternal *instance, OSTime *timeOut, bool *successOut) { - return instance->vtable->instance->GetLocalTime(timeOut, successOut); - } +private: + static nn::Result + GetNetworkTimeWrapper(details::ITimeAccessorInternal *instance, OSTime *timeOut, bool *successOut) + { + return instance->vtable->instance->GetNetworkTime(timeOut, successOut); + } + static nn::Result + GetLocalTimeWrapper(details::ITimeAccessorInternal *instance, OSTime *timeOut, bool *successOut) + { + return instance->vtable->instance->GetLocalTime(timeOut, successOut); + } - details::ITimeAccessorInternal *GetInternal() override { - return &mInstance; - } + details::ITimeAccessorInternal * + GetInternal() override + { + return &mInstance; + } - void InitInternalVtable() { - mVTable = {.instance = this, - .GetNetworkTimeFn = &GetNetworkTimeWrapper, - .GetLocalTimeFn = &GetLocalTimeWrapper}; - mInstance.vtable = &mVTable; - } + void + InitInternalVtable() + { + mVTable = {.instance = this, + .GetNetworkTimeFn = &GetNetworkTimeWrapper, + .GetLocalTimeFn = &GetLocalTimeWrapper}; + mInstance.vtable = &mVTable; + } - details::ITimeAccessorInternal mInstance{}; - details::ITimeAccessorInternalVTable mVTable{}; - }; + details::ITimeAccessorInternal mInstance{}; + details::ITimeAccessorInternalVTable mVTable{}; +}; - details::ITimeAccessorBase &GetDefaultTimeAccessor(); +details::ITimeAccessorBase & +GetDefaultTimeAccessor(); } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/ITitleIconCache.h b/include/nn/sl/ITitleIconCache.h index f20741520..f8b37c75e 100644 --- a/include/nn/sl/ITitleIconCache.h +++ b/include/nn/sl/ITitleIconCache.h @@ -1,72 +1,93 @@ #pragma once +#include #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - - class ITitleIconCache : public details::ITitleIconCacheBase { - - public: - ITitleIconCache() { - InitInternalVtable(); - } - - ITitleIconCache(ITitleIconCache &src) { - InitInternalVtable(); - } - - ITitleIconCache &operator=(const ITitleIconCache &other) { - InitInternalVtable(); - return *this; - } - - ITitleIconCache &operator=(ITitleIconCache &&src) noexcept { - InitInternalVtable(); - return *this; - } - - ~ITitleIconCache() override = default; - - private: - static nn::Result LoadWrapper(details::ITitleIconCacheInternal *instance) { - return instance->vtable->instance->Load(); - } - - static nn::Result UpdateWrapper(details::ITitleIconCacheInternal *instance, TitleInfo *titleInfos, int num) { - return instance->vtable->instance->Update(titleInfos, num); - } - - static nn::Result StoreWrapper(details::ITitleIconCacheInternal *instance) { - return instance->vtable->instance->Store(); - } - - static void GetWrapper(details::ITitleIconCacheInternal *instance, IconInfo *iconInfos, int num) { - return instance->vtable->instance->Get(iconInfos, num); - } - - details::ITitleIconCacheInternal *GetInternal() override { - return &mInstance; - } - - void InitInternalVtable() { - mVTable = {.instance = this, - .LoadFn = &LoadWrapper, - .UpdateFn = &UpdateWrapper, - .StoreFn = &StoreWrapper, - .GetFn = &GetWrapper}; - mInstance.vtable = &mVTable; - } - - details::ITitleIconCacheInternal mInstance{}; - details::ITitleIconCacheInternalVTable mVTable{}; - }; - - details::ITitleIconCacheBase &GetDefaultTitleIconCache(); +namespace nn::sl +{ + +class ITitleIconCache : public details::ITitleIconCacheBase +{ + +public: + ITitleIconCache() + { + InitInternalVtable(); + } + + ITitleIconCache(ITitleIconCache &src) + { + InitInternalVtable(); + } + + ITitleIconCache & + operator=(const ITitleIconCache &other) + { + InitInternalVtable(); + return *this; + } + + ITitleIconCache & + operator=(ITitleIconCache &&src) noexcept + { + InitInternalVtable(); + return *this; + } + + ~ITitleIconCache() override = default; + +private: + static nn::Result + LoadWrapper(details::ITitleIconCacheInternal *instance) + { + return instance->vtable->instance->Load(); + } + + static nn::Result + UpdateWrapper(details::ITitleIconCacheInternal *instance, TitleInfo *titleInfos, int num) + { + return instance->vtable->instance->Update(titleInfos, num); + } + + static nn::Result + StoreWrapper(details::ITitleIconCacheInternal *instance) + { + return instance->vtable->instance->Store(); + } + + static void + GetWrapper(details::ITitleIconCacheInternal *instance, IconInfo *iconInfos, int num) + { + return instance->vtable->instance->Get(iconInfos, num); + } + + details::ITitleIconCacheInternal * + GetInternal() override + { + return &mInstance; + } + + void + InitInternalVtable() + { + mVTable = {.instance = this, + .LoadFn = &LoadWrapper, + .UpdateFn = &UpdateWrapper, + .StoreFn = &StoreWrapper, + .GetFn = &GetWrapper}; + mInstance.vtable = &mVTable; + } + + details::ITitleIconCacheInternal mInstance{}; + details::ITitleIconCacheInternalVTable mVTable{}; +}; + +details::ITitleIconCacheBase & +GetDefaultTitleIconCache(); } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/ITitleListAccessor.h b/include/nn/sl/ITitleListAccessor.h index 3edfaf914..37f518585 100644 --- a/include/nn/sl/ITitleListAccessor.h +++ b/include/nn/sl/ITitleListAccessor.h @@ -1,58 +1,73 @@ #pragma once +#include #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - - class ITitleListAccessor : public details::ITitleListAccessorBase { - - public: - ITitleListAccessor() { - InitInternalVtable(); - } - - - ITitleListAccessor(ITitleListAccessor &src) { - InitInternalVtable(); - } - - ITitleListAccessor &operator=(const ITitleListAccessor &other) { - InitInternalVtable(); - return *this; - } - - ITitleListAccessor &operator=(ITitleListAccessor &&src) noexcept { - InitInternalVtable(); - return *this; - } - - ~ITitleListAccessor() override = default; - - private: - static nn::Result GetWrapper(details::ITitleListAccessorInternal *instance, nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos) { - return instance->vtable->instance->Get(outTitleInfos, outTitleInfosSize, maxTitleInfos); - } - - details::ITitleListAccessorInternal *GetInternal() override { - return &mInstance; - } - - void InitInternalVtable() { - mVTable = {.instance = this, - .GetFn = &GetWrapper}; - mInstance.vtable = &mVTable; - } - - details::ITitleListAccessorInternal mInstance{}; - details::ITitleListAccessorInternalVTable mVTable{}; - }; - - details::ITitleListAccessorBase &GetDefaultTitleListAccessor(); +namespace nn::sl +{ + +class ITitleListAccessor : public details::ITitleListAccessorBase +{ + +public: + ITitleListAccessor() + { + InitInternalVtable(); + } + + + ITitleListAccessor(ITitleListAccessor &src) + { + InitInternalVtable(); + } + + ITitleListAccessor & + operator=(const ITitleListAccessor &other) + { + InitInternalVtable(); + return *this; + } + + ITitleListAccessor & + operator=(ITitleListAccessor &&src) noexcept + { + InitInternalVtable(); + return *this; + } + + ~ITitleListAccessor() override = default; + +private: + static nn::Result + GetWrapper(details::ITitleListAccessorInternal *instance, nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos) + { + return instance->vtable->instance->Get(outTitleInfos, outTitleInfosSize, maxTitleInfos); + } + + details::ITitleListAccessorInternal * + GetInternal() override + { + return &mInstance; + } + + void + InitInternalVtable() + { + mVTable = {.instance = this, + .GetFn = &GetWrapper}; + mInstance.vtable = &mVTable; + } + + details::ITitleListAccessorInternal mInstance{}; + details::ITitleListAccessorInternalVTable mVTable{}; +}; + +details::ITitleListAccessorBase & +GetDefaultTitleListAccessor(); } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/ITransferrer.h b/include/nn/sl/ITransferrer.h index fc3c3aef3..f4082ed1e 100644 --- a/include/nn/sl/ITransferrer.h +++ b/include/nn/sl/ITransferrer.h @@ -1,72 +1,95 @@ #pragma once +#include #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class ITransferrer : public details::ITransferrerBase { +namespace nn::sl +{ +class ITransferrer : public details::ITransferrerBase +{ - public: - ITransferrer() { - InitInternalVtable(); - } +public: + ITransferrer() + { + InitInternalVtable(); + } - ITransferrer(ITransferrer &src) { - InitInternalVtable(); - } + ITransferrer(ITransferrer &src) + { + InitInternalVtable(); + } - ITransferrer &operator=(const ITransferrer &other) { - InitInternalVtable(); - return *this; - } + ITransferrer & + operator=(const ITransferrer &other) + { + InitInternalVtable(); + return *this; + } - ITransferrer &operator=(ITransferrer &&src) noexcept { - InitInternalVtable(); - return *this; - } + ITransferrer & + operator=(ITransferrer &&src) noexcept + { + InitInternalVtable(); + return *this; + } - ~ITransferrer() override = default; + ~ITransferrer() override = default; - private: - static nn::Result TransferDeprecatedWrapper(details::ITransferrerInternal *instance, void *buffer, uint32_t size, bool setKillerNotification, int transferMode) { - return instance->vtable->instance->TransferDeprecated(buffer, size, setKillerNotification, transferMode); - } - static nn::Result TransferWrapper(details::ITransferrerInternal *instance, void *buffer, uint32_t size, bool setKillerNotification, TransferMode transferMode) { - return instance->vtable->instance->Transfer(buffer, size, setKillerNotification, transferMode); - } - static nn::Result CancelTransferWrapper(details::ITransferrerInternal *instance) { - return instance->vtable->instance->CancelTransfer(); - } - static nn::Result InvalidateNotificationWrapper(details::ITransferrerInternal *instance, uint32_t u1) { - return instance->vtable->instance->InvalidateNotification(u1); - } - static nn::Result DisplayNotificationWrapper(details::ITransferrerInternal *instance, uint32_t u1, uint32_t u2, uint32_t u3) { - return instance->vtable->instance->DisplayNotification(u1, u2, u3); - } +private: + static nn::Result + TransferDeprecatedWrapper(details::ITransferrerInternal *instance, void *buffer, uint32_t size, bool setKillerNotification, int transferMode) + { + return instance->vtable->instance->TransferDeprecated(buffer, size, setKillerNotification, transferMode); + } + static nn::Result + TransferWrapper(details::ITransferrerInternal *instance, void *buffer, uint32_t size, bool setKillerNotification, TransferMode transferMode) + { + return instance->vtable->instance->Transfer(buffer, size, setKillerNotification, transferMode); + } + static nn::Result + CancelTransferWrapper(details::ITransferrerInternal *instance) + { + return instance->vtable->instance->CancelTransfer(); + } + static nn::Result + InvalidateNotificationWrapper(details::ITransferrerInternal *instance, uint32_t u1) + { + return instance->vtable->instance->InvalidateNotification(u1); + } + static nn::Result + DisplayNotificationWrapper(details::ITransferrerInternal *instance, uint32_t u1, uint32_t u2, uint32_t u3) + { + return instance->vtable->instance->DisplayNotification(u1, u2, u3); + } - details::ITransferrerInternal *GetInternal() override { - return &mInstance; - } + details::ITransferrerInternal * + GetInternal() override + { + return &mInstance; + } - void InitInternalVtable() { - mVTable = {.instance = this, - .TransferDeprecatedFn = &TransferDeprecatedWrapper, - .TransferFn = &TransferWrapper, - .CancelTransferFn = &CancelTransferWrapper, - .InvalidateNotificationFn = &InvalidateNotificationWrapper, - .DisplayNotificationFn = &DisplayNotificationWrapper}; - mInstance.vtable = &mVTable; - } + void + InitInternalVtable() + { + mVTable = {.instance = this, + .TransferDeprecatedFn = &TransferDeprecatedWrapper, + .TransferFn = &TransferWrapper, + .CancelTransferFn = &CancelTransferWrapper, + .InvalidateNotificationFn = &InvalidateNotificationWrapper, + .DisplayNotificationFn = &DisplayNotificationWrapper}; + mInstance.vtable = &mVTable; + } - details::ITransferrerInternal mInstance{}; - details::ITransferrerInternalVTable mVTable{}; - }; + details::ITransferrerInternal mInstance{}; + details::ITransferrerInternalVTable mVTable{}; +}; - details::ITransferrerBase &GetDrcTransferrer(); +details::ITransferrerBase & +GetDrcTransferrer(); } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/IUpdatePackageAccessor.h b/include/nn/sl/IUpdatePackageAccessor.h index 484d6dd24..5c3df820e 100644 --- a/include/nn/sl/IUpdatePackageAccessor.h +++ b/include/nn/sl/IUpdatePackageAccessor.h @@ -1,59 +1,76 @@ #pragma once +#include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class IUpdatePackageAccessor : public details::IUpdatePackageAccessorBase { - - public: - IUpdatePackageAccessor() { - InitInternalVtable(); - } - - IUpdatePackageAccessor(IUpdatePackageAccessor &src) { - InitInternalVtable(); - } - - IUpdatePackageAccessor &operator=(const IUpdatePackageAccessor &other) { - InitInternalVtable(); - return *this; - } - - IUpdatePackageAccessor &operator=(IUpdatePackageAccessor &&src) noexcept { - InitInternalVtable(); - return *this; - } - - ~IUpdatePackageAccessor() override = default; - - private: - static bool PackageExistsWrapper(details::IUpdatePackageAccessorInternal *instance) { - return instance->vtable->instance->PackageExists(); - } - static bool IsUpdatePackageDownloadedWrapper(details::IUpdatePackageAccessorInternal *instance) { - return instance->vtable->instance->IsUpdatePackageDownloaded(); - } - - details::IUpdatePackageAccessorInternal *GetInternal() override { - return &mInstance; - } - - void InitInternalVtable() { - mVTable = {.instance = this, - .PackageExistsFn = PackageExistsWrapper, - .IsUpdatePackageDownloadedFn = IsUpdatePackageDownloadedWrapper}; - mInstance.vtable = &mVTable; - } - - details::IUpdatePackageAccessorInternal mInstance{}; - details::IUpdatePackageAccessorInternalVTable mVTable{}; - }; - - details::IUpdatePackageAccessorBase &GetDefaultUpdatePackageAccessor(); +namespace nn::sl +{ +class IUpdatePackageAccessor : public details::IUpdatePackageAccessorBase +{ + +public: + IUpdatePackageAccessor() + { + InitInternalVtable(); + } + + IUpdatePackageAccessor(IUpdatePackageAccessor &src) + { + InitInternalVtable(); + } + + IUpdatePackageAccessor & + operator=(const IUpdatePackageAccessor &other) + { + InitInternalVtable(); + return *this; + } + + IUpdatePackageAccessor & + operator=(IUpdatePackageAccessor &&src) noexcept + { + InitInternalVtable(); + return *this; + } + + ~IUpdatePackageAccessor() override = default; + +private: + static bool + PackageExistsWrapper(details::IUpdatePackageAccessorInternal *instance) + { + return instance->vtable->instance->PackageExists(); + } + static bool + IsUpdatePackageDownloadedWrapper(details::IUpdatePackageAccessorInternal *instance) + { + return instance->vtable->instance->IsUpdatePackageDownloaded(); + } + + details::IUpdatePackageAccessorInternal * + GetInternal() override + { + return &mInstance; + } + + void + InitInternalVtable() + { + mVTable = {.instance = this, + .PackageExistsFn = PackageExistsWrapper, + .IsUpdatePackageDownloadedFn = IsUpdatePackageDownloadedWrapper}; + mInstance.vtable = &mVTable; + } + + details::IUpdatePackageAccessorInternal mInstance{}; + details::IUpdatePackageAccessorInternalVTable mVTable{}; +}; + +details::IUpdatePackageAccessorBase & +GetDefaultUpdatePackageAccessor(); } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/IWhiteListAccessor.h b/include/nn/sl/IWhiteListAccessor.h index 5e79074ba..72dae2762 100644 --- a/include/nn/sl/IWhiteListAccessor.h +++ b/include/nn/sl/IWhiteListAccessor.h @@ -1,58 +1,73 @@ #pragma once +#include #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - - class IWhiteListAccessor : public details::IWhiteListAccessorBase { - - public: - IWhiteListAccessor() { - InitInternalVtable(); - } - - IWhiteListAccessor(IWhiteListAccessor &src) { - InitInternalVtable(); - } - - IWhiteListAccessor &operator=(const IWhiteListAccessor &other) { - InitInternalVtable(); - return *this; - } - - IWhiteListAccessor &operator=(IWhiteListAccessor &&src) noexcept { - InitInternalVtable(); - return *this; - } - - ~IWhiteListAccessor() override = default; - - private: - static nn::Result GetWrapper(details::IWhiteListAccessorInternal *instance, nn::sl::WhiteList *outWhiteList) { - return instance->vtable->instance->Get(outWhiteList); - } - - details::IWhiteListAccessorInternal *GetInternal() override { - return &mInstance; - } - - void InitInternalVtable() { - - mVTable = {.instance = this, - .GetFn = &GetWrapper}; - mInstance.vtable = &mVTable; - } - - details::IWhiteListAccessorInternal mInstance{}; - details::IWhiteListAccessorInternalVTable mVTable{}; - }; - - details::IWhiteListAccessorBase &GetDefaultWhiteListAccessor(); +namespace nn::sl +{ + +class IWhiteListAccessor : public details::IWhiteListAccessorBase +{ + +public: + IWhiteListAccessor() + { + InitInternalVtable(); + } + + IWhiteListAccessor(IWhiteListAccessor &src) + { + InitInternalVtable(); + } + + IWhiteListAccessor & + operator=(const IWhiteListAccessor &other) + { + InitInternalVtable(); + return *this; + } + + IWhiteListAccessor & + operator=(IWhiteListAccessor &&src) noexcept + { + InitInternalVtable(); + return *this; + } + + ~IWhiteListAccessor() override = default; + +private: + static nn::Result + GetWrapper(details::IWhiteListAccessorInternal *instance, nn::sl::WhiteList *outWhiteList) + { + return instance->vtable->instance->Get(outWhiteList); + } + + details::IWhiteListAccessorInternal * + GetInternal() override + { + return &mInstance; + } + + void + InitInternalVtable() + { + + mVTable = {.instance = this, + .GetFn = &GetWrapper}; + mInstance.vtable = &mVTable; + } + + details::IWhiteListAccessorInternal mInstance{}; + details::IWhiteListAccessorInternalVTable mVTable{}; +}; + +details::IWhiteListAccessorBase & +GetDefaultWhiteListAccessor(); } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/KillerNotification.h b/include/nn/sl/KillerNotification.h index 02da2f28e..d820ef39a 100644 --- a/include/nn/sl/KillerNotification.h +++ b/include/nn/sl/KillerNotification.h @@ -1,205 +1,235 @@ #pragma once -#include "sl_cpp.h" +#include #include #include -#include +#include "sl_cpp.h" #ifdef __cplusplus -namespace nn::sl { - struct KillerNotification; - namespace details { - extern "C" nn::Result __CPR81__CheckEmptyValue__Q3_2nn2sl18KillerNotificationSFPbPCQ3_2nn2slJ26J(bool *u1, const KillerNotification *u2); - extern "C" void __CPR76__GetEmptyValue__Q3_2nn2sl18KillerNotificationSFPQ3_2nn2slJ24J(KillerNotification *u1); - } // namespace details - - typedef enum KillerNotificationType { - PROMOTION = 0, - PUSH_APP = 1, - NON_COMMERCIAL = 2 - } KillerNotificationType; - - typedef enum KillerNotificationNotificationPattern { - NORMAL = 0, - SILENT = 1 - } KillerNotificationNotificationPattern; - - typedef enum KillerNotificationGender { - UNKNOWN = 0, - MALE = 1, - FEMALE = 2 - } KillerNotificationGender; - - typedef enum KillerNotificationAllowLocalAccount : int8_t { - ALLOW = 0, - NOT_ALLOW = 1 - } KillerNotificationAllowLocalAccount; - - typedef enum KillerNotificationAccountMailActivation : int8_t { - NOT_ACTIVATED = 0, - ANYBODY = 1 - } KillerNotificationAccountMailActivation; - - typedef enum KillerNotificationConjunction { - AND = 0, - OR = 1 - } KillerNotificationConjunction; - - struct WUT_PACKED KillerNotificationInstalledTitleFilter { - uint64_t titleId; - KillerNotificationConjunction conjunction; - }; - WUT_CHECK_SIZE(KillerNotificationInstalledTitleFilter, 0x0C); - WUT_CHECK_OFFSET(KillerNotificationInstalledTitleFilter, 0x00, titleId); - WUT_CHECK_OFFSET(KillerNotificationInstalledTitleFilter, 0x08, conjunction); - - struct WUT_PACKED KillerNotificationPlayedTitleFilter { - uint64_t titleId; - enum KillerNotificationConjunction conjunction; - }; - WUT_CHECK_SIZE(KillerNotificationPlayedTitleFilter, 0x0C); - WUT_CHECK_OFFSET(KillerNotificationPlayedTitleFilter, 0x00, titleId); - WUT_CHECK_OFFSET(KillerNotificationPlayedTitleFilter, 0x08, conjunction); - - struct WUT_PACKED KillerNotificationTitleFilter { - uint64_t titleId; - WUT_UNKNOWN_BYTES(4); - int32_t played; - WUT_UNKNOWN_BYTES(4); - int32_t installed; - }; - WUT_CHECK_SIZE(KillerNotificationTitleFilter, 0x18); - WUT_CHECK_OFFSET(KillerNotificationTitleFilter, 0x0C, played); - WUT_CHECK_OFFSET(KillerNotificationTitleFilter, 0x14, installed); - - - struct WUT_PACKED KillerNotification { - uint32_t serialId; - uint32_t version; - WUT_UNKNOWN_BYTES(16); - bool deleteFlag; - char language[4]; - WUT_UNKNOWN_BYTES(3); - KillerNotificationType type; - KillerNotificationNotificationPattern notificationPattern; - struct { - uint64_t titleId; - char parameter[2048]; - } launchApplication; - uint32_t priority; - struct { - struct { - DRCImagePalette palette; // the "main" image actually uses the button palette in the quick start menu - uint8_t pixels[400][854]; // index of color in (button) palette - 854x400 - } main; - struct { - DRCImagePalette palette; - uint8_t pixels[160][487]; // index of color in palette - 487*160 - } button; - WUT_PADDING_BYTES(0); - char banner[290416]; // BMP! 854×85, Bit depth: 32 - } images; - struct { - WUT_UNKNOWN_BYTES(12); - struct WUT_PACKED { - uint64_t startUnixTime; - uint64_t endUnixTime; - } duration; - WUT_UNKNOWN_BYTES(4); - uint32_t lifetime; - WUT_UNKNOWN_BYTES(4); - struct { - struct { - uint32_t lowerBound; - uint32_t upperBound; - } age; - KillerNotificationGender gender; - } account; - struct { - uint32_t titleCount; - WUT_UNKNOWN_BYTES(4); - KillerNotificationTitleFilter titles[2]; - } titleFilter; - WUT_UNKNOWN_BYTES(1); - struct WUT_PACKED { - KillerNotificationAllowLocalAccount allowLocalAccount; - WUT_UNKNOWN_BYTES(2); - uint32_t ageRestrictionLowerBound; - } ageRestriction; - KillerNotificationAccountMailActivation accountMailActivation; - - WUT_UNKNOWN_BYTES(11); - uint32_t accountBirthMonth; - WUT_UNKNOWN_BYTES(4); - int8_t anticipatoryDownload; - WUT_UNKNOWN_BYTES(15); - struct { - int32_t installedTitleCount; - enum KillerNotificationConjunction installedConjunction; - WUT_UNKNOWN_BYTES(4); - struct KillerNotificationInstalledTitleFilter installedTitleFilter[2]; - }; - WUT_UNKNOWN_BYTES(12); - struct { - uint32_t playedTitleFilterCount; - enum KillerNotificationConjunction playedConjunction; - WUT_UNKNOWN_BYTES(4); - uint32_t played_duration_sinceUnixTime; - WUT_UNKNOWN_BYTES(4); - KillerNotificationPlayedTitleFilter playedTitleFilter[2]; - }; - } displayCondition; - WUT_UNKNOWN_BYTES(8); - uint32_t formatVersion; - uint32_t tags; - WUT_UNKNOWN_BYTES(256); - - static nn::Result CheckEmptyValue(bool *outRes, const KillerNotification *u2) { - return details::__CPR81__CheckEmptyValue__Q3_2nn2sl18KillerNotificationSFPbPCQ3_2nn2slJ26J(outRes, u2); - } - - static void GetEmptyValue(KillerNotification *u1) { - return details::__CPR76__GetEmptyValue__Q3_2nn2sl18KillerNotificationSFPQ3_2nn2slJ24J(u1); - } - }; - WUT_CHECK_SIZE(KillerNotification, 0xae768); - WUT_CHECK_OFFSET(KillerNotification, 0x0, serialId); - WUT_CHECK_OFFSET(KillerNotification, 0x04, version); - WUT_CHECK_OFFSET(KillerNotification, 0x18, deleteFlag); - WUT_CHECK_OFFSET(KillerNotification, 0x20, type); - WUT_CHECK_OFFSET(KillerNotification, 0x24, notificationPattern); - WUT_CHECK_OFFSET(KillerNotification, 0x28, launchApplication.titleId); - WUT_CHECK_OFFSET(KillerNotification, 0x30, launchApplication.parameter); - WUT_CHECK_OFFSET(KillerNotification, 0x830, priority); - WUT_CHECK_OFFSET(KillerNotification, 0x834, images); - WUT_CHECK_OFFSET(KillerNotification, 0x834, images.main); - WUT_CHECK_OFFSET(KillerNotification, 0x834 + 0x400, images.main.pixels); - WUT_CHECK_OFFSET(KillerNotification, 0x54294, images.button); - WUT_CHECK_OFFSET(KillerNotification, 0x54294 + 0x400, images.button.pixels); - WUT_CHECK_OFFSET(KillerNotification, 0x676f4, images.banner); - WUT_CHECK_OFFSET(KillerNotification, 0xae570, displayCondition.duration.startUnixTime); - WUT_CHECK_OFFSET(KillerNotification, 0xae578, displayCondition.duration.endUnixTime); - WUT_CHECK_OFFSET(KillerNotification, 0xae584, displayCondition.lifetime); - WUT_CHECK_OFFSET(KillerNotification, 0xae58C, displayCondition.account.age.lowerBound); - WUT_CHECK_OFFSET(KillerNotification, 0xae590, displayCondition.account.age.upperBound); - WUT_CHECK_OFFSET(KillerNotification, 0xae594, displayCondition.account.gender); - WUT_CHECK_OFFSET(KillerNotification, 0xae598, displayCondition.titleFilter.titleCount); - WUT_CHECK_OFFSET(KillerNotification, 0xae5a0, displayCondition.titleFilter.titles); - WUT_CHECK_OFFSET(KillerNotification, 0xae5d1, displayCondition.ageRestriction.allowLocalAccount); - WUT_CHECK_OFFSET(KillerNotification, 0xae5d4, displayCondition.ageRestriction.ageRestrictionLowerBound); - WUT_CHECK_OFFSET(KillerNotification, 0xae5d8, displayCondition.accountMailActivation); - WUT_CHECK_OFFSET(KillerNotification, 0xae5e4, displayCondition.accountBirthMonth); - WUT_CHECK_OFFSET(KillerNotification, 0xae5ec, displayCondition.anticipatoryDownload); - WUT_CHECK_OFFSET(KillerNotification, 0xae5fc, displayCondition.installedTitleCount); - WUT_CHECK_OFFSET(KillerNotification, 0xae600, displayCondition.installedConjunction); - WUT_CHECK_OFFSET(KillerNotification, 0xae608, displayCondition.installedTitleFilter); - WUT_CHECK_OFFSET(KillerNotification, 0xae62c, displayCondition.playedTitleFilterCount); - WUT_CHECK_OFFSET(KillerNotification, 0xae630, displayCondition.playedConjunction); - WUT_CHECK_OFFSET(KillerNotification, 0xae638, displayCondition.played_duration_sinceUnixTime); - WUT_CHECK_OFFSET(KillerNotification, 0xae640, displayCondition.playedTitleFilter); - WUT_CHECK_OFFSET(KillerNotification, 0xae660, formatVersion); - WUT_CHECK_OFFSET(KillerNotification, 0xae664, tags); +namespace nn::sl +{ +struct KillerNotification; +namespace details +{ +extern "C" nn::Result +__CPR81__CheckEmptyValue__Q3_2nn2sl18KillerNotificationSFPbPCQ3_2nn2slJ26J(bool *u1, const KillerNotification *u2); +extern "C" void +__CPR76__GetEmptyValue__Q3_2nn2sl18KillerNotificationSFPQ3_2nn2slJ24J(KillerNotification *u1); +} // namespace details + +typedef enum KillerNotificationType +{ + PROMOTION = 0, + PUSH_APP = 1, + NON_COMMERCIAL = 2 +} KillerNotificationType; + +typedef enum KillerNotificationNotificationPattern +{ + NORMAL = 0, + SILENT = 1 +} KillerNotificationNotificationPattern; + +typedef enum KillerNotificationGender +{ + UNKNOWN = 0, + MALE = 1, + FEMALE = 2 +} KillerNotificationGender; + +typedef enum KillerNotificationAllowLocalAccount : int8_t +{ + ALLOW = 0, + NOT_ALLOW = 1 +} KillerNotificationAllowLocalAccount; + +typedef enum KillerNotificationAccountMailActivation : int8_t +{ + NOT_ACTIVATED = 0, + ANYBODY = 1 +} KillerNotificationAccountMailActivation; + +typedef enum KillerNotificationConjunction +{ + AND = 0, + OR = 1 +} KillerNotificationConjunction; + +struct WUT_PACKED KillerNotificationInstalledTitleFilter +{ + uint64_t titleId; + KillerNotificationConjunction conjunction; +}; +WUT_CHECK_SIZE(KillerNotificationInstalledTitleFilter, 0x0C); +WUT_CHECK_OFFSET(KillerNotificationInstalledTitleFilter, 0x00, titleId); +WUT_CHECK_OFFSET(KillerNotificationInstalledTitleFilter, 0x08, conjunction); + +struct WUT_PACKED KillerNotificationPlayedTitleFilter +{ + uint64_t titleId; + enum KillerNotificationConjunction conjunction; +}; +WUT_CHECK_SIZE(KillerNotificationPlayedTitleFilter, 0x0C); +WUT_CHECK_OFFSET(KillerNotificationPlayedTitleFilter, 0x00, titleId); +WUT_CHECK_OFFSET(KillerNotificationPlayedTitleFilter, 0x08, conjunction); + +struct WUT_PACKED KillerNotificationTitleFilter +{ + uint64_t titleId; + WUT_UNKNOWN_BYTES(4); + int32_t played; + WUT_UNKNOWN_BYTES(4); + int32_t installed; +}; +WUT_CHECK_SIZE(KillerNotificationTitleFilter, 0x18); +WUT_CHECK_OFFSET(KillerNotificationTitleFilter, 0x0C, played); +WUT_CHECK_OFFSET(KillerNotificationTitleFilter, 0x14, installed); + + +struct WUT_PACKED KillerNotification +{ + uint32_t serialId; + uint32_t version; + WUT_UNKNOWN_BYTES(16); + bool deleteFlag; + char language[4]; + WUT_UNKNOWN_BYTES(3); + KillerNotificationType type; + KillerNotificationNotificationPattern notificationPattern; + struct + { + uint64_t titleId; + char parameter[2048]; + } launchApplication; + uint32_t priority; + struct + { + struct + { + DRCImagePalette palette; // the "main" image actually uses the button palette in the quick start menu + uint8_t pixels[400][854]; // index of color in (button) palette - 854x400 + } main; + struct + { + DRCImagePalette palette; + uint8_t pixels[160][487]; // index of color in palette - 487*160 + } button; + WUT_PADDING_BYTES(0); + char banner[290416]; // BMP! 854×85, Bit depth: 32 + } images; + struct + { + WUT_UNKNOWN_BYTES(12); + struct WUT_PACKED + { + uint64_t startUnixTime; + uint64_t endUnixTime; + } duration; + WUT_UNKNOWN_BYTES(4); + uint32_t lifetime; + WUT_UNKNOWN_BYTES(4); + struct + { + struct + { + uint32_t lowerBound; + uint32_t upperBound; + } age; + KillerNotificationGender gender; + } account; + struct + { + uint32_t titleCount; + WUT_UNKNOWN_BYTES(4); + KillerNotificationTitleFilter titles[2]; + } titleFilter; + WUT_UNKNOWN_BYTES(1); + struct WUT_PACKED + { + KillerNotificationAllowLocalAccount allowLocalAccount; + WUT_UNKNOWN_BYTES(2); + uint32_t ageRestrictionLowerBound; + } ageRestriction; + KillerNotificationAccountMailActivation accountMailActivation; + + WUT_UNKNOWN_BYTES(11); + uint32_t accountBirthMonth; + WUT_UNKNOWN_BYTES(4); + int8_t anticipatoryDownload; + WUT_UNKNOWN_BYTES(15); + struct + { + int32_t installedTitleCount; + enum KillerNotificationConjunction installedConjunction; + WUT_UNKNOWN_BYTES(4); + struct KillerNotificationInstalledTitleFilter installedTitleFilter[2]; + }; + WUT_UNKNOWN_BYTES(12); + struct + { + uint32_t playedTitleFilterCount; + enum KillerNotificationConjunction playedConjunction; + WUT_UNKNOWN_BYTES(4); + uint32_t played_duration_sinceUnixTime; + WUT_UNKNOWN_BYTES(4); + KillerNotificationPlayedTitleFilter playedTitleFilter[2]; + }; + } displayCondition; + WUT_UNKNOWN_BYTES(8); + uint32_t formatVersion; + uint32_t tags; + WUT_UNKNOWN_BYTES(256); + + static nn::Result + CheckEmptyValue(bool *outRes, const KillerNotification *u2) + { + return details::__CPR81__CheckEmptyValue__Q3_2nn2sl18KillerNotificationSFPbPCQ3_2nn2slJ26J(outRes, u2); + } + + static void + GetEmptyValue(KillerNotification *u1) + { + return details::__CPR76__GetEmptyValue__Q3_2nn2sl18KillerNotificationSFPQ3_2nn2slJ24J(u1); + } +}; +WUT_CHECK_SIZE(KillerNotification, 0xae768); +WUT_CHECK_OFFSET(KillerNotification, 0x0, serialId); +WUT_CHECK_OFFSET(KillerNotification, 0x04, version); +WUT_CHECK_OFFSET(KillerNotification, 0x18, deleteFlag); +WUT_CHECK_OFFSET(KillerNotification, 0x20, type); +WUT_CHECK_OFFSET(KillerNotification, 0x24, notificationPattern); +WUT_CHECK_OFFSET(KillerNotification, 0x28, launchApplication.titleId); +WUT_CHECK_OFFSET(KillerNotification, 0x30, launchApplication.parameter); +WUT_CHECK_OFFSET(KillerNotification, 0x830, priority); +WUT_CHECK_OFFSET(KillerNotification, 0x834, images); +WUT_CHECK_OFFSET(KillerNotification, 0x834, images.main); +WUT_CHECK_OFFSET(KillerNotification, 0x834 + 0x400, images.main.pixels); +WUT_CHECK_OFFSET(KillerNotification, 0x54294, images.button); +WUT_CHECK_OFFSET(KillerNotification, 0x54294 + 0x400, images.button.pixels); +WUT_CHECK_OFFSET(KillerNotification, 0x676f4, images.banner); +WUT_CHECK_OFFSET(KillerNotification, 0xae570, displayCondition.duration.startUnixTime); +WUT_CHECK_OFFSET(KillerNotification, 0xae578, displayCondition.duration.endUnixTime); +WUT_CHECK_OFFSET(KillerNotification, 0xae584, displayCondition.lifetime); +WUT_CHECK_OFFSET(KillerNotification, 0xae58C, displayCondition.account.age.lowerBound); +WUT_CHECK_OFFSET(KillerNotification, 0xae590, displayCondition.account.age.upperBound); +WUT_CHECK_OFFSET(KillerNotification, 0xae594, displayCondition.account.gender); +WUT_CHECK_OFFSET(KillerNotification, 0xae598, displayCondition.titleFilter.titleCount); +WUT_CHECK_OFFSET(KillerNotification, 0xae5a0, displayCondition.titleFilter.titles); +WUT_CHECK_OFFSET(KillerNotification, 0xae5d1, displayCondition.ageRestriction.allowLocalAccount); +WUT_CHECK_OFFSET(KillerNotification, 0xae5d4, displayCondition.ageRestriction.ageRestrictionLowerBound); +WUT_CHECK_OFFSET(KillerNotification, 0xae5d8, displayCondition.accountMailActivation); +WUT_CHECK_OFFSET(KillerNotification, 0xae5e4, displayCondition.accountBirthMonth); +WUT_CHECK_OFFSET(KillerNotification, 0xae5ec, displayCondition.anticipatoryDownload); +WUT_CHECK_OFFSET(KillerNotification, 0xae5fc, displayCondition.installedTitleCount); +WUT_CHECK_OFFSET(KillerNotification, 0xae600, displayCondition.installedConjunction); +WUT_CHECK_OFFSET(KillerNotification, 0xae608, displayCondition.installedTitleFilter); +WUT_CHECK_OFFSET(KillerNotification, 0xae62c, displayCondition.playedTitleFilterCount); +WUT_CHECK_OFFSET(KillerNotification, 0xae630, displayCondition.playedConjunction); +WUT_CHECK_OFFSET(KillerNotification, 0xae638, displayCondition.played_duration_sinceUnixTime); +WUT_CHECK_OFFSET(KillerNotification, 0xae640, displayCondition.playedTitleFilter); +WUT_CHECK_OFFSET(KillerNotification, 0xae660, formatVersion); +WUT_CHECK_OFFSET(KillerNotification, 0xae664, tags); } // namespace nn::sl diff --git a/include/nn/sl/KillerNotificationSelector.h b/include/nn/sl/KillerNotificationSelector.h index f53424b2c..15ce1937d 100644 --- a/include/nn/sl/KillerNotificationSelector.h +++ b/include/nn/sl/KillerNotificationSelector.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -11,152 +12,182 @@ #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - namespace details { - typedef struct WUT_PACKED KillerNotificationSelectorInternal { - ILaunchedTitleListAccessorInternal *launchedTitleListAccessor; - IKillerNotificationAccessorInternal *killerNotificationAccessor; - ITitleListCacheInternal *titleListCache; - ISerializerInternal *killerNotificationSerializer; - ISettingAccessorInternal *settingsAccessor; - IAccountInfoAccessorInternal *accountInfoAccessor; - ITimeAccessorInternal *timeAccessor; - IKillerNotificationTransferRecordManagerInternal *killerNotificationTransferRecordManager; - void *vtable; - } KillerNotificationSelectorInternal; - WUT_CHECK_SIZE(KillerNotificationSelectorInternal, 0x24); - WUT_CHECK_OFFSET(KillerNotificationSelectorInternal, 0x00, launchedTitleListAccessor); - WUT_CHECK_OFFSET(KillerNotificationSelectorInternal, 0x04, killerNotificationAccessor); - WUT_CHECK_OFFSET(KillerNotificationSelectorInternal, 0x08, titleListCache); - WUT_CHECK_OFFSET(KillerNotificationSelectorInternal, 0x0C, killerNotificationSerializer); - WUT_CHECK_OFFSET(KillerNotificationSelectorInternal, 0x10, settingsAccessor); - WUT_CHECK_OFFSET(KillerNotificationSelectorInternal, 0x14, accountInfoAccessor); - WUT_CHECK_OFFSET(KillerNotificationSelectorInternal, 0x18, timeAccessor); - WUT_CHECK_OFFSET(KillerNotificationSelectorInternal, 0x1C, killerNotificationTransferRecordManager); - WUT_CHECK_OFFSET(KillerNotificationSelectorInternal, 0x20, vtable); - - extern "C" KillerNotificationSelectorInternal *__ct__Q3_2nn2sl26KillerNotificationSelectorFv(KillerNotificationSelectorInternal *); - extern "C" void __dt__Q3_2nn2sl26KillerNotificationSelectorFv(KillerNotificationSelectorInternal *, int); - extern "C" nn::Result Select__Q3_2nn2sl26KillerNotificationSelectorFPQ3_2nn2sl18KillerNotificationPQ3_2nn2sl9TitleInfoPb(KillerNotificationSelectorInternal *, KillerNotification *, TitleInfo *, bool *); - extern "C" void Initialize__Q3_2nn2sl26KillerNotificationSelectorFRQ3_2nn2sl26ILaunchedTitleListAccessorRQ3_2nn2sl27IKillerNotificationAccessorRQ3_2nn2sl14TitleListCacheRQ3_2nn2sl49ISerializer__tm__30_Q3_2nn2sl18KillerNotificationRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl20IAccountInfoAccessorRQ3_2nn2sl13ITimeAccessorRQ3_2nn2sl40IKillerNotificationTransferRecordManager( - KillerNotificationSelectorInternal *, - ILaunchedTitleListAccessorInternal *, - IKillerNotificationAccessorInternal *, - ITitleListCacheInternal *, - ISerializerInternal *, - ISettingAccessorInternal *, - IAccountInfoAccessorInternal *, - ITimeAccessorInternal *, - IKillerNotificationTransferRecordManagerInternal *); - } // namespace details - - class KillerNotificationSelector { - public: - KillerNotificationSelector() : mLaunchedTitleListAccessor(nullptr), - mKillerNotificationAccessor(nullptr), - mTitleListCache(nullptr), - mKillerNotificationSerializer(nullptr), - mSettingAccessor(nullptr), - mAccountInfoAccessor(nullptr), - mTimeAccessor(nullptr), - mKillerNotificationTransferRecordManager(nullptr) { - if (__ct__Q3_2nn2sl26KillerNotificationSelectorFv(&mInstance) != nullptr) { - mLaunchedTitleListAccessor = details::LaunchedTitleListAccessorFromPtr(mInstance.launchedTitleListAccessor); - mKillerNotificationAccessor = details::KillerNotificationAccessorFromPtr(mInstance.killerNotificationAccessor); - mTitleListCache = TitleListCacheFromPtr(mInstance.titleListCache); - mKillerNotificationSerializer = details::SerializerFromPtr(mInstance.killerNotificationSerializer); - mSettingAccessor = details::SettingAccessorFromPtr(mInstance.settingsAccessor); - mAccountInfoAccessor = details::AccountInfoAccessorFromPtr(mInstance.accountInfoAccessor); - mTimeAccessor = details::TimeAccessorFromPtr(mInstance.timeAccessor); - mKillerNotificationTransferRecordManager = details::KillerNotificationTransferRecordManagerFromPtr(mInstance.killerNotificationTransferRecordManager); - } - } - - ~KillerNotificationSelector() { - __dt__Q3_2nn2sl26KillerNotificationSelectorFv(&mInstance, 2); - } - - details::ILaunchedTitleListAccessorBase &GetLaunchedTitleListAccessor() { - return mLaunchedTitleListAccessor; - } - - details::IKillerNotificationAccessorBase &GetKillerNotificationAccessor() { - return mKillerNotificationAccessor; - } - - details::ITitleListCacheBase &GetTitleListCache() { - return mTitleListCache; - } - - details::ISerializerBase &GetKillerNotificationSerializer() { - return mKillerNotificationSerializer; - } - - details::ISettingAccessorBase &GetSettingAccessor() { - return mSettingAccessor; - } - - details::IAccountInfoAccessorBase &GetAccountInfoAccessor() { - return mAccountInfoAccessor; - } - - details::ITimeAccessorBase &GetTimeAccessor() { - return mTimeAccessor; - } - - details::IKillerNotificationTransferRecordManagerBase &GetKillerNotificationTransferRecordManager() { - return mKillerNotificationTransferRecordManager; - } - - nn::Result Select(KillerNotification *outKillerNotification, TitleInfo *outKillerNotificationTitle, bool *u1) { - return Select__Q3_2nn2sl26KillerNotificationSelectorFPQ3_2nn2sl18KillerNotificationPQ3_2nn2sl9TitleInfoPb(&mInstance, outKillerNotification, outKillerNotificationTitle, u1); - } - - void Initialize(details::ILaunchedTitleListAccessorBase &launchedTitleListAccessor, - details::IKillerNotificationAccessorBase &killerNotificationAccessor, - details::ITitleListCacheBase &titleListCache, - details::ISerializerBase &killerNotificationSerializer, - details::ISettingAccessorBase &settingAccessor, - details::IAccountInfoAccessorBase &accountInfoAccessor, - details::ITimeAccessorBase &timeAccessor, - details::IKillerNotificationTransferRecordManagerBase &killerNotificationTransferRecordManager) { - Initialize__Q3_2nn2sl26KillerNotificationSelectorFRQ3_2nn2sl26ILaunchedTitleListAccessorRQ3_2nn2sl27IKillerNotificationAccessorRQ3_2nn2sl14TitleListCacheRQ3_2nn2sl49ISerializer__tm__30_Q3_2nn2sl18KillerNotificationRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl20IAccountInfoAccessorRQ3_2nn2sl13ITimeAccessorRQ3_2nn2sl40IKillerNotificationTransferRecordManager( - &mInstance, - launchedTitleListAccessor.GetInternal(), - killerNotificationAccessor.GetInternal(), - titleListCache.GetInternal(), - killerNotificationSerializer.GetInternal(), - settingAccessor.GetInternal(), - accountInfoAccessor.GetInternal(), - timeAccessor.GetInternal(), - killerNotificationTransferRecordManager.GetInternal()); - - mLaunchedTitleListAccessor = details::LaunchedTitleListAccessorFromPtr(launchedTitleListAccessor.GetInternal()); - mKillerNotificationAccessor = details::KillerNotificationAccessorFromPtr(killerNotificationAccessor.GetInternal()); - mTitleListCache = TitleListCacheFromPtr(titleListCache.GetInternal()); - mKillerNotificationSerializer = details::SerializerFromPtr(killerNotificationSerializer.GetInternal()); - mSettingAccessor = details::SettingAccessorFromPtr(settingAccessor.GetInternal()); - mAccountInfoAccessor = details::AccountInfoAccessorFromPtr(accountInfoAccessor.GetInternal()); - mTimeAccessor = details::TimeAccessorFromPtr(timeAccessor.GetInternal()); - mKillerNotificationTransferRecordManager = details::KillerNotificationTransferRecordManagerFromPtr(killerNotificationTransferRecordManager.GetInternal()); - } - - private: - details::KillerNotificationSelectorInternal mInstance = {}; - - details::LaunchedTitleListAccessorFromPtr mLaunchedTitleListAccessor; - details::KillerNotificationAccessorFromPtr mKillerNotificationAccessor; - TitleListCacheFromPtr mTitleListCache; - details::SerializerFromPtr mKillerNotificationSerializer; - details::SettingAccessorFromPtr mSettingAccessor; - details::AccountInfoAccessorFromPtr mAccountInfoAccessor; - details::TimeAccessorFromPtr mTimeAccessor; - details::KillerNotificationTransferRecordManagerFromPtr mKillerNotificationTransferRecordManager; - }; +namespace nn::sl +{ +namespace details +{ +typedef struct WUT_PACKED KillerNotificationSelectorInternal +{ + ILaunchedTitleListAccessorInternal *launchedTitleListAccessor; + IKillerNotificationAccessorInternal *killerNotificationAccessor; + ITitleListCacheInternal *titleListCache; + ISerializerInternal *killerNotificationSerializer; + ISettingAccessorInternal *settingsAccessor; + IAccountInfoAccessorInternal *accountInfoAccessor; + ITimeAccessorInternal *timeAccessor; + IKillerNotificationTransferRecordManagerInternal *killerNotificationTransferRecordManager; + void *vtable; +} KillerNotificationSelectorInternal; +WUT_CHECK_SIZE(KillerNotificationSelectorInternal, 0x24); +WUT_CHECK_OFFSET(KillerNotificationSelectorInternal, 0x00, launchedTitleListAccessor); +WUT_CHECK_OFFSET(KillerNotificationSelectorInternal, 0x04, killerNotificationAccessor); +WUT_CHECK_OFFSET(KillerNotificationSelectorInternal, 0x08, titleListCache); +WUT_CHECK_OFFSET(KillerNotificationSelectorInternal, 0x0C, killerNotificationSerializer); +WUT_CHECK_OFFSET(KillerNotificationSelectorInternal, 0x10, settingsAccessor); +WUT_CHECK_OFFSET(KillerNotificationSelectorInternal, 0x14, accountInfoAccessor); +WUT_CHECK_OFFSET(KillerNotificationSelectorInternal, 0x18, timeAccessor); +WUT_CHECK_OFFSET(KillerNotificationSelectorInternal, 0x1C, killerNotificationTransferRecordManager); +WUT_CHECK_OFFSET(KillerNotificationSelectorInternal, 0x20, vtable); + +extern "C" KillerNotificationSelectorInternal * +__ct__Q3_2nn2sl26KillerNotificationSelectorFv(KillerNotificationSelectorInternal *); +extern "C" void +__dt__Q3_2nn2sl26KillerNotificationSelectorFv(KillerNotificationSelectorInternal *, int); +extern "C" nn::Result +Select__Q3_2nn2sl26KillerNotificationSelectorFPQ3_2nn2sl18KillerNotificationPQ3_2nn2sl9TitleInfoPb(KillerNotificationSelectorInternal *, KillerNotification *, TitleInfo *, bool *); +extern "C" void +Initialize__Q3_2nn2sl26KillerNotificationSelectorFRQ3_2nn2sl26ILaunchedTitleListAccessorRQ3_2nn2sl27IKillerNotificationAccessorRQ3_2nn2sl14TitleListCacheRQ3_2nn2sl49ISerializer__tm__30_Q3_2nn2sl18KillerNotificationRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl20IAccountInfoAccessorRQ3_2nn2sl13ITimeAccessorRQ3_2nn2sl40IKillerNotificationTransferRecordManager( + KillerNotificationSelectorInternal *, + ILaunchedTitleListAccessorInternal *, + IKillerNotificationAccessorInternal *, + ITitleListCacheInternal *, + ISerializerInternal *, + ISettingAccessorInternal *, + IAccountInfoAccessorInternal *, + ITimeAccessorInternal *, + IKillerNotificationTransferRecordManagerInternal *); +} // namespace details + +class KillerNotificationSelector +{ +public: + KillerNotificationSelector() : + mLaunchedTitleListAccessor(nullptr), + mKillerNotificationAccessor(nullptr), + mTitleListCache(nullptr), + mKillerNotificationSerializer(nullptr), + mSettingAccessor(nullptr), + mAccountInfoAccessor(nullptr), + mTimeAccessor(nullptr), + mKillerNotificationTransferRecordManager(nullptr) + { + if (__ct__Q3_2nn2sl26KillerNotificationSelectorFv(&mInstance) != nullptr) { + mLaunchedTitleListAccessor = details::LaunchedTitleListAccessorFromPtr(mInstance.launchedTitleListAccessor); + mKillerNotificationAccessor = details::KillerNotificationAccessorFromPtr(mInstance.killerNotificationAccessor); + mTitleListCache = TitleListCacheFromPtr(mInstance.titleListCache); + mKillerNotificationSerializer = details::SerializerFromPtr(mInstance.killerNotificationSerializer); + mSettingAccessor = details::SettingAccessorFromPtr(mInstance.settingsAccessor); + mAccountInfoAccessor = details::AccountInfoAccessorFromPtr(mInstance.accountInfoAccessor); + mTimeAccessor = details::TimeAccessorFromPtr(mInstance.timeAccessor); + mKillerNotificationTransferRecordManager = details::KillerNotificationTransferRecordManagerFromPtr(mInstance.killerNotificationTransferRecordManager); + } + } + + ~KillerNotificationSelector() + { + __dt__Q3_2nn2sl26KillerNotificationSelectorFv(&mInstance, 2); + } + + details::ILaunchedTitleListAccessorBase & + GetLaunchedTitleListAccessor() + { + return mLaunchedTitleListAccessor; + } + + details::IKillerNotificationAccessorBase & + GetKillerNotificationAccessor() + { + return mKillerNotificationAccessor; + } + + details::ITitleListCacheBase & + GetTitleListCache() + { + return mTitleListCache; + } + + details::ISerializerBase & + GetKillerNotificationSerializer() + { + return mKillerNotificationSerializer; + } + + details::ISettingAccessorBase & + GetSettingAccessor() + { + return mSettingAccessor; + } + + details::IAccountInfoAccessorBase & + GetAccountInfoAccessor() + { + return mAccountInfoAccessor; + } + + details::ITimeAccessorBase & + GetTimeAccessor() + { + return mTimeAccessor; + } + + details::IKillerNotificationTransferRecordManagerBase & + GetKillerNotificationTransferRecordManager() + { + return mKillerNotificationTransferRecordManager; + } + + nn::Result + Select(KillerNotification *outKillerNotification, TitleInfo *outKillerNotificationTitle, bool *u1) + { + return Select__Q3_2nn2sl26KillerNotificationSelectorFPQ3_2nn2sl18KillerNotificationPQ3_2nn2sl9TitleInfoPb(&mInstance, outKillerNotification, outKillerNotificationTitle, u1); + } + + void + Initialize(details::ILaunchedTitleListAccessorBase &launchedTitleListAccessor, + details::IKillerNotificationAccessorBase &killerNotificationAccessor, + details::ITitleListCacheBase &titleListCache, + details::ISerializerBase &killerNotificationSerializer, + details::ISettingAccessorBase &settingAccessor, + details::IAccountInfoAccessorBase &accountInfoAccessor, + details::ITimeAccessorBase &timeAccessor, + details::IKillerNotificationTransferRecordManagerBase &killerNotificationTransferRecordManager) + { + Initialize__Q3_2nn2sl26KillerNotificationSelectorFRQ3_2nn2sl26ILaunchedTitleListAccessorRQ3_2nn2sl27IKillerNotificationAccessorRQ3_2nn2sl14TitleListCacheRQ3_2nn2sl49ISerializer__tm__30_Q3_2nn2sl18KillerNotificationRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl20IAccountInfoAccessorRQ3_2nn2sl13ITimeAccessorRQ3_2nn2sl40IKillerNotificationTransferRecordManager( + &mInstance, + launchedTitleListAccessor.GetInternal(), + killerNotificationAccessor.GetInternal(), + titleListCache.GetInternal(), + killerNotificationSerializer.GetInternal(), + settingAccessor.GetInternal(), + accountInfoAccessor.GetInternal(), + timeAccessor.GetInternal(), + killerNotificationTransferRecordManager.GetInternal()); + + mLaunchedTitleListAccessor = details::LaunchedTitleListAccessorFromPtr(launchedTitleListAccessor.GetInternal()); + mKillerNotificationAccessor = details::KillerNotificationAccessorFromPtr(killerNotificationAccessor.GetInternal()); + mTitleListCache = TitleListCacheFromPtr(titleListCache.GetInternal()); + mKillerNotificationSerializer = details::SerializerFromPtr(killerNotificationSerializer.GetInternal()); + mSettingAccessor = details::SettingAccessorFromPtr(settingAccessor.GetInternal()); + mAccountInfoAccessor = details::AccountInfoAccessorFromPtr(accountInfoAccessor.GetInternal()); + mTimeAccessor = details::TimeAccessorFromPtr(timeAccessor.GetInternal()); + mKillerNotificationTransferRecordManager = details::KillerNotificationTransferRecordManagerFromPtr(killerNotificationTransferRecordManager.GetInternal()); + } + +private: + details::KillerNotificationSelectorInternal mInstance = {}; + + details::LaunchedTitleListAccessorFromPtr mLaunchedTitleListAccessor; + details::KillerNotificationAccessorFromPtr mKillerNotificationAccessor; + TitleListCacheFromPtr mTitleListCache; + details::SerializerFromPtr mKillerNotificationSerializer; + details::SettingAccessorFromPtr mSettingAccessor; + details::AccountInfoAccessorFromPtr mAccountInfoAccessor; + details::TimeAccessorFromPtr mTimeAccessor; + details::KillerNotificationTransferRecordManagerFromPtr mKillerNotificationTransferRecordManager; +}; } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/KillerNotificationTransferRecordManager.h b/include/nn/sl/KillerNotificationTransferRecordManager.h index 2e1f67f14..7220eabcf 100644 --- a/include/nn/sl/KillerNotificationTransferRecordManager.h +++ b/include/nn/sl/KillerNotificationTransferRecordManager.h @@ -1,188 +1,255 @@ #pragma once +#include #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class IKillerNotificationTransferRecordManager : public details::IKillerNotificationTransferRecordManagerBase { - - public: - IKillerNotificationTransferRecordManager() { - InitInternalVtable(); - } - - IKillerNotificationTransferRecordManager(IKillerNotificationTransferRecordManager &src) { - InitInternalVtable(); - } - - IKillerNotificationTransferRecordManager &operator=(const IKillerNotificationTransferRecordManager &other) { - InitInternalVtable(); - return *this; - } - - IKillerNotificationTransferRecordManager &operator=(IKillerNotificationTransferRecordManager &&src) noexcept { - InitInternalVtable(); - return *this; - } - - ~IKillerNotificationTransferRecordManager() override = default; - - private: - static nn::Result LoadWrapper(details::IKillerNotificationTransferRecordManagerInternal *instance, nn::sl::details::IStreamInternal *stream) { - return instance->vtable->instance->Load(*stream->vtable->instance); - } - - static nn::Result LoadInitialWrapper(details::IKillerNotificationTransferRecordManagerInternal *instance) { - return instance->vtable->instance->LoadInitial(); - } - - static nn::Result StoreWrapper(details::IKillerNotificationTransferRecordManagerInternal *instance, nn::sl::details::IStreamInternal *stream) { - return instance->vtable->instance->Store(*stream->vtable->instance); - } - - static uint32_t GetRecordCountWrapper(details::IKillerNotificationTransferRecordManagerInternal *instance) { - return instance->vtable->instance->GetRecordCount(); - } - - static uint32_t GetRecordsWrapper(details::IKillerNotificationTransferRecordManagerInternal *instance, KillerNotificationTransferRecord *u1, uint32_t u2) { - return instance->vtable->instance->GetRecords(u1, u2); - } - - static void RegisterRecordsWrapper(details::IKillerNotificationTransferRecordManagerInternal *instance, const KillerNotificationTransferRecord *u1, uint32_t u2) { - return instance->vtable->instance->RegisterRecords(u1, u2); - } - - static nn::Result RegisterRecordsOtherWrapper(details::IKillerNotificationTransferRecordManagerInternal *instance, const uint32_t *u1, uint32_t u2) { - return instance->vtable->instance->RegisterRecords(u1, u2); - } - - details::IKillerNotificationTransferRecordManagerInternal *GetInternal() override { - return &mInstance; - } - - void InitInternalVtable() { - mVTable = {.instance = this, - .LoadFn = &LoadWrapper, - .LoadInitialFn = &LoadInitialWrapper, - .StoreFn = &StoreWrapper, - .GetRecordsFn = &GetRecordsWrapper, - .RegisterRecordsFn = &RegisterRecordsWrapper, - .RegisterRecordsOtherFn = &RegisterRecordsOtherWrapper}; - mInstance.vtable = &mVTable; - } - - details::IKillerNotificationTransferRecordManagerInternal mInstance{}; - details::IKillerNotificationTransferRecordManagerInternalVTable mVTable{}; - }; - - class KillerNotificationTransferRecordManager : public details::IKillerNotificationTransferRecordManagerBase { - public: - KillerNotificationTransferRecordManager() { - __ct__Q3_2nn2sl39KillerNotificationTransferRecordManagerFv(&mInstance); - } - - ~KillerNotificationTransferRecordManager() override { - __dt__Q3_2nn2sl39KillerNotificationTransferRecordManagerFv(&mInstance, 2); - } - - void Finalize() override { - Finalize__Q3_2nn2sl39KillerNotificationTransferRecordManagerFv(&mInstance); - } - - nn::Result Load(nn::sl::details::IStreamBase &stream) override { - return Load__Q3_2nn2sl39KillerNotificationTransferRecordManagerFRQ3_2nn2sl7IStream(&mInstance, stream.GetInternal()); - } - - nn::Result LoadInitial() override { - return LoadInitial__Q3_2nn2sl39KillerNotificationTransferRecordManagerFv(&mInstance); - } - - nn::Result Store(nn::sl::details::IStreamBase &stream) override { - return Store__Q3_2nn2sl39KillerNotificationTransferRecordManagerCFRQ3_2nn2sl7IStream(&mInstance, stream.GetInternal()); - } - - uint32_t GetRecordCount() const override { - return GetRecordCount__Q3_2nn2sl39KillerNotificationTransferRecordManagerCFv((details::IKillerNotificationTransferRecordManagerInternal *) &mInstance); - } - - uint32_t GetRecords(KillerNotificationTransferRecord *u1, uint32_t u2) const override { - return GetRecords__Q3_2nn2sl39KillerNotificationTransferRecordManagerCFPQ3_2nn2sl32KillerNotificationTransferRecordUi((details::IKillerNotificationTransferRecordManagerInternal *) &mInstance, u1, u2); - } - - void RegisterRecords(const KillerNotificationTransferRecord *u1, uint32_t u2) override { - RegisterRecords__Q3_2nn2sl39KillerNotificationTransferRecordManagerFPCQ3_2nn2sl32KillerNotificationTransferRecordUi(&mInstance, u1, u2); - } - - nn::Result RegisterRecords(const uint32_t *u1, uint32_t u2) override { - return mInstance.vtable->RegisterRecordsOtherFn(&mInstance, u1, u2); - } - - private: - details::IKillerNotificationTransferRecordManagerInternal *GetInternal() override { - return &mInstance; - } - details::IKillerNotificationTransferRecordManagerInternal mInstance = {}; - }; - - class KillerNotificationTransferRecordManagerInternal : public details::IKillerNotificationTransferRecordManagerBase { - public: - KillerNotificationTransferRecordManagerInternal() { - __ct__Q3_2nn2sl47KillerNotificationTransferRecordManagerInternalFv(&mInstance); - } - - ~KillerNotificationTransferRecordManagerInternal() override { - __dt__Q3_2nn2sl47KillerNotificationTransferRecordManagerInternalFv(&mInstance, 2); - } - - nn::Result Load(nn::sl::details::IStreamBase &stream) override { - auto *base = reinterpret_cast(&mInstance); - return mInstance.vtable->LoadFn(base, stream.GetInternal()); - } - - nn::Result LoadInitial() override { - auto *base = reinterpret_cast(&mInstance); - return mInstance.vtable->LoadInitialFn(base); - } - - nn::Result Store(nn::sl::details::IStreamBase &stream) override { - auto *base = reinterpret_cast(&mInstance); - return mInstance.vtable->StoreFn(base, stream.GetInternal()); - } - - void Finalize() override { - auto *base = reinterpret_cast(&mInstance); - return mInstance.vtable->FinalizeFn(base); - } - - uint32_t GetRecordCount() const override { - auto *base = (details::IKillerNotificationTransferRecordManagerInternal *) (&mInstance); - return mInstance.vtable->GetRecordCountFn(base); - } - - uint32_t GetRecords(KillerNotificationTransferRecord *u1, uint32_t u2) const override { - auto *base = (details::IKillerNotificationTransferRecordManagerInternal *) (&mInstance); - return mInstance.vtable->GetRecordsFn(base, u1, u2); - } - - void RegisterRecords(const KillerNotificationTransferRecord *u1, uint32_t u2) override { - auto *base = reinterpret_cast(&mInstance); - return mInstance.vtable->RegisterRecordsFn(base, u1, u2); - } - - nn::Result RegisterRecords(const uint32_t *u1, uint32_t u2) override { - auto *base = reinterpret_cast(&mInstance); - return mInstance.vtable->RegisterRecordsOtherFn(base, u1, u2); - } - - private: - details::KillerNotificationTransferRecordManagerInternalInternal mInstance = {}; - }; - - details::IKillerNotificationTransferRecordManagerBase &GetDefaultKillerNotificationTransferRecordManager(); +namespace nn::sl +{ +class IKillerNotificationTransferRecordManager : public details::IKillerNotificationTransferRecordManagerBase +{ + +public: + IKillerNotificationTransferRecordManager() + { + InitInternalVtable(); + } + + IKillerNotificationTransferRecordManager(IKillerNotificationTransferRecordManager &src) + { + InitInternalVtable(); + } + + IKillerNotificationTransferRecordManager & + operator=(const IKillerNotificationTransferRecordManager &other) + { + InitInternalVtable(); + return *this; + } + + IKillerNotificationTransferRecordManager & + operator=(IKillerNotificationTransferRecordManager &&src) noexcept + { + InitInternalVtable(); + return *this; + } + + ~IKillerNotificationTransferRecordManager() override = default; + +private: + static nn::Result + LoadWrapper(details::IKillerNotificationTransferRecordManagerInternal *instance, nn::sl::details::IStreamInternal *stream) + { + return instance->vtable->instance->Load(*stream->vtable->instance); + } + + static nn::Result + LoadInitialWrapper(details::IKillerNotificationTransferRecordManagerInternal *instance) + { + return instance->vtable->instance->LoadInitial(); + } + + static nn::Result + StoreWrapper(details::IKillerNotificationTransferRecordManagerInternal *instance, nn::sl::details::IStreamInternal *stream) + { + return instance->vtable->instance->Store(*stream->vtable->instance); + } + + static uint32_t + GetRecordCountWrapper(details::IKillerNotificationTransferRecordManagerInternal *instance) + { + return instance->vtable->instance->GetRecordCount(); + } + + static uint32_t + GetRecordsWrapper(details::IKillerNotificationTransferRecordManagerInternal *instance, KillerNotificationTransferRecord *u1, uint32_t u2) + { + return instance->vtable->instance->GetRecords(u1, u2); + } + + static void + RegisterRecordsWrapper(details::IKillerNotificationTransferRecordManagerInternal *instance, const KillerNotificationTransferRecord *u1, uint32_t u2) + { + return instance->vtable->instance->RegisterRecords(u1, u2); + } + + static nn::Result + RegisterRecordsOtherWrapper(details::IKillerNotificationTransferRecordManagerInternal *instance, const uint32_t *u1, uint32_t u2) + { + return instance->vtable->instance->RegisterRecords(u1, u2); + } + + details::IKillerNotificationTransferRecordManagerInternal * + GetInternal() override + { + return &mInstance; + } + + void + InitInternalVtable() + { + mVTable = {.instance = this, + .LoadFn = &LoadWrapper, + .LoadInitialFn = &LoadInitialWrapper, + .StoreFn = &StoreWrapper, + .GetRecordsFn = &GetRecordsWrapper, + .RegisterRecordsFn = &RegisterRecordsWrapper, + .RegisterRecordsOtherFn = &RegisterRecordsOtherWrapper}; + mInstance.vtable = &mVTable; + } + + details::IKillerNotificationTransferRecordManagerInternal mInstance{}; + details::IKillerNotificationTransferRecordManagerInternalVTable mVTable{}; +}; + +class KillerNotificationTransferRecordManager : public details::IKillerNotificationTransferRecordManagerBase +{ +public: + KillerNotificationTransferRecordManager() + { + __ct__Q3_2nn2sl39KillerNotificationTransferRecordManagerFv(&mInstance); + } + + ~KillerNotificationTransferRecordManager() override + { + __dt__Q3_2nn2sl39KillerNotificationTransferRecordManagerFv(&mInstance, 2); + } + + void + Finalize() override + { + Finalize__Q3_2nn2sl39KillerNotificationTransferRecordManagerFv(&mInstance); + } + + nn::Result + Load(nn::sl::details::IStreamBase &stream) override + { + return Load__Q3_2nn2sl39KillerNotificationTransferRecordManagerFRQ3_2nn2sl7IStream(&mInstance, stream.GetInternal()); + } + + nn::Result + LoadInitial() override + { + return LoadInitial__Q3_2nn2sl39KillerNotificationTransferRecordManagerFv(&mInstance); + } + + nn::Result + Store(nn::sl::details::IStreamBase &stream) override + { + return Store__Q3_2nn2sl39KillerNotificationTransferRecordManagerCFRQ3_2nn2sl7IStream(&mInstance, stream.GetInternal()); + } + + uint32_t + GetRecordCount() const override + { + return GetRecordCount__Q3_2nn2sl39KillerNotificationTransferRecordManagerCFv((details::IKillerNotificationTransferRecordManagerInternal *)&mInstance); + } + + uint32_t + GetRecords(KillerNotificationTransferRecord *u1, uint32_t u2) const override + { + return GetRecords__Q3_2nn2sl39KillerNotificationTransferRecordManagerCFPQ3_2nn2sl32KillerNotificationTransferRecordUi((details::IKillerNotificationTransferRecordManagerInternal *)&mInstance, u1, u2); + } + + void + RegisterRecords(const KillerNotificationTransferRecord *u1, uint32_t u2) override + { + RegisterRecords__Q3_2nn2sl39KillerNotificationTransferRecordManagerFPCQ3_2nn2sl32KillerNotificationTransferRecordUi(&mInstance, u1, u2); + } + + nn::Result + RegisterRecords(const uint32_t *u1, uint32_t u2) override + { + return mInstance.vtable->RegisterRecordsOtherFn(&mInstance, u1, u2); + } + +private: + details::IKillerNotificationTransferRecordManagerInternal * + GetInternal() override + { + return &mInstance; + } + details::IKillerNotificationTransferRecordManagerInternal mInstance = {}; +}; + +class KillerNotificationTransferRecordManagerInternal : public details::IKillerNotificationTransferRecordManagerBase +{ +public: + KillerNotificationTransferRecordManagerInternal() + { + __ct__Q3_2nn2sl47KillerNotificationTransferRecordManagerInternalFv(&mInstance); + } + + ~KillerNotificationTransferRecordManagerInternal() override + { + __dt__Q3_2nn2sl47KillerNotificationTransferRecordManagerInternalFv(&mInstance, 2); + } + + nn::Result + Load(nn::sl::details::IStreamBase &stream) override + { + auto *base = reinterpret_cast(&mInstance); + return mInstance.vtable->LoadFn(base, stream.GetInternal()); + } + + nn::Result + LoadInitial() override + { + auto *base = reinterpret_cast(&mInstance); + return mInstance.vtable->LoadInitialFn(base); + } + + nn::Result + Store(nn::sl::details::IStreamBase &stream) override + { + auto *base = reinterpret_cast(&mInstance); + return mInstance.vtable->StoreFn(base, stream.GetInternal()); + } + + void + Finalize() override + { + auto *base = reinterpret_cast(&mInstance); + return mInstance.vtable->FinalizeFn(base); + } + + uint32_t + GetRecordCount() const override + { + auto *base = (details::IKillerNotificationTransferRecordManagerInternal *)(&mInstance); + return mInstance.vtable->GetRecordCountFn(base); + } + + uint32_t + GetRecords(KillerNotificationTransferRecord *u1, uint32_t u2) const override + { + auto *base = (details::IKillerNotificationTransferRecordManagerInternal *)(&mInstance); + return mInstance.vtable->GetRecordsFn(base, u1, u2); + } + + void + RegisterRecords(const KillerNotificationTransferRecord *u1, uint32_t u2) override + { + auto *base = reinterpret_cast(&mInstance); + return mInstance.vtable->RegisterRecordsFn(base, u1, u2); + } + + nn::Result + RegisterRecords(const uint32_t *u1, uint32_t u2) override + { + auto *base = reinterpret_cast(&mInstance); + return mInstance.vtable->RegisterRecordsOtherFn(base, u1, u2); + } + +private: + details::KillerNotificationTransferRecordManagerInternalInternal mInstance = {}; +}; + +details::IKillerNotificationTransferRecordManagerBase & +GetDefaultKillerNotificationTransferRecordManager(); } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/KillerNotificationTransferRecordStream.h b/include/nn/sl/KillerNotificationTransferRecordStream.h index 9998d4a6a..30802dbb9 100644 --- a/include/nn/sl/KillerNotificationTransferRecordStream.h +++ b/include/nn/sl/KillerNotificationTransferRecordStream.h @@ -1,58 +1,75 @@ #pragma once +#include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - namespace details { - typedef struct WUT_PACKED KillerNotificationTransferRecordStreamInternal { - void *vtable; - FileStreamInternal fileStream; - uint32_t unkn1; - WUT_UNKNOWN_BYTES(0x84); - } KillerNotificationTransferRecordStreamInternal; - WUT_CHECK_SIZE(KillerNotificationTransferRecordStreamInternal, 0x9C); - WUT_CHECK_OFFSET(KillerNotificationTransferRecordStreamInternal, 0x00, vtable); - WUT_CHECK_OFFSET(KillerNotificationTransferRecordStreamInternal, 0x04, fileStream); - WUT_CHECK_OFFSET(KillerNotificationTransferRecordStreamInternal, 0x14, unkn1); - } // namespace details - - class KillerNotificationTransferRecordStream : public nn::sl::details::IStreamBase { - public: - explicit KillerNotificationTransferRecordStream(details::KillerNotificationTransferRecordStreamInternal *instance) : mInstance(instance) { - } - - nn::Result Read(uint32_t *bytesRead, void *buffer, uint32_t readSize) override { - auto *base = reinterpret_cast(&mInstance); - return base->vtable->ReadFn(base, bytesRead, buffer, readSize); - } - nn::Result Write(uint32_t *bytesWritten, void *buffer, uint32_t readSize) override { - auto *base = reinterpret_cast(&mInstance); - return base->vtable->WriteFn(base, bytesWritten, buffer, readSize); - } - nn::Result GetSize(uint32_t *fileSize) override { - auto *base = reinterpret_cast(&mInstance); - return base->vtable->GetSizeFn(base, fileSize); - } - nn::Result Seek(int32_t offset, nn::sl::SeekOrigin seekOrigin) override { - auto *base = reinterpret_cast(&mInstance); - return base->vtable->SeekFn(base, offset, seekOrigin); - } - - ~KillerNotificationTransferRecordStream() override = default; - - details::IStreamInternal *GetInternal() override { - return reinterpret_cast(mInstance); - } - - private: - details::KillerNotificationTransferRecordStreamInternal *mInstance = {}; - }; - - nn::sl::details::IStreamBase &GetDefaultKillerNotificationTransferRecordStream(); +namespace nn::sl +{ +namespace details +{ +typedef struct WUT_PACKED KillerNotificationTransferRecordStreamInternal +{ + void *vtable; + FileStreamInternal fileStream; + uint32_t unkn1; + WUT_UNKNOWN_BYTES(0x84); +} KillerNotificationTransferRecordStreamInternal; +WUT_CHECK_SIZE(KillerNotificationTransferRecordStreamInternal, 0x9C); +WUT_CHECK_OFFSET(KillerNotificationTransferRecordStreamInternal, 0x00, vtable); +WUT_CHECK_OFFSET(KillerNotificationTransferRecordStreamInternal, 0x04, fileStream); +WUT_CHECK_OFFSET(KillerNotificationTransferRecordStreamInternal, 0x14, unkn1); +} // namespace details + +class KillerNotificationTransferRecordStream : public nn::sl::details::IStreamBase +{ +public: + explicit KillerNotificationTransferRecordStream(details::KillerNotificationTransferRecordStreamInternal *instance) : + mInstance(instance) + { + } + + nn::Result + Read(uint32_t *bytesRead, void *buffer, uint32_t readSize) override + { + auto *base = reinterpret_cast(&mInstance); + return base->vtable->ReadFn(base, bytesRead, buffer, readSize); + } + nn::Result + Write(uint32_t *bytesWritten, void *buffer, uint32_t readSize) override + { + auto *base = reinterpret_cast(&mInstance); + return base->vtable->WriteFn(base, bytesWritten, buffer, readSize); + } + nn::Result + GetSize(uint32_t *fileSize) override + { + auto *base = reinterpret_cast(&mInstance); + return base->vtable->GetSizeFn(base, fileSize); + } + nn::Result + Seek(int32_t offset, nn::sl::SeekOrigin seekOrigin) override + { + auto *base = reinterpret_cast(&mInstance); + return base->vtable->SeekFn(base, offset, seekOrigin); + } + + ~KillerNotificationTransferRecordStream() override = default; + + details::IStreamInternal * + GetInternal() override + { + return reinterpret_cast(mInstance); + } + +private: + details::KillerNotificationTransferRecordStreamInternal *mInstance = {}; +}; + +nn::sl::details::IStreamBase & +GetDefaultKillerNotificationTransferRecordStream(); } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/LaunchInfoDatabase.h b/include/nn/sl/LaunchInfoDatabase.h index fd5a05621..d1a6334b6 100644 --- a/include/nn/sl/LaunchInfoDatabase.h +++ b/include/nn/sl/LaunchInfoDatabase.h @@ -2,152 +2,198 @@ #ifdef __cplusplus +#include #include #include #include #include -#include -namespace nn::sl { - namespace details { - typedef struct WUT_PACKED LaunchInfoDatabaseInternal { - uint64_t *currentIdPtr; - uint32_t *entryCountPtr; - uint32_t *maxEntriesPtr; - void *pDatabase; - LaunchInfoDatabaseEntry *entriesPtr; - LaunchInfoDatabaseEntry *systemTablePtr; - uint32_t systemTableNum; - } LaunchInfoDatabaseInternal; - WUT_CHECK_SIZE(LaunchInfoDatabaseInternal, 0x1C); - WUT_CHECK_OFFSET(LaunchInfoDatabaseInternal, 0x00, currentIdPtr); - WUT_CHECK_OFFSET(LaunchInfoDatabaseInternal, 0x04, entryCountPtr); - WUT_CHECK_OFFSET(LaunchInfoDatabaseInternal, 0x08, maxEntriesPtr); - WUT_CHECK_OFFSET(LaunchInfoDatabaseInternal, 0x0C, pDatabase); - WUT_CHECK_OFFSET(LaunchInfoDatabaseInternal, 0x10, entriesPtr); - WUT_CHECK_OFFSET(LaunchInfoDatabaseInternal, 0x14, systemTablePtr); - WUT_CHECK_OFFSET(LaunchInfoDatabaseInternal, 0x18, systemTableNum); - - extern "C" LaunchInfoDatabaseInternal *__ct__Q3_2nn2sl18LaunchInfoDatabaseFv(LaunchInfoDatabaseInternal *); - extern "C" nn::Result Store__Q3_2nn2sl18LaunchInfoDatabaseCFRQ3_2nn2sl7IStream(LaunchInfoDatabaseInternal *, nn::sl::details::IStreamInternal *); - extern "C" nn::Result Load__Q3_2nn2sl18LaunchInfoDatabaseFRQ3_2nn2sl7IStreamQ3_2nn2sl6Region(LaunchInfoDatabaseInternal *, nn::sl::details::IStreamInternal *, nn::sl::Region); - extern "C" nn::Result LoadInitial__Q3_2nn2sl18LaunchInfoDatabaseFUiQ3_2nn2sl6Region(LaunchInfoDatabaseInternal *, int, nn::sl::Region); - extern "C" nn::Result GetLaunchInfoById__Q3_2nn2sl18LaunchInfoDatabaseCFPQ3_2nn2sl10LaunchInfoUL(LaunchInfoDatabaseInternal *, nn::sl::LaunchInfo *, uint64_t titleId); - extern "C" void Finalize__Q3_2nn2sl18LaunchInfoDatabaseFv(LaunchInfoDatabaseInternal *); - extern "C" uint32_t GetEntryCount__Q3_2nn2sl18LaunchInfoDatabaseCFv(LaunchInfoDatabaseInternal *); - extern "C" void Clear__Q3_2nn2sl18LaunchInfoDatabaseFv(LaunchInfoDatabaseInternal *); - extern "C" uint64_t GetCurrentId__Q3_2nn2sl18LaunchInfoDatabaseCFv(LaunchInfoDatabaseInternal *); - extern "C" uint64_t Register__Q3_2nn2sl18LaunchInfoDatabaseFRCQ3_2nn2sl10LaunchInfo(LaunchInfoDatabaseInternal *, const nn::sl::LaunchInfo &); - extern "C" nn::Result Unregister__Q3_2nn2sl18LaunchInfoDatabaseFUL(LaunchInfoDatabaseInternal *, uint64_t); - extern "C" nn::Result __CPR84__LoadInitial__Q3_2nn2sl18LaunchInfoDatabaseFUiPCQ4_2nn2slJ22J5EntryT1(LaunchInfoDatabaseInternal *, uint32_t max_entries, nn::sl::LaunchInfoDatabaseEntry *defaultEntries, uint32_t defaultEntryNum); - extern "C" uint32_t __CPR86__ListLaunchInfos__Q3_2nn2sl18LaunchInfoDatabaseCFPQ4_2nn2slJ26J5EntryUi(LaunchInfoDatabaseInternal *, nn::sl::LaunchInfoDatabaseEntry *entriesOut, uint32_t num); - extern "C" nn::Result __CPR93__Load__Q3_2nn2sl18LaunchInfoDatabaseFRQ3_2nn2sl7IStreamPCQ4_2nn2slJ15J5EntryUi(LaunchInfoDatabaseInternal *, details::IStreamInternal *stream, nn::sl::LaunchInfoDatabaseEntry *defaultEntries, uint32_t defaultEntryNum); - } // namespace details - - class LaunchInfoDatabase { - public: - LaunchInfoDatabase() { - __ct__Q3_2nn2sl18LaunchInfoDatabaseFv(&mInstance); - } - - ~LaunchInfoDatabase() { - Finalize(); - } - - void Finalize() { - // Only actually call finalize if the database is still loaded, otherwise we might trigger an assertion. - if (mInstance.pDatabase != nullptr) { - Finalize__Q3_2nn2sl18LaunchInfoDatabaseFv(&mInstance); - } - } - - nn::Result Load(nn::sl::details::IStreamBase &fileStream, nn::sl::Region region) { - if (mInstance.pDatabase != nullptr) { // Avoid triggering an assertion - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 0}; - } - return Load__Q3_2nn2sl18LaunchInfoDatabaseFRQ3_2nn2sl7IStreamQ3_2nn2sl6Region(&mInstance, fileStream.GetInternal(), region); - } - - nn::Result Store(nn::sl::details::IStreamBase &fileStream) { - if (mInstance.pDatabase == nullptr) { // Avoid triggering an assertion - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 0}; - } - return Store__Q3_2nn2sl18LaunchInfoDatabaseCFRQ3_2nn2sl7IStream(&mInstance, fileStream.GetInternal()); - } - - nn::Result LoadInitial(int maxEntries, nn::sl::Region region) { - if (mInstance.pDatabase != nullptr) { // Avoid triggering an assertion - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 0}; - } - return LoadInitial__Q3_2nn2sl18LaunchInfoDatabaseFUiQ3_2nn2sl6Region(&mInstance, maxEntries, region); - } - - nn::Result GetLaunchInfoById(nn::sl::LaunchInfo *launchInfo, uint64_t id) const { - if (mInstance.pDatabase == nullptr) { // Avoid triggering an assertion - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 0}; - } - return GetLaunchInfoById__Q3_2nn2sl18LaunchInfoDatabaseCFPQ3_2nn2sl10LaunchInfoUL((details::LaunchInfoDatabaseInternal *) &mInstance, launchInfo, id); - } - - [[nodiscard]] std::optional GetEntryCount() const { - if (mInstance.pDatabase == nullptr) { // Avoid triggering an assertion - return {}; - } - return details::GetEntryCount__Q3_2nn2sl18LaunchInfoDatabaseCFv((details::LaunchInfoDatabaseInternal *) &mInstance); - } - - [[nodiscard]] std::optional GetCurrentId() const { - if (mInstance.pDatabase == nullptr) { // Avoid triggering an assertion - return {}; - } - return details::GetCurrentId__Q3_2nn2sl18LaunchInfoDatabaseCFv((details::LaunchInfoDatabaseInternal *) &mInstance); - } - - [[nodiscard]] std::optional Register(const nn::sl::LaunchInfo &launchInfo) { - if (mInstance.pDatabase == nullptr) { // Avoid triggering an assertion - return {}; - } - return details::Register__Q3_2nn2sl18LaunchInfoDatabaseFRCQ3_2nn2sl10LaunchInfo((details::LaunchInfoDatabaseInternal *) &mInstance, launchInfo); - } - - [[nodiscard]] nn::Result Unregister(uint64_t id) { - if (mInstance.pDatabase == nullptr) { // Avoid triggering an assertion - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 0}; - } - return details::Unregister__Q3_2nn2sl18LaunchInfoDatabaseFUL((details::LaunchInfoDatabaseInternal *) &mInstance, id); - } - - void Clear() { - if (mInstance.pDatabase == nullptr) { // Avoid triggering an assertion - return; - } - return details::Clear__Q3_2nn2sl18LaunchInfoDatabaseFv(&mInstance); - } - - static nn::Result LoadInitial(LaunchInfoDatabase &launchDatabase, uint32_t maxEntries, nn::sl::LaunchInfoDatabaseEntry *defaultEntries, uint32_t defaultEntryNum) { - if (launchDatabase.mInstance.pDatabase != nullptr) { // Avoid triggering an assertion - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 0}; - } - return details::__CPR84__LoadInitial__Q3_2nn2sl18LaunchInfoDatabaseFUiPCQ4_2nn2slJ22J5EntryT1(&launchDatabase.mInstance, maxEntries, defaultEntries, defaultEntryNum); - } - - static uint32_t ListLaunchInfos(const LaunchInfoDatabase &launchDatabase, nn::sl::LaunchInfoDatabaseEntry *entriesOut, uint32_t num) { - if (launchDatabase.mInstance.pDatabase == nullptr) { // Avoid triggering an assertion - return 0; - } - return details::__CPR86__ListLaunchInfos__Q3_2nn2sl18LaunchInfoDatabaseCFPQ4_2nn2slJ26J5EntryUi((details::LaunchInfoDatabaseInternal *) &launchDatabase.mInstance, entriesOut, num); - } - - static nn::Result Load(LaunchInfoDatabase &launchDatabase, nn::sl::details::IStreamBase &fileStream, nn::sl::LaunchInfoDatabaseEntry *defaultEntries, uint32_t defaultEntryNum) { - if (launchDatabase.mInstance.pDatabase != nullptr) { // Avoid triggering an assertion - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 0}; - } - return details::__CPR93__Load__Q3_2nn2sl18LaunchInfoDatabaseFRQ3_2nn2sl7IStreamPCQ4_2nn2slJ15J5EntryUi(&launchDatabase.mInstance, fileStream.GetInternal(), defaultEntries, defaultEntryNum); - } - - private: - details::LaunchInfoDatabaseInternal mInstance = {}; - }; +namespace nn::sl +{ +namespace details +{ +typedef struct WUT_PACKED LaunchInfoDatabaseInternal +{ + uint64_t *currentIdPtr; + uint32_t *entryCountPtr; + uint32_t *maxEntriesPtr; + void *pDatabase; + LaunchInfoDatabaseEntry *entriesPtr; + LaunchInfoDatabaseEntry *systemTablePtr; + uint32_t systemTableNum; +} LaunchInfoDatabaseInternal; +WUT_CHECK_SIZE(LaunchInfoDatabaseInternal, 0x1C); +WUT_CHECK_OFFSET(LaunchInfoDatabaseInternal, 0x00, currentIdPtr); +WUT_CHECK_OFFSET(LaunchInfoDatabaseInternal, 0x04, entryCountPtr); +WUT_CHECK_OFFSET(LaunchInfoDatabaseInternal, 0x08, maxEntriesPtr); +WUT_CHECK_OFFSET(LaunchInfoDatabaseInternal, 0x0C, pDatabase); +WUT_CHECK_OFFSET(LaunchInfoDatabaseInternal, 0x10, entriesPtr); +WUT_CHECK_OFFSET(LaunchInfoDatabaseInternal, 0x14, systemTablePtr); +WUT_CHECK_OFFSET(LaunchInfoDatabaseInternal, 0x18, systemTableNum); + +extern "C" LaunchInfoDatabaseInternal * +__ct__Q3_2nn2sl18LaunchInfoDatabaseFv(LaunchInfoDatabaseInternal *); +extern "C" nn::Result +Store__Q3_2nn2sl18LaunchInfoDatabaseCFRQ3_2nn2sl7IStream(LaunchInfoDatabaseInternal *, nn::sl::details::IStreamInternal *); +extern "C" nn::Result +Load__Q3_2nn2sl18LaunchInfoDatabaseFRQ3_2nn2sl7IStreamQ3_2nn2sl6Region(LaunchInfoDatabaseInternal *, nn::sl::details::IStreamInternal *, nn::sl::Region); +extern "C" nn::Result +LoadInitial__Q3_2nn2sl18LaunchInfoDatabaseFUiQ3_2nn2sl6Region(LaunchInfoDatabaseInternal *, int, nn::sl::Region); +extern "C" nn::Result +GetLaunchInfoById__Q3_2nn2sl18LaunchInfoDatabaseCFPQ3_2nn2sl10LaunchInfoUL(LaunchInfoDatabaseInternal *, nn::sl::LaunchInfo *, uint64_t titleId); +extern "C" void +Finalize__Q3_2nn2sl18LaunchInfoDatabaseFv(LaunchInfoDatabaseInternal *); +extern "C" uint32_t +GetEntryCount__Q3_2nn2sl18LaunchInfoDatabaseCFv(LaunchInfoDatabaseInternal *); +extern "C" void +Clear__Q3_2nn2sl18LaunchInfoDatabaseFv(LaunchInfoDatabaseInternal *); +extern "C" uint64_t +GetCurrentId__Q3_2nn2sl18LaunchInfoDatabaseCFv(LaunchInfoDatabaseInternal *); +extern "C" uint64_t +Register__Q3_2nn2sl18LaunchInfoDatabaseFRCQ3_2nn2sl10LaunchInfo(LaunchInfoDatabaseInternal *, const nn::sl::LaunchInfo &); +extern "C" nn::Result +Unregister__Q3_2nn2sl18LaunchInfoDatabaseFUL(LaunchInfoDatabaseInternal *, uint64_t); +extern "C" nn::Result +__CPR84__LoadInitial__Q3_2nn2sl18LaunchInfoDatabaseFUiPCQ4_2nn2slJ22J5EntryT1(LaunchInfoDatabaseInternal *, uint32_t max_entries, nn::sl::LaunchInfoDatabaseEntry *defaultEntries, uint32_t defaultEntryNum); +extern "C" uint32_t +__CPR86__ListLaunchInfos__Q3_2nn2sl18LaunchInfoDatabaseCFPQ4_2nn2slJ26J5EntryUi(LaunchInfoDatabaseInternal *, nn::sl::LaunchInfoDatabaseEntry *entriesOut, uint32_t num); +extern "C" nn::Result +__CPR93__Load__Q3_2nn2sl18LaunchInfoDatabaseFRQ3_2nn2sl7IStreamPCQ4_2nn2slJ15J5EntryUi(LaunchInfoDatabaseInternal *, details::IStreamInternal *stream, nn::sl::LaunchInfoDatabaseEntry *defaultEntries, uint32_t defaultEntryNum); +} // namespace details + +class LaunchInfoDatabase +{ +public: + LaunchInfoDatabase() + { + __ct__Q3_2nn2sl18LaunchInfoDatabaseFv(&mInstance); + } + + ~LaunchInfoDatabase() + { + Finalize(); + } + + void + Finalize() + { + // Only actually call finalize if the database is still loaded, otherwise we might trigger an assertion. + if (mInstance.pDatabase != nullptr) { + Finalize__Q3_2nn2sl18LaunchInfoDatabaseFv(&mInstance); + } + } + + nn::Result + Load(nn::sl::details::IStreamBase &fileStream, nn::sl::Region region) + { + if (mInstance.pDatabase != nullptr) { // Avoid triggering an assertion + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 0}; + } + return Load__Q3_2nn2sl18LaunchInfoDatabaseFRQ3_2nn2sl7IStreamQ3_2nn2sl6Region(&mInstance, fileStream.GetInternal(), region); + } + + nn::Result + Store(nn::sl::details::IStreamBase &fileStream) + { + if (mInstance.pDatabase == nullptr) { // Avoid triggering an assertion + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 0}; + } + return Store__Q3_2nn2sl18LaunchInfoDatabaseCFRQ3_2nn2sl7IStream(&mInstance, fileStream.GetInternal()); + } + + nn::Result + LoadInitial(int maxEntries, nn::sl::Region region) + { + if (mInstance.pDatabase != nullptr) { // Avoid triggering an assertion + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 0}; + } + return LoadInitial__Q3_2nn2sl18LaunchInfoDatabaseFUiQ3_2nn2sl6Region(&mInstance, maxEntries, region); + } + + nn::Result + GetLaunchInfoById(nn::sl::LaunchInfo *launchInfo, uint64_t id) const + { + if (mInstance.pDatabase == nullptr) { // Avoid triggering an assertion + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 0}; + } + return GetLaunchInfoById__Q3_2nn2sl18LaunchInfoDatabaseCFPQ3_2nn2sl10LaunchInfoUL((details::LaunchInfoDatabaseInternal *)&mInstance, launchInfo, id); + } + + [[nodiscard]] std::optional + GetEntryCount() const + { + if (mInstance.pDatabase == nullptr) { // Avoid triggering an assertion + return {}; + } + return details::GetEntryCount__Q3_2nn2sl18LaunchInfoDatabaseCFv((details::LaunchInfoDatabaseInternal *)&mInstance); + } + + [[nodiscard]] std::optional + GetCurrentId() const + { + if (mInstance.pDatabase == nullptr) { // Avoid triggering an assertion + return {}; + } + return details::GetCurrentId__Q3_2nn2sl18LaunchInfoDatabaseCFv((details::LaunchInfoDatabaseInternal *)&mInstance); + } + + [[nodiscard]] std::optional + Register(const nn::sl::LaunchInfo &launchInfo) + { + if (mInstance.pDatabase == nullptr) { // Avoid triggering an assertion + return {}; + } + return details::Register__Q3_2nn2sl18LaunchInfoDatabaseFRCQ3_2nn2sl10LaunchInfo((details::LaunchInfoDatabaseInternal *)&mInstance, launchInfo); + } + + [[nodiscard]] nn::Result + Unregister(uint64_t id) + { + if (mInstance.pDatabase == nullptr) { // Avoid triggering an assertion + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 0}; + } + return details::Unregister__Q3_2nn2sl18LaunchInfoDatabaseFUL((details::LaunchInfoDatabaseInternal *)&mInstance, id); + } + + void + Clear() + { + if (mInstance.pDatabase == nullptr) { // Avoid triggering an assertion + return; + } + return details::Clear__Q3_2nn2sl18LaunchInfoDatabaseFv(&mInstance); + } + + static nn::Result + LoadInitial(LaunchInfoDatabase &launchDatabase, uint32_t maxEntries, nn::sl::LaunchInfoDatabaseEntry *defaultEntries, uint32_t defaultEntryNum) + { + if (launchDatabase.mInstance.pDatabase != nullptr) { // Avoid triggering an assertion + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 0}; + } + return details::__CPR84__LoadInitial__Q3_2nn2sl18LaunchInfoDatabaseFUiPCQ4_2nn2slJ22J5EntryT1(&launchDatabase.mInstance, maxEntries, defaultEntries, defaultEntryNum); + } + + static uint32_t + ListLaunchInfos(const LaunchInfoDatabase &launchDatabase, nn::sl::LaunchInfoDatabaseEntry *entriesOut, uint32_t num) + { + if (launchDatabase.mInstance.pDatabase == nullptr) { // Avoid triggering an assertion + return 0; + } + return details::__CPR86__ListLaunchInfos__Q3_2nn2sl18LaunchInfoDatabaseCFPQ4_2nn2slJ26J5EntryUi((details::LaunchInfoDatabaseInternal *)&launchDatabase.mInstance, entriesOut, num); + } + + static nn::Result + Load(LaunchInfoDatabase &launchDatabase, nn::sl::details::IStreamBase &fileStream, nn::sl::LaunchInfoDatabaseEntry *defaultEntries, uint32_t defaultEntryNum) + { + if (launchDatabase.mInstance.pDatabase != nullptr) { // Avoid triggering an assertion + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 0}; + } + return details::__CPR93__Load__Q3_2nn2sl18LaunchInfoDatabaseFRQ3_2nn2sl7IStreamPCQ4_2nn2slJ15J5EntryUi(&launchDatabase.mInstance, fileStream.GetInternal(), defaultEntries, defaultEntryNum); + } + +private: + details::LaunchInfoDatabaseInternal mInstance = {}; +}; } // namespace nn::sl diff --git a/include/nn/sl/QuickStartApplicationSelector.h b/include/nn/sl/QuickStartApplicationSelector.h index c2d0e2bc9..8eb246371 100644 --- a/include/nn/sl/QuickStartApplicationSelector.h +++ b/include/nn/sl/QuickStartApplicationSelector.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -7,121 +8,145 @@ #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - namespace details { - typedef struct WUT_PACKED QuickStartApplicationSelectorInternal { - IPreferentialTitleAccessorInternal *preferentialTitleAccessor; - IDefaultTitleAccessorInternal *defaultTitleAccessor; - IWhiteListAccessorInternal *whiteListAccessor; - ITitleListCacheInternal *titleListCache; - ISettingAccessorInternal *settingsAccessor; - IBlackListAccessorInternal *blackListAccessor; - void *vtable; - } QuickStartApplicationSelectorInternal; - WUT_CHECK_SIZE(QuickStartApplicationSelectorInternal, 0x1C); - WUT_CHECK_OFFSET(QuickStartApplicationSelectorInternal, 0x00, preferentialTitleAccessor); - WUT_CHECK_OFFSET(QuickStartApplicationSelectorInternal, 0x04, defaultTitleAccessor); - WUT_CHECK_OFFSET(QuickStartApplicationSelectorInternal, 0x08, whiteListAccessor); - WUT_CHECK_OFFSET(QuickStartApplicationSelectorInternal, 0x0C, titleListCache); - WUT_CHECK_OFFSET(QuickStartApplicationSelectorInternal, 0x10, settingsAccessor); - WUT_CHECK_OFFSET(QuickStartApplicationSelectorInternal, 0x14, blackListAccessor); - WUT_CHECK_OFFSET(QuickStartApplicationSelectorInternal, 0x18, vtable); - - extern "C" QuickStartApplicationSelectorInternal *__ct__Q3_2nn2sl29QuickStartApplicationSelectorFv(QuickStartApplicationSelectorInternal *); - extern "C" nn::Result Select__Q3_2nn2sl29QuickStartApplicationSelectorFPQ3_2nn2sl9TitleInfoi(QuickStartApplicationSelectorInternal *, nn::sl::TitleInfo *, int); - extern "C" void Initialize__Q3_2nn2sl29QuickStartApplicationSelectorFRQ3_2nn2sl26IPreferentialTitleAccessorRQ3_2nn2sl21IDefaultTitleAccessorRQ3_2nn2sl18IWhiteListAccessorRQ3_2nn2sl14TitleListCacheRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl18IBlackListAccessor( - QuickStartApplicationSelectorInternal *, - IPreferentialTitleAccessorInternal *, - IDefaultTitleAccessorInternal *, - IWhiteListAccessorInternal *, - ITitleListCacheInternal *, - ISettingAccessorInternal *, - details::IBlackListAccessorInternal *); - } // namespace details - - class QuickStartApplicationSelector { - public: - QuickStartApplicationSelector() : mPreferentialTitleAccessorFromPtr(nullptr), - mDefaultTitleAccessorFromPtr(nullptr), - mWhiteListAccessorFromPtr(nullptr), - mTitleListCacheFromPtr(nullptr), - mSettingAccessorFromPtr(nullptr), - mBlackListAccessorFromPtr(nullptr) { - if (__ct__Q3_2nn2sl29QuickStartApplicationSelectorFv(&mInstance) != nullptr) { - mPreferentialTitleAccessorFromPtr = details::PreferentialTitleAccessorFromPtr(mInstance.preferentialTitleAccessor); - mDefaultTitleAccessorFromPtr = details::DefaultTitleAccessorFromPtr(mInstance.defaultTitleAccessor); - mWhiteListAccessorFromPtr = details::WhiteListAccessorFromPtr(mInstance.whiteListAccessor); - mTitleListCacheFromPtr = TitleListCacheFromPtr(mInstance.titleListCache); - mSettingAccessorFromPtr = details::SettingAccessorFromPtr(mInstance.settingsAccessor); - mBlackListAccessorFromPtr = details::BlackListAccessorFromPtr(mInstance.blackListAccessor); - } - } - - ~QuickStartApplicationSelector() = default; - - details::IPreferentialTitleAccessorBase &GetPreferentialTitleAccessor() { - return mPreferentialTitleAccessorFromPtr; - } - - details::IDefaultTitleAccessorBase &GetDefaultTitleAccessor() { - return mDefaultTitleAccessorFromPtr; - } - - details::IWhiteListAccessorBase &GetWhiteListAccessor() { - return mWhiteListAccessorFromPtr; - } - - details::ITitleListCacheBase &GetTitleListCache() { - return mTitleListCacheFromPtr; - } - - details::ISettingAccessorBase &GetSettingAccessor() { - return mSettingAccessorFromPtr; - } - - details::IBlackListAccessorBase &GetBlackListAccessor() { - return mBlackListAccessorFromPtr; - } - - nn::Result Select(nn::sl::TitleInfo *titleInfos, int num) { - return Select__Q3_2nn2sl29QuickStartApplicationSelectorFPQ3_2nn2sl9TitleInfoi(&mInstance, titleInfos, num); - } - - void Initialize(details::IPreferentialTitleAccessorBase &preferentialTitleAccessor, - details::IDefaultTitleAccessorBase &defaultTitleAccessor, - details::IWhiteListAccessorBase &whiteListAccessor, - details::ITitleListCacheBase &titleListCache, - details::ISettingAccessorBase &settingAccessor, - details::IBlackListAccessorBase &blackListAccessor) { - Initialize__Q3_2nn2sl29QuickStartApplicationSelectorFRQ3_2nn2sl26IPreferentialTitleAccessorRQ3_2nn2sl21IDefaultTitleAccessorRQ3_2nn2sl18IWhiteListAccessorRQ3_2nn2sl14TitleListCacheRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl18IBlackListAccessor( - &mInstance, - preferentialTitleAccessor.GetInternal(), - defaultTitleAccessor.GetInternal(), - whiteListAccessor.GetInternal(), - titleListCache.GetInternal(), - settingAccessor.GetInternal(), - blackListAccessor.GetInternal()); - mPreferentialTitleAccessorFromPtr = details::PreferentialTitleAccessorFromPtr(preferentialTitleAccessor.GetInternal()); - mDefaultTitleAccessorFromPtr = details::DefaultTitleAccessorFromPtr(defaultTitleAccessor.GetInternal()); - mWhiteListAccessorFromPtr = details::WhiteListAccessorFromPtr(whiteListAccessor.GetInternal()); - mTitleListCacheFromPtr = TitleListCacheFromPtr(titleListCache.GetInternal()); - mSettingAccessorFromPtr = details::SettingAccessorFromPtr(settingAccessor.GetInternal()); - mBlackListAccessorFromPtr = details::BlackListAccessorFromPtr(blackListAccessor.GetInternal()); - } - - private: - details::QuickStartApplicationSelectorInternal mInstance = {}; - details::PreferentialTitleAccessorFromPtr mPreferentialTitleAccessorFromPtr; - details::DefaultTitleAccessorFromPtr mDefaultTitleAccessorFromPtr; - details::WhiteListAccessorFromPtr mWhiteListAccessorFromPtr; - TitleListCacheFromPtr mTitleListCacheFromPtr; - details::SettingAccessorFromPtr mSettingAccessorFromPtr; - details::BlackListAccessorFromPtr mBlackListAccessorFromPtr; - }; +namespace nn::sl +{ +namespace details +{ +typedef struct WUT_PACKED QuickStartApplicationSelectorInternal +{ + IPreferentialTitleAccessorInternal *preferentialTitleAccessor; + IDefaultTitleAccessorInternal *defaultTitleAccessor; + IWhiteListAccessorInternal *whiteListAccessor; + ITitleListCacheInternal *titleListCache; + ISettingAccessorInternal *settingsAccessor; + IBlackListAccessorInternal *blackListAccessor; + void *vtable; +} QuickStartApplicationSelectorInternal; +WUT_CHECK_SIZE(QuickStartApplicationSelectorInternal, 0x1C); +WUT_CHECK_OFFSET(QuickStartApplicationSelectorInternal, 0x00, preferentialTitleAccessor); +WUT_CHECK_OFFSET(QuickStartApplicationSelectorInternal, 0x04, defaultTitleAccessor); +WUT_CHECK_OFFSET(QuickStartApplicationSelectorInternal, 0x08, whiteListAccessor); +WUT_CHECK_OFFSET(QuickStartApplicationSelectorInternal, 0x0C, titleListCache); +WUT_CHECK_OFFSET(QuickStartApplicationSelectorInternal, 0x10, settingsAccessor); +WUT_CHECK_OFFSET(QuickStartApplicationSelectorInternal, 0x14, blackListAccessor); +WUT_CHECK_OFFSET(QuickStartApplicationSelectorInternal, 0x18, vtable); + +extern "C" QuickStartApplicationSelectorInternal * +__ct__Q3_2nn2sl29QuickStartApplicationSelectorFv(QuickStartApplicationSelectorInternal *); +extern "C" nn::Result +Select__Q3_2nn2sl29QuickStartApplicationSelectorFPQ3_2nn2sl9TitleInfoi(QuickStartApplicationSelectorInternal *, nn::sl::TitleInfo *, int); +extern "C" void +Initialize__Q3_2nn2sl29QuickStartApplicationSelectorFRQ3_2nn2sl26IPreferentialTitleAccessorRQ3_2nn2sl21IDefaultTitleAccessorRQ3_2nn2sl18IWhiteListAccessorRQ3_2nn2sl14TitleListCacheRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl18IBlackListAccessor( + QuickStartApplicationSelectorInternal *, + IPreferentialTitleAccessorInternal *, + IDefaultTitleAccessorInternal *, + IWhiteListAccessorInternal *, + ITitleListCacheInternal *, + ISettingAccessorInternal *, + details::IBlackListAccessorInternal *); +} // namespace details + +class QuickStartApplicationSelector +{ +public: + QuickStartApplicationSelector() : + mPreferentialTitleAccessorFromPtr(nullptr), + mDefaultTitleAccessorFromPtr(nullptr), + mWhiteListAccessorFromPtr(nullptr), + mTitleListCacheFromPtr(nullptr), + mSettingAccessorFromPtr(nullptr), + mBlackListAccessorFromPtr(nullptr) + { + if (__ct__Q3_2nn2sl29QuickStartApplicationSelectorFv(&mInstance) != nullptr) { + mPreferentialTitleAccessorFromPtr = details::PreferentialTitleAccessorFromPtr(mInstance.preferentialTitleAccessor); + mDefaultTitleAccessorFromPtr = details::DefaultTitleAccessorFromPtr(mInstance.defaultTitleAccessor); + mWhiteListAccessorFromPtr = details::WhiteListAccessorFromPtr(mInstance.whiteListAccessor); + mTitleListCacheFromPtr = TitleListCacheFromPtr(mInstance.titleListCache); + mSettingAccessorFromPtr = details::SettingAccessorFromPtr(mInstance.settingsAccessor); + mBlackListAccessorFromPtr = details::BlackListAccessorFromPtr(mInstance.blackListAccessor); + } + } + + ~QuickStartApplicationSelector() = default; + + details::IPreferentialTitleAccessorBase & + GetPreferentialTitleAccessor() + { + return mPreferentialTitleAccessorFromPtr; + } + + details::IDefaultTitleAccessorBase & + GetDefaultTitleAccessor() + { + return mDefaultTitleAccessorFromPtr; + } + + details::IWhiteListAccessorBase & + GetWhiteListAccessor() + { + return mWhiteListAccessorFromPtr; + } + + details::ITitleListCacheBase & + GetTitleListCache() + { + return mTitleListCacheFromPtr; + } + + details::ISettingAccessorBase & + GetSettingAccessor() + { + return mSettingAccessorFromPtr; + } + + details::IBlackListAccessorBase & + GetBlackListAccessor() + { + return mBlackListAccessorFromPtr; + } + + nn::Result + Select(nn::sl::TitleInfo *titleInfos, int num) + { + return Select__Q3_2nn2sl29QuickStartApplicationSelectorFPQ3_2nn2sl9TitleInfoi(&mInstance, titleInfos, num); + } + + void + Initialize(details::IPreferentialTitleAccessorBase &preferentialTitleAccessor, + details::IDefaultTitleAccessorBase &defaultTitleAccessor, + details::IWhiteListAccessorBase &whiteListAccessor, + details::ITitleListCacheBase &titleListCache, + details::ISettingAccessorBase &settingAccessor, + details::IBlackListAccessorBase &blackListAccessor) + { + Initialize__Q3_2nn2sl29QuickStartApplicationSelectorFRQ3_2nn2sl26IPreferentialTitleAccessorRQ3_2nn2sl21IDefaultTitleAccessorRQ3_2nn2sl18IWhiteListAccessorRQ3_2nn2sl14TitleListCacheRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl18IBlackListAccessor( + &mInstance, + preferentialTitleAccessor.GetInternal(), + defaultTitleAccessor.GetInternal(), + whiteListAccessor.GetInternal(), + titleListCache.GetInternal(), + settingAccessor.GetInternal(), + blackListAccessor.GetInternal()); + mPreferentialTitleAccessorFromPtr = details::PreferentialTitleAccessorFromPtr(preferentialTitleAccessor.GetInternal()); + mDefaultTitleAccessorFromPtr = details::DefaultTitleAccessorFromPtr(defaultTitleAccessor.GetInternal()); + mWhiteListAccessorFromPtr = details::WhiteListAccessorFromPtr(whiteListAccessor.GetInternal()); + mTitleListCacheFromPtr = TitleListCacheFromPtr(titleListCache.GetInternal()); + mSettingAccessorFromPtr = details::SettingAccessorFromPtr(settingAccessor.GetInternal()); + mBlackListAccessorFromPtr = details::BlackListAccessorFromPtr(blackListAccessor.GetInternal()); + } + +private: + details::QuickStartApplicationSelectorInternal mInstance = {}; + details::PreferentialTitleAccessorFromPtr mPreferentialTitleAccessorFromPtr; + details::DefaultTitleAccessorFromPtr mDefaultTitleAccessorFromPtr; + details::WhiteListAccessorFromPtr mWhiteListAccessorFromPtr; + TitleListCacheFromPtr mTitleListCacheFromPtr; + details::SettingAccessorFromPtr mSettingAccessorFromPtr; + details::BlackListAccessorFromPtr mBlackListAccessorFromPtr; +}; } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/TitleIconCache.h b/include/nn/sl/TitleIconCache.h index 0f3b9f91b..8bded4ad3 100644 --- a/include/nn/sl/TitleIconCache.h +++ b/include/nn/sl/TitleIconCache.h @@ -7,93 +7,124 @@ #include #include -namespace nn::sl { - - namespace details { - typedef struct WUT_PACKED TitleIconCacheInternal { - void *vtable; - uint32_t num; - void *cachedIconsBuffer; - IIconInfoAccessorInternal *iconInfoAccessor; - ISerializerInternal *iconInfoSerializer; - ISettingAccessorInternal *settingAccessor; - } TitleIconCacheInternal; - WUT_CHECK_SIZE(TitleIconCacheInternal, 0x18); - WUT_CHECK_OFFSET(TitleIconCacheInternal, 0x00, vtable); - WUT_CHECK_OFFSET(TitleIconCacheInternal, 0x04, num); - WUT_CHECK_OFFSET(TitleIconCacheInternal, 0x08, cachedIconsBuffer); - WUT_CHECK_OFFSET(TitleIconCacheInternal, 0x0C, iconInfoAccessor); - WUT_CHECK_OFFSET(TitleIconCacheInternal, 0x10, iconInfoSerializer); - WUT_CHECK_OFFSET(TitleIconCacheInternal, 0x14, settingAccessor); - - extern "C" ITitleIconCacheInternal *__ct__Q3_2nn2sl14TitleIconCacheFv(TitleIconCacheInternal *); - extern "C" ITitleIconCacheInternal *__dt__Q3_2nn2sl14TitleIconCacheFv(TitleIconCacheInternal *, int); - extern "C" void Initialize__Q3_2nn2sl14TitleIconCacheFi(TitleIconCacheInternal *, int); - extern "C" void Initialize__Q3_2nn2sl14TitleIconCacheFiRQ3_2nn2sl17IIconInfoAccessorRQ3_2nn2sl38ISerializer__tm__19_Q3_2nn2sl8IconInfoRQ3_2nn2sl16ISettingAccessor( - TitleIconCacheInternal *, - int, - IIconInfoAccessorInternal *, - ISerializerInternal *, - ISettingAccessorInternal *); - extern "C" void Finalize__Q3_2nn2sl14TitleIconCacheFv(TitleIconCacheInternal *); - extern "C" void Get__Q3_2nn2sl14TitleIconCacheCFPQ3_2nn2sl8IconInfoi(TitleIconCacheInternal *, nn::sl::IconInfo *iconInfos, int num); - extern "C" nn::Result Load__Q3_2nn2sl14TitleIconCacheFv(TitleIconCacheInternal *); - extern "C" nn::Result Update__Q3_2nn2sl14TitleIconCacheFPCQ3_2nn2sl9TitleInfoi(TitleIconCacheInternal *, nn::sl ::TitleInfo *, int); - extern "C" nn::Result Store__Q3_2nn2sl14TitleIconCacheCFv(TitleIconCacheInternal *); - } // namespace details - - class TitleIconCache : public details::ITitleIconCacheBase { - public: - TitleIconCache() { - details::__ct__Q3_2nn2sl14TitleIconCacheFv(&mInstance); - } - ~TitleIconCache() override { - __dt__Q3_2nn2sl14TitleIconCacheFv(&mInstance, 2); - } - - void Initialize(int cacheSize) { - Initialize__Q3_2nn2sl14TitleIconCacheFi(&mInstance, cacheSize); - } - - void Initialize(int cacheSize, - details::IIconInfoAccessorBase &iconInfoAccessor, - details::ISerializerBase &iconInfoSerializer, - details::ISettingAccessorBase &settingAccessor) { - Initialize__Q3_2nn2sl14TitleIconCacheFiRQ3_2nn2sl17IIconInfoAccessorRQ3_2nn2sl38ISerializer__tm__19_Q3_2nn2sl8IconInfoRQ3_2nn2sl16ISettingAccessor( - &mInstance, - cacheSize, - iconInfoAccessor.GetInternal(), - iconInfoSerializer.GetInternal(), - settingAccessor.GetInternal()); - } - - void Finalize(int cacheSize) { - Finalize__Q3_2nn2sl14TitleIconCacheFv(&mInstance); - } - - void Get(nn::sl::IconInfo *iconInfos, int num) const override { - return Get__Q3_2nn2sl14TitleIconCacheCFPQ3_2nn2sl8IconInfoi((details::TitleIconCacheInternal *) &mInstance, iconInfos, num); - } - - nn::Result Load() override { - return Load__Q3_2nn2sl14TitleIconCacheFv(&mInstance); - } - - nn::Result Update(nn::sl::TitleInfo *titleInfos, int num) override { - return Update__Q3_2nn2sl14TitleIconCacheFPCQ3_2nn2sl9TitleInfoi(&mInstance, titleInfos, num); - } - - nn::Result Store() override { - return Store__Q3_2nn2sl14TitleIconCacheCFv(&mInstance); - } - - private: - details::ITitleIconCacheInternal *GetInternal() override { - return reinterpret_cast(&mInstance); - } - - details::TitleIconCacheInternal mInstance{}; - }; +namespace nn::sl +{ + +namespace details +{ +typedef struct WUT_PACKED TitleIconCacheInternal +{ + void *vtable; + uint32_t num; + void *cachedIconsBuffer; + IIconInfoAccessorInternal *iconInfoAccessor; + ISerializerInternal *iconInfoSerializer; + ISettingAccessorInternal *settingAccessor; +} TitleIconCacheInternal; +WUT_CHECK_SIZE(TitleIconCacheInternal, 0x18); +WUT_CHECK_OFFSET(TitleIconCacheInternal, 0x00, vtable); +WUT_CHECK_OFFSET(TitleIconCacheInternal, 0x04, num); +WUT_CHECK_OFFSET(TitleIconCacheInternal, 0x08, cachedIconsBuffer); +WUT_CHECK_OFFSET(TitleIconCacheInternal, 0x0C, iconInfoAccessor); +WUT_CHECK_OFFSET(TitleIconCacheInternal, 0x10, iconInfoSerializer); +WUT_CHECK_OFFSET(TitleIconCacheInternal, 0x14, settingAccessor); + +extern "C" ITitleIconCacheInternal * +__ct__Q3_2nn2sl14TitleIconCacheFv(TitleIconCacheInternal *); +extern "C" ITitleIconCacheInternal * +__dt__Q3_2nn2sl14TitleIconCacheFv(TitleIconCacheInternal *, int); +extern "C" void +Initialize__Q3_2nn2sl14TitleIconCacheFi(TitleIconCacheInternal *, int); +extern "C" void +Initialize__Q3_2nn2sl14TitleIconCacheFiRQ3_2nn2sl17IIconInfoAccessorRQ3_2nn2sl38ISerializer__tm__19_Q3_2nn2sl8IconInfoRQ3_2nn2sl16ISettingAccessor( + TitleIconCacheInternal *, + int, + IIconInfoAccessorInternal *, + ISerializerInternal *, + ISettingAccessorInternal *); +extern "C" void +Finalize__Q3_2nn2sl14TitleIconCacheFv(TitleIconCacheInternal *); +extern "C" void +Get__Q3_2nn2sl14TitleIconCacheCFPQ3_2nn2sl8IconInfoi(TitleIconCacheInternal *, nn::sl::IconInfo *iconInfos, int num); +extern "C" nn::Result +Load__Q3_2nn2sl14TitleIconCacheFv(TitleIconCacheInternal *); +extern "C" nn::Result +Update__Q3_2nn2sl14TitleIconCacheFPCQ3_2nn2sl9TitleInfoi(TitleIconCacheInternal *, nn::sl ::TitleInfo *, int); +extern "C" nn::Result +Store__Q3_2nn2sl14TitleIconCacheCFv(TitleIconCacheInternal *); +} // namespace details + +class TitleIconCache : public details::ITitleIconCacheBase +{ +public: + TitleIconCache() + { + details::__ct__Q3_2nn2sl14TitleIconCacheFv(&mInstance); + } + ~TitleIconCache() override + { + __dt__Q3_2nn2sl14TitleIconCacheFv(&mInstance, 2); + } + + void + Initialize(int cacheSize) + { + Initialize__Q3_2nn2sl14TitleIconCacheFi(&mInstance, cacheSize); + } + + void + Initialize(int cacheSize, + details::IIconInfoAccessorBase &iconInfoAccessor, + details::ISerializerBase &iconInfoSerializer, + details::ISettingAccessorBase &settingAccessor) + { + Initialize__Q3_2nn2sl14TitleIconCacheFiRQ3_2nn2sl17IIconInfoAccessorRQ3_2nn2sl38ISerializer__tm__19_Q3_2nn2sl8IconInfoRQ3_2nn2sl16ISettingAccessor( + &mInstance, + cacheSize, + iconInfoAccessor.GetInternal(), + iconInfoSerializer.GetInternal(), + settingAccessor.GetInternal()); + } + + void + Finalize(int cacheSize) + { + Finalize__Q3_2nn2sl14TitleIconCacheFv(&mInstance); + } + + void + Get(nn::sl::IconInfo *iconInfos, int num) const override + { + return Get__Q3_2nn2sl14TitleIconCacheCFPQ3_2nn2sl8IconInfoi((details::TitleIconCacheInternal *)&mInstance, iconInfos, num); + } + + nn::Result + Load() override + { + return Load__Q3_2nn2sl14TitleIconCacheFv(&mInstance); + } + + nn::Result + Update(nn::sl::TitleInfo *titleInfos, int num) override + { + return Update__Q3_2nn2sl14TitleIconCacheFPCQ3_2nn2sl9TitleInfoi(&mInstance, titleInfos, num); + } + + nn::Result + Store() override + { + return Store__Q3_2nn2sl14TitleIconCacheCFv(&mInstance); + } + +private: + details::ITitleIconCacheInternal * + GetInternal() override + { + return reinterpret_cast(&mInstance); + } + + details::TitleIconCacheInternal mInstance{}; +}; } // namespace nn::sl diff --git a/include/nn/sl/TitleListCache.h b/include/nn/sl/TitleListCache.h index 6f51fa7d8..88c205dc9 100644 --- a/include/nn/sl/TitleListCache.h +++ b/include/nn/sl/TitleListCache.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -8,295 +9,352 @@ #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class QuickStartApplicationSelector; - class KillerNotificationSelector; - namespace details { - typedef struct WUT_PACKED ITitleListCacheInternal { - ITitleListAccessorInternal *titleListAccessor; - ILaunchedTitleListAccessorInternal *launchedTitleListAccessor; - IInstalledTitleListAccessorInternal *installedTitleListAccessor; - IDiscCachedTitleAccessorInternal *discCachedTitleAccessor; - ISerializerInternal *titleInfoSerializer; - ITimeAccessorInternal *timeAccessor; - IMetaInfoAccessorInternal *metaInfoAccessor; - WUT_UNKNOWN_BYTES(0x18); - void *vtable; - } TitleListCacheInternal; - WUT_CHECK_SIZE(ITitleListCacheInternal, 0x38); - WUT_CHECK_OFFSET(ITitleListCacheInternal, 0x00, titleListAccessor); - WUT_CHECK_OFFSET(ITitleListCacheInternal, 0x04, launchedTitleListAccessor); - WUT_CHECK_OFFSET(ITitleListCacheInternal, 0x08, installedTitleListAccessor); - WUT_CHECK_OFFSET(ITitleListCacheInternal, 0x0C, discCachedTitleAccessor); - WUT_CHECK_OFFSET(ITitleListCacheInternal, 0x10, titleInfoSerializer); - WUT_CHECK_OFFSET(ITitleListCacheInternal, 0x14, timeAccessor); - WUT_CHECK_OFFSET(ITitleListCacheInternal, 0x18, metaInfoAccessor); - WUT_CHECK_OFFSET(ITitleListCacheInternal, 0x34, vtable); - - extern "C" ITitleListCacheInternal *__ct__Q3_2nn2sl14TitleListCacheFv(ITitleListCacheInternal *); - extern "C" void Finalize__Q3_2nn2sl14TitleListCacheFv(ITitleListCacheInternal *); - extern "C" nn::Result Load__Q3_2nn2sl14TitleListCacheFv(ITitleListCacheInternal *); - extern "C" nn::Result Update__Q3_2nn2sl14TitleListCacheFv(ITitleListCacheInternal *); - extern "C" nn::Result UpdateIfNeeded__Q3_2nn2sl14TitleListCacheFv(ITitleListCacheInternal *); - extern "C" nn::Result Store__Q3_2nn2sl14TitleListCacheFv(ITitleListCacheInternal *); - extern "C" nn::Result Initialize__Q3_2nn2sl14TitleListCacheFiT1(ITitleListCacheInternal *, int, int); - extern "C" void Finalize__Q3_2nn2sl14TitleListCacheFv(ITitleListCacheInternal *); - extern "C" void Initialize__Q3_2nn2sl14TitleListCacheFiN21( - ITitleListCacheInternal *, - int, - int, - int); - extern "C" void Initialize__Q3_2nn2sl14TitleListCacheFiT1RQ3_2nn2sl18ITitleListAccessorRQ3_2nn2sl26ILaunchedTitleListAccessorRQ3_2nn2sl27IInstalledTitleListAccessorRQ3_2nn2sl24IDiscCachedTitleAccessorRQ3_2nn2sl39ISerializer__tm__20_Q3_2nn2sl9TitleInfo( - ITitleListCacheInternal *, - int, - int, - ITitleListAccessorInternal *, - ILaunchedTitleListAccessorInternal *, - IInstalledTitleListAccessorInternal *, - IDiscCachedTitleAccessorInternal *, - ISerializerInternal *); - extern "C" void Initialize__Q3_2nn2sl14TitleListCacheFiN21RQ3_2nn2sl18ITitleListAccessorRQ3_2nn2sl26ILaunchedTitleListAccessorRQ3_2nn2sl27IInstalledTitleListAccessorRQ3_2nn2sl24IDiscCachedTitleAccessorRQ3_2nn2sl39ISerializer__tm__20_Q3_2nn2sl9TitleInfo( - ITitleListCacheInternal *, - int, - int, - int, - ITitleListAccessorInternal *, - ILaunchedTitleListAccessorInternal *, - IInstalledTitleListAccessorInternal *, - IDiscCachedTitleAccessorInternal *, - ISerializerInternal *); - extern "C" void Initialize__Q3_2nn2sl14TitleListCacheFiN21RQ3_2nn2sl18ITitleListAccessorRQ3_2nn2sl26ILaunchedTitleListAccessorRQ3_2nn2sl27IInstalledTitleListAccessorRQ3_2nn2sl24IDiscCachedTitleAccessorRQ3_2nn2sl39ISerializer__tm__20_Q3_2nn2sl9TitleInfoRQ3_2nn2sl13ITimeAccessorRQ3_2nn2sl17IMetaInfoAccessor( - ITitleListCacheInternal *, - int, - int, - int, - ITitleListAccessorInternal *, - ILaunchedTitleListAccessorInternal *, - IInstalledTitleListAccessorInternal *, - IDiscCachedTitleAccessorInternal *, - ISerializerInternal *, - ITimeAccessorInternal *, - IMetaInfoAccessorInternal *); - - class ITitleListCacheBase { - friend class nn::sl::QuickStartApplicationSelector; - friend class nn::sl::KillerNotificationSelector; - - public: - virtual ~ITitleListCacheBase() = default; - virtual nn::Result Load() = 0; - virtual nn::Result Update() = 0; - virtual nn::Result UpdateIfNeeded() = 0; - virtual nn::Result Store() = 0; - - private: - virtual details::ITitleListCacheInternal *GetInternal() = 0; - }; - - } // namespace details - - class TitleListCache final : public details::ITitleListCacheBase { - public: - TitleListCache() : mTitleListAccessor(nullptr), - mLaunchedTitleListAccessor(nullptr), - mInstalledTitleListAccessor(nullptr), - mDiscCachedTitleAccessor(nullptr), - mTitleInfoSerializer(nullptr), - mTimeAccessor(nullptr), - mMetaInfoAccessor(nullptr) { - if (__ct__Q3_2nn2sl14TitleListCacheFv(&mInstance) != nullptr) { - mTitleListAccessor = details::TitleListAccessorFromPtr(mInstance.titleListAccessor); - mLaunchedTitleListAccessor = details::LaunchedTitleListAccessorFromPtr(mInstance.launchedTitleListAccessor); - mInstalledTitleListAccessor = details::InstalledTitleListAccessorFromPtr(mInstance.installedTitleListAccessor); - mDiscCachedTitleAccessor = details::DiscCachedTitleAccessorFromPtr(mInstance.discCachedTitleAccessor); - mTitleInfoSerializer = details::SerializerFromPtr(mInstance.titleInfoSerializer); - mTimeAccessor = details::TimeAccessorFromPtr(mInstance.timeAccessor); - mMetaInfoAccessor = details::MetaInfoAccessorFromPtr(mInstance.metaInfoAccessor); - } - } - - ~TitleListCache() override { - Finalize__Q3_2nn2sl14TitleListCacheFv(&mInstance); - } - - details::ITitleListAccessorBase &GetTitleListAccessor() { - return mTitleListAccessor; - } - - details::ILaunchedTitleListAccessorBase &GetLaunchedTitleListAccessor() { - return mLaunchedTitleListAccessor; - } - - details::IInstalledTitleListAccessorBase &GetInstalledTitleListAccessor() { - return mInstalledTitleListAccessor; - } - - details::IDiscCachedTitleAccessorBase &GetDiscCachedTitleAccessor() { - return mDiscCachedTitleAccessor; - } - - details::ISerializerBase &GetTitleInfoSerializer() { - return mTitleInfoSerializer; - } - - details::ITimeAccessorBase &GetTimeAccessor() { - return mTimeAccessor; - } - - details::IMetaInfoAccessorBase &GetMetaInfoAccessor() { - return mMetaInfoAccessor; - } - - void Initialize(int u1, int num) { - Initialize__Q3_2nn2sl14TitleListCacheFiT1(&mInstance, u1, num); - } - - void Initialize(int u1, int num, int u3) { - Initialize__Q3_2nn2sl14TitleListCacheFiN21(&mInstance, u1, num, u3); - } - - void Initialize(int u1, int num, int u3, - details::ITitleListAccessorBase &titleListAccessor, - details::ILaunchedTitleListAccessorBase &launchedTitleListAccessor, - details::IInstalledTitleListAccessorBase &installedTitleListAccessor, - details::IDiscCachedTitleAccessorBase &discCachedTitleAccessor, - details::ISerializerBase &titleInfoSerializer) { - Initialize__Q3_2nn2sl14TitleListCacheFiN21RQ3_2nn2sl18ITitleListAccessorRQ3_2nn2sl26ILaunchedTitleListAccessorRQ3_2nn2sl27IInstalledTitleListAccessorRQ3_2nn2sl24IDiscCachedTitleAccessorRQ3_2nn2sl39ISerializer__tm__20_Q3_2nn2sl9TitleInfo( - &mInstance, u1, num, u3, - titleListAccessor.GetInternal(), - launchedTitleListAccessor.GetInternal(), - installedTitleListAccessor.GetInternal(), - discCachedTitleAccessor.GetInternal(), - titleInfoSerializer.GetInternal()); - mTitleListAccessor = details::TitleListAccessorFromPtr(titleListAccessor.GetInternal()); - mLaunchedTitleListAccessor = details::LaunchedTitleListAccessorFromPtr(launchedTitleListAccessor.GetInternal()); - mInstalledTitleListAccessor = details::InstalledTitleListAccessorFromPtr(installedTitleListAccessor.GetInternal()); - mDiscCachedTitleAccessor = details::DiscCachedTitleAccessorFromPtr(discCachedTitleAccessor.GetInternal()); - mTitleInfoSerializer = details::SerializerFromPtr(titleInfoSerializer.GetInternal()); - mTimeAccessor = details::TimeAccessorFromPtr(mInstance.timeAccessor); - mMetaInfoAccessor = details::MetaInfoAccessorFromPtr(mInstance.metaInfoAccessor); - } - - void Initialize(int u1, int num, - details::ITitleListAccessorBase &titleListAccessor, - details::ILaunchedTitleListAccessorBase &launchedTitleListAccessor, - details::IInstalledTitleListAccessorBase &installedTitleListAccessor, - details::IDiscCachedTitleAccessorBase &discCachedTitleAccessor, - details::ISerializerBase &titleInfoSerializer) { - Initialize__Q3_2nn2sl14TitleListCacheFiT1RQ3_2nn2sl18ITitleListAccessorRQ3_2nn2sl26ILaunchedTitleListAccessorRQ3_2nn2sl27IInstalledTitleListAccessorRQ3_2nn2sl24IDiscCachedTitleAccessorRQ3_2nn2sl39ISerializer__tm__20_Q3_2nn2sl9TitleInfo( - &mInstance, u1, num, - titleListAccessor.GetInternal(), - launchedTitleListAccessor.GetInternal(), - installedTitleListAccessor.GetInternal(), - discCachedTitleAccessor.GetInternal(), - titleInfoSerializer.GetInternal()); - mTitleListAccessor = details::TitleListAccessorFromPtr(titleListAccessor.GetInternal()); - mLaunchedTitleListAccessor = details::LaunchedTitleListAccessorFromPtr(launchedTitleListAccessor.GetInternal()); - mInstalledTitleListAccessor = details::InstalledTitleListAccessorFromPtr(installedTitleListAccessor.GetInternal()); - mDiscCachedTitleAccessor = details::DiscCachedTitleAccessorFromPtr(discCachedTitleAccessor.GetInternal()); - mTitleInfoSerializer = details::SerializerFromPtr(titleInfoSerializer.GetInternal()); - mTimeAccessor = details::TimeAccessorFromPtr(mInstance.timeAccessor); - mMetaInfoAccessor = details::MetaInfoAccessorFromPtr(mInstance.metaInfoAccessor); - } - - void Initialize(int u1, int u2, int u3, - details::ITitleListAccessorBase &titleListAccessor, - details::ILaunchedTitleListAccessorBase &launchedTitleListAccessor, - details::IInstalledTitleListAccessorBase &installedTitleListAccessor, - details::IDiscCachedTitleAccessorBase &discCachedTitleAccessor, - details::ISerializerBase &titleInfoSerializer, - details::ITimeAccessorBase &timeAccessor, - details::IMetaInfoAccessorBase &metaInfoAccessor) { - - Initialize__Q3_2nn2sl14TitleListCacheFiN21RQ3_2nn2sl18ITitleListAccessorRQ3_2nn2sl26ILaunchedTitleListAccessorRQ3_2nn2sl27IInstalledTitleListAccessorRQ3_2nn2sl24IDiscCachedTitleAccessorRQ3_2nn2sl39ISerializer__tm__20_Q3_2nn2sl9TitleInfoRQ3_2nn2sl13ITimeAccessorRQ3_2nn2sl17IMetaInfoAccessor( - &mInstance, u1, u2, u3, - titleListAccessor.GetInternal(), - launchedTitleListAccessor.GetInternal(), - installedTitleListAccessor.GetInternal(), - discCachedTitleAccessor.GetInternal(), - titleInfoSerializer.GetInternal(), - timeAccessor.GetInternal(), - metaInfoAccessor.GetInternal()); - mTitleListAccessor = details::TitleListAccessorFromPtr(titleListAccessor.GetInternal()); - mLaunchedTitleListAccessor = details::LaunchedTitleListAccessorFromPtr(launchedTitleListAccessor.GetInternal()); - mInstalledTitleListAccessor = details::InstalledTitleListAccessorFromPtr(installedTitleListAccessor.GetInternal()); - mDiscCachedTitleAccessor = details::DiscCachedTitleAccessorFromPtr(discCachedTitleAccessor.GetInternal()); - mTitleInfoSerializer = details::SerializerFromPtr(titleInfoSerializer.GetInternal()); - mTimeAccessor = details::TimeAccessorFromPtr(timeAccessor.GetInternal()); - mMetaInfoAccessor = details::MetaInfoAccessorFromPtr(metaInfoAccessor.GetInternal()); - } - - void Finalize() { - return Finalize__Q3_2nn2sl14TitleListCacheFv(&mInstance); - } - - nn::Result Load() override { - return Load__Q3_2nn2sl14TitleListCacheFv(&mInstance); - } - - nn::Result Update() override { - return Update__Q3_2nn2sl14TitleListCacheFv(&mInstance); - } - - nn::Result UpdateIfNeeded() override { - return UpdateIfNeeded__Q3_2nn2sl14TitleListCacheFv(&mInstance); - } - - nn::Result Store() override { - return Store__Q3_2nn2sl14TitleListCacheFv(&mInstance); - } - - private: - details::ITitleListCacheInternal *GetInternal() override { - return &mInstance; - } - details::ITitleListCacheInternal mInstance = {}; - - details::TitleListAccessorFromPtr mTitleListAccessor; - details::LaunchedTitleListAccessorFromPtr mLaunchedTitleListAccessor; - details::InstalledTitleListAccessorFromPtr mInstalledTitleListAccessor; - details::DiscCachedTitleAccessorFromPtr mDiscCachedTitleAccessor; - details::SerializerFromPtr mTitleInfoSerializer; - details::TimeAccessorFromPtr mTimeAccessor; - details::MetaInfoAccessorFromPtr mMetaInfoAccessor; - }; - - class TitleListCacheFromPtr final : public details::ITitleListCacheBase { - - public: - explicit TitleListCacheFromPtr(details::ITitleListCacheInternal *ptr) : mPtrInstance(ptr) { - } - ~TitleListCacheFromPtr() override = default; - - nn::Result Load() override { - return Load__Q3_2nn2sl14TitleListCacheFv(mPtrInstance); - } - - nn::Result Update() override { - return Update__Q3_2nn2sl14TitleListCacheFv(mPtrInstance); - } - - nn::Result UpdateIfNeeded() override { - return UpdateIfNeeded__Q3_2nn2sl14TitleListCacheFv(mPtrInstance); - } - - nn::Result Store() override { - return Store__Q3_2nn2sl14TitleListCacheFv(mPtrInstance); - } - - private: - details::ITitleListCacheInternal *GetInternal() override { - return mPtrInstance; - } - - details::ITitleListCacheInternal *mPtrInstance = {}; - }; - - details::ITitleListCacheBase &GetDefaultTitleListCache(); +namespace nn::sl +{ +class QuickStartApplicationSelector; +class KillerNotificationSelector; +namespace details +{ +typedef struct WUT_PACKED ITitleListCacheInternal +{ + ITitleListAccessorInternal *titleListAccessor; + ILaunchedTitleListAccessorInternal *launchedTitleListAccessor; + IInstalledTitleListAccessorInternal *installedTitleListAccessor; + IDiscCachedTitleAccessorInternal *discCachedTitleAccessor; + ISerializerInternal *titleInfoSerializer; + ITimeAccessorInternal *timeAccessor; + IMetaInfoAccessorInternal *metaInfoAccessor; + WUT_UNKNOWN_BYTES(0x18); + void *vtable; +} TitleListCacheInternal; +WUT_CHECK_SIZE(ITitleListCacheInternal, 0x38); +WUT_CHECK_OFFSET(ITitleListCacheInternal, 0x00, titleListAccessor); +WUT_CHECK_OFFSET(ITitleListCacheInternal, 0x04, launchedTitleListAccessor); +WUT_CHECK_OFFSET(ITitleListCacheInternal, 0x08, installedTitleListAccessor); +WUT_CHECK_OFFSET(ITitleListCacheInternal, 0x0C, discCachedTitleAccessor); +WUT_CHECK_OFFSET(ITitleListCacheInternal, 0x10, titleInfoSerializer); +WUT_CHECK_OFFSET(ITitleListCacheInternal, 0x14, timeAccessor); +WUT_CHECK_OFFSET(ITitleListCacheInternal, 0x18, metaInfoAccessor); +WUT_CHECK_OFFSET(ITitleListCacheInternal, 0x34, vtable); + +extern "C" ITitleListCacheInternal * +__ct__Q3_2nn2sl14TitleListCacheFv(ITitleListCacheInternal *); +extern "C" void +Finalize__Q3_2nn2sl14TitleListCacheFv(ITitleListCacheInternal *); +extern "C" nn::Result +Load__Q3_2nn2sl14TitleListCacheFv(ITitleListCacheInternal *); +extern "C" nn::Result +Update__Q3_2nn2sl14TitleListCacheFv(ITitleListCacheInternal *); +extern "C" nn::Result +UpdateIfNeeded__Q3_2nn2sl14TitleListCacheFv(ITitleListCacheInternal *); +extern "C" nn::Result +Store__Q3_2nn2sl14TitleListCacheFv(ITitleListCacheInternal *); +extern "C" nn::Result +Initialize__Q3_2nn2sl14TitleListCacheFiT1(ITitleListCacheInternal *, int, int); +extern "C" void +Finalize__Q3_2nn2sl14TitleListCacheFv(ITitleListCacheInternal *); +extern "C" void +Initialize__Q3_2nn2sl14TitleListCacheFiN21( + ITitleListCacheInternal *, + int, + int, + int); +extern "C" void +Initialize__Q3_2nn2sl14TitleListCacheFiT1RQ3_2nn2sl18ITitleListAccessorRQ3_2nn2sl26ILaunchedTitleListAccessorRQ3_2nn2sl27IInstalledTitleListAccessorRQ3_2nn2sl24IDiscCachedTitleAccessorRQ3_2nn2sl39ISerializer__tm__20_Q3_2nn2sl9TitleInfo( + ITitleListCacheInternal *, + int, + int, + ITitleListAccessorInternal *, + ILaunchedTitleListAccessorInternal *, + IInstalledTitleListAccessorInternal *, + IDiscCachedTitleAccessorInternal *, + ISerializerInternal *); +extern "C" void +Initialize__Q3_2nn2sl14TitleListCacheFiN21RQ3_2nn2sl18ITitleListAccessorRQ3_2nn2sl26ILaunchedTitleListAccessorRQ3_2nn2sl27IInstalledTitleListAccessorRQ3_2nn2sl24IDiscCachedTitleAccessorRQ3_2nn2sl39ISerializer__tm__20_Q3_2nn2sl9TitleInfo( + ITitleListCacheInternal *, + int, + int, + int, + ITitleListAccessorInternal *, + ILaunchedTitleListAccessorInternal *, + IInstalledTitleListAccessorInternal *, + IDiscCachedTitleAccessorInternal *, + ISerializerInternal *); +extern "C" void +Initialize__Q3_2nn2sl14TitleListCacheFiN21RQ3_2nn2sl18ITitleListAccessorRQ3_2nn2sl26ILaunchedTitleListAccessorRQ3_2nn2sl27IInstalledTitleListAccessorRQ3_2nn2sl24IDiscCachedTitleAccessorRQ3_2nn2sl39ISerializer__tm__20_Q3_2nn2sl9TitleInfoRQ3_2nn2sl13ITimeAccessorRQ3_2nn2sl17IMetaInfoAccessor( + ITitleListCacheInternal *, + int, + int, + int, + ITitleListAccessorInternal *, + ILaunchedTitleListAccessorInternal *, + IInstalledTitleListAccessorInternal *, + IDiscCachedTitleAccessorInternal *, + ISerializerInternal *, + ITimeAccessorInternal *, + IMetaInfoAccessorInternal *); + +class ITitleListCacheBase +{ + friend class nn::sl::QuickStartApplicationSelector; + friend class nn::sl::KillerNotificationSelector; + +public: + virtual ~ITitleListCacheBase() = default; + virtual nn::Result + Load() = 0; + virtual nn::Result + Update() = 0; + virtual nn::Result + UpdateIfNeeded() = 0; + virtual nn::Result + Store() = 0; + +private: + virtual details::ITitleListCacheInternal * + GetInternal() = 0; +}; + +} // namespace details + +class TitleListCache final : public details::ITitleListCacheBase +{ +public: + TitleListCache() : + mTitleListAccessor(nullptr), + mLaunchedTitleListAccessor(nullptr), + mInstalledTitleListAccessor(nullptr), + mDiscCachedTitleAccessor(nullptr), + mTitleInfoSerializer(nullptr), + mTimeAccessor(nullptr), + mMetaInfoAccessor(nullptr) + { + if (__ct__Q3_2nn2sl14TitleListCacheFv(&mInstance) != nullptr) { + mTitleListAccessor = details::TitleListAccessorFromPtr(mInstance.titleListAccessor); + mLaunchedTitleListAccessor = details::LaunchedTitleListAccessorFromPtr(mInstance.launchedTitleListAccessor); + mInstalledTitleListAccessor = details::InstalledTitleListAccessorFromPtr(mInstance.installedTitleListAccessor); + mDiscCachedTitleAccessor = details::DiscCachedTitleAccessorFromPtr(mInstance.discCachedTitleAccessor); + mTitleInfoSerializer = details::SerializerFromPtr(mInstance.titleInfoSerializer); + mTimeAccessor = details::TimeAccessorFromPtr(mInstance.timeAccessor); + mMetaInfoAccessor = details::MetaInfoAccessorFromPtr(mInstance.metaInfoAccessor); + } + } + + ~TitleListCache() override + { + Finalize__Q3_2nn2sl14TitleListCacheFv(&mInstance); + } + + details::ITitleListAccessorBase & + GetTitleListAccessor() + { + return mTitleListAccessor; + } + + details::ILaunchedTitleListAccessorBase & + GetLaunchedTitleListAccessor() + { + return mLaunchedTitleListAccessor; + } + + details::IInstalledTitleListAccessorBase & + GetInstalledTitleListAccessor() + { + return mInstalledTitleListAccessor; + } + + details::IDiscCachedTitleAccessorBase & + GetDiscCachedTitleAccessor() + { + return mDiscCachedTitleAccessor; + } + + details::ISerializerBase & + GetTitleInfoSerializer() + { + return mTitleInfoSerializer; + } + + details::ITimeAccessorBase & + GetTimeAccessor() + { + return mTimeAccessor; + } + + details::IMetaInfoAccessorBase & + GetMetaInfoAccessor() + { + return mMetaInfoAccessor; + } + + void + Initialize(int u1, int num) + { + Initialize__Q3_2nn2sl14TitleListCacheFiT1(&mInstance, u1, num); + } + + void + Initialize(int u1, int num, int u3) + { + Initialize__Q3_2nn2sl14TitleListCacheFiN21(&mInstance, u1, num, u3); + } + + void + Initialize(int u1, int num, int u3, details::ITitleListAccessorBase &titleListAccessor, details::ILaunchedTitleListAccessorBase &launchedTitleListAccessor, details::IInstalledTitleListAccessorBase &installedTitleListAccessor, details::IDiscCachedTitleAccessorBase &discCachedTitleAccessor, details::ISerializerBase &titleInfoSerializer) + { + Initialize__Q3_2nn2sl14TitleListCacheFiN21RQ3_2nn2sl18ITitleListAccessorRQ3_2nn2sl26ILaunchedTitleListAccessorRQ3_2nn2sl27IInstalledTitleListAccessorRQ3_2nn2sl24IDiscCachedTitleAccessorRQ3_2nn2sl39ISerializer__tm__20_Q3_2nn2sl9TitleInfo( + &mInstance, u1, num, u3, + titleListAccessor.GetInternal(), + launchedTitleListAccessor.GetInternal(), + installedTitleListAccessor.GetInternal(), + discCachedTitleAccessor.GetInternal(), + titleInfoSerializer.GetInternal()); + mTitleListAccessor = details::TitleListAccessorFromPtr(titleListAccessor.GetInternal()); + mLaunchedTitleListAccessor = details::LaunchedTitleListAccessorFromPtr(launchedTitleListAccessor.GetInternal()); + mInstalledTitleListAccessor = details::InstalledTitleListAccessorFromPtr(installedTitleListAccessor.GetInternal()); + mDiscCachedTitleAccessor = details::DiscCachedTitleAccessorFromPtr(discCachedTitleAccessor.GetInternal()); + mTitleInfoSerializer = details::SerializerFromPtr(titleInfoSerializer.GetInternal()); + mTimeAccessor = details::TimeAccessorFromPtr(mInstance.timeAccessor); + mMetaInfoAccessor = details::MetaInfoAccessorFromPtr(mInstance.metaInfoAccessor); + } + + void + Initialize(int u1, int num, details::ITitleListAccessorBase &titleListAccessor, details::ILaunchedTitleListAccessorBase &launchedTitleListAccessor, details::IInstalledTitleListAccessorBase &installedTitleListAccessor, details::IDiscCachedTitleAccessorBase &discCachedTitleAccessor, details::ISerializerBase &titleInfoSerializer) + { + Initialize__Q3_2nn2sl14TitleListCacheFiT1RQ3_2nn2sl18ITitleListAccessorRQ3_2nn2sl26ILaunchedTitleListAccessorRQ3_2nn2sl27IInstalledTitleListAccessorRQ3_2nn2sl24IDiscCachedTitleAccessorRQ3_2nn2sl39ISerializer__tm__20_Q3_2nn2sl9TitleInfo( + &mInstance, u1, num, + titleListAccessor.GetInternal(), + launchedTitleListAccessor.GetInternal(), + installedTitleListAccessor.GetInternal(), + discCachedTitleAccessor.GetInternal(), + titleInfoSerializer.GetInternal()); + mTitleListAccessor = details::TitleListAccessorFromPtr(titleListAccessor.GetInternal()); + mLaunchedTitleListAccessor = details::LaunchedTitleListAccessorFromPtr(launchedTitleListAccessor.GetInternal()); + mInstalledTitleListAccessor = details::InstalledTitleListAccessorFromPtr(installedTitleListAccessor.GetInternal()); + mDiscCachedTitleAccessor = details::DiscCachedTitleAccessorFromPtr(discCachedTitleAccessor.GetInternal()); + mTitleInfoSerializer = details::SerializerFromPtr(titleInfoSerializer.GetInternal()); + mTimeAccessor = details::TimeAccessorFromPtr(mInstance.timeAccessor); + mMetaInfoAccessor = details::MetaInfoAccessorFromPtr(mInstance.metaInfoAccessor); + } + + void + Initialize(int u1, int u2, int u3, details::ITitleListAccessorBase &titleListAccessor, details::ILaunchedTitleListAccessorBase &launchedTitleListAccessor, details::IInstalledTitleListAccessorBase &installedTitleListAccessor, details::IDiscCachedTitleAccessorBase &discCachedTitleAccessor, details::ISerializerBase &titleInfoSerializer, details::ITimeAccessorBase &timeAccessor, details::IMetaInfoAccessorBase &metaInfoAccessor) + { + + Initialize__Q3_2nn2sl14TitleListCacheFiN21RQ3_2nn2sl18ITitleListAccessorRQ3_2nn2sl26ILaunchedTitleListAccessorRQ3_2nn2sl27IInstalledTitleListAccessorRQ3_2nn2sl24IDiscCachedTitleAccessorRQ3_2nn2sl39ISerializer__tm__20_Q3_2nn2sl9TitleInfoRQ3_2nn2sl13ITimeAccessorRQ3_2nn2sl17IMetaInfoAccessor( + &mInstance, u1, u2, u3, + titleListAccessor.GetInternal(), + launchedTitleListAccessor.GetInternal(), + installedTitleListAccessor.GetInternal(), + discCachedTitleAccessor.GetInternal(), + titleInfoSerializer.GetInternal(), + timeAccessor.GetInternal(), + metaInfoAccessor.GetInternal()); + mTitleListAccessor = details::TitleListAccessorFromPtr(titleListAccessor.GetInternal()); + mLaunchedTitleListAccessor = details::LaunchedTitleListAccessorFromPtr(launchedTitleListAccessor.GetInternal()); + mInstalledTitleListAccessor = details::InstalledTitleListAccessorFromPtr(installedTitleListAccessor.GetInternal()); + mDiscCachedTitleAccessor = details::DiscCachedTitleAccessorFromPtr(discCachedTitleAccessor.GetInternal()); + mTitleInfoSerializer = details::SerializerFromPtr(titleInfoSerializer.GetInternal()); + mTimeAccessor = details::TimeAccessorFromPtr(timeAccessor.GetInternal()); + mMetaInfoAccessor = details::MetaInfoAccessorFromPtr(metaInfoAccessor.GetInternal()); + } + + void + Finalize() + { + return Finalize__Q3_2nn2sl14TitleListCacheFv(&mInstance); + } + + nn::Result + Load() override + { + return Load__Q3_2nn2sl14TitleListCacheFv(&mInstance); + } + + nn::Result + Update() override + { + return Update__Q3_2nn2sl14TitleListCacheFv(&mInstance); + } + + nn::Result + UpdateIfNeeded() override + { + return UpdateIfNeeded__Q3_2nn2sl14TitleListCacheFv(&mInstance); + } + + nn::Result + Store() override + { + return Store__Q3_2nn2sl14TitleListCacheFv(&mInstance); + } + +private: + details::ITitleListCacheInternal * + GetInternal() override + { + return &mInstance; + } + details::ITitleListCacheInternal mInstance = {}; + + details::TitleListAccessorFromPtr mTitleListAccessor; + details::LaunchedTitleListAccessorFromPtr mLaunchedTitleListAccessor; + details::InstalledTitleListAccessorFromPtr mInstalledTitleListAccessor; + details::DiscCachedTitleAccessorFromPtr mDiscCachedTitleAccessor; + details::SerializerFromPtr mTitleInfoSerializer; + details::TimeAccessorFromPtr mTimeAccessor; + details::MetaInfoAccessorFromPtr mMetaInfoAccessor; +}; + +class TitleListCacheFromPtr final : public details::ITitleListCacheBase +{ + +public: + explicit TitleListCacheFromPtr(details::ITitleListCacheInternal *ptr) : + mPtrInstance(ptr) + { + } + ~TitleListCacheFromPtr() override = default; + + nn::Result + Load() override + { + return Load__Q3_2nn2sl14TitleListCacheFv(mPtrInstance); + } + + nn::Result + Update() override + { + return Update__Q3_2nn2sl14TitleListCacheFv(mPtrInstance); + } + + nn::Result + UpdateIfNeeded() override + { + return UpdateIfNeeded__Q3_2nn2sl14TitleListCacheFv(mPtrInstance); + } + + nn::Result + Store() override + { + return Store__Q3_2nn2sl14TitleListCacheFv(mPtrInstance); + } + +private: + details::ITitleListCacheInternal * + GetInternal() override + { + return mPtrInstance; + } + + details::ITitleListCacheInternal *mPtrInstance = {}; +}; + +details::ITitleListCacheBase & +GetDefaultTitleListCache(); } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/details/IAccountInfoAccessorDetails.h b/include/nn/sl/details/IAccountInfoAccessorDetails.h index beab407bb..8bc943fc3 100644 --- a/include/nn/sl/details/IAccountInfoAccessorDetails.h +++ b/include/nn/sl/details/IAccountInfoAccessorDetails.h @@ -1,71 +1,85 @@ #pragma once +#include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class DataCreator; - class KillerNotificationSelector; - namespace details { - class IAccountInfoAccessorBase; - struct IAccountInfoAccessorInternal; - typedef nn::Result (*IAccountInfoAccessor_GetFn)(IAccountInfoAccessorInternal *, nn::sl::AccountInfo *); +namespace nn::sl +{ +class DataCreator; +class KillerNotificationSelector; +namespace details +{ +class IAccountInfoAccessorBase; +struct IAccountInfoAccessorInternal; +typedef nn::Result (*IAccountInfoAccessor_GetFn)(IAccountInfoAccessorInternal *, nn::sl::AccountInfo *); - struct WUT_PACKED IAccountInfoAccessorInternalVTable { - IAccountInfoAccessorBase *instance; // Is normally padding - uint32_t info; - WUT_PADDING_BYTES(4); - uint32_t destructor; - WUT_PADDING_BYTES(4); - IAccountInfoAccessor_GetFn GetFn; - }; - WUT_CHECK_SIZE(IAccountInfoAccessorInternalVTable, 0x18); - WUT_CHECK_OFFSET(IAccountInfoAccessorInternalVTable, 0x00, instance); - WUT_CHECK_OFFSET(IAccountInfoAccessorInternalVTable, 0x14, GetFn); +struct WUT_PACKED IAccountInfoAccessorInternalVTable +{ + IAccountInfoAccessorBase *instance; // Is normally padding + uint32_t info; + WUT_PADDING_BYTES(4); + uint32_t destructor; + WUT_PADDING_BYTES(4); + IAccountInfoAccessor_GetFn GetFn; +}; +WUT_CHECK_SIZE(IAccountInfoAccessorInternalVTable, 0x18); +WUT_CHECK_OFFSET(IAccountInfoAccessorInternalVTable, 0x00, instance); +WUT_CHECK_OFFSET(IAccountInfoAccessorInternalVTable, 0x14, GetFn); - typedef struct WUT_PACKED IAccountInfoAccessorInternal { - IAccountInfoAccessorInternalVTable *vtable; - } IAccountInfoAccessorInternal; - WUT_CHECK_SIZE(IAccountInfoAccessorInternal, 0x04); - WUT_CHECK_OFFSET(IAccountInfoAccessorInternal, 0x00, vtable); +typedef struct WUT_PACKED IAccountInfoAccessorInternal +{ + IAccountInfoAccessorInternalVTable *vtable; +} IAccountInfoAccessorInternal; +WUT_CHECK_SIZE(IAccountInfoAccessorInternal, 0x04); +WUT_CHECK_OFFSET(IAccountInfoAccessorInternal, 0x00, vtable); - class IAccountInfoAccessorBase { - friend class nn::sl::DataCreator; - friend class nn::sl::KillerNotificationSelector; +class IAccountInfoAccessorBase +{ + friend class nn::sl::DataCreator; + friend class nn::sl::KillerNotificationSelector; - public: - IAccountInfoAccessorBase() = default; +public: + IAccountInfoAccessorBase() = default; - virtual ~IAccountInfoAccessorBase() = default; + virtual ~IAccountInfoAccessorBase() = default; - virtual nn::Result Get(nn::sl::AccountInfo *) const = 0; + virtual nn::Result + Get(nn::sl::AccountInfo *) const = 0; - private: - virtual details::IAccountInfoAccessorInternal *GetInternal() = 0; - }; +private: + virtual details::IAccountInfoAccessorInternal * + GetInternal() = 0; +}; - class AccountInfoAccessorFromPtr : public IAccountInfoAccessorBase { - public: - explicit AccountInfoAccessorFromPtr(details::IAccountInfoAccessorInternal *ptr) : mInstancePtr(ptr) { - } - nn::Result Get(nn::sl::AccountInfo *outAccountInfo) const override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->GetFn(mInstancePtr, outAccountInfo); - } +class AccountInfoAccessorFromPtr : public IAccountInfoAccessorBase +{ +public: + explicit AccountInfoAccessorFromPtr(details::IAccountInfoAccessorInternal *ptr) : + mInstancePtr(ptr) + { + } + nn::Result + Get(nn::sl::AccountInfo *outAccountInfo) const override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->GetFn(mInstancePtr, outAccountInfo); + } - private: - details::IAccountInfoAccessorInternal *GetInternal() override { - return mInstancePtr; - } +private: + details::IAccountInfoAccessorInternal * + GetInternal() override + { + return mInstancePtr; + } - details::IAccountInfoAccessorInternal *mInstancePtr; - }; - } // namespace details + details::IAccountInfoAccessorInternal *mInstancePtr; +}; +} // namespace details } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/details/IBlackListAccessorDetails.h b/include/nn/sl/details/IBlackListAccessorDetails.h index c8cb91d08..544e1b239 100644 --- a/include/nn/sl/details/IBlackListAccessorDetails.h +++ b/include/nn/sl/details/IBlackListAccessorDetails.h @@ -1,71 +1,85 @@ #pragma once +#include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class DataCreator; - class QuickStartApplicationSelector; - namespace details { - class IBlackListAccessorBase; - struct IBlackListAccessorInternal; +namespace nn::sl +{ +class DataCreator; +class QuickStartApplicationSelector; +namespace details +{ +class IBlackListAccessorBase; +struct IBlackListAccessorInternal; - typedef nn::Result (*IBlackListAccessor_GetFn)(IBlackListAccessorInternal *, TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos); +typedef nn::Result (*IBlackListAccessor_GetFn)(IBlackListAccessorInternal *, TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos); - struct WUT_PACKED IBlackListAccessorInternalVTable { - IBlackListAccessorBase *instance; // normally this is padding - uint32_t info; - WUT_PADDING_BYTES(4); - uint32_t destructor; - WUT_PADDING_BYTES(4); - IBlackListAccessor_GetFn GetFn; - }; - WUT_CHECK_SIZE(IBlackListAccessorInternalVTable, 0x18); - WUT_CHECK_OFFSET(IBlackListAccessorInternalVTable, 0x00, instance); - WUT_CHECK_OFFSET(IBlackListAccessorInternalVTable, 0x14, GetFn); +struct WUT_PACKED IBlackListAccessorInternalVTable +{ + IBlackListAccessorBase *instance; // normally this is padding + uint32_t info; + WUT_PADDING_BYTES(4); + uint32_t destructor; + WUT_PADDING_BYTES(4); + IBlackListAccessor_GetFn GetFn; +}; +WUT_CHECK_SIZE(IBlackListAccessorInternalVTable, 0x18); +WUT_CHECK_OFFSET(IBlackListAccessorInternalVTable, 0x00, instance); +WUT_CHECK_OFFSET(IBlackListAccessorInternalVTable, 0x14, GetFn); - typedef struct WUT_PACKED IBlackListAccessorInternal { - IBlackListAccessorInternalVTable *vtable; - } IBlackListAccessorInternal; - WUT_CHECK_SIZE(IBlackListAccessorInternal, 0x04); - WUT_CHECK_OFFSET(IBlackListAccessorInternal, 0x00, vtable); +typedef struct WUT_PACKED IBlackListAccessorInternal +{ + IBlackListAccessorInternalVTable *vtable; +} IBlackListAccessorInternal; +WUT_CHECK_SIZE(IBlackListAccessorInternal, 0x04); +WUT_CHECK_OFFSET(IBlackListAccessorInternal, 0x00, vtable); - class IBlackListAccessorBase { - friend class nn::sl::DataCreator; - friend class nn::sl::QuickStartApplicationSelector; +class IBlackListAccessorBase +{ + friend class nn::sl::DataCreator; + friend class nn::sl::QuickStartApplicationSelector; - public: - IBlackListAccessorBase() = default; - virtual ~IBlackListAccessorBase() = default; +public: + IBlackListAccessorBase() = default; + virtual ~IBlackListAccessorBase() = default; - virtual nn::Result Get(nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos) const = 0; + virtual nn::Result + Get(nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos) const = 0; - private: - virtual details::IBlackListAccessorInternal *GetInternal() = 0; - }; +private: + virtual details::IBlackListAccessorInternal * + GetInternal() = 0; +}; - class BlackListAccessorFromPtr : public IBlackListAccessorBase { - public: - explicit BlackListAccessorFromPtr(details::IBlackListAccessorInternal *ptr) : mInstancePtr(ptr) { - } - nn::Result Get(nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos) const override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->GetFn(mInstancePtr, outTitleInfos, outTitleInfosSize, maxTitleInfos); - } +class BlackListAccessorFromPtr : public IBlackListAccessorBase +{ +public: + explicit BlackListAccessorFromPtr(details::IBlackListAccessorInternal *ptr) : + mInstancePtr(ptr) + { + } + nn::Result + Get(nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos) const override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->GetFn(mInstancePtr, outTitleInfos, outTitleInfosSize, maxTitleInfos); + } - private: - nn::sl::details::IBlackListAccessorInternal *GetInternal() override { - return mInstancePtr; - } +private: + nn::sl::details::IBlackListAccessorInternal * + GetInternal() override + { + return mInstancePtr; + } - details::IBlackListAccessorInternal *mInstancePtr; - }; - } // namespace details + details::IBlackListAccessorInternal *mInstancePtr; +}; +} // namespace details } // namespace nn::sl diff --git a/include/nn/sl/details/IDefaultTitleAccessorDetails.h b/include/nn/sl/details/IDefaultTitleAccessorDetails.h index 2776d9437..87dcfb57f 100644 --- a/include/nn/sl/details/IDefaultTitleAccessorDetails.h +++ b/include/nn/sl/details/IDefaultTitleAccessorDetails.h @@ -1,69 +1,83 @@ #pragma once +#include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class QuickStartApplicationSelector; - namespace details { - class IDefaultTitleAccessorBase; - struct IDefaultTitleAccessorInternal; +namespace nn::sl +{ +class QuickStartApplicationSelector; +namespace details +{ +class IDefaultTitleAccessorBase; +struct IDefaultTitleAccessorInternal; - typedef nn::Result (*IDefaultTitleAccessor_GetFn)(IDefaultTitleAccessorInternal *, TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos); +typedef nn::Result (*IDefaultTitleAccessor_GetFn)(IDefaultTitleAccessorInternal *, TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos); - struct WUT_PACKED IDefaultTitleAccessorInternalVTable { - IDefaultTitleAccessorBase *instance; // normally this is padding - uint32_t info; - WUT_PADDING_BYTES(4); - uint32_t destructor; - WUT_PADDING_BYTES(4); - IDefaultTitleAccessor_GetFn GetFn; - }; - WUT_CHECK_SIZE(IDefaultTitleAccessorInternalVTable, 0x18); - WUT_CHECK_OFFSET(IDefaultTitleAccessorInternalVTable, 0x00, instance); - WUT_CHECK_OFFSET(IDefaultTitleAccessorInternalVTable, 0x14, GetFn); +struct WUT_PACKED IDefaultTitleAccessorInternalVTable +{ + IDefaultTitleAccessorBase *instance; // normally this is padding + uint32_t info; + WUT_PADDING_BYTES(4); + uint32_t destructor; + WUT_PADDING_BYTES(4); + IDefaultTitleAccessor_GetFn GetFn; +}; +WUT_CHECK_SIZE(IDefaultTitleAccessorInternalVTable, 0x18); +WUT_CHECK_OFFSET(IDefaultTitleAccessorInternalVTable, 0x00, instance); +WUT_CHECK_OFFSET(IDefaultTitleAccessorInternalVTable, 0x14, GetFn); - typedef struct WUT_PACKED IDefaultTitleAccessorInternal { - IDefaultTitleAccessorInternalVTable *vtable; - } IDefaultTitleAccessorInternal; - WUT_CHECK_SIZE(IDefaultTitleAccessorInternal, 0x04); - WUT_CHECK_OFFSET(IDefaultTitleAccessorInternal, 0x00, vtable); +typedef struct WUT_PACKED IDefaultTitleAccessorInternal +{ + IDefaultTitleAccessorInternalVTable *vtable; +} IDefaultTitleAccessorInternal; +WUT_CHECK_SIZE(IDefaultTitleAccessorInternal, 0x04); +WUT_CHECK_OFFSET(IDefaultTitleAccessorInternal, 0x00, vtable); - class IDefaultTitleAccessorBase { - friend class nn::sl::QuickStartApplicationSelector; +class IDefaultTitleAccessorBase +{ + friend class nn::sl::QuickStartApplicationSelector; - public: - IDefaultTitleAccessorBase() = default; - virtual ~IDefaultTitleAccessorBase() = default; +public: + IDefaultTitleAccessorBase() = default; + virtual ~IDefaultTitleAccessorBase() = default; - virtual nn::Result Get(TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos) = 0; + virtual nn::Result + Get(TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos) = 0; - private: - virtual details::IDefaultTitleAccessorInternal *GetInternal() = 0; - }; +private: + virtual details::IDefaultTitleAccessorInternal * + GetInternal() = 0; +}; - class DefaultTitleAccessorFromPtr : public IDefaultTitleAccessorBase { - public: - explicit DefaultTitleAccessorFromPtr(details::IDefaultTitleAccessorInternal *ptr) : mInstancePtr(ptr) { - } - nn::Result Get(TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos) override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->GetFn(mInstancePtr, outTitleInfos, outTitleInfosSize, maxTitleInfos); - } +class DefaultTitleAccessorFromPtr : public IDefaultTitleAccessorBase +{ +public: + explicit DefaultTitleAccessorFromPtr(details::IDefaultTitleAccessorInternal *ptr) : + mInstancePtr(ptr) + { + } + nn::Result + Get(TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos) override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->GetFn(mInstancePtr, outTitleInfos, outTitleInfosSize, maxTitleInfos); + } - private: - nn::sl::details::IDefaultTitleAccessorInternal *GetInternal() override { - return mInstancePtr; - } +private: + nn::sl::details::IDefaultTitleAccessorInternal * + GetInternal() override + { + return mInstancePtr; + } - details::IDefaultTitleAccessorInternal *mInstancePtr; - }; - } // namespace details + details::IDefaultTitleAccessorInternal *mInstancePtr; +}; +} // namespace details } // namespace nn::sl diff --git a/include/nn/sl/details/IDiscCachedTitleAccessorDetails.h b/include/nn/sl/details/IDiscCachedTitleAccessorDetails.h index 663a29c64..4b8fca05e 100644 --- a/include/nn/sl/details/IDiscCachedTitleAccessorDetails.h +++ b/include/nn/sl/details/IDiscCachedTitleAccessorDetails.h @@ -1,69 +1,83 @@ #pragma once +#include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class TitleListCache; - namespace details { - class IDiscCachedTitleAccessorBase; - struct IDiscCachedTitleAccessorInternal; +namespace nn::sl +{ +class TitleListCache; +namespace details +{ +class IDiscCachedTitleAccessorBase; +struct IDiscCachedTitleAccessorInternal; - typedef nn::Result (*IDiscCachedTitleAccessor_GetFn)(IDiscCachedTitleAccessorInternal *, nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos); +typedef nn::Result (*IDiscCachedTitleAccessor_GetFn)(IDiscCachedTitleAccessorInternal *, nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos); - struct WUT_PACKED IDiscCachedTitleAccessorInternalVTable { - IDiscCachedTitleAccessorBase *instance; // normally this is padding - uint32_t info; - WUT_PADDING_BYTES(4); - uint32_t destructor; - WUT_PADDING_BYTES(4); - IDiscCachedTitleAccessor_GetFn GetFn; - }; - WUT_CHECK_SIZE(IDiscCachedTitleAccessorInternalVTable, 0x18); - WUT_CHECK_OFFSET(IDiscCachedTitleAccessorInternalVTable, 0x00, instance); - WUT_CHECK_OFFSET(IDiscCachedTitleAccessorInternalVTable, 0x14, GetFn); +struct WUT_PACKED IDiscCachedTitleAccessorInternalVTable +{ + IDiscCachedTitleAccessorBase *instance; // normally this is padding + uint32_t info; + WUT_PADDING_BYTES(4); + uint32_t destructor; + WUT_PADDING_BYTES(4); + IDiscCachedTitleAccessor_GetFn GetFn; +}; +WUT_CHECK_SIZE(IDiscCachedTitleAccessorInternalVTable, 0x18); +WUT_CHECK_OFFSET(IDiscCachedTitleAccessorInternalVTable, 0x00, instance); +WUT_CHECK_OFFSET(IDiscCachedTitleAccessorInternalVTable, 0x14, GetFn); - typedef struct WUT_PACKED IDiscCachedTitleAccessorInternal { - IDiscCachedTitleAccessorInternalVTable *vtable; - } IDiscCachedTitleAccessorInternal; - WUT_CHECK_SIZE(IDiscCachedTitleAccessorInternal, 0x04); - WUT_CHECK_OFFSET(IDiscCachedTitleAccessorInternal, 0x00, vtable); +typedef struct WUT_PACKED IDiscCachedTitleAccessorInternal +{ + IDiscCachedTitleAccessorInternalVTable *vtable; +} IDiscCachedTitleAccessorInternal; +WUT_CHECK_SIZE(IDiscCachedTitleAccessorInternal, 0x04); +WUT_CHECK_OFFSET(IDiscCachedTitleAccessorInternal, 0x00, vtable); - class IDiscCachedTitleAccessorBase { - friend class nn::sl::TitleListCache; +class IDiscCachedTitleAccessorBase +{ + friend class nn::sl::TitleListCache; - public: - IDiscCachedTitleAccessorBase() = default; - virtual ~IDiscCachedTitleAccessorBase() = default; +public: + IDiscCachedTitleAccessorBase() = default; + virtual ~IDiscCachedTitleAccessorBase() = default; - virtual nn::Result Get(nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos) const = 0; + virtual nn::Result + Get(nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos) const = 0; - private: - virtual details::IDiscCachedTitleAccessorInternal *GetInternal() = 0; - }; +private: + virtual details::IDiscCachedTitleAccessorInternal * + GetInternal() = 0; +}; - class DiscCachedTitleAccessorFromPtr : public IDiscCachedTitleAccessorBase { - public: - explicit DiscCachedTitleAccessorFromPtr(details::IDiscCachedTitleAccessorInternal *ptr) : mInstancePtr(ptr) { - } - nn::Result Get(nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos) const override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->GetFn(mInstancePtr, outTitleInfos, outTitleInfosSize, maxTitleInfos); - } +class DiscCachedTitleAccessorFromPtr : public IDiscCachedTitleAccessorBase +{ +public: + explicit DiscCachedTitleAccessorFromPtr(details::IDiscCachedTitleAccessorInternal *ptr) : + mInstancePtr(ptr) + { + } + nn::Result + Get(nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos) const override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->GetFn(mInstancePtr, outTitleInfos, outTitleInfosSize, maxTitleInfos); + } - private: - nn::sl::details::IDiscCachedTitleAccessorInternal *GetInternal() override { - return mInstancePtr; - } +private: + nn::sl::details::IDiscCachedTitleAccessorInternal * + GetInternal() override + { + return mInstancePtr; + } - details::IDiscCachedTitleAccessorInternal *mInstancePtr; - }; - } // namespace details + details::IDiscCachedTitleAccessorInternal *mInstancePtr; +}; +} // namespace details } // namespace nn::sl diff --git a/include/nn/sl/details/IIconInfoAccessorDetails.h b/include/nn/sl/details/IIconInfoAccessorDetails.h index 6f35baa02..c5129b4d0 100644 --- a/include/nn/sl/details/IIconInfoAccessorDetails.h +++ b/include/nn/sl/details/IIconInfoAccessorDetails.h @@ -1,85 +1,102 @@ #pragma once +#include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class DataCreator; - class TitleIconCache; - namespace details { - class IIconInfoAccessorBase; - struct IIconInfoAccessorInternal; - - typedef nn::Result (*IconInfoAccessor_GetTitleIconInfoFn)(IIconInfoAccessorInternal *, nn::sl::IconInfo *, const nn::sl::TitleInfo &, nn::sl::Language); - typedef nn::Result (*IconInfoAccessor_GetMiiIconFn)(IIconInfoAccessorInternal *, void *buffer, uint32_t buffer_size, uint32_t slot); - - struct WUT_PACKED IIconInfoAccessorInternalVTable { - IIconInfoAccessorBase *instance; // normally this is padding - uint32_t info; - WUT_PADDING_BYTES(4); - uint32_t destructor; - WUT_PADDING_BYTES(4); - IconInfoAccessor_GetTitleIconInfoFn GetTitleIconInfoFn; - WUT_PADDING_BYTES(4); - IconInfoAccessor_GetMiiIconFn GetMiiIconFn; - WUT_PADDING_BYTES(4); - }; - WUT_CHECK_SIZE(IIconInfoAccessorInternalVTable, 0x24); - WUT_CHECK_OFFSET(IIconInfoAccessorInternalVTable, 0x14, GetTitleIconInfoFn); - WUT_CHECK_OFFSET(IIconInfoAccessorInternalVTable, 0x1C, GetMiiIconFn); - - typedef struct WUT_PACKED IIconInfoAccessorInternal { - IIconInfoAccessorInternalVTable *vtable; - } IIconInfoAccessorInternal; - WUT_CHECK_SIZE(IIconInfoAccessorInternal, 0x04); - WUT_CHECK_OFFSET(IIconInfoAccessorInternal, 0x00, vtable); - - class IIconInfoAccessorBase { - friend class nn::sl::DataCreator; - friend class nn::sl::TitleIconCache; - - public: - IIconInfoAccessorBase() = default; - virtual ~IIconInfoAccessorBase() = default; - - virtual nn::Result GetTitleIconInfo(nn::sl::IconInfo *outIconInfo, const nn::sl::TitleInfo &titleInfo, nn::sl::Language language) const = 0; - - virtual nn::Result GetMiiIcon(void *buffer, uint32_t buffer_size, uint32_t slot) const = 0; - - private: - virtual details::IIconInfoAccessorInternal *GetInternal() = 0; - }; - - class IconInfoAccessorFromPtr : public IIconInfoAccessorBase { - public: - explicit IconInfoAccessorFromPtr(details::IIconInfoAccessorInternal *ptr) : mInstancePtr(ptr) { - } - - nn::Result GetTitleIconInfo(nn::sl::IconInfo *outIconInfo, const nn::sl::TitleInfo &titleInfo, nn::sl::Language language) const override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->GetTitleIconInfoFn(mInstancePtr, outIconInfo, titleInfo, language); - } - - nn::Result GetMiiIcon(void *buffer, uint32_t buffer_size, uint32_t slot) const override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->GetMiiIconFn(mInstancePtr, buffer, buffer_size, slot); - } - - private: - nn::sl::details::IIconInfoAccessorInternal *GetInternal() override { - return mInstancePtr; - } - - details::IIconInfoAccessorInternal *mInstancePtr; - }; - } // namespace details +namespace nn::sl +{ +class DataCreator; +class TitleIconCache; +namespace details +{ +class IIconInfoAccessorBase; +struct IIconInfoAccessorInternal; + +typedef nn::Result (*IconInfoAccessor_GetTitleIconInfoFn)(IIconInfoAccessorInternal *, nn::sl::IconInfo *, const nn::sl::TitleInfo &, nn::sl::Language); +typedef nn::Result (*IconInfoAccessor_GetMiiIconFn)(IIconInfoAccessorInternal *, void *buffer, uint32_t buffer_size, uint32_t slot); + +struct WUT_PACKED IIconInfoAccessorInternalVTable +{ + IIconInfoAccessorBase *instance; // normally this is padding + uint32_t info; + WUT_PADDING_BYTES(4); + uint32_t destructor; + WUT_PADDING_BYTES(4); + IconInfoAccessor_GetTitleIconInfoFn GetTitleIconInfoFn; + WUT_PADDING_BYTES(4); + IconInfoAccessor_GetMiiIconFn GetMiiIconFn; + WUT_PADDING_BYTES(4); +}; +WUT_CHECK_SIZE(IIconInfoAccessorInternalVTable, 0x24); +WUT_CHECK_OFFSET(IIconInfoAccessorInternalVTable, 0x14, GetTitleIconInfoFn); +WUT_CHECK_OFFSET(IIconInfoAccessorInternalVTable, 0x1C, GetMiiIconFn); + +typedef struct WUT_PACKED IIconInfoAccessorInternal +{ + IIconInfoAccessorInternalVTable *vtable; +} IIconInfoAccessorInternal; +WUT_CHECK_SIZE(IIconInfoAccessorInternal, 0x04); +WUT_CHECK_OFFSET(IIconInfoAccessorInternal, 0x00, vtable); + +class IIconInfoAccessorBase +{ + friend class nn::sl::DataCreator; + friend class nn::sl::TitleIconCache; + +public: + IIconInfoAccessorBase() = default; + virtual ~IIconInfoAccessorBase() = default; + + virtual nn::Result + GetTitleIconInfo(nn::sl::IconInfo *outIconInfo, const nn::sl::TitleInfo &titleInfo, nn::sl::Language language) const = 0; + + virtual nn::Result + GetMiiIcon(void *buffer, uint32_t buffer_size, uint32_t slot) const = 0; + +private: + virtual details::IIconInfoAccessorInternal * + GetInternal() = 0; +}; + +class IconInfoAccessorFromPtr : public IIconInfoAccessorBase +{ +public: + explicit IconInfoAccessorFromPtr(details::IIconInfoAccessorInternal *ptr) : + mInstancePtr(ptr) + { + } + + nn::Result + GetTitleIconInfo(nn::sl::IconInfo *outIconInfo, const nn::sl::TitleInfo &titleInfo, nn::sl::Language language) const override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->GetTitleIconInfoFn(mInstancePtr, outIconInfo, titleInfo, language); + } + + nn::Result + GetMiiIcon(void *buffer, uint32_t buffer_size, uint32_t slot) const override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->GetMiiIconFn(mInstancePtr, buffer, buffer_size, slot); + } + +private: + nn::sl::details::IIconInfoAccessorInternal * + GetInternal() override + { + return mInstancePtr; + } + + details::IIconInfoAccessorInternal *mInstancePtr; +}; +} // namespace details } // namespace nn::sl diff --git a/include/nn/sl/details/IInstalledTitleListAccessorDetails.h b/include/nn/sl/details/IInstalledTitleListAccessorDetails.h index 5981f5fd0..d18074336 100644 --- a/include/nn/sl/details/IInstalledTitleListAccessorDetails.h +++ b/include/nn/sl/details/IInstalledTitleListAccessorDetails.h @@ -1,69 +1,83 @@ #pragma once +#include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class TitleListCache; - namespace details { - class IInstalledTitleListAccessorBase; - struct IInstalledTitleListAccessorInternal; +namespace nn::sl +{ +class TitleListCache; +namespace details +{ +class IInstalledTitleListAccessorBase; +struct IInstalledTitleListAccessorInternal; - typedef nn::Result (*IInstalledTitleListAccessor_GetFn)(IInstalledTitleListAccessorInternal *, nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos); +typedef nn::Result (*IInstalledTitleListAccessor_GetFn)(IInstalledTitleListAccessorInternal *, nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos); - struct WUT_PACKED IInstalledTitleListAccessorInternalVTable { - IInstalledTitleListAccessorBase *instance; // normally this is padding - uint32_t info; - WUT_PADDING_BYTES(4); - uint32_t destructor; - WUT_PADDING_BYTES(4); - IInstalledTitleListAccessor_GetFn GetFn; - }; - WUT_CHECK_SIZE(IInstalledTitleListAccessorInternalVTable, 0x18); - WUT_CHECK_OFFSET(IInstalledTitleListAccessorInternalVTable, 0x00, instance); - WUT_CHECK_OFFSET(IInstalledTitleListAccessorInternalVTable, 0x14, GetFn); +struct WUT_PACKED IInstalledTitleListAccessorInternalVTable +{ + IInstalledTitleListAccessorBase *instance; // normally this is padding + uint32_t info; + WUT_PADDING_BYTES(4); + uint32_t destructor; + WUT_PADDING_BYTES(4); + IInstalledTitleListAccessor_GetFn GetFn; +}; +WUT_CHECK_SIZE(IInstalledTitleListAccessorInternalVTable, 0x18); +WUT_CHECK_OFFSET(IInstalledTitleListAccessorInternalVTable, 0x00, instance); +WUT_CHECK_OFFSET(IInstalledTitleListAccessorInternalVTable, 0x14, GetFn); - typedef struct WUT_PACKED IInstalledTitleListAccessorInternal { - IInstalledTitleListAccessorInternalVTable *vtable; - } IInstalledTitleListAccessorInternal; - WUT_CHECK_SIZE(IInstalledTitleListAccessorInternal, 0x04); - WUT_CHECK_OFFSET(IInstalledTitleListAccessorInternal, 0x00, vtable); +typedef struct WUT_PACKED IInstalledTitleListAccessorInternal +{ + IInstalledTitleListAccessorInternalVTable *vtable; +} IInstalledTitleListAccessorInternal; +WUT_CHECK_SIZE(IInstalledTitleListAccessorInternal, 0x04); +WUT_CHECK_OFFSET(IInstalledTitleListAccessorInternal, 0x00, vtable); - class IInstalledTitleListAccessorBase { - friend class nn::sl::TitleListCache; +class IInstalledTitleListAccessorBase +{ + friend class nn::sl::TitleListCache; - public: - IInstalledTitleListAccessorBase() = default; - virtual ~IInstalledTitleListAccessorBase() = default; +public: + IInstalledTitleListAccessorBase() = default; + virtual ~IInstalledTitleListAccessorBase() = default; - virtual nn::Result Get(nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos) const = 0; + virtual nn::Result + Get(nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos) const = 0; - private: - virtual details::IInstalledTitleListAccessorInternal *GetInternal() = 0; - }; +private: + virtual details::IInstalledTitleListAccessorInternal * + GetInternal() = 0; +}; - class InstalledTitleListAccessorFromPtr : public IInstalledTitleListAccessorBase { - public: - explicit InstalledTitleListAccessorFromPtr(details::IInstalledTitleListAccessorInternal *ptr) : mInstancePtr(ptr) { - } - nn::Result Get(nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos) const override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->GetFn(mInstancePtr, outTitleInfos, outTitleInfosSize, maxTitleInfos); - } +class InstalledTitleListAccessorFromPtr : public IInstalledTitleListAccessorBase +{ +public: + explicit InstalledTitleListAccessorFromPtr(details::IInstalledTitleListAccessorInternal *ptr) : + mInstancePtr(ptr) + { + } + nn::Result + Get(nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosSize, int maxTitleInfos) const override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->GetFn(mInstancePtr, outTitleInfos, outTitleInfosSize, maxTitleInfos); + } - private: - nn::sl::details::IInstalledTitleListAccessorInternal *GetInternal() override { - return mInstancePtr; - } +private: + nn::sl::details::IInstalledTitleListAccessorInternal * + GetInternal() override + { + return mInstancePtr; + } - details::IInstalledTitleListAccessorInternal *mInstancePtr; - }; - } // namespace details + details::IInstalledTitleListAccessorInternal *mInstancePtr; +}; +} // namespace details } // namespace nn::sl diff --git a/include/nn/sl/details/IKillerNotificationAccessorDetails.h b/include/nn/sl/details/IKillerNotificationAccessorDetails.h index 18eea53b7..1045331ea 100644 --- a/include/nn/sl/details/IKillerNotificationAccessorDetails.h +++ b/include/nn/sl/details/IKillerNotificationAccessorDetails.h @@ -1,71 +1,85 @@ #pragma once -#include "nn/sl/KillerNotification.h" +#include #include #include -#include +#include "nn/sl/KillerNotification.h" #ifdef __cplusplus -namespace nn::sl { - class KillerNotificationSelector; - namespace details { - class IKillerNotificationAccessorBase; - struct IKillerNotificationAccessorInternal; - - typedef nn::Result (*IKillerNotificationAccessor_GetFn)(IKillerNotificationAccessorInternal *, KillerNotification *outKillerNotifications, int *outKillerNotificationsNum, int maxKillerNotifications); - - struct WUT_PACKED IKillerNotificationAccessorInternalVTable { - IKillerNotificationAccessorBase *instance; // Is normally padding - uint32_t info; - WUT_PADDING_BYTES(4); - uint32_t destructor; - WUT_PADDING_BYTES(4); - IKillerNotificationAccessor_GetFn GetFn; - }; - WUT_CHECK_SIZE(IKillerNotificationAccessorInternalVTable, 0x18); - WUT_CHECK_OFFSET(IKillerNotificationAccessorInternalVTable, 0x00, instance); - WUT_CHECK_OFFSET(IKillerNotificationAccessorInternalVTable, 0x14, GetFn); - - typedef struct WUT_PACKED IKillerNotificationAccessorInternal { - IKillerNotificationAccessorInternalVTable *vtable; - } IKillerNotificationAccessorInternal; - WUT_CHECK_SIZE(IKillerNotificationAccessorInternal, 0x04); - WUT_CHECK_OFFSET(IKillerNotificationAccessorInternal, 0x00, vtable); - - class IKillerNotificationAccessorBase { - friend class nn::sl::KillerNotificationSelector; - - public: - IKillerNotificationAccessorBase() = default; - virtual ~IKillerNotificationAccessorBase() = default; - - virtual nn::Result Get(KillerNotification *outKillerNotifications, int *outKillerNotificationsNum, int maxKillerNotifications) const = 0; - - private: - virtual details::IKillerNotificationAccessorInternal *GetInternal() = 0; - }; - - class KillerNotificationAccessorFromPtr : public IKillerNotificationAccessorBase { - public: - explicit KillerNotificationAccessorFromPtr(details::IKillerNotificationAccessorInternal *ptr) : mInstancePtr(ptr) { - } - nn::Result Get(nn::sl::KillerNotification *outKillerNotifications, int *outKillerNotificationsNum, int maxKillerNotifications) const override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->GetFn(mInstancePtr, outKillerNotifications, outKillerNotificationsNum, maxKillerNotifications); - } - - private: - nn::sl::details::IKillerNotificationAccessorInternal *GetInternal() override { - return mInstancePtr; - } - - details::IKillerNotificationAccessorInternal *mInstancePtr; - }; - - } // namespace details +namespace nn::sl +{ +class KillerNotificationSelector; +namespace details +{ +class IKillerNotificationAccessorBase; +struct IKillerNotificationAccessorInternal; + +typedef nn::Result (*IKillerNotificationAccessor_GetFn)(IKillerNotificationAccessorInternal *, KillerNotification *outKillerNotifications, int *outKillerNotificationsNum, int maxKillerNotifications); + +struct WUT_PACKED IKillerNotificationAccessorInternalVTable +{ + IKillerNotificationAccessorBase *instance; // Is normally padding + uint32_t info; + WUT_PADDING_BYTES(4); + uint32_t destructor; + WUT_PADDING_BYTES(4); + IKillerNotificationAccessor_GetFn GetFn; +}; +WUT_CHECK_SIZE(IKillerNotificationAccessorInternalVTable, 0x18); +WUT_CHECK_OFFSET(IKillerNotificationAccessorInternalVTable, 0x00, instance); +WUT_CHECK_OFFSET(IKillerNotificationAccessorInternalVTable, 0x14, GetFn); + +typedef struct WUT_PACKED IKillerNotificationAccessorInternal +{ + IKillerNotificationAccessorInternalVTable *vtable; +} IKillerNotificationAccessorInternal; +WUT_CHECK_SIZE(IKillerNotificationAccessorInternal, 0x04); +WUT_CHECK_OFFSET(IKillerNotificationAccessorInternal, 0x00, vtable); + +class IKillerNotificationAccessorBase +{ + friend class nn::sl::KillerNotificationSelector; + +public: + IKillerNotificationAccessorBase() = default; + virtual ~IKillerNotificationAccessorBase() = default; + + virtual nn::Result + Get(KillerNotification *outKillerNotifications, int *outKillerNotificationsNum, int maxKillerNotifications) const = 0; + +private: + virtual details::IKillerNotificationAccessorInternal * + GetInternal() = 0; +}; + +class KillerNotificationAccessorFromPtr : public IKillerNotificationAccessorBase +{ +public: + explicit KillerNotificationAccessorFromPtr(details::IKillerNotificationAccessorInternal *ptr) : + mInstancePtr(ptr) + { + } + nn::Result + Get(nn::sl::KillerNotification *outKillerNotifications, int *outKillerNotificationsNum, int maxKillerNotifications) const override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->GetFn(mInstancePtr, outKillerNotifications, outKillerNotificationsNum, maxKillerNotifications); + } + +private: + nn::sl::details::IKillerNotificationAccessorInternal * + GetInternal() override + { + return mInstancePtr; + } + + details::IKillerNotificationAccessorInternal *mInstancePtr; +}; + +} // namespace details } // namespace nn::sl diff --git a/include/nn/sl/details/IKillerNotificationTransferRecordManagerDetails.h b/include/nn/sl/details/IKillerNotificationTransferRecordManagerDetails.h index f3581cdcd..101a35174 100644 --- a/include/nn/sl/details/IKillerNotificationTransferRecordManagerDetails.h +++ b/include/nn/sl/details/IKillerNotificationTransferRecordManagerDetails.h @@ -1,178 +1,225 @@ #pragma once +#include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class KillerNotificationSelector; - namespace details { - class IKillerNotificationTransferRecordManagerBase; - struct IKillerNotificationTransferRecordManagerInternal; - typedef nn::Result (*IKillerNotificationTransferRecordManagerInternVTable_LoadFn)(IKillerNotificationTransferRecordManagerInternal *, nn::sl::details::IStreamInternal *); - typedef nn::Result (*IKillerNotificationTransferRecordManagerInternVTable_LoadInitialFn)(IKillerNotificationTransferRecordManagerInternal *); - typedef nn::Result (*IKillerNotificationTransferRecordManagerInternVTable_StoreFn)(IKillerNotificationTransferRecordManagerInternal *, nn::sl::details::IStreamInternal *); - typedef void (*IKillerNotificationTransferRecordManagerInternVTable_FinalizeFn)(IKillerNotificationTransferRecordManagerInternal *); - typedef uint32_t (*IKillerNotificationTransferRecordManagerInternVTable_GetRecordCountFn)(IKillerNotificationTransferRecordManagerInternal *); - typedef uint32_t (*IKillerNotificationTransferRecordManagerInternVTable_GetRecordsFn)(IKillerNotificationTransferRecordManagerInternal *, KillerNotificationTransferRecord *, uint32_t); - typedef void (*IKillerNotificationTransferRecordManagerInternVTable_RegisterRecordsFn)(IKillerNotificationTransferRecordManagerInternal *, const KillerNotificationTransferRecord *, uint32_t); - typedef nn::Result (*IKillerNotificationTransferRecordManagerInternVTable_RegisterRecordsOtherFn)(IKillerNotificationTransferRecordManagerInternal *, const uint32_t *, uint32_t); - - typedef struct WUT_PACKED IKillerNotificationTransferRecordManagerInternalVTable { - IKillerNotificationTransferRecordManagerBase *instance; // Normally this is padding - WUT_UNKNOWN_BYTES(0x10); - IKillerNotificationTransferRecordManagerInternVTable_LoadFn LoadFn; - WUT_UNKNOWN_BYTES(0x4); - IKillerNotificationTransferRecordManagerInternVTable_LoadInitialFn LoadInitialFn; - WUT_UNKNOWN_BYTES(0x4); - IKillerNotificationTransferRecordManagerInternVTable_StoreFn StoreFn; - WUT_UNKNOWN_BYTES(0x4); - IKillerNotificationTransferRecordManagerInternVTable_FinalizeFn FinalizeFn; - WUT_UNKNOWN_BYTES(0x4); - IKillerNotificationTransferRecordManagerInternVTable_GetRecordCountFn GetRecordCountFn; - WUT_UNKNOWN_BYTES(0x4); - IKillerNotificationTransferRecordManagerInternVTable_GetRecordsFn GetRecordsFn; - WUT_UNKNOWN_BYTES(0x4); - IKillerNotificationTransferRecordManagerInternVTable_RegisterRecordsFn RegisterRecordsFn; - WUT_UNKNOWN_BYTES(0x4); - IKillerNotificationTransferRecordManagerInternVTable_RegisterRecordsOtherFn RegisterRecordsOtherFn; - } IKillerNotificationTransferRecordManagerInternalVTable; - WUT_CHECK_SIZE(IKillerNotificationTransferRecordManagerInternalVTable, 0x50); - WUT_CHECK_OFFSET(IKillerNotificationTransferRecordManagerInternalVTable, 0x14, LoadFn); - WUT_CHECK_OFFSET(IKillerNotificationTransferRecordManagerInternalVTable, 0x1C, LoadInitialFn); - WUT_CHECK_OFFSET(IKillerNotificationTransferRecordManagerInternalVTable, 0x24, StoreFn); - WUT_CHECK_OFFSET(IKillerNotificationTransferRecordManagerInternalVTable, 0x2C, FinalizeFn); - WUT_CHECK_OFFSET(IKillerNotificationTransferRecordManagerInternalVTable, 0x34, GetRecordCountFn); - WUT_CHECK_OFFSET(IKillerNotificationTransferRecordManagerInternalVTable, 0x3C, GetRecordsFn); - WUT_CHECK_OFFSET(IKillerNotificationTransferRecordManagerInternalVTable, 0x44, RegisterRecordsFn); - WUT_CHECK_OFFSET(IKillerNotificationTransferRecordManagerInternalVTable, 0x4C, RegisterRecordsOtherFn); - - typedef struct WUT_PACKED IKillerNotificationTransferRecordManagerInternal { - IKillerNotificationTransferRecordManagerInternalVTable *vtable; - } IKillerNotificationTransferRecordManagerIntern; - WUT_CHECK_SIZE(IKillerNotificationTransferRecordManagerInternal, 0x4); - WUT_CHECK_OFFSET(IKillerNotificationTransferRecordManagerInternal, 0x00, vtable); - - typedef struct WUT_PACKED KillerNotificationTransferRecordManagerInternalInternal { - IKillerNotificationTransferRecordManagerInternalVTable *vtable; - void *killerNotificationTransferRecordManagerImpl; - } KillerNotificationTransferRecordManagerInternalInternal; - WUT_CHECK_SIZE(KillerNotificationTransferRecordManagerInternalInternal, 0x8); - WUT_CHECK_OFFSET(KillerNotificationTransferRecordManagerInternalInternal, 0x00, vtable); - WUT_CHECK_OFFSET(KillerNotificationTransferRecordManagerInternalInternal, 0x04, killerNotificationTransferRecordManagerImpl); - - extern "C" IKillerNotificationTransferRecordManagerIntern *__ct__Q3_2nn2sl39KillerNotificationTransferRecordManagerFv(IKillerNotificationTransferRecordManagerInternal *); - extern "C" void *__dt__Q3_2nn2sl39KillerNotificationTransferRecordManagerFv(IKillerNotificationTransferRecordManagerInternal *, int); - extern "C" void Finalize__Q3_2nn2sl39KillerNotificationTransferRecordManagerFv(IKillerNotificationTransferRecordManagerInternal *); - extern "C" nn::Result Load__Q3_2nn2sl39KillerNotificationTransferRecordManagerFRQ3_2nn2sl7IStream(IKillerNotificationTransferRecordManagerInternal *, details::IStreamInternal *); - extern "C" nn::Result LoadInitial__Q3_2nn2sl39KillerNotificationTransferRecordManagerFv(IKillerNotificationTransferRecordManagerInternal *); - extern "C" uint32_t GetRecordCount__Q3_2nn2sl39KillerNotificationTransferRecordManagerCFv(IKillerNotificationTransferRecordManagerInternal *); - extern "C" uint32_t GetRecords__Q3_2nn2sl39KillerNotificationTransferRecordManagerCFPQ3_2nn2sl32KillerNotificationTransferRecordUi(IKillerNotificationTransferRecordManagerInternal *, KillerNotificationTransferRecord *, uint32_t); - extern "C" void RegisterRecords__Q3_2nn2sl39KillerNotificationTransferRecordManagerFPCQ3_2nn2sl32KillerNotificationTransferRecordUi(IKillerNotificationTransferRecordManagerInternal *, const KillerNotificationTransferRecord *, uint32_t); - extern "C" nn::Result Store__Q3_2nn2sl39KillerNotificationTransferRecordManagerCFRQ3_2nn2sl7IStream(IKillerNotificationTransferRecordManagerInternal *, details::IStreamInternal *); - - - extern "C" KillerNotificationTransferRecordManagerInternalInternal *__ct__Q3_2nn2sl47KillerNotificationTransferRecordManagerInternalFv(KillerNotificationTransferRecordManagerInternalInternal *); - extern "C" void *__dt__Q3_2nn2sl47KillerNotificationTransferRecordManagerInternalFv(KillerNotificationTransferRecordManagerInternalInternal *, int); - - class IKillerNotificationTransferRecordManagerBase { - friend class nn::sl::KillerNotificationSelector; - - public: - virtual ~IKillerNotificationTransferRecordManagerBase() = default; - - virtual nn::Result Load(nn::sl::details::IStreamBase &stream) = 0; - - virtual nn::Result LoadInitial() = 0; - - virtual nn::Result Store(nn::sl::details::IStreamBase &stream) = 0; - - virtual void Finalize() = 0; - - virtual uint32_t GetRecordCount() const = 0; - - virtual uint32_t GetRecords(KillerNotificationTransferRecord *outTransferRecords, uint32_t maxTransferRecords) const = 0; - - virtual void RegisterRecords(const KillerNotificationTransferRecord *transferRecords, uint32_t numTransferRecords) = 0; - - virtual nn::Result RegisterRecords(const uint32_t *u1, uint32_t u2) = 0; - - private: - virtual details::IKillerNotificationTransferRecordManagerInternal *GetInternal() = 0; - }; - - class KillerNotificationTransferRecordManagerFromPtr : public IKillerNotificationTransferRecordManagerBase { - public: - explicit KillerNotificationTransferRecordManagerFromPtr(details::IKillerNotificationTransferRecordManagerInternal *instance) : mInstancePtr(instance) { - } - - ~KillerNotificationTransferRecordManagerFromPtr() override = default; - - void Finalize() override { - if (!mInstancePtr) { - return; - } - mInstancePtr->vtable->FinalizeFn(mInstancePtr); - } - - nn::Result Load(nn::sl::details::IStreamBase &stream) override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->LoadFn(mInstancePtr, stream.GetInternal()); - } - - nn::Result LoadInitial() override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->LoadInitialFn(mInstancePtr); - } - - nn::Result Store(nn::sl::details::IStreamBase &stream) override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->StoreFn(mInstancePtr, stream.GetInternal()); - } - - uint32_t GetRecordCount() const override { - if (!mInstancePtr) { - return 0; - } - return mInstancePtr->vtable->GetRecordCountFn(mInstancePtr); - } - - uint32_t GetRecords(KillerNotificationTransferRecord *outTransferRecords, uint32_t maxTransferRecords) const override { - if (!mInstancePtr) { - return 0; - } - return mInstancePtr->vtable->GetRecordsFn(mInstancePtr, outTransferRecords, maxTransferRecords); - } - - void RegisterRecords(const KillerNotificationTransferRecord *transferRecords, uint32_t numTransferRecords) override { - if (!mInstancePtr) { - return; - } - mInstancePtr->vtable->RegisterRecordsFn(mInstancePtr, transferRecords, numTransferRecords); - } - - nn::Result RegisterRecords(const uint32_t *u1, uint32_t u2) override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->RegisterRecordsOtherFn(mInstancePtr, u1, u2); - } - - private: - details::IKillerNotificationTransferRecordManagerInternal *GetInternal() override { - return mInstancePtr; - } - details::IKillerNotificationTransferRecordManagerInternal *mInstancePtr = {}; - }; - } // namespace details +namespace nn::sl +{ +class KillerNotificationSelector; +namespace details +{ +class IKillerNotificationTransferRecordManagerBase; +struct IKillerNotificationTransferRecordManagerInternal; +typedef nn::Result (*IKillerNotificationTransferRecordManagerInternVTable_LoadFn)(IKillerNotificationTransferRecordManagerInternal *, nn::sl::details::IStreamInternal *); +typedef nn::Result (*IKillerNotificationTransferRecordManagerInternVTable_LoadInitialFn)(IKillerNotificationTransferRecordManagerInternal *); +typedef nn::Result (*IKillerNotificationTransferRecordManagerInternVTable_StoreFn)(IKillerNotificationTransferRecordManagerInternal *, nn::sl::details::IStreamInternal *); +typedef void (*IKillerNotificationTransferRecordManagerInternVTable_FinalizeFn)(IKillerNotificationTransferRecordManagerInternal *); +typedef uint32_t (*IKillerNotificationTransferRecordManagerInternVTable_GetRecordCountFn)(IKillerNotificationTransferRecordManagerInternal *); +typedef uint32_t (*IKillerNotificationTransferRecordManagerInternVTable_GetRecordsFn)(IKillerNotificationTransferRecordManagerInternal *, KillerNotificationTransferRecord *, uint32_t); +typedef void (*IKillerNotificationTransferRecordManagerInternVTable_RegisterRecordsFn)(IKillerNotificationTransferRecordManagerInternal *, const KillerNotificationTransferRecord *, uint32_t); +typedef nn::Result (*IKillerNotificationTransferRecordManagerInternVTable_RegisterRecordsOtherFn)(IKillerNotificationTransferRecordManagerInternal *, const uint32_t *, uint32_t); + +typedef struct WUT_PACKED IKillerNotificationTransferRecordManagerInternalVTable +{ + IKillerNotificationTransferRecordManagerBase *instance; // Normally this is padding + WUT_UNKNOWN_BYTES(0x10); + IKillerNotificationTransferRecordManagerInternVTable_LoadFn LoadFn; + WUT_UNKNOWN_BYTES(0x4); + IKillerNotificationTransferRecordManagerInternVTable_LoadInitialFn LoadInitialFn; + WUT_UNKNOWN_BYTES(0x4); + IKillerNotificationTransferRecordManagerInternVTable_StoreFn StoreFn; + WUT_UNKNOWN_BYTES(0x4); + IKillerNotificationTransferRecordManagerInternVTable_FinalizeFn FinalizeFn; + WUT_UNKNOWN_BYTES(0x4); + IKillerNotificationTransferRecordManagerInternVTable_GetRecordCountFn GetRecordCountFn; + WUT_UNKNOWN_BYTES(0x4); + IKillerNotificationTransferRecordManagerInternVTable_GetRecordsFn GetRecordsFn; + WUT_UNKNOWN_BYTES(0x4); + IKillerNotificationTransferRecordManagerInternVTable_RegisterRecordsFn RegisterRecordsFn; + WUT_UNKNOWN_BYTES(0x4); + IKillerNotificationTransferRecordManagerInternVTable_RegisterRecordsOtherFn RegisterRecordsOtherFn; +} IKillerNotificationTransferRecordManagerInternalVTable; +WUT_CHECK_SIZE(IKillerNotificationTransferRecordManagerInternalVTable, 0x50); +WUT_CHECK_OFFSET(IKillerNotificationTransferRecordManagerInternalVTable, 0x14, LoadFn); +WUT_CHECK_OFFSET(IKillerNotificationTransferRecordManagerInternalVTable, 0x1C, LoadInitialFn); +WUT_CHECK_OFFSET(IKillerNotificationTransferRecordManagerInternalVTable, 0x24, StoreFn); +WUT_CHECK_OFFSET(IKillerNotificationTransferRecordManagerInternalVTable, 0x2C, FinalizeFn); +WUT_CHECK_OFFSET(IKillerNotificationTransferRecordManagerInternalVTable, 0x34, GetRecordCountFn); +WUT_CHECK_OFFSET(IKillerNotificationTransferRecordManagerInternalVTable, 0x3C, GetRecordsFn); +WUT_CHECK_OFFSET(IKillerNotificationTransferRecordManagerInternalVTable, 0x44, RegisterRecordsFn); +WUT_CHECK_OFFSET(IKillerNotificationTransferRecordManagerInternalVTable, 0x4C, RegisterRecordsOtherFn); + +typedef struct WUT_PACKED IKillerNotificationTransferRecordManagerInternal +{ + IKillerNotificationTransferRecordManagerInternalVTable *vtable; +} IKillerNotificationTransferRecordManagerIntern; +WUT_CHECK_SIZE(IKillerNotificationTransferRecordManagerInternal, 0x4); +WUT_CHECK_OFFSET(IKillerNotificationTransferRecordManagerInternal, 0x00, vtable); + +typedef struct WUT_PACKED KillerNotificationTransferRecordManagerInternalInternal +{ + IKillerNotificationTransferRecordManagerInternalVTable *vtable; + void *killerNotificationTransferRecordManagerImpl; +} KillerNotificationTransferRecordManagerInternalInternal; +WUT_CHECK_SIZE(KillerNotificationTransferRecordManagerInternalInternal, 0x8); +WUT_CHECK_OFFSET(KillerNotificationTransferRecordManagerInternalInternal, 0x00, vtable); +WUT_CHECK_OFFSET(KillerNotificationTransferRecordManagerInternalInternal, 0x04, killerNotificationTransferRecordManagerImpl); + +extern "C" IKillerNotificationTransferRecordManagerIntern * +__ct__Q3_2nn2sl39KillerNotificationTransferRecordManagerFv(IKillerNotificationTransferRecordManagerInternal *); +extern "C" void * +__dt__Q3_2nn2sl39KillerNotificationTransferRecordManagerFv(IKillerNotificationTransferRecordManagerInternal *, int); +extern "C" void +Finalize__Q3_2nn2sl39KillerNotificationTransferRecordManagerFv(IKillerNotificationTransferRecordManagerInternal *); +extern "C" nn::Result +Load__Q3_2nn2sl39KillerNotificationTransferRecordManagerFRQ3_2nn2sl7IStream(IKillerNotificationTransferRecordManagerInternal *, details::IStreamInternal *); +extern "C" nn::Result +LoadInitial__Q3_2nn2sl39KillerNotificationTransferRecordManagerFv(IKillerNotificationTransferRecordManagerInternal *); +extern "C" uint32_t +GetRecordCount__Q3_2nn2sl39KillerNotificationTransferRecordManagerCFv(IKillerNotificationTransferRecordManagerInternal *); +extern "C" uint32_t +GetRecords__Q3_2nn2sl39KillerNotificationTransferRecordManagerCFPQ3_2nn2sl32KillerNotificationTransferRecordUi(IKillerNotificationTransferRecordManagerInternal *, KillerNotificationTransferRecord *, uint32_t); +extern "C" void +RegisterRecords__Q3_2nn2sl39KillerNotificationTransferRecordManagerFPCQ3_2nn2sl32KillerNotificationTransferRecordUi(IKillerNotificationTransferRecordManagerInternal *, const KillerNotificationTransferRecord *, uint32_t); +extern "C" nn::Result +Store__Q3_2nn2sl39KillerNotificationTransferRecordManagerCFRQ3_2nn2sl7IStream(IKillerNotificationTransferRecordManagerInternal *, details::IStreamInternal *); + + +extern "C" KillerNotificationTransferRecordManagerInternalInternal * +__ct__Q3_2nn2sl47KillerNotificationTransferRecordManagerInternalFv(KillerNotificationTransferRecordManagerInternalInternal *); +extern "C" void * +__dt__Q3_2nn2sl47KillerNotificationTransferRecordManagerInternalFv(KillerNotificationTransferRecordManagerInternalInternal *, int); + +class IKillerNotificationTransferRecordManagerBase +{ + friend class nn::sl::KillerNotificationSelector; + +public: + virtual ~IKillerNotificationTransferRecordManagerBase() = default; + + virtual nn::Result + Load(nn::sl::details::IStreamBase &stream) = 0; + + virtual nn::Result + LoadInitial() = 0; + + virtual nn::Result + Store(nn::sl::details::IStreamBase &stream) = 0; + + virtual void + Finalize() = 0; + + virtual uint32_t + GetRecordCount() const = 0; + + virtual uint32_t + GetRecords(KillerNotificationTransferRecord *outTransferRecords, uint32_t maxTransferRecords) const = 0; + + virtual void + RegisterRecords(const KillerNotificationTransferRecord *transferRecords, uint32_t numTransferRecords) = 0; + + virtual nn::Result + RegisterRecords(const uint32_t *u1, uint32_t u2) = 0; + +private: + virtual details::IKillerNotificationTransferRecordManagerInternal * + GetInternal() = 0; +}; + +class KillerNotificationTransferRecordManagerFromPtr : public IKillerNotificationTransferRecordManagerBase +{ +public: + explicit KillerNotificationTransferRecordManagerFromPtr(details::IKillerNotificationTransferRecordManagerInternal *instance) : + mInstancePtr(instance) + { + } + + ~KillerNotificationTransferRecordManagerFromPtr() override = default; + + void + Finalize() override + { + if (!mInstancePtr) { + return; + } + mInstancePtr->vtable->FinalizeFn(mInstancePtr); + } + + nn::Result + Load(nn::sl::details::IStreamBase &stream) override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->LoadFn(mInstancePtr, stream.GetInternal()); + } + + nn::Result + LoadInitial() override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->LoadInitialFn(mInstancePtr); + } + + nn::Result + Store(nn::sl::details::IStreamBase &stream) override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->StoreFn(mInstancePtr, stream.GetInternal()); + } + + uint32_t + GetRecordCount() const override + { + if (!mInstancePtr) { + return 0; + } + return mInstancePtr->vtable->GetRecordCountFn(mInstancePtr); + } + + uint32_t + GetRecords(KillerNotificationTransferRecord *outTransferRecords, uint32_t maxTransferRecords) const override + { + if (!mInstancePtr) { + return 0; + } + return mInstancePtr->vtable->GetRecordsFn(mInstancePtr, outTransferRecords, maxTransferRecords); + } + + void + RegisterRecords(const KillerNotificationTransferRecord *transferRecords, uint32_t numTransferRecords) override + { + if (!mInstancePtr) { + return; + } + mInstancePtr->vtable->RegisterRecordsFn(mInstancePtr, transferRecords, numTransferRecords); + } + + nn::Result + RegisterRecords(const uint32_t *u1, uint32_t u2) override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->RegisterRecordsOtherFn(mInstancePtr, u1, u2); + } + +private: + details::IKillerNotificationTransferRecordManagerInternal * + GetInternal() override + { + return mInstancePtr; + } + details::IKillerNotificationTransferRecordManagerInternal *mInstancePtr = {}; +}; +} // namespace details } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/details/ILaunchedTitleListAccessoDetails.h b/include/nn/sl/details/ILaunchedTitleListAccessoDetails.h index e88dd4990..2b68e7a1e 100644 --- a/include/nn/sl/details/ILaunchedTitleListAccessoDetails.h +++ b/include/nn/sl/details/ILaunchedTitleListAccessoDetails.h @@ -1,73 +1,87 @@ #pragma once +#include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class KillerNotificationSelector; - class TitleListCache; - namespace details { - class ILaunchedTitleListAccessorBase; - struct ILaunchedTitleListAccessorInternal; - - typedef nn::Result (*ILaunchedTitleListAccessor_GetByAccountFn)(ILaunchedTitleListAccessorInternal *, nn::sl::TitleInfo *outTitleInfos, int *outTitleInfoSize, int inTitleInfosSize, int userId); - - struct WUT_PACKED ILaunchedTitleListAccessorInternalVTable { - ILaunchedTitleListAccessorBase *instance; // normally this is padding - uint32_t info; - WUT_PADDING_BYTES(4); - uint32_t destructor; - WUT_PADDING_BYTES(4); - ILaunchedTitleListAccessor_GetByAccountFn GetByAccountFn; - }; - WUT_CHECK_SIZE(ILaunchedTitleListAccessorInternalVTable, 0x18); - WUT_CHECK_OFFSET(ILaunchedTitleListAccessorInternalVTable, 0x14, GetByAccountFn); - - typedef struct WUT_PACKED ILaunchedTitleListAccessorInternal { - ILaunchedTitleListAccessorInternalVTable *vtable; - } ILaunchedTitleListAccessorInternal; - WUT_CHECK_SIZE(ILaunchedTitleListAccessorInternal, 0x04); - WUT_CHECK_OFFSET(ILaunchedTitleListAccessorInternal, 0x00, vtable); - - class ILaunchedTitleListAccessorBase { - friend class nn::sl::KillerNotificationSelector; - friend class nn::sl::TitleListCache; - - public: - ILaunchedTitleListAccessorBase() = default; - virtual ~ILaunchedTitleListAccessorBase() = default; - - virtual nn::Result GetByAccount(nn::sl::TitleInfo *outTitleInfos, int *outTitleInfoSize, int inTitleInfosSize, int userId) const = 0; - - private: - virtual details::ILaunchedTitleListAccessorInternal *GetInternal() = 0; - }; - - class LaunchedTitleListAccessorFromPtr : public ILaunchedTitleListAccessorBase { - public: - explicit LaunchedTitleListAccessorFromPtr(details::ILaunchedTitleListAccessorInternal *ptr) : mInstancePtr(ptr) { - } - - nn::Result GetByAccount(nn::sl::TitleInfo *outTitleInfos, int *outTitleInfoNum, int maxNumTitleInfos, int userId) const override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->GetByAccountFn(mInstancePtr, outTitleInfos, outTitleInfoNum, maxNumTitleInfos, userId); - } - - details::ILaunchedTitleListAccessorInternal *GetInternal() override { - return mInstancePtr; - } - - private: - details::ILaunchedTitleListAccessorInternal *mInstancePtr; - }; - - - } // namespace details +namespace nn::sl +{ +class KillerNotificationSelector; +class TitleListCache; +namespace details +{ +class ILaunchedTitleListAccessorBase; +struct ILaunchedTitleListAccessorInternal; + +typedef nn::Result (*ILaunchedTitleListAccessor_GetByAccountFn)(ILaunchedTitleListAccessorInternal *, nn::sl::TitleInfo *outTitleInfos, int *outTitleInfoSize, int inTitleInfosSize, int userId); + +struct WUT_PACKED ILaunchedTitleListAccessorInternalVTable +{ + ILaunchedTitleListAccessorBase *instance; // normally this is padding + uint32_t info; + WUT_PADDING_BYTES(4); + uint32_t destructor; + WUT_PADDING_BYTES(4); + ILaunchedTitleListAccessor_GetByAccountFn GetByAccountFn; +}; +WUT_CHECK_SIZE(ILaunchedTitleListAccessorInternalVTable, 0x18); +WUT_CHECK_OFFSET(ILaunchedTitleListAccessorInternalVTable, 0x14, GetByAccountFn); + +typedef struct WUT_PACKED ILaunchedTitleListAccessorInternal +{ + ILaunchedTitleListAccessorInternalVTable *vtable; +} ILaunchedTitleListAccessorInternal; +WUT_CHECK_SIZE(ILaunchedTitleListAccessorInternal, 0x04); +WUT_CHECK_OFFSET(ILaunchedTitleListAccessorInternal, 0x00, vtable); + +class ILaunchedTitleListAccessorBase +{ + friend class nn::sl::KillerNotificationSelector; + friend class nn::sl::TitleListCache; + +public: + ILaunchedTitleListAccessorBase() = default; + virtual ~ILaunchedTitleListAccessorBase() = default; + + virtual nn::Result + GetByAccount(nn::sl::TitleInfo *outTitleInfos, int *outTitleInfoSize, int inTitleInfosSize, int userId) const = 0; + +private: + virtual details::ILaunchedTitleListAccessorInternal * + GetInternal() = 0; +}; + +class LaunchedTitleListAccessorFromPtr : public ILaunchedTitleListAccessorBase +{ +public: + explicit LaunchedTitleListAccessorFromPtr(details::ILaunchedTitleListAccessorInternal *ptr) : + mInstancePtr(ptr) + { + } + + nn::Result + GetByAccount(nn::sl::TitleInfo *outTitleInfos, int *outTitleInfoNum, int maxNumTitleInfos, int userId) const override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->GetByAccountFn(mInstancePtr, outTitleInfos, outTitleInfoNum, maxNumTitleInfos, userId); + } + + details::ILaunchedTitleListAccessorInternal * + GetInternal() override + { + return mInstancePtr; + } + +private: + details::ILaunchedTitleListAccessorInternal *mInstancePtr; +}; + + +} // namespace details } // namespace nn::sl diff --git a/include/nn/sl/details/IMetaInfoAccessorDetails.h b/include/nn/sl/details/IMetaInfoAccessorDetails.h index 09e11b94b..ae56e6a62 100644 --- a/include/nn/sl/details/IMetaInfoAccessorDetails.h +++ b/include/nn/sl/details/IMetaInfoAccessorDetails.h @@ -1,69 +1,83 @@ #pragma once +#include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class TitleListCache; - namespace details { - class IMetaInfoAccessorBase; - struct IMetaInfoAccessorInternal; +namespace nn::sl +{ +class TitleListCache; +namespace details +{ +class IMetaInfoAccessorBase; +struct IMetaInfoAccessorInternal; - typedef nn::Result (*IMetaInfoAccessor_GetFn)(IMetaInfoAccessorInternal *, nn::sl::TitleMetaInfo *, const nn::sl::TitleInfo &); +typedef nn::Result (*IMetaInfoAccessor_GetFn)(IMetaInfoAccessorInternal *, nn::sl::TitleMetaInfo *, const nn::sl::TitleInfo &); - struct WUT_PACKED IMetaInfoAccessorInternalVTable { - IMetaInfoAccessorBase *instance; // normally this is padding - uint32_t info; - WUT_PADDING_BYTES(4); - uint32_t destructor; - WUT_PADDING_BYTES(4); - IMetaInfoAccessor_GetFn GetFn; - }; - WUT_CHECK_SIZE(IMetaInfoAccessorInternalVTable, 0x18); - WUT_CHECK_OFFSET(IMetaInfoAccessorInternalVTable, 0x00, instance); - WUT_CHECK_OFFSET(IMetaInfoAccessorInternalVTable, 0x14, GetFn); +struct WUT_PACKED IMetaInfoAccessorInternalVTable +{ + IMetaInfoAccessorBase *instance; // normally this is padding + uint32_t info; + WUT_PADDING_BYTES(4); + uint32_t destructor; + WUT_PADDING_BYTES(4); + IMetaInfoAccessor_GetFn GetFn; +}; +WUT_CHECK_SIZE(IMetaInfoAccessorInternalVTable, 0x18); +WUT_CHECK_OFFSET(IMetaInfoAccessorInternalVTable, 0x00, instance); +WUT_CHECK_OFFSET(IMetaInfoAccessorInternalVTable, 0x14, GetFn); - typedef struct WUT_PACKED IMetaInfoAccessorInternal { - IMetaInfoAccessorInternalVTable *vtable; - } IMetaInfoAccessorInternal; - WUT_CHECK_SIZE(IMetaInfoAccessorInternal, 0x04); - WUT_CHECK_OFFSET(IMetaInfoAccessorInternal, 0x00, vtable); +typedef struct WUT_PACKED IMetaInfoAccessorInternal +{ + IMetaInfoAccessorInternalVTable *vtable; +} IMetaInfoAccessorInternal; +WUT_CHECK_SIZE(IMetaInfoAccessorInternal, 0x04); +WUT_CHECK_OFFSET(IMetaInfoAccessorInternal, 0x00, vtable); - class IMetaInfoAccessorBase { - friend class nn::sl::TitleListCache; +class IMetaInfoAccessorBase +{ + friend class nn::sl::TitleListCache; - public: - IMetaInfoAccessorBase() = default; - virtual ~IMetaInfoAccessorBase() = default; +public: + IMetaInfoAccessorBase() = default; + virtual ~IMetaInfoAccessorBase() = default; - virtual nn::Result Get(nn::sl::TitleMetaInfo *outMetaInfo, const nn::sl::TitleInfo &titleInfo) const = 0; + virtual nn::Result + Get(nn::sl::TitleMetaInfo *outMetaInfo, const nn::sl::TitleInfo &titleInfo) const = 0; - private: - virtual details::IMetaInfoAccessorInternal *GetInternal() = 0; - }; +private: + virtual details::IMetaInfoAccessorInternal * + GetInternal() = 0; +}; - class MetaInfoAccessorFromPtr : public IMetaInfoAccessorBase { - public: - explicit MetaInfoAccessorFromPtr(details::IMetaInfoAccessorInternal *ptr) : mInstancePtr(ptr) { - } - nn::Result Get(nn::sl::TitleMetaInfo *outMetaInfo, const nn::sl::TitleInfo &titleInfo) const override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->GetFn(mInstancePtr, outMetaInfo, titleInfo); - } +class MetaInfoAccessorFromPtr : public IMetaInfoAccessorBase +{ +public: + explicit MetaInfoAccessorFromPtr(details::IMetaInfoAccessorInternal *ptr) : + mInstancePtr(ptr) + { + } + nn::Result + Get(nn::sl::TitleMetaInfo *outMetaInfo, const nn::sl::TitleInfo &titleInfo) const override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->GetFn(mInstancePtr, outMetaInfo, titleInfo); + } - private: - nn::sl::details::IMetaInfoAccessorInternal *GetInternal() override { - return mInstancePtr; - } +private: + nn::sl::details::IMetaInfoAccessorInternal * + GetInternal() override + { + return mInstancePtr; + } - details::IMetaInfoAccessorInternal *mInstancePtr; - }; - } // namespace details + details::IMetaInfoAccessorInternal *mInstancePtr; +}; +} // namespace details } // namespace nn::sl diff --git a/include/nn/sl/details/IPreferentialTitleAccessorDetails.h b/include/nn/sl/details/IPreferentialTitleAccessorDetails.h index 79ecc0dcd..92d8c5e4e 100644 --- a/include/nn/sl/details/IPreferentialTitleAccessorDetails.h +++ b/include/nn/sl/details/IPreferentialTitleAccessorDetails.h @@ -1,70 +1,84 @@ #pragma once +#include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class QuickStartApplicationSelector; - namespace details { - class IPreferentialTitleAccessorBase; - struct IPreferentialTitleAccessorInternal; +namespace nn::sl +{ +class QuickStartApplicationSelector; +namespace details +{ +class IPreferentialTitleAccessorBase; +struct IPreferentialTitleAccessorInternal; - typedef nn::Result (*IPreferentialTitleAccessorBase_GetFn)(IPreferentialTitleAccessorInternal *, TitleInfo *, uint32_t *, int, uint32_t); +typedef nn::Result (*IPreferentialTitleAccessorBase_GetFn)(IPreferentialTitleAccessorInternal *, TitleInfo *, uint32_t *, int, uint32_t); - struct WUT_PACKED IPreferentialTitleAccessorInternalVTable { - IPreferentialTitleAccessorBase *instance; // Is normally padding - uint32_t info; - WUT_PADDING_BYTES(4); - uint32_t destructor; - WUT_PADDING_BYTES(4); - IPreferentialTitleAccessorBase_GetFn GetFn; - }; - WUT_CHECK_SIZE(IPreferentialTitleAccessorInternalVTable, 0x18); - WUT_CHECK_OFFSET(IPreferentialTitleAccessorInternalVTable, 0x00, instance); - WUT_CHECK_OFFSET(IPreferentialTitleAccessorInternalVTable, 0x14, GetFn); +struct WUT_PACKED IPreferentialTitleAccessorInternalVTable +{ + IPreferentialTitleAccessorBase *instance; // Is normally padding + uint32_t info; + WUT_PADDING_BYTES(4); + uint32_t destructor; + WUT_PADDING_BYTES(4); + IPreferentialTitleAccessorBase_GetFn GetFn; +}; +WUT_CHECK_SIZE(IPreferentialTitleAccessorInternalVTable, 0x18); +WUT_CHECK_OFFSET(IPreferentialTitleAccessorInternalVTable, 0x00, instance); +WUT_CHECK_OFFSET(IPreferentialTitleAccessorInternalVTable, 0x14, GetFn); - typedef struct WUT_PACKED IPreferentialTitleAccessorInternal { - IPreferentialTitleAccessorInternalVTable *vtable; - } IPreferentialTitleAccessorInternal; - WUT_CHECK_SIZE(IPreferentialTitleAccessorInternal, 0x04); - WUT_CHECK_OFFSET(IPreferentialTitleAccessorInternal, 0x00, vtable); +typedef struct WUT_PACKED IPreferentialTitleAccessorInternal +{ + IPreferentialTitleAccessorInternalVTable *vtable; +} IPreferentialTitleAccessorInternal; +WUT_CHECK_SIZE(IPreferentialTitleAccessorInternal, 0x04); +WUT_CHECK_OFFSET(IPreferentialTitleAccessorInternal, 0x00, vtable); - class IPreferentialTitleAccessorBase { - friend class nn::sl::QuickStartApplicationSelector; +class IPreferentialTitleAccessorBase +{ + friend class nn::sl::QuickStartApplicationSelector; - public: - IPreferentialTitleAccessorBase() = default; +public: + IPreferentialTitleAccessorBase() = default; - virtual ~IPreferentialTitleAccessorBase() = default; + virtual ~IPreferentialTitleAccessorBase() = default; - virtual nn::Result Get(TitleInfo *outTitleInfo, uint32_t *outTitleInfoNum, int maxNumTitleInfos, uint32_t u1) const = 0; + virtual nn::Result + Get(TitleInfo *outTitleInfo, uint32_t *outTitleInfoNum, int maxNumTitleInfos, uint32_t u1) const = 0; - private: - virtual details::IPreferentialTitleAccessorInternal *GetInternal() = 0; - }; +private: + virtual details::IPreferentialTitleAccessorInternal * + GetInternal() = 0; +}; - class PreferentialTitleAccessorFromPtr : public IPreferentialTitleAccessorBase { - public: - explicit PreferentialTitleAccessorFromPtr(details::IPreferentialTitleAccessorInternal *ptr) : mInstancePtr(ptr) { - } - nn::Result Get(TitleInfo *outTitleInfo, uint32_t *outTitleInfoNum, int maxNumTitleInfos, uint32_t u1) const override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->GetFn(mInstancePtr, outTitleInfo, outTitleInfoNum, maxNumTitleInfos, u1); - } +class PreferentialTitleAccessorFromPtr : public IPreferentialTitleAccessorBase +{ +public: + explicit PreferentialTitleAccessorFromPtr(details::IPreferentialTitleAccessorInternal *ptr) : + mInstancePtr(ptr) + { + } + nn::Result + Get(TitleInfo *outTitleInfo, uint32_t *outTitleInfoNum, int maxNumTitleInfos, uint32_t u1) const override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->GetFn(mInstancePtr, outTitleInfo, outTitleInfoNum, maxNumTitleInfos, u1); + } - private: - details::IPreferentialTitleAccessorInternal *GetInternal() override { - return mInstancePtr; - } +private: + details::IPreferentialTitleAccessorInternal * + GetInternal() override + { + return mInstancePtr; + } - details::IPreferentialTitleAccessorInternal *mInstancePtr; - }; - } // namespace details + details::IPreferentialTitleAccessorInternal *mInstancePtr; +}; +} // namespace details } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/details/ISerializerDetails.h b/include/nn/sl/details/ISerializerDetails.h index 53baa8f71..ef57791eb 100644 --- a/include/nn/sl/details/ISerializerDetails.h +++ b/include/nn/sl/details/ISerializerDetails.h @@ -1,112 +1,132 @@ #pragma once -#include #include +#include #ifdef __cplusplus -namespace nn::sl { - template - class ISerializerBase; - - class TitleIconCache; - class DataCreator; - class CacheManager; - class Condition; - class KillerNotificationSelector; - class TitleListCache; - - namespace details { - struct ISerializerInternal; - - typedef nn::Result (*ISerializer_SerializeFn)(ISerializerInternal *, void *, uint32_t); - typedef nn::Result (*ISerializer_DeserializeFn)(ISerializerInternal *, void *, uint32_t); - typedef nn::Result (*ISerializer_GetCountFn)(ISerializerInternal *, uint32_t *); - - struct WUT_PACKED ISerializerInternalVTable { - ISerializerBase *instance; // Is normally padding - uint32_t info; - WUT_PADDING_BYTES(4); - uint32_t destructor; - WUT_PADDING_BYTES(4); - ISerializer_SerializeFn SerializeFn; - WUT_PADDING_BYTES(4); - ISerializer_DeserializeFn DeserializeFn; - WUT_PADDING_BYTES(4); - ISerializer_GetCountFn GetCountFn; - }; - WUT_CHECK_SIZE(ISerializerInternalVTable, 0x28); - WUT_CHECK_OFFSET(ISerializerInternalVTable, 0x00, instance); - WUT_CHECK_OFFSET(ISerializerInternalVTable, 0x14, SerializeFn); - WUT_CHECK_OFFSET(ISerializerInternalVTable, 0x1C, DeserializeFn); - WUT_CHECK_OFFSET(ISerializerInternalVTable, 0x24, GetCountFn); - - typedef struct WUT_PACKED ISerializerInternal { - ISerializerInternalVTable *vtable; - } ISerializerInternal; - WUT_CHECK_SIZE(ISerializerInternal, 0x04); - WUT_CHECK_OFFSET(ISerializerInternal, 0x00, vtable); - - template - class ISerializerBase { - friend class nn::sl::TitleIconCache; - friend class nn::sl::DataCreator; - friend class nn::sl::CacheManager; - friend class nn::sl::Condition; - friend class nn::sl::KillerNotificationSelector; - friend class nn::sl::TitleListCache; - - public: - ISerializerBase() = default; - - virtual ~ISerializerBase() = default; - - virtual nn::Result Serialize(void *buffer, uint32_t size) const = 0; - - virtual nn::Result Deserialize(void *buffer, uint32_t size) const = 0; - - virtual nn::Result GetCount(uint32_t *outCount) const = 0; - - private: - virtual details::ISerializerInternal *GetInternal() = 0; - }; - - - template - class SerializerFromPtr : public ISerializerBase { - public: - explicit SerializerFromPtr(details::ISerializerInternal *ptr) : mInstancePtr(ptr) { - } - - nn::Result Serialize(void *buffer, uint32_t size) const override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->SerializeFn(mInstancePtr, buffer, size); - } - - nn::Result Deserialize(void *buffer, uint32_t size) const override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->DeserializeFn(mInstancePtr, buffer, size); - } - - nn::Result GetCount(uint32_t *outCount) const override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->GetCountFn(mInstancePtr, outCount); - } - - private: - details::ISerializerInternal *GetInternal() override { - return mInstancePtr; - } - - details::ISerializerInternal *mInstancePtr; - }; - } // namespace details +namespace nn::sl +{ +template +class ISerializerBase; + +class TitleIconCache; +class DataCreator; +class CacheManager; +class Condition; +class KillerNotificationSelector; +class TitleListCache; + +namespace details +{ +struct ISerializerInternal; + +typedef nn::Result (*ISerializer_SerializeFn)(ISerializerInternal *, void *, uint32_t); +typedef nn::Result (*ISerializer_DeserializeFn)(ISerializerInternal *, void *, uint32_t); +typedef nn::Result (*ISerializer_GetCountFn)(ISerializerInternal *, uint32_t *); + +struct WUT_PACKED ISerializerInternalVTable +{ + ISerializerBase *instance; // Is normally padding + uint32_t info; + WUT_PADDING_BYTES(4); + uint32_t destructor; + WUT_PADDING_BYTES(4); + ISerializer_SerializeFn SerializeFn; + WUT_PADDING_BYTES(4); + ISerializer_DeserializeFn DeserializeFn; + WUT_PADDING_BYTES(4); + ISerializer_GetCountFn GetCountFn; +}; +WUT_CHECK_SIZE(ISerializerInternalVTable, 0x28); +WUT_CHECK_OFFSET(ISerializerInternalVTable, 0x00, instance); +WUT_CHECK_OFFSET(ISerializerInternalVTable, 0x14, SerializeFn); +WUT_CHECK_OFFSET(ISerializerInternalVTable, 0x1C, DeserializeFn); +WUT_CHECK_OFFSET(ISerializerInternalVTable, 0x24, GetCountFn); + +typedef struct WUT_PACKED ISerializerInternal +{ + ISerializerInternalVTable *vtable; +} ISerializerInternal; +WUT_CHECK_SIZE(ISerializerInternal, 0x04); +WUT_CHECK_OFFSET(ISerializerInternal, 0x00, vtable); + +template +class ISerializerBase +{ + friend class nn::sl::TitleIconCache; + friend class nn::sl::DataCreator; + friend class nn::sl::CacheManager; + friend class nn::sl::Condition; + friend class nn::sl::KillerNotificationSelector; + friend class nn::sl::TitleListCache; + +public: + ISerializerBase() = default; + + virtual ~ISerializerBase() = default; + + virtual nn::Result + Serialize(void *buffer, uint32_t size) const = 0; + + virtual nn::Result + Deserialize(void *buffer, uint32_t size) const = 0; + + virtual nn::Result + GetCount(uint32_t *outCount) const = 0; + +private: + virtual details::ISerializerInternal * + GetInternal() = 0; +}; + + +template +class SerializerFromPtr : public ISerializerBase +{ +public: + explicit SerializerFromPtr(details::ISerializerInternal *ptr) : + mInstancePtr(ptr) + { + } + + nn::Result + Serialize(void *buffer, uint32_t size) const override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->SerializeFn(mInstancePtr, buffer, size); + } + + nn::Result + Deserialize(void *buffer, uint32_t size) const override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->DeserializeFn(mInstancePtr, buffer, size); + } + + nn::Result + GetCount(uint32_t *outCount) const override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->GetCountFn(mInstancePtr, outCount); + } + +private: + details::ISerializerInternal * + GetInternal() override + { + return mInstancePtr; + } + + details::ISerializerInternal *mInstancePtr; +}; +} // namespace details } // namespace nn::sl diff --git a/include/nn/sl/details/ISettingAccessorDetails.h b/include/nn/sl/details/ISettingAccessorDetails.h index 3b6aa0041..09cdc7510 100644 --- a/include/nn/sl/details/ISettingAccessorDetails.h +++ b/include/nn/sl/details/ISettingAccessorDetails.h @@ -1,82 +1,96 @@ #pragma once +#include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class TitleIconCache; - class DataCreator; - class Condition; - class DrcManager; - class KillerNotificationSelector; - class QuickStartApplicationSelector; - namespace details { - class ISettingAccessorBase; - struct ISettingAccessorInternal; - - typedef nn::Result (*ISettingAccessor_GetFn)(ISettingAccessorInternal *, Setting *); - - struct WUT_PACKED ISettingAccessorInternalVTable { - ISettingAccessorBase *instance; // Is normally padding - uint32_t info; - WUT_PADDING_BYTES(4); - uint32_t destructor; - WUT_PADDING_BYTES(4); - ISettingAccessor_GetFn GetFn; - }; - WUT_CHECK_SIZE(ISettingAccessorInternalVTable, 0x18); - WUT_CHECK_OFFSET(ISettingAccessorInternalVTable, 0x00, instance); - WUT_CHECK_OFFSET(ISettingAccessorInternalVTable, 0x14, GetFn); - - typedef struct WUT_PACKED ISettingAccessorInternal { - ISettingAccessorInternalVTable *vtable; - } ISettingAccessorInternal; - WUT_CHECK_SIZE(ISettingAccessorInternal, 0x04); - WUT_CHECK_OFFSET(ISettingAccessorInternal, 0x00, vtable); - - class ISettingAccessorBase { - friend class nn::sl::TitleIconCache; - friend class nn::sl::DataCreator; - friend class nn::sl::Condition; - friend class nn::sl::DrcManager; - friend class nn::sl::KillerNotificationSelector; - friend class nn::sl::QuickStartApplicationSelector; - - public: - ISettingAccessorBase() = default; - - virtual ~ISettingAccessorBase() = default; - - virtual nn::Result Get(nn::sl::Setting *) const = 0; - - private: - virtual details::ISettingAccessorInternal *GetInternal() = 0; - }; - - - class SettingAccessorFromPtr : public ISettingAccessorBase { - public: - explicit SettingAccessorFromPtr(details::ISettingAccessorInternal *ptr) : mInstancePtr(ptr) { - } - - nn::Result Get(nn::sl::Setting *outSetting) const override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->GetFn(mInstancePtr, outSetting); - } - - private: - details::ISettingAccessorInternal *GetInternal() override { - return mInstancePtr; - } - - details::ISettingAccessorInternal *mInstancePtr; - }; - } // namespace details +namespace nn::sl +{ +class TitleIconCache; +class DataCreator; +class Condition; +class DrcManager; +class KillerNotificationSelector; +class QuickStartApplicationSelector; +namespace details +{ +class ISettingAccessorBase; +struct ISettingAccessorInternal; + +typedef nn::Result (*ISettingAccessor_GetFn)(ISettingAccessorInternal *, Setting *); + +struct WUT_PACKED ISettingAccessorInternalVTable +{ + ISettingAccessorBase *instance; // Is normally padding + uint32_t info; + WUT_PADDING_BYTES(4); + uint32_t destructor; + WUT_PADDING_BYTES(4); + ISettingAccessor_GetFn GetFn; +}; +WUT_CHECK_SIZE(ISettingAccessorInternalVTable, 0x18); +WUT_CHECK_OFFSET(ISettingAccessorInternalVTable, 0x00, instance); +WUT_CHECK_OFFSET(ISettingAccessorInternalVTable, 0x14, GetFn); + +typedef struct WUT_PACKED ISettingAccessorInternal +{ + ISettingAccessorInternalVTable *vtable; +} ISettingAccessorInternal; +WUT_CHECK_SIZE(ISettingAccessorInternal, 0x04); +WUT_CHECK_OFFSET(ISettingAccessorInternal, 0x00, vtable); + +class ISettingAccessorBase +{ + friend class nn::sl::TitleIconCache; + friend class nn::sl::DataCreator; + friend class nn::sl::Condition; + friend class nn::sl::DrcManager; + friend class nn::sl::KillerNotificationSelector; + friend class nn::sl::QuickStartApplicationSelector; + +public: + ISettingAccessorBase() = default; + + virtual ~ISettingAccessorBase() = default; + + virtual nn::Result + Get(nn::sl::Setting *) const = 0; + +private: + virtual details::ISettingAccessorInternal * + GetInternal() = 0; +}; + + +class SettingAccessorFromPtr : public ISettingAccessorBase +{ +public: + explicit SettingAccessorFromPtr(details::ISettingAccessorInternal *ptr) : + mInstancePtr(ptr) + { + } + + nn::Result + Get(nn::sl::Setting *outSetting) const override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->GetFn(mInstancePtr, outSetting); + } + +private: + details::ISettingAccessorInternal * + GetInternal() override + { + return mInstancePtr; + } + + details::ISettingAccessorInternal *mInstancePtr; +}; +} // namespace details } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/details/IStreamDetails.h b/include/nn/sl/details/IStreamDetails.h index fcf7ee478..1753a45cf 100644 --- a/include/nn/sl/details/IStreamDetails.h +++ b/include/nn/sl/details/IStreamDetails.h @@ -1,74 +1,84 @@ #pragma once +#include #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class LaunchInfoDatabase; - class KillerNotificationTransferRecordManager; - class KillerNotificationTransferRecordManagerInternal; - - namespace details { - class KillerNotificationTransferRecordManagerFromPtr; - class IStreamBase; - struct IStreamInternal; - - typedef nn::Result (*IStream_ReadFn)(IStreamInternal *, uint32_t *bytesRead, void *buffer, uint32_t readSize); - typedef nn::Result (*IStream_WriteFn)(IStreamInternal *, uint32_t *bytesWritten, void *buffer, uint32_t writeSize); - typedef nn::Result (*IStream_GetSizeFn)(IStreamInternal *, uint32_t *fileSize); - typedef nn::Result (*IStream_SeekFn)(IStreamInternal *, int32_t offset, nn::sl::SeekOrigin seekOrigin); - - struct WUT_PACKED IStreamInternalVTable { - IStreamBase *instance; // normally this is padding - uint32_t info; - WUT_PADDING_BYTES(4); - uint32_t destructor; - WUT_PADDING_BYTES(4); - IStream_ReadFn ReadFn; - WUT_PADDING_BYTES(4); - IStream_WriteFn WriteFn; - WUT_PADDING_BYTES(4); - IStream_GetSizeFn GetSizeFn; - WUT_PADDING_BYTES(4); - IStream_SeekFn SeekFn; - }; - WUT_CHECK_SIZE(IStreamInternalVTable, 0x30); - WUT_CHECK_OFFSET(IStreamInternalVTable, 0x14, ReadFn); - WUT_CHECK_OFFSET(IStreamInternalVTable, 0x1C, WriteFn); - WUT_CHECK_OFFSET(IStreamInternalVTable, 0x24, GetSizeFn); - WUT_CHECK_OFFSET(IStreamInternalVTable, 0x2C, SeekFn); - - typedef struct WUT_PACKED IStreamInternal { - IStreamInternalVTable *vtable; - } IStreamInternal; - WUT_CHECK_SIZE(IStreamInternal, 0x04); - - class IStreamBase { - friend class nn::sl::LaunchInfoDatabase; - friend class nn::sl::KillerNotificationTransferRecordManager; - friend class nn::sl::KillerNotificationTransferRecordManagerInternal; - friend class nn::sl::details::KillerNotificationTransferRecordManagerFromPtr; - - public: - IStreamBase() = default; - - virtual ~IStreamBase() = default; - - virtual nn::Result Read(uint32_t *bytesRead, void *buffer, uint32_t readSize) = 0; - virtual nn::Result Write(uint32_t *bytesWritten, void *buffer, uint32_t writeSize) = 0; - virtual nn::Result GetSize(uint32_t *fileSize) = 0; - virtual nn::Result Seek(int32_t offset, nn::sl::SeekOrigin seekOrigin) = 0; - - private: - virtual details::IStreamInternal *GetInternal() = 0; - }; - - - } // namespace details +namespace nn::sl +{ +class LaunchInfoDatabase; +class KillerNotificationTransferRecordManager; +class KillerNotificationTransferRecordManagerInternal; + +namespace details +{ +class KillerNotificationTransferRecordManagerFromPtr; +class IStreamBase; +struct IStreamInternal; + +typedef nn::Result (*IStream_ReadFn)(IStreamInternal *, uint32_t *bytesRead, void *buffer, uint32_t readSize); +typedef nn::Result (*IStream_WriteFn)(IStreamInternal *, uint32_t *bytesWritten, void *buffer, uint32_t writeSize); +typedef nn::Result (*IStream_GetSizeFn)(IStreamInternal *, uint32_t *fileSize); +typedef nn::Result (*IStream_SeekFn)(IStreamInternal *, int32_t offset, nn::sl::SeekOrigin seekOrigin); + +struct WUT_PACKED IStreamInternalVTable +{ + IStreamBase *instance; // normally this is padding + uint32_t info; + WUT_PADDING_BYTES(4); + uint32_t destructor; + WUT_PADDING_BYTES(4); + IStream_ReadFn ReadFn; + WUT_PADDING_BYTES(4); + IStream_WriteFn WriteFn; + WUT_PADDING_BYTES(4); + IStream_GetSizeFn GetSizeFn; + WUT_PADDING_BYTES(4); + IStream_SeekFn SeekFn; +}; +WUT_CHECK_SIZE(IStreamInternalVTable, 0x30); +WUT_CHECK_OFFSET(IStreamInternalVTable, 0x14, ReadFn); +WUT_CHECK_OFFSET(IStreamInternalVTable, 0x1C, WriteFn); +WUT_CHECK_OFFSET(IStreamInternalVTable, 0x24, GetSizeFn); +WUT_CHECK_OFFSET(IStreamInternalVTable, 0x2C, SeekFn); + +typedef struct WUT_PACKED IStreamInternal +{ + IStreamInternalVTable *vtable; +} IStreamInternal; +WUT_CHECK_SIZE(IStreamInternal, 0x04); + +class IStreamBase +{ + friend class nn::sl::LaunchInfoDatabase; + friend class nn::sl::KillerNotificationTransferRecordManager; + friend class nn::sl::KillerNotificationTransferRecordManagerInternal; + friend class nn::sl::details::KillerNotificationTransferRecordManagerFromPtr; + +public: + IStreamBase() = default; + + virtual ~IStreamBase() = default; + + virtual nn::Result + Read(uint32_t *bytesRead, void *buffer, uint32_t readSize) = 0; + virtual nn::Result + Write(uint32_t *bytesWritten, void *buffer, uint32_t writeSize) = 0; + virtual nn::Result + GetSize(uint32_t *fileSize) = 0; + virtual nn::Result + Seek(int32_t offset, nn::sl::SeekOrigin seekOrigin) = 0; + +private: + virtual details::IStreamInternal * + GetInternal() = 0; +}; + + +} // namespace details } // namespace nn::sl diff --git a/include/nn/sl/details/ITimeAccessorDetails.h b/include/nn/sl/details/ITimeAccessorDetails.h index cd09d8357..923bf4e7b 100644 --- a/include/nn/sl/details/ITimeAccessorDetails.h +++ b/include/nn/sl/details/ITimeAccessorDetails.h @@ -1,88 +1,105 @@ #pragma once +#include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class Condition; - class DrcManager; - class KillerNotificationSelector; - class TitleListCache; - - namespace details { - class ITimeAccessorBase; - struct ITimeAccessorInternal; - - typedef nn::Result (*ITimeAccessor_GetNetworkTimeFn)(ITimeAccessorInternal *, OSTime *, bool *); - typedef nn::Result (*ITimeAccessor_GetLocalTimeFn)(ITimeAccessorInternal *, OSTime *, bool *); - - struct WUT_PACKED ITimeAccessorInternalVTable { - ITimeAccessorBase *instance; // Is normally padding - uint32_t info; - WUT_PADDING_BYTES(4); - uint32_t destructor; - WUT_PADDING_BYTES(4); - ITimeAccessor_GetNetworkTimeFn GetNetworkTimeFn; - WUT_PADDING_BYTES(4); - ITimeAccessor_GetLocalTimeFn GetLocalTimeFn; - }; - WUT_CHECK_SIZE(ITimeAccessorInternalVTable, 0x20); - WUT_CHECK_OFFSET(ITimeAccessorInternalVTable, 0x00, instance); - WUT_CHECK_OFFSET(ITimeAccessorInternalVTable, 0x14, GetNetworkTimeFn); - WUT_CHECK_OFFSET(ITimeAccessorInternalVTable, 0x1C, GetLocalTimeFn); - - typedef struct WUT_PACKED ITimeAccessorInternal { - ITimeAccessorInternalVTable *vtable; - } ITimeAccessorInternal; - WUT_CHECK_SIZE(ITimeAccessorInternal, 0x04); - WUT_CHECK_OFFSET(ITimeAccessorInternal, 0x00, vtable); - - class ITimeAccessorBase { - friend class nn::sl::Condition; - friend class nn::sl::DrcManager; - friend class nn::sl::KillerNotificationSelector; - friend class nn::sl::TitleListCache; - - public: - ITimeAccessorBase() = default; - - virtual ~ITimeAccessorBase() = default; - - virtual nn::Result GetNetworkTime(OSTime *, bool *) const = 0; - virtual nn::Result GetLocalTime(OSTime *, bool *) const = 0; - - private: - virtual details::ITimeAccessorInternal *GetInternal() = 0; - }; - - class TimeAccessorFromPtr : public ITimeAccessorBase { - public: - explicit TimeAccessorFromPtr(details::ITimeAccessorInternal *ptr) : mInstancePtr(ptr) { - } - nn::Result GetNetworkTime(OSTime *outTime, bool *outSuccess) const override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->GetNetworkTimeFn(mInstancePtr, outTime, outSuccess); - } - nn::Result GetLocalTime(OSTime *outTime, bool *outSuccess) const override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->GetLocalTimeFn(mInstancePtr, outTime, outSuccess); - } - - private: - details::ITimeAccessorInternal *GetInternal() override { - return mInstancePtr; - } - - details::ITimeAccessorInternal *mInstancePtr; - }; - } // namespace details +namespace nn::sl +{ +class Condition; +class DrcManager; +class KillerNotificationSelector; +class TitleListCache; + +namespace details +{ +class ITimeAccessorBase; +struct ITimeAccessorInternal; + +typedef nn::Result (*ITimeAccessor_GetNetworkTimeFn)(ITimeAccessorInternal *, OSTime *, bool *); +typedef nn::Result (*ITimeAccessor_GetLocalTimeFn)(ITimeAccessorInternal *, OSTime *, bool *); + +struct WUT_PACKED ITimeAccessorInternalVTable +{ + ITimeAccessorBase *instance; // Is normally padding + uint32_t info; + WUT_PADDING_BYTES(4); + uint32_t destructor; + WUT_PADDING_BYTES(4); + ITimeAccessor_GetNetworkTimeFn GetNetworkTimeFn; + WUT_PADDING_BYTES(4); + ITimeAccessor_GetLocalTimeFn GetLocalTimeFn; +}; +WUT_CHECK_SIZE(ITimeAccessorInternalVTable, 0x20); +WUT_CHECK_OFFSET(ITimeAccessorInternalVTable, 0x00, instance); +WUT_CHECK_OFFSET(ITimeAccessorInternalVTable, 0x14, GetNetworkTimeFn); +WUT_CHECK_OFFSET(ITimeAccessorInternalVTable, 0x1C, GetLocalTimeFn); + +typedef struct WUT_PACKED ITimeAccessorInternal +{ + ITimeAccessorInternalVTable *vtable; +} ITimeAccessorInternal; +WUT_CHECK_SIZE(ITimeAccessorInternal, 0x04); +WUT_CHECK_OFFSET(ITimeAccessorInternal, 0x00, vtable); + +class ITimeAccessorBase +{ + friend class nn::sl::Condition; + friend class nn::sl::DrcManager; + friend class nn::sl::KillerNotificationSelector; + friend class nn::sl::TitleListCache; + +public: + ITimeAccessorBase() = default; + + virtual ~ITimeAccessorBase() = default; + + virtual nn::Result + GetNetworkTime(OSTime *, bool *) const = 0; + virtual nn::Result + GetLocalTime(OSTime *, bool *) const = 0; + +private: + virtual details::ITimeAccessorInternal * + GetInternal() = 0; +}; + +class TimeAccessorFromPtr : public ITimeAccessorBase +{ +public: + explicit TimeAccessorFromPtr(details::ITimeAccessorInternal *ptr) : + mInstancePtr(ptr) + { + } + nn::Result + GetNetworkTime(OSTime *outTime, bool *outSuccess) const override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->GetNetworkTimeFn(mInstancePtr, outTime, outSuccess); + } + nn::Result + GetLocalTime(OSTime *outTime, bool *outSuccess) const override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->GetLocalTimeFn(mInstancePtr, outTime, outSuccess); + } + +private: + details::ITimeAccessorInternal * + GetInternal() override + { + return mInstancePtr; + } + + details::ITimeAccessorInternal *mInstancePtr; +}; +} // namespace details } // namespace nn::sl diff --git a/include/nn/sl/details/ITitleIconCacheDetails.h b/include/nn/sl/details/ITitleIconCacheDetails.h index fd951566c..c152ce7a8 100644 --- a/include/nn/sl/details/ITitleIconCacheDetails.h +++ b/include/nn/sl/details/ITitleIconCacheDetails.h @@ -1,110 +1,133 @@ #pragma once +#include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class DataCreator; - namespace details { - class ITitleIconCacheBase; - struct ITitleIconCacheInternal; - - struct WUT_PACKED ITitleIconCacheInternal; - - typedef nn::Result (*TitleIconCache_LoadFn)(ITitleIconCacheInternal *); - typedef nn::Result (*TitleIconCache_UpdateFn)(ITitleIconCacheInternal *, TitleInfo *, int); - typedef nn::Result (*TitleIconCache_StoreFn)(ITitleIconCacheInternal *); - typedef void (*TitleIconCache_GetFn)(ITitleIconCacheInternal *, IconInfo *, int); - - typedef struct WUT_PACKED ITitleIconCacheInternalVTable { - ITitleIconCacheBase *instance; // this is normally padding - WUT_UNKNOWN_BYTES(0x4); - WUT_UNKNOWN_BYTES(0x4); - void *destructor; - WUT_UNKNOWN_BYTES(0x4); - TitleIconCache_LoadFn LoadFn; - WUT_UNKNOWN_BYTES(0x4); - TitleIconCache_UpdateFn UpdateFn; - WUT_UNKNOWN_BYTES(0x4); - TitleIconCache_StoreFn StoreFn; - WUT_UNKNOWN_BYTES(0x4); - TitleIconCache_GetFn GetFn; - } ITitleIconCacheInternalVTable; - WUT_CHECK_SIZE(ITitleIconCacheInternalVTable, 0x30); - WUT_CHECK_OFFSET(ITitleIconCacheInternalVTable, 0x14, LoadFn); - WUT_CHECK_OFFSET(ITitleIconCacheInternalVTable, 0x1c, UpdateFn); - WUT_CHECK_OFFSET(ITitleIconCacheInternalVTable, 0x24, StoreFn); - WUT_CHECK_OFFSET(ITitleIconCacheInternalVTable, 0x2C, GetFn); - - typedef struct WUT_PACKED ITitleIconCacheInternal { - ITitleIconCacheInternalVTable *vtable; - } ITitleIconCacheInternal; - WUT_CHECK_SIZE(ITitleIconCacheInternal, 0x04); - WUT_CHECK_OFFSET(ITitleIconCacheInternal, 0x00, vtable); - - class ITitleIconCacheBase { - friend class nn::sl::DataCreator; - - public: - ITitleIconCacheBase() = default; - - virtual ~ITitleIconCacheBase() = default; - - virtual nn::Result Load() = 0; - - virtual nn::Result Update(nn::sl::TitleInfo *titleInfos, int num) = 0; - - virtual nn::Result Store() = 0; - - virtual void Get(nn::sl::IconInfo *iconInfos, int num) const = 0; - - private: - virtual details::ITitleIconCacheInternal *GetInternal() = 0; - }; - - class TitleIconCacheFromPtr : public ITitleIconCacheBase { - public: - explicit TitleIconCacheFromPtr(details::ITitleIconCacheInternal *ptr) : mInstancePtr(ptr) { - } - nn::Result Load() override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->LoadFn(mInstancePtr); - } - - nn::Result Update(nn::sl::TitleInfo *titleInfos, int num) override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->UpdateFn(mInstancePtr, titleInfos, num); - } - - nn::Result Store() override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->StoreFn(mInstancePtr); - } - - void Get(nn::sl::IconInfo *iconInfos, int num) const override { - if (!mInstancePtr) { - return; - } - mInstancePtr->vtable->GetFn(mInstancePtr, iconInfos, num); - } - - private: - details::ITitleIconCacheInternal *GetInternal() override { - return mInstancePtr; - } - - details::ITitleIconCacheInternal *mInstancePtr; - }; - } // namespace details +namespace nn::sl +{ +class DataCreator; +namespace details +{ +class ITitleIconCacheBase; +struct ITitleIconCacheInternal; + +struct WUT_PACKED ITitleIconCacheInternal; + +typedef nn::Result (*TitleIconCache_LoadFn)(ITitleIconCacheInternal *); +typedef nn::Result (*TitleIconCache_UpdateFn)(ITitleIconCacheInternal *, TitleInfo *, int); +typedef nn::Result (*TitleIconCache_StoreFn)(ITitleIconCacheInternal *); +typedef void (*TitleIconCache_GetFn)(ITitleIconCacheInternal *, IconInfo *, int); + +typedef struct WUT_PACKED ITitleIconCacheInternalVTable +{ + ITitleIconCacheBase *instance; // this is normally padding + WUT_UNKNOWN_BYTES(0x4); + WUT_UNKNOWN_BYTES(0x4); + void *destructor; + WUT_UNKNOWN_BYTES(0x4); + TitleIconCache_LoadFn LoadFn; + WUT_UNKNOWN_BYTES(0x4); + TitleIconCache_UpdateFn UpdateFn; + WUT_UNKNOWN_BYTES(0x4); + TitleIconCache_StoreFn StoreFn; + WUT_UNKNOWN_BYTES(0x4); + TitleIconCache_GetFn GetFn; +} ITitleIconCacheInternalVTable; +WUT_CHECK_SIZE(ITitleIconCacheInternalVTable, 0x30); +WUT_CHECK_OFFSET(ITitleIconCacheInternalVTable, 0x14, LoadFn); +WUT_CHECK_OFFSET(ITitleIconCacheInternalVTable, 0x1c, UpdateFn); +WUT_CHECK_OFFSET(ITitleIconCacheInternalVTable, 0x24, StoreFn); +WUT_CHECK_OFFSET(ITitleIconCacheInternalVTable, 0x2C, GetFn); + +typedef struct WUT_PACKED ITitleIconCacheInternal +{ + ITitleIconCacheInternalVTable *vtable; +} ITitleIconCacheInternal; +WUT_CHECK_SIZE(ITitleIconCacheInternal, 0x04); +WUT_CHECK_OFFSET(ITitleIconCacheInternal, 0x00, vtable); + +class ITitleIconCacheBase +{ + friend class nn::sl::DataCreator; + +public: + ITitleIconCacheBase() = default; + + virtual ~ITitleIconCacheBase() = default; + + virtual nn::Result + Load() = 0; + + virtual nn::Result + Update(nn::sl::TitleInfo *titleInfos, int num) = 0; + + virtual nn::Result + Store() = 0; + + virtual void + Get(nn::sl::IconInfo *iconInfos, int num) const = 0; + +private: + virtual details::ITitleIconCacheInternal * + GetInternal() = 0; +}; + +class TitleIconCacheFromPtr : public ITitleIconCacheBase +{ +public: + explicit TitleIconCacheFromPtr(details::ITitleIconCacheInternal *ptr) : + mInstancePtr(ptr) + { + } + nn::Result + Load() override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->LoadFn(mInstancePtr); + } + + nn::Result + Update(nn::sl::TitleInfo *titleInfos, int num) override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->UpdateFn(mInstancePtr, titleInfos, num); + } + + nn::Result + Store() override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->StoreFn(mInstancePtr); + } + + void + Get(nn::sl::IconInfo *iconInfos, int num) const override + { + if (!mInstancePtr) { + return; + } + mInstancePtr->vtable->GetFn(mInstancePtr, iconInfos, num); + } + +private: + details::ITitleIconCacheInternal * + GetInternal() override + { + return mInstancePtr; + } + + details::ITitleIconCacheInternal *mInstancePtr; +}; +} // namespace details } // namespace nn::sl diff --git a/include/nn/sl/details/ITitleListAccessorDetails.h b/include/nn/sl/details/ITitleListAccessorDetails.h index 08b0c332c..0fe4b7029 100644 --- a/include/nn/sl/details/ITitleListAccessorDetails.h +++ b/include/nn/sl/details/ITitleListAccessorDetails.h @@ -1,69 +1,83 @@ #pragma once +#include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class TitleListCache; - namespace details { - class ITitleListAccessorBase; - struct ITitleListAccessorInternal; +namespace nn::sl +{ +class TitleListCache; +namespace details +{ +class ITitleListAccessorBase; +struct ITitleListAccessorInternal; - typedef nn::Result (*ITitleListAccessor_GetFn)(ITitleListAccessorInternal *, nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosNum, int maxTitleInfosNum); +typedef nn::Result (*ITitleListAccessor_GetFn)(ITitleListAccessorInternal *, nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosNum, int maxTitleInfosNum); - struct WUT_PACKED ITitleListAccessorInternalVTable { - ITitleListAccessorBase *instance; // normally this is padding - uint32_t info; - WUT_PADDING_BYTES(4); - uint32_t destructor; - WUT_PADDING_BYTES(4); - ITitleListAccessor_GetFn GetFn; - }; - WUT_CHECK_SIZE(ITitleListAccessorInternalVTable, 0x18); - WUT_CHECK_OFFSET(ITitleListAccessorInternalVTable, 0x00, instance); - WUT_CHECK_OFFSET(ITitleListAccessorInternalVTable, 0x14, GetFn); +struct WUT_PACKED ITitleListAccessorInternalVTable +{ + ITitleListAccessorBase *instance; // normally this is padding + uint32_t info; + WUT_PADDING_BYTES(4); + uint32_t destructor; + WUT_PADDING_BYTES(4); + ITitleListAccessor_GetFn GetFn; +}; +WUT_CHECK_SIZE(ITitleListAccessorInternalVTable, 0x18); +WUT_CHECK_OFFSET(ITitleListAccessorInternalVTable, 0x00, instance); +WUT_CHECK_OFFSET(ITitleListAccessorInternalVTable, 0x14, GetFn); - typedef struct WUT_PACKED ITitleListAccessorInternal { - ITitleListAccessorInternalVTable *vtable; - } ITitleListAccessorInternal; - WUT_CHECK_SIZE(ITitleListAccessorInternal, 0x04); - WUT_CHECK_OFFSET(ITitleListAccessorInternal, 0x00, vtable); +typedef struct WUT_PACKED ITitleListAccessorInternal +{ + ITitleListAccessorInternalVTable *vtable; +} ITitleListAccessorInternal; +WUT_CHECK_SIZE(ITitleListAccessorInternal, 0x04); +WUT_CHECK_OFFSET(ITitleListAccessorInternal, 0x00, vtable); - class ITitleListAccessorBase { - friend class nn::sl::TitleListCache; +class ITitleListAccessorBase +{ + friend class nn::sl::TitleListCache; - public: - ITitleListAccessorBase() = default; - virtual ~ITitleListAccessorBase() = default; +public: + ITitleListAccessorBase() = default; + virtual ~ITitleListAccessorBase() = default; - virtual nn::Result Get(nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosNum, int maxTitleInfosNum) const = 0; + virtual nn::Result + Get(nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosNum, int maxTitleInfosNum) const = 0; - private: - virtual details::ITitleListAccessorInternal *GetInternal() = 0; - }; +private: + virtual details::ITitleListAccessorInternal * + GetInternal() = 0; +}; - class TitleListAccessorFromPtr : public ITitleListAccessorBase { - public: - explicit TitleListAccessorFromPtr(details::ITitleListAccessorInternal *ptr) : mInstancePtr(ptr) { - } - nn::Result Get(nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosNum, int maxTitleInfosNum) const override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->GetFn(mInstancePtr, outTitleInfos, outTitleInfosNum, maxTitleInfosNum); - } +class TitleListAccessorFromPtr : public ITitleListAccessorBase +{ +public: + explicit TitleListAccessorFromPtr(details::ITitleListAccessorInternal *ptr) : + mInstancePtr(ptr) + { + } + nn::Result + Get(nn::sl::TitleInfo *outTitleInfos, int *outTitleInfosNum, int maxTitleInfosNum) const override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->GetFn(mInstancePtr, outTitleInfos, outTitleInfosNum, maxTitleInfosNum); + } - private: - nn::sl::details::ITitleListAccessorInternal *GetInternal() override { - return mInstancePtr; - } +private: + nn::sl::details::ITitleListAccessorInternal * + GetInternal() override + { + return mInstancePtr; + } - details::ITitleListAccessorInternal *mInstancePtr; - }; - } // namespace details + details::ITitleListAccessorInternal *mInstancePtr; +}; +} // namespace details } // namespace nn::sl diff --git a/include/nn/sl/details/ITransferrerDetails.h b/include/nn/sl/details/ITransferrerDetails.h index 81d50430f..3f345f6e4 100644 --- a/include/nn/sl/details/ITransferrerDetails.h +++ b/include/nn/sl/details/ITransferrerDetails.h @@ -1,114 +1,138 @@ #pragma once +#include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class DrcManager; - namespace details { - class ITransferrerBase; - struct ITransferrerInternal; - - typedef nn::Result (*ITransferrer_TransferDeprecatedFn)(ITransferrerInternal *, void *, uint32_t, bool, int); - typedef nn::Result (*ITransferrer_TransferFn)(ITransferrerInternal *, void *, uint32_t, bool, TransferMode); - typedef nn::Result (*ITransferrer_CancelTransferFn)(ITransferrerInternal *); - typedef nn::Result (*ITransferrer_InvalidateNotificationFn)(ITransferrerInternal *, uint32_t); - typedef nn::Result (*ITransferrer_DisplayNotificationFn)(ITransferrerInternal *, uint32_t, uint32_t, uint32_t); - - struct WUT_PACKED ITransferrerInternalVTable { - ITransferrerBase *instance; // Is normally padding - uint32_t info; - WUT_PADDING_BYTES(4); - uint32_t destructor; - WUT_PADDING_BYTES(4); - ITransferrer_TransferDeprecatedFn TransferDeprecatedFn; - WUT_PADDING_BYTES(4); - ITransferrer_TransferFn TransferFn; - WUT_PADDING_BYTES(4); - ITransferrer_CancelTransferFn CancelTransferFn; - WUT_PADDING_BYTES(4); - ITransferrer_InvalidateNotificationFn InvalidateNotificationFn; - WUT_PADDING_BYTES(4); - ITransferrer_DisplayNotificationFn DisplayNotificationFn; - }; - WUT_CHECK_SIZE(ITransferrerInternalVTable, 0x38); - WUT_CHECK_OFFSET(ITransferrerInternalVTable, 0x00, instance); - WUT_CHECK_OFFSET(ITransferrerInternalVTable, 0x14, TransferDeprecatedFn); - WUT_CHECK_OFFSET(ITransferrerInternalVTable, 0x1C, TransferFn); - WUT_CHECK_OFFSET(ITransferrerInternalVTable, 0x24, CancelTransferFn); - WUT_CHECK_OFFSET(ITransferrerInternalVTable, 0x2C, InvalidateNotificationFn); - WUT_CHECK_OFFSET(ITransferrerInternalVTable, 0x34, DisplayNotificationFn); - - typedef struct WUT_PACKED ITransferrerInternal { - ITransferrerInternalVTable *vtable; - } ITransferrerInternal; - WUT_CHECK_SIZE(ITransferrerInternal, 0x04); - WUT_CHECK_OFFSET(ITransferrerInternal, 0x00, vtable); - - class ITransferrerBase { - friend class nn::sl::DrcManager; - - public: - ITransferrerBase() = default; - - virtual ~ITransferrerBase() = default; - - virtual nn::Result TransferDeprecated(void *buffer, uint32_t size, bool setKillerNotification, int transferMode) const = 0; - virtual nn::Result Transfer(void *buffer, uint32_t size, bool setKillerNotification, TransferMode transferMode) const = 0; - virtual nn::Result CancelTransfer() const = 0; - virtual nn::Result InvalidateNotification(uint32_t) const = 0; - virtual nn::Result DisplayNotification(uint32_t, uint32_t, uint32_t) const = 0; - - private: - virtual details::ITransferrerInternal *GetInternal() = 0; - }; - - class TransferrerFromPtr : public ITransferrerBase { - public: - explicit TransferrerFromPtr(details::ITransferrerInternal *ptr) : mInstancePtr(ptr) { - } - nn::Result TransferDeprecated(void *buffer, uint32_t size, bool setKillerNotification, int transferMode) const override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->TransferDeprecatedFn(mInstancePtr, buffer, size, setKillerNotification, transferMode); - } - nn::Result Transfer(void *buffer, uint32_t size, bool setKillerNotification, TransferMode transferMode) const override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->TransferFn(mInstancePtr, buffer, size, setKillerNotification, transferMode); - } - nn::Result CancelTransfer() const override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->CancelTransferFn(mInstancePtr); - } - nn::Result InvalidateNotification(uint32_t u1) const override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->InvalidateNotificationFn(mInstancePtr, u1); - } - nn::Result DisplayNotification(uint32_t u1, uint32_t u2, uint32_t u3) const override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->DisplayNotificationFn(mInstancePtr, u1, u2, u3); - } - - private: - details::ITransferrerInternal *GetInternal() override { - return mInstancePtr; - } - - details::ITransferrerInternal *mInstancePtr; - }; - } // namespace details +namespace nn::sl +{ +class DrcManager; +namespace details +{ +class ITransferrerBase; +struct ITransferrerInternal; + +typedef nn::Result (*ITransferrer_TransferDeprecatedFn)(ITransferrerInternal *, void *, uint32_t, bool, int); +typedef nn::Result (*ITransferrer_TransferFn)(ITransferrerInternal *, void *, uint32_t, bool, TransferMode); +typedef nn::Result (*ITransferrer_CancelTransferFn)(ITransferrerInternal *); +typedef nn::Result (*ITransferrer_InvalidateNotificationFn)(ITransferrerInternal *, uint32_t); +typedef nn::Result (*ITransferrer_DisplayNotificationFn)(ITransferrerInternal *, uint32_t, uint32_t, uint32_t); + +struct WUT_PACKED ITransferrerInternalVTable +{ + ITransferrerBase *instance; // Is normally padding + uint32_t info; + WUT_PADDING_BYTES(4); + uint32_t destructor; + WUT_PADDING_BYTES(4); + ITransferrer_TransferDeprecatedFn TransferDeprecatedFn; + WUT_PADDING_BYTES(4); + ITransferrer_TransferFn TransferFn; + WUT_PADDING_BYTES(4); + ITransferrer_CancelTransferFn CancelTransferFn; + WUT_PADDING_BYTES(4); + ITransferrer_InvalidateNotificationFn InvalidateNotificationFn; + WUT_PADDING_BYTES(4); + ITransferrer_DisplayNotificationFn DisplayNotificationFn; +}; +WUT_CHECK_SIZE(ITransferrerInternalVTable, 0x38); +WUT_CHECK_OFFSET(ITransferrerInternalVTable, 0x00, instance); +WUT_CHECK_OFFSET(ITransferrerInternalVTable, 0x14, TransferDeprecatedFn); +WUT_CHECK_OFFSET(ITransferrerInternalVTable, 0x1C, TransferFn); +WUT_CHECK_OFFSET(ITransferrerInternalVTable, 0x24, CancelTransferFn); +WUT_CHECK_OFFSET(ITransferrerInternalVTable, 0x2C, InvalidateNotificationFn); +WUT_CHECK_OFFSET(ITransferrerInternalVTable, 0x34, DisplayNotificationFn); + +typedef struct WUT_PACKED ITransferrerInternal +{ + ITransferrerInternalVTable *vtable; +} ITransferrerInternal; +WUT_CHECK_SIZE(ITransferrerInternal, 0x04); +WUT_CHECK_OFFSET(ITransferrerInternal, 0x00, vtable); + +class ITransferrerBase +{ + friend class nn::sl::DrcManager; + +public: + ITransferrerBase() = default; + + virtual ~ITransferrerBase() = default; + + virtual nn::Result + TransferDeprecated(void *buffer, uint32_t size, bool setKillerNotification, int transferMode) const = 0; + virtual nn::Result + Transfer(void *buffer, uint32_t size, bool setKillerNotification, TransferMode transferMode) const = 0; + virtual nn::Result + CancelTransfer() const = 0; + virtual nn::Result InvalidateNotification(uint32_t) const = 0; + virtual nn::Result DisplayNotification(uint32_t, uint32_t, uint32_t) const = 0; + +private: + virtual details::ITransferrerInternal * + GetInternal() = 0; +}; + +class TransferrerFromPtr : public ITransferrerBase +{ +public: + explicit TransferrerFromPtr(details::ITransferrerInternal *ptr) : + mInstancePtr(ptr) + { + } + nn::Result + TransferDeprecated(void *buffer, uint32_t size, bool setKillerNotification, int transferMode) const override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->TransferDeprecatedFn(mInstancePtr, buffer, size, setKillerNotification, transferMode); + } + nn::Result + Transfer(void *buffer, uint32_t size, bool setKillerNotification, TransferMode transferMode) const override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->TransferFn(mInstancePtr, buffer, size, setKillerNotification, transferMode); + } + nn::Result + CancelTransfer() const override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->CancelTransferFn(mInstancePtr); + } + nn::Result + InvalidateNotification(uint32_t u1) const override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->InvalidateNotificationFn(mInstancePtr, u1); + } + nn::Result + DisplayNotification(uint32_t u1, uint32_t u2, uint32_t u3) const override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->DisplayNotificationFn(mInstancePtr, u1, u2, u3); + } + +private: + details::ITransferrerInternal * + GetInternal() override + { + return mInstancePtr; + } + + details::ITransferrerInternal *mInstancePtr; +}; +} // namespace details } // namespace nn::sl diff --git a/include/nn/sl/details/IUpdatePackageAccessorDetails.h b/include/nn/sl/details/IUpdatePackageAccessorDetails.h index f1fc8a2f6..f076e1e53 100644 --- a/include/nn/sl/details/IUpdatePackageAccessorDetails.h +++ b/include/nn/sl/details/IUpdatePackageAccessorDetails.h @@ -1,83 +1,101 @@ #pragma once -#include #include +#include #ifdef __cplusplus -namespace nn::sl { - class Condition; - namespace details { - class IUpdatePackageAccessorBase; - struct IUpdatePackageAccessorInternal; - - typedef bool (*IUpdatePackageAccessor_PackageExistsFn)(IUpdatePackageAccessorInternal *); - typedef bool (*IUpdatePackageAccessor_IsUpdatePackageDownloadedFn)(IUpdatePackageAccessorInternal *); - - struct WUT_PACKED IUpdatePackageAccessorInternalVTable { - IUpdatePackageAccessorBase *instance; // normally this is padding - uint32_t info; - WUT_PADDING_BYTES(4); - uint32_t destructor; - WUT_PADDING_BYTES(4); - IUpdatePackageAccessor_PackageExistsFn PackageExistsFn; - WUT_PADDING_BYTES(4); - IUpdatePackageAccessor_IsUpdatePackageDownloadedFn IsUpdatePackageDownloadedFn; - WUT_PADDING_BYTES(4); - }; - WUT_CHECK_SIZE(IUpdatePackageAccessorInternalVTable, 0x24); - WUT_CHECK_OFFSET(IUpdatePackageAccessorInternalVTable, 0x14, PackageExistsFn); - WUT_CHECK_OFFSET(IUpdatePackageAccessorInternalVTable, 0x1C, IsUpdatePackageDownloadedFn); - - typedef struct WUT_PACKED IUpdatePackageAccessorInternal { - IUpdatePackageAccessorInternalVTable *vtable; - } IUpdatePackageAccessorInternal; - WUT_CHECK_SIZE(IUpdatePackageAccessorInternal, 0x04); - WUT_CHECK_OFFSET(IUpdatePackageAccessorInternal, 0x00, vtable); - - extern "C" IUpdatePackageAccessorInternal *GetDefaultUpdatePackageAccessor__Q2_2nn2slFv(); - - class IUpdatePackageAccessorBase { - friend class nn::sl::Condition; - - public: - IUpdatePackageAccessorBase() = default; - virtual ~IUpdatePackageAccessorBase() = default; - - virtual bool PackageExists() const = 0; - - virtual bool IsUpdatePackageDownloaded() const = 0; - - private: - virtual details::IUpdatePackageAccessorInternal *GetInternal() = 0; - }; - - class UpdatePackageAccessorFromPtr : public IUpdatePackageAccessorBase { - public: - explicit UpdatePackageAccessorFromPtr(details::IUpdatePackageAccessorInternal *ptr) : mInstancePtr(ptr) { - } - bool PackageExists() const override { - if (!mInstancePtr) { - return false; - } - return mInstancePtr->vtable->PackageExistsFn(mInstancePtr); - } - - bool IsUpdatePackageDownloaded() const override { - if (!mInstancePtr) { - return false; - } - return mInstancePtr->vtable->IsUpdatePackageDownloadedFn(mInstancePtr); - } - - details::IUpdatePackageAccessorInternal *GetInternal() override { - return mInstancePtr; - } - - private: - details::IUpdatePackageAccessorInternal *mInstancePtr; - }; - } // namespace details +namespace nn::sl +{ +class Condition; +namespace details +{ +class IUpdatePackageAccessorBase; +struct IUpdatePackageAccessorInternal; + +typedef bool (*IUpdatePackageAccessor_PackageExistsFn)(IUpdatePackageAccessorInternal *); +typedef bool (*IUpdatePackageAccessor_IsUpdatePackageDownloadedFn)(IUpdatePackageAccessorInternal *); + +struct WUT_PACKED IUpdatePackageAccessorInternalVTable +{ + IUpdatePackageAccessorBase *instance; // normally this is padding + uint32_t info; + WUT_PADDING_BYTES(4); + uint32_t destructor; + WUT_PADDING_BYTES(4); + IUpdatePackageAccessor_PackageExistsFn PackageExistsFn; + WUT_PADDING_BYTES(4); + IUpdatePackageAccessor_IsUpdatePackageDownloadedFn IsUpdatePackageDownloadedFn; + WUT_PADDING_BYTES(4); +}; +WUT_CHECK_SIZE(IUpdatePackageAccessorInternalVTable, 0x24); +WUT_CHECK_OFFSET(IUpdatePackageAccessorInternalVTable, 0x14, PackageExistsFn); +WUT_CHECK_OFFSET(IUpdatePackageAccessorInternalVTable, 0x1C, IsUpdatePackageDownloadedFn); + +typedef struct WUT_PACKED IUpdatePackageAccessorInternal +{ + IUpdatePackageAccessorInternalVTable *vtable; +} IUpdatePackageAccessorInternal; +WUT_CHECK_SIZE(IUpdatePackageAccessorInternal, 0x04); +WUT_CHECK_OFFSET(IUpdatePackageAccessorInternal, 0x00, vtable); + +extern "C" IUpdatePackageAccessorInternal * +GetDefaultUpdatePackageAccessor__Q2_2nn2slFv(); + +class IUpdatePackageAccessorBase +{ + friend class nn::sl::Condition; + +public: + IUpdatePackageAccessorBase() = default; + virtual ~IUpdatePackageAccessorBase() = default; + + virtual bool + PackageExists() const = 0; + + virtual bool + IsUpdatePackageDownloaded() const = 0; + +private: + virtual details::IUpdatePackageAccessorInternal * + GetInternal() = 0; +}; + +class UpdatePackageAccessorFromPtr : public IUpdatePackageAccessorBase +{ +public: + explicit UpdatePackageAccessorFromPtr(details::IUpdatePackageAccessorInternal *ptr) : + mInstancePtr(ptr) + { + } + bool + PackageExists() const override + { + if (!mInstancePtr) { + return false; + } + return mInstancePtr->vtable->PackageExistsFn(mInstancePtr); + } + + bool + IsUpdatePackageDownloaded() const override + { + if (!mInstancePtr) { + return false; + } + return mInstancePtr->vtable->IsUpdatePackageDownloadedFn(mInstancePtr); + } + + details::IUpdatePackageAccessorInternal * + GetInternal() override + { + return mInstancePtr; + } + +private: + details::IUpdatePackageAccessorInternal *mInstancePtr; +}; +} // namespace details } // namespace nn::sl #endif \ No newline at end of file diff --git a/include/nn/sl/details/IWhiteListAccessorDetails.h b/include/nn/sl/details/IWhiteListAccessorDetails.h index 27d04d4d1..755e422a8 100644 --- a/include/nn/sl/details/IWhiteListAccessorDetails.h +++ b/include/nn/sl/details/IWhiteListAccessorDetails.h @@ -1,69 +1,83 @@ #pragma once +#include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - class QuickStartApplicationSelector; - namespace details { - class IWhiteListAccessorBase; - struct IWhiteListAccessorInternal; +namespace nn::sl +{ +class QuickStartApplicationSelector; +namespace details +{ +class IWhiteListAccessorBase; +struct IWhiteListAccessorInternal; - typedef nn::Result (*IWhiteListAccessor_GetFn)(IWhiteListAccessorInternal *, nn::sl::WhiteList *); +typedef nn::Result (*IWhiteListAccessor_GetFn)(IWhiteListAccessorInternal *, nn::sl::WhiteList *); - struct WUT_PACKED IWhiteListAccessorInternalVTable { - IWhiteListAccessorBase *instance; // normally this is padding - uint32_t info; - WUT_PADDING_BYTES(4); - uint32_t destructor; - WUT_PADDING_BYTES(4); - IWhiteListAccessor_GetFn GetFn; - }; - WUT_CHECK_SIZE(IWhiteListAccessorInternalVTable, 0x18); - WUT_CHECK_OFFSET(IWhiteListAccessorInternalVTable, 0x00, instance); - WUT_CHECK_OFFSET(IWhiteListAccessorInternalVTable, 0x14, GetFn); +struct WUT_PACKED IWhiteListAccessorInternalVTable +{ + IWhiteListAccessorBase *instance; // normally this is padding + uint32_t info; + WUT_PADDING_BYTES(4); + uint32_t destructor; + WUT_PADDING_BYTES(4); + IWhiteListAccessor_GetFn GetFn; +}; +WUT_CHECK_SIZE(IWhiteListAccessorInternalVTable, 0x18); +WUT_CHECK_OFFSET(IWhiteListAccessorInternalVTable, 0x00, instance); +WUT_CHECK_OFFSET(IWhiteListAccessorInternalVTable, 0x14, GetFn); - typedef struct WUT_PACKED IWhiteListAccessorInternal { - IWhiteListAccessorInternalVTable *vtable; - } IWhiteListAccessorInternal; - WUT_CHECK_SIZE(IWhiteListAccessorInternal, 0x04); - WUT_CHECK_OFFSET(IWhiteListAccessorInternal, 0x00, vtable); +typedef struct WUT_PACKED IWhiteListAccessorInternal +{ + IWhiteListAccessorInternalVTable *vtable; +} IWhiteListAccessorInternal; +WUT_CHECK_SIZE(IWhiteListAccessorInternal, 0x04); +WUT_CHECK_OFFSET(IWhiteListAccessorInternal, 0x00, vtable); - class IWhiteListAccessorBase { - friend class nn::sl::QuickStartApplicationSelector; +class IWhiteListAccessorBase +{ + friend class nn::sl::QuickStartApplicationSelector; - public: - IWhiteListAccessorBase() = default; - virtual ~IWhiteListAccessorBase() = default; +public: + IWhiteListAccessorBase() = default; + virtual ~IWhiteListAccessorBase() = default; - virtual nn::Result Get(nn::sl::WhiteList *outWhiteList) const = 0; + virtual nn::Result + Get(nn::sl::WhiteList *outWhiteList) const = 0; - private: - virtual details::IWhiteListAccessorInternal *GetInternal() = 0; - }; +private: + virtual details::IWhiteListAccessorInternal * + GetInternal() = 0; +}; - class WhiteListAccessorFromPtr : public IWhiteListAccessorBase { - public: - explicit WhiteListAccessorFromPtr(details::IWhiteListAccessorInternal *ptr) : mInstancePtr(ptr) { - } - nn::Result Get(nn::sl::WhiteList *outWhiteList) const override { - if (!mInstancePtr) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return mInstancePtr->vtable->GetFn(mInstancePtr, outWhiteList); - } +class WhiteListAccessorFromPtr : public IWhiteListAccessorBase +{ +public: + explicit WhiteListAccessorFromPtr(details::IWhiteListAccessorInternal *ptr) : + mInstancePtr(ptr) + { + } + nn::Result + Get(nn::sl::WhiteList *outWhiteList) const override + { + if (!mInstancePtr) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return mInstancePtr->vtable->GetFn(mInstancePtr, outWhiteList); + } - private: - nn::sl::details::IWhiteListAccessorInternal *GetInternal() override { - return mInstancePtr; - } +private: + nn::sl::details::IWhiteListAccessorInternal * + GetInternal() override + { + return mInstancePtr; + } - details::IWhiteListAccessorInternal *mInstancePtr; - }; - } // namespace details + details::IWhiteListAccessorInternal *mInstancePtr; +}; +} // namespace details } // namespace nn::sl diff --git a/include/nn/sl/sl_cpp.h b/include/nn/sl/sl_cpp.h index 14c453433..0e172a0f7 100644 --- a/include/nn/sl/sl_cpp.h +++ b/include/nn/sl/sl_cpp.h @@ -1,291 +1,325 @@ #pragma once +#include #include #include #include -#include #ifdef __cplusplus -namespace nn::sl { - typedef enum MediaType { - NN_SL_MEDIA_TYPE_MLC = 0x00, - NN_SL_MEDIA_TYPE_SLC = 0x01, - NN_SL_MEDIA_TYPE_ODD = 0x02, - NN_SL_MEDIA_TYPE_USB = 0x03, - NN_SL_MEDIA_TYPE_HFIO = 0x04, - } MediaType; +namespace nn::sl +{ +typedef enum MediaType +{ + NN_SL_MEDIA_TYPE_MLC = 0x00, + NN_SL_MEDIA_TYPE_SLC = 0x01, + NN_SL_MEDIA_TYPE_ODD = 0x02, + NN_SL_MEDIA_TYPE_USB = 0x03, + NN_SL_MEDIA_TYPE_HFIO = 0x04, +} MediaType; - typedef struct WUT_PACKED LaunchInfo { - uint64_t titleId; - MCPAppType appType; - MediaType mediaType; - char parameter[0x800]; - } LaunchInfo; - WUT_CHECK_OFFSET(LaunchInfo, 0x00, titleId); - WUT_CHECK_OFFSET(LaunchInfo, 0x08, appType); - WUT_CHECK_OFFSET(LaunchInfo, 0x0C, mediaType); - WUT_CHECK_SIZE(LaunchInfo, 0x810); +typedef struct WUT_PACKED LaunchInfo +{ + uint64_t titleId; + MCPAppType appType; + MediaType mediaType; + char parameter[0x800]; +} LaunchInfo; +WUT_CHECK_OFFSET(LaunchInfo, 0x00, titleId); +WUT_CHECK_OFFSET(LaunchInfo, 0x08, appType); +WUT_CHECK_OFFSET(LaunchInfo, 0x0C, mediaType); +WUT_CHECK_SIZE(LaunchInfo, 0x810); - typedef struct WUT_PACKED LaunchInfoDatabaseEntry { - uint64_t id; - LaunchInfo launchInfo; - } LaunchInfoDatabaseEntry; - WUT_CHECK_SIZE(LaunchInfoDatabaseEntry, 0x818); - WUT_CHECK_OFFSET(LaunchInfoDatabaseEntry, 0x0, id); - WUT_CHECK_OFFSET(LaunchInfoDatabaseEntry, 0x8, launchInfo); +typedef struct WUT_PACKED LaunchInfoDatabaseEntry +{ + uint64_t id; + LaunchInfo launchInfo; +} LaunchInfoDatabaseEntry; +WUT_CHECK_SIZE(LaunchInfoDatabaseEntry, 0x818); +WUT_CHECK_OFFSET(LaunchInfoDatabaseEntry, 0x0, id); +WUT_CHECK_OFFSET(LaunchInfoDatabaseEntry, 0x8, launchInfo); - // This struct has a variable length, the hash is always expected at the end - typedef struct WUT_PACKED LaunchInfoDatabaseHeader { - uint32_t version; // 1 - uint32_t magic; // "LIDB" - uint32_t maxEntries; - uint32_t entryCount; - uint64_t currentId; // start at 0x1000000000000000 - LaunchInfoDatabaseEntry entries[0]; // Dynamic, actually this array should be entries[maxEntries] - char sha1Hash[20]; - } LaunchInfoDatabaseHeader; - WUT_CHECK_SIZE(LaunchInfoDatabaseHeader, 0x2C); - WUT_CHECK_OFFSET(LaunchInfoDatabaseHeader, 0x0, version); - WUT_CHECK_OFFSET(LaunchInfoDatabaseHeader, 0x4, magic); - WUT_CHECK_OFFSET(LaunchInfoDatabaseHeader, 0x8, maxEntries); - WUT_CHECK_OFFSET(LaunchInfoDatabaseHeader, 0xC, entryCount); - WUT_CHECK_OFFSET(LaunchInfoDatabaseHeader, 0x10, currentId); - WUT_CHECK_OFFSET(LaunchInfoDatabaseHeader, 0x18, entries); - WUT_CHECK_OFFSET(LaunchInfoDatabaseHeader, 0x18, sha1Hash); +// This struct has a variable length, the hash is always expected at the end +typedef struct WUT_PACKED LaunchInfoDatabaseHeader +{ + uint32_t version; // 1 + uint32_t magic; // "LIDB" + uint32_t maxEntries; + uint32_t entryCount; + uint64_t currentId; // start at 0x1000000000000000 + LaunchInfoDatabaseEntry entries[0]; // Dynamic, actually this array should be entries[maxEntries] + char sha1Hash[20]; +} LaunchInfoDatabaseHeader; +WUT_CHECK_SIZE(LaunchInfoDatabaseHeader, 0x2C); +WUT_CHECK_OFFSET(LaunchInfoDatabaseHeader, 0x0, version); +WUT_CHECK_OFFSET(LaunchInfoDatabaseHeader, 0x4, magic); +WUT_CHECK_OFFSET(LaunchInfoDatabaseHeader, 0x8, maxEntries); +WUT_CHECK_OFFSET(LaunchInfoDatabaseHeader, 0xC, entryCount); +WUT_CHECK_OFFSET(LaunchInfoDatabaseHeader, 0x10, currentId); +WUT_CHECK_OFFSET(LaunchInfoDatabaseHeader, 0x18, entries); +WUT_CHECK_OFFSET(LaunchInfoDatabaseHeader, 0x18, sha1Hash); - struct WUT_PACKED IconInfo { - uint8_t data[65580]; // tga - char name[0x80]; - }; - WUT_CHECK_SIZE(IconInfo, 0x100ac); - WUT_CHECK_OFFSET(IconInfo, 0, data); - WUT_CHECK_OFFSET(IconInfo, 0x1002c, name); +struct WUT_PACKED IconInfo +{ + uint8_t data[65580]; // tga + char name[0x80]; +}; +WUT_CHECK_SIZE(IconInfo, 0x100ac); +WUT_CHECK_OFFSET(IconInfo, 0, data); +WUT_CHECK_OFFSET(IconInfo, 0x1002c, name); - struct WUT_PACKED AccountUUID { - char uuid[10]; - }; - WUT_CHECK_SIZE(AccountUUID, 10); +struct WUT_PACKED AccountUUID +{ + char uuid[10]; +}; +WUT_CHECK_SIZE(AccountUUID, 10); - struct DRCImagePaletteColor { - uint8_t b; - uint8_t g; - uint8_t r; - uint8_t a; - }; - WUT_CHECK_SIZE(DRCImagePaletteColor, 4); - WUT_CHECK_OFFSET(DRCImagePaletteColor, 0, b); - WUT_CHECK_OFFSET(DRCImagePaletteColor, 1, g); - WUT_CHECK_OFFSET(DRCImagePaletteColor, 2, r); - WUT_CHECK_OFFSET(DRCImagePaletteColor, 3, a); +struct DRCImagePaletteColor +{ + uint8_t b; + uint8_t g; + uint8_t r; + uint8_t a; +}; +WUT_CHECK_SIZE(DRCImagePaletteColor, 4); +WUT_CHECK_OFFSET(DRCImagePaletteColor, 0, b); +WUT_CHECK_OFFSET(DRCImagePaletteColor, 1, g); +WUT_CHECK_OFFSET(DRCImagePaletteColor, 2, r); +WUT_CHECK_OFFSET(DRCImagePaletteColor, 3, a); - struct DRCImagePalette { - DRCImagePaletteColor values[0x100]; - }; - WUT_CHECK_SIZE(DRCImagePalette, 0x400); - WUT_CHECK_OFFSET(DRCImagePalette, 0, values); +struct DRCImagePalette +{ + DRCImagePaletteColor values[0x100]; +}; +WUT_CHECK_SIZE(DRCImagePalette, 0x400); +WUT_CHECK_OFFSET(DRCImagePalette, 0, values); - struct WUT_PACKED TransferableInfo { - uint8_t numAccounts; - uint8_t defaultAccountIndex; - AccountUUID uuids[12]; - WUT_PADDING_BYTES(0x48); - uint8_t isNetworkAccount[12]; - uint8_t isPasswordCacheEnabled[12]; - uint64_t titleIds[10]; - uint8_t isOnDisc[10]; - uint64_t killerNotificationsTitleId; - uint32_t serialId; - WUT_PADDING_BYTES(192); - struct { - DRCImagePalette palette; - uint8_t pixelIndex[206][412]; // index of color in palette - } accountSceneImage; - struct { - DRCImagePalette palette; - uint8_t pixelIndex[129][1630]; // index of color in palette - } quickStartScene1; - struct { - DRCImagePalette palette; - uint8_t pixelIndex[85][854]; // index of color in palette - } quickStartScene2; - struct { - DRCImagePalette palette; // this is actually unused. The quick start menu uses the button color palette for the main image as well. - uint8_t pixel[400][854]; // index of color in (button) palette - } killerNotificationMain; - struct { - DRCImagePalette palette; - uint8_t pixelIndex[160][487]; // index of color in palette - } killerNotificationButton; - }; - WUT_CHECK_SIZE(TransferableInfo, 0xc1934); - WUT_CHECK_OFFSET(TransferableInfo, 0x00, numAccounts); - WUT_CHECK_OFFSET(TransferableInfo, 0x01, defaultAccountIndex); - WUT_CHECK_OFFSET(TransferableInfo, 0x02, uuids); - WUT_CHECK_OFFSET(TransferableInfo, 0xC2, isNetworkAccount); - WUT_CHECK_OFFSET(TransferableInfo, 0xCE, isPasswordCacheEnabled); - WUT_CHECK_OFFSET(TransferableInfo, 0xda, titleIds); - WUT_CHECK_OFFSET(TransferableInfo, 0x12a, isOnDisc); - WUT_CHECK_OFFSET(TransferableInfo, 0x134, killerNotificationsTitleId); - WUT_CHECK_OFFSET(TransferableInfo, 0x13C, serialId); - WUT_CHECK_OFFSET(TransferableInfo, 0x200, accountSceneImage); - WUT_CHECK_OFFSET(TransferableInfo, 0x15188, quickStartScene1); - WUT_CHECK_OFFSET(TransferableInfo, 0x48ae6, quickStartScene2); - WUT_CHECK_OFFSET(TransferableInfo, 0x5aa74, killerNotificationMain); - WUT_CHECK_OFFSET(TransferableInfo, 0xae4d4, killerNotificationButton); +struct WUT_PACKED TransferableInfo +{ + uint8_t numAccounts; + uint8_t defaultAccountIndex; + AccountUUID uuids[12]; + WUT_PADDING_BYTES(0x48); + uint8_t isNetworkAccount[12]; + uint8_t isPasswordCacheEnabled[12]; + uint64_t titleIds[10]; + uint8_t isOnDisc[10]; + uint64_t killerNotificationsTitleId; + uint32_t serialId; + WUT_PADDING_BYTES(192); + struct + { + DRCImagePalette palette; + uint8_t pixelIndex[206][412]; // index of color in palette + } accountSceneImage; + struct + { + DRCImagePalette palette; + uint8_t pixelIndex[129][1630]; // index of color in palette + } quickStartScene1; + struct + { + DRCImagePalette palette; + uint8_t pixelIndex[85][854]; // index of color in palette + } quickStartScene2; + struct + { + DRCImagePalette palette; // this is actually unused. The quick start menu uses the button color palette for the main image as well. + uint8_t pixel[400][854]; // index of color in (button) palette + } killerNotificationMain; + struct + { + DRCImagePalette palette; + uint8_t pixelIndex[160][487]; // index of color in palette + } killerNotificationButton; +}; +WUT_CHECK_SIZE(TransferableInfo, 0xc1934); +WUT_CHECK_OFFSET(TransferableInfo, 0x00, numAccounts); +WUT_CHECK_OFFSET(TransferableInfo, 0x01, defaultAccountIndex); +WUT_CHECK_OFFSET(TransferableInfo, 0x02, uuids); +WUT_CHECK_OFFSET(TransferableInfo, 0xC2, isNetworkAccount); +WUT_CHECK_OFFSET(TransferableInfo, 0xCE, isPasswordCacheEnabled); +WUT_CHECK_OFFSET(TransferableInfo, 0xda, titleIds); +WUT_CHECK_OFFSET(TransferableInfo, 0x12a, isOnDisc); +WUT_CHECK_OFFSET(TransferableInfo, 0x134, killerNotificationsTitleId); +WUT_CHECK_OFFSET(TransferableInfo, 0x13C, serialId); +WUT_CHECK_OFFSET(TransferableInfo, 0x200, accountSceneImage); +WUT_CHECK_OFFSET(TransferableInfo, 0x15188, quickStartScene1); +WUT_CHECK_OFFSET(TransferableInfo, 0x48ae6, quickStartScene2); +WUT_CHECK_OFFSET(TransferableInfo, 0x5aa74, killerNotificationMain); +WUT_CHECK_OFFSET(TransferableInfo, 0xae4d4, killerNotificationButton); - struct WUT_PACKED TitleInfo { - uint64_t titleId; - MCPAppType appType; - MediaType mediaType; - WUT_UNKNOWN_BYTES(0x10); - }; - WUT_CHECK_SIZE(TitleInfo, 0x20); - WUT_CHECK_OFFSET(TitleInfo, 0x00, titleId); - WUT_CHECK_OFFSET(TitleInfo, 0x08, appType); - WUT_CHECK_OFFSET(TitleInfo, 0x0C, mediaType); +struct WUT_PACKED TitleInfo +{ + uint64_t titleId; + MCPAppType appType; + MediaType mediaType; + WUT_UNKNOWN_BYTES(0x10); +}; +WUT_CHECK_SIZE(TitleInfo, 0x20); +WUT_CHECK_OFFSET(TitleInfo, 0x00, titleId); +WUT_CHECK_OFFSET(TitleInfo, 0x08, appType); +WUT_CHECK_OFFSET(TitleInfo, 0x0C, mediaType); - struct WUT_PACKED TitleMetaInfo { - bool isPreOrder; - WUT_PADDING_BYTES(3); - }; - WUT_CHECK_SIZE(TitleMetaInfo, 0x4); - WUT_CHECK_OFFSET(TitleMetaInfo, 0x00, isPreOrder); +struct WUT_PACKED TitleMetaInfo +{ + bool isPreOrder; + WUT_PADDING_BYTES(3); +}; +WUT_CHECK_SIZE(TitleMetaInfo, 0x4); +WUT_CHECK_OFFSET(TitleMetaInfo, 0x00, isPreOrder); - struct WUT_PACKED WhiteList { - MCPAppType titleTypes[50]; - uint32_t titleTypeCount; - WUT_PADDING_BYTES(4); - uint64_t titleIds[50]; - uint32_t titleIdCount; - }; - WUT_CHECK_SIZE(WhiteList, 0x264); - WUT_CHECK_OFFSET(WhiteList, 0x00, titleTypes); - WUT_CHECK_OFFSET(WhiteList, 0xC8, titleTypeCount); - WUT_CHECK_OFFSET(WhiteList, 0xD0, titleIds); - WUT_CHECK_OFFSET(WhiteList, 0x260, titleIdCount); +struct WUT_PACKED WhiteList +{ + MCPAppType titleTypes[50]; + uint32_t titleTypeCount; + WUT_PADDING_BYTES(4); + uint64_t titleIds[50]; + uint32_t titleIdCount; +}; +WUT_CHECK_SIZE(WhiteList, 0x264); +WUT_CHECK_OFFSET(WhiteList, 0x00, titleTypes); +WUT_CHECK_OFFSET(WhiteList, 0xC8, titleTypeCount); +WUT_CHECK_OFFSET(WhiteList, 0xD0, titleIds); +WUT_CHECK_OFFSET(WhiteList, 0x260, titleIdCount); - struct WUT_PACKED Account { - char uuid[0x10]; - uint32_t isNetworkAccount; - uint8_t isPasswordCacheEnabled; - uint8_t age; - WUT_PADDING_BYTES(2); - uint32_t gender; - uint32_t simpleAddressId; - uint8_t isMailAddressValidated; - WUT_PADDING_BYTES(1); - uint16_t bday_year; - uint8_t bday_month; - uint8_t bday_day; - WUT_PADDING_BYTES(2); - }; - WUT_CHECK_SIZE(Account, 0x28); - WUT_CHECK_OFFSET(Account, 0x00, uuid); - WUT_CHECK_OFFSET(Account, 0x10, isNetworkAccount); - WUT_CHECK_OFFSET(Account, 0x14, isPasswordCacheEnabled); - WUT_CHECK_OFFSET(Account, 0x15, age); - WUT_CHECK_OFFSET(Account, 0x18, gender); - WUT_CHECK_OFFSET(Account, 0x1C, simpleAddressId); - WUT_CHECK_OFFSET(Account, 0x20, isMailAddressValidated); - WUT_CHECK_OFFSET(Account, 0x22, bday_year); - WUT_CHECK_OFFSET(Account, 0x24, bday_month); - WUT_CHECK_OFFSET(Account, 0x25, bday_day); +struct WUT_PACKED Account +{ + char uuid[0x10]; + uint32_t isNetworkAccount; + uint8_t isPasswordCacheEnabled; + uint8_t age; + WUT_PADDING_BYTES(2); + uint32_t gender; + uint32_t simpleAddressId; + uint8_t isMailAddressValidated; + WUT_PADDING_BYTES(1); + uint16_t bday_year; + uint8_t bday_month; + uint8_t bday_day; + WUT_PADDING_BYTES(2); +}; +WUT_CHECK_SIZE(Account, 0x28); +WUT_CHECK_OFFSET(Account, 0x00, uuid); +WUT_CHECK_OFFSET(Account, 0x10, isNetworkAccount); +WUT_CHECK_OFFSET(Account, 0x14, isPasswordCacheEnabled); +WUT_CHECK_OFFSET(Account, 0x15, age); +WUT_CHECK_OFFSET(Account, 0x18, gender); +WUT_CHECK_OFFSET(Account, 0x1C, simpleAddressId); +WUT_CHECK_OFFSET(Account, 0x20, isMailAddressValidated); +WUT_CHECK_OFFSET(Account, 0x22, bday_year); +WUT_CHECK_OFFSET(Account, 0x24, bday_month); +WUT_CHECK_OFFSET(Account, 0x25, bday_day); - struct WUT_PACKED AccountInfo { - uint8_t account_index[12]; - WUT_UNKNOWN_BYTES(4); - uint32_t num_of_accounts; - Account accounts[12]; - }; - WUT_CHECK_SIZE(AccountInfo, 0x1f4); - WUT_CHECK_OFFSET(AccountInfo, 0, account_index); - WUT_CHECK_OFFSET(AccountInfo, 0x10, num_of_accounts); - WUT_CHECK_OFFSET(AccountInfo, 0x14, accounts); +struct WUT_PACKED AccountInfo +{ + uint8_t account_index[12]; + WUT_UNKNOWN_BYTES(4); + uint32_t num_of_accounts; + Account accounts[12]; +}; +WUT_CHECK_SIZE(AccountInfo, 0x1f4); +WUT_CHECK_OFFSET(AccountInfo, 0, account_index); +WUT_CHECK_OFFSET(AccountInfo, 0x10, num_of_accounts); +WUT_CHECK_OFFSET(AccountInfo, 0x14, accounts); - struct WUT_PACKED Setting { - struct { - bool enabled; - bool pushEnabled; - bool adEnabled; - bool drcLedEnable; - uint16_t pushInterval; - WUT_PADDING_BYTES(2); - uint32_t pushTimeSlot; - } caffeine; - bool pushAutoDelivery; - WUT_PADDING_BYTES(3); - uint32_t edmStandbyModeLength; - uint32_t language; - uint32_t prodArea; - }; - WUT_CHECK_SIZE(Setting, 0x1C); - WUT_CHECK_OFFSET(Setting, 0x0, caffeine.enabled); - WUT_CHECK_OFFSET(Setting, 0x01, caffeine.pushEnabled); - WUT_CHECK_OFFSET(Setting, 0x02, caffeine.adEnabled); - WUT_CHECK_OFFSET(Setting, 0x03, caffeine.drcLedEnable); - WUT_CHECK_OFFSET(Setting, 0x04, caffeine.pushInterval); - WUT_CHECK_OFFSET(Setting, 0x08, caffeine.pushTimeSlot); - WUT_CHECK_OFFSET(Setting, 0x0C, pushAutoDelivery); - WUT_CHECK_OFFSET(Setting, 0x10, edmStandbyModeLength); - WUT_CHECK_OFFSET(Setting, 0x14, language); - WUT_CHECK_OFFSET(Setting, 0x18, prodArea); +struct WUT_PACKED Setting +{ + struct + { + bool enabled; + bool pushEnabled; + bool adEnabled; + bool drcLedEnable; + uint16_t pushInterval; + WUT_PADDING_BYTES(2); + uint32_t pushTimeSlot; + } caffeine; + bool pushAutoDelivery; + WUT_PADDING_BYTES(3); + uint32_t edmStandbyModeLength; + uint32_t language; + uint32_t prodArea; +}; +WUT_CHECK_SIZE(Setting, 0x1C); +WUT_CHECK_OFFSET(Setting, 0x0, caffeine.enabled); +WUT_CHECK_OFFSET(Setting, 0x01, caffeine.pushEnabled); +WUT_CHECK_OFFSET(Setting, 0x02, caffeine.adEnabled); +WUT_CHECK_OFFSET(Setting, 0x03, caffeine.drcLedEnable); +WUT_CHECK_OFFSET(Setting, 0x04, caffeine.pushInterval); +WUT_CHECK_OFFSET(Setting, 0x08, caffeine.pushTimeSlot); +WUT_CHECK_OFFSET(Setting, 0x0C, pushAutoDelivery); +WUT_CHECK_OFFSET(Setting, 0x10, edmStandbyModeLength); +WUT_CHECK_OFFSET(Setting, 0x14, language); +WUT_CHECK_OFFSET(Setting, 0x18, prodArea); - struct KillerNotificationTransferRecord { - WUT_UNKNOWN_BYTES(0x18); - }; - WUT_CHECK_SIZE(KillerNotificationTransferRecord, 0x18); +struct KillerNotificationTransferRecord +{ + WUT_UNKNOWN_BYTES(0x18); +}; +WUT_CHECK_SIZE(KillerNotificationTransferRecord, 0x18); - typedef enum Region { - REGION_JPN = 0, - REGION_USA = 1, - REGION_EUR = 2 - } Region; +typedef enum Region +{ + REGION_JPN = 0, + REGION_USA = 1, + REGION_EUR = 2 +} Region; - enum TransferMode { - TRANSFER_MODE_UNKWN_1 = 1, - TRANSFER_MODE_UNKWN_2 = 2, - TRANSFER_MODE_UNKWN_3 = 3, - }; +enum TransferMode +{ + TRANSFER_MODE_UNKWN_1 = 1, + TRANSFER_MODE_UNKWN_2 = 2, + TRANSFER_MODE_UNKWN_3 = 3, +}; - enum Language { - Japanese = 0, - English = 1, - French = 2, - German = 3, - Italian = 4, - Spanish = 5, - SimplifiedChinese = 6, - Korean = 7, - Dutch = 8, - Portuguese = 9, - Russian = 10, - TraditionalChinese = 11, - }; +enum Language +{ + Japanese = 0, + English = 1, + French = 2, + German = 3, + Italian = 4, + Spanish = 5, + SimplifiedChinese = 6, + Korean = 7, + Dutch = 8, + Portuguese = 9, + Russian = 10, + TraditionalChinese = 11, +}; - enum SeekOrigin { - SeekSet = 0 - }; +enum SeekOrigin +{ + SeekSet = 0 +}; - void - GetDefaultDatabasePath(char *, int size, uint64_t titleId) asm("GetDefaultDatabasePath__Q2_2nn2slFPcUiUL"); +void +GetDefaultDatabasePath(char *, int size, uint64_t titleId) + asm("GetDefaultDatabasePath__Q2_2nn2slFPcUiUL"); - void - GetDefaultDatabasePath(char *, int size) asm("GetDefaultDatabasePath__Q2_2nn2slFPcUi"); +void +GetDefaultDatabasePath(char *, int size) + asm("GetDefaultDatabasePath__Q2_2nn2slFPcUi"); - void - GetDefaultKillerNotificationTransferRecordPath(char *, int size, uint64_t titleId, const char *) asm("GetDefaultKillerNotificationTransferRecordPath__Q2_2nn2slFPcUiUL"); +void +GetDefaultKillerNotificationTransferRecordPath(char *, int size, uint64_t titleId, const char *) + asm("GetDefaultKillerNotificationTransferRecordPath__Q2_2nn2slFPcUiUL"); - void Initialize(MEMAllocFromDefaultHeapExFn, MEMFreeToDefaultHeapFn) asm("Initialize__Q2_2nn2slFPFUiT1_PvPFPv_v"); +void Initialize(MEMAllocFromDefaultHeapExFn, MEMFreeToDefaultHeapFn) + asm("Initialize__Q2_2nn2slFPFUiT1_PvPFPv_v"); - void - Finalize() asm("Finalize__Q2_2nn2slFv"); +void +Finalize() + asm("Finalize__Q2_2nn2slFv"); - void - FinalizeForEcoProcess() asm("FinalizeForEcoProcess__Q2_2nn2slFv"); +void +FinalizeForEcoProcess() + asm("FinalizeForEcoProcess__Q2_2nn2slFv"); - void - InitializeForEcoProcess(MEMAllocFromDefaultHeapExFn allocFn, MEMFreeToDefaultHeapFn freeFn) asm("InitializeForEcoProcess__Q2_2nn2slFPFUiT1_PvPFPv_v"); +void +InitializeForEcoProcess(MEMAllocFromDefaultHeapExFn allocFn, MEMFreeToDefaultHeapFn freeFn) + asm("InitializeForEcoProcess__Q2_2nn2slFPFUiT1_PvPFPv_v"); }; // namespace nn::sl diff --git a/include/nn/spm/storage.h b/include/nn/spm/storage.h index 62ee48fe2..f45ad20d3 100644 --- a/include/nn/spm/storage.h +++ b/include/nn/spm/storage.h @@ -12,8 +12,10 @@ #include -namespace nn { -namespace spm { +namespace nn +{ +namespace spm +{ enum StorageType : uint32_t { @@ -27,7 +29,8 @@ struct VolumeId { VolumeId() = default; - VolumeId(char const* id){ + VolumeId(char const *id) + { strncpy(this->id, id, sizeof(this->id)); } @@ -38,8 +41,8 @@ struct VolumeId * 0 if equal */ int32_t - Compare(VolumeId const& other) const - asm("Compare__Q3_2nn3spm8VolumeIdCFRCQ3_2nn3spm8VolumeId"); + Compare(VolumeId const &other) const + asm("Compare__Q3_2nn3spm8VolumeIdCFRCQ3_2nn3spm8VolumeId"); char id[16]; }; @@ -93,41 +96,41 @@ SetAutoFatal(bool enabled) * 0 on success. */ int32_t -SetExtendedStorage(StorageIndex* index) +SetExtendedStorage(StorageIndex *index) asm("SetExtendedStorage__Q2_2nn3spmFQ3_2nn3spm12StorageIndex"); /** * Sets the id of the default extended storage drive */ void -SetDefaultExtendedStorageVolumeId(VolumeId const& id) +SetDefaultExtendedStorageVolumeId(VolumeId const &id) asm("SetDefaultExtendedStorageVolumeId__Q2_2nn3spmFRCQ3_2nn3spm8VolumeId"); /** * Gets the id of the default extended storage drive */ void -GetDefaultExtendedStorageVolumeId(VolumeId* id) +GetDefaultExtendedStorageVolumeId(VolumeId *id) asm("GetDefaultExtendedStorageVolumeId__Q2_2nn3spmFv"); bool -GetPreviousExtendedStorageVolumeId(bool*, VolumeId* outVolumeId) +GetPreviousExtendedStorageVolumeId(bool *, VolumeId *outVolumeId) asm("GetPreviousExtendedStorageVolumeId__Q2_2nn3spmFPbPQ3_2nn3spm8VolumeId"); bool -FindStorageByVolumeId(StorageIndex* outIndex, VolumeId const& volumeId) +FindStorageByVolumeId(StorageIndex *outIndex, VolumeId const &volumeId) asm("FindStorageByVolumeId__Q2_2nn3spmFPQ3_2nn3spm12StorageIndexRCQ3_2nn3spm8VolumeId"); int32_t -GetExtendedStorageIndex(StorageIndex* outIndex) +GetExtendedStorageIndex(StorageIndex *outIndex) asm("GetExtendedStorageIndex__Q2_2nn3spmFPQ3_2nn3spm12StorageIndex"); int32_t -GetStorageList(StorageListItem* items, uint32_t maxNumItems) +GetStorageList(StorageListItem *items, uint32_t maxNumItems) asm("GetStorageList__Q2_2nn3spmFPQ3_2nn3spm15StorageListItemUi"); int32_t -GetStorageInfo(StorageInfo* outInfo, StorageIndex* index) +GetStorageInfo(StorageInfo *outInfo, StorageIndex *index) asm("GetStorageInfo__Q2_2nn3spmFPQ3_2nn3spm11StorageInfoQ3_2nn3spm12StorageIndex"); /** @@ -137,7 +140,7 @@ GetStorageInfo(StorageInfo* outInfo, StorageIndex* index) * 0 on success. */ int32_t -ReadRawStorageHead512(StorageIndex* index, char* outBuffer) +ReadRawStorageHead512(StorageIndex *index, char *outBuffer) asm("ReadRawStorageHead512__Q2_2nn3spmFQ3_2nn3spm12StorageIndexPc"); /** @@ -149,7 +152,7 @@ ReadRawStorageHead512(StorageIndex* index, char* outBuffer) * 0 on success. */ int32_t -IsStorageMaybePcFormatted(bool* isPcFormatted, StorageIndex* index) +IsStorageMaybePcFormatted(bool *isPcFormatted, StorageIndex *index) asm("IsStorageMaybePcFormatted__Q2_2nn3spmFPbQ3_2nn3spm12StorageIndex"); /** @@ -161,11 +164,11 @@ IsStorageMaybePcFormatted(bool* isPcFormatted, StorageIndex* index) * 0 on success. */ int32_t -IsStorageMaybeWfsFormatted(bool* isWfsFormatted, StorageIndex* index) +IsStorageMaybeWfsFormatted(bool *isWfsFormatted, StorageIndex *index) asm("IsStorageMaybeWfsFormatted__Q2_2nn3spmFPbQ3_2nn3spm12StorageIndex"); -}; -}; +}; // namespace spm +}; // namespace nn #endif diff --git a/include/nn/swkbd/swkbd_cpp.h b/include/nn/swkbd/swkbd_cpp.h index a0260c52d..5f90f6157 100644 --- a/include/nn/swkbd/swkbd_cpp.h +++ b/include/nn/swkbd/swkbd_cpp.h @@ -3,8 +3,8 @@ #include #include #include -#include #include +#include /** * \defgroup nn_swkbd_swkbd Software Keyboard @@ -37,11 +37,11 @@ namespace swkbd enum class ControllerType { - WiiRemote0 = 0, - WiiRemote1 = 1, - WiiRemote2 = 2, - WiiRemote3 = 3, - DrcGamepad = 4, + WiiRemote0 = 0, + WiiRemote1 = 1, + WiiRemote2 = 2, + WiiRemote3 = 3, + DrcGamepad = 4, }; //! If the LanguageType and RegionType are not compatible, the LanguageType will be set to English, unless the RegionType is set to "Japan," in which case the LanguageType will be set to Japanese. @@ -76,24 +76,24 @@ enum class LanguageType enum class RegionType { - Japan = 0, - USA = 1, - Europe = 2, - China = 3, - Korea = 4, - Taiwan = 5, + Japan = 0, + USA = 1, + Europe = 2, + China = 3, + Korea = 4, + Taiwan = 5, }; enum class State { //! The input form / keyboard is completely hidden. - Hidden = 0, + Hidden = 0, //! The input form / keyboard is drawing the fade in animation. - FadeIn = 1, + FadeIn = 1, //! The input form / keyboard is done drawing the fade in animation and completely visible. - Visible = 2, + Visible = 2, //! The input form / keyboard is drawing the fade out animation. - FadeOut = 3, + FadeOut = 3, }; enum class InputFormType @@ -101,29 +101,29 @@ enum class InputFormType //! Input form seen when adding an NNID on Friends List or creating a folder on the System Menu. (Individual square design with up to 40 characters) InputForm0 = 0, //! The default input layout that is usually used (Page design) - Default = 1, + Default = 1, }; enum class KeyboardMode { //! The one that fully allows utf-16LE(char16_t) charaters - Full = 0, + Full = 0, //! Numpad used for entering for example a DNS address - Numpad = 1, + Numpad = 1, //! ascii, possibly used for passwords ? - Utf8 = 2, + Utf8 = 2, //! the one thats used for registering an nnid full alphabet, numbers, '_' and '-' - NNID = 3, + NNID = 3, }; enum class PasswordMode { //! Show clear text - Clear = 0, + Clear = 0, //! Hides the text - Hide = 1, + Hide = 1, //! Hides the charater after a few seconds - Fade = 2, + Fade = 2, }; //! Configuration options for the virtual keyboard. @@ -132,14 +132,14 @@ struct ConfigArg ConfigArg() { memset(this, 0, sizeof(*this)); - languageType = LanguageType::English; + languageType = LanguageType::English; controllerType = ControllerType::DrcGamepad; - keyboardMode = KeyboardMode::Full; - accessFlags = 0x7FFFF; - unk_0x10 = 19; - unk_0x14 = -1; - unk_0x9C = 1; - unk_0xA4 = -1; + keyboardMode = KeyboardMode::Full; + accessFlags = 0x7FFFF; + unk_0x10 = 19; + unk_0x14 = -1; + unk_0x9C = 1; + unk_0xA4 = -1; } //! The language to use for input @@ -196,9 +196,9 @@ struct ReceiverArg uint32_t unk_0x00 = 0; uint32_t unk_0x04 = 0; uint32_t unk_0x08 = 0; - int32_t unk_0x0C = -1; + int32_t unk_0x0C = -1; uint32_t unk_0x10 = 0; - int32_t unk_0x14 = -1; + int32_t unk_0x14 = -1; }; WUT_CHECK_OFFSET(ReceiverArg, 0x00, unk_0x00); WUT_CHECK_OFFSET(ReceiverArg, 0x04, unk_0x04); @@ -221,23 +221,23 @@ WUT_CHECK_SIZE(KeyboardArg, 0xC0); struct InputFormArg { //! The type of input form - InputFormType type = InputFormType::Default; - int32_t unk_0x04 = -1; + InputFormType type = InputFormType::Default; + int32_t unk_0x04 = -1; //! Initial string to open the keyboard with - const char16_t *initialText = nullptr; + const char16_t *initialText = nullptr; //! Hint string - const char16_t *hintText = nullptr; + const char16_t *hintText = nullptr; //! The maximum number of characters that can be entered, -1 for unlimited. - int32_t maxTextLength = -1; + int32_t maxTextLength = -1; //! Which password inputting preset to use nn::swkbd::PasswordMode passwordMode = nn::swkbd::PasswordMode::Clear; - uint32_t unk_0x18 = 0; - //! Whether or not to draw a cursor. Exclusive to the inputform0 input form type. - bool drawInput0Cursor = false; - //! Whether or not to highlight the initial string. Exclusive to the Default input form type. - bool higlightInitialText = false; + uint32_t unk_0x18 = 0; + //! Whether or not to draw a cursor. Exclusive to the inputform0 input form type. + bool drawInput0Cursor = false; + //! Whether or not to highlight the initial string. Exclusive to the Default input form type. + bool higlightInitialText = false; //! Whether or not to show a copy and a paste button. - bool showCopyPasteButtons = false; + bool showCopyPasteButtons = false; WUT_PADDING_BYTES(1); }; WUT_CHECK_OFFSET(InputFormArg, 0x00, type); @@ -266,12 +266,12 @@ WUT_CHECK_SIZE(AppearArg, 0xE0); struct CreateArg { //! A pointer to a work memory buffer; see \link GetWorkMemorySize \endlink. - void *workMemory = nullptr; + void *workMemory = nullptr; //! The swkbd region to use. RegionType regionType = RegionType::Europe; - uint32_t unk_0x08 = 0; + uint32_t unk_0x08 = 0; //! An FSClient for swkbd to use while loading resources. - FSClient *fsClient = nullptr; + FSClient *fsClient = nullptr; }; WUT_CHECK_OFFSET(CreateArg, 0x00, workMemory); WUT_CHECK_OFFSET(CreateArg, 0x04, regionType); @@ -283,9 +283,9 @@ WUT_CHECK_SIZE(CreateArg, 0x10); struct ControllerInfo { //! DRC input information, see \link VPADRead \endlink. - VPADStatus *vpad = nullptr; + VPADStatus *vpad = nullptr; //! Wiimote and extension controller inputs, see \link KPADRead \endlink. - KPADStatus *kpad[4] = { nullptr, nullptr, nullptr, nullptr }; + KPADStatus *kpad[4] = {nullptr, nullptr, nullptr, nullptr}; }; WUT_CHECK_OFFSET(ControllerInfo, 0x00, vpad); WUT_CHECK_OFFSET(ControllerInfo, 0x04, kpad); @@ -334,7 +334,7 @@ struct ISoundObj; * - \link IsDecideCancelButton \endlink */ bool -AppearInputForm(const AppearArg& args); +AppearInputForm(const AppearArg &args); /** * Show a keyboard with the given configuration. @@ -352,7 +352,7 @@ AppearInputForm(const AppearArg& args); * - \link IsDecideCancelButton \endlink */ bool -AppearKeyboard(const KeyboardArg& args); +AppearKeyboard(const KeyboardArg &args); /** * Calculate font data. Call in response to diff --git a/include/nn/temp/temp.h b/include/nn/temp/temp.h index 86610ce2d..dbd365416 100644 --- a/include/nn/temp/temp.h +++ b/include/nn/temp/temp.h @@ -9,10 +9,10 @@ extern "C" { typedef enum TEMPTargetPreference { - //! Use whichever target has more available space - TEMP_PREF_DEFAULT = 0, - //! Always prefer USB - TEMP_PREF_USB = 1, + //! Use whichever target has more available space + TEMP_PREF_DEFAULT = 0, + //! Always prefer USB + TEMP_PREF_USB = 1, } TEMPTargetPreference; typedef uint64_t TEMPDirId; diff --git a/include/nn/uds/Cafe.h b/include/nn/uds/Cafe.h index 3de428fd9..754d6e498 100644 --- a/include/nn/uds/Cafe.h +++ b/include/nn/uds/Cafe.h @@ -1,9 +1,9 @@ #pragma once #include +#include #include #include -#include /** * \defgroup nn_uds nn_uds @@ -15,462 +15,497 @@ #ifdef __cplusplus //! Theoretical supported maximum number of nodes connected to a network, including the host -#define UDS_MAX_NODES 0x10 +#define UDS_MAX_NODES 0x10 //! Broadcast node ID, used for sending data to all nodes in the network #define UDS_BROADCAST_NODE_ID 0xFFFF -namespace nn { - -namespace uds { - -namespace Cafe { - //! Stores the connection status of the network - struct ConnectionStatus { - //! The network status - uint32_t status; - //! The reason why the status has changed - uint32_t reason; - //! The network node ID of this device - uint16_t networkNodeId; - //! Bitmask of nodes that have changed - uint16_t changedNodes; - //! Array of nodes connected to the network - uint16_t nodes[UDS_MAX_NODES]; - //! Total amount of nodes connected to the network - uint8_t totalNodes; - //! Maximum number of nodes that can connect to the network, including the host - uint8_t maxNodes; - //! Bitmask of nodes connected to the network - uint16_t nodeBitmask; - }; - WUT_CHECK_SIZE(ConnectionStatus, 0x30); - WUT_CHECK_OFFSET(ConnectionStatus, 0x00, status); - WUT_CHECK_OFFSET(ConnectionStatus, 0x04, reason); - WUT_CHECK_OFFSET(ConnectionStatus, 0x08, networkNodeId); - WUT_CHECK_OFFSET(ConnectionStatus, 0x0A, changedNodes); - WUT_CHECK_OFFSET(ConnectionStatus, 0x0C, nodes); - WUT_CHECK_OFFSET(ConnectionStatus, 0x2C, totalNodes); - WUT_CHECK_OFFSET(ConnectionStatus, 0x2D, maxNodes); - WUT_CHECK_OFFSET(ConnectionStatus, 0x2E, nodeBitmask); - - //! Recommended size to use for work memory buffer - static constexpr uint32_t kWorkMemorySize = 0x14000; - - //! Describes a network endpoint - using EndpointDescriptor = uint32_t; - - enum PollStateChangeFlags : uint8_t { - //! Prevents \c PollStateChange from blocking if no new data is available - UDS_POLL_NONBLOCK = 1 << 0, - }; - WUT_CHECK_SIZE(PollStateChangeFlags, 0x1); - - enum ReceiveFlags : uint8_t { - //! Prevents \c Receive from blocking if no new data is available - UDS_RECEIVE_NONBLOCK = 1 << 0, - }; - WUT_CHECK_SIZE(ReceiveFlags, 0x1); - - /** - * Allows clients to connect to the network. - */ - nn::Result - AllowToConnect() asm("AllowToConnect__Q3_2nn3uds4CafeFv"); - - /** - * Allows clients to spectate the network. - */ - nn::Result - AllowToSpectate() asm("AllowToSpectate__Q3_2nn3uds4CafeFv"); - - /** - * Attaches an endpoint to a specified node. - * - * \param fd - * The endpoint descriptor. - * - * \param networkNodeId - * The network node ID. Use \link UDS_BROADCAST_NODE_ID \endlink to attach to all nodes. - * - * \param dataChannel - * Data channel to attach to. Must not be 0. - * - * \param recvBufferSize - * Size to be allocated for the internal buffer for receiving data. - * Must be greater or equal than 1536 bytes. - */ - nn::Result - Attach(EndpointDescriptor *fd, - uint16_t networkNodeId, - uint8_t dataChannel, - uint32_t recvBufferSize) asm("Attach__Q3_2nn3uds4CafeFPQ4_2nn3uds4Cafe18EndpointDescriptorUsUcUi"); - - /** - * Creates a local communication ID based on the given paramaters. - * - * \param uniqueId - * A unique identifier of the current title. - * This is truncated to 20 bits on the created ID. - * - * \param unknown - * Enables or disables a flag on the created ID. - * - * \returns - * The created local communication ID. - */ - uint32_t - CreateLocalCommunicationId(uint32_t uniqueId, bool unknown) asm("CreateLocalCommunicationId__Q3_2nn3uds4CafeFUib"); - - /** - * Creates a new endpoint. - * - * \param fd - * A pointer where the endpoint descriptor is written. - */ - nn::Result - CreateEndpoint(EndpointDescriptor *fd) asm("CreateEndpoint__Q3_2nn3uds4CafeFPQ4_2nn3uds4Cafe18EndpointDescriptor"); - - /** - * Creates a new network with the given parameters. - * - * \param id8 - * ID8 to be used on the network. Must not be 0xFF. - * - * \param maxNodes - * The maximum amount of nodes that will be able to connect to the network, - * including the host. Must be a number between 2 and 9 inclusively. - * - * \param localCommunicationId - * Local communication ID used for identifying the network. - * - * \param passphrase - * Passphrase to be used for the network. - * - * \param passphraseSize - * Size of the passphrase, including NULL termination. Must be greater than 8 - * characters and lower than 255 characters inclusively. - * - * \param channel - * Channel to use for hosting the network. Use 0 to choose a channel automatically. - * Must be either 0, 1, 6 or 11. - */ - nn::Result - CreateNetwork(uint8_t id8, - uint8_t maxNodes, - uint32_t localCommunicationId, - const char *passphrase, - uint32_t passphraseSize, - uint8_t channel) asm("CreateNetwork__Q3_2nn3uds4CafeFUcT1UiPCcT3T1"); - - /** - * Creates a new network with the given parameters. - * - * \param id8 - * ID8 to be used on the network. Must not be 0xFF. - * - * \param maxNodes - * The maximum amount of nodes that will be able to connect to the network, - * including the host. Must be a number between 2 and 9 inclusively. - * - * \param localCommunicationId - * Local communication ID used for identifying the network. - * - * \param passphrase - * Passphrase to be used for the network. - * - * \param passphraseSize - * Size of the passphrase, including NULL termination. Must be greater than 8 - * characters and lower than 255 characters inclusively. - * - * \param channel - * Channel to use for hosting the network. Use 0 to choose a channel automatically. - * Must be either 0, 1, 6 or 11. - * - * \param appData - * Pointer to application data. - * - * \param appDataSize - * Size of application data. Must be lower than 200 bytes inclusively. - */ - nn::Result - CreateNetwork(uint8_t id8, - uint8_t maxNodes, - uint32_t localCommunicationId, - const char *passphrase, - uint32_t passphraseSize, - uint8_t channel, - const void *appData, - uint32_t appDataSize) asm("CreateNetwork__Q3_2nn3uds4CafeFUcT1UiPCcT3T1PCvT3"); - - /** - * Creates a new network with the given parameters. - * - * \param id8 - * ID8 to be used on the network. Must not be 0xFF. - * - * \param maxNodes - * The maximum amount of nodes that will be able to connect to the network, - * including the host. Must be a number between 2 and 9 inclusively. - * - * \param localCommunicationId - * Local communication ID used for identifying the network. - * - * \param passphrase - * Passphrase to be used for the network. - * - * \param passphraseSize - * Size of the passphrase, including NULL termination. Must be greater than 8 - * characters and lower than 255 characters inclusively. - * - * \param unused - * This parameter is unused. - * - * \param channel - * Channel to use for hosting the network. Use 0 to choose a channel automatically. - * Must be either 0, 1, 6 or 11. - * - * \param appData - * Pointer to application data. - * - * \param appDataSize - * Size of application data. Must be lower than 200 bytes inclusively. - */ - nn::Result - CreateNetwork(uint8_t id8, - uint8_t maxNodes, - uint32_t localCommunicationId, - const char *passphrase, - uint32_t passphraseSize, - bool unused, - uint8_t channel, - const void *appData, - uint32_t appDataSize) asm("CreateNetwork__Q3_2nn3uds4CafeFUcT1UiPCcT3bT1PCvT3"); - - /** - * Destroys the given endpoint. - * - * \param fd - * The endpoint descriptor. - */ - nn::Result - DestroyEndpoint(EndpointDescriptor *fd) asm("DestroyEndpoint__Q3_2nn3uds4CafeFPQ4_2nn3uds4Cafe18EndpointDescriptor"); - - /** - * Destroys the previously created network. - */ - nn::Result - DestroyNetwork() asm("DestroyNetwork__Q3_2nn3uds4CafeFv"); - - /** - * Prevents clients from connecting to the network. - * - * \param unknown - * Triggers an unknown flag. - */ - nn::Result - DisallowToConnect(bool unknown) asm("DisallowToConnect__Q3_2nn3uds4CafeFb"); - - /** - * Ejects the specified client from the network. - * - * \param networkNodeId - * The network node ID of the client. Use \link UDS_BROADCAST_NODE_ID \endlink to eject all clients. - */ - nn::Result - EjectClient(uint16_t networkNodeId) asm("EjectClient__Q3_2nn3uds4CafeFUs"); - - /** - * Ejects all spectators from the network. - */ - nn::Result - EjectSpectator() asm("EjectSpectator__Q3_2nn3uds4CafeFv"); - - /** - * Finalizes UDS. - */ - void - Finalize() asm("Finalize__Q3_2nn3uds4CafeFv"); - - /** - * Gets the application data from the network. - * - * \param appData - * Buffer where the application data is written. - * - * \param readSize - * Pointer where the size of the application data is written. - * - * \param size - * Size of the buffer. - */ - nn::Result - GetApplicationDataFromBeacon(void *appData, - uint32_t *readSize, - uint32_t size) asm("GetApplicationDataFromBeacon__Q3_2nn3uds4CafeFPvPUiUi"); - - /** - * Gets the network channel. - * - * \param channel - * Pointer where the channel is written. - */ - nn::Result - GetChannel(uint8_t *channel) asm("GetChannel__Q3_2nn3uds4CafeFPUc"); - - /** - * Retrieves the connection status of the network. - * - * \param status - * Pointer where the connection status is written. - */ - nn::Result - GetConnectionStatus(ConnectionStatus *status) asm("GetConnectionStatus__Q3_2nn3uds4CafeFPQ4_2nn3uds4Cafe16ConnectionStatus"); - - /** - * Gets information about a specified node. - * - * \param info - * Output node information. - * - * \param networkNodeId - * The network node ID. - */ - nn::Result - GetNodeInformation(NodeInformation *info, uint16_t networkNodeId) asm("GetNodeInformation__Q3_2nn3uds4CafeFPQ4_2nn3uds4Cafe15NodeInformationUs"); - - /** - * Initializes UDS. The username will be set to the Mii name. - * - * \param workMemory - * Pointer to work memory to be used by UDS. - * - * \param workMemorySize - * Size of work memory. See \link kWorkMemorySize \endlink for a recomended amount of memory. - */ - nn::Result - Initialize(void *workMemory, uint32_t workMemorySize) asm("Initialize__Q3_2nn3uds4CafeFPvUi"); - - /** - * Initializes UDS with the given username. - * - * \param workMemory - * Pointer to work memory to be used by UDS. - * - * \param workMemorySize - * Size of work memory. See \link kWorkMemorySize \endlink for a recomended amount of memory. - * - * \param username - * The username to be used. If \c NULL, the username will be set to the Mii name. - */ - nn::Result - Initialize(void *workMemory, - uint32_t workMemorySize, - nn::cfg::CTR::UserName *username) asm("Initialize__Q3_2nn3uds4CafeFPvUiPQ4_2nn3cfg3CTR8UserName"); - - /** - * Checks if new data can be retrieved through \c GetConnectionStatus, - * and waits until new data is available if specified. - * - * \param flags - * Flags, see \link PollStateChangeFlags \endlink for all flags. - */ - nn::Result - PollStateChange(uint8_t flags) asm("PollStateChange__Q3_2nn3uds4CafeFUc"); - - /** - * Receives data from the specified endpoint. - * - * \param fd - * The endpoint descriptor. - * - * \param buf - * Output buffer where the data will be written. - * - * \param receivedSize - * Pointer where the received size is written. - * - * \param networkNodeId - * Pointer where the incoming node ID is written. - * - * \param size - * Size of the buffer. Must be 4-byte aligned. - * - * \param flags - * Flags, see \link ReceiveFlags \endlink for all flags. - */ - nn::Result - ReceiveFrom(const EndpointDescriptor &fd, - void *buf, - uint32_t *receivedSize, - uint16_t *networkNodeId, - uint32_t size, - uint8_t flags) asm("ReceiveFrom__Q3_2nn3uds4CafeFRCQ4_2nn3uds4Cafe18EndpointDescriptorPvPUiPUsUiUc"); - - /** - * Receives data from the specified endpoint. - * - * \param fd - * The endpoint descriptor. - * - * \param buf - * Output buffer where the data will be written. - * - * \param receivedSize - * Pointer where the received size is written. - * - * \param size - * Size of the buffer. Must be 4-byte aligned. - * - * \param flags - * Flags, see \link ReceiveFlags \endlink for all flags. - */ - nn::Result - Receive(const EndpointDescriptor &fd, - void *buf, - uint32_t *receivedSize, - uint32_t size, - uint8_t flags) asm("Receive__Q3_2nn3uds4CafeFRCQ4_2nn3uds4Cafe18EndpointDescriptorPvPUiUiUc"); - - /** - * Sends data to the specified node ID through the given data channel. - * - * \param fd - * THe endpoint descriptor. - * - * \param buf - * Buffer which holds the data to be sent. - * - * \param size - * Size of the buffer. Must be lower or equal than 1478 bytes. - * - * \param destNodeId - * The destination node ID. - * - * \param dataChannel - * The destination data channel. - * - * \param flags - * Unknown flags. - */ - nn::Result - SendTo(const EndpointDescriptor &fd, - const void *buf, - uint32_t size, - uint16_t destNodeId, - uint8_t dataChannel, - uint8_t flags) asm("SendTo__Q3_2nn3uds4CafeFRCQ4_2nn3uds4Cafe18EndpointDescriptorPCvUiUsUcT5"); - - /** - * Sets the application data to the network. - * - * \param appData - * Application data. - * - * \param size - * Size of application data. Must be lower or equal to 200 bytes. - */ - nn::Result - SetApplicationDataToBeacon(const void *appData, uint32_t size) asm("SetApplicationDataToBeacon__Q3_2nn3uds4CafeFPCvUi"); +namespace nn +{ + +namespace uds +{ + +namespace Cafe +{ +//! Stores the connection status of the network +struct ConnectionStatus +{ + //! The network status + uint32_t status; + //! The reason why the status has changed + uint32_t reason; + //! The network node ID of this device + uint16_t networkNodeId; + //! Bitmask of nodes that have changed + uint16_t changedNodes; + //! Array of nodes connected to the network + uint16_t nodes[UDS_MAX_NODES]; + //! Total amount of nodes connected to the network + uint8_t totalNodes; + //! Maximum number of nodes that can connect to the network, including the host + uint8_t maxNodes; + //! Bitmask of nodes connected to the network + uint16_t nodeBitmask; +}; +WUT_CHECK_SIZE(ConnectionStatus, 0x30); +WUT_CHECK_OFFSET(ConnectionStatus, 0x00, status); +WUT_CHECK_OFFSET(ConnectionStatus, 0x04, reason); +WUT_CHECK_OFFSET(ConnectionStatus, 0x08, networkNodeId); +WUT_CHECK_OFFSET(ConnectionStatus, 0x0A, changedNodes); +WUT_CHECK_OFFSET(ConnectionStatus, 0x0C, nodes); +WUT_CHECK_OFFSET(ConnectionStatus, 0x2C, totalNodes); +WUT_CHECK_OFFSET(ConnectionStatus, 0x2D, maxNodes); +WUT_CHECK_OFFSET(ConnectionStatus, 0x2E, nodeBitmask); + +//! Recommended size to use for work memory buffer +static constexpr uint32_t kWorkMemorySize = 0x14000; + +//! Describes a network endpoint +using EndpointDescriptor = uint32_t; + +enum PollStateChangeFlags : uint8_t +{ + //! Prevents \c PollStateChange from blocking if no new data is available + UDS_POLL_NONBLOCK = 1 << 0, +}; +WUT_CHECK_SIZE(PollStateChangeFlags, 0x1); + +enum ReceiveFlags : uint8_t +{ + //! Prevents \c Receive from blocking if no new data is available + UDS_RECEIVE_NONBLOCK = 1 << 0, +}; +WUT_CHECK_SIZE(ReceiveFlags, 0x1); + +/** + * Allows clients to connect to the network. + */ +nn::Result +AllowToConnect() + asm("AllowToConnect__Q3_2nn3uds4CafeFv"); + +/** + * Allows clients to spectate the network. + */ +nn::Result +AllowToSpectate() + asm("AllowToSpectate__Q3_2nn3uds4CafeFv"); + +/** + * Attaches an endpoint to a specified node. + * + * \param fd + * The endpoint descriptor. + * + * \param networkNodeId + * The network node ID. Use \link UDS_BROADCAST_NODE_ID \endlink to attach to all nodes. + * + * \param dataChannel + * Data channel to attach to. Must not be 0. + * + * \param recvBufferSize + * Size to be allocated for the internal buffer for receiving data. + * Must be greater or equal than 1536 bytes. + */ +nn::Result +Attach(EndpointDescriptor *fd, + uint16_t networkNodeId, + uint8_t dataChannel, + uint32_t recvBufferSize) + asm("Attach__Q3_2nn3uds4CafeFPQ4_2nn3uds4Cafe18EndpointDescriptorUsUcUi"); + +/** + * Creates a local communication ID based on the given paramaters. + * + * \param uniqueId + * A unique identifier of the current title. + * This is truncated to 20 bits on the created ID. + * + * \param unknown + * Enables or disables a flag on the created ID. + * + * \returns + * The created local communication ID. + */ +uint32_t +CreateLocalCommunicationId(uint32_t uniqueId, + bool unknown) + asm("CreateLocalCommunicationId__Q3_2nn3uds4CafeFUib"); + +/** + * Creates a new endpoint. + * + * \param fd + * A pointer where the endpoint descriptor is written. + */ +nn::Result +CreateEndpoint(EndpointDescriptor *fd) + asm("CreateEndpoint__Q3_2nn3uds4CafeFPQ4_2nn3uds4Cafe18EndpointDescriptor"); + +/** + * Creates a new network with the given parameters. + * + * \param id8 + * ID8 to be used on the network. Must not be 0xFF. + * + * \param maxNodes + * The maximum amount of nodes that will be able to connect to the network, + * including the host. Must be a number between 2 and 9 inclusively. + * + * \param localCommunicationId + * Local communication ID used for identifying the network. + * + * \param passphrase + * Passphrase to be used for the network. + * + * \param passphraseSize + * Size of the passphrase, including NULL termination. Must be greater than 8 + * characters and lower than 255 characters inclusively. + * + * \param channel + * Channel to use for hosting the network. Use 0 to choose a channel automatically. + * Must be either 0, 1, 6 or 11. + */ +nn::Result +CreateNetwork(uint8_t id8, + uint8_t maxNodes, + uint32_t localCommunicationId, + const char *passphrase, + uint32_t passphraseSize, + uint8_t channel) + asm("CreateNetwork__Q3_2nn3uds4CafeFUcT1UiPCcT3T1"); + +/** + * Creates a new network with the given parameters. + * + * \param id8 + * ID8 to be used on the network. Must not be 0xFF. + * + * \param maxNodes + * The maximum amount of nodes that will be able to connect to the network, + * including the host. Must be a number between 2 and 9 inclusively. + * + * \param localCommunicationId + * Local communication ID used for identifying the network. + * + * \param passphrase + * Passphrase to be used for the network. + * + * \param passphraseSize + * Size of the passphrase, including NULL termination. Must be greater than 8 + * characters and lower than 255 characters inclusively. + * + * \param channel + * Channel to use for hosting the network. Use 0 to choose a channel automatically. + * Must be either 0, 1, 6 or 11. + * + * \param appData + * Pointer to application data. + * + * \param appDataSize + * Size of application data. Must be lower than 200 bytes inclusively. + */ +nn::Result +CreateNetwork(uint8_t id8, + uint8_t maxNodes, + uint32_t localCommunicationId, + const char *passphrase, + uint32_t passphraseSize, + uint8_t channel, + const void *appData, + uint32_t appDataSize) + asm("CreateNetwork__Q3_2nn3uds4CafeFUcT1UiPCcT3T1PCvT3"); + +/** + * Creates a new network with the given parameters. + * + * \param id8 + * ID8 to be used on the network. Must not be 0xFF. + * + * \param maxNodes + * The maximum amount of nodes that will be able to connect to the network, + * including the host. Must be a number between 2 and 9 inclusively. + * + * \param localCommunicationId + * Local communication ID used for identifying the network. + * + * \param passphrase + * Passphrase to be used for the network. + * + * \param passphraseSize + * Size of the passphrase, including NULL termination. Must be greater than 8 + * characters and lower than 255 characters inclusively. + * + * \param unused + * This parameter is unused. + * + * \param channel + * Channel to use for hosting the network. Use 0 to choose a channel automatically. + * Must be either 0, 1, 6 or 11. + * + * \param appData + * Pointer to application data. + * + * \param appDataSize + * Size of application data. Must be lower than 200 bytes inclusively. + */ +nn::Result +CreateNetwork(uint8_t id8, + uint8_t maxNodes, + uint32_t localCommunicationId, + const char *passphrase, + uint32_t passphraseSize, + bool unused, + uint8_t channel, + const void *appData, + uint32_t appDataSize) + asm("CreateNetwork__Q3_2nn3uds4CafeFUcT1UiPCcT3bT1PCvT3"); + +/** + * Destroys the given endpoint. + * + * \param fd + * The endpoint descriptor. + */ +nn::Result +DestroyEndpoint(EndpointDescriptor *fd) + asm("DestroyEndpoint__Q3_2nn3uds4CafeFPQ4_2nn3uds4Cafe18EndpointDescriptor"); + +/** + * Destroys the previously created network. + */ +nn::Result +DestroyNetwork() + asm("DestroyNetwork__Q3_2nn3uds4CafeFv"); + +/** + * Prevents clients from connecting to the network. + * + * \param unknown + * Triggers an unknown flag. + */ +nn::Result +DisallowToConnect(bool unknown) + asm("DisallowToConnect__Q3_2nn3uds4CafeFb"); + +/** + * Ejects the specified client from the network. + * + * \param networkNodeId + * The network node ID of the client. Use \link UDS_BROADCAST_NODE_ID \endlink to eject all clients. + */ +nn::Result +EjectClient(uint16_t networkNodeId) + asm("EjectClient__Q3_2nn3uds4CafeFUs"); + +/** + * Ejects all spectators from the network. + */ +nn::Result +EjectSpectator() + asm("EjectSpectator__Q3_2nn3uds4CafeFv"); + +/** + * Finalizes UDS. + */ +void +Finalize() + asm("Finalize__Q3_2nn3uds4CafeFv"); + +/** + * Gets the application data from the network. + * + * \param appData + * Buffer where the application data is written. + * + * \param readSize + * Pointer where the size of the application data is written. + * + * \param size + * Size of the buffer. + */ +nn::Result +GetApplicationDataFromBeacon(void *appData, + uint32_t *readSize, + uint32_t size) + asm("GetApplicationDataFromBeacon__Q3_2nn3uds4CafeFPvPUiUi"); + +/** + * Gets the network channel. + * + * \param channel + * Pointer where the channel is written. + */ +nn::Result +GetChannel(uint8_t *channel) + asm("GetChannel__Q3_2nn3uds4CafeFPUc"); + +/** + * Retrieves the connection status of the network. + * + * \param status + * Pointer where the connection status is written. + */ +nn::Result +GetConnectionStatus(ConnectionStatus *status) + asm("GetConnectionStatus__Q3_2nn3uds4CafeFPQ4_2nn3uds4Cafe16ConnectionStatus"); + +/** + * Gets information about a specified node. + * + * \param info + * Output node information. + * + * \param networkNodeId + * The network node ID. + */ +nn::Result +GetNodeInformation(NodeInformation *info, + uint16_t networkNodeId) + asm("GetNodeInformation__Q3_2nn3uds4CafeFPQ4_2nn3uds4Cafe15NodeInformationUs"); + +/** + * Initializes UDS. The username will be set to the Mii name. + * + * \param workMemory + * Pointer to work memory to be used by UDS. + * + * \param workMemorySize + * Size of work memory. See \link kWorkMemorySize \endlink for a recomended amount of memory. + */ +nn::Result +Initialize(void *workMemory, + uint32_t workMemorySize) + asm("Initialize__Q3_2nn3uds4CafeFPvUi"); + +/** + * Initializes UDS with the given username. + * + * \param workMemory + * Pointer to work memory to be used by UDS. + * + * \param workMemorySize + * Size of work memory. See \link kWorkMemorySize \endlink for a recomended amount of memory. + * + * \param username + * The username to be used. If \c NULL, the username will be set to the Mii name. + */ +nn::Result +Initialize(void *workMemory, + uint32_t workMemorySize, + nn::cfg::CTR::UserName *username) + asm("Initialize__Q3_2nn3uds4CafeFPvUiPQ4_2nn3cfg3CTR8UserName"); + +/** + * Checks if new data can be retrieved through \c GetConnectionStatus, + * and waits until new data is available if specified. + * + * \param flags + * Flags, see \link PollStateChangeFlags \endlink for all flags. + */ +nn::Result +PollStateChange(uint8_t flags) + asm("PollStateChange__Q3_2nn3uds4CafeFUc"); + +/** + * Receives data from the specified endpoint. + * + * \param fd + * The endpoint descriptor. + * + * \param buf + * Output buffer where the data will be written. + * + * \param receivedSize + * Pointer where the received size is written. + * + * \param networkNodeId + * Pointer where the incoming node ID is written. + * + * \param size + * Size of the buffer. Must be 4-byte aligned. + * + * \param flags + * Flags, see \link ReceiveFlags \endlink for all flags. + */ +nn::Result +ReceiveFrom(const EndpointDescriptor &fd, + void *buf, + uint32_t *receivedSize, + uint16_t *networkNodeId, + uint32_t size, + uint8_t flags) + asm("ReceiveFrom__Q3_2nn3uds4CafeFRCQ4_2nn3uds4Cafe18EndpointDescriptorPvPUiPUsUiUc"); + +/** + * Receives data from the specified endpoint. + * + * \param fd + * The endpoint descriptor. + * + * \param buf + * Output buffer where the data will be written. + * + * \param receivedSize + * Pointer where the received size is written. + * + * \param size + * Size of the buffer. Must be 4-byte aligned. + * + * \param flags + * Flags, see \link ReceiveFlags \endlink for all flags. + */ +nn::Result +Receive(const EndpointDescriptor &fd, + void *buf, + uint32_t *receivedSize, + uint32_t size, + uint8_t flags) + asm("Receive__Q3_2nn3uds4CafeFRCQ4_2nn3uds4Cafe18EndpointDescriptorPvPUiUiUc"); + +/** + * Sends data to the specified node ID through the given data channel. + * + * \param fd + * THe endpoint descriptor. + * + * \param buf + * Buffer which holds the data to be sent. + * + * \param size + * Size of the buffer. Must be lower or equal than 1478 bytes. + * + * \param destNodeId + * The destination node ID. + * + * \param dataChannel + * The destination data channel. + * + * \param flags + * Unknown flags. + */ +nn::Result +SendTo(const EndpointDescriptor &fd, + const void *buf, + uint32_t size, + uint16_t destNodeId, + uint8_t dataChannel, + uint8_t flags) + asm("SendTo__Q3_2nn3uds4CafeFRCQ4_2nn3uds4Cafe18EndpointDescriptorPCvUiUsUcT5"); + +/** + * Sets the application data to the network. + * + * \param appData + * Application data. + * + * \param size + * Size of application data. Must be lower or equal to 200 bytes. + */ +nn::Result +SetApplicationDataToBeacon(const void *appData, + uint32_t size) + asm("SetApplicationDataToBeacon__Q3_2nn3uds4CafeFPCvUi"); } // namespace Cafe } // namespace uds diff --git a/include/nn/uds/NodeInformation.h b/include/nn/uds/NodeInformation.h index 90bf62f0a..1a83a9af0 100644 --- a/include/nn/uds/NodeInformation.h +++ b/include/nn/uds/NodeInformation.h @@ -1,32 +1,36 @@ #pragma once #include +#include #include #include -#include #ifdef __cplusplus -namespace nn { - -namespace uds { - -namespace Cafe { - //! Stores information about a node - struct WUT_PACKED NodeInformation { - //! The scrambled local friend code of the node - ScrambledLocalFriendCode scrambledLocalFriendCode; - //! The node username - nn::cfg::CTR::UserName username; - //! The network node ID - uint16_t networkNodeId; - //! Unknown - WUT_UNKNOWN_BYTES(0x2); - }; - WUT_CHECK_SIZE(NodeInformation, 0x28); - WUT_CHECK_OFFSET(NodeInformation, 0x00, scrambledLocalFriendCode); - WUT_CHECK_OFFSET(NodeInformation, 0x0C, username); - WUT_CHECK_OFFSET(NodeInformation, 0x24, networkNodeId); +namespace nn +{ + +namespace uds +{ + +namespace Cafe +{ +//! Stores information about a node +struct WUT_PACKED NodeInformation +{ + //! The scrambled local friend code of the node + ScrambledLocalFriendCode scrambledLocalFriendCode; + //! The node username + nn::cfg::CTR::UserName username; + //! The network node ID + uint16_t networkNodeId; + //! Unknown + WUT_UNKNOWN_BYTES(0x2); +}; +WUT_CHECK_SIZE(NodeInformation, 0x28); +WUT_CHECK_OFFSET(NodeInformation, 0x00, scrambledLocalFriendCode); +WUT_CHECK_OFFSET(NodeInformation, 0x0C, username); +WUT_CHECK_OFFSET(NodeInformation, 0x24, networkNodeId); } // namespace Cafe } // namespace uds diff --git a/include/nn/uds/ScrambledLocalFriendCode.h b/include/nn/uds/ScrambledLocalFriendCode.h index 970c26496..ef2026f58 100644 --- a/include/nn/uds/ScrambledLocalFriendCode.h +++ b/include/nn/uds/ScrambledLocalFriendCode.h @@ -5,24 +5,28 @@ #ifdef __cplusplus -namespace nn { - -namespace uds { - -namespace Cafe { - //! Stores data about the scrambled local friend code of a node - struct WUT_PACKED ScrambledLocalFriendCode { - //! The scrambled local friend code. On the Wii U this is always descrambled - uint64_t localFriendCode; - //! The node ID that the local friend code belongs to - uint16_t networkNodeId; - //! The XOR key used for descrambling the local friend code - uint16_t xorKey; - }; - WUT_CHECK_SIZE(ScrambledLocalFriendCode, 0x0C); - WUT_CHECK_OFFSET(ScrambledLocalFriendCode, 0x00, localFriendCode); - WUT_CHECK_OFFSET(ScrambledLocalFriendCode, 0x08, networkNodeId); - WUT_CHECK_OFFSET(ScrambledLocalFriendCode, 0x0A, xorKey); +namespace nn +{ + +namespace uds +{ + +namespace Cafe +{ +//! Stores data about the scrambled local friend code of a node +struct WUT_PACKED ScrambledLocalFriendCode +{ + //! The scrambled local friend code. On the Wii U this is always descrambled + uint64_t localFriendCode; + //! The node ID that the local friend code belongs to + uint16_t networkNodeId; + //! The XOR key used for descrambling the local friend code + uint16_t xorKey; +}; +WUT_CHECK_SIZE(ScrambledLocalFriendCode, 0x0C); +WUT_CHECK_OFFSET(ScrambledLocalFriendCode, 0x00, localFriendCode); +WUT_CHECK_OFFSET(ScrambledLocalFriendCode, 0x08, networkNodeId); +WUT_CHECK_OFFSET(ScrambledLocalFriendCode, 0x0A, xorKey); } // namespace Cafe } // namespace uds diff --git a/include/nsysccr/cdc.h b/include/nsysccr/cdc.h index 0b00a0488..438cd601a 100644 --- a/include/nsysccr/cdc.h +++ b/include/nsysccr/cdc.h @@ -51,26 +51,26 @@ typedef enum CCRCDCDestinationEnum typedef enum CCRCDCWpsStatusEnum { - CCR_CDC_WPS_STATUS_PAIRED = 0, - CCR_CDC_WPS_STATUS_SEARCHING = 1, - CCR_CDC_WPS_STATUS_PAIRING = 2, + CCR_CDC_WPS_STATUS_PAIRED = 0, + CCR_CDC_WPS_STATUS_SEARCHING = 1, + CCR_CDC_WPS_STATUS_PAIRING = 2, } CCRCDCWpsStatusEnum; typedef enum CCRCDCDrcStateEnum { - CCR_CDC_DRC_STATE_ACTIVE = 0, - CCR_CDC_DRC_STATE_PAIRING = 1, - CCR_CDC_DRC_STATE_FWUPDATE = 2, - CCR_CDC_DRC_STATE_STANDALONE = 3, - CCR_CDC_DRC_STATE_BACKGROUND = 4, - CCR_CDC_DRC_STATE_SLEEP = 5, - CCR_CDC_DRC_STATE_STANDBY = 6, - CCR_CDC_DRC_STATE_WOWLSETTING = 7, - CCR_CDC_DRC_STATE_DKSETTING = 8, - CCR_CDC_DRC_STATE_UNKNOWN9 = 9, - CCR_CDC_DRC_STATE_WIIACTIVE = 10, - CCR_CDC_DRC_STATE_LOW_BATTERY = 11, - CCR_CDC_DRC_STATE_SUBACTIVE = 12, + CCR_CDC_DRC_STATE_ACTIVE = 0, + CCR_CDC_DRC_STATE_PAIRING = 1, + CCR_CDC_DRC_STATE_FWUPDATE = 2, + CCR_CDC_DRC_STATE_STANDALONE = 3, + CCR_CDC_DRC_STATE_BACKGROUND = 4, + CCR_CDC_DRC_STATE_SLEEP = 5, + CCR_CDC_DRC_STATE_STANDBY = 6, + CCR_CDC_DRC_STATE_WOWLSETTING = 7, + CCR_CDC_DRC_STATE_DKSETTING = 8, + CCR_CDC_DRC_STATE_UNKNOWN9 = 9, + CCR_CDC_DRC_STATE_WIIACTIVE = 10, + CCR_CDC_DRC_STATE_LOW_BATTERY = 11, + CCR_CDC_DRC_STATE_SUBACTIVE = 12, } CCRCDCDrcStateEnum; typedef enum CCRCDCWakeStateEnum @@ -83,21 +83,21 @@ typedef enum CCRCDCWakeStateEnum typedef enum CCRCDCBoardVersion { - CCR_CDC_BOARD_VERSION_DK1 = 0, - CCR_CDC_BOARD_VERSION_DK1_EP_DK2 = 1, - CCR_CDC_BOARD_VERSION_DP1 = 2, - CCR_CDC_BOARD_VERSION_DP2 = 3, - CCR_CDC_BOARD_VERSION_DK3 = 4, - CCR_CDC_BOARD_VERSION_DK4 = 5, - CCR_CDC_BOARD_VERSION_PREDP3_DP3 = 6, - CCR_CDC_BOARD_VERSION_DK5 = 7, - CCR_CDC_BOARD_VERSION_DP4 = 8, - CCR_CDC_BOARD_VERSION_DKMP = 9, - CCR_CDC_BOARD_VERSION_DP5 = 10, - CCR_CDC_BOARD_VERSION_MASS = 11, - CCR_CDC_BOARD_VERSION_DKMP2 = 12, - CCR_CDC_BOARD_VERSION_DRC_I = 13, - CCR_CDC_BOARD_VERSION_DKTVMP = 14, + CCR_CDC_BOARD_VERSION_DK1 = 0, + CCR_CDC_BOARD_VERSION_DK1_EP_DK2 = 1, + CCR_CDC_BOARD_VERSION_DP1 = 2, + CCR_CDC_BOARD_VERSION_DP2 = 3, + CCR_CDC_BOARD_VERSION_DK3 = 4, + CCR_CDC_BOARD_VERSION_DK4 = 5, + CCR_CDC_BOARD_VERSION_PREDP3_DP3 = 6, + CCR_CDC_BOARD_VERSION_DK5 = 7, + CCR_CDC_BOARD_VERSION_DP4 = 8, + CCR_CDC_BOARD_VERSION_DKMP = 9, + CCR_CDC_BOARD_VERSION_DP5 = 10, + CCR_CDC_BOARD_VERSION_MASS = 11, + CCR_CDC_BOARD_VERSION_DKMP2 = 12, + CCR_CDC_BOARD_VERSION_DRC_I = 13, + CCR_CDC_BOARD_VERSION_DKTVMP = 14, } CCRCDCBoardVersion; typedef enum CCRCDCChipVersion @@ -292,14 +292,16 @@ WUT_CHECK_OFFSET(CCRCDCSoftwareVersion, 0x0, runningVersion); WUT_CHECK_OFFSET(CCRCDCSoftwareVersion, 0x4, activeVersion); WUT_CHECK_SIZE(CCRCDCSoftwareVersion, 0x8); -struct CCRCDCDrcState { +struct CCRCDCDrcState +{ //! Must be one of \link CCRCDCDrcStateEnum \endlink uint8_t state; }; WUT_CHECK_OFFSET(CCRCDCDrcState, 0x0, state); WUT_CHECK_SIZE(CCRCDCDrcState, 0x1); -struct CCRCDCDrhState { +struct CCRCDCDrhState +{ //! Must be one of \link CCRCDCDrhStateEnum \endlink uint8_t state; }; @@ -811,7 +813,7 @@ CCRCDCSoftwareExtUpdate(CCRCDCDestination dest, int32_t CCRCDCRegisterAOAttachCallback(CCRCDCRegisterCallbackFn callback, - void *context); + void *context); int32_t CCRCDCRegisterCFGAttachCallback(CCRCDCRegisterCallbackFn callback, @@ -835,7 +837,7 @@ CCRCDCRegisterUVCAttachCallback(CCRCDCRegisterCallbackFn callback, int32_t CCRCDCRegisterVOAttachCallback(CCRCDCRegisterCallbackFn callback, - void *context); + void *context); #ifdef __cplusplus } diff --git a/include/nsysccr/irda.h b/include/nsysccr/irda.h index 240c278bf..c3f9b81f2 100644 --- a/include/nsysccr/irda.h +++ b/include/nsysccr/irda.h @@ -33,59 +33,59 @@ typedef struct CCRCDCIrdaLargePacketHeader CCRCDCIrdaLargePacketHeader; typedef enum { //! Initiate a new connection - CCR_IRDA_COMMAND_CONNECT = 0, + CCR_IRDA_COMMAND_CONNECT = 0, //! Send data - CCR_IRDA_COMMAND_SEND = 1, + CCR_IRDA_COMMAND_SEND = 1, //! Receive data - CCR_IRDA_COMMAND_RECEIVE = 2, + CCR_IRDA_COMMAND_RECEIVE = 2, //! Disconnect - CCR_IRDA_COMMAND_DISCONNECT = 3, + CCR_IRDA_COMMAND_DISCONNECT = 3, } CCRCDCIrdaCommandEnum; typedef enum { //! 115200 bits-per-second - CCR_IRDA_BITRATE_115200 = 0, + CCR_IRDA_BITRATE_115200 = 0, //! 96000 bits-per-second - CCR_IRDA_BITRATE_96000 = 1, + CCR_IRDA_BITRATE_96000 = 1, //! 72000 bits-per-second - CCR_IRDA_BITRATE_72000 = 2, + CCR_IRDA_BITRATE_72000 = 2, //! 57600 bits-per-second - CCR_IRDA_BITRATE_57600 = 3, + CCR_IRDA_BITRATE_57600 = 3, //! 48000 bits-per-second - CCR_IRDA_BITRATE_48000 = 4, + CCR_IRDA_BITRATE_48000 = 4, //! 38400 bits-per-second - CCR_IRDA_BITRATE_38400 = 5, + CCR_IRDA_BITRATE_38400 = 5, //! 36000 bits-per-second - CCR_IRDA_BITRATE_36000 = 6, + CCR_IRDA_BITRATE_36000 = 6, //! 24000 bits-per-second - CCR_IRDA_BITRATE_24000 = 7, + CCR_IRDA_BITRATE_24000 = 7, //! 19200 bits-per-second - CCR_IRDA_BITRATE_19200 = 8, + CCR_IRDA_BITRATE_19200 = 8, //! 18000 bits-per-second - CCR_IRDA_BITRATE_18000 = 9, + CCR_IRDA_BITRATE_18000 = 9, //! 12000 bits-per-second - CCR_IRDA_BITRATE_12000 = 10, + CCR_IRDA_BITRATE_12000 = 10, //! 9600 bits-per-second - CCR_IRDA_BITRATE_9600 = 11, + CCR_IRDA_BITRATE_9600 = 11, //! 7200 bits-per-second - CCR_IRDA_BITRATE_7200 = 13, + CCR_IRDA_BITRATE_7200 = 13, //! 6000 bits-per-second - CCR_IRDA_BITRATE_6000 = 13, + CCR_IRDA_BITRATE_6000 = 13, //! 4800 bits-per-second - CCR_IRDA_BITRATE_4800 = 14, + CCR_IRDA_BITRATE_4800 = 14, //! 3000 bits-per-second - CCR_IRDA_BITRATE_3000 = 15, + CCR_IRDA_BITRATE_3000 = 15, } CCRCDCIrdaBitrateEnum; typedef enum { //! Wait for another device to start a connection - CCR_IRDA_CONNECTION_WAIT = 0, + CCR_IRDA_CONNECTION_WAIT = 0, //! Initiate a new connection - CCR_IRDA_CONNECTION_REQUIRE = 1, + CCR_IRDA_CONNECTION_REQUIRE = 1, //! Don't require a connection - CCR_IRDA_CONNECTION_ANY = 2, + CCR_IRDA_CONNECTION_ANY = 2, } CCRCDCIrdaConnectionTypeEnum; struct WUT_PACKED CCRCDCIrdaConnectRequest @@ -244,7 +244,7 @@ int32_t CCRCDCPerIrdaControl(CCRCDCDestination dest, void *request, uint32_t requestSize, - void *response, + void *response, uint32_t responseSize); #ifdef __cplusplus diff --git a/include/nsyshid/hid.h b/include/nsyshid/hid.h index c0567ddcf..19ca673f7 100644 --- a/include/nsyshid/hid.h +++ b/include/nsyshid/hid.h @@ -19,17 +19,15 @@ typedef enum HIDAttachEvent HID_DEVICE_ATTACH = 1, } HIDAttachEvent; -typedef int32_t -(*HIDAttachCallback)(HIDClient *client, - HIDDevice *device, - HIDAttachEvent attach); - -typedef void -(*HIDCallback)(uint32_t handle, - int32_t error, - uint8_t *buffer, - uint32_t bytesTransferred, - void *userContext); +typedef int32_t (*HIDAttachCallback)(HIDClient *client, + HIDDevice *device, + HIDAttachEvent attach); + +typedef void (*HIDCallback)(uint32_t handle, + int32_t error, + uint8_t *buffer, + uint32_t bytesTransferred, + void *userContext); struct HIDDevice { @@ -120,7 +118,7 @@ int32_t HIDGetIdle(uint32_t handle, uint8_t interfaceIndex, uint8_t reportId, - uint8_t* duration, + uint8_t *duration, HIDCallback callback, void *userContext); diff --git a/include/nsyskbd/nsyskbd.h b/include/nsyskbd/nsyskbd.h index b49194b44..970418648 100644 --- a/include/nsyskbd/nsyskbd.h +++ b/include/nsyskbd/nsyskbd.h @@ -6,21 +6,23 @@ extern "C" { #endif -typedef struct WUT_PACKED KBDAttachEvent { - uint8_t channel; - WUT_PADDING_BYTES(3); +typedef struct WUT_PACKED KBDAttachEvent +{ + uint8_t channel; + WUT_PADDING_BYTES(3); } KBDAttachEvent; WUT_CHECK_OFFSET(KBDAttachEvent, 0x00, channel); WUT_CHECK_SIZE(KBDAttachEvent, 0x04); -typedef struct WUT_PACKED KBDKeyEvent { - uint8_t channel; - uint8_t hidCode; - WUT_PADDING_BYTES(2); - BOOL isPressedDown; - WUT_UNKNOWN_BYTES(4); - uint16_t asUTF16Character; - WUT_PADDING_BYTES(2); +typedef struct WUT_PACKED KBDKeyEvent +{ + uint8_t channel; + uint8_t hidCode; + WUT_PADDING_BYTES(2); + BOOL isPressedDown; + WUT_UNKNOWN_BYTES(4); + uint16_t asUTF16Character; + WUT_PADDING_BYTES(2); } KBDKeyEvent; WUT_CHECK_OFFSET(KBDKeyEvent, 0x00, channel); WUT_CHECK_OFFSET(KBDKeyEvent, 0x01, hidCode); @@ -32,33 +34,35 @@ typedef void (*KDBAttachCallback)(KBDAttachEvent *channel); typedef void (*KDBKeyCallback)(KBDKeyEvent *event); -typedef enum KDBCountry { - KDB_COUNTRY_UNKNOWN_0 = 0, - KDB_COUNTRY_UNKNOWN_1 = 1, - KDB_COUNTRY_UNKNOWN_2 = 2, - KDB_COUNTRY_UNKNOWN_3 = 3, - KDB_COUNTRY_UNKNOWN_4 = 4, - KDB_COUNTRY_UNKNOWN_5 = 5, - KDB_COUNTRY_UNKNOWN_6 = 6, - KDB_COUNTRY_UNKNOWN_7 = 7, - KDB_COUNTRY_UNKNOWN_8 = 8, - KDB_COUNTRY_UNKNOWN_9 = 9, - KDB_COUNTRY_UNKNOWN_10 = 10, - KDB_COUNTRY_UNKNOWN_11 = 11, - KDB_COUNTRY_UNKNOWN_12 = 12, - KDB_COUNTRY_UNKNOWN_13 = 13, - KDB_COUNTRY_UNKNOWN_14 = 14, - KDB_COUNTRY_UNKNOWN_15 = 15, - KDB_COUNTRY_UNKNOWN_16 = 16, - KDB_COUNTRY_UNKNOWN_17 = 17, - KDB_COUNTRY_UNKNOWN_18 = 18, +typedef enum KDBCountry +{ + KDB_COUNTRY_UNKNOWN_0 = 0, + KDB_COUNTRY_UNKNOWN_1 = 1, + KDB_COUNTRY_UNKNOWN_2 = 2, + KDB_COUNTRY_UNKNOWN_3 = 3, + KDB_COUNTRY_UNKNOWN_4 = 4, + KDB_COUNTRY_UNKNOWN_5 = 5, + KDB_COUNTRY_UNKNOWN_6 = 6, + KDB_COUNTRY_UNKNOWN_7 = 7, + KDB_COUNTRY_UNKNOWN_8 = 8, + KDB_COUNTRY_UNKNOWN_9 = 9, + KDB_COUNTRY_UNKNOWN_10 = 10, + KDB_COUNTRY_UNKNOWN_11 = 11, + KDB_COUNTRY_UNKNOWN_12 = 12, + KDB_COUNTRY_UNKNOWN_13 = 13, + KDB_COUNTRY_UNKNOWN_14 = 14, + KDB_COUNTRY_UNKNOWN_15 = 15, + KDB_COUNTRY_UNKNOWN_16 = 16, + KDB_COUNTRY_UNKNOWN_17 = 17, + KDB_COUNTRY_UNKNOWN_18 = 18, } KDBCountry; -typedef enum KDBError { - KDB_ERROR_NONE = 0, - KDB_ERROR_NOT_INITIALIZED = 2, - KDB_ERROR_ALREADY_INITIALIZED = 3, - KDB_ERROR_INVALID_COUNTRY = 4, +typedef enum KDBError +{ + KDB_ERROR_NONE = 0, + KDB_ERROR_NOT_INITIALIZED = 2, + KDB_ERROR_ALREADY_INITIALIZED = 3, + KDB_ERROR_INVALID_COUNTRY = 4, } KDBError; KDBError diff --git a/include/nsysnet/_socket.h b/include/nsysnet/_socket.h index cde9cf701..cf964fb91 100644 --- a/include/nsysnet/_socket.h +++ b/include/nsysnet/_socket.h @@ -1,12 +1,12 @@ #pragma once #include #include +#include +#include #include +#include #include #include -#include -#include -#include /** * \defgroup nsysnet_socket Socket @@ -20,7 +20,7 @@ extern "C" { /* * fd_set for select() */ -#define NSYSNET_FD_SETSIZE 32 +#define NSYSNET_FD_SETSIZE 32 #define NSYSNET_FD_SET(n, p) ((p)->fds_bits |= (1L << (n))) #define NSYSNET_FD_CLR(n, p) ((p)->fds_bits &= ~(1L << (n))) @@ -32,13 +32,13 @@ typedef struct nsysnet_fd_set nsysnet_fd_set; struct nsysnet_fd_set { - nsysnet_fd_mask fds_bits; + nsysnet_fd_mask fds_bits; }; struct nsysnet_timeval { - long tv_sec; - long tv_usec; + long tv_sec; + long tv_usec; }; void diff --git a/include/nsysnet/netconfig.h b/include/nsysnet/netconfig.h index 1e5b83d97..c15a31941 100644 --- a/include/nsysnet/netconfig.h +++ b/include/nsysnet/netconfig.h @@ -1,12 +1,12 @@ #pragma once #include +#include +#include #include +#include #include #include -#include -#include -#include /** * \defgroup nsysnet_netconfig @@ -43,163 +43,186 @@ typedef struct NetConfWifiConfigDataPrivacy NetConfWifiConfigDataPrivacy; typedef struct NetConfInterface NetConfInterface; typedef struct NetConfIfState NetConfIfState; -typedef enum NetConfInterfaceTypeEnum { - NET_CONF_INTERFACE_TYPE_WIFI = 0, - NET_CONF_INTERFACE_TYPE_ETHERNET = 1, +typedef enum NetConfInterfaceTypeEnum +{ + NET_CONF_INTERFACE_TYPE_WIFI = 0, + NET_CONF_INTERFACE_TYPE_ETHERNET = 1, } NetConfInterfaceTypeEnum; -typedef enum NetConfEthCfgSpeedEnum { - NET_CONF_ETH_CFG_SPEED_10M = 10, - NET_CONF_ETH_CFG_SPEED_100M = 100, +typedef enum NetConfEthCfgSpeedEnum +{ + NET_CONF_ETH_CFG_SPEED_10M = 10, + NET_CONF_ETH_CFG_SPEED_100M = 100, } NetConfEthCfgSpeedEnum; -typedef enum NetConfEthCfgDuplexEnum { - NET_CONF_ETH_CFG_DUPLEX_HALF = 1, - NET_CONF_ETH_CFG_DUPLEX_FULL = 2, +typedef enum NetConfEthCfgDuplexEnum +{ + NET_CONF_ETH_CFG_DUPLEX_HALF = 1, + NET_CONF_ETH_CFG_DUPLEX_FULL = 2, } NetConfEthCfgDuplexEnum; -typedef enum NetConfEthCfgNegotiationEnum { - NET_CONF_ETH_CFG_NEGOTIATION_MANUAL = 1, - NET_CONF_ETH_CFG_NEGOTIATION_AUTO = 2, +typedef enum NetConfEthCfgNegotiationEnum +{ + NET_CONF_ETH_CFG_NEGOTIATION_MANUAL = 1, + NET_CONF_ETH_CFG_NEGOTIATION_AUTO = 2, } NetConfEthCfgNegotiationEnum; -typedef enum NetConfIPv4Mode { - NET_CONF_IPV4_MODE_DHCP = 0, - NET_CONF_IPV4_MODE_MANUAL = 2, +typedef enum NetConfIPv4Mode +{ + NET_CONF_IPV4_MODE_DHCP = 0, + NET_CONF_IPV4_MODE_MANUAL = 2, } NetConfIPv4Mode; -typedef enum NetConfWifiPrivacyModeEnum { - NET_CONF_WIFI_PRIVACY_MODE_NONE = 0, - NET_CONF_WIFI_PRIVACY_MODE_WEP = 1, - NET_CONF_WIFI_PRIVACY_MODE_WPA2_PSK_TKIP = 3, - NET_CONF_WIFI_PRIVACY_MODE_WPA_PSK_TKIP = 4, - NET_CONF_WIFI_PRIVACY_MODE_WPA2_PSK_AES = 5, - NET_CONF_WIFI_PRIVACY_MODE_WPA_PSK_AES = 6, +typedef enum NetConfWifiPrivacyModeEnum +{ + NET_CONF_WIFI_PRIVACY_MODE_NONE = 0, + NET_CONF_WIFI_PRIVACY_MODE_WEP = 1, + NET_CONF_WIFI_PRIVACY_MODE_WPA2_PSK_TKIP = 3, + NET_CONF_WIFI_PRIVACY_MODE_WPA_PSK_TKIP = 4, + NET_CONF_WIFI_PRIVACY_MODE_WPA2_PSK_AES = 5, + NET_CONF_WIFI_PRIVACY_MODE_WPA_PSK_AES = 6, } NetConfWifiPrivacyModeEnum; -typedef enum NetConfProxyAuthTypeEnum { - NET_CONF_PROXY_AUTH_TYPE_NONE = 0, - NET_CONF_PROXY_AUTH_TYPE_BASIC_AUTHENTICATION = 1, +typedef enum NetConfProxyAuthTypeEnum +{ + NET_CONF_PROXY_AUTH_TYPE_NONE = 0, + NET_CONF_PROXY_AUTH_TYPE_BASIC_AUTHENTICATION = 1, } NetConfProxyAuthTypeEnum; -typedef enum NetConfProxyStatusEnum { - NET_CONF_PROXY_DISABLED = 0, - NET_CONF_PROXY_ENABLED = 1, +typedef enum NetConfProxyStatusEnum +{ + NET_CONF_PROXY_DISABLED = 0, + NET_CONF_PROXY_ENABLED = 1, } NetConfProxyStatusEnum; -typedef enum NetConfLinkStateEnum { - NET_CONF_LINK_STATE_UP = 1, - NET_CONF_LINK_STATE_DOWN = 2, - NET_CONF_LINK_STATE_NEGOTIATE = 3, +typedef enum NetConfLinkStateEnum +{ + NET_CONF_LINK_STATE_UP = 1, + NET_CONF_LINK_STATE_DOWN = 2, + NET_CONF_LINK_STATE_NEGOTIATE = 3, } NetConfLinkStateEnum; -typedef enum NetConfOperStateEnum { - NET_CONF_OPER_STATE_UP = 1, - NET_CONF_OPER_STATE_DOWN = 2, +typedef enum NetConfOperStateEnum +{ + NET_CONF_OPER_STATE_UP = 1, + NET_CONF_OPER_STATE_DOWN = 2, } NetConfOperStateEnum; -typedef enum NetConfAdminStateEnum { - NET_CONF_ADMIN_STATE_UP = 1, - NET_CONF_ADMIN_STATE_DOWN = 2, +typedef enum NetConfAdminStateEnum +{ + NET_CONF_ADMIN_STATE_UP = 1, + NET_CONF_ADMIN_STATE_DOWN = 2, } NetConfAdminStateEnum; -typedef enum NetConfProfile { - NET_CONF_PROFILE_0 = 0, - NET_CONF_PROFILE_1 = 1, - NET_CONF_PROFILE_2 = 2, - NET_CONF_PROFILE_3 = 3, - NET_CONF_PROFILE_4 = 4, - NET_CONF_PROFILE_5 = 5, +typedef enum NetConfProfile +{ + NET_CONF_PROFILE_0 = 0, + NET_CONF_PROFILE_1 = 1, + NET_CONF_PROFILE_2 = 2, + NET_CONF_PROFILE_3 = 3, + NET_CONF_PROFILE_4 = 4, + NET_CONF_PROFILE_5 = 5, } NetConfProfile; -struct NetConfAllProfileState { - WUT_UNKNOWN_BYTES(0x18); +struct NetConfAllProfileState +{ + WUT_UNKNOWN_BYTES(0x18); }; WUT_CHECK_SIZE(NetConfAllProfileState, 0x18); -struct WUT_PACKED NetConfEthCfg { - NetConfEthCfgSpeed speed; - NetConfEthCfgDuplex duplex; - NetConfEthCfgNegotiation negotiation; - WUT_PADDING_BYTES(2); +struct WUT_PACKED NetConfEthCfg +{ + NetConfEthCfgSpeed speed; + NetConfEthCfgDuplex duplex; + NetConfEthCfgNegotiation negotiation; + WUT_PADDING_BYTES(2); }; WUT_CHECK_OFFSET(NetConfEthCfg, 0x00, speed); WUT_CHECK_OFFSET(NetConfEthCfg, 0x02, duplex); WUT_CHECK_OFFSET(NetConfEthCfg, 0x04, negotiation); WUT_CHECK_SIZE(NetConfEthCfg, 0x8); -struct NetConfIPv4Info { - NetConfIPv4Mode mode; - uint32_t addr; - uint32_t netmask; - uint32_t nexthop; // gateway - uint32_t ns1; // dns 1 - uint32_t ns2; // dns 2 +struct NetConfIPv4Info +{ + NetConfIPv4Mode mode; + uint32_t addr; + uint32_t netmask; + uint32_t nexthop; // gateway + uint32_t ns1; // dns 1 + uint32_t ns2; // dns 2 }; WUT_CHECK_SIZE(NetConfIPv4Info, 0x18); -struct NetConfMACAddr { - uint8_t MACAddr[0x6]; +struct NetConfMACAddr +{ + uint8_t MACAddr[0x6]; }; WUT_CHECK_SIZE(NetConfMACAddr, 0x6); -struct NetConfProxyConfig { - NetConfProxyStatus use_proxy; // true/false - uint16_t port; - WUT_UNKNOWN_BYTES(0x02); - NetConfProxyAuthType auth_type; - char host[0x80]; - char username[0x80]; // only 0x20 bytes usable - char password[0x40]; // only 0x20 bytes usable - char noproxy_hosts[0x80]; // not used +struct NetConfProxyConfig +{ + NetConfProxyStatus use_proxy; // true/false + uint16_t port; + WUT_UNKNOWN_BYTES(0x02); + NetConfProxyAuthType auth_type; + char host[0x80]; + char username[0x80]; // only 0x20 bytes usable + char password[0x40]; // only 0x20 bytes usable + char noproxy_hosts[0x80]; // not used }; WUT_CHECK_SIZE(NetConfProxyConfig, 0x1c8); -struct NetConfValidFlags { - WUT_UNKNOWN_BYTES(0x18); +struct NetConfValidFlags +{ + WUT_UNKNOWN_BYTES(0x18); }; WUT_CHECK_SIZE(NetConfValidFlags, 0x18); -struct WUT_PACKED NetConfWifiConfigDataPrivacy { - NetConfWifiPrivacyMode mode; - WUT_PADDING_BYTES(2); - uint16_t aes_key_len; - uint8_t aes_key[0x40]; - WUT_PADDING_BYTES(2); +struct WUT_PACKED NetConfWifiConfigDataPrivacy +{ + NetConfWifiPrivacyMode mode; + WUT_PADDING_BYTES(2); + uint16_t aes_key_len; + uint8_t aes_key[0x40]; + WUT_PADDING_BYTES(2); }; WUT_CHECK_OFFSET(NetConfWifiConfigDataPrivacy, 0x00, mode); WUT_CHECK_OFFSET(NetConfWifiConfigDataPrivacy, 0x04, aes_key_len); WUT_CHECK_OFFSET(NetConfWifiConfigDataPrivacy, 0x06, aes_key); WUT_CHECK_SIZE(NetConfWifiConfigDataPrivacy, 0x48); -struct WUT_PACKED NetConfWifiConfigData { - char ssid[0x20]; - uint16_t ssidlength; - WUT_PADDING_BYTES(2); - NetConfWifiConfigDataPrivacy privacy; +struct WUT_PACKED NetConfWifiConfigData +{ + char ssid[0x20]; + uint16_t ssidlength; + WUT_PADDING_BYTES(2); + NetConfWifiConfigDataPrivacy privacy; }; WUT_CHECK_OFFSET(NetConfWifiConfigData, 0x00, ssid); WUT_CHECK_OFFSET(NetConfWifiConfigData, 0x20, ssidlength); WUT_CHECK_OFFSET(NetConfWifiConfigData, 0x24, privacy); WUT_CHECK_SIZE(NetConfWifiConfigData, 0x6C); -struct NetConfWifiConfig { - uint16_t config_method; - WUT_PADDING_BYTES(2); - NetConfWifiConfigData config; +struct NetConfWifiConfig +{ + uint16_t config_method; + WUT_PADDING_BYTES(2); + NetConfWifiConfigData config; }; WUT_CHECK_SIZE(NetConfWifiConfig, 0x70); -struct NetConfOpt { - WUT_UNKNOWN_BYTES(0x2c1); +struct NetConfOpt +{ + WUT_UNKNOWN_BYTES(0x2c1); }; WUT_CHECK_SIZE(NetConfOpt, 0x2c1); -struct WUT_PACKED NetConfInterface { - uint16_t if_index; - uint16_t if_state; - uint32_t if_mtu; - NetConfIPv4Info ipv4Info; +struct WUT_PACKED NetConfInterface +{ + uint16_t if_index; + uint16_t if_state; + uint32_t if_mtu; + NetConfIPv4Info ipv4Info; }; WUT_CHECK_OFFSET(NetConfInterface, 0x00, if_index); WUT_CHECK_OFFSET(NetConfInterface, 0x02, if_state); @@ -207,12 +230,13 @@ WUT_CHECK_OFFSET(NetConfInterface, 0x04, if_mtu); WUT_CHECK_OFFSET(NetConfInterface, 0x08, ipv4Info); WUT_CHECK_SIZE(NetConfInterface, 0x20); -struct NetConfCfg { - NetConfInterface wl0; - NetConfWifiConfig wifi; - NetConfInterface eth0; - NetConfEthCfg ethCfg; - NetConfProxyConfig proxy; +struct NetConfCfg +{ + NetConfInterface wl0; + NetConfWifiConfig wifi; + NetConfInterface eth0; + NetConfEthCfg ethCfg; + NetConfProxyConfig proxy; }; WUT_CHECK_OFFSET(NetConfCfg, 0x0, wl0); WUT_CHECK_OFFSET(NetConfCfg, 0x20, wifi); @@ -221,16 +245,18 @@ WUT_CHECK_OFFSET(NetConfCfg, 0xB0, ethCfg); WUT_CHECK_OFFSET(NetConfCfg, 0xB8, proxy); WUT_CHECK_SIZE(NetConfCfg, 0x280); -struct WUT_PACKED NetConfAOSSConfig { - NetConfWifiConfigData config[4]; +struct WUT_PACKED NetConfAOSSConfig +{ + NetConfWifiConfigData config[4]; }; WUT_CHECK_SIZE(NetConfAOSSConfig, 0x1b0); -struct NetConfIfState { - uint16_t if_state; - NetConfLinkState linkstate; - NetConfOperState operstate; - WUT_PADDING_BYTES(2); +struct NetConfIfState +{ + uint16_t if_state; + NetConfLinkState linkstate; + NetConfOperState operstate; + WUT_PADDING_BYTES(2); }; WUT_CHECK_SIZE(NetConfIfState, 0x8); diff --git a/include/nsysnet/nssl.h b/include/nsysnet/nssl.h index ebc6eaacb..32479f21e 100644 --- a/include/nsysnet/nssl.h +++ b/include/nsysnet/nssl.h @@ -36,57 +36,57 @@ typedef int32_t NSSLConnectionHandle; */ typedef enum NSSLErrors { - NSSL_ERROR_OK = 0x0, - NSSL_ERROR_GENERIC = -0x1, - NSSL_ERROR_INVALID_NSSL_CONTEXT = -0x280001, - NSSL_ERROR_INVALID_CERT_ID = -0x280002, - NSSL_ERROR_CERT_LIMIT = -0x280003, - NSSL_ERROR_INVALID_NSSL_CONNECTION = -0x280004, - NSSL_ERROR_INVALID_CERT = -0x280005, - NSSL_ERROR_ZERO_RETURN = -0x280006, - NSSL_ERROR_WANT_READ = -0x280007, - NSSL_ERROR_WANT_WRITE = -0x280008, - NSSL_ERROR_IO_ERROR = -0x280009, - NSSL_ERROR_NSSL_LIB_ERROR = -0x28000a, - NSSL_ERROR_UNKNOWN = -0x28000b, - NSSL_ERROR_OUT_OF_MEMORY = -0x28000c, - NSSL_ERROR_INVALID_STATE = -0x28000d, - NSSL_ERROR_HANDSHAKE_ERROR = -0x28000e, - NSSL_ERROR_NO_CERT = -0x28000f, - NSSL_ERROR_INVALID_FD = -0x280010, - NSSL_ERROR_LIB_NOT_READY = -0x280011, - NSSL_ERROR_IPC_ERROR = -0x280012, - NSSL_ERROR_RESOURCE_LIMIT = -0x280013, - NSSL_ERROR_INVALID_HANDLE = -0x280014, - NSSL_ERROR_INVALID_CERT_TYPE = -0x280015, - NSSL_ERROR_INVALID_KEY_TYPE = -0x280016, - NSSL_ERROR_INVALID_SIZE = -0x280017, - NSSL_ERROR_NO_PEER_CERT = -0x280018, - NSSL_ERROR_INSUFFICIENT_SIZE = -0x280019, - NSSL_ERROR_NO_CIPHER = -0x28001a, - NSSL_ERROR_INVALID_ARG = -0x28001b, - NSSL_ERROR_INVALID_NSSL_SESSION = -0x28001c, - NSSL_ERROR_NO_SESSION = -0x28001d, - NSSL_ERROR_SSL_SHUTDOWN_ERROR = -0x28001e, - NSSL_ERROR_CERT_SIZE_LIMIT = -0x28001f, - NSSL_ERROR_CERT_NO_ACCESS = -0x280020, - NSSL_ERROR_INVALID_CERT_ID2 = -0x280021, - NSSL_ERROR_CERT_READ_ERROR = -0x280022, - NSSL_ERROR_CERT_STORE_INIT_FAILURE = -0x280023, - NSSL_ERROR_INVALID_CERT_ENCODING = -0x280024, - NSSL_ERROR_CERT_STORE_ERROR = -0x280025, - NSSL_ERROR_PRIVATE_KEY_READ_ERROR = -0x280026, - NSSL_ERROR_INVALID_PRIVATE_KEY = -0x280027, - NSSL_ERROR_NOT_READY = -0x280028, - NSSL_ERROR_ENCRYPTION_ERROR = -0x280029, - NSSL_ERROR_NO_CERT_STORE = -0x28002a, - NSSL_ERROR_PRIVATE_KEY_SIZE_LIMIT = -0x28002b, - NSSL_ERROR_PROCESS_MAX_EXT_CERTS = -0x28002c, - NSSL_ERROR_PROCESS_MAX_CONTEXTS = -0x28002d, - NSSL_ERROR_PROCESS_MAX_CONNECTIONS = -0x28002e, - NSSL_ERROR_CERT_NOT_EXPORTABLE = -0x28002f, - NSSL_ERROR_INVALID_CERT_SIZE = -0x280030, - NSSL_ERROR_INVALID_KEY_SIZE = -0x280031, + NSSL_ERROR_OK = 0x0, + NSSL_ERROR_GENERIC = -0x1, + NSSL_ERROR_INVALID_NSSL_CONTEXT = -0x280001, + NSSL_ERROR_INVALID_CERT_ID = -0x280002, + NSSL_ERROR_CERT_LIMIT = -0x280003, + NSSL_ERROR_INVALID_NSSL_CONNECTION = -0x280004, + NSSL_ERROR_INVALID_CERT = -0x280005, + NSSL_ERROR_ZERO_RETURN = -0x280006, + NSSL_ERROR_WANT_READ = -0x280007, + NSSL_ERROR_WANT_WRITE = -0x280008, + NSSL_ERROR_IO_ERROR = -0x280009, + NSSL_ERROR_NSSL_LIB_ERROR = -0x28000a, + NSSL_ERROR_UNKNOWN = -0x28000b, + NSSL_ERROR_OUT_OF_MEMORY = -0x28000c, + NSSL_ERROR_INVALID_STATE = -0x28000d, + NSSL_ERROR_HANDSHAKE_ERROR = -0x28000e, + NSSL_ERROR_NO_CERT = -0x28000f, + NSSL_ERROR_INVALID_FD = -0x280010, + NSSL_ERROR_LIB_NOT_READY = -0x280011, + NSSL_ERROR_IPC_ERROR = -0x280012, + NSSL_ERROR_RESOURCE_LIMIT = -0x280013, + NSSL_ERROR_INVALID_HANDLE = -0x280014, + NSSL_ERROR_INVALID_CERT_TYPE = -0x280015, + NSSL_ERROR_INVALID_KEY_TYPE = -0x280016, + NSSL_ERROR_INVALID_SIZE = -0x280017, + NSSL_ERROR_NO_PEER_CERT = -0x280018, + NSSL_ERROR_INSUFFICIENT_SIZE = -0x280019, + NSSL_ERROR_NO_CIPHER = -0x28001a, + NSSL_ERROR_INVALID_ARG = -0x28001b, + NSSL_ERROR_INVALID_NSSL_SESSION = -0x28001c, + NSSL_ERROR_NO_SESSION = -0x28001d, + NSSL_ERROR_SSL_SHUTDOWN_ERROR = -0x28001e, + NSSL_ERROR_CERT_SIZE_LIMIT = -0x28001f, + NSSL_ERROR_CERT_NO_ACCESS = -0x280020, + NSSL_ERROR_INVALID_CERT_ID2 = -0x280021, + NSSL_ERROR_CERT_READ_ERROR = -0x280022, + NSSL_ERROR_CERT_STORE_INIT_FAILURE = -0x280023, + NSSL_ERROR_INVALID_CERT_ENCODING = -0x280024, + NSSL_ERROR_CERT_STORE_ERROR = -0x280025, + NSSL_ERROR_PRIVATE_KEY_READ_ERROR = -0x280026, + NSSL_ERROR_INVALID_PRIVATE_KEY = -0x280027, + NSSL_ERROR_NOT_READY = -0x280028, + NSSL_ERROR_ENCRYPTION_ERROR = -0x280029, + NSSL_ERROR_NO_CERT_STORE = -0x28002a, + NSSL_ERROR_PRIVATE_KEY_SIZE_LIMIT = -0x28002b, + NSSL_ERROR_PROCESS_MAX_EXT_CERTS = -0x28002c, + NSSL_ERROR_PROCESS_MAX_CONTEXTS = -0x28002d, + NSSL_ERROR_PROCESS_MAX_CONNECTIONS = -0x28002e, + NSSL_ERROR_CERT_NOT_EXPORTABLE = -0x28002f, + NSSL_ERROR_INVALID_CERT_SIZE = -0x280030, + NSSL_ERROR_INVALID_KEY_SIZE = -0x280031, } NSSLErrors; /** @@ -102,143 +102,143 @@ typedef enum NSSLErrors */ typedef enum NSSLServerCertId { - //! Represents the first certificate in the Nintendo CA group. - NSSL_SERVER_CERT_GROUP_NINTENDO_FIRST = 100, - //! Nintendo CA - //! (SHA1: B5 22 94 55 DD 26 C1 F5 3C 73 06 0E 90 89 B3 91 38 9E 1F 75) - NSSL_SERVER_CERT_NINTENDO_CA = 100, - //! Nintendo CA - G2 - //! (SHA1: C6 0B 2A 5C C9 0F 06 30 CC A3 30 40 DF 6B 33 78 23 9F 3B FA) - NSSL_SERVER_CERT_NINTENDO_CA_G2 = 101, - //! Nintendo CA - G3 - //! (SHA1: 68 A0 77 05 CC C7 A4 08 41 6E 0E D7 AD 65 F2 EC 3F EA 98 62) - NSSL_SERVER_CERT_NINTENDO_CA_G3 = 102, - //! Nintendo Class 2 CA - //! (SHA1: AA 8E F6 6A E0 F8 07 ED B8 41 C8 89 EE 36 66 A2 59 A2 8C CC) - NSSL_SERVER_CERT_NINTENDO_CLASS2_CA = 103, - //! Nintendo Class 2 CA - G2 - //! (SHA1: 03 9D E5 37 3A C6 5E 1A EE 89 8D 54 E7 56 35 76 EB BE 54 9B) - NSSL_SERVER_CERT_NINTENDO_CLASS2_CA_G2 = 104, - //! Nintendo Class 2 CA - G3 - //! (SHA1: FA B5 6C 4C C7 CF F5 07 1D 40 B6 B0 07 38 61 D2 90 CA 2A 1A) - NSSL_SERVER_CERT_NINTENDO_CLASS2_CA_G3 = 105, - //! Represents the last certificate in the Nintendo CA group. - NSSL_SERVER_CERT_GROUP_NINTENDO_LAST = 105, + //! Represents the first certificate in the Nintendo CA group. + NSSL_SERVER_CERT_GROUP_NINTENDO_FIRST = 100, + //! Nintendo CA + //! (SHA1: B5 22 94 55 DD 26 C1 F5 3C 73 06 0E 90 89 B3 91 38 9E 1F 75) + NSSL_SERVER_CERT_NINTENDO_CA = 100, + //! Nintendo CA - G2 + //! (SHA1: C6 0B 2A 5C C9 0F 06 30 CC A3 30 40 DF 6B 33 78 23 9F 3B FA) + NSSL_SERVER_CERT_NINTENDO_CA_G2 = 101, + //! Nintendo CA - G3 + //! (SHA1: 68 A0 77 05 CC C7 A4 08 41 6E 0E D7 AD 65 F2 EC 3F EA 98 62) + NSSL_SERVER_CERT_NINTENDO_CA_G3 = 102, + //! Nintendo Class 2 CA + //! (SHA1: AA 8E F6 6A E0 F8 07 ED B8 41 C8 89 EE 36 66 A2 59 A2 8C CC) + NSSL_SERVER_CERT_NINTENDO_CLASS2_CA = 103, + //! Nintendo Class 2 CA - G2 + //! (SHA1: 03 9D E5 37 3A C6 5E 1A EE 89 8D 54 E7 56 35 76 EB BE 54 9B) + NSSL_SERVER_CERT_NINTENDO_CLASS2_CA_G2 = 104, + //! Nintendo Class 2 CA - G3 + //! (SHA1: FA B5 6C 4C C7 CF F5 07 1D 40 B6 B0 07 38 61 D2 90 CA 2A 1A) + NSSL_SERVER_CERT_NINTENDO_CLASS2_CA_G3 = 105, + //! Represents the last certificate in the Nintendo CA group. + NSSL_SERVER_CERT_GROUP_NINTENDO_LAST = 105, - //! Represents the first certificate in the commercial CA group. - NSSL_SERVER_CERT_GROUP_COMMERCIAL_FIRST = 1001, - //! Baltimore CyberTrust Root - //! (SHA1: D4 DE 20 D0 5E 66 FC 53 FE 1A 50 88 2C 78 DB 28 52 CA E4 74) - NSSL_SERVER_CERT_BALTIMORE_CYBERTRUST_ROOT_CA = 1001, - //! Cybertrust Global Root - //! (SHA1: 5F 43 E5 B1 BF F8 78 8C AC 1C C7 CA 4A 9A C6 22 2B CC 34 C6) - NSSL_SERVER_CERT_CYBERTRUST_GLOBAL_ROOT_CA = 1002, - //! Verizon Global Root - //! (SHA1: 91 21 98 EE F2 3D CA C4 09 39 31 2F EE 97 DD 56 0B AE 49 B1) - NSSL_SERVER_CERT_VERIZON_GLOBAL_ROOT_CA = 1003, - //! GlobalSign Root CA - //! (SHA1: B1 BC 96 8B D4 F4 9D 62 2A A8 9A 81 F2 15 01 52 A4 1D 82 9C) - NSSL_SERVER_CERT_GLOBALSIGN_ROOT_CA = 1004, - //! GlobalSign - //! (SHA1: 75 E0 AB B6 13 85 12 27 1C 04 F8 5F DD DE 38 E4 B7 24 2E FE) - NSSL_SERVER_CERT_GLOBALSIGN_ROOT_CA_R2 = 1005, - //! GlobalSign - //! (SHA1: D6 9B 56 11 48 F0 1C 77 C5 45 78 C1 09 26 DF 5B 85 69 76 AD) - NSSL_SERVER_CERT_GLOBALSIGN_ROOT_CA_R3 = 1006, - //! VeriSign Class 3 Public Primary Certification Authority - G3 - //! (SHA1: 13 2D 0D 45 53 4B 69 97 CD B2 D5 C3 39 E2 55 76 60 9B 5C C6) - NSSL_SERVER_CERT_VERISIGN_CLASS3_PUBLIC_PRIMARY_CA_G3 = 1007, - //! VeriSign Universal Root Certification Authority - //! (SHA1: 36 79 CA 35 66 87 72 30 4D 30 A5 FB 87 3B 0F A7 7B B7 0D 54) - NSSL_SERVER_CERT_VERISIGN_UNIVERSAL_ROOT_CA = 1008, - //! VeriSign Class 3 Public Primary Certification Authority - G5 - //! (SHA1: 4E B6 D5 78 49 9B 1C CF 5F 58 1E AD 56 BE 3D 9B 67 44 A5 E5) - NSSL_SERVER_CERT_VERISIGN_CLASS3_PUBLIC_PRIMARY_CA_G5 = 1009, - //! thawte Primary Root CA - G3 - //! (SHA1: F1 8B 53 8D 1B E9 03 B6 A6 F0 56 43 5B 17 15 89 CA F3 6B F2) - NSSL_SERVER_CERT_THAWTE_PRIMARY_ROOT_CA_G3 = 1010, - //! thawte Primary Root CA - //! (SHA1: 91 C6 D6 EE 3E 8A C8 63 84 E5 48 C2 99 29 5C 75 6C 81 7B 81) - NSSL_SERVER_CERT_THAWTE_PRIMARY_ROOT_CA = 1011, - //! GeoTrust Global CA - //! (SHA1: DE 28 F4 A4 FF E5 B9 2F A3 C5 03 D1 A3 49 A7 F9 96 2A 82 12) - NSSL_SERVER_CERT_GEOTRUST_GLOBAL_CA = 1012, - //! GeoTrust Global CA 2 - //! (SHA1: A9 E9 78 08 14 37 58 88 F2 05 19 B0 6D 2B 0D 2B 60 16 90 7D) - NSSL_SERVER_CERT_GEOTRUST_GLOBAL_CA2 = 1013, - //! GeoTrust Primary Certification Authority - //! (SHA1: 32 3C 11 8E 1B F7 B8 B6 52 54 E2 E2 10 0D D6 02 90 37 F0 96) - NSSL_SERVER_CERT_GEOTRUST_PRIMARY_CA = 1014, - //! GeoTrust Primary Certification Authority - G3 - //! (SHA1: 03 9E ED B8 0B E7 A0 3C 69 53 89 3B 20 D2 D9 32 3A 4C 2A FD) - NSSL_SERVER_CERT_GEOTRUST_PRIMARY_CA_G3 = 1015, - //! AddTrust External CA Root - //! (SHA1: 02 FA F3 E2 91 43 54 68 60 78 57 69 4D F5 E4 5B 68 85 18 68) - NSSL_SERVER_CERT_ADDTRUST_EXT_CA_ROOT = 1016, - //! COMODO Certification Authority - //! (SHA1: EE 86 93 87 FF FD 83 49 AB 5A D1 43 22 58 87 89 A4 57 B0 12) - NSSL_SERVER_CERT_COMODO_CA = 1017, - //! UTN - DATACorp SGC - //! (SHA1: 58 11 9F 0E 12 82 87 EA 50 FD D9 87 45 6F 4F 78 DC FA D6 D4) - NSSL_SERVER_CERT_UTN_DATACORP_SGC_CA = 1018, - //! UTN-USERFirst-Hardware - //! (SHA1: 04 83 ED 33 99 AC 36 08 05 87 22 ED BC 5E 46 00 E3 BE F9 D7) - NSSL_SERVER_CERT_UTN_USERFIRST_HARDWARE_CA = 1019, - //! DigiCert High Assurance EV Root CA - //! (SHA1: 5F B7 EE 06 33 E2 59 DB AD 0C 4C 9A E6 D3 8F 1A 61 C7 DC 25) - NSSL_SERVER_CERT_DIGICERT_HIGH_ASSURANCE_EV_ROOT_CA = 1020, - //! DigiCert Assured ID Root CA - //! (SHA1: 05 63 B8 63 0D 62 D7 5A BB C8 AB 1E 4B DF B5 A8 99 B2 4D 43) - NSSL_SERVER_CERT_DIGICERT_ASSURED_ID_ROOT_CA = 1021, - //! DigiCert Global Root CA - //! (SHA1: A8 98 5D 3A 65 E5 E5 C4 B2 D7 D6 6D 40 C6 DD 2F B1 9C 54 36) - NSSL_SERVER_CERT_DIGICERT_GLOBAL_ROOT_CA = 1022, - //! GTE CyberTrust Global Root - //! (SHA1: 97 81 79 50 D8 1C 96 70 CC 34 D8 09 CF 79 44 31 36 7E F4 74) - NSSL_SERVER_CERT_GTE_CYBERTRUST_GLOBAL_ROOT = 1023, - //! [No common name] - //! (SHA1: A1 DB 63 93 91 6F 17 E4 18 55 09 40 04 15 C7 02 40 B0 AE 6B) - NSSL_SERVER_CERT_VERISIGN_CLASS3_PUBLIC_PRIMARY_CA = 1024, - //! Thawte Premium Server CA - //! (SHA1: 62 7F 8D 78 27 65 63 99 D2 7D 7F 90 44 C9 FE B3 F3 3E FA 9A) - NSSL_SERVER_CERT_THAWTE_PREMIUM_SERVER_CA = 1025, - //! [No common name] - //! (SHA1: D2 32 09 AD 23 D3 14 23 21 74 E4 0D 7F 9D 62 13 97 86 63 3A) - NSSL_SERVER_CERT_EQUIFAX_SECURE_CA = 1026, - //! Entrust.net Secure Server Certification Authority - //! (SHA1: 99 A6 9B E6 1A FE 88 6B 4D 2B 82 00 7C B8 54 FC 31 7E 15 39) - NSSL_SERVER_CERT_ENTRUST_SECURE_SERVER_CA = 1027, - //! [No common name] - //! (SHA1: 85 37 1C A6 E5 50 14 3D CE 28 03 47 1B DE 3A 09 E8 F8 77 0F) - NSSL_SERVER_CERT_VERISIGN_CLASS3_PUBLIC_PRIMARY_CA_G2 = 1028, - //! Entrust.net Certification Authority (2048) - //! (SHA1: 50 30 06 09 1D 97 D4 F5 AE 39 F7 CB E7 92 7D 7D 65 2D 34 31) - NSSL_SERVER_CERT_ENTRUST_CA_2048 = 1029, - //! Entrust Root Certification Authority - //! (SHA1: B3 1E B1 B7 40 E3 6C 84 02 DA DC 37 D4 4D F5 D4 67 49 52 F9) - NSSL_SERVER_CERT_ENTRUST_ROOT_CA = 1030, - //! Entrust Root Certification Authority - G2 - //! (SHA1: 8C F4 27 FD 79 0C 3A D1 66 06 8D E8 1E 57 EF BB 93 22 72 D4) - NSSL_SERVER_CERT_ENTRUST_ROOT_CA_G2 = 1031, - //! DigiCert Assured ID Root G2 - //! (SHA1: A1 4B 48 D9 43 EE 0A 0E 40 90 4F 3C E0 A4 C0 91 93 51 5D 3F) - NSSL_SERVER_CERT_DIGICERT_ASSURED_ID_ROOT_CA_G2 = 1032, - //! DigiCert Global Root G2 - //! (SHA1: DF 3C 24 F9 BF D6 66 76 1B 26 80 73 FE 06 D1 CC 8D 4F 82 A4) - NSSL_SERVER_CERT_DIGICERT_GLOBAL_ROOT_CA_G2 = 1033, - //! Represents the last certificate in the commerical CA group. - NSSL_SERVER_CERT_GROUP_COMMERCIAL_LAST = 1033, + //! Represents the first certificate in the commercial CA group. + NSSL_SERVER_CERT_GROUP_COMMERCIAL_FIRST = 1001, + //! Baltimore CyberTrust Root + //! (SHA1: D4 DE 20 D0 5E 66 FC 53 FE 1A 50 88 2C 78 DB 28 52 CA E4 74) + NSSL_SERVER_CERT_BALTIMORE_CYBERTRUST_ROOT_CA = 1001, + //! Cybertrust Global Root + //! (SHA1: 5F 43 E5 B1 BF F8 78 8C AC 1C C7 CA 4A 9A C6 22 2B CC 34 C6) + NSSL_SERVER_CERT_CYBERTRUST_GLOBAL_ROOT_CA = 1002, + //! Verizon Global Root + //! (SHA1: 91 21 98 EE F2 3D CA C4 09 39 31 2F EE 97 DD 56 0B AE 49 B1) + NSSL_SERVER_CERT_VERIZON_GLOBAL_ROOT_CA = 1003, + //! GlobalSign Root CA + //! (SHA1: B1 BC 96 8B D4 F4 9D 62 2A A8 9A 81 F2 15 01 52 A4 1D 82 9C) + NSSL_SERVER_CERT_GLOBALSIGN_ROOT_CA = 1004, + //! GlobalSign + //! (SHA1: 75 E0 AB B6 13 85 12 27 1C 04 F8 5F DD DE 38 E4 B7 24 2E FE) + NSSL_SERVER_CERT_GLOBALSIGN_ROOT_CA_R2 = 1005, + //! GlobalSign + //! (SHA1: D6 9B 56 11 48 F0 1C 77 C5 45 78 C1 09 26 DF 5B 85 69 76 AD) + NSSL_SERVER_CERT_GLOBALSIGN_ROOT_CA_R3 = 1006, + //! VeriSign Class 3 Public Primary Certification Authority - G3 + //! (SHA1: 13 2D 0D 45 53 4B 69 97 CD B2 D5 C3 39 E2 55 76 60 9B 5C C6) + NSSL_SERVER_CERT_VERISIGN_CLASS3_PUBLIC_PRIMARY_CA_G3 = 1007, + //! VeriSign Universal Root Certification Authority + //! (SHA1: 36 79 CA 35 66 87 72 30 4D 30 A5 FB 87 3B 0F A7 7B B7 0D 54) + NSSL_SERVER_CERT_VERISIGN_UNIVERSAL_ROOT_CA = 1008, + //! VeriSign Class 3 Public Primary Certification Authority - G5 + //! (SHA1: 4E B6 D5 78 49 9B 1C CF 5F 58 1E AD 56 BE 3D 9B 67 44 A5 E5) + NSSL_SERVER_CERT_VERISIGN_CLASS3_PUBLIC_PRIMARY_CA_G5 = 1009, + //! thawte Primary Root CA - G3 + //! (SHA1: F1 8B 53 8D 1B E9 03 B6 A6 F0 56 43 5B 17 15 89 CA F3 6B F2) + NSSL_SERVER_CERT_THAWTE_PRIMARY_ROOT_CA_G3 = 1010, + //! thawte Primary Root CA + //! (SHA1: 91 C6 D6 EE 3E 8A C8 63 84 E5 48 C2 99 29 5C 75 6C 81 7B 81) + NSSL_SERVER_CERT_THAWTE_PRIMARY_ROOT_CA = 1011, + //! GeoTrust Global CA + //! (SHA1: DE 28 F4 A4 FF E5 B9 2F A3 C5 03 D1 A3 49 A7 F9 96 2A 82 12) + NSSL_SERVER_CERT_GEOTRUST_GLOBAL_CA = 1012, + //! GeoTrust Global CA 2 + //! (SHA1: A9 E9 78 08 14 37 58 88 F2 05 19 B0 6D 2B 0D 2B 60 16 90 7D) + NSSL_SERVER_CERT_GEOTRUST_GLOBAL_CA2 = 1013, + //! GeoTrust Primary Certification Authority + //! (SHA1: 32 3C 11 8E 1B F7 B8 B6 52 54 E2 E2 10 0D D6 02 90 37 F0 96) + NSSL_SERVER_CERT_GEOTRUST_PRIMARY_CA = 1014, + //! GeoTrust Primary Certification Authority - G3 + //! (SHA1: 03 9E ED B8 0B E7 A0 3C 69 53 89 3B 20 D2 D9 32 3A 4C 2A FD) + NSSL_SERVER_CERT_GEOTRUST_PRIMARY_CA_G3 = 1015, + //! AddTrust External CA Root + //! (SHA1: 02 FA F3 E2 91 43 54 68 60 78 57 69 4D F5 E4 5B 68 85 18 68) + NSSL_SERVER_CERT_ADDTRUST_EXT_CA_ROOT = 1016, + //! COMODO Certification Authority + //! (SHA1: EE 86 93 87 FF FD 83 49 AB 5A D1 43 22 58 87 89 A4 57 B0 12) + NSSL_SERVER_CERT_COMODO_CA = 1017, + //! UTN - DATACorp SGC + //! (SHA1: 58 11 9F 0E 12 82 87 EA 50 FD D9 87 45 6F 4F 78 DC FA D6 D4) + NSSL_SERVER_CERT_UTN_DATACORP_SGC_CA = 1018, + //! UTN-USERFirst-Hardware + //! (SHA1: 04 83 ED 33 99 AC 36 08 05 87 22 ED BC 5E 46 00 E3 BE F9 D7) + NSSL_SERVER_CERT_UTN_USERFIRST_HARDWARE_CA = 1019, + //! DigiCert High Assurance EV Root CA + //! (SHA1: 5F B7 EE 06 33 E2 59 DB AD 0C 4C 9A E6 D3 8F 1A 61 C7 DC 25) + NSSL_SERVER_CERT_DIGICERT_HIGH_ASSURANCE_EV_ROOT_CA = 1020, + //! DigiCert Assured ID Root CA + //! (SHA1: 05 63 B8 63 0D 62 D7 5A BB C8 AB 1E 4B DF B5 A8 99 B2 4D 43) + NSSL_SERVER_CERT_DIGICERT_ASSURED_ID_ROOT_CA = 1021, + //! DigiCert Global Root CA + //! (SHA1: A8 98 5D 3A 65 E5 E5 C4 B2 D7 D6 6D 40 C6 DD 2F B1 9C 54 36) + NSSL_SERVER_CERT_DIGICERT_GLOBAL_ROOT_CA = 1022, + //! GTE CyberTrust Global Root + //! (SHA1: 97 81 79 50 D8 1C 96 70 CC 34 D8 09 CF 79 44 31 36 7E F4 74) + NSSL_SERVER_CERT_GTE_CYBERTRUST_GLOBAL_ROOT = 1023, + //! [No common name] + //! (SHA1: A1 DB 63 93 91 6F 17 E4 18 55 09 40 04 15 C7 02 40 B0 AE 6B) + NSSL_SERVER_CERT_VERISIGN_CLASS3_PUBLIC_PRIMARY_CA = 1024, + //! Thawte Premium Server CA + //! (SHA1: 62 7F 8D 78 27 65 63 99 D2 7D 7F 90 44 C9 FE B3 F3 3E FA 9A) + NSSL_SERVER_CERT_THAWTE_PREMIUM_SERVER_CA = 1025, + //! [No common name] + //! (SHA1: D2 32 09 AD 23 D3 14 23 21 74 E4 0D 7F 9D 62 13 97 86 63 3A) + NSSL_SERVER_CERT_EQUIFAX_SECURE_CA = 1026, + //! Entrust.net Secure Server Certification Authority + //! (SHA1: 99 A6 9B E6 1A FE 88 6B 4D 2B 82 00 7C B8 54 FC 31 7E 15 39) + NSSL_SERVER_CERT_ENTRUST_SECURE_SERVER_CA = 1027, + //! [No common name] + //! (SHA1: 85 37 1C A6 E5 50 14 3D CE 28 03 47 1B DE 3A 09 E8 F8 77 0F) + NSSL_SERVER_CERT_VERISIGN_CLASS3_PUBLIC_PRIMARY_CA_G2 = 1028, + //! Entrust.net Certification Authority (2048) + //! (SHA1: 50 30 06 09 1D 97 D4 F5 AE 39 F7 CB E7 92 7D 7D 65 2D 34 31) + NSSL_SERVER_CERT_ENTRUST_CA_2048 = 1029, + //! Entrust Root Certification Authority + //! (SHA1: B3 1E B1 B7 40 E3 6C 84 02 DA DC 37 D4 4D F5 D4 67 49 52 F9) + NSSL_SERVER_CERT_ENTRUST_ROOT_CA = 1030, + //! Entrust Root Certification Authority - G2 + //! (SHA1: 8C F4 27 FD 79 0C 3A D1 66 06 8D E8 1E 57 EF BB 93 22 72 D4) + NSSL_SERVER_CERT_ENTRUST_ROOT_CA_G2 = 1031, + //! DigiCert Assured ID Root G2 + //! (SHA1: A1 4B 48 D9 43 EE 0A 0E 40 90 4F 3C E0 A4 C0 91 93 51 5D 3F) + NSSL_SERVER_CERT_DIGICERT_ASSURED_ID_ROOT_CA_G2 = 1032, + //! DigiCert Global Root G2 + //! (SHA1: DF 3C 24 F9 BF D6 66 76 1B 26 80 73 FE 06 D1 CC 8D 4F 82 A4) + NSSL_SERVER_CERT_DIGICERT_GLOBAL_ROOT_CA_G2 = 1033, + //! Represents the last certificate in the commerical CA group. + NSSL_SERVER_CERT_GROUP_COMMERCIAL_LAST = 1033, - //! Represents the first certificate in the 4096-bit commercial CA group. - NSSL_SERVER_CERT_GROUP_COMMERCIAL_4096_FIRST = 1900, - //! COMODO RSA Certification Authority - //! (SHA1: AF E5 D2 44 A8 D1 19 42 30 FF 47 9F E2 F8 97 BB CD 7A 8C B4) - NSSL_SERVER_CERT_COMODO_RSA_CA = 1900, - //! USERTrust RSA Certification Authority - //! (SHA1: 2B 8F 1B 57 33 0D BB A2 D0 7A 6C 51 F7 0E E9 0D DA B9 AD 8E) - NSSL_SERVER_CERT_USERTRUST_RSA_CA = 1901, - //! Represents the last certificate in the 4096-bit commercial CA group. - NSSL_SERVER_CERT_GROUP_COMMERCIAL_4096_LAST = 1901, + //! Represents the first certificate in the 4096-bit commercial CA group. + NSSL_SERVER_CERT_GROUP_COMMERCIAL_4096_FIRST = 1900, + //! COMODO RSA Certification Authority + //! (SHA1: AF E5 D2 44 A8 D1 19 42 30 FF 47 9F E2 F8 97 BB CD 7A 8C B4) + NSSL_SERVER_CERT_COMODO_RSA_CA = 1900, + //! USERTrust RSA Certification Authority + //! (SHA1: 2B 8F 1B 57 33 0D BB A2 D0 7A 6C 51 F7 0E E9 0D DA B9 AD 8E) + NSSL_SERVER_CERT_USERTRUST_RSA_CA = 1901, + //! Represents the last certificate in the 4096-bit commercial CA group. + NSSL_SERVER_CERT_GROUP_COMMERCIAL_4096_LAST = 1901, } NSSLServerCertId; /** diff --git a/include/nsysnet/socket.h b/include/nsysnet/socket.h index 0d7c04bfc..372486d32 100644 --- a/include/nsysnet/socket.h +++ b/include/nsysnet/socket.h @@ -1,13 +1,13 @@ #pragma once #include +#include +#include +#include #include +#include #include #include -#include -#include -#include #include -#include #warning "nsysnet/socket.h is deprecated; please use standard socket headers instead." @@ -15,18 +15,16 @@ extern "C" { #endif -#define NSN_EAGAIN EAGAIN -#define NSN_EWOULDBLOCK EWOULDBLOCK +#define NSN_EAGAIN EAGAIN +#define NSN_EWOULDBLOCK EWOULDBLOCK -__attribute__ ((deprecated)) -static inline int +__attribute__((deprecated)) static inline int socketclose(int sockfd) { return close(sockfd); } -__attribute__ ((deprecated)) -static inline int +__attribute__((deprecated)) static inline int socketlasterr() { return errno; @@ -35,4 +33,3 @@ socketlasterr() #ifdef __cplusplus } #endif - diff --git a/include/nsysuhs/uhs.h b/include/nsysuhs/uhs.h index 28d977a8c..16ee75ef6 100644 --- a/include/nsysuhs/uhs.h +++ b/include/nsysuhs/uhs.h @@ -1,6 +1,6 @@ #pragma once #include -#include +#include #ifdef __cplusplus extern "C" { @@ -15,41 +15,41 @@ typedef struct UhsHandle UhsHandle; typedef struct UhsConfig UhsConfig; /* Determines which interface parameters to check */ -#define MATCH_ANY 0x000 -#define MATCH_DEV_VID 0x001 -#define MATCH_DEV_PID 0x002 -#define MATCH_DEV_CLASS 0x010 -#define MATCH_DEV_SUBCLASS 0x020 -#define MATCH_DEV_PROTOCOL 0x040 -#define MATCH_IF_CLASS 0x080 -#define MATCH_IF_SUBCLASS 0x100 -#define MATCH_IF_PROTOCOL 0x200 +#define MATCH_ANY 0x000 +#define MATCH_DEV_VID 0x001 +#define MATCH_DEV_PID 0x002 +#define MATCH_DEV_CLASS 0x010 +#define MATCH_DEV_SUBCLASS 0x020 +#define MATCH_DEV_PROTOCOL 0x040 +#define MATCH_IF_CLASS 0x080 +#define MATCH_IF_SUBCLASS 0x100 +#define MATCH_IF_PROTOCOL 0x200 typedef enum UHSStatus { - UHS_STATUS_OK = 0, - UHS_STATUS_HANDLE_INVALID_ARGS = 0xffdefffd, - UHS_STATUS_HANDLE_INVALID_STATE = 0xffdefffc, + UHS_STATUS_OK = 0, + UHS_STATUS_HANDLE_INVALID_ARGS = 0xffdefffd, + UHS_STATUS_HANDLE_INVALID_STATE = 0xffdefffc, } UHSStatus; typedef enum UHSHandleState { - UHS_HANDLE_STATE_INIT = 0x00, - UHS_HANDLE_STATE_OPENING = 0x01, - UHS_HANDLE_STATE_OPENED = 0x02, - UHS_HANDLE_STATE_CLOSING = 0x03, - UHS_HANDLE_STATE_CLOSED = 0x04, - UHS_HANDLE_STATE_ERROR = 0x05, + UHS_HANDLE_STATE_INIT = 0x00, + UHS_HANDLE_STATE_OPENING = 0x01, + UHS_HANDLE_STATE_OPENED = 0x02, + UHS_HANDLE_STATE_CLOSING = 0x03, + UHS_HANDLE_STATE_CLOSED = 0x04, + UHS_HANDLE_STATE_ERROR = 0x05, } UHSHandleState; #define UHS_CONFIG_BUFFER_SIZE 0x137f struct WUT_PACKED UhsConfig { - uint32_t controller_num; - /* buffer aligned by 0x40 with a size of UHS_CONFIG_BUFFER_SIZE */ - void* buffer; - uint32_t buffer_size; + uint32_t controller_num; + /* buffer aligned by 0x40 with a size of UHS_CONFIG_BUFFER_SIZE */ + void *buffer; + uint32_t buffer_size; }; WUT_CHECK_OFFSET(UhsConfig, 0x00, controller_num); WUT_CHECK_OFFSET(UhsConfig, 0x04, buffer); @@ -58,12 +58,12 @@ WUT_CHECK_SIZE(UhsConfig, 0x0C); struct WUT_PACKED UhsHandle { - UHSHandleState state; - void* ipc_buffer; - WUT_UNKNOWN_BYTES(4); /* always 0xFFFFFFFF after init */ - uint32_t handle; - UhsConfig * config; - WUT_UNKNOWN_BYTES(4); + UHSHandleState state; + void *ipc_buffer; + WUT_UNKNOWN_BYTES(4); /* always 0xFFFFFFFF after init */ + uint32_t handle; + UhsConfig *config; + WUT_UNKNOWN_BYTES(4); }; WUT_CHECK_OFFSET(UhsHandle, 0x00, state); WUT_CHECK_OFFSET(UhsHandle, 0x04, ipc_buffer); @@ -72,25 +72,25 @@ WUT_CHECK_OFFSET(UhsHandle, 0x10, config); WUT_CHECK_SIZE(UhsHandle, 0x18); /* Endpoint transfer directions */ -#define ENDPOINT_TRANSFER_OUT 1 -#define ENDPOINT_TRANSFER_IN 2 +#define ENDPOINT_TRANSFER_OUT 1 +#define ENDPOINT_TRANSFER_IN 2 /* Special timeout values */ -#define TIMEOUT_NONE -1 - +#define TIMEOUT_NONE -1 + /* Interface filter */ struct WUT_PACKED UhsInterfaceFilter { - uint16_t match_params; /* Bitmask of above flags */ - uint16_t vid; /* Vendor ID */ - uint16_t pid; /* Product ID */ - WUT_UNKNOWN_BYTES(4); - uint8_t dev_class; /* Device class */ - uint8_t dev_subclass; /* Device subclass */ - uint8_t dev_protocol; /* Device protocol */ - uint8_t if_class; /* Interface class */ - uint8_t if_subclass; /* Interface subclass */ - uint8_t if_protocol; /* Interface protocol */ + uint16_t match_params; /* Bitmask of above flags */ + uint16_t vid; /* Vendor ID */ + uint16_t pid; /* Product ID */ + WUT_UNKNOWN_BYTES(4); + uint8_t dev_class; /* Device class */ + uint8_t dev_subclass; /* Device subclass */ + uint8_t dev_protocol; /* Device protocol */ + uint8_t if_class; /* Interface class */ + uint8_t if_subclass; /* Interface subclass */ + uint8_t if_protocol; /* Interface protocol */ }; WUT_CHECK_OFFSET(UhsInterfaceFilter, 0x00, match_params); WUT_CHECK_OFFSET(UhsInterfaceFilter, 0x02, vid); @@ -107,13 +107,13 @@ WUT_CHECK_SIZE(UhsInterfaceFilter, 0x10); /* Interface profile */ struct WUT_PACKED UhsEndpointDescriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bEndpointAddress; - uint8_t bmAttributes; - uint16_t wMaxPacketSize; - uint8_t bInterval; - WUT_UNKNOWN_BYTES(0x2); + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bEndpointAddress; + uint8_t bmAttributes; + uint16_t wMaxPacketSize; + uint8_t bInterval; + WUT_UNKNOWN_BYTES(0x2); }; WUT_CHECK_OFFSET(UhsEndpointDescriptor, 0x00, bLength); WUT_CHECK_OFFSET(UhsEndpointDescriptor, 0x01, bDescriptorType); @@ -126,13 +126,13 @@ WUT_CHECK_SIZE(UhsEndpointDescriptor, 0x09); /* Interface profile */ struct WUT_PACKED UhsInterfaceProfile { - uint32_t if_handle; - WUT_UNKNOWN_BYTES(0x24); - UhsDeviceDescriptor dev_desc; - UhsConfigDescriptor cfg_desc; - UhsInterfaceDescriptor if_desc; - UhsEndpointDescriptor in_endpoints[16]; - UhsEndpointDescriptor out_endpoints[16]; + uint32_t if_handle; + WUT_UNKNOWN_BYTES(0x24); + UhsDeviceDescriptor dev_desc; + UhsConfigDescriptor cfg_desc; + UhsInterfaceDescriptor if_desc; + UhsEndpointDescriptor in_endpoints[16]; + UhsEndpointDescriptor out_endpoints[16]; }; WUT_CHECK_OFFSET(UhsInterfaceProfile, 0x00, if_handle); WUT_CHECK_OFFSET(UhsInterfaceProfile, 0x28, dev_desc); @@ -144,88 +144,88 @@ WUT_CHECK_SIZE(UhsInterfaceProfile, 0x16C); typedef enum UHSAdminDevType { - UHS_ADMIN_DEV_RESET = 0x01, - UHS_ADMIN_DEV_FREEZE = 0x02, - UHS_ADMIN_DEV_SUSPEND = 0x03, - UHS_ADMIN_DEV_RESUME = 0x04, - UHS_ADMIN_DEV_DESTROY = 0x05, + UHS_ADMIN_DEV_RESET = 0x01, + UHS_ADMIN_DEV_FREEZE = 0x02, + UHS_ADMIN_DEV_SUSPEND = 0x03, + UHS_ADMIN_DEV_RESUME = 0x04, + UHS_ADMIN_DEV_DESTROY = 0x05, } UHSAdminDevType; typedef enum UHSAdminEpType { - UHS_ADMIN_EP_ENABLE = 0x01, - UHS_ADMIN_EP_DISABLE = 0x02, - UHS_ADMIN_EP_CANCEL = 0x03, - UHS_ADMIN_EP_CANCEL_RESET = 0x04, + UHS_ADMIN_EP_ENABLE = 0x01, + UHS_ADMIN_EP_DISABLE = 0x02, + UHS_ADMIN_EP_CANCEL = 0x03, + UHS_ADMIN_EP_CANCEL_RESET = 0x04, } UHSAdminEpType; /* Open a specific controller under /dev/uhs */ UHSStatus -UhsClientOpen(UhsHandle* handle, - UhsConfig* config); +UhsClientOpen(UhsHandle *handle, + UhsConfig *config); UHSStatus -UhsClientClose(UhsHandle* handle); +UhsClientClose(UhsHandle *handle); -typedef void(*UHSDrvRegCallback)(void * context, UhsInterfaceProfile * profile); +typedef void (*UHSDrvRegCallback)(void *context, UhsInterfaceProfile *profile); /* Register a USB class driver */ -UHSStatus -UhsClassDrvReg(UhsHandle* handle, - UhsInterfaceFilter *filter, - void *context, +UHSStatus +UhsClassDrvReg(UhsHandle *handle, + UhsInterfaceFilter *filter, + void *context, UHSDrvRegCallback callback); -UHSStatus -UhsClassDrvUnReg(UhsHandle* handle, +UHSStatus +UhsClassDrvUnReg(UhsHandle *handle, uint32_t drv_handle); UHSStatus -UhsGetFullConfigDescriptor(UhsHandle* handle, +UhsGetFullConfigDescriptor(UhsHandle *handle, uint32_t if_handle, - void* data, + void *data, uint32_t size); UHSStatus -UhsGetDescriptorString(UhsHandle* handle, +UhsGetDescriptorString(UhsHandle *handle, uint32_t if_handle, uint8_t string_index, BOOL as_unicode, - void* data, + void *data, uint32_t size); /* Determine which USB device interfaces are plugged in and available */ -UHSStatus -UhsQueryInterfaces(UhsHandle* handle, - UhsInterfaceFilter *filter, - UhsInterfaceProfile *profiles, +UHSStatus +UhsQueryInterfaces(UhsHandle *handle, + UhsInterfaceFilter *filter, + UhsInterfaceProfile *profiles, int32_t max_profiles); -typedef void(*UhsAcquireInterfaceCallback)(void * context, int32_t arg1, int32_t arg2); +typedef void (*UhsAcquireInterfaceCallback)(void *context, int32_t arg1, int32_t arg2); /* Acquire a USB device interface for use */ -UHSStatus -UhsAcquireInterface(UhsHandle* handle, - uint32_t if_handle, - void * context, +UHSStatus +UhsAcquireInterface(UhsHandle *handle, + uint32_t if_handle, + void *context, UhsAcquireInterfaceCallback callback); /* Release a currently-held USB device interface */ -UHSStatus -UhsReleaseInterface(UhsHandle* handle, - uint32_t if_handle, +UHSStatus +UhsReleaseInterface(UhsHandle *handle, + uint32_t if_handle, bool no_reacquire); /* Administer a USB device */ -UHSStatus -UhsAdministerDevice(UhsHandle* handle, +UHSStatus +UhsAdministerDevice(UhsHandle *handle, uint32_t if_handle, UHSAdminDevType type, int32_t arg3); UHSStatus -UhsAdministerEndpoint(UhsHandle* handle, +UhsAdministerEndpoint(UhsHandle *handle, uint32_t if_handle, UHSAdminEpType type, uint32_t endpointMask, @@ -233,60 +233,66 @@ UhsAdministerEndpoint(UhsHandle* handle, uint32_t max_request_size); UHSStatus -UhsClearEndpointHalt(UhsHandle* handle, +UhsClearEndpointHalt(UhsHandle *handle, uint32_t if_handle, uint32_t endpoint, int32_t direction); /* Submit a control request to endpoint 0 */ -UHSStatus -UhsSubmitControlRequest(UhsHandle* handle, - uint32_t if_handle, - void *buffer, - uint8_t bRequest, - uint8_t bmRequestType, - uint16_t wValue, - uint16_t wIndex, - uint16_t wLength, +UHSStatus +UhsSubmitControlRequest(UhsHandle *handle, + uint32_t if_handle, + void *buffer, + uint8_t bRequest, + uint8_t bmRequestType, + uint16_t wValue, + uint16_t wIndex, + uint16_t wLength, int32_t timeout); /* Submit a bulk request to an endpoint */ -UHSStatus -UhsSubmitBulkRequest(UhsHandle* handle, - uint32_t if_handle, - uint8_t endpoint, - int32_t direction, - void *buffer, - int32_t length, +UHSStatus +UhsSubmitBulkRequest(UhsHandle *handle, + uint32_t if_handle, + uint8_t endpoint, + int32_t direction, + void *buffer, + int32_t length, int32_t timeout); /* Submit an interrupt request to an endpoint */ -UHSStatus -UhsSubmitInterruptRequest(UhsHandle* handle, - uint32_t if_handle, - uint8_t endpoint, - int32_t direction, - void *buffer, - int32_t length, +UHSStatus +UhsSubmitInterruptRequest(UhsHandle *handle, + uint32_t if_handle, + uint8_t endpoint, + int32_t direction, + void *buffer, + int32_t length, int32_t timeout); -static inline uint32_t UHSEndpointDirIsIn(UhsEndpointDescriptor * endpoint_descriptor){ - return ((endpoint_descriptor->bEndpointAddress & 0x80) == 0x80); +static inline uint32_t +UHSEndpointDirIsIn(UhsEndpointDescriptor *endpoint_descriptor) +{ + return ((endpoint_descriptor->bEndpointAddress & 0x80) == 0x80); } -static inline uint32_t UHSEndpointGetNum(UhsEndpointDescriptor * endpoint_descriptor){ - return (endpoint_descriptor->bEndpointAddress & 0x0F); +static inline uint32_t +UHSEndpointGetNum(UhsEndpointDescriptor *endpoint_descriptor) +{ + return (endpoint_descriptor->bEndpointAddress & 0x0F); } -static inline uint32_t UHSEndpointGetMask(UhsEndpointDescriptor * endpoint_descriptor){ - uint32_t endpoint_mask; - - if (UHSEndpointDirIsIn(endpoint_descriptor)) { - endpoint_mask = (1 << (UHSEndpointGetNum(endpoint_descriptor) + 16)); - } else { - endpoint_mask = (1 << UHSEndpointGetNum(endpoint_descriptor)); - } - return endpoint_mask; +static inline uint32_t +UHSEndpointGetMask(UhsEndpointDescriptor *endpoint_descriptor) +{ + uint32_t endpoint_mask; + + if (UHSEndpointDirIsIn(endpoint_descriptor)) { + endpoint_mask = (1 << (UHSEndpointGetNum(endpoint_descriptor) + 16)); + } else { + endpoint_mask = (1 << UHSEndpointGetNum(endpoint_descriptor)); + } + return endpoint_mask; } #ifdef __cplusplus diff --git a/include/nsysuhs/uhs_usbspec.h b/include/nsysuhs/uhs_usbspec.h index e1497754b..0810c4f28 100644 --- a/include/nsysuhs/uhs_usbspec.h +++ b/include/nsysuhs/uhs_usbspec.h @@ -6,10 +6,10 @@ extern "C" { #endif /* USB class codes */ -#define USBCLASS_DEVICE 0x00 -#define USBCLASS_AUDIO 0x01 -#define USBCLASS_HID 0x03 -#define USBCLASS_STORAGE 0x08 +#define USBCLASS_DEVICE 0x00 +#define USBCLASS_AUDIO 0x01 +#define USBCLASS_HID 0x03 +#define USBCLASS_STORAGE 0x08 typedef struct UhsDeviceDescriptor UhsDeviceDescriptor; typedef struct UhsConfigDescriptor UhsConfigDescriptor; @@ -19,20 +19,20 @@ typedef struct UhsSetupPacket UhsSetupPacket; /* USB device descriptor */ struct WUT_PACKED UhsDeviceDescriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint16_t bcdUsb; - uint8_t bDeviceClass; - uint8_t bDeviceSubclass; - uint8_t bDeviceProtocol; - uint8_t bMaxPacketSize; - uint16_t idVendor; - uint16_t idProduct; - uint16_t bcdDevice; - uint8_t iManufacturer; - uint8_t iProduct; - uint8_t iSerialNumber; - uint8_t bNumConfigurations; + uint8_t bLength; + uint8_t bDescriptorType; + uint16_t bcdUsb; + uint8_t bDeviceClass; + uint8_t bDeviceSubclass; + uint8_t bDeviceProtocol; + uint8_t bMaxPacketSize; + uint16_t idVendor; + uint16_t idProduct; + uint16_t bcdDevice; + uint8_t iManufacturer; + uint8_t iProduct; + uint8_t iSerialNumber; + uint8_t bNumConfigurations; }; WUT_CHECK_OFFSET(UhsDeviceDescriptor, 0x00, bLength); WUT_CHECK_OFFSET(UhsDeviceDescriptor, 0x01, bDescriptorType); @@ -49,18 +49,18 @@ WUT_CHECK_OFFSET(UhsDeviceDescriptor, 0x0F, iProduct); WUT_CHECK_OFFSET(UhsDeviceDescriptor, 0x10, iSerialNumber); WUT_CHECK_OFFSET(UhsDeviceDescriptor, 0x11, bNumConfigurations); WUT_CHECK_SIZE(UhsDeviceDescriptor, 0x12); - + /* USB configuration descriptor */ struct WUT_PACKED UhsConfigDescriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint16_t wTotalLength; - uint8_t bNumInterfaces; - uint8_t bConfigurationValue; - uint8_t iConfiguration; - uint8_t bmAttributes; - uint8_t bMaxPower; + uint8_t bLength; + uint8_t bDescriptorType; + uint16_t wTotalLength; + uint8_t bNumInterfaces; + uint8_t bConfigurationValue; + uint8_t iConfiguration; + uint8_t bmAttributes; + uint8_t bMaxPower; }; WUT_CHECK_OFFSET(UhsConfigDescriptor, 0x00, bLength); WUT_CHECK_OFFSET(UhsConfigDescriptor, 0x01, bDescriptorType); @@ -75,15 +75,15 @@ WUT_CHECK_SIZE(UhsConfigDescriptor, 0x09); /* USB interface descriptor */ struct WUT_PACKED UhsInterfaceDescriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bInterfaceNumber; - uint8_t bAlternateSetting; - uint8_t bNumEndpoints; - uint8_t bInterfaceClass; - uint8_t bInterfaceSubClass; - uint8_t bInterfaceProtocol; - uint8_t iInterface; + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bInterfaceNumber; + uint8_t bAlternateSetting; + uint8_t bNumEndpoints; + uint8_t bInterfaceClass; + uint8_t bInterfaceSubClass; + uint8_t bInterfaceProtocol; + uint8_t iInterface; }; WUT_CHECK_OFFSET(UhsInterfaceDescriptor, 0x00, bLength); WUT_CHECK_OFFSET(UhsInterfaceDescriptor, 0x01, bDescriptorType); @@ -99,11 +99,11 @@ WUT_CHECK_SIZE(UhsInterfaceDescriptor, 0x09); /* USB setup packet */ struct WUT_PACKED UhsSetupPacket { - uint8_t bmRequestType; - uint8_t bRequest; - uint16_t wValue; - uint16_t wIndex; - uint16_t wLength; + uint8_t bmRequestType; + uint8_t bRequest; + uint16_t wValue; + uint16_t wIndex; + uint16_t wLength; }; WUT_CHECK_OFFSET(UhsSetupPacket, 0x00, bmRequestType); WUT_CHECK_OFFSET(UhsSetupPacket, 0x01, bRequest); diff --git a/include/ntag/ntag.h b/include/ntag/ntag.h index f62e25e40..89c30e8b4 100644 --- a/include/ntag/ntag.h +++ b/include/ntag/ntag.h @@ -183,7 +183,8 @@ struct NTAGRawDataT2T uint8_t internal; uint8_t lockBytes[2]; uint8_t capabilityContainer[4]; - struct WUT_PACKED { + struct WUT_PACKED + { uint8_t magic; uint16_t writes; uint8_t figureVersion; @@ -195,7 +196,8 @@ struct NTAGRawDataT2T uint32_t crc; uint16_t name[10]; } section0; - struct WUT_PACKED { + struct WUT_PACKED + { uint8_t tagHmac[0x20]; uint8_t characterID[3]; uint8_t figureType; @@ -206,7 +208,8 @@ struct NTAGRawDataT2T uint8_t keygenSalt[0x20]; uint8_t dataHmac[0x20]; } section1; - struct WUT_PACKED { + struct WUT_PACKED + { FFLStoreData mii; uint64_t titleID; uint16_t applicationAreaWrites; @@ -297,10 +300,9 @@ WUT_CHECK_SIZE(NTAGDataT2T, 0x5E0); * \param userContext * User provided value. */ -typedef void -(*NTAGCallbackFn)(VPADChan chan, - NTAGError error, - void *userContext); +typedef void (*NTAGCallbackFn)(VPADChan chan, + NTAGError error, + void *userContext); /** * Callback function for \link NTAGRead \endlink. @@ -317,11 +319,10 @@ typedef void * \param userContext * User provided value. */ -typedef void -(*NTAGReadCallbackFn)(VPADChan chan, - NTAGError error, - NTAGData *data, - void *userContext); +typedef void (*NTAGReadCallbackFn)(VPADChan chan, + NTAGError error, + NTAGData *data, + void *userContext); /** * Callback function for \link NTAGReadT2T \endlink. @@ -338,11 +339,10 @@ typedef void * \param userContext * User provided value. */ -typedef void -(*NTAGReadT2TCallbackFn)(VPADChan chan, - NTAGError error, - NTAGDataT2T *data, - void *userContext); +typedef void (*NTAGReadT2TCallbackFn)(VPADChan chan, + NTAGError error, + NTAGDataT2T *data, + void *userContext); /** * Callback function for \link NTAGReadT2TRawData \endlink. @@ -362,12 +362,11 @@ typedef void * \param userContext * User provided value. */ -typedef void -(*NTAGReadT2TRawDataCallbackFn)(VPADChan chan, - NTAGError error, - NFCTagInfo *tagInfo, - NTAGRawDataContainerT2T *rawData, - void *userContext); +typedef void (*NTAGReadT2TRawDataCallbackFn)(VPADChan chan, + NTAGError error, + NFCTagInfo *tagInfo, + NTAGRawDataContainerT2T *rawData, + void *userContext); /** * Initializes the NTAG library. diff --git a/include/padscore/kpad.h b/include/padscore/kpad.h index 0de8ac1a2..0833fbb83 100644 --- a/include/padscore/kpad.h +++ b/include/padscore/kpad.h @@ -49,11 +49,11 @@ typedef enum KPADError typedef enum KPADControlMplsStatus { //! When `KPADEnableMpls()` is called. - KPAD_CONTROL_MPLS_STATUS_STARTED = 0, + KPAD_CONTROL_MPLS_STATUS_STARTED = 0, //! When MotionPlus mode was set correctly, or wiimote disconnected prematurely. - KPAD_CONTROL_MPLS_STATUS_FINISHED = 1, + KPAD_CONTROL_MPLS_STATUS_FINISHED = 1, //! When `KPADEnableMpls(chan, WPAD_MPLS_MODE_MPLS_ONLY)` failed. - KPAD_CONTROL_MPLS_STATUS_FAILED_MPLS_ONLY = -1, + KPAD_CONTROL_MPLS_STATUS_FAILED_MPLS_ONLY = -1, //! When `KPADEnableMpls(chan, WPAD_MPLS_MODE_MPLS_NUNCHUK)` failed. KPAD_CONTROL_MPLS_STATUS_FAILED_MPLS_NUNCHUK = -2, //! When `KPADEnableMpls(chan, WPAD_MPLS_MODE_MPLS_CLASSIC)` failed. @@ -220,11 +220,11 @@ struct KPADStatus { //! Averaged corrected (total) weight, but it's always zero because calibration //! never completes. - double avgTGCWeight; + double avgTGCWeight; //! Instantaneous uncorrected weights. - double weights[WPAD_MAX_PRESSURE_SENSORS]; + double weights[WPAD_MAX_PRESSURE_SENSORS]; //! Time-smoothed uncorrected weights, very slow to stabilize. - double avgWeights[WPAD_MAX_PRESSURE_SENSORS]; + double avgWeights[WPAD_MAX_PRESSURE_SENSORS]; //! Error generated from reading weights. int32_t error; //! Status of calibration: negative is error, otherwise is [0, 3], but KPAD never @@ -315,14 +315,16 @@ WUT_CHECK_SIZE(KPADStatus, 0xF0); * - `KPADInitEx()` * - `KPADGetUnifiedWpadStatus()` */ -struct KPADUnifiedWpadStatus { - union { - WPADStatus core; - WPADStatusNunchuk nunchuk; - WPADStatusClassic classic; - WPADStatusPro pro; +struct KPADUnifiedWpadStatus +{ + union + { + WPADStatus core; + WPADStatusNunchuk nunchuk; + WPADStatusClassic classic; + WPADStatusPro pro; WPADStatusBalanceBoard balance; - WPADStatusTrain train; + WPADStatusTrain train; }; //! One of `WPADDataFormat`. uint8_t format; diff --git a/include/padscore/wbc.h b/include/padscore/wbc.h index b9f1afa32..07b4abf8c 100644 --- a/include/padscore/wbc.h +++ b/include/padscore/wbc.h @@ -17,7 +17,7 @@ extern "C" { typedef enum WBCError { - WBC_ERROR_NONE = 0, + WBC_ERROR_NONE = 0, WBC_ERROR_NO_CONTROLLER = -1, WBC_ERROR_NOT_READY = -2, WBC_ERROR_BAD_TEMPERATURE = -3, diff --git a/include/padscore/wpad.h b/include/padscore/wpad.h index d449c5d03..73bbd5361 100644 --- a/include/padscore/wpad.h +++ b/include/padscore/wpad.h @@ -14,7 +14,7 @@ extern "C" { #endif -#define WPAD_MAX_IR_DOTS 4 +#define WPAD_MAX_IR_DOTS 4 #define WPAD_MAX_PRESSURE_SENSORS 4 typedef struct WPADStatusProController WPADStatusProController; @@ -37,7 +37,7 @@ typedef WPADStatusProController WPADStatusPro; typedef enum WPADError { - WPAD_ERROR_NONE = 0, + WPAD_ERROR_NONE = 0, WPAD_ERROR_NO_CONTROLLER = -1, WPAD_ERROR_NOT_READY = -2, WPAD_ERROR_TRANSFER = -3, @@ -426,9 +426,9 @@ struct WPADIRDot //! Position (in a 1024x768 grid). WPADVec2D pos; //! Pixel area (in a 128x96 grid). - uint16_t pixels; + uint16_t pixels; //! Identifier. - uint8_t id; + uint8_t id; WUT_PADDING_BYTES(1); }; WUT_CHECK_OFFSET(WPADIRDot, 0x0, pos); @@ -466,15 +466,15 @@ WUT_CHECK_SIZE(WPADIRDotEx, 0x0C); struct WPADStatus { //! Bitset from `WPADButton`. - uint16_t buttons; + uint16_t buttons; //! Accelerometer data. WPADVec3D acc; //! IR dots tracked. WPADIRDot ir[WPAD_MAX_IR_DOTS]; //! One of `WPADExtensionType`. - uint8_t extensionType; + uint8_t extensionType; //! Error of the last `WPADRead()`. - int8_t error; + int8_t error; }; WUT_CHECK_OFFSET(WPADStatus, 0x00, buttons); WUT_CHECK_OFFSET(WPADStatus, 0x02, acc); @@ -513,7 +513,7 @@ struct WPADStatusNunchuk //! Wii Remote core state + nunchuk buttons. WPADStatus core; //! Accelerometer data. - WPADVec3D acc; + WPADVec3D acc; struct { //! x, in the range [-128, 127]. @@ -543,13 +543,13 @@ struct WPADStatusClassic { WPADStatus core; //! Bitset from `WPADClassicButton`. - uint16_t buttons; + uint16_t buttons; //! Left stick: [-512, 511] x [-512, 511] - WPADVec2D leftStick; + WPADVec2D leftStick; //! Right stick: [-512, 511] x [-512, 511] - WPADVec2D rightStick; - uint8_t leftTrigger; - uint8_t rightTrigger; + WPADVec2D rightStick; + uint8_t leftTrigger; + uint8_t rightTrigger; }; WUT_CHECK_OFFSET(WPADStatusClassic, 0x00, core); WUT_CHECK_OFFSET(WPADStatusClassic, 0x2a, buttons); @@ -570,13 +570,13 @@ struct WPADStatusProController WPADStatus core; WUT_PADDING_BYTES(2); //! Bitset from `WPADProButton`. - uint32_t buttons; + uint32_t buttons; //! Left stick: [-2048, 2047] x [-2048 x 2047] - WPADVec2D leftStick; + WPADVec2D leftStick; //! Right stick: [-2048, 2047] x [-2048 x 2047] - WPADVec2D rightStick; - BOOL charging; - BOOL wired; + WPADVec2D rightStick; + BOOL charging; + BOOL wired; }; WUT_CHECK_OFFSET(WPADStatusProController, 0x00, core); WUT_CHECK_OFFSET(WPADStatusProController, 0x2C, buttons); @@ -616,17 +616,17 @@ struct WPADStatusMotionPlus struct { //! Bitset from `WPADClassicButton`. - uint16_t buttons; + uint16_t buttons; //! Left stick: [-512, 511] x [-512, 511] WPADVec2D leftStick; //! Right stick: [-512, 511] x [-512, 511] WPADVec2D rightStick; - uint8_t leftTrigger; - uint8_t rightTrigger; + uint8_t leftTrigger; + uint8_t rightTrigger; } classic; }; //! Bitset from WPADMplsStatus - uint8_t status; + uint8_t status; WUT_PADDING_BYTES(1); WPADVec3D angle; }; @@ -652,11 +652,11 @@ struct WPADStatusBalanceBoard { WPADStatus core; //! Raw pressure data. \sa `WBCRead()`. - uint16_t pressure[WPAD_MAX_PRESSURE_SENSORS]; + uint16_t pressure[WPAD_MAX_PRESSURE_SENSORS]; //! Raw temperature data. \sa `WBCSetupCalibration()`. - int8_t temperature; + int8_t temperature; //! Raw battery charge. \sa `WBCGetBatteryLevel()`. - uint8_t battery; + uint8_t battery; }; WUT_CHECK_OFFSET(WPADStatusBalanceBoard, 0x00, core); WUT_CHECK_OFFSET(WPADStatusBalanceBoard, 0x2a, pressure); @@ -674,11 +674,11 @@ struct WPADStatusTrain { WPADStatus core; //! Bitset from `WPADClassicButton`. - uint16_t buttons; + uint16_t buttons; //! Brake (left) lever. - uint8_t brake; + uint8_t brake; //! Throttle (right) lever. - uint8_t throttle; + uint8_t throttle; }; WUT_CHECK_OFFSET(WPADStatusTrain, 0x00, core); WUT_CHECK_OFFSET(WPADStatusTrain, 0x2a, buttons); @@ -694,10 +694,10 @@ struct WPADInfo uint32_t extensionAttached; uint32_t batteryLow; uint32_t batteryNearEmpty; - uint8_t batteryLevel; - uint8_t led; - uint8_t protocol; - uint8_t firmware; + uint8_t batteryLevel; + uint8_t led; + uint8_t protocol; + uint8_t firmware; }; WUT_CHECK_OFFSET(WPADInfo, 0x00, irEnabled); WUT_CHECK_OFFSET(WPADInfo, 0x04, speakerEnabled); @@ -723,7 +723,7 @@ struct WPADiQueue uint8_t frontIndex; uint8_t backIndex; WUT_PADDING_BYTES(2); - WPADiQueueElement* elements; + WPADiQueueElement *elements; uint32_t capacity; }; WUT_CHECK_OFFSET(WPADiQueue, 0x00, frontIndex); @@ -1047,7 +1047,7 @@ WPADGetPowerSaveMode(WPADChan channel); */ void WPADGetAddress(WPADChan channel, - WPADAddress* outAddress); + WPADAddress *outAddress); /** * Enables/disables motors globally. @@ -1117,8 +1117,8 @@ WPADStartSyncDevice(void); * \endcode */ BOOL -WPADStartSyncDeviceEx(WPADAddress* deviceAddress, - const char* deviceName); +WPADStartSyncDeviceEx(WPADAddress *deviceAddress, + const char *deviceName); /** * Sets function to be run upon controller connect/disconnect @@ -1328,7 +1328,7 @@ WPADiSendReadData(WPADiQueue *cmdQueue, * Game code (identifier), which may be saved to the EEPROM of connected controllers * \return pointer to the game code */ -uint32_t* +uint32_t * WPADiGetGameCode(void); /** diff --git a/include/poll.h b/include/poll.h index f601fc4b7..4e2b93a1c 100644 --- a/include/poll.h +++ b/include/poll.h @@ -1,11 +1,11 @@ #pragma once -#define POLLIN 0x01 -#define POLLPRI 0x02 -#define POLLOUT 0x04 -#define POLLERR 0x08 -#define POLLHUP 0x10 -#define POLLNVAL 0x20 +#define POLLIN 0x01 +#define POLLPRI 0x02 +#define POLLOUT 0x04 +#define POLLERR 0x08 +#define POLLHUP 0x10 +#define POLLNVAL 0x20 typedef unsigned long nfds_t; @@ -28,4 +28,3 @@ poll(struct pollfd *fds, #ifdef __cplusplus } #endif - diff --git a/include/sndcore2/core.h b/include/sndcore2/core.h index 25d4c1371..b3b2ea16d 100644 --- a/include/sndcore2/core.h +++ b/include/sndcore2/core.h @@ -19,7 +19,7 @@ typedef struct AXInitParams AXInitParams; typedef struct AXTransitionAudioBuffer AXTransitionAudioBuffer; typedef struct AXTransitionAudioBufferDevice AXTransitionAudioBufferDevice; -typedef void(*AXFrameCallback)(void); +typedef void (*AXFrameCallback)(void); //! A value from enum AX_INIT_RENDERER. typedef uint32_t AXInitRenderer; @@ -29,19 +29,19 @@ typedef uint32_t AXInitPipeline; enum AX_INIT_RENDERER { - AX_INIT_RENDERER_32KHZ = 0, - AX_INIT_RENDERER_48KHZ = 1, + AX_INIT_RENDERER_32KHZ = 0, + AX_INIT_RENDERER_48KHZ = 1, }; enum AX_INIT_PIPELINE { - AX_INIT_PIPELINE_SINGLE = 0, - AX_INIT_PIPELINE_FOUR_STAGE = 1, + AX_INIT_PIPELINE_SINGLE = 0, + AX_INIT_PIPELINE_FOUR_STAGE = 1, }; struct AXProfile { - // Unknown + // Unknown }; struct AXInitParams @@ -54,23 +54,25 @@ WUT_CHECK_OFFSET(AXInitParams, 0x00, renderer); WUT_CHECK_OFFSET(AXInitParams, 0x08, pipeline); WUT_CHECK_SIZE(AXInitParams, 0x0C); -struct WUT_PACKED AXTransitionAudioBufferDevice { - AXDeviceMode mode; - float unk1; - uint32_t unk2; - BOOL enabled; +struct WUT_PACKED AXTransitionAudioBufferDevice +{ + AXDeviceMode mode; + float unk1; + uint32_t unk2; + BOOL enabled; }; WUT_CHECK_SIZE(AXTransitionAudioBufferDevice, 0x10); -struct WUT_PACKED AXTransitionAudioBuffer { - uint32_t unk1; - uint32_t unk2; - uint32_t length; - uint32_t loopPoint; - void *audioBuffer; - uint32_t audioBufferLen; - AXTransitionAudioBufferDevice tv; - AXTransitionAudioBufferDevice drc; +struct WUT_PACKED AXTransitionAudioBuffer +{ + uint32_t unk1; + uint32_t unk2; + uint32_t length; + uint32_t loopPoint; + void *audioBuffer; + uint32_t audioBufferLen; + AXTransitionAudioBufferDevice tv; + AXTransitionAudioBufferDevice drc; }; WUT_CHECK_OFFSET(AXTransitionAudioBuffer, 0x00, unk1); WUT_CHECK_OFFSET(AXTransitionAudioBuffer, 0x04, unk2); diff --git a/include/sndcore2/device.h b/include/sndcore2/device.h index 14817d98b..52a7da8df 100644 --- a/include/sndcore2/device.h +++ b/include/sndcore2/device.h @@ -13,8 +13,8 @@ extern "C" { #endif -typedef void(*AXDeviceFinalMixCallback)(void*); -typedef void(*AXAuxCallback)(void*, void*); +typedef void (*AXDeviceFinalMixCallback)(void *); +typedef void (*AXAuxCallback)(void *, void *); //! A value from enum AX_DEVICE_MODE. typedef uint32_t AXDeviceMode; @@ -30,9 +30,9 @@ enum AX_DEVICE_MODE enum AX_DEVICE_TYPE { - AX_DEVICE_TYPE_TV = 0, - AX_DEVICE_TYPE_DRC = 1, - AX_DEVICE_TYPE_CONTROLLER = 2, + AX_DEVICE_TYPE_TV = 0, + AX_DEVICE_TYPE_DRC = 1, + AX_DEVICE_TYPE_CONTROLLER = 2, }; AXResult diff --git a/include/sndcore2/result.h b/include/sndcore2/result.h index ea9873fcc..85940ab99 100644 --- a/include/sndcore2/result.h +++ b/include/sndcore2/result.h @@ -17,11 +17,11 @@ typedef int32_t AXResult; enum AX_RESULT { - AX_RESULT_SUCCESS = 0, - AX_RESULT_INVALID_DEVICE_TYPE = -1, - AX_RESULT_INVALID_DRC_VS_MODE = -13, - AX_RESULT_VOICE_IS_RUNNING = -18, - AX_RESULT_DELAY_TOO_BIG = -19, + AX_RESULT_SUCCESS = 0, + AX_RESULT_INVALID_DEVICE_TYPE = -1, + AX_RESULT_INVALID_DRC_VS_MODE = -13, + AX_RESULT_VOICE_IS_RUNNING = -18, + AX_RESULT_DELAY_TOO_BIG = -19, }; #ifdef __cplusplus diff --git a/include/sndcore2/voice.h b/include/sndcore2/voice.h index f4fd2438a..a16d12ccd 100644 --- a/include/sndcore2/voice.h +++ b/include/sndcore2/voice.h @@ -45,49 +45,49 @@ typedef int32_t AXVoiceSrcRatioResult; //! A value from enum AX_VOICE_TYPE. typedef uint32_t AXVoiceType; -typedef void(*AXVoiceCallbackFn)(void *); -typedef void(*AXVoiceCallbackExFn)(void *, uint32_t, uint32_t); +typedef void (*AXVoiceCallbackFn)(void *); +typedef void (*AXVoiceCallbackExFn)(void *, uint32_t, uint32_t); enum AX_VOICE_FORMAT { - AX_VOICE_FORMAT_ADPCM = 0, - AX_VOICE_FORMAT_LPCM16 = 10, - AX_VOICE_FORMAT_LPCM8 = 25, + AX_VOICE_FORMAT_ADPCM = 0, + AX_VOICE_FORMAT_LPCM16 = 10, + AX_VOICE_FORMAT_LPCM8 = 25, }; enum AX_VOICE_LOOP { - AX_VOICE_LOOP_DISABLED = 0, - AX_VOICE_LOOP_ENABLED = 1, + AX_VOICE_LOOP_DISABLED = 0, + AX_VOICE_LOOP_ENABLED = 1, }; enum AX_VOICE_RENDERER { - AX_VOICE_RENDERER_DSP = 0, - AX_VOICE_RENDERER_CPU = 1, - AX_VOICE_RENDERER_AUTO = 2, + AX_VOICE_RENDERER_DSP = 0, + AX_VOICE_RENDERER_CPU = 1, + AX_VOICE_RENDERER_AUTO = 2, }; enum AX_VOICE_RATIO_RESULT { - AX_VOICE_RATIO_RESULT_SUCCESS = 0, - AX_VOICE_RATIO_RESULT_LESS_THAN_ZERO = -1, - AX_VOICE_RATIO_RESULT_GREATER_THAN_SOMETHING = -2, + AX_VOICE_RATIO_RESULT_SUCCESS = 0, + AX_VOICE_RATIO_RESULT_LESS_THAN_ZERO = -1, + AX_VOICE_RATIO_RESULT_GREATER_THAN_SOMETHING = -2, }; enum AX_VOICE_SRC_TYPE { - AX_VOICE_SRC_TYPE_NONE = 0, - AX_VOICE_SRC_TYPE_LINEAR = 1, - AX_VOICE_SRC_TYPE_UNK0 = 2, - AX_VOICE_SRC_TYPE_UNK1 = 3, - AX_VOICE_SRC_TYPE_UNK2 = 4, + AX_VOICE_SRC_TYPE_NONE = 0, + AX_VOICE_SRC_TYPE_LINEAR = 1, + AX_VOICE_SRC_TYPE_UNK0 = 2, + AX_VOICE_SRC_TYPE_UNK1 = 3, + AX_VOICE_SRC_TYPE_UNK2 = 4, }; enum AX_VOICE_STATE { - AX_VOICE_STATE_STOPPED = 0, - AX_VOICE_STATE_PLAYING = 1, + AX_VOICE_STATE_STOPPED = 0, + AX_VOICE_STATE_PLAYING = 1, }; enum AX_VOICE_TYPE diff --git a/include/swkbd/rpl_interface.h b/include/swkbd/rpl_interface.h index c5eef5a3e..803e06afc 100644 --- a/include/swkbd/rpl_interface.h +++ b/include/swkbd/rpl_interface.h @@ -14,45 +14,80 @@ namespace Rpl { -bool SwkbdAppearInputForm(const nn::swkbd::AppearArg &appearArg); -bool SwkbdAppearKeyboard(const nn::swkbd::KeyboardArg &keyboardArg); -void SwkbdCalcSubThreadFont(); -void SwkbdCalcSubThreadPredict(); -void SwkbdCalc(const nn::swkbd::ControllerInfo &controllerInfo); -void SwkbdConfirmUnfixAll(); -void SwkbdCreate(void *buffer, nn::swkbd::RegionType regionType, - uint32_t unk, FSClient *fsClient); -void SwkbdDestroy(); -bool SwkbdDisappearInputForm(); -bool SwkbdDisappearKeyboard(); -void SwkbdDrawDRC(); -void SwkbdDrawTV(); -void SwkbdGetDrawStringInfo(nn::swkbd::DrawStringInfo *drawStringInfo); -const char16_t *SwkbdGetInputFormString(); -void SwkbdGetKeyboardCondition(nn::swkbd::KeyboardCondition *keyboardCondition); -nn::swkbd::State SwkbdGetStateInputForm(); -nn::swkbd::State SwkbdGetStateKeyboard(); -void SwkbdInactivateSelectCursor(); -bool SwkbdInitLearnDic(void *buffer); -bool SwkbdIsCoveredWithSubWindow(); -bool SwkbdIsDecideCancelButton(bool *outIsSelectCursor); -bool SwkbdIsDecideOkButton(bool *outIsSelectCursor); -bool SwkbdIsKeyboardTarget(nn::swkbd::IEventReceiver *eventReceiver); -bool SwkbdIsNeedCalcSubThreadFont(); -bool SwkbdIsNeedCalcSubThreadPredict(); -bool SwkbdIsSelectCursorActive(); -void SwkbdMuteAllSound(bool muted); -void SwkbdSetControllerRemo(nn::swkbd::ControllerType type); -void SwkbdSetCursorPos(int pos); -void SwkbdSetEnableOkButton(bool enable); -void SwkbdSetInputFormString(const char16_t *str); -void SwkbdSetReceiver(const nn::swkbd::ReceiverArg &receiver); -void SwkbdSetSelectFrom(int from); -void SwkbdSetUserControllerEventObj(nn::swkbd::IControllerEventObj *userControllerEventObj); -void SwkbdSetUserSoundObj(nn::swkbd::ISoundObj *userSoundObj); -void SwkbdSetVersion(int version); +bool +SwkbdAppearInputForm(const nn::swkbd::AppearArg &appearArg); +bool +SwkbdAppearKeyboard(const nn::swkbd::KeyboardArg &keyboardArg); +void +SwkbdCalcSubThreadFont(); +void +SwkbdCalcSubThreadPredict(); +void +SwkbdCalc(const nn::swkbd::ControllerInfo &controllerInfo); +void +SwkbdConfirmUnfixAll(); +void +SwkbdCreate(void *buffer, nn::swkbd::RegionType regionType, uint32_t unk, FSClient *fsClient); +void +SwkbdDestroy(); +bool +SwkbdDisappearInputForm(); +bool +SwkbdDisappearKeyboard(); +void +SwkbdDrawDRC(); +void +SwkbdDrawTV(); +void +SwkbdGetDrawStringInfo(nn::swkbd::DrawStringInfo *drawStringInfo); +const char16_t * +SwkbdGetInputFormString(); +void +SwkbdGetKeyboardCondition(nn::swkbd::KeyboardCondition *keyboardCondition); +nn::swkbd::State +SwkbdGetStateInputForm(); +nn::swkbd::State +SwkbdGetStateKeyboard(); +void +SwkbdInactivateSelectCursor(); +bool +SwkbdInitLearnDic(void *buffer); +bool +SwkbdIsCoveredWithSubWindow(); +bool +SwkbdIsDecideCancelButton(bool *outIsSelectCursor); +bool +SwkbdIsDecideOkButton(bool *outIsSelectCursor); +bool +SwkbdIsKeyboardTarget(nn::swkbd::IEventReceiver *eventReceiver); +bool +SwkbdIsNeedCalcSubThreadFont(); +bool +SwkbdIsNeedCalcSubThreadPredict(); +bool +SwkbdIsSelectCursorActive(); +void +SwkbdMuteAllSound(bool muted); +void +SwkbdSetControllerRemo(nn::swkbd::ControllerType type); +void +SwkbdSetCursorPos(int pos); +void +SwkbdSetEnableOkButton(bool enable); +void +SwkbdSetInputFormString(const char16_t *str); +void +SwkbdSetReceiver(const nn::swkbd::ReceiverArg &receiver); +void +SwkbdSetSelectFrom(int from); +void +SwkbdSetUserControllerEventObj(nn::swkbd::IControllerEventObj *userControllerEventObj); +void +SwkbdSetUserSoundObj(nn::swkbd::ISoundObj *userSoundObj); +void +SwkbdSetVersion(int version); -} +} // namespace Rpl #endif // ifdef __cplusplus diff --git a/include/sys/filio.h b/include/sys/filio.h index c2e486d42..b9898ed97 100644 --- a/include/sys/filio.h +++ b/include/sys/filio.h @@ -3,19 +3,20 @@ #include /* Generic file-descriptor ioctl's. */ -#define FIOCLEX _IO('f', 1) /* set close on exec on fd */ -#define FIONCLEX _IO('f', 2) /* remove close on exec */ -#define FIONREAD _IOR('f', 127, int) /* get # bytes to read */ -#define FIONWRITE _IOR('f', 119, int) /* get # bytes (yet) to write */ -#define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */ -#define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */ -#define FIOSETOWN _IOW('f', 124, int) /* set owner */ -#define FIOGETOWN _IOR('f', 123, int) /* get owner */ -#define FIODTYPE _IOR('f', 122, int) /* get d_flags type part */ -#define FIOGETLBA _IOR('f', 121, int) /* get start blk # */ -struct fiodgname_arg { - int len; - void *buf; +#define FIOCLEX _IO('f', 1) /* set close on exec on fd */ +#define FIONCLEX _IO('f', 2) /* remove close on exec */ +#define FIONREAD _IOR('f', 127, int) /* get # bytes to read */ +#define FIONWRITE _IOR('f', 119, int) /* get # bytes (yet) to write */ +#define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */ +#define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */ +#define FIOSETOWN _IOW('f', 124, int) /* set owner */ +#define FIOGETOWN _IOR('f', 123, int) /* get owner */ +#define FIODTYPE _IOR('f', 122, int) /* get d_flags type part */ +#define FIOGETLBA _IOR('f', 121, int) /* get start blk # */ +struct fiodgname_arg +{ + int len; + void *buf; }; -#define FIODGNAME _IOW('f', 120, struct fiodgname_arg) /* get dev. name */ -#define FIONSPACE _IOR('f', 118, int) /* get space in send queue */ +#define FIODGNAME _IOW('f', 120, struct fiodgname_arg) /* get dev. name */ +#define FIONSPACE _IOR('f', 118, int) /* get space in send queue */ diff --git a/include/sys/ioccom.h b/include/sys/ioccom.h index c47fd895a..d95447486 100644 --- a/include/sys/ioccom.h +++ b/include/sys/ioccom.h @@ -5,35 +5,35 @@ * any in or out parameters in the upper word. The high 3 bits of the * upper word are used to encode the in/out status of the parameter. */ -#define IOCPARM_SHIFT 13 /* number of bits for ioctl size */ -#define IOCPARM_MASK ((1 << IOCPARM_SHIFT) - 1) /* parameter length mask */ -#define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK) -#define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16)) -#define IOCGROUP(x) (((x) >> 8) & 0xff) +#define IOCPARM_SHIFT 13 /* number of bits for ioctl size */ +#define IOCPARM_MASK ((1 << IOCPARM_SHIFT) - 1) /* parameter length mask */ +#define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK) +#define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16)) +#define IOCGROUP(x) (((x) >> 8) & 0xff) -#define IOCPARM_MAX (1 << IOCPARM_SHIFT) /* max size of ioctl */ -#define IOC_VOID 0x20000000 /* no parameters */ -#define IOC_OUT 0x40000000 /* copy out parameters */ -#define IOC_IN 0x80000000 /* copy in parameters */ -#define IOC_INOUT (IOC_IN|IOC_OUT) -#define IOC_DIRMASK (IOC_VOID|IOC_OUT|IOC_IN) +#define IOCPARM_MAX (1 << IOCPARM_SHIFT) /* max size of ioctl */ +#define IOC_VOID 0x20000000 /* no parameters */ +#define IOC_OUT 0x40000000 /* copy out parameters */ +#define IOC_IN 0x80000000 /* copy in parameters */ +#define IOC_INOUT (IOC_IN | IOC_OUT) +#define IOC_DIRMASK (IOC_VOID | IOC_OUT | IOC_IN) -#define _IOC(inout,group,num,len) ((int) \ - ((inout) | (((len) & IOCPARM_MASK) << 16) | ((group) << 8) | (num))) -#define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0) -#define _IOWINT(g,n) _IOC(IOC_VOID, (g), (n), sizeof(int)) -#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t)) -#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t)) +#define _IOC(inout, group, num, len) ((int)((inout) | (((len) & IOCPARM_MASK) << 16) | ((group) << 8) | (num))) +#define _IO(g, n) _IOC(IOC_VOID, (g), (n), 0) +#define _IOWINT(g, n) _IOC(IOC_VOID, (g), (n), sizeof(int)) +#define _IOR(g, n, t) _IOC(IOC_OUT, (g), (n), sizeof(t)) +#define _IOW(g, n, t) _IOC(IOC_IN, (g), (n), sizeof(t)) /* this should be _IORW, but stdio got there first */ -#define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t)) +#define _IOWR(g, n, t) _IOC(IOC_INOUT, (g), (n), sizeof(t)) #ifdef __cplusplus extern "C" { #endif -int ioctl(int fd, - int request, - ...); +int +ioctl(int fd, + int request, + ...); #ifdef __cplusplus } diff --git a/include/sys/socket.h b/include/sys/socket.h index 08161cde2..f643851cc 100644 --- a/include/sys/socket.h +++ b/include/sys/socket.h @@ -2,56 +2,56 @@ #include #include -#define SOL_SOCKET -1 +#define SOL_SOCKET -1 -#define PF_UNSPEC 0 -#define PF_INET 2 +#define PF_UNSPEC 0 +#define PF_INET 2 -#define AF_UNSPEC PF_UNSPEC -#define AF_INET PF_INET +#define AF_UNSPEC PF_UNSPEC +#define AF_INET PF_INET -#define SOCK_STREAM 1 -#define SOCK_DGRAM 2 +#define SOCK_STREAM 1 +#define SOCK_DGRAM 2 -#define MSG_OOB 0x0001 -#define MSG_PEEK 0x0002 -#define MSG_DONTROUTE 0x0004 -#define MSG_DONTWAIT 0x0020 +#define MSG_OOB 0x0001 +#define MSG_PEEK 0x0002 +#define MSG_DONTROUTE 0x0004 +#define MSG_DONTWAIT 0x0020 -#define SHUT_RD 0 -#define SHUT_WR 1 -#define SHUT_RDWR 2 +#define SHUT_RD 0 +#define SHUT_WR 1 +#define SHUT_RDWR 2 /* * SOL_SOCKET options */ -#define SO_REUSEADDR 0x0004 // reuse address -#define SO_KEEPALIVE 0x0008 // keep connections alive -#define SO_DONTROUTE 0x0010 // route locally only -#define SO_BROADCAST 0x0020 // broadcast -#define SO_LINGER 0x0080 // linger (no effect?) -#define SO_OOBINLINE 0x0100 // out-of-band data inline (no effect?) -#define SO_TCPSACK 0x0200 // set tcp selective acknowledgment -#define SO_WINSCALE 0x0400 // set tcp window scaling -#define SO_SNDBUF 0x1001 // send buffer size -#define SO_RCVBUF 0x1002 // receive buffer size -#define SO_SNDLOWAT 0x1003 // send low-water mark (no effect?) -#define SO_RCVLOWAT 0x1004 // receive low-water mark -#define SO_ERROR 0x1007 // get socket error -#define SO_TYPE 0x1008 // get socket type -#define SO_HOPCNT 0x1009 // get hop count -#define SO_MAXMSG 0x1010 // same as TCP_MAXSEG -#define SO_RXDATA 0x1011 // get count of bytes in sb_rcv -#define SO_TXDATA 0x1012 // get count of bytes in sb_snd -#define SO_MYADDR 0x1013 // get IP address -#define SO_NBIO 0x1014 // set socket to NON-blocking mode -#define SO_BIO 0x1015 // set socket to blocking mode -#define SO_NONBLOCK 0x1016 // set/get blocking mode via optval param -#define SO_UNKNOWN1019 0x1019 // tcp related -#define SO_UNKNOWN101A 0x101A // tcp related -#define SO_UNKNOWN101B 0x101B // tcp related -#define SO_NOSLOWSTART 0x4000 // disable slowstart -#define SO_RUSRBUF 0x10000 // enable somemopt provided memory for receive buffer +#define SO_REUSEADDR 0x0004 // reuse address +#define SO_KEEPALIVE 0x0008 // keep connections alive +#define SO_DONTROUTE 0x0010 // route locally only +#define SO_BROADCAST 0x0020 // broadcast +#define SO_LINGER 0x0080 // linger (no effect?) +#define SO_OOBINLINE 0x0100 // out-of-band data inline (no effect?) +#define SO_TCPSACK 0x0200 // set tcp selective acknowledgment +#define SO_WINSCALE 0x0400 // set tcp window scaling +#define SO_SNDBUF 0x1001 // send buffer size +#define SO_RCVBUF 0x1002 // receive buffer size +#define SO_SNDLOWAT 0x1003 // send low-water mark (no effect?) +#define SO_RCVLOWAT 0x1004 // receive low-water mark +#define SO_ERROR 0x1007 // get socket error +#define SO_TYPE 0x1008 // get socket type +#define SO_HOPCNT 0x1009 // get hop count +#define SO_MAXMSG 0x1010 // same as TCP_MAXSEG +#define SO_RXDATA 0x1011 // get count of bytes in sb_rcv +#define SO_TXDATA 0x1012 // get count of bytes in sb_snd +#define SO_MYADDR 0x1013 // get IP address +#define SO_NBIO 0x1014 // set socket to NON-blocking mode +#define SO_BIO 0x1015 // set socket to blocking mode +#define SO_NONBLOCK 0x1016 // set/get blocking mode via optval param +#define SO_UNKNOWN1019 0x1019 // tcp related +#define SO_UNKNOWN101A 0x101A // tcp related +#define SO_UNKNOWN101B 0x101B // tcp related +#define SO_NOSLOWSTART 0x4000 // disable slowstart +#define SO_RUSRBUF 0x10000 // enable somemopt provided memory for receive buffer typedef uint32_t socklen_t; typedef uint16_t sa_family_t; @@ -59,7 +59,7 @@ typedef uint16_t sa_family_t; struct sockaddr { sa_family_t sa_family; - char sa_data[]; + char sa_data[]; }; struct sockaddr_storage @@ -164,4 +164,3 @@ sockatmark(int sockfd); #ifdef __cplusplus } #endif - diff --git a/include/sysapp/args.h b/include/sysapp/args.h index f5159fb94..25ad2a333 100644 --- a/include/sysapp/args.h +++ b/include/sysapp/args.h @@ -26,36 +26,36 @@ typedef void (*SYSDeserializeCallback)(SYSDeserializeArg *arg, void *userArg); typedef enum SYSArgIDEnum { - SYS_ARG_ID_END = 0x0, - SYS_ARG_ID_ANCHOR = 0x64, - SYS_ARG_ID_RESULT = 0x65, - SYS_ARG_ID_URL = 0xc8, - SYS_ARG_ID_MIV_DATA = 0x12c, - SYS_ARG_ID_JOIN_PID = 0x190, + SYS_ARG_ID_END = 0x0, + SYS_ARG_ID_ANCHOR = 0x64, + SYS_ARG_ID_RESULT = 0x65, + SYS_ARG_ID_URL = 0xc8, + SYS_ARG_ID_MIV_DATA = 0x12c, + SYS_ARG_ID_JOIN_PID = 0x190, } SYSArgIDEnum; typedef enum SYSArgTypeEnum { - SYS_ARG_TYPE_UINT32 = 1, - SYS_ARG_TYPE_UINT64 = 2, - SYS_ARG_TYPE_DATA = 3, - SYS_ARG_TYPE_STRING = 4, + SYS_ARG_TYPE_UINT32 = 1, + SYS_ARG_TYPE_UINT64 = 2, + SYS_ARG_TYPE_DATA = 3, + SYS_ARG_TYPE_STRING = 4, } SYSArgTypeEnum; struct SYSArgDataBlock { SYSArgID id; SYSArgType type; - union + union { uint32_t uint32; uint64_t uint64; - struct + struct { void *ptr; uint32_t size; } data; - struct + struct { const char *ptr; uint32_t size; diff --git a/include/sysapp/launch.h b/include/sysapp/launch.h index 47723f25c..e318ac674 100644 --- a/include/sysapp/launch.h +++ b/include/sysapp/launch.h @@ -2,8 +2,8 @@ #include #include "args.h" -#include "switch.h" #include "nn/ffl/miidata.h" +#include "switch.h" /** * \defgroup sysapp_launch SYSAPP Launch @@ -25,21 +25,23 @@ typedef struct SysAppSettingsArgs SysAppSettingsArgs; typedef struct SysAppParentalArgs SysAppParentalArgs; typedef struct SysAppNotificationArgs SysAppNotificationArgs; -struct SysAppMiiMakerArgs { - SYSStandardArgsIn stdArgs; - uint32_t slotId; - FFLStoreData *mii; +struct SysAppMiiMakerArgs +{ + SYSStandardArgsIn stdArgs; + uint32_t slotId; + FFLStoreData *mii; }; WUT_CHECK_OFFSET(SysAppMiiMakerArgs, 0x0, stdArgs); WUT_CHECK_OFFSET(SysAppMiiMakerArgs, 0x8, slotId); WUT_CHECK_OFFSET(SysAppMiiMakerArgs, 0x0C, mii); WUT_CHECK_SIZE(SysAppMiiMakerArgs, 0x10); -struct _SysAppMiiMakerArgs { - SYSStandardArgsIn stdArgs; - uint32_t mode; - uint32_t slotId; - FFLStoreData *mii; +struct _SysAppMiiMakerArgs +{ + SYSStandardArgsIn stdArgs; + uint32_t mode; + uint32_t slotId; + FFLStoreData *mii; }; WUT_CHECK_OFFSET(_SysAppMiiMakerArgs, 0x0, stdArgs); WUT_CHECK_OFFSET(_SysAppMiiMakerArgs, 0x8, mode); @@ -49,57 +51,60 @@ WUT_CHECK_SIZE(_SysAppMiiMakerArgs, 0x14); typedef enum SYSSettingsJumpToTarget { - // Jumps to the Settings normally - SYS_SETTINGS_JUMP_TO_NONE = 0, - // Jumps to the Internet settings - SYS_SETTINGS_JUMP_TO_INTERNET = 1, - // Jumps to the Data Management - SYS_SETTINGS_JUMP_TO_DATA_MANAGEMENT = 2, - // Jumps to the TV Remote Settings - SYS_SETTINGS_JUMP_TO_TV_REMOTE = 3, - // Jumps to the Data/Time Settings - SYS_SETTINGS_JUMP_TO_DATE_TIME = 4, - // Jumps to Country settings - SYS_SETTINGS_JUMP_TO_COUNTRY = 5, - // Starting a System Update - SYS_SETTINGS_JUMP_TO_SYSTEM_UPDATE = 6, - // Triggers the initial console settings screen - SYS_SETTINGS_JUMP_TO_INITIAL_SETTINGS = 100, - // Valid target, but jumps to the Settings normally - SYS_SETTINGS_JUMP_TO_UNKNOWN = 101, - // Wipes the console without any confirmation - SYS_SETTINGS_JUMP_TO_WIPE_CONSOLE = 102, - // Jumps to Quick Start Settings - SYS_SETTINGS_JUMP_TO_QUICK_START_SETTINGS = 103, - // Jumps to TV Settings - SYS_SETTINGS_JUMP_TO_TV_CONNECTION_TYPE = 104, - // Same as \link SYS_SETTINGS_JUMP_TO_DATA_MANAGEMENT \endlink - SYS_SETTINGS_JUMP_TO_DATA_MANAGEMENT_2 = 105, - // Jumps to Software Transfer Settings - SYS_SETTINGS_JUMP_TO_SOFTWARE_TRANSFER = 255, + // Jumps to the Settings normally + SYS_SETTINGS_JUMP_TO_NONE = 0, + // Jumps to the Internet settings + SYS_SETTINGS_JUMP_TO_INTERNET = 1, + // Jumps to the Data Management + SYS_SETTINGS_JUMP_TO_DATA_MANAGEMENT = 2, + // Jumps to the TV Remote Settings + SYS_SETTINGS_JUMP_TO_TV_REMOTE = 3, + // Jumps to the Data/Time Settings + SYS_SETTINGS_JUMP_TO_DATE_TIME = 4, + // Jumps to Country settings + SYS_SETTINGS_JUMP_TO_COUNTRY = 5, + // Starting a System Update + SYS_SETTINGS_JUMP_TO_SYSTEM_UPDATE = 6, + // Triggers the initial console settings screen + SYS_SETTINGS_JUMP_TO_INITIAL_SETTINGS = 100, + // Valid target, but jumps to the Settings normally + SYS_SETTINGS_JUMP_TO_UNKNOWN = 101, + // Wipes the console without any confirmation + SYS_SETTINGS_JUMP_TO_WIPE_CONSOLE = 102, + // Jumps to Quick Start Settings + SYS_SETTINGS_JUMP_TO_QUICK_START_SETTINGS = 103, + // Jumps to TV Settings + SYS_SETTINGS_JUMP_TO_TV_CONNECTION_TYPE = 104, + // Same as \link SYS_SETTINGS_JUMP_TO_DATA_MANAGEMENT \endlink + SYS_SETTINGS_JUMP_TO_DATA_MANAGEMENT_2 = 105, + // Jumps to Software Transfer Settings + SYS_SETTINGS_JUMP_TO_SOFTWARE_TRANSFER = 255, } SYSSettingsJumpToTarget; -struct SysAppSettingsArgs { - SYSStandardArgsIn stdArgs; - SYSSettingsJumpToTarget jumpTo; - uint32_t firstBootKind; +struct SysAppSettingsArgs +{ + SYSStandardArgsIn stdArgs; + SYSSettingsJumpToTarget jumpTo; + uint32_t firstBootKind; }; WUT_CHECK_OFFSET(SysAppSettingsArgs, 0x0, stdArgs); WUT_CHECK_OFFSET(SysAppSettingsArgs, 0x8, jumpTo); WUT_CHECK_OFFSET(SysAppSettingsArgs, 0x0C, firstBootKind); WUT_CHECK_SIZE(SysAppSettingsArgs, 0x10); -struct SysAppParentalArgs { - SYSStandardArgsIn stdArgs; - uint32_t mode; +struct SysAppParentalArgs +{ + SYSStandardArgsIn stdArgs; + uint32_t mode; }; WUT_CHECK_OFFSET(SysAppParentalArgs, 0x0, stdArgs); WUT_CHECK_OFFSET(SysAppParentalArgs, 0x8, mode); WUT_CHECK_SIZE(SysAppParentalArgs, 0x0C); -struct SysAppNotificationArgs { - SYSStandardArgsIn stdArgs; - uint32_t notificationFile; +struct SysAppNotificationArgs +{ + SYSStandardArgsIn stdArgs; + uint32_t notificationFile; }; WUT_CHECK_OFFSET(SysAppNotificationArgs, 0x0, stdArgs); WUT_CHECK_OFFSET(SysAppNotificationArgs, 0x8, notificationFile); @@ -198,7 +203,7 @@ void _SYSLaunchNotifications(SysAppNotificationArgs *args); void -_SYSLaunchTitleByPathFromLauncher(const char* path, +_SYSLaunchTitleByPathFromLauncher(const char *path, uint32_t unused); #ifdef __cplusplus diff --git a/include/sysapp/switch.h b/include/sysapp/switch.h index f28ed2876..e54873be5 100644 --- a/include/sysapp/switch.h +++ b/include/sysapp/switch.h @@ -27,8 +27,8 @@ typedef struct SysAppEManualArgs SysAppEManualArgs; struct SysAppEManualArgs { - SYSStandardArgsIn stdArgs; - uint64_t titleId; + SYSStandardArgsIn stdArgs; + uint64_t titleId; }; WUT_CHECK_OFFSET(SysAppEManualArgs, 0x0, stdArgs); WUT_CHECK_OFFSET(SysAppEManualArgs, 0x8, titleId); @@ -36,9 +36,9 @@ WUT_CHECK_SIZE(SysAppEManualArgs, 0x10); struct SysAppEShopArgs { - SYSStandardArgsIn stdArgs; - char *query; - uint32_t querySize; + SYSStandardArgsIn stdArgs; + char *query; + uint32_t querySize; }; WUT_CHECK_OFFSET(SysAppEShopArgs, 0x0, stdArgs); WUT_CHECK_OFFSET(SysAppEShopArgs, 0x8, query); @@ -47,9 +47,9 @@ WUT_CHECK_SIZE(SysAppEShopArgs, 0x10); struct SysAppBrowserArgs { - SYSStandardArgsIn stdArgs; - char *url; - uint32_t urlSize; + SYSStandardArgsIn stdArgs; + char *url; + uint32_t urlSize; }; WUT_CHECK_OFFSET(SysAppBrowserArgs, 0x0, stdArgs); WUT_CHECK_OFFSET(SysAppBrowserArgs, 0x8, url); @@ -58,10 +58,10 @@ WUT_CHECK_SIZE(SysAppBrowserArgs, 0x10); struct SysAppBrowserArgsWithCallback { - SysAppBrowserArgs browserArgs; - char *cbUrl; - uint32_t cbUrlSize; - BOOL hbmDisable; + SysAppBrowserArgs browserArgs; + char *cbUrl; + uint32_t cbUrlSize; + BOOL hbmDisable; }; WUT_CHECK_OFFSET(SysAppBrowserArgsWithCallback, 0x0, browserArgs); WUT_CHECK_OFFSET(SysAppBrowserArgsWithCallback, 0x10, cbUrl); @@ -70,7 +70,7 @@ WUT_CHECK_OFFSET(SysAppBrowserArgsWithCallback, 0x18, hbmDisable); WUT_CHECK_SIZE(SysAppBrowserArgsWithCallback, 0x1C); typedef enum SysAppPFID -{ +{ SYSAPP_PFID_WII_U_MENU = 2, SYSAPP_PFID_TVII = 3, SYSAPP_PFID_EMANUAL = 4, @@ -161,21 +161,21 @@ int32_t _SYSSwitchToBrowserForCallbackURLFromHBM(SysAppBrowserArgsWithCallback *); int32_t -_SYSSwitchToHBMWithMode(int32_t); +_SYSSwitchToHBMWithMode(int32_t p1); int32_t -_SYSSwitchToOverlayFromHBM(int32_t); +_SYSSwitchToOverlayFromHBM(int32_t p1); /** * Calls __OSClearCopyData then _SYSSwitchTo */ -int32_t +int32_t SYSSwitchTo(SysAppPFID pfid); -int32_t +int32_t _SYSSwitchTo(SysAppPFID pfid); -int32_t +int32_t _SYSDirectlySwitchTo(SysAppPFID pfid); #ifdef __cplusplus diff --git a/include/sysapp/title.h b/include/sysapp/title.h index 62fc90b7b..eb5ae3959 100644 --- a/include/sysapp/title.h +++ b/include/sysapp/title.h @@ -17,18 +17,18 @@ extern "C" { typedef enum SYSTEM_APP_ID { - SYSTEM_APP_ID_WII_U_MENU = 0, - SYSTEM_APP_ID_SYSTEM_SETTINGS = 1, - SYSTEM_APP_ID_PARENTAL_CONTROLS = 2, - SYSTEM_APP_ID_USER_SETTINGS = 3, - SYSTEM_APP_ID_MII_MAKER = 4, - SYSTEM_APP_ID_ACCOUNT_SETTINGS = 5, - SYSTEM_APP_ID_DAILY_LOG = 6, - SYSTEM_APP_ID_NOTIFICATIONS = 7, - SYSTEM_APP_ID_HEALTH_AND_SAFETY = 8, - SYSTEM_APP_ID_ELECTRONIC_MANUAL = 9, - SYSTEM_APP_ID_WIIU_CHAT = 10, - SYSTEM_APP_ID_SOFTWARE_DATA_TRANSFER = 11, + SYSTEM_APP_ID_WII_U_MENU = 0, + SYSTEM_APP_ID_SYSTEM_SETTINGS = 1, + SYSTEM_APP_ID_PARENTAL_CONTROLS = 2, + SYSTEM_APP_ID_USER_SETTINGS = 3, + SYSTEM_APP_ID_MII_MAKER = 4, + SYSTEM_APP_ID_ACCOUNT_SETTINGS = 5, + SYSTEM_APP_ID_DAILY_LOG = 6, + SYSTEM_APP_ID_NOTIFICATIONS = 7, + SYSTEM_APP_ID_HEALTH_AND_SAFETY = 8, + SYSTEM_APP_ID_ELECTRONIC_MANUAL = 9, + SYSTEM_APP_ID_WIIU_CHAT = 10, + SYSTEM_APP_ID_SOFTWARE_DATA_TRANSFER = 11, } SYSTEM_APP_ID; // for compatibility diff --git a/include/tve/cec.h b/include/tve/cec.h index ab5f1e149..d6da99780 100644 --- a/include/tve/cec.h +++ b/include/tve/cec.h @@ -13,23 +13,23 @@ extern "C" { typedef enum TVECECLogicalAddress { - TVE_CEC_DEVICE_TV = 0x0, - TVE_CEC_DEVICE_RECORDING_DEVICE_1 = 0x1, - TVE_CEC_DEVICE_RECORDING_DEVICE_2 = 0x2, - TVE_CEC_DEVICE_TUNER_1 = 0x3, - TVE_CEC_DEVICE_PLAYBACK_DEVICE_1 = 0x4, - TVE_CEC_DEVICE_AUDIO_SYSTEM = 0x5, - TVE_CEC_DEVICE_TUNER_2 = 0x6, - TVE_CEC_DEVICE_TUNER_3 = 0x7, - TVE_CEC_DEVICE_PLAYBACK_DEVICE_2 = 0x8, - TVE_CEC_DEVICE_RECORDING_DEVICE_3 = 0x9, - TVE_CEC_DEVICE_TUNER_4 = 0xA, - TVE_CEC_DEVICE_PLAYBACK_DEVICE_3 = 0xB, - TVE_CEC_DEVICE_RESERVED_1 = 0xC, - TVE_CEC_DEVICE_RESERVED_2 = 0xD, - TVE_CEC_DEVICE_FREE_USE = 0xE, - TVE_CEC_DEVICE_UNREGISTERED = 0xF, - TVE_CEC_DEVICE_BROADCAST = 0xF, + TVE_CEC_DEVICE_TV = 0x0, + TVE_CEC_DEVICE_RECORDING_DEVICE_1 = 0x1, + TVE_CEC_DEVICE_RECORDING_DEVICE_2 = 0x2, + TVE_CEC_DEVICE_TUNER_1 = 0x3, + TVE_CEC_DEVICE_PLAYBACK_DEVICE_1 = 0x4, + TVE_CEC_DEVICE_AUDIO_SYSTEM = 0x5, + TVE_CEC_DEVICE_TUNER_2 = 0x6, + TVE_CEC_DEVICE_TUNER_3 = 0x7, + TVE_CEC_DEVICE_PLAYBACK_DEVICE_2 = 0x8, + TVE_CEC_DEVICE_RECORDING_DEVICE_3 = 0x9, + TVE_CEC_DEVICE_TUNER_4 = 0xA, + TVE_CEC_DEVICE_PLAYBACK_DEVICE_3 = 0xB, + TVE_CEC_DEVICE_RESERVED_1 = 0xC, + TVE_CEC_DEVICE_RESERVED_2 = 0xD, + TVE_CEC_DEVICE_FREE_USE = 0xE, + TVE_CEC_DEVICE_UNREGISTERED = 0xF, + TVE_CEC_DEVICE_BROADCAST = 0xF, } TVECECLogicalAddress; typedef enum TVECECOpCode diff --git a/include/vpad/input.h b/include/vpad/input.h index bc78fd792..a1e3e87b3 100644 --- a/include/vpad/input.h +++ b/include/vpad/input.h @@ -25,115 +25,115 @@ typedef struct VPADVec3D VPADVec3D; typedef enum VPADButtons { //! The A button. - VPAD_BUTTON_A = 0x8000, + VPAD_BUTTON_A = 0x8000, //! The B button. - VPAD_BUTTON_B = 0x4000, + VPAD_BUTTON_B = 0x4000, //! The X button. - VPAD_BUTTON_X = 0x2000, + VPAD_BUTTON_X = 0x2000, //! The Y button. - VPAD_BUTTON_Y = 0x1000, + VPAD_BUTTON_Y = 0x1000, //! The left button of the D-pad. - VPAD_BUTTON_LEFT = 0x0800, + VPAD_BUTTON_LEFT = 0x0800, //! The right button of the D-pad. - VPAD_BUTTON_RIGHT = 0x0400, + VPAD_BUTTON_RIGHT = 0x0400, //! The up button of the D-pad. - VPAD_BUTTON_UP = 0x0200, + VPAD_BUTTON_UP = 0x0200, //! The down button of the D-pad. - VPAD_BUTTON_DOWN = 0x0100, + VPAD_BUTTON_DOWN = 0x0100, //! The ZL button. - VPAD_BUTTON_ZL = 0x0080, + VPAD_BUTTON_ZL = 0x0080, //! The ZR button. - VPAD_BUTTON_ZR = 0x0040, + VPAD_BUTTON_ZR = 0x0040, //! The L button. - VPAD_BUTTON_L = 0x0020, + VPAD_BUTTON_L = 0x0020, //! The R button. - VPAD_BUTTON_R = 0x0010, + VPAD_BUTTON_R = 0x0010, //! The + button. - VPAD_BUTTON_PLUS = 0x0008, + VPAD_BUTTON_PLUS = 0x0008, //! The - button. - VPAD_BUTTON_MINUS = 0x0004, + VPAD_BUTTON_MINUS = 0x0004, //! The HOME button. - VPAD_BUTTON_HOME = 0x0002, + VPAD_BUTTON_HOME = 0x0002, //! The SYNC button. - VPAD_BUTTON_SYNC = 0x0001, + VPAD_BUTTON_SYNC = 0x0001, //! The right stick button. - VPAD_BUTTON_STICK_R = 0x00020000, + VPAD_BUTTON_STICK_R = 0x00020000, //! The left stick button. - VPAD_BUTTON_STICK_L = 0x00040000, + VPAD_BUTTON_STICK_L = 0x00040000, //! The TV button. - VPAD_BUTTON_TV = 0x00010000, + VPAD_BUTTON_TV = 0x00010000, //! The emulated left button on the right stick. - VPAD_STICK_R_EMULATION_LEFT = 0x04000000, + VPAD_STICK_R_EMULATION_LEFT = 0x04000000, //! The emulated right button on the right stick. - VPAD_STICK_R_EMULATION_RIGHT = 0x02000000, + VPAD_STICK_R_EMULATION_RIGHT = 0x02000000, //! The emulated up button on the right stick. - VPAD_STICK_R_EMULATION_UP = 0x01000000, + VPAD_STICK_R_EMULATION_UP = 0x01000000, //! The emulated down button on the right stick. - VPAD_STICK_R_EMULATION_DOWN = 0x00800000, + VPAD_STICK_R_EMULATION_DOWN = 0x00800000, //! The emulated left button on the left stick. - VPAD_STICK_L_EMULATION_LEFT = 0x40000000, + VPAD_STICK_L_EMULATION_LEFT = 0x40000000, //! The emulated right button on the left stick. - VPAD_STICK_L_EMULATION_RIGHT = 0x20000000, + VPAD_STICK_L_EMULATION_RIGHT = 0x20000000, //! The emulated up button on the left stick. - VPAD_STICK_L_EMULATION_UP = 0x10000000, + VPAD_STICK_L_EMULATION_UP = 0x10000000, //! The emulated down button on the left stick. - VPAD_STICK_L_EMULATION_DOWN = 0x08000000, + VPAD_STICK_L_EMULATION_DOWN = 0x08000000, } VPADButtons; //! Touch pad validity. typedef enum VPADTouchPadValidity { //! Both X and Y touchpad positions are accurate. - VPAD_VALID = 0x0, + VPAD_VALID = 0x0, //! X position is inaccurate. - VPAD_INVALID_X = 0x1, + VPAD_INVALID_X = 0x1, //! Y position is inaccurate. - VPAD_INVALID_Y = 0x2, + VPAD_INVALID_Y = 0x2, } VPADTouchPadValidity; //! Touch pad resolution. typedef enum VPADTouchPadResolution { //! 1920 x 1080 resolution. - VPAD_TP_1920X1080 = 0, + VPAD_TP_1920X1080 = 0, //! 1280 x 720 resolution. - VPAD_TP_1280X720 = 1, + VPAD_TP_1280X720 = 1, //! 854 x 480 resolution. - VPAD_TP_854X480 = 2, + VPAD_TP_854X480 = 2, } VPADTouchPadResolution; //! Read error. typedef enum VPADReadError { //! No error occurred, and data was written to the buffers. - VPAD_READ_SUCCESS = 0, + VPAD_READ_SUCCESS = 0, //! There was no sample new data available to write. - VPAD_READ_NO_SAMPLES = -1, + VPAD_READ_NO_SAMPLES = -1, //! The requested controller or channel was invalid. - VPAD_READ_INVALID_CONTROLLER = -2, + VPAD_READ_INVALID_CONTROLLER = -2, //! VPAD channel is busy, perhaps being accessed by another thread - VPAD_READ_BUSY = -4, + VPAD_READ_BUSY = -4, //! VPAD is uninitialized, need to call VPADInit() - VPAD_READ_UNINITIALIZED = -5, + VPAD_READ_UNINITIALIZED = -5, } VPADReadError; //! LCD mode. typedef enum VPADLcdMode { //! Display is in standby and will turn back on if any buttons are pressed. - VPAD_LCD_STANDBY = 0, + VPAD_LCD_STANDBY = 0, //! Display is completely off and will remain so until explicitly changed. - VPAD_LCD_OFF = 1, + VPAD_LCD_OFF = 1, //! Display is on as normal. - VPAD_LCD_ON = 0xFF, + VPAD_LCD_ON = 0xFF, } VPADLcdMode; //! Gyro zero drift mode. typedef enum VPADGyroZeroDriftMode { - VPAD_GYRO_ZERODRIFT_LOOSE = 0, + VPAD_GYRO_ZERODRIFT_LOOSE = 0, VPAD_GYRO_ZERODRIFT_STANDARD, VPAD_GYRO_ZERODRIFT_TIGHT, VPAD_GYRO_ZERODRIFT_NONE @@ -315,7 +315,7 @@ WUT_CHECK_OFFSET(VPADStatus, 0xA2, micStatus); WUT_CHECK_OFFSET(VPADStatus, 0xA3, slideVolumeEx); WUT_CHECK_SIZE(VPADStatus, 0xAC); -typedef void(*VPADSamplingCallback)(VPADChan chan); +typedef void (*VPADSamplingCallback)(VPADChan chan); /** * Initialises the VPAD library for use. diff --git a/include/vpadbase/base.h b/include/vpadbase/base.h index c6ecb3dd0..498872e18 100644 --- a/include/vpadbase/base.h +++ b/include/vpadbase/base.h @@ -15,17 +15,17 @@ extern "C" { typedef enum VPADChan { //! Channel 0. - VPAD_CHAN_0 = 0, + VPAD_CHAN_0 = 0, //! Channel 1. - VPAD_CHAN_1 = 1, + VPAD_CHAN_1 = 1, } VPADChan; typedef enum { //! Indicates that there is pending data which can be received - VPAD_IRC_STATUS_FLAG_HAS_DATA = 1, + VPAD_IRC_STATUS_FLAG_HAS_DATA = 1, //! Indicates that another device is connected - VPAD_IRC_STATUS_FLAG_CONNECTED = 2, + VPAD_IRC_STATUS_FLAG_CONNECTED = 2, } VPADIRCStatusFlags; /** diff --git a/include/wut.h b/include/wut.h index b66fea3ca..a29e1f284 100644 --- a/include/wut.h +++ b/include/wut.h @@ -6,9 +6,9 @@ * https://github.com/devkitPro/wut */ +#include "wut_rplwrap.h" #include "wut_structsize.h" #include "wut_types.h" -#include "wut_rplwrap.h" #ifdef DEBUG #include #endif diff --git a/include/wut_structsize.h b/include/wut_structsize.h index d28972e89..dfa114a1b 100644 --- a/include/wut_structsize.h +++ b/include/wut_structsize.h @@ -4,33 +4,33 @@ // Ensure structs are correct size & offsets #if defined(static_assert) || defined(__cplusplus) -# define WUT_CHECK_SIZE(Type, Size) \ - static_assert(sizeof(Type) == Size, \ - #Type " must be " #Size " bytes") +#define WUT_CHECK_SIZE(Type, Size) \ + static_assert(sizeof(Type) == Size, \ + #Type " must be " #Size " bytes") -# define WUT_CHECK_OFFSET(Type, Offset, Field) \ - static_assert(offsetof(Type, Field) == Offset, \ - #Type "::" #Field " must be at offset " #Offset) +#define WUT_CHECK_OFFSET(Type, Offset, Field) \ + static_assert(offsetof(Type, Field) == Offset, \ + #Type "::" #Field " must be at offset " #Offset) #else -# define WUT_CHECK_SIZE(Type, Size) -# define WUT_CHECK_OFFSET(Type, Offset, Field) +#define WUT_CHECK_SIZE(Type, Size) +#define WUT_CHECK_OFFSET(Type, Offset, Field) #endif // Workaround weird macro concat ## behaviour -#define WUT_PP_CAT(a, b) WUT_PP_CAT_I(a, b) -#define WUT_PP_CAT_I(a, b) WUT_PP_CAT_II(~, a ## b) -#define WUT_PP_CAT_II(p, res) res +#define WUT_PP_CAT(a, b) WUT_PP_CAT_I(a, b) +#define WUT_PP_CAT_I(a, b) WUT_PP_CAT_II(~, a##b) +#define WUT_PP_CAT_II(p, res) res // Allow us to easily add UNKNOWN / PADDING bytes into our structs, // generates unique variable names using __COUNTER__ -#define WUT_UNKNOWN_BYTES(Size) char WUT_PP_CAT(__unk, __COUNTER__) [Size] +#define WUT_UNKNOWN_BYTES(Size) char WUT_PP_CAT(__unk, __COUNTER__)[Size] #define WUT_PADDING_BYTES(Size) WUT_UNKNOWN_BYTES(Size) // Unknown struct size #define WUT_UNKNOWN_SIZE(x) // Marks a struct as packed -#define WUT_PACKED __attribute__((__packed__)) +#define WUT_PACKED __attribute__((__packed__)) // Sets alignment for a struct #if defined(__alignas_is_defined) || defined(__cplusplus) diff --git a/include/wut_types.h b/include/wut_types.h index 9dbbbee68..b19751d3b 100644 --- a/include/wut_types.h +++ b/include/wut_types.h @@ -1,8 +1,8 @@ #pragma once -#include +#include #include #include -#include +#include typedef int32_t BOOL; @@ -17,30 +17,47 @@ typedef int32_t BOOL; #if defined(__cplusplus) && (__cplusplus >= 201402L) #include -#define WUT_ENUM_BITMASK_TYPE(_type) \ - extern "C++" { namespace { \ - constexpr inline _type operator~(_type lhs) { \ - return static_cast<_type>(~static_cast>(lhs)); \ - } \ - constexpr inline _type operator&(_type lhs, _type rhs) { \ - return static_cast<_type>(static_cast>(lhs) & static_cast>(rhs)); \ - } \ - constexpr inline _type operator|(_type lhs, _type rhs) { \ - return static_cast<_type>(static_cast>(lhs) | static_cast>(rhs)); \ - } \ - constexpr inline _type operator^(_type lhs, _type rhs) { \ - return static_cast<_type>(static_cast>(lhs) ^ static_cast>(rhs)); \ - } \ - inline _type& operator&=(_type &lhs, _type rhs) { \ - return reinterpret_cast<_type&>(reinterpret_cast&>(lhs) &= static_cast>(rhs)); \ - } \ - inline _type& operator|=(_type &lhs, _type rhs) { \ - return reinterpret_cast<_type&>(reinterpret_cast&>(lhs) |= static_cast>(rhs)); \ - } \ - inline _type& operator^=(_type &lhs, _type rhs) { \ - return reinterpret_cast<_type&>(reinterpret_cast&>(lhs) ^= static_cast>(rhs)); \ - } \ - } } +#define WUT_ENUM_BITMASK_TYPE(_type) \ + extern "C++" { \ + namespace \ + { \ + constexpr inline _type \ + operator~(_type lhs) \ + { \ + return static_cast<_type>(~static_cast>(lhs)); \ + } \ + constexpr inline _type \ + operator&(_type lhs, _type rhs) \ + { \ + return static_cast<_type>(static_cast>(lhs) & static_cast>(rhs)); \ + } \ + constexpr inline _type \ + operator|(_type lhs, _type rhs) \ + { \ + return static_cast<_type>(static_cast>(lhs) | static_cast>(rhs)); \ + } \ + constexpr inline _type \ + operator^(_type lhs, _type rhs) \ + { \ + return static_cast<_type>(static_cast>(lhs) ^ static_cast>(rhs)); \ + } \ + inline _type & \ + operator&=(_type &lhs, _type rhs) \ + { \ + return reinterpret_cast<_type &>(reinterpret_cast &>(lhs) &= static_cast>(rhs)); \ + } \ + inline _type & \ + operator|=(_type &lhs, _type rhs) \ + { \ + return reinterpret_cast<_type &>(reinterpret_cast &>(lhs) |= static_cast>(rhs)); \ + } \ + inline _type & \ + operator^=(_type &lhs, _type rhs) \ + { \ + return reinterpret_cast<_type &>(reinterpret_cast &>(lhs) ^= static_cast>(rhs)); \ + } \ + } \ + } #else #define WUT_ENUM_BITMASK_TYPE(_type) #endif diff --git a/libraries/libgfd/include/gfd.h b/libraries/libgfd/include/gfd.h index 46106999e..046cacd39 100644 --- a/libraries/libgfd/include/gfd.h +++ b/libraries/libgfd/include/gfd.h @@ -11,17 +11,17 @@ typedef struct GFDHeader GFDHeader; typedef struct GFDBlockHeader GFDBlockHeader; typedef struct GFDRelocationHeader GFDRelocationHeader; -#define GFD_HEADER_MAGIC (0x47667832) -#define GFD_BLOCK_HEADER_MAGIC (0x424C4B7B) +#define GFD_HEADER_MAGIC (0x47667832) +#define GFD_BLOCK_HEADER_MAGIC (0x424C4B7B) #define GFD_RELOCATION_HEADER_MAGIC (0x7D424C4B) -#define GFD_FILE_VERSION_MAJOR (7) -#define GFD_FILE_VERSION_MINOR (1) -#define GFD_BLOCK_VERSION_MAJOR (1) +#define GFD_FILE_VERSION_MAJOR (7) +#define GFD_FILE_VERSION_MINOR (1) +#define GFD_BLOCK_VERSION_MAJOR (1) -#define GFD_PATCH_MASK (0xFFF00000) -#define GFD_PATCH_DATA (0xD0600000) -#define GFD_PATCH_TEXT (0xCA700000) +#define GFD_PATCH_MASK (0xFFF00000) +#define GFD_PATCH_DATA (0xD0600000) +#define GFD_PATCH_TEXT (0xCA700000) typedef enum GFDBlockType { diff --git a/libraries/libgfd/src/gfd.c b/libraries/libgfd/src/gfd.c index ab696d681..835103503 100644 --- a/libraries/libgfd/src/gfd.c +++ b/libraries/libgfd/src/gfd.c @@ -8,24 +8,33 @@ // #define CHECK_GPU_VERSION -static uint32_t _GFDCleanTag(uint32_t tag); -static BOOL _GFDCheckTagDAT(uint32_t tag); -static BOOL _GFDCheckTagSTR(uint32_t tag); -static BOOL _GFDRelocateBlock(const GFDBlockHeader *blockHeader, void *dst); -static BOOL _GFDRelocateBlockEx(const GFDRelocationHeader *relocationHeader, - const uint32_t *patchTable, uint8_t *dst); -static uint32_t _GFDGetBlockDataSize(GFDBlockType type, uint32_t index, - const void *file); -static uint32_t _GFDGetBlockCount(GFDBlockType type, const void *file); -static BOOL _GFDCheckBlockHeaderMagicVersions(const GFDBlockHeader *header); -static BOOL _GFDCheckHeaderVersions(const void *file); -static BOOL _GFDGetHeaderVersions(uint32_t *majorVersion, - uint32_t *minorVersion, uint32_t *gpuVersion, - const void *file); -static BOOL _GFDGetBlockPointerConst(GFDBlockType type, uint32_t index, - const void *file, - const GFDBlockHeader **blockHeaderOut, - const void **blockDataOut); +static uint32_t +_GFDCleanTag(uint32_t tag); +static BOOL +_GFDCheckTagDAT(uint32_t tag); +static BOOL +_GFDCheckTagSTR(uint32_t tag); +static BOOL +_GFDRelocateBlock(const GFDBlockHeader *blockHeader, void *dst); +static BOOL +_GFDRelocateBlockEx(const GFDRelocationHeader *relocationHeader, + const uint32_t *patchTable, + uint8_t *dst); +static uint32_t +_GFDGetBlockDataSize(GFDBlockType type, uint32_t index, const void *file); +static uint32_t +_GFDGetBlockCount(GFDBlockType type, const void *file); +static BOOL +_GFDCheckBlockHeaderMagicVersions(const GFDBlockHeader *header); +static BOOL +_GFDCheckHeaderVersions(const void *file); +static BOOL +_GFDGetHeaderVersions(uint32_t *majorVersion, + uint32_t *minorVersion, + uint32_t *gpuVersion, + const void *file); +static BOOL +_GFDGetBlockPointerConst(GFDBlockType type, uint32_t index, const void *file, const GFDBlockHeader **blockHeaderOut, const void **blockDataOut); #if 0 // Currently unused static BOOL _GFDGetBlockPointer(GFDBlockType type, uint32_t index, void *file, GFDBlockHeader **blockHeaderOut, @@ -33,7 +42,7 @@ static BOOL _GFDGetBlockPointer(GFDBlockType type, uint32_t index, void *file, #endif static char -sLastError[1024] = { 0 }; + sLastError[1024] = {0}; static void setLastError(const char *fmt, ...) @@ -57,9 +66,9 @@ _GFDGetHeaderVersions(uint32_t *majorVersion, const void *file) { GFDHeader *header = (GFDHeader *)file; - *majorVersion = 0; - *minorVersion = 0; - *gpuVersion = 0; + *majorVersion = 0; + *minorVersion = 0; + *gpuVersion = 0; if (header->magic != GFD_HEADER_MAGIC) { setLastError("%s: header->magic %08X != %08X GFD_HEADER_MAGIC", @@ -69,7 +78,7 @@ _GFDGetHeaderVersions(uint32_t *majorVersion, *majorVersion = header->majorVersion; *minorVersion = header->minorVersion; - *gpuVersion = header->gpuVersion; + *gpuVersion = header->gpuVersion; return TRUE; } @@ -127,7 +136,7 @@ static uint32_t _GFDGetBlockCount(GFDBlockType type, const void *file) { - const uint8_t *ptr = (const uint8_t *)file; + const uint8_t *ptr = (const uint8_t *)file; const GFDHeader *fileHeader = (const GFDHeader *)file; const GFDBlockHeader *blockHeader; uint32_t count = 0; @@ -162,7 +171,7 @@ _GFDGetBlockDataSize(GFDBlockType type, uint32_t index, const void *file) { - const uint8_t *ptr = (const uint8_t *)file; + const uint8_t *ptr = (const uint8_t *)file; const GFDHeader *fileHeader = (const GFDHeader *)file; const GFDBlockHeader *blockHeader; uint32_t count = 0; @@ -203,7 +212,7 @@ _GFDGetBlockPointerConst(GFDBlockType type, const GFDBlockHeader **blockHeaderOut, const void **blockDataOut) { - const uint8_t *ptr = (const uint8_t *)file; + const uint8_t *ptr = (const uint8_t *)file; const GFDHeader *fileHeader = (const GFDHeader *)file; const GFDBlockHeader *blockHeader; uint32_t count = 0; @@ -223,7 +232,7 @@ _GFDGetBlockPointerConst(GFDBlockType type, if (blockHeader->type == type) { if (count == index) { *blockHeaderOut = blockHeader; - *blockDataOut = ptr + blockHeader->headerSize; + *blockDataOut = ptr + blockHeader->headerSize; return TRUE; } @@ -361,9 +370,7 @@ _GFDRelocateBlock(const GFDBlockHeader *blockHeader, return FALSE; } - relocationHeader = (const GFDRelocationHeader *)(blockData - + blockHeader->dataSize - - sizeof(GFDRelocationHeader)); + relocationHeader = (const GFDRelocationHeader *)(blockData + blockHeader->dataSize - sizeof(GFDRelocationHeader)); if (relocationHeader->magic != GFD_RELOCATION_HEADER_MAGIC) { setLastError("%s: relocationHeader->magic %08X != GFD_RELOCATION_HEADER_MAGIC", @@ -399,13 +406,13 @@ _GFDGetGenericBlock(GFDBlockType blockTypeHeader, uint32_t index, const void *file) { - const uint8_t *ptr = (const uint8_t *)file; + const uint8_t *ptr = (const uint8_t *)file; const GFDHeader *fileHeader = (const GFDHeader *)file; const GFDBlockHeader *blockHeader; - uint32_t headerCount = 0; + uint32_t headerCount = 0; uint32_t program1Count = 0; uint32_t program2Count = 0; - BOOL result = FALSE; + BOOL result = FALSE; if (!header || !file) { return FALSE; @@ -536,20 +543,20 @@ GFDGetComputeShaderCount(const void *file) uint32_t GFDGetComputeShaderHeaderSize(uint32_t index, - const void *file) + const void *file) { - return _GFDGetBlockDataSize(GFD_BLOCK_COMPUTE_SHADER_HEADER, - index, - file); + return _GFDGetBlockDataSize(GFD_BLOCK_COMPUTE_SHADER_HEADER, + index, + file); } uint32_t GFDGetComputeShaderProgramSize(uint32_t index, - const void *file) + const void *file) { - return _GFDGetBlockDataSize(GFD_BLOCK_COMPUTE_SHADER_PROGRAM, - index, - file); + return _GFDGetBlockDataSize(GFD_BLOCK_COMPUTE_SHADER_PROGRAM, + index, + file); } /* @@ -583,27 +590,27 @@ uint32_t GFDGetGeometryShaderHeaderSize(uint32_t index, const void *file) { - return _GFDGetBlockDataSize(GFD_BLOCK_GEOMETRY_SHADER_HEADER, - index, - file); + return _GFDGetBlockDataSize(GFD_BLOCK_GEOMETRY_SHADER_HEADER, + index, + file); } uint32_t GFDGetGeometryShaderProgramSize(uint32_t index, const void *file) { - return _GFDGetBlockDataSize(GFD_BLOCK_GEOMETRY_SHADER_PROGRAM, - index, - file); + return _GFDGetBlockDataSize(GFD_BLOCK_GEOMETRY_SHADER_PROGRAM, + index, + file); } uint32_t GFDGetGeometryShaderCopyProgramSize(uint32_t index, const void *file) { - return _GFDGetBlockDataSize(GFD_BLOCK_GEOMETRY_SHADER_COPY_PROGRAM, - index, - file); + return _GFDGetBlockDataSize(GFD_BLOCK_GEOMETRY_SHADER_COPY_PROGRAM, + index, + file); } BOOL @@ -640,18 +647,18 @@ uint32_t GFDGetPixelShaderHeaderSize(uint32_t index, const void *file) { - return _GFDGetBlockDataSize(GFD_BLOCK_PIXEL_SHADER_HEADER, - index, - file); + return _GFDGetBlockDataSize(GFD_BLOCK_PIXEL_SHADER_HEADER, + index, + file); } uint32_t GFDGetPixelShaderProgramSize(uint32_t index, const void *file) { - return _GFDGetBlockDataSize(GFD_BLOCK_PIXEL_SHADER_PROGRAM, - index, - file); + return _GFDGetBlockDataSize(GFD_BLOCK_PIXEL_SHADER_PROGRAM, + index, + file); } BOOL @@ -687,18 +694,18 @@ uint32_t GFDGetVertexShaderHeaderSize(uint32_t index, const void *file) { - return _GFDGetBlockDataSize(GFD_BLOCK_VERTEX_SHADER_HEADER, - index, - file); + return _GFDGetBlockDataSize(GFD_BLOCK_VERTEX_SHADER_HEADER, + index, + file); } uint32_t GFDGetVertexShaderProgramSize(uint32_t index, const void *file) { - return _GFDGetBlockDataSize(GFD_BLOCK_VERTEX_SHADER_PROGRAM, - index, - file); + return _GFDGetBlockDataSize(GFD_BLOCK_VERTEX_SHADER_PROGRAM, + index, + file); } BOOL @@ -730,27 +737,27 @@ uint32_t GFDGetTextureHeaderSize(uint32_t index, const void *file) { - return _GFDGetBlockDataSize(GFD_BLOCK_TEXTURE_HEADER, - index, - file); + return _GFDGetBlockDataSize(GFD_BLOCK_TEXTURE_HEADER, + index, + file); } uint32_t GFDGetTextureImageSize(uint32_t index, const void *file) { - return _GFDGetBlockDataSize(GFD_BLOCK_TEXTURE_IMAGE, - index, - file); + return _GFDGetBlockDataSize(GFD_BLOCK_TEXTURE_IMAGE, + index, + file); } uint32_t GFDGetTextureMipImageSize(uint32_t index, const void *file) { - return _GFDGetBlockDataSize(GFD_BLOCK_TEXTURE_MIPMAP, - index, - file); + return _GFDGetBlockDataSize(GFD_BLOCK_TEXTURE_MIPMAP, + index, + file); } uint32_t @@ -795,11 +802,11 @@ GFDGetGX2RTexture(GX2Texture *texture, uint32_t index, const void *file) { - const uint8_t *ptr = (const uint8_t *)file; + const uint8_t *ptr = (const uint8_t *)file; const GFDHeader *fileHeader = (const GFDHeader *)file; const GFDBlockHeader *blockHeader; uint32_t headerCount = 0; - BOOL created = FALSE; + BOOL created = FALSE; if (!texture || !file) { return FALSE; @@ -819,14 +826,11 @@ GFDGetGX2RTexture(GX2Texture *texture, memcpy(texture, ptr, sizeof(GX2Texture)); - texture->surface.image = NULL; + texture->surface.image = NULL; texture->surface.mipmaps = NULL; GX2RCreateSurface(&texture->surface, - GX2R_RESOURCE_BIND_TEXTURE - | GX2R_RESOURCE_USAGE_CPU_READ - | GX2R_RESOURCE_USAGE_CPU_WRITE - | GX2R_RESOURCE_USAGE_GPU_READ); + GX2R_RESOURCE_BIND_TEXTURE | GX2R_RESOURCE_USAGE_CPU_READ | GX2R_RESOURCE_USAGE_CPU_WRITE | GX2R_RESOURCE_USAGE_GPU_READ); created = TRUE; } else if (created) { @@ -843,8 +847,7 @@ GFDGetGX2RTexture(GX2Texture *texture, memcpy(image, ptr, blockHeader->dataSize); GX2RUnlockSurfaceEx(&texture->surface, 0, - GX2R_RESOURCE_DISABLE_CPU_INVALIDATE - | GX2R_RESOURCE_DISABLE_GPU_INVALIDATE); + GX2R_RESOURCE_DISABLE_CPU_INVALIDATE | GX2R_RESOURCE_DISABLE_GPU_INVALIDATE); } } else if (blockHeader->type == GFD_BLOCK_TEXTURE_MIPMAP) { if (created) { @@ -855,8 +858,7 @@ GFDGetGX2RTexture(GX2Texture *texture, memcpy(mipmap, ptr, blockHeader->dataSize); GX2RUnlockSurfaceEx(&texture->surface, -1, - GX2R_RESOURCE_DISABLE_CPU_INVALIDATE - | GX2R_RESOURCE_DISABLE_GPU_INVALIDATE); + GX2R_RESOURCE_DISABLE_CPU_INVALIDATE | GX2R_RESOURCE_DISABLE_GPU_INVALIDATE); } } else if (blockHeader->type == GFD_BLOCK_END_OF_FILE) { break; diff --git a/libraries/libirc/include/irc/irc.h b/libraries/libirc/include/irc/irc.h index 925c3d68c..f1cff9724 100644 --- a/libraries/libirc/include/irc/irc.h +++ b/libraries/libirc/include/irc/irc.h @@ -1,7 +1,7 @@ #pragma once #include -#include #include +#include /** * \defgroup irc_irc @@ -15,31 +15,32 @@ extern "C" { #endif -typedef enum { +typedef enum +{ //! No error - IRC_RESULT_SUCCESS = 0, + IRC_RESULT_SUCCESS = 0, //! The amount of data received from the other device does not match the requested size - IRC_RESULT_INVALID_RECEIVE_SIZE = 3, + IRC_RESULT_INVALID_RECEIVE_SIZE = 3, //! The received packet is invalid - IRC_RESULT_INVALID_PACKET = 5, + IRC_RESULT_INVALID_PACKET = 5, //! No data was available to receive - IRC_RESULT_NO_DATA = 6, + IRC_RESULT_NO_DATA = 6, //! Tried to connect while a connection was already established - IRC_RESULT_ALREADY_CONNECTED = 11, + IRC_RESULT_ALREADY_CONNECTED = 11, //! IR is not available (Is the DRC TV menu open?) - IRC_IR_UNAVAILABLE = 12, + IRC_IR_UNAVAILABLE = 12, //! IRC is not initialized - IRC_RESULT_UNINITIALIZED = 13, + IRC_RESULT_UNINITIALIZED = 13, //! No connection - IRC_RESULT_NOT_CONNECTED = 13, + IRC_RESULT_NOT_CONNECTED = 13, //! __CCRCDCIRCConnect failed - IRC_RESULT_CONNECT_FAILED = 15, + IRC_RESULT_CONNECT_FAILED = 15, //! __CCRCDCIRCReceive failed - IRC_RESULT_RECEIVE_FAILED = 16, + IRC_RESULT_RECEIVE_FAILED = 16, //! __CCRCDCIRCSend failed - IRC_RESULT_SEND_FAILED = 17, + IRC_RESULT_SEND_FAILED = 17, //! __CCRCDCIRCDisconnect failed - IRC_RESULT_DISCONNECT_FAILED = 18, + IRC_RESULT_DISCONNECT_FAILED = 18, } IRCResult; typedef void (*IRCConnectCallback)(); diff --git a/libraries/libirc/src/cdc.c b/libraries/libirc/src/cdc.c index 678824712..d0e1c23fc 100644 --- a/libraries/libirc/src/cdc.c +++ b/libraries/libirc/src/cdc.c @@ -17,29 +17,29 @@ __CCRCDCIRCConnect(int32_t drcIndex, uint8_t targetId, CCRCDCIrdaConnectionType type) { - CCRCDCIrdaConnectRequest *request = (CCRCDCIrdaConnectRequest *) sendBuffer; - CCRCDCIrdaConnectReply *reply = (CCRCDCIrdaConnectReply *) replyBuffer; - - if (receiveSize < 0x3e) { - request->receiveSize = receiveSize + sizeof(CCRCDCIrdaSmallPacketHeader) + 1; // +1 for crc8 - } else { - request->receiveSize = receiveSize + sizeof(CCRCDCIrdaLargePacketHeader) + 1; // +1 for crc8 - } - - reply->result = 0; - request->command = CCR_IRDA_COMMAND_CONNECT; - request->timeout = timeout; - request->bitrate = bitrate; - request->targetId = targetId; - request->type = type; - int32_t ret = CCRCDCPerIrdaControl(CCR_CDC_DESTINATION_DRC0 + drcIndex, - request, sizeof(CCRCDCIrdaConnectRequest), - reply, sizeof(CCRCDCIrdaConnectReply)); - if (ret == 0) { - *result = reply->result; - } - - return ret; + CCRCDCIrdaConnectRequest *request = (CCRCDCIrdaConnectRequest *)sendBuffer; + CCRCDCIrdaConnectReply *reply = (CCRCDCIrdaConnectReply *)replyBuffer; + + if (receiveSize < 0x3e) { + request->receiveSize = receiveSize + sizeof(CCRCDCIrdaSmallPacketHeader) + 1; // +1 for crc8 + } else { + request->receiveSize = receiveSize + sizeof(CCRCDCIrdaLargePacketHeader) + 1; // +1 for crc8 + } + + reply->result = 0; + request->command = CCR_IRDA_COMMAND_CONNECT; + request->timeout = timeout; + request->bitrate = bitrate; + request->targetId = targetId; + request->type = type; + int32_t ret = CCRCDCPerIrdaControl(CCR_CDC_DESTINATION_DRC0 + drcIndex, + request, sizeof(CCRCDCIrdaConnectRequest), + reply, sizeof(CCRCDCIrdaConnectReply)); + if (ret == 0) { + *result = reply->result; + } + + return ret; } int32_t @@ -49,62 +49,62 @@ __CCRCDCIRCSend(int32_t drcIndex, uint32_t receiveSize, void *data) { - CCRCDCIrdaSendRequest *request = (CCRCDCIrdaSendRequest *) sendBuffer; - CCRCDCIrdaSendReply *reply = (CCRCDCIrdaSendReply *) replyBuffer; - - uint16_t totalReceiveSize; - if (receiveSize < 0x3e) { - totalReceiveSize = receiveSize + sizeof(CCRCDCIrdaSmallPacketHeader) + 1; // +1 for crc8 - } else { - totalReceiveSize = receiveSize + sizeof(CCRCDCIrdaLargePacketHeader) + 1; // +1 for crc8 - } - - void *packetData; - uint32_t packetSize; - if (size < 0x3e) { - CCRCDCIrdaSmallPacketHeader *header = (CCRCDCIrdaSmallPacketHeader *) request->data; - header->sessionId = 0; - header->receiveSize = totalReceiveSize; - header->magic = 0xa5; - header->unk = 0; - header->isLarge = 0; - header->dataSize = size + 2; // +2 for requestSize - - packetData = header + 1; - packetSize = size + sizeof(CCRCDCIrdaSmallPacketHeader) + 1; // +1 for crc8 - } else { - CCRCDCIrdaLargePacketHeader *header = (CCRCDCIrdaLargePacketHeader *) request->data; - header->sessionId = 0; - header->receiveSize = totalReceiveSize; - header->magic = 0xa5; - header->unk = 0; - header->isLarge = 1; - header->dataSize = size + 2; // +2 for requestSize - - packetData = header + 1; - packetSize = size + sizeof(CCRCDCIrdaLargePacketHeader) + 1; // +1 for crc8 - } - - // Copy the data into the packet - memcpy(packetData, data, size); - - // Fill the rest of the buffer with 0 - uint32_t spaceLeft = CCR_CDC_IRDA_DATA_TRANSFER_SIZE - sizeof(CCRCDCIrdaSendRequest) - packetSize; - if (spaceLeft > 0) { - memset((uint8_t *) packetData + size, 0, spaceLeft); - } - - request->command = CCR_IRDA_COMMAND_SEND; - request->size = packetSize; - reply->result = 0; - int32_t ret = CCRCDCPerIrdaControl(CCR_CDC_DESTINATION_DRC0 + drcIndex, - request, CCR_CDC_IRDA_DATA_TRANSFER_SIZE, - reply, sizeof(CCRCDCIrdaSendReply)); - if (ret == 0) { - *result = reply->result; - } - - return ret; + CCRCDCIrdaSendRequest *request = (CCRCDCIrdaSendRequest *)sendBuffer; + CCRCDCIrdaSendReply *reply = (CCRCDCIrdaSendReply *)replyBuffer; + + uint16_t totalReceiveSize; + if (receiveSize < 0x3e) { + totalReceiveSize = receiveSize + sizeof(CCRCDCIrdaSmallPacketHeader) + 1; // +1 for crc8 + } else { + totalReceiveSize = receiveSize + sizeof(CCRCDCIrdaLargePacketHeader) + 1; // +1 for crc8 + } + + void *packetData; + uint32_t packetSize; + if (size < 0x3e) { + CCRCDCIrdaSmallPacketHeader *header = (CCRCDCIrdaSmallPacketHeader *)request->data; + header->sessionId = 0; + header->receiveSize = totalReceiveSize; + header->magic = 0xa5; + header->unk = 0; + header->isLarge = 0; + header->dataSize = size + 2; // +2 for requestSize + + packetData = header + 1; + packetSize = size + sizeof(CCRCDCIrdaSmallPacketHeader) + 1; // +1 for crc8 + } else { + CCRCDCIrdaLargePacketHeader *header = (CCRCDCIrdaLargePacketHeader *)request->data; + header->sessionId = 0; + header->receiveSize = totalReceiveSize; + header->magic = 0xa5; + header->unk = 0; + header->isLarge = 1; + header->dataSize = size + 2; // +2 for requestSize + + packetData = header + 1; + packetSize = size + sizeof(CCRCDCIrdaLargePacketHeader) + 1; // +1 for crc8 + } + + // Copy the data into the packet + memcpy(packetData, data, size); + + // Fill the rest of the buffer with 0 + uint32_t spaceLeft = CCR_CDC_IRDA_DATA_TRANSFER_SIZE - sizeof(CCRCDCIrdaSendRequest) - packetSize; + if (spaceLeft > 0) { + memset((uint8_t *)packetData + size, 0, spaceLeft); + } + + request->command = CCR_IRDA_COMMAND_SEND; + request->size = packetSize; + reply->result = 0; + int32_t ret = CCRCDCPerIrdaControl(CCR_CDC_DESTINATION_DRC0 + drcIndex, + request, CCR_CDC_IRDA_DATA_TRANSFER_SIZE, + reply, sizeof(CCRCDCIrdaSendReply)); + if (ret == 0) { + *result = reply->result; + } + + return ret; } int32_t @@ -113,38 +113,38 @@ __CCRCDCIRCReceive(int32_t drcIndex, uint16_t *receivedSize, void *data) { - CCRCDCIrdaReceiveRequest *request = (CCRCDCIrdaReceiveRequest *) sendBuffer; - CCRCDCIrdaReceiveReply *reply = (CCRCDCIrdaReceiveReply *) data; - - request->command = CCR_IRDA_COMMAND_RECEIVE; - memset(data, 0, CCR_CDC_IRDA_DATA_TRANSFER_SIZE); - int32_t ret = CCRCDCPerIrdaControl(CCR_CDC_DESTINATION_DRC0 + drcIndex, - request, sizeof(CCRCDCIrdaReceiveRequest), - reply, CCR_CDC_IRDA_DATA_TRANSFER_SIZE); - if (ret == 0) { - *result = reply->result; - *receivedSize = reply->size + 1; // +1 for crc8 - } - - VPADBASEClearIRCEvent((VPADChan) drcIndex); - return ret; + CCRCDCIrdaReceiveRequest *request = (CCRCDCIrdaReceiveRequest *)sendBuffer; + CCRCDCIrdaReceiveReply *reply = (CCRCDCIrdaReceiveReply *)data; + + request->command = CCR_IRDA_COMMAND_RECEIVE; + memset(data, 0, CCR_CDC_IRDA_DATA_TRANSFER_SIZE); + int32_t ret = CCRCDCPerIrdaControl(CCR_CDC_DESTINATION_DRC0 + drcIndex, + request, sizeof(CCRCDCIrdaReceiveRequest), + reply, CCR_CDC_IRDA_DATA_TRANSFER_SIZE); + if (ret == 0) { + *result = reply->result; + *receivedSize = reply->size + 1; // +1 for crc8 + } + + VPADBASEClearIRCEvent((VPADChan)drcIndex); + return ret; } int32_t __CCRCDCIRCDisconnect(int32_t drcIndex, uint8_t *result) { - CCRCDCIrdaDisconnectRequest *request = (CCRCDCIrdaDisconnectRequest *) sendBuffer; - CCRCDCIrdaDisconnectReply *reply = (CCRCDCIrdaDisconnectReply *) replyBuffer; - - reply->result = 0; - request->command = CCR_IRDA_COMMAND_DISCONNECT; - int32_t ret = CCRCDCPerIrdaControl(CCR_CDC_DESTINATION_DRC0 + drcIndex, - request, sizeof(CCRCDCIrdaDisconnectRequest), - reply, sizeof(CCRCDCIrdaDisconnectReply)); - if (ret == 0) { - *result = reply->result; - } - - return ret; + CCRCDCIrdaDisconnectRequest *request = (CCRCDCIrdaDisconnectRequest *)sendBuffer; + CCRCDCIrdaDisconnectReply *reply = (CCRCDCIrdaDisconnectReply *)replyBuffer; + + reply->result = 0; + request->command = CCR_IRDA_COMMAND_DISCONNECT; + int32_t ret = CCRCDCPerIrdaControl(CCR_CDC_DESTINATION_DRC0 + drcIndex, + request, sizeof(CCRCDCIrdaDisconnectRequest), + reply, sizeof(CCRCDCIrdaDisconnectReply)); + if (ret == 0) { + *result = reply->result; + } + + return ret; } diff --git a/libraries/libirc/src/irc.c b/libraries/libirc/src/irc.c index aba47a70b..9b8429499 100644 --- a/libraries/libirc/src/irc.c +++ b/libraries/libirc/src/irc.c @@ -3,7 +3,8 @@ #include -typedef enum { +typedef enum +{ IRC_STATE_UNINITIALIZED, IRC_STATE_DISCONNECTED, IRC_STATE_WAITING, @@ -11,7 +12,7 @@ typedef enum { } IRCState; static BOOL isInitialized = FALSE; -static IRCState state = IRC_STATE_UNINITIALIZED; +static IRCState state = IRC_STATE_UNINITIALIZED; static CCRCDCIrdaConnectionType connectionType; static uint8_t targetId; static uint8_t sessionId; @@ -31,10 +32,10 @@ IRCInit(VPADChan channel, return FALSE; } - isInitialized = TRUE; - state = IRC_STATE_DISCONNECTED; - connectionType = CCR_IRDA_CONNECTION_WAIT; - targetId = _targetId; + isInitialized = TRUE; + state = IRC_STATE_DISCONNECTED; + connectionType = CCR_IRDA_CONNECTION_WAIT; + targetId = _targetId; receiveCallback = NULL; connectCallback = NULL; @@ -50,7 +51,7 @@ IRCConnect(VPADChan channel, IRCConnectCallback callback) { if (state == IRC_STATE_UNINITIALIZED) { - return IRC_RESULT_UNINITIALIZED; + return IRC_RESULT_UNINITIALIZED; } // Can't connected if we already have an established connection @@ -87,8 +88,8 @@ IRCConnect(VPADChan channel, // // If the type is any, we don't need to wait for a connection // state = IRC_STATE_CONNECTED; //} else { - state = IRC_STATE_WAITING; - connectCallback = callback; + state = IRC_STATE_WAITING; + connectCallback = callback; //} return IRC_RESULT_SUCCESS; @@ -170,10 +171,10 @@ IRCProc(VPADChan channel) return result; } - CCRCDCIrdaSmallPacketHeader *smallHeader = (CCRCDCIrdaSmallPacketHeader *) (receiveBuffer + sizeof(CCRCDCIrdaReceiveReply)); - CCRCDCIrdaLargePacketHeader *largeHeader = (CCRCDCIrdaLargePacketHeader *) (receiveBuffer + sizeof(CCRCDCIrdaReceiveReply)); + CCRCDCIrdaSmallPacketHeader *smallHeader = (CCRCDCIrdaSmallPacketHeader *)(receiveBuffer + sizeof(CCRCDCIrdaReceiveReply)); + CCRCDCIrdaLargePacketHeader *largeHeader = (CCRCDCIrdaLargePacketHeader *)(receiveBuffer + sizeof(CCRCDCIrdaReceiveReply)); - sessionId = smallHeader->sessionId; + sessionId = smallHeader->sessionId; void *packetData; uint16_t packetSize; @@ -261,6 +262,6 @@ IRCSetReceiveCallback(VPADChan channel, IRCReceiveCallback _receiveCallback) { IRCReceiveCallback prev = receiveCallback; - receiveCallback = _receiveCallback; + receiveCallback = _receiveCallback; return prev; } diff --git a/libraries/libwhb/include/whb/file.h b/libraries/libwhb/include/whb/file.h index 93cd83166..7e6a13f11 100644 --- a/libraries/libwhb/include/whb/file.h +++ b/libraries/libwhb/include/whb/file.h @@ -13,7 +13,7 @@ extern "C" { typedef enum WHBFileError { - WHB_FILE_OK = 0, + WHB_FILE_OK = 0, WHB_FILE_FATAL_ERROR = -1, } WHBFileError; diff --git a/libraries/libwhb/include/whb/libmanager.h b/libraries/libwhb/include/whb/libmanager.h index 42a179a95..7b64af577 100644 --- a/libraries/libwhb/include/whb/libmanager.h +++ b/libraries/libwhb/include/whb/libmanager.h @@ -14,10 +14,10 @@ extern "C" { * Socket Library (nsysnet.rpl) */ -__attribute__ ((deprecated)) void +__attribute__((deprecated)) void WHBInitializeSocketLibrary(); -__attribute__ ((deprecated)) void +__attribute__((deprecated)) void WHBDeinitializeSocketLibrary(); #ifdef __cplusplus diff --git a/libraries/libwhb/src/console.c b/libraries/libwhb/src/console.c index 4da5bb8c2..3eda83700 100644 --- a/libraries/libwhb/src/console.c +++ b/libraries/libwhb/src/console.c @@ -1,25 +1,25 @@ #include #include -#include #include #include +#include #include #include #include #include -#define NUM_LINES (16) -#define LINE_LENGTH (128) +#define NUM_LINES (16) +#define LINE_LENGTH (128) #define CONSOLE_FRAME_HEAP_TAG (0x000DECAF) static char sConsoleBuffer[NUM_LINES][LINE_LENGTH]; -static int sLineNum = 0; +static int sLineNum = 0; static void *sBufferTV = NULL, *sBufferDRC = NULL; static uint32_t sBufferSizeTV = 0, sBufferSizeDRC = 0; static BOOL sConsoleHasForeground = TRUE; -static uint32_t consoleColor = 0x993333FF; +static uint32_t consoleColor = 0x993333FF; static void ConsoleAddLine(const char *line) @@ -77,7 +77,7 @@ BOOL WHBLogConsoleInit() { OSScreenInit(); - sBufferSizeTV = OSScreenGetBufferSizeEx(SCREEN_TV); + sBufferSizeTV = OSScreenGetBufferSizeEx(SCREEN_TV); sBufferSizeDRC = OSScreenGetBufferSizeEx(SCREEN_DRC); ConsoleProcCallbackAcquired(NULL); diff --git a/libraries/libwhb/src/crash.c b/libraries/libwhb/src/crash.c index f3cad2a1d..f384ad153 100644 --- a/libraries/libwhb/src/crash.c +++ b/libraries/libwhb/src/crash.c @@ -1,4 +1,3 @@ -#include #include #include #include @@ -8,37 +7,38 @@ #include #include #include +#include #include #define LOG_DISASSEMBLY_SIZE (4096) #define LOG_STACK_TRACE_SIZE (4096) -#define LOG_REGISTER_SIZE (4096) +#define LOG_REGISTER_SIZE (4096) -#define THREAD_STACK_SIZE (4096) +#define THREAD_STACK_SIZE (4096) static const char * -sCrashType = NULL; + sCrashType = NULL; static char -sDisassemblyBuffer[LOG_DISASSEMBLY_SIZE]; + sDisassemblyBuffer[LOG_DISASSEMBLY_SIZE]; static uint32_t -sDisassemblyLength = 0; + sDisassemblyLength = 0; static char -sStackTraceBuffer[LOG_STACK_TRACE_SIZE]; + sStackTraceBuffer[LOG_STACK_TRACE_SIZE]; static uint32_t -sStackTraceLength = 0; + sStackTraceLength = 0; static char -sRegistersBuffer[LOG_REGISTER_SIZE]; + sRegistersBuffer[LOG_REGISTER_SIZE]; static uint32_t -sRegistersLength = 0; + sRegistersLength = 0; static uint8_t -sCrashThreadStack[THREAD_STACK_SIZE]; + sCrashThreadStack[THREAD_STACK_SIZE]; static OSThread __attribute__((aligned(8))) sCrashThread; @@ -56,7 +56,7 @@ crashReportThread(int argc, const char **argv) } static void -disassemblyPrintCallback(const char* fmt, ...) +disassemblyPrintCallback(const char *fmt, ...) { va_list args; va_start(args, fmt); @@ -69,7 +69,7 @@ disassemblyPrintCallback(const char* fmt, ...) static void getDisassembly(OSContext *context) { - sDisassemblyLength = 0; + sDisassemblyLength = 0; sDisassemblyBuffer[0] = 0; if (context->srr0 > 16) { @@ -88,9 +88,9 @@ getStackTrace(OSContext *context) uint32_t *stackPtr; char name[256]; - sStackTraceLength = 0; + sStackTraceLength = 0; sStackTraceBuffer[0] = 0; - stackPtr = (uint32_t *)context->gpr[1]; + stackPtr = (uint32_t *)context->gpr[1]; sStackTraceLength += sprintf(sStackTraceBuffer + sStackTraceLength, "Address: Back Chain LR Save\n"); @@ -125,7 +125,7 @@ getStackTrace(OSContext *context) } static void -writeRegister(const char* fmt, ...) +writeRegister(const char *fmt, ...) { va_list args; va_start(args, fmt); @@ -143,7 +143,7 @@ getRegisters(OSContext *context) int i; uint64_t *fpr, *psf; - sRegistersLength = 0; + sRegistersLength = 0; sRegistersBuffer[sRegistersLength] = 0; writeRegister("--Proc%d-Core%u--------- OSContext 0x%p --------------------\n\n", @@ -200,16 +200,16 @@ getRegisters(OSContext *context) fpr = (uint64_t *)context->fpr; for (i = 0; i < 16; ++i) { writeRegister("fr%d \t= 0x%16.16llx \t fr%d \t= 0x%16.16llx\n", - i, fpr[i], - i + 16, fpr[i + 16]); + i, fpr[i], + i + 16, fpr[i + 16]); } writeRegister("\n\n--PSFs----------\n"); psf = (uint64_t *)context->psf; for (i = 0; i < 16; ++i) { writeRegister("ps%d \t= 0x%16.16llx \t ps%d \t= 0x%16.16llx\n", - i, psf[i], - i + 16, psf[i + 16]); + i, psf[i], + i + 16, psf[i + 16]); } } diff --git a/libraries/libwhb/src/file.c b/libraries/libwhb/src/file.c index 60cf2cb5a..004533f3d 100644 --- a/libraries/libwhb/src/file.c +++ b/libraries/libwhb/src/file.c @@ -1,14 +1,14 @@ -#include #include +#include #include #include #include static BOOL -sInitialised = FALSE; + sInitialised = FALSE; static FSClient -sClient; + sClient; static BOOL InitFileSystem() @@ -29,15 +29,15 @@ InitFileSystem() BOOL WHBDeInitFileSystem() { - if (sInitialised) { + if (sInitialised) { if (FSDelClient(&sClient, FS_ERROR_FLAG_ALL) != FS_STATUS_OK) { return FALSE; } sInitialised = FALSE; - } + } - return TRUE; + return TRUE; } int32_t @@ -127,7 +127,7 @@ WHBReadWholeFile(const char *path, int32_t handle; uint32_t size; char *buf = NULL; - handle = WHBOpenFile(path, "r"); + handle = WHBOpenFile(path, "r"); if (handle == WHB_FILE_FATAL_ERROR) { WHBLogPrintf("%s: WHBOpenFile failed", __FUNCTION__); return NULL; diff --git a/libraries/libwhb/src/gfx.c b/libraries/libwhb/src/gfx.c index e1fcf27a3..da15a9bf2 100644 --- a/libraries/libwhb/src/gfx.c +++ b/libraries/libwhb/src/gfx.c @@ -20,58 +20,58 @@ #define WHB_GFX_COMMAND_BUFFER_POOL_SIZE (0x400000) static void * -sCommandBufferPool = NULL; + sCommandBufferPool = NULL; static GX2DrcRenderMode -sDrcRenderMode; + sDrcRenderMode; static void * -sDrcScanBuffer = NULL; + sDrcScanBuffer = NULL; static uint32_t -sDrcScanBufferSize = 0; + sDrcScanBufferSize = 0; static GX2SurfaceFormat -sDrcSurfaceFormat; + sDrcSurfaceFormat; static GX2TVRenderMode -sTvRenderMode; + sTvRenderMode; static void * -sTvScanBuffer = NULL; + sTvScanBuffer = NULL; static uint32_t -sTvScanBufferSize = 0; + sTvScanBufferSize = 0; static GX2SurfaceFormat -sTvSurfaceFormat; + sTvSurfaceFormat; static GX2ColorBuffer -sTvColourBuffer = { 0 }; + sTvColourBuffer = {0}; static GX2DepthBuffer -sTvDepthBuffer = { 0 }; + sTvDepthBuffer = {0}; static GX2ColorBuffer -sDrcColourBuffer = { 0 }; + sDrcColourBuffer = {0}; static GX2DepthBuffer -sDrcDepthBuffer = { 0 }; + sDrcDepthBuffer = {0}; static GX2ContextState * -sTvContextState = NULL; + sTvContextState = NULL; static GX2ContextState * -sDrcContextState = NULL; + sDrcContextState = NULL; static BOOL -sDrawingTv = FALSE; + sDrawingTv = FALSE; static BOOL -sGpuTimedOut = FALSE; + sGpuTimedOut = FALSE; static BOOL -sGfxHasForeground = TRUE; + sGfxHasForeground = TRUE; static void * GfxGX2RAlloc(GX2RResourceFlags flags, @@ -79,11 +79,7 @@ GfxGX2RAlloc(GX2RResourceFlags flags, uint32_t alignment) { // Color, depth, scan buffers all belong in MEM1 - if ((flags & (GX2R_RESOURCE_BIND_COLOR_BUFFER - | GX2R_RESOURCE_BIND_DEPTH_BUFFER - | GX2R_RESOURCE_BIND_SCAN_BUFFER - | GX2R_RESOURCE_USAGE_FORCE_MEM1)) - && !(flags & GX2R_RESOURCE_USAGE_FORCE_MEM2)) { + if ((flags & (GX2R_RESOURCE_BIND_COLOR_BUFFER | GX2R_RESOURCE_BIND_DEPTH_BUFFER | GX2R_RESOURCE_BIND_SCAN_BUFFER | GX2R_RESOURCE_USAGE_FORCE_MEM1)) && !(flags & GX2R_RESOURCE_USAGE_FORCE_MEM2)) { return GfxHeapAllocMEM1(size, alignment); } else { return GfxHeapAllocMEM2(size, alignment); @@ -93,11 +89,7 @@ GfxGX2RAlloc(GX2RResourceFlags flags, static void GfxGX2RFree(GX2RResourceFlags flags, void *block) { - if ((flags & (GX2R_RESOURCE_BIND_COLOR_BUFFER - | GX2R_RESOURCE_BIND_DEPTH_BUFFER - | GX2R_RESOURCE_BIND_SCAN_BUFFER - | GX2R_RESOURCE_USAGE_FORCE_MEM1)) - && !(flags & GX2R_RESOURCE_USAGE_FORCE_MEM2)) { + if ((flags & (GX2R_RESOURCE_BIND_COLOR_BUFFER | GX2R_RESOURCE_BIND_DEPTH_BUFFER | GX2R_RESOURCE_BIND_SCAN_BUFFER | GX2R_RESOURCE_USAGE_FORCE_MEM1)) && !(flags & GX2R_RESOURCE_USAGE_FORCE_MEM2)) { return GfxHeapFreeMEM1(block); } else { return GfxHeapFreeMEM2(block); @@ -112,16 +104,16 @@ GfxInitTvColourBuffer(GX2ColorBuffer *cb, GX2AAMode aa) { memset(cb, 0, sizeof(GX2ColorBuffer)); - cb->surface.use = GX2_SURFACE_USE_TEXTURE_COLOR_BUFFER_TV; - cb->surface.dim = GX2_SURFACE_DIM_TEXTURE_2D; - cb->surface.width = width; - cb->surface.height = height; - cb->surface.depth = 1; + cb->surface.use = GX2_SURFACE_USE_TEXTURE_COLOR_BUFFER_TV; + cb->surface.dim = GX2_SURFACE_DIM_TEXTURE_2D; + cb->surface.width = width; + cb->surface.height = height; + cb->surface.depth = 1; cb->surface.mipLevels = 1; - cb->surface.format = format; - cb->surface.aa = aa; - cb->surface.tileMode = GX2_TILE_MODE_DEFAULT; - cb->viewNumSlices = 1; + cb->surface.format = format; + cb->surface.aa = aa; + cb->surface.tileMode = GX2_TILE_MODE_DEFAULT; + cb->viewNumSlices = 1; GX2CalcSurfaceSizeAndAlignment(&cb->surface); GX2InitColorBufferRegs(cb); } @@ -141,16 +133,16 @@ GfxInitDepthBuffer(GX2DepthBuffer *db, db->surface.use = GX2_SURFACE_USE_DEPTH_BUFFER | GX2_SURFACE_USE_TEXTURE; } - db->surface.dim = GX2_SURFACE_DIM_TEXTURE_2D; - db->surface.width = width; - db->surface.height = height; - db->surface.depth = 1; + db->surface.dim = GX2_SURFACE_DIM_TEXTURE_2D; + db->surface.width = width; + db->surface.height = height; + db->surface.depth = 1; db->surface.mipLevels = 1; - db->surface.format = format; - db->surface.aa = aa; - db->surface.tileMode = GX2_TILE_MODE_DEFAULT; - db->viewNumSlices = 1; - db->depthClear = 1.0f; + db->surface.format = format; + db->surface.aa = aa; + db->surface.tileMode = GX2_TILE_MODE_DEFAULT; + db->viewNumSlices = 1; + db->depthClear = 1.0f; GX2CalcSurfaceSizeAndAlignment(&db->surface); GX2InitDepthBufferRegs(db); } @@ -303,43 +295,41 @@ WHBGfxInit() GX2_INIT_CMD_BUF_POOL_SIZE, WHB_GFX_COMMAND_BUFFER_POOL_SIZE, GX2_INIT_ARGC, 0, GX2_INIT_ARGV, 0, - GX2_INIT_END - }; + GX2_INIT_END}; GX2Init(initAttribs); - sDrcRenderMode = GX2GetSystemDRCMode(); - sTvSurfaceFormat = GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8; + sDrcRenderMode = GX2GetSystemDRCMode(); + sTvSurfaceFormat = GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8; sDrcSurfaceFormat = GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8; - switch(GX2GetSystemTVScanMode()) - { - case GX2_TV_SCAN_MODE_480I: - case GX2_TV_SCAN_MODE_480P: - if (GX2GetSystemTVAspectRatio() == GX2_ASPECT_RATIO_16_9) { - sTvRenderMode = GX2_TV_RENDER_MODE_WIDE_480P; - tvWidth = 854; - tvHeight = 480; - } else { - sTvRenderMode = GX2_TV_RENDER_MODE_STANDARD_480P; - tvWidth = 640; - tvHeight = 480; - } - break; - case GX2_TV_SCAN_MODE_1080I: - case GX2_TV_SCAN_MODE_1080P: - sTvRenderMode = GX2_TV_RENDER_MODE_WIDE_1080P; - tvWidth = 1920; - tvHeight = 1080; - break; - case GX2_TV_SCAN_MODE_720P: - default: - sTvRenderMode = GX2_TV_RENDER_MODE_WIDE_720P; - tvWidth = 1280; - tvHeight = 720; - break; - } - - drcWidth = 854; + switch (GX2GetSystemTVScanMode()) { + case GX2_TV_SCAN_MODE_480I: + case GX2_TV_SCAN_MODE_480P: + if (GX2GetSystemTVAspectRatio() == GX2_ASPECT_RATIO_16_9) { + sTvRenderMode = GX2_TV_RENDER_MODE_WIDE_480P; + tvWidth = 854; + tvHeight = 480; + } else { + sTvRenderMode = GX2_TV_RENDER_MODE_STANDARD_480P; + tvWidth = 640; + tvHeight = 480; + } + break; + case GX2_TV_SCAN_MODE_1080I: + case GX2_TV_SCAN_MODE_1080P: + sTvRenderMode = GX2_TV_RENDER_MODE_WIDE_1080P; + tvWidth = 1920; + tvHeight = 1080; + break; + case GX2_TV_SCAN_MODE_720P: + default: + sTvRenderMode = GX2_TV_RENDER_MODE_WIDE_720P; + tvWidth = 1280; + tvHeight = 720; + break; + } + + drcWidth = 854; drcHeight = 480; // Setup TV and DRC buffers - they will be allocated in GfxProcCallbackAcquired. diff --git a/libraries/libwhb/src/gfx_heap.c b/libraries/libwhb/src/gfx_heap.c index 8f8c71760..6ecf1aa66 100644 --- a/libraries/libwhb/src/gfx_heap.c +++ b/libraries/libwhb/src/gfx_heap.c @@ -1,15 +1,15 @@ #include "gfx_heap.h" -#include #include #include #include +#include #include static void * -sGfxHeapMEM1 = NULL; + sGfxHeapMEM1 = NULL; static void * -sGfxHeapForeground = NULL; + sGfxHeapForeground = NULL; #define GFX_FRAME_HEAP_TAG (0x123DECAF) diff --git a/libraries/libwhb/src/gfx_shader.c b/libraries/libwhb/src/gfx_shader.c index 3c1ee6ca5..0aef9349a 100644 --- a/libraries/libwhb/src/gfx_shader.c +++ b/libraries/libwhb/src/gfx_shader.c @@ -1,12 +1,12 @@ -#include "gfx_heap.h" #include -#include #include #include #include +#include #include #include #include +#include "gfx_heap.h" GX2PixelShader * WHBGfxLoadGFDPixelShader(uint32_t index, @@ -14,7 +14,7 @@ WHBGfxLoadGFDPixelShader(uint32_t index, { uint32_t headerSize, programSize; GX2PixelShader *shader = NULL; - void *program = NULL; + void *program = NULL; if (index >= GFDGetPixelShaderCount(file)) { WHBLogPrintf("%s: index %u >= %u GFDGetPixelShaderCount(file)", @@ -47,9 +47,9 @@ WHBGfxLoadGFDPixelShader(uint32_t index, GX2R_RESOURCE_USAGE_CPU_READ | GX2R_RESOURCE_USAGE_CPU_WRITE | GX2R_RESOURCE_USAGE_GPU_READ; - shader->gx2rBuffer.elemSize = programSize; + shader->gx2rBuffer.elemSize = programSize; shader->gx2rBuffer.elemCount = 1; - shader->gx2rBuffer.buffer = NULL; + shader->gx2rBuffer.buffer = NULL; if (!GX2RCreateBuffer(&shader->gx2rBuffer)) { WHBLogPrintf("%s: GX2RCreateBuffer failed with programSize = %u", __FUNCTION__, programSize); @@ -66,7 +66,7 @@ WHBGfxLoadGFDPixelShader(uint32_t index, WHBLogPrintf("%s: GFDGetPixelShader failed", __FUNCTION__); GX2RUnlockBufferEx(&shader->gx2rBuffer, GX2R_RESOURCE_DISABLE_CPU_INVALIDATE | - GX2R_RESOURCE_DISABLE_GPU_INVALIDATE); + GX2R_RESOURCE_DISABLE_GPU_INVALIDATE); goto error; } @@ -106,7 +106,7 @@ WHBGfxLoadGFDVertexShader(uint32_t index, { uint32_t headerSize, programSize; GX2VertexShader *shader = NULL; - void *program = NULL; + void *program = NULL; if (index >= GFDGetVertexShaderCount(file)) { WHBLogPrintf("%s: index %u >= %u GFDGetVertexShaderCount(file)", @@ -139,9 +139,9 @@ WHBGfxLoadGFDVertexShader(uint32_t index, GX2R_RESOURCE_USAGE_CPU_READ | GX2R_RESOURCE_USAGE_CPU_WRITE | GX2R_RESOURCE_USAGE_GPU_READ; - shader->gx2rBuffer.elemSize = programSize; + shader->gx2rBuffer.elemSize = programSize; shader->gx2rBuffer.elemCount = 1; - shader->gx2rBuffer.buffer = NULL; + shader->gx2rBuffer.buffer = NULL; if (!GX2RCreateBuffer(&shader->gx2rBuffer)) { WHBLogPrintf("%s: GX2RCreateBuffer failed with programSize = %u", __FUNCTION__, programSize); @@ -158,7 +158,7 @@ WHBGfxLoadGFDVertexShader(uint32_t index, WHBLogPrintf("%s: GFDGetVertexShader failed", __FUNCTION__); GX2RUnlockBufferEx(&shader->gx2rBuffer, GX2R_RESOURCE_DISABLE_CPU_INVALIDATE | - GX2R_RESOURCE_DISABLE_GPU_INVALIDATE); + GX2R_RESOURCE_DISABLE_GPU_INVALIDATE); goto error; } @@ -199,7 +199,7 @@ WHBGfxLoadGFDShaderGroup(WHBGfxShaderGroup *group, { memset(group, 0, sizeof(WHBGfxShaderGroup)); group->vertexShader = WHBGfxLoadGFDVertexShader(index, file); - group->pixelShader = WHBGfxLoadGFDPixelShader(index, file); + group->pixelShader = WHBGfxLoadGFDPixelShader(index, file); if (!group->vertexShader || !group->pixelShader) { // A shader group requires at least a vertex shader and a pixel shader. @@ -214,34 +214,34 @@ static uint32_t GfxGetAttribFormatSel(GX2AttribFormat format) { switch (format) { - case GX2_ATTRIB_FORMAT_UNORM_8: - case GX2_ATTRIB_FORMAT_UINT_8: - case GX2_ATTRIB_FORMAT_SNORM_8: - case GX2_ATTRIB_FORMAT_SINT_8: - case GX2_ATTRIB_FORMAT_FLOAT_32: - return GX2_SEL_MASK(GX2_SQ_SEL_X, GX2_SQ_SEL_0, GX2_SQ_SEL_0, GX2_SQ_SEL_1); - case GX2_ATTRIB_FORMAT_UNORM_8_8: - case GX2_ATTRIB_FORMAT_UINT_8_8: - case GX2_ATTRIB_FORMAT_SNORM_8_8: - case GX2_ATTRIB_FORMAT_SINT_8_8: - case GX2_ATTRIB_FORMAT_FLOAT_32_32: - return GX2_SEL_MASK(GX2_SQ_SEL_X, GX2_SQ_SEL_Y, GX2_SQ_SEL_0, GX2_SQ_SEL_1); - case GX2_ATTRIB_FORMAT_FLOAT_32_32_32: - return GX2_SEL_MASK(GX2_SQ_SEL_X, GX2_SQ_SEL_Y, GX2_SQ_SEL_Z, GX2_SQ_SEL_1); - case GX2_ATTRIB_FORMAT_UNORM_8_8_8_8: - case GX2_ATTRIB_FORMAT_UINT_8_8_8_8: - case GX2_ATTRIB_FORMAT_SNORM_8_8_8_8: - case GX2_ATTRIB_FORMAT_SINT_8_8_8_8: - case GX2_ATTRIB_FORMAT_FLOAT_32_32_32_32: - return GX2_SEL_MASK(GX2_SQ_SEL_X, GX2_SQ_SEL_Y, GX2_SQ_SEL_Z, GX2_SQ_SEL_W); - break; - default: - return GX2_SEL_MASK(GX2_SQ_SEL_0, GX2_SQ_SEL_0, GX2_SQ_SEL_0, GX2_SQ_SEL_1); + case GX2_ATTRIB_FORMAT_UNORM_8: + case GX2_ATTRIB_FORMAT_UINT_8: + case GX2_ATTRIB_FORMAT_SNORM_8: + case GX2_ATTRIB_FORMAT_SINT_8: + case GX2_ATTRIB_FORMAT_FLOAT_32: + return GX2_SEL_MASK(GX2_SQ_SEL_X, GX2_SQ_SEL_0, GX2_SQ_SEL_0, GX2_SQ_SEL_1); + case GX2_ATTRIB_FORMAT_UNORM_8_8: + case GX2_ATTRIB_FORMAT_UINT_8_8: + case GX2_ATTRIB_FORMAT_SNORM_8_8: + case GX2_ATTRIB_FORMAT_SINT_8_8: + case GX2_ATTRIB_FORMAT_FLOAT_32_32: + return GX2_SEL_MASK(GX2_SQ_SEL_X, GX2_SQ_SEL_Y, GX2_SQ_SEL_0, GX2_SQ_SEL_1); + case GX2_ATTRIB_FORMAT_FLOAT_32_32_32: + return GX2_SEL_MASK(GX2_SQ_SEL_X, GX2_SQ_SEL_Y, GX2_SQ_SEL_Z, GX2_SQ_SEL_1); + case GX2_ATTRIB_FORMAT_UNORM_8_8_8_8: + case GX2_ATTRIB_FORMAT_UINT_8_8_8_8: + case GX2_ATTRIB_FORMAT_SNORM_8_8_8_8: + case GX2_ATTRIB_FORMAT_SINT_8_8_8_8: + case GX2_ATTRIB_FORMAT_FLOAT_32_32_32_32: + return GX2_SEL_MASK(GX2_SQ_SEL_X, GX2_SQ_SEL_Y, GX2_SQ_SEL_Z, GX2_SQ_SEL_W); + break; + default: + return GX2_SEL_MASK(GX2_SQ_SEL_0, GX2_SQ_SEL_0, GX2_SQ_SEL_0, GX2_SQ_SEL_1); } } static int32_t -GfxGetVertexAttribVarLocation(const GX2VertexShader* shader, +GfxGetVertexAttribVarLocation(const GX2VertexShader *shader, const char *name) { uint32_t i; @@ -270,14 +270,14 @@ WHBGfxInitShaderAttribute(WHBGfxShaderGroup *group, return FALSE; } - attrib = &group->attributes[group->numAttributes++]; - attrib->location = location; - attrib->buffer = buffer; - attrib->offset = offset; - attrib->format = format; - attrib->type = GX2_ATTRIB_INDEX_PER_VERTEX; + attrib = &group->attributes[group->numAttributes++]; + attrib->location = location; + attrib->buffer = buffer; + attrib->offset = offset; + attrib->format = format; + attrib->type = GX2_ATTRIB_INDEX_PER_VERTEX; attrib->aluDivisor = 0; - attrib->mask = GfxGetAttribFormatSel(format); + attrib->mask = GfxGetAttribFormatSel(format); attrib->endianSwap = GX2_ENDIAN_SWAP_DEFAULT; return TRUE; } @@ -285,9 +285,9 @@ WHBGfxInitShaderAttribute(WHBGfxShaderGroup *group, BOOL WHBGfxInitFetchShader(WHBGfxShaderGroup *group) { - uint32_t size = GX2CalcFetchShaderSizeEx(group->numAttributes, - GX2_FETCH_SHADER_TESSELLATION_NONE, - GX2_TESSELLATION_MODE_DISCRETE); + uint32_t size = GX2CalcFetchShaderSizeEx(group->numAttributes, + GX2_FETCH_SHADER_TESSELLATION_NONE, + GX2_TESSELLATION_MODE_DISCRETE); group->fetchShaderProgram = GfxHeapAllocMEM2(size, GX2_SHADER_PROGRAM_ALIGNMENT); GX2InitFetchShaderEx(&group->fetchShader, diff --git a/libraries/libwhb/src/gfx_texture.c b/libraries/libwhb/src/gfx_texture.c index 2eb9fb012..e439043e5 100644 --- a/libraries/libwhb/src/gfx_texture.c +++ b/libraries/libwhb/src/gfx_texture.c @@ -1,9 +1,9 @@ -#include "gfx_heap.h" #include -#include #include -#include +#include #include +#include +#include "gfx_heap.h" GX2Texture * WHBGfxLoadGFDTexture(uint32_t index, @@ -18,7 +18,7 @@ WHBGfxLoadGFDTexture(uint32_t index, } headerSize = GFDGetTextureHeaderSize(index, file); - imageSize = GFDGetTextureImageSize(index, file); + imageSize = GFDGetTextureImageSize(index, file); if (!headerSize || !imageSize) { goto error; diff --git a/libraries/libwhb/src/log.c b/libraries/libwhb/src/log.c index 660f225f8..e600ad07e 100644 --- a/libraries/libwhb/src/log.c +++ b/libraries/libwhb/src/log.c @@ -4,14 +4,14 @@ #include #include -#define MAX_HANDLERS 16 +#define MAX_HANDLERS 16 #define PRINTF_BUFFER_LENGTH 2048 static LogHandlerFn -sHandlers[MAX_HANDLERS] = { 0 }; + sHandlers[MAX_HANDLERS] = {0}; static inline void -dispatchMessage(const char * str) +dispatchMessage(const char *str) { int i; for (i = 0; i < MAX_HANDLERS; ++i) { @@ -27,8 +27,8 @@ WHBAddLogHandler(LogHandlerFn fn) int i; for (i = 0; i < MAX_HANDLERS; ++i) { - if(sHandlers[i] == fn){ - return TRUE; + if (sHandlers[i] == fn) { + return TRUE; } if (!sHandlers[i]) { sHandlers[i] = fn; @@ -44,8 +44,8 @@ WHBRemoveLogHandler(LogHandlerFn fn) { int i; - for(i = 0; i < MAX_HANDLERS; ++i) { - if(sHandlers[i] == fn) { + for (i = 0; i < MAX_HANDLERS; ++i) { + if (sHandlers[i] == fn) { sHandlers[i] = NULL; return TRUE; } @@ -65,7 +65,7 @@ BOOL WHBLogPrint(const char *str) { char *buf = MEMAllocFromDefaultHeapEx(PRINTF_BUFFER_LENGTH, 4); - if(!buf) { + if (!buf) { return FALSE; } @@ -106,7 +106,7 @@ WHBLogPrintf(const char *fmt, ...) return FALSE; } - if(!buf2) { + if (!buf2) { MEMFreeToDefaultHeap(buf1); return FALSE; } diff --git a/libraries/libwhb/src/log_cafe.c b/libraries/libwhb/src/log_cafe.c index 34d067e56..cf37e81cb 100644 --- a/libraries/libwhb/src/log_cafe.c +++ b/libraries/libwhb/src/log_cafe.c @@ -4,14 +4,13 @@ #include static void -cafeLogHandler(const char * msg) +cafeLogHandler(const char *msg) { int length = strlen(msg); - if(msg[length-1] != '\n') { + if (msg[length - 1] != '\n') { OSReport("%s\n", msg); - } - else { + } else { OSReport(msg); } } diff --git a/libraries/libwhb/src/log_module.c b/libraries/libwhb/src/log_module.c index cb91be87b..1d2e0cdb8 100644 --- a/libraries/libwhb/src/log_module.c +++ b/libraries/libwhb/src/log_module.c @@ -1,28 +1,28 @@ -#include #include -#include +#include #include +#include -static OSDynLoad_Module sModuleHandle = NULL; +static OSDynLoad_Module sModuleHandle = NULL; static void (*sWUMSLogWrite)(const char *, size_t) = NULL; static void moduleLogHandler(const char *msg) { - if(sWUMSLogWrite != NULL) { + if (sWUMSLogWrite != NULL) { sWUMSLogWrite(msg, strlen(msg)); } } BOOL WHBLogModuleInit() -{ +{ if (OSDynLoad_Acquire("homebrew_logging", &sModuleHandle) != OS_DYNLOAD_OK) { OSReport("WHBLogModuleInit: OSDynLoad_Acquire failed.\n"); return false; } - if (OSDynLoad_FindExport(sModuleHandle, FALSE, "WUMSLogWrite", (void**) &sWUMSLogWrite) != OS_DYNLOAD_OK) { + if (OSDynLoad_FindExport(sModuleHandle, FALSE, "WUMSLogWrite", (void **)&sWUMSLogWrite) != OS_DYNLOAD_OK) { OSReport("WHBLogModuleInit: OSDynLoad_FindExport failed.\n"); return false; } diff --git a/libraries/libwhb/src/log_udp.c b/libraries/libwhb/src/log_udp.c index 5a4739ce5..90b59a455 100644 --- a/libraries/libwhb/src/log_udp.c +++ b/libraries/libwhb/src/log_udp.c @@ -1,19 +1,19 @@ +#include #include #include -#include #include -#include #include +#include #include +#include #include #include -#include static int -sSocket = -1; + sSocket = -1; static struct sockaddr_in -sSendAddr; + sSendAddr; #define SERVER_PORT 4405 @@ -33,7 +33,7 @@ WHBLogUdpInit() { int broadcastEnable = 1; - sSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + sSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (sSocket < 0) { return FALSE; } @@ -41,8 +41,8 @@ WHBLogUdpInit() setsockopt(sSocket, SOL_SOCKET, SO_BROADCAST, &broadcastEnable, sizeof(broadcastEnable)); memset(&sSendAddr, 0, sizeof(struct sockaddr_in)); - sSendAddr.sin_family = AF_INET; - sSendAddr.sin_port = htons(SERVER_PORT); + sSendAddr.sin_family = AF_INET; + sSendAddr.sin_port = htons(SERVER_PORT); sSendAddr.sin_addr.s_addr = htonl(INADDR_BROADCAST); return WHBAddLogHandler(udpLogHandler); diff --git a/libraries/libwhb/src/proc.c b/libraries/libwhb/src/proc.c index ad66d744b..298fd379e 100644 --- a/libraries/libwhb/src/proc.c +++ b/libraries/libwhb/src/proc.c @@ -10,19 +10,19 @@ #include #include -#define HBL_TITLE_ID (0x0005000013374842) +#define HBL_TITLE_ID (0x0005000013374842) #define MII_MAKER_JPN_TITLE_ID (0x000500101004A000) #define MII_MAKER_USA_TITLE_ID (0x000500101004A100) #define MII_MAKER_EUR_TITLE_ID (0x000500101004A200) static uint32_t -sMainCore; + sMainCore; static BOOL -sRunning = FALSE; + sRunning = FALSE; static BOOL -sFromHBL = FALSE; + sFromHBL = FALSE; static uint32_t procSaveCallback(void *context) @@ -60,7 +60,7 @@ WHBProcInit() } sMainCore = OSGetCoreId(); - sRunning = TRUE; + sRunning = TRUE; ProcUIInitEx(&procSaveCallback, NULL); if (sFromHBL) { diff --git a/libraries/libwhb/src/sdcard.c b/libraries/libwhb/src/sdcard.c index 3c0582c54..3d44cec51 100644 --- a/libraries/libwhb/src/sdcard.c +++ b/libraries/libwhb/src/sdcard.c @@ -1,15 +1,15 @@ #include -#include #include +#include static BOOL -sMounted = FALSE; + sMounted = FALSE; static char -sMountPath[128] = { 0 }; + sMountPath[128] = {0}; static FSClient -sClient; + sClient; BOOL WHBMountSdCard() @@ -74,7 +74,7 @@ WHBUnmountSdCard() WHBLogPrintf("%s: FSUnmount error %d", __FUNCTION__, result); return FALSE; } - + result = FSDelClient(&sClient, FS_ERROR_FLAG_ALL); if (result < 0) { WHBLogPrintf("%s: FSDelClient error %d", __FUNCTION__, result); diff --git a/libraries/nn_erreula/nn_erreula.cpp b/libraries/nn_erreula/nn_erreula.cpp index bfb8c75e3..65e2d5ed8 100644 --- a/libraries/nn_erreula/nn_erreula.cpp +++ b/libraries/nn_erreula/nn_erreula.cpp @@ -1,5 +1,5 @@ -#include #include +#include #include #include @@ -10,35 +10,35 @@ namespace nn namespace erreula { -static const uint32_t kWorkMemorySize = 0x1F00000; -static const uint32_t kRplAcquireBufferSize = 0xC80000; - -static MEMHeapHandle sHeapHandle = NULL; -static OSDynLoad_Module sModuleHandle = NULL; - -static void *sAppearError = NULL; -static void *sAppearHomeNixSign = NULL; -static void *sCalc = NULL; -static void *sChangeLang = NULL; -static void *sCreate = NULL; -static void *sDestroy = NULL; -static void *sDisappearError = NULL; -static void *sDisappearHomeNixSign = NULL; -static void *sDrawDRC = NULL; -static void *sDrawTV = NULL; -static void *sGetResultCode = NULL; -static void *sGetResultType = NULL; -static void *sGetSelectButtonNumError = NULL; -static void *sGetStateErrorViewer = NULL; -static void *sIsAppearHomeNixSign = NULL; -static void *sIsDecideSelectButtonError = NULL; -static void *sIsDecideSelectLeftButtonError = NULL; +static const uint32_t kWorkMemorySize = 0x1F00000; +static const uint32_t kRplAcquireBufferSize = 0xC80000; + +static MEMHeapHandle sHeapHandle = NULL; +static OSDynLoad_Module sModuleHandle = NULL; + +static void *sAppearError = NULL; +static void *sAppearHomeNixSign = NULL; +static void *sCalc = NULL; +static void *sChangeLang = NULL; +static void *sCreate = NULL; +static void *sDestroy = NULL; +static void *sDisappearError = NULL; +static void *sDisappearHomeNixSign = NULL; +static void *sDrawDRC = NULL; +static void *sDrawTV = NULL; +static void *sGetResultCode = NULL; +static void *sGetResultType = NULL; +static void *sGetSelectButtonNumError = NULL; +static void *sGetStateErrorViewer = NULL; +static void *sIsAppearHomeNixSign = NULL; +static void *sIsDecideSelectButtonError = NULL; +static void *sIsDecideSelectLeftButtonError = NULL; static void *sIsDecideSelectRightButtonError = NULL; -static void *sIsSelectCursorActive = NULL; -static void *sJump = NULL; -static void *sPlayAppearSE = NULL; -static void *sSetControllerRemo = NULL; -static void *sSetVersion = NULL; +static void *sIsSelectCursorActive = NULL; +static void *sJump = NULL; +static void *sPlayAppearSE = NULL; +static void *sSetControllerRemo = NULL; +static void *sSetVersion = NULL; static OSDynLoad_Error allocForDynLoad(int32_t size, @@ -82,10 +82,10 @@ bool Create(const CreateArg &args) { OSDynLoadAllocFn prevDynLoadAlloc = NULL; - OSDynLoadFreeFn prevDynLoadFree = NULL; - uint32_t dynloadAcquireUseSize = 0; - void *workMemory = NULL; - bool result = true; + OSDynLoadFreeFn prevDynLoadFree = NULL; + uint32_t dynloadAcquireUseSize = 0; + void *workMemory = NULL; + bool result = true; if (!args.workMemory) { OSReport("ERREULA: Create failed. CreateArg.workMemory is NULL."); @@ -176,33 +176,25 @@ Create(const CreateArg &args) void AppearErrorViewer(const AppearArg &arg) { - return reinterpret_cast - (sAppearError) - (arg); + return reinterpret_cast(sAppearError)(arg); } void AppearHomeNixSign(const HomeNixSignArg &arg) { - return reinterpret_cast - (sAppearHomeNixSign) - (arg); + return reinterpret_cast(sAppearHomeNixSign)(arg); } void Calc(const ControllerInfo &controllerInfo) { - return reinterpret_cast - (sCalc) - (controllerInfo); + return reinterpret_cast(sCalc)(controllerInfo); } void ChangeLangError(LangType language) { - return reinterpret_cast - (sChangeLang) - (language); + return reinterpret_cast(sChangeLang)(language); } void @@ -224,65 +216,49 @@ Destroy() void DisappearErrorViewer() { - return reinterpret_cast - (sDisappearError) - (); + return reinterpret_cast(sDisappearError)(); } void DisappearHomeNixSign() { - return reinterpret_cast - (sDisappearHomeNixSign) - (); + return reinterpret_cast(sDisappearHomeNixSign)(); } void DrawDRC() { - return reinterpret_cast - (sDrawDRC) - (); + return reinterpret_cast(sDrawDRC)(); } void DrawTV() { - return reinterpret_cast - (sDrawTV) - (); + return reinterpret_cast(sDrawTV)(); } int32_t GetResultCode() { - return reinterpret_cast - (sGetResultCode) - (); + return reinterpret_cast(sGetResultCode)(); } ResultType GetResultType() { - return reinterpret_cast - (sGetResultType) - (); + return reinterpret_cast(sGetResultType)(); } int32_t GetSelectButtonNumError() { - return reinterpret_cast - (sGetSelectButtonNumError) - (); + return reinterpret_cast(sGetSelectButtonNumError)(); } State GetStateErrorViewer() { - return reinterpret_cast - (sGetStateErrorViewer) - (); + return reinterpret_cast(sGetStateErrorViewer)(); } uint32_t @@ -294,65 +270,49 @@ GetWorkMemorySize() bool IsAppearHomeNixSign() { - return reinterpret_cast - (sIsAppearHomeNixSign) - (); + return reinterpret_cast(sIsAppearHomeNixSign)(); } bool IsDecideSelectButtonError() { - return reinterpret_cast - (sIsDecideSelectButtonError) - (); + return reinterpret_cast(sIsDecideSelectButtonError)(); } bool IsDecideSelectLeftButtonError() { - return reinterpret_cast - (sIsDecideSelectLeftButtonError) - (); + return reinterpret_cast(sIsDecideSelectLeftButtonError)(); } bool IsDecideSelectRightButtonError() { - return reinterpret_cast - (sIsDecideSelectRightButtonError) - (); + return reinterpret_cast(sIsDecideSelectRightButtonError)(); } bool IsSelectCursorActive() { - return reinterpret_cast - (sIsSelectCursorActive) - (); + return reinterpret_cast(sIsSelectCursorActive)(); } bool Jump(const char *buffer, uint32_t bufferSize) { - return reinterpret_cast - (sJump) - (buffer, bufferSize); + return reinterpret_cast(sJump)(buffer, bufferSize); } void PlayAppearSE(bool playAppearSoundEffect) { - return reinterpret_cast - (sPlayAppearSE) - (playAppearSoundEffect); + return reinterpret_cast(sPlayAppearSE)(playAppearSoundEffect); } void SetControllerRemo(ControllerType controller) { - return reinterpret_cast - (sSetControllerRemo) - (controller); + return reinterpret_cast(sSetControllerRemo)(controller); } } // namespace erreula diff --git a/libraries/nn_idb/include/nn/idb/IDBReader.h b/libraries/nn_idb/include/nn/idb/IDBReader.h index 763c2ad8a..4f7773538 100644 --- a/libraries/nn_idb/include/nn/idb/IDBReader.h +++ b/libraries/nn_idb/include/nn/idb/IDBReader.h @@ -7,49 +7,61 @@ #include #include -namespace nn::idb { - class IDBReader { - public: - IDBReader() = default; - - ~IDBReader(); - - nn::Result LoadIconDataFromIdb(uint64_t titleId, nn::idb::IconDataRaw &iconData) const; - - bool SearchFromDataBase(nn::idb::IconDataKey &key, uint32_t &outIndex) const; - - bool LoadIconDataFromDatabase(uint32_t index, nn::idb::IconDataRaw &iconData) const; - - bool LoadIconData(uint64_t titleId, uint32_t u1, nn::idb::IconDataRaw &iconData) const; - - /** - * Initializes the IDBReader from a custom path - * @param path Path to "BaristaIconDataBase.dat" - * @return true on success, false on error - */ - bool Initialize(const std::string &path); - - /** - * Initializes the IDBReader to read icons from the Wii U Menu icon cache - * (fs:/vol/storage_mlc01/usr/save/%08X/%08X/user/common/BaristaIconDataBase.dat) - * @return true on success, false on error - */ - bool Initialize(); - - void Finalize(); - - private: - bool InitializeFile(); - - void FinalizeFile(); - - int LoadFromFile(void *buffer, uint32_t size, uint32_t offset) const; - - std::string mPath = {}; - FileHeader *mFileHeader = {}; - FILE *mFile = {}; - bool mInitDone = false; - }; +namespace nn::idb +{ +class IDBReader +{ +public: + IDBReader() = default; + + ~IDBReader(); + + nn::Result + LoadIconDataFromIdb(uint64_t titleId, nn::idb::IconDataRaw &iconData) const; + + bool + SearchFromDataBase(nn::idb::IconDataKey &key, uint32_t &outIndex) const; + + bool + LoadIconDataFromDatabase(uint32_t index, nn::idb::IconDataRaw &iconData) const; + + bool + LoadIconData(uint64_t titleId, uint32_t u1, nn::idb::IconDataRaw &iconData) const; + + /** + * Initializes the IDBReader from a custom path + * @param path Path to "BaristaIconDataBase.dat" + * @return true on success, false on error + */ + bool + Initialize(const std::string &path); + + /** + * Initializes the IDBReader to read icons from the Wii U Menu icon cache + * (fs:/vol/storage_mlc01/usr/save/%08X/%08X/user/common/BaristaIconDataBase.dat) + * @return true on success, false on error + */ + bool + Initialize(); + + void + Finalize(); + +private: + bool + InitializeFile(); + + void + FinalizeFile(); + + int + LoadFromFile(void *buffer, uint32_t size, uint32_t offset) const; + + std::string mPath = {}; + FileHeader *mFileHeader = {}; + FILE *mFile = {}; + bool mInitDone = false; +}; } // namespace nn::idb #endif \ No newline at end of file diff --git a/libraries/nn_idb/include/nn/idb/idb_cpp.h b/libraries/nn_idb/include/nn/idb/idb_cpp.h index fca7313a0..916e15adb 100644 --- a/libraries/nn_idb/include/nn/idb/idb_cpp.h +++ b/libraries/nn_idb/include/nn/idb/idb_cpp.h @@ -5,52 +5,58 @@ #include #include -namespace nn::idb { - struct WUT_PACKED FileHeaderEntry { - uint64_t titleId; - uint32_t u1; - WUT_UNKNOWN_BYTES(0xC); - }; - WUT_CHECK_SIZE(FileHeaderEntry, 0x18); - WUT_CHECK_OFFSET(FileHeaderEntry, 0x00, titleId); - WUT_CHECK_OFFSET(FileHeaderEntry, 0x08, u1); - - struct WUT_PACKED FileHeader { - uint32_t version; - FileHeaderEntry entries[300]; - }; - WUT_CHECK_SIZE(FileHeader, 0x1c24); - WUT_CHECK_OFFSET(FileHeader, 0x00, version); - WUT_CHECK_OFFSET(FileHeader, 0x04, entries); - - struct WUT_PACKED IconDataKey { - uint64_t titleId; - uint32_t u1; // maybe some kind of filter (or version)? - }; - WUT_CHECK_SIZE(IconDataKey, 0xC); - WUT_CHECK_OFFSET(IconDataKey, 0x00, titleId); - WUT_CHECK_OFFSET(IconDataKey, 0x08, u1); - - struct WUT_PACKED Utf16NameBuffer { - char16_t utf16Str[0x100]; - }; - WUT_CHECK_SIZE(Utf16NameBuffer, 0x200); - WUT_CHECK_OFFSET(Utf16NameBuffer, 0x00, utf16Str); - - struct WUT_PACKED IconDataRaw { - uint64_t titleID; - WUT_UNKNOWN_BYTES(0xC); - char u6[0x10]; - WUT_UNKNOWN_BYTES(0xC); - Utf16NameBuffer names[0xF]; - WUT_UNKNOWN_BYTES(0x200); - uint8_t icon[0x1002c]; - WUT_UNKNOWN_BYTES(0x4); - }; - WUT_CHECK_SIZE(IconDataRaw, 0x12060); - WUT_CHECK_OFFSET(IconDataRaw, 0x00, titleID); - WUT_CHECK_OFFSET(IconDataRaw, 0x30, names); - WUT_CHECK_OFFSET(IconDataRaw, 0x2030, icon); +namespace nn::idb +{ +struct WUT_PACKED FileHeaderEntry +{ + uint64_t titleId; + uint32_t u1; + WUT_UNKNOWN_BYTES(0xC); +}; +WUT_CHECK_SIZE(FileHeaderEntry, 0x18); +WUT_CHECK_OFFSET(FileHeaderEntry, 0x00, titleId); +WUT_CHECK_OFFSET(FileHeaderEntry, 0x08, u1); + +struct WUT_PACKED FileHeader +{ + uint32_t version; + FileHeaderEntry entries[300]; +}; +WUT_CHECK_SIZE(FileHeader, 0x1c24); +WUT_CHECK_OFFSET(FileHeader, 0x00, version); +WUT_CHECK_OFFSET(FileHeader, 0x04, entries); + +struct WUT_PACKED IconDataKey +{ + uint64_t titleId; + uint32_t u1; // maybe some kind of filter (or version)? +}; +WUT_CHECK_SIZE(IconDataKey, 0xC); +WUT_CHECK_OFFSET(IconDataKey, 0x00, titleId); +WUT_CHECK_OFFSET(IconDataKey, 0x08, u1); + +struct WUT_PACKED Utf16NameBuffer +{ + char16_t utf16Str[0x100]; +}; +WUT_CHECK_SIZE(Utf16NameBuffer, 0x200); +WUT_CHECK_OFFSET(Utf16NameBuffer, 0x00, utf16Str); + +struct WUT_PACKED IconDataRaw +{ + uint64_t titleID; + WUT_UNKNOWN_BYTES(0xC); + char u6[0x10]; + WUT_UNKNOWN_BYTES(0xC); + Utf16NameBuffer names[0xF]; + WUT_UNKNOWN_BYTES(0x200); + uint8_t icon[0x1002c]; + WUT_UNKNOWN_BYTES(0x4); +}; +WUT_CHECK_SIZE(IconDataRaw, 0x12060); +WUT_CHECK_OFFSET(IconDataRaw, 0x00, titleID); +WUT_CHECK_OFFSET(IconDataRaw, 0x30, names); +WUT_CHECK_OFFSET(IconDataRaw, 0x2030, icon); } // namespace nn::idb #endif \ No newline at end of file diff --git a/libraries/nn_idb/src/IDBReader.cpp b/libraries/nn_idb/src/IDBReader.cpp index 66b111e92..5841ef7b5 100644 --- a/libraries/nn_idb/src/IDBReader.cpp +++ b/libraries/nn_idb/src/IDBReader.cpp @@ -3,133 +3,155 @@ #include #include -namespace nn::idb { - IDBReader::~IDBReader() { - Finalize(); - } - - nn::Result IDBReader::LoadIconDataFromIdb(uint64_t titleId, IconDataRaw &iconData) const { - if (!LoadIconData(titleId, 0xFFFFFFFF, iconData)) { - return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; - } - return {{0}}; - } - - bool IDBReader::SearchFromDataBase(IconDataKey &key, uint32_t &outIndex) const { - if (!mInitDone) { - return false; - } - int index = 0; - for (const auto &entry : mFileHeader->entries) { - if (entry.titleId == key.titleId && (entry.u1 == key.u1 || key.u1 == 0xFFFFFFFF)) { - outIndex = index; - return true; - } - index++; - } - return false; - } - - bool IDBReader::LoadIconDataFromDatabase(uint32_t index, IconDataRaw &iconData) const { - if (!mInitDone) { - return false; - } - auto res = LoadFromFile(&iconData, sizeof(IconDataRaw), index * sizeof(IconDataRaw) + sizeof(FileHeader)); - return res == sizeof(IconDataRaw); - } - - bool IDBReader::LoadIconData(uint64_t titleId, uint32_t u1, IconDataRaw &iconData) const { - if (!mInitDone) { - return false; - } - IconDataKey dataKey = { - .titleId = titleId, - .u1 = u1}; - uint32_t index; - - - if (SearchFromDataBase(dataKey, index)) { - return LoadIconDataFromDatabase(index, iconData); - } - return false; - } - - bool IDBReader::Initialize(const std::string &path) { - this->mPath = path; - if (!mFileHeader) { - mFileHeader = (FileHeader *) memalign(0x40, sizeof(*mFileHeader)); - if (!mFileHeader) { - return false; - } - } - - if (!InitializeFile()) { - Finalize(); - return false; - } - - if (LoadFromFile(mFileHeader, sizeof(*mFileHeader), 0) != sizeof(*mFileHeader)) { - Finalize(); - return false; - } - if (mFileHeader->version != 0) { - Finalize(); - return false; - } - - mInitDone = true; - return true; - } - - bool IDBReader::Initialize() { - uint64_t menuTid = _SYSGetSystemApplicationTitleId(SYSTEM_APP_ID_WII_U_MENU); - char path[90]; - snprintf(path, sizeof(path), "fs:/vol/storage_mlc01/usr/save/%08X/%08X/user/common/BaristaIconDataBase.dat", (uint32_t) (menuTid >> 32), (uint32_t) (menuTid & 0xffffffff)); - - return Initialize(path); - } - - void IDBReader::Finalize() { - if (mFileHeader) { - free(mFileHeader); - mFileHeader = nullptr; - } - FinalizeFile(); - mInitDone = false; - } - - bool IDBReader::InitializeFile() { - if (!mFile) { - mFile = fopen(mPath.c_str(), "r"); - if (!mFile) { - return false; - } - } - return true; - } - - void IDBReader::FinalizeFile() { - if (mFile) { - fclose(mFile); - mFile = nullptr; - } - } - - int IDBReader::LoadFromFile(void *buffer, uint32_t size, uint32_t offset) const { - if (!mFile) { - return 0; - } - size_t bytesRead; - - if (fseek(mFile, offset, SEEK_SET) != 0) { - return false; - } - - bytesRead = ::fread(buffer, 1, (size_t) size, mFile); - - if (bytesRead != size) { - bytesRead = 0; - } - return bytesRead; - } +namespace nn::idb +{ +IDBReader::~IDBReader() +{ + Finalize(); +} + +nn::Result +IDBReader::LoadIconDataFromIdb(uint64_t titleId, IconDataRaw &iconData) const +{ + if (!LoadIconData(titleId, 0xFFFFFFFF, iconData)) { + return {Result::LEVEL_FATAL, Result::RESULT_MODULE_NN_SL, 1}; + } + return {{0}}; +} + +bool +IDBReader::SearchFromDataBase(IconDataKey &key, uint32_t &outIndex) const +{ + if (!mInitDone) { + return false; + } + int index = 0; + for (const auto &entry : mFileHeader->entries) { + if (entry.titleId == key.titleId && (entry.u1 == key.u1 || key.u1 == 0xFFFFFFFF)) { + outIndex = index; + return true; + } + index++; + } + return false; +} + +bool +IDBReader::LoadIconDataFromDatabase(uint32_t index, IconDataRaw &iconData) const +{ + if (!mInitDone) { + return false; + } + auto res = LoadFromFile(&iconData, sizeof(IconDataRaw), index * sizeof(IconDataRaw) + sizeof(FileHeader)); + return res == sizeof(IconDataRaw); +} + +bool +IDBReader::LoadIconData(uint64_t titleId, uint32_t u1, IconDataRaw &iconData) const +{ + if (!mInitDone) { + return false; + } + IconDataKey dataKey = { + .titleId = titleId, + .u1 = u1}; + uint32_t index; + + + if (SearchFromDataBase(dataKey, index)) { + return LoadIconDataFromDatabase(index, iconData); + } + return false; +} + +bool +IDBReader::Initialize(const std::string &path) +{ + this->mPath = path; + if (!mFileHeader) { + mFileHeader = (FileHeader *)memalign(0x40, sizeof(*mFileHeader)); + if (!mFileHeader) { + return false; + } + } + + if (!InitializeFile()) { + Finalize(); + return false; + } + + if (LoadFromFile(mFileHeader, sizeof(*mFileHeader), 0) != sizeof(*mFileHeader)) { + Finalize(); + return false; + } + if (mFileHeader->version != 0) { + Finalize(); + return false; + } + + mInitDone = true; + return true; +} + +bool +IDBReader::Initialize() +{ + uint64_t menuTid = _SYSGetSystemApplicationTitleId(SYSTEM_APP_ID_WII_U_MENU); + char path[90]; + snprintf(path, sizeof(path), "fs:/vol/storage_mlc01/usr/save/%08X/%08X/user/common/BaristaIconDataBase.dat", (uint32_t)(menuTid >> 32), (uint32_t)(menuTid & 0xffffffff)); + + return Initialize(path); +} + +void +IDBReader::Finalize() +{ + if (mFileHeader) { + free(mFileHeader); + mFileHeader = nullptr; + } + FinalizeFile(); + mInitDone = false; +} + +bool +IDBReader::InitializeFile() +{ + if (!mFile) { + mFile = fopen(mPath.c_str(), "r"); + if (!mFile) { + return false; + } + } + return true; +} + +void +IDBReader::FinalizeFile() +{ + if (mFile) { + fclose(mFile); + mFile = nullptr; + } +} + +int +IDBReader::LoadFromFile(void *buffer, uint32_t size, uint32_t offset) const +{ + if (!mFile) { + return 0; + } + size_t bytesRead; + + if (fseek(mFile, offset, SEEK_SET) != 0) { + return false; + } + + bytesRead = ::fread(buffer, 1, (size_t)size, mFile); + + if (bytesRead != size) { + bytesRead = 0; + } + return bytesRead; +} } // namespace nn::idb \ No newline at end of file diff --git a/libraries/nn_sl/IAccountInfoAccessor.cpp b/libraries/nn_sl/IAccountInfoAccessor.cpp index e1843d055..81ae2c9b4 100644 --- a/libraries/nn_sl/IAccountInfoAccessor.cpp +++ b/libraries/nn_sl/IAccountInfoAccessor.cpp @@ -1,13 +1,18 @@ #include -namespace nn::sl { - namespace { - extern "C" details::IAccountInfoAccessorInternal *GetDefaultAccountInfoAccessor__Q2_2nn2slFv(); - } +namespace nn::sl +{ +namespace +{ +extern "C" details::IAccountInfoAccessorInternal * +GetDefaultAccountInfoAccessor__Q2_2nn2slFv(); +} - static details::AccountInfoAccessorFromPtr gAccountInfoAccessor(GetDefaultAccountInfoAccessor__Q2_2nn2slFv()); +static details::AccountInfoAccessorFromPtr gAccountInfoAccessor(GetDefaultAccountInfoAccessor__Q2_2nn2slFv()); - details::IAccountInfoAccessorBase &GetDefaultAccountInfoAccessor() { - return gAccountInfoAccessor; - } +details::IAccountInfoAccessorBase & +GetDefaultAccountInfoAccessor() +{ + return gAccountInfoAccessor; +} } // namespace nn::sl \ No newline at end of file diff --git a/libraries/nn_sl/IBlackListAccessor.cpp b/libraries/nn_sl/IBlackListAccessor.cpp index 433a28bd6..9d4301591 100644 --- a/libraries/nn_sl/IBlackListAccessor.cpp +++ b/libraries/nn_sl/IBlackListAccessor.cpp @@ -1,14 +1,19 @@ #include -namespace nn::sl { - namespace { - extern "C" details::IBlackListAccessorInternal *GetDefaultBlackListAccessor__Q2_2nn2slFv(); - } +namespace nn::sl +{ +namespace +{ +extern "C" details::IBlackListAccessorInternal * +GetDefaultBlackListAccessor__Q2_2nn2slFv(); +} - static details::BlackListAccessorFromPtr sDefaultIconInfoAccessor(GetDefaultBlackListAccessor__Q2_2nn2slFv()); +static details::BlackListAccessorFromPtr sDefaultIconInfoAccessor(GetDefaultBlackListAccessor__Q2_2nn2slFv()); - details::IBlackListAccessorBase &GetDefaultBlackListAccessor() { - return sDefaultIconInfoAccessor; - } +details::IBlackListAccessorBase & +GetDefaultBlackListAccessor() +{ + return sDefaultIconInfoAccessor; +} } // namespace nn::sl \ No newline at end of file diff --git a/libraries/nn_sl/IDefaultTitleAccessor.cpp b/libraries/nn_sl/IDefaultTitleAccessor.cpp index e83bcf681..139c6aa0f 100644 --- a/libraries/nn_sl/IDefaultTitleAccessor.cpp +++ b/libraries/nn_sl/IDefaultTitleAccessor.cpp @@ -1,14 +1,19 @@ #include -namespace nn::sl { - namespace { - extern "C" details::IDefaultTitleAccessorInternal *GetDefaultDefaultTitleAccessor__Q2_2nn2slFv(); - } +namespace nn::sl +{ +namespace +{ +extern "C" details::IDefaultTitleAccessorInternal * +GetDefaultDefaultTitleAccessor__Q2_2nn2slFv(); +} - static details::DefaultTitleAccessorFromPtr sDefaultDefaultTitleAccessor(GetDefaultDefaultTitleAccessor__Q2_2nn2slFv()); +static details::DefaultTitleAccessorFromPtr sDefaultDefaultTitleAccessor(GetDefaultDefaultTitleAccessor__Q2_2nn2slFv()); - details::IDefaultTitleAccessorBase &GetDefaultDefaultTitleAccessor() { - return sDefaultDefaultTitleAccessor; - } +details::IDefaultTitleAccessorBase & +GetDefaultDefaultTitleAccessor() +{ + return sDefaultDefaultTitleAccessor; +} } // namespace nn::sl \ No newline at end of file diff --git a/libraries/nn_sl/IDiscCachedTitleAccessor.cpp b/libraries/nn_sl/IDiscCachedTitleAccessor.cpp index 5c0278ba8..efaaaa708 100644 --- a/libraries/nn_sl/IDiscCachedTitleAccessor.cpp +++ b/libraries/nn_sl/IDiscCachedTitleAccessor.cpp @@ -1,14 +1,19 @@ #include -namespace nn::sl { - namespace { - extern "C" details::IDiscCachedTitleAccessorInternal *GetDefaultDiscCachedTitleAccessor__Q2_2nn2slFv(); - } +namespace nn::sl +{ +namespace +{ +extern "C" details::IDiscCachedTitleAccessorInternal * +GetDefaultDiscCachedTitleAccessor__Q2_2nn2slFv(); +} - static details::DiscCachedTitleAccessorFromPtr sDefaultDiscCachedTitleListAccessor(GetDefaultDiscCachedTitleAccessor__Q2_2nn2slFv()); +static details::DiscCachedTitleAccessorFromPtr sDefaultDiscCachedTitleListAccessor(GetDefaultDiscCachedTitleAccessor__Q2_2nn2slFv()); - details::IDiscCachedTitleAccessorBase &GetDefaultDiscCachedTitleAccessor() { - return sDefaultDiscCachedTitleListAccessor; - } +details::IDiscCachedTitleAccessorBase & +GetDefaultDiscCachedTitleAccessor() +{ + return sDefaultDiscCachedTitleListAccessor; +} } // namespace nn::sl \ No newline at end of file diff --git a/libraries/nn_sl/IIconInfoAccessor.cpp b/libraries/nn_sl/IIconInfoAccessor.cpp index c10d057ad..8956b458c 100644 --- a/libraries/nn_sl/IIconInfoAccessor.cpp +++ b/libraries/nn_sl/IIconInfoAccessor.cpp @@ -1,14 +1,19 @@ #include -namespace nn::sl { - namespace { - extern "C" details::IIconInfoAccessorInternal *GetDefaultIconInfoAccessor__Q2_2nn2slFv(); - } +namespace nn::sl +{ +namespace +{ +extern "C" details::IIconInfoAccessorInternal * +GetDefaultIconInfoAccessor__Q2_2nn2slFv(); +} - static details::IconInfoAccessorFromPtr sDefaultIconInfoAccessor(GetDefaultIconInfoAccessor__Q2_2nn2slFv()); +static details::IconInfoAccessorFromPtr sDefaultIconInfoAccessor(GetDefaultIconInfoAccessor__Q2_2nn2slFv()); - details::IIconInfoAccessorBase &GetDefaultIconInfoAccessor() { - return sDefaultIconInfoAccessor; - } +details::IIconInfoAccessorBase & +GetDefaultIconInfoAccessor() +{ + return sDefaultIconInfoAccessor; +} } // namespace nn::sl \ No newline at end of file diff --git a/libraries/nn_sl/IInstalledTitleListAccessor.cpp b/libraries/nn_sl/IInstalledTitleListAccessor.cpp index 3e0da03a6..f3f633e9d 100644 --- a/libraries/nn_sl/IInstalledTitleListAccessor.cpp +++ b/libraries/nn_sl/IInstalledTitleListAccessor.cpp @@ -1,14 +1,19 @@ #include -namespace nn::sl { - namespace { - extern "C" details::IInstalledTitleListAccessorInternal *GetDefaultInstalledTitleListAccessor__Q2_2nn2slFv(); - } +namespace nn::sl +{ +namespace +{ +extern "C" details::IInstalledTitleListAccessorInternal * +GetDefaultInstalledTitleListAccessor__Q2_2nn2slFv(); +} - static details::InstalledTitleListAccessorFromPtr sDefaultInstalledTitleListAccessor(GetDefaultInstalledTitleListAccessor__Q2_2nn2slFv()); +static details::InstalledTitleListAccessorFromPtr sDefaultInstalledTitleListAccessor(GetDefaultInstalledTitleListAccessor__Q2_2nn2slFv()); - details::IInstalledTitleListAccessorBase &GetDefaultInstalledTitleListAccessor() { - return sDefaultInstalledTitleListAccessor; - } +details::IInstalledTitleListAccessorBase & +GetDefaultInstalledTitleListAccessor() +{ + return sDefaultInstalledTitleListAccessor; +} } // namespace nn::sl \ No newline at end of file diff --git a/libraries/nn_sl/IKillerNotificationAccessor.cpp b/libraries/nn_sl/IKillerNotificationAccessor.cpp index 7bf9c9f84..c00d9e25d 100644 --- a/libraries/nn_sl/IKillerNotificationAccessor.cpp +++ b/libraries/nn_sl/IKillerNotificationAccessor.cpp @@ -1,13 +1,18 @@ #include -namespace nn::sl { - namespace { - extern "C" details::IKillerNotificationAccessorInternal *GetDefaultKillerNotificationAccessor__Q2_2nn2slFv(); - } +namespace nn::sl +{ +namespace +{ +extern "C" details::IKillerNotificationAccessorInternal * +GetDefaultKillerNotificationAccessor__Q2_2nn2slFv(); +} - static details::KillerNotificationAccessorFromPtr sDefaultKillerNotificationAccessor(GetDefaultKillerNotificationAccessor__Q2_2nn2slFv()); +static details::KillerNotificationAccessorFromPtr sDefaultKillerNotificationAccessor(GetDefaultKillerNotificationAccessor__Q2_2nn2slFv()); - details::IKillerNotificationAccessorBase &GetDefaultKillerNotificationAccessor() { - return sDefaultKillerNotificationAccessor; - } +details::IKillerNotificationAccessorBase & +GetDefaultKillerNotificationAccessor() +{ + return sDefaultKillerNotificationAccessor; +} } // namespace nn::sl \ No newline at end of file diff --git a/libraries/nn_sl/ILaunchedTitleListAccessor.cpp b/libraries/nn_sl/ILaunchedTitleListAccessor.cpp index 9b09c193f..e79da10eb 100644 --- a/libraries/nn_sl/ILaunchedTitleListAccessor.cpp +++ b/libraries/nn_sl/ILaunchedTitleListAccessor.cpp @@ -1,26 +1,34 @@ #include #include -namespace nn::sl { +namespace nn::sl +{ - namespace { - extern "C" details::ILaunchedTitleListAccessorInternal *GetDefaultLaunchedTitleListAccessor__Q2_2nn2slFQ3_2nn2sl29LaunchedTitleListAccessorType(LaunchedTitleListAccessorType type); - extern "C" details::ILaunchedTitleListAccessorInternal *GetDefaultLaunchedTitleListAccessor__Q2_2nn2slFv(); - } // namespace - static details::LaunchedTitleListAccessorFromPtr sDefaultLaunchedTitleListAccessorType0(GetDefaultLaunchedTitleListAccessor__Q2_2nn2slFQ3_2nn2sl29LaunchedTitleListAccessorType(TITLE_LIST_ACCESSOR_LAUNCHED_TITLES)); - static details::LaunchedTitleListAccessorFromPtr sDefaultLaunchedTitleListAccessorType1(GetDefaultLaunchedTitleListAccessor__Q2_2nn2slFQ3_2nn2sl29LaunchedTitleListAccessorType(TITLE_LIST_ACCESSOR_PLAY_STATS)); +namespace +{ +extern "C" details::ILaunchedTitleListAccessorInternal * +GetDefaultLaunchedTitleListAccessor__Q2_2nn2slFQ3_2nn2sl29LaunchedTitleListAccessorType(LaunchedTitleListAccessorType type); +extern "C" details::ILaunchedTitleListAccessorInternal * +GetDefaultLaunchedTitleListAccessor__Q2_2nn2slFv(); +} // namespace +static details::LaunchedTitleListAccessorFromPtr sDefaultLaunchedTitleListAccessorType0(GetDefaultLaunchedTitleListAccessor__Q2_2nn2slFQ3_2nn2sl29LaunchedTitleListAccessorType(TITLE_LIST_ACCESSOR_LAUNCHED_TITLES)); +static details::LaunchedTitleListAccessorFromPtr sDefaultLaunchedTitleListAccessorType1(GetDefaultLaunchedTitleListAccessor__Q2_2nn2slFQ3_2nn2sl29LaunchedTitleListAccessorType(TITLE_LIST_ACCESSOR_PLAY_STATS)); - details::ILaunchedTitleListAccessorBase &GetDefaultLaunchedTitleListAccessor(LaunchedTitleListAccessorType type) { - if (type == TITLE_LIST_ACCESSOR_LAUNCHED_TITLES) { - return sDefaultLaunchedTitleListAccessorType0; - } else if (type == TITLE_LIST_ACCESSOR_PLAY_STATS) { - return sDefaultLaunchedTitleListAccessorType1; - } - OSFatal("Called GetDefaultLaunchedTitleListAccessor with invalid type"); - // not reached - return sDefaultLaunchedTitleListAccessorType1; - } - details::ILaunchedTitleListAccessorBase &GetDefaultLaunchedTitleListAccessor() { - return sDefaultLaunchedTitleListAccessorType0; - } +details::ILaunchedTitleListAccessorBase & +GetDefaultLaunchedTitleListAccessor(LaunchedTitleListAccessorType type) +{ + if (type == TITLE_LIST_ACCESSOR_LAUNCHED_TITLES) { + return sDefaultLaunchedTitleListAccessorType0; + } else if (type == TITLE_LIST_ACCESSOR_PLAY_STATS) { + return sDefaultLaunchedTitleListAccessorType1; + } + OSFatal("Called GetDefaultLaunchedTitleListAccessor with invalid type"); + // not reached + return sDefaultLaunchedTitleListAccessorType1; +} +details::ILaunchedTitleListAccessorBase & +GetDefaultLaunchedTitleListAccessor() +{ + return sDefaultLaunchedTitleListAccessorType0; +} } // namespace nn::sl \ No newline at end of file diff --git a/libraries/nn_sl/IMetaInfoAccessor.cpp b/libraries/nn_sl/IMetaInfoAccessor.cpp index e70e33950..729061795 100644 --- a/libraries/nn_sl/IMetaInfoAccessor.cpp +++ b/libraries/nn_sl/IMetaInfoAccessor.cpp @@ -1,14 +1,19 @@ #include -namespace nn::sl { - namespace { - extern "C" details::IMetaInfoAccessorInternal *GetDefaultMetaInfoAccessor__Q2_2nn2slFv(); - } +namespace nn::sl +{ +namespace +{ +extern "C" details::IMetaInfoAccessorInternal * +GetDefaultMetaInfoAccessor__Q2_2nn2slFv(); +} - static details::MetaInfoAccessorFromPtr sDefaultMetaInfoAccessor(GetDefaultMetaInfoAccessor__Q2_2nn2slFv()); +static details::MetaInfoAccessorFromPtr sDefaultMetaInfoAccessor(GetDefaultMetaInfoAccessor__Q2_2nn2slFv()); - details::IMetaInfoAccessorBase &GetDefaultMetaInfoAccessor() { - return sDefaultMetaInfoAccessor; - } +details::IMetaInfoAccessorBase & +GetDefaultMetaInfoAccessor() +{ + return sDefaultMetaInfoAccessor; +} } // namespace nn::sl \ No newline at end of file diff --git a/libraries/nn_sl/IPreferentialTitleAccessor.cpp b/libraries/nn_sl/IPreferentialTitleAccessor.cpp index c70861b6f..bc985d45b 100644 --- a/libraries/nn_sl/IPreferentialTitleAccessor.cpp +++ b/libraries/nn_sl/IPreferentialTitleAccessor.cpp @@ -1,14 +1,19 @@ #include -namespace nn::sl { - namespace { - extern "C" details::IPreferentialTitleAccessorInternal *GetDefaultPreferentialTitleAccessor__Q2_2nn2slFv(); - } +namespace nn::sl +{ +namespace +{ +extern "C" details::IPreferentialTitleAccessorInternal * +GetDefaultPreferentialTitleAccessor__Q2_2nn2slFv(); +} - static details::PreferentialTitleAccessorFromPtr sDefaultPreferentialTitleAccessor(GetDefaultPreferentialTitleAccessor__Q2_2nn2slFv()); +static details::PreferentialTitleAccessorFromPtr sDefaultPreferentialTitleAccessor(GetDefaultPreferentialTitleAccessor__Q2_2nn2slFv()); - details::IPreferentialTitleAccessorBase &GetDefaultPreferentialTitleAccessor() { - return sDefaultPreferentialTitleAccessor; - } +details::IPreferentialTitleAccessorBase & +GetDefaultPreferentialTitleAccessor() +{ + return sDefaultPreferentialTitleAccessor; +} } // namespace nn::sl diff --git a/libraries/nn_sl/ISerializer.cpp b/libraries/nn_sl/ISerializer.cpp index dcb1ead24..b43196dd9 100644 --- a/libraries/nn_sl/ISerializer.cpp +++ b/libraries/nn_sl/ISerializer.cpp @@ -1,38 +1,55 @@ #include #include -namespace nn::sl { - namespace { - extern "C" details::ISerializerInternal *GetDefaultIconInfoSerializer__Q2_2nn2slFv(); - extern "C" details::ISerializerInternal *GetDefaultQuickStartTitleInfoSerializer__Q2_2nn2slFv(); - extern "C" details::ISerializerInternal *GetDefaultKillerNotificationSerializer__Q2_2nn2slFv(); - extern "C" details::ISerializerInternal *GetDefaultJumpTitleInfoSerializer__Q2_2nn2slFv(); - extern "C" details::ISerializerInternal *GetDefaultPreviousSendingTimeSerializer__Q2_2nn2slFv(); - } // namespace +namespace nn::sl +{ +namespace +{ +extern "C" details::ISerializerInternal * +GetDefaultIconInfoSerializer__Q2_2nn2slFv(); +extern "C" details::ISerializerInternal * +GetDefaultQuickStartTitleInfoSerializer__Q2_2nn2slFv(); +extern "C" details::ISerializerInternal * +GetDefaultKillerNotificationSerializer__Q2_2nn2slFv(); +extern "C" details::ISerializerInternal * +GetDefaultJumpTitleInfoSerializer__Q2_2nn2slFv(); +extern "C" details::ISerializerInternal * +GetDefaultPreviousSendingTimeSerializer__Q2_2nn2slFv(); +} // namespace - static details::SerializerFromPtr sDefaultIconInfoSerializer(GetDefaultIconInfoSerializer__Q2_2nn2slFv()); - static details::SerializerFromPtr sDefaultQuickStartTitleInfoSerializer(GetDefaultQuickStartTitleInfoSerializer__Q2_2nn2slFv()); - static details::SerializerFromPtr sDefaultKillerNotificationSerializer(GetDefaultKillerNotificationSerializer__Q2_2nn2slFv()); - static details::SerializerFromPtr sDefaultJumpTitleInfoSerializer(GetDefaultJumpTitleInfoSerializer__Q2_2nn2slFv()); - static details::SerializerFromPtr sDefaultPreviousSendingTimeSerializer(GetDefaultPreviousSendingTimeSerializer__Q2_2nn2slFv()); +static details::SerializerFromPtr sDefaultIconInfoSerializer(GetDefaultIconInfoSerializer__Q2_2nn2slFv()); +static details::SerializerFromPtr sDefaultQuickStartTitleInfoSerializer(GetDefaultQuickStartTitleInfoSerializer__Q2_2nn2slFv()); +static details::SerializerFromPtr sDefaultKillerNotificationSerializer(GetDefaultKillerNotificationSerializer__Q2_2nn2slFv()); +static details::SerializerFromPtr sDefaultJumpTitleInfoSerializer(GetDefaultJumpTitleInfoSerializer__Q2_2nn2slFv()); +static details::SerializerFromPtr sDefaultPreviousSendingTimeSerializer(GetDefaultPreviousSendingTimeSerializer__Q2_2nn2slFv()); - details::ISerializerBase &GetDefaultIconInfoSerializer() { - return sDefaultIconInfoSerializer; - } +details::ISerializerBase & +GetDefaultIconInfoSerializer() +{ + return sDefaultIconInfoSerializer; +} - details::ISerializerBase &GetDefaultQuickStartTitleInfoSerializer() { - return sDefaultQuickStartTitleInfoSerializer; - } +details::ISerializerBase & +GetDefaultQuickStartTitleInfoSerializer() +{ + return sDefaultQuickStartTitleInfoSerializer; +} - details::ISerializerBase &GetDefaultKillerNotificationSerializer() { - return sDefaultKillerNotificationSerializer; - } +details::ISerializerBase & +GetDefaultKillerNotificationSerializer() +{ + return sDefaultKillerNotificationSerializer; +} - details::ISerializerBase &GetDefaultJumpTitleInfoSerializer() { - return sDefaultJumpTitleInfoSerializer; - } +details::ISerializerBase & +GetDefaultJumpTitleInfoSerializer() +{ + return sDefaultJumpTitleInfoSerializer; +} - details::ISerializerBase &GetDefaultPreviousSendingTimeSerializer() { - return sDefaultPreviousSendingTimeSerializer; - } +details::ISerializerBase & +GetDefaultPreviousSendingTimeSerializer() +{ + return sDefaultPreviousSendingTimeSerializer; +} } // namespace nn::sl \ No newline at end of file diff --git a/libraries/nn_sl/ISettingAccessor.cpp b/libraries/nn_sl/ISettingAccessor.cpp index cc9c985c0..15875962c 100644 --- a/libraries/nn_sl/ISettingAccessor.cpp +++ b/libraries/nn_sl/ISettingAccessor.cpp @@ -1,13 +1,18 @@ #include -namespace nn::sl { - namespace { - extern "C" details::ISettingAccessorInternal *GetDefaultSettingAccessor__Q2_2nn2slFv(); - } +namespace nn::sl +{ +namespace +{ +extern "C" details::ISettingAccessorInternal * +GetDefaultSettingAccessor__Q2_2nn2slFv(); +} - static details::SettingAccessorFromPtr sDefaultSettingAccessor(GetDefaultSettingAccessor__Q2_2nn2slFv()); +static details::SettingAccessorFromPtr sDefaultSettingAccessor(GetDefaultSettingAccessor__Q2_2nn2slFv()); - details::ISettingAccessorBase &GetDefaultSettingAccessor() { - return sDefaultSettingAccessor; - } +details::ISettingAccessorBase & +GetDefaultSettingAccessor() +{ + return sDefaultSettingAccessor; +} } // namespace nn::sl \ No newline at end of file diff --git a/libraries/nn_sl/ITimeAccessor.cpp b/libraries/nn_sl/ITimeAccessor.cpp index 71189405d..009ff2998 100644 --- a/libraries/nn_sl/ITimeAccessor.cpp +++ b/libraries/nn_sl/ITimeAccessor.cpp @@ -1,13 +1,18 @@ #include -namespace nn::sl { - namespace { - extern "C" details::ITimeAccessorInternal *GetDefaultTimeAccessor__Q2_2nn2slFv(); - } +namespace nn::sl +{ +namespace +{ +extern "C" details::ITimeAccessorInternal * +GetDefaultTimeAccessor__Q2_2nn2slFv(); +} - static details::TimeAccessorFromPtr sDefaultTimeAccessor(GetDefaultTimeAccessor__Q2_2nn2slFv()); +static details::TimeAccessorFromPtr sDefaultTimeAccessor(GetDefaultTimeAccessor__Q2_2nn2slFv()); - details::ITimeAccessorBase &GetDefaultTimeAccessor() { - return sDefaultTimeAccessor; - } +details::ITimeAccessorBase & +GetDefaultTimeAccessor() +{ + return sDefaultTimeAccessor; +} } // namespace nn::sl \ No newline at end of file diff --git a/libraries/nn_sl/ITitleIconCache.cpp b/libraries/nn_sl/ITitleIconCache.cpp index 4c5f1cdef..d825d2a90 100644 --- a/libraries/nn_sl/ITitleIconCache.cpp +++ b/libraries/nn_sl/ITitleIconCache.cpp @@ -1,15 +1,20 @@ #include #include -namespace nn::sl { +namespace nn::sl +{ - namespace { - extern "C" details::ITitleIconCacheInternal *GetDefaultTitleIconCache__Q2_2nn2slFv(); - } +namespace +{ +extern "C" details::ITitleIconCacheInternal * +GetDefaultTitleIconCache__Q2_2nn2slFv(); +} - static details::TitleIconCacheFromPtr sDefaultTitleIconCache(GetDefaultTitleIconCache__Q2_2nn2slFv()); +static details::TitleIconCacheFromPtr sDefaultTitleIconCache(GetDefaultTitleIconCache__Q2_2nn2slFv()); - details::ITitleIconCacheBase &GetDefaultTitleIconCache() { - return sDefaultTitleIconCache; - } +details::ITitleIconCacheBase & +GetDefaultTitleIconCache() +{ + return sDefaultTitleIconCache; +} } // namespace nn::sl \ No newline at end of file diff --git a/libraries/nn_sl/ITitleListAccessor.cpp b/libraries/nn_sl/ITitleListAccessor.cpp index 589c6b678..808d81b00 100644 --- a/libraries/nn_sl/ITitleListAccessor.cpp +++ b/libraries/nn_sl/ITitleListAccessor.cpp @@ -1,14 +1,19 @@ #include -namespace nn::sl { - namespace { - extern "C" details::ITitleListAccessorInternal *GetDefaultTitleListAccessor__Q2_2nn2slFv(); - } +namespace nn::sl +{ +namespace +{ +extern "C" details::ITitleListAccessorInternal * +GetDefaultTitleListAccessor__Q2_2nn2slFv(); +} - static details::TitleListAccessorFromPtr sDefaultTitleListAccessor(GetDefaultTitleListAccessor__Q2_2nn2slFv()); +static details::TitleListAccessorFromPtr sDefaultTitleListAccessor(GetDefaultTitleListAccessor__Q2_2nn2slFv()); - details::ITitleListAccessorBase &GetDefaultTitleListAccessor() { - return sDefaultTitleListAccessor; - } +details::ITitleListAccessorBase & +GetDefaultTitleListAccessor() +{ + return sDefaultTitleListAccessor; +} } // namespace nn::sl \ No newline at end of file diff --git a/libraries/nn_sl/ITransferrer.cpp b/libraries/nn_sl/ITransferrer.cpp index 94f49d18b..3125c39b2 100644 --- a/libraries/nn_sl/ITransferrer.cpp +++ b/libraries/nn_sl/ITransferrer.cpp @@ -1,13 +1,18 @@ #include -namespace nn::sl { - namespace { - extern "C" details::ITransferrerInternal *GetDrcTransferrer__Q2_2nn2slFv(); - } +namespace nn::sl +{ +namespace +{ +extern "C" details::ITransferrerInternal * +GetDrcTransferrer__Q2_2nn2slFv(); +} - static details::TransferrerFromPtr sDrcTransferrer(GetDrcTransferrer__Q2_2nn2slFv()); +static details::TransferrerFromPtr sDrcTransferrer(GetDrcTransferrer__Q2_2nn2slFv()); - details::ITransferrerBase &GetDrcTransferrer() { - return sDrcTransferrer; - } +details::ITransferrerBase & +GetDrcTransferrer() +{ + return sDrcTransferrer; +} } // namespace nn::sl \ No newline at end of file diff --git a/libraries/nn_sl/IUpdatePackageAccessor.cpp b/libraries/nn_sl/IUpdatePackageAccessor.cpp index b06ad8629..5bb85a350 100644 --- a/libraries/nn_sl/IUpdatePackageAccessor.cpp +++ b/libraries/nn_sl/IUpdatePackageAccessor.cpp @@ -1,14 +1,19 @@ #include -namespace nn::sl { - namespace { - extern "C" details::IUpdatePackageAccessorInternal *GetDefaultUpdatePackageAccessor__Q2_2nn2slFv(); - } +namespace nn::sl +{ +namespace +{ +extern "C" details::IUpdatePackageAccessorInternal * +GetDefaultUpdatePackageAccessor__Q2_2nn2slFv(); +} - static details::UpdatePackageAccessorFromPtr sDefaultUpdatePackageAccessor(GetDefaultUpdatePackageAccessor__Q2_2nn2slFv()); +static details::UpdatePackageAccessorFromPtr sDefaultUpdatePackageAccessor(GetDefaultUpdatePackageAccessor__Q2_2nn2slFv()); - details::IUpdatePackageAccessorBase &GetDefaultUpdatePackageAccessor() { - return sDefaultUpdatePackageAccessor; - } +details::IUpdatePackageAccessorBase & +GetDefaultUpdatePackageAccessor() +{ + return sDefaultUpdatePackageAccessor; +} } // namespace nn::sl \ No newline at end of file diff --git a/libraries/nn_sl/IWhiteListAccessor.cpp b/libraries/nn_sl/IWhiteListAccessor.cpp index bda79a3e2..4b638a629 100644 --- a/libraries/nn_sl/IWhiteListAccessor.cpp +++ b/libraries/nn_sl/IWhiteListAccessor.cpp @@ -1,14 +1,19 @@ #include -namespace nn::sl { - namespace { - extern "C" details::IWhiteListAccessorInternal *GetDefaultWhiteListAccessor__Q2_2nn2slFv(); - } +namespace nn::sl +{ +namespace +{ +extern "C" details::IWhiteListAccessorInternal * +GetDefaultWhiteListAccessor__Q2_2nn2slFv(); +} - static details::WhiteListAccessorFromPtr sDefaultIconInfoAccessor(GetDefaultWhiteListAccessor__Q2_2nn2slFv()); +static details::WhiteListAccessorFromPtr sDefaultIconInfoAccessor(GetDefaultWhiteListAccessor__Q2_2nn2slFv()); - details::IWhiteListAccessorBase &GetDefaultWhiteListAccessor() { - return sDefaultIconInfoAccessor; - } +details::IWhiteListAccessorBase & +GetDefaultWhiteListAccessor() +{ + return sDefaultIconInfoAccessor; +} } // namespace nn::sl \ No newline at end of file diff --git a/libraries/nn_sl/KillerNotificationTransferRecordManager.cpp b/libraries/nn_sl/KillerNotificationTransferRecordManager.cpp index 83159cc39..ffab45175 100644 --- a/libraries/nn_sl/KillerNotificationTransferRecordManager.cpp +++ b/libraries/nn_sl/KillerNotificationTransferRecordManager.cpp @@ -1,13 +1,18 @@ #include -namespace nn::sl { - namespace { - extern "C" details::IKillerNotificationTransferRecordManagerInternal *GetDefaultKillerNotificationTransferRecordManager__Q2_2nn2slFv(); - } +namespace nn::sl +{ +namespace +{ +extern "C" details::IKillerNotificationTransferRecordManagerInternal * +GetDefaultKillerNotificationTransferRecordManager__Q2_2nn2slFv(); +} - static details::KillerNotificationTransferRecordManagerFromPtr sDefaultKillerNotificationTransferRecordManager(GetDefaultKillerNotificationTransferRecordManager__Q2_2nn2slFv()); +static details::KillerNotificationTransferRecordManagerFromPtr sDefaultKillerNotificationTransferRecordManager(GetDefaultKillerNotificationTransferRecordManager__Q2_2nn2slFv()); - details::IKillerNotificationTransferRecordManagerBase &GetDefaultKillerNotificationTransferRecordManager() { - return sDefaultKillerNotificationTransferRecordManager; - } +details::IKillerNotificationTransferRecordManagerBase & +GetDefaultKillerNotificationTransferRecordManager() +{ + return sDefaultKillerNotificationTransferRecordManager; +} } // namespace nn::sl \ No newline at end of file diff --git a/libraries/nn_sl/KillerNotificationTransferRecordStream.cpp b/libraries/nn_sl/KillerNotificationTransferRecordStream.cpp index b1c29d0b5..013aee632 100644 --- a/libraries/nn_sl/KillerNotificationTransferRecordStream.cpp +++ b/libraries/nn_sl/KillerNotificationTransferRecordStream.cpp @@ -1,13 +1,18 @@ #include -namespace nn::sl { - namespace { - extern "C" details::KillerNotificationTransferRecordStreamInternal *GetDefaultKillerNotificationTransferRecordStream__Q2_2nn2slFv(); - } +namespace nn::sl +{ +namespace +{ +extern "C" details::KillerNotificationTransferRecordStreamInternal * +GetDefaultKillerNotificationTransferRecordStream__Q2_2nn2slFv(); +} - static KillerNotificationTransferRecordStream sDefaultKillerNotificationTransferRecordStream(GetDefaultKillerNotificationTransferRecordStream__Q2_2nn2slFv()); +static KillerNotificationTransferRecordStream sDefaultKillerNotificationTransferRecordStream(GetDefaultKillerNotificationTransferRecordStream__Q2_2nn2slFv()); - nn::sl::details::IStreamBase &GetDefaultKillerNotificationTransferRecordStream() { - return sDefaultKillerNotificationTransferRecordStream; - } +nn::sl::details::IStreamBase & +GetDefaultKillerNotificationTransferRecordStream() +{ + return sDefaultKillerNotificationTransferRecordStream; +} } // namespace nn::sl \ No newline at end of file diff --git a/libraries/nn_sl/TitleListCache.cpp b/libraries/nn_sl/TitleListCache.cpp index 8ae978d97..c2aadc1f5 100644 --- a/libraries/nn_sl/TitleListCache.cpp +++ b/libraries/nn_sl/TitleListCache.cpp @@ -1,13 +1,18 @@ #include -namespace nn::sl { - namespace { - extern "C" details::ITitleListCacheInternal *GetDefaultTitleListCache__Q2_2nn2slFv(); - } - static TitleListCacheFromPtr sDefaultTitleListCache(GetDefaultTitleListCache__Q2_2nn2slFv()); +namespace nn::sl +{ +namespace +{ +extern "C" details::ITitleListCacheInternal * +GetDefaultTitleListCache__Q2_2nn2slFv(); +} +static TitleListCacheFromPtr sDefaultTitleListCache(GetDefaultTitleListCache__Q2_2nn2slFv()); - details::ITitleListCacheBase &GetDefaultTitleListCache() { - return sDefaultTitleListCache; - } +details::ITitleListCacheBase & +GetDefaultTitleListCache() +{ + return sDefaultTitleListCache; +} } // namespace nn::sl \ No newline at end of file diff --git a/libraries/nn_swkbd/nn_swkbd.cpp b/libraries/nn_swkbd/nn_swkbd.cpp index beef83ddb..d382dda81 100644 --- a/libraries/nn_swkbd/nn_swkbd.cpp +++ b/libraries/nn_swkbd/nn_swkbd.cpp @@ -11,45 +11,45 @@ namespace swkbd static const uint32_t sRplAcquireBufferSize = 0x380000; -static MEMHeapHandle sHeapHandle = NULL; -static OSDynLoad_Module sModuleHandle = NULL; - -static void *sAppearInputForm = NULL; -static void *sAppearKeyboard = NULL; -static void *sCalcSubThreadFont = NULL; -static void *sCalcSubThreadPredict = NULL; -static void *sCalc = NULL; -static void *sConfirmUnfixAll = NULL; -static void *sCreate = NULL; -static void *sDestroy = NULL; -static void *sDisappearInputForm = NULL; -static void *sDisappearKeyboard = NULL; -static void *sDrawDRC = NULL; -static void *sDrawTV = NULL; -static void *sGetDrawStringInfo = NULL; -static void *sGetInputFormString = NULL; -static void *sGetKeyboardCondition = NULL; -static void *sGetStateInputForm = NULL; -static void *sGetStateKeyboard = NULL; -static void *sInactivateSelectCursor = NULL; -static void *sInitLearnDic = NULL; -static void *sIsCoveredWithSubWindow = NULL; -static void *sIsDecideCancelButton = NULL; -static void *sIsDecideOkButton = NULL; -static void *sIsKeyboardTarget = NULL; -static void *sIsNeedCalcSubThreadFont = NULL; -static void *sIsNeedCalcSubThreadPredict = NULL; -static void *sIsSelectCursorActive = NULL; -static void *sMuteAllSound = NULL; -static void *sSetControllerRemo = NULL; -static void *sSetCursorPos = NULL; -static void *sSetEnableOkButton = NULL; -static void *sSetInputFormString = NULL; -static void *sSetReceiver = NULL; -static void *sSetSelectFrom = NULL; -static void *sSetUserControllerEventObj = NULL; -static void *sSetUserSoundObj = NULL; -static void *sSetVersion = NULL; +static MEMHeapHandle sHeapHandle = NULL; +static OSDynLoad_Module sModuleHandle = NULL; + +static void *sAppearInputForm = NULL; +static void *sAppearKeyboard = NULL; +static void *sCalcSubThreadFont = NULL; +static void *sCalcSubThreadPredict = NULL; +static void *sCalc = NULL; +static void *sConfirmUnfixAll = NULL; +static void *sCreate = NULL; +static void *sDestroy = NULL; +static void *sDisappearInputForm = NULL; +static void *sDisappearKeyboard = NULL; +static void *sDrawDRC = NULL; +static void *sDrawTV = NULL; +static void *sGetDrawStringInfo = NULL; +static void *sGetInputFormString = NULL; +static void *sGetKeyboardCondition = NULL; +static void *sGetStateInputForm = NULL; +static void *sGetStateKeyboard = NULL; +static void *sInactivateSelectCursor = NULL; +static void *sInitLearnDic = NULL; +static void *sIsCoveredWithSubWindow = NULL; +static void *sIsDecideCancelButton = NULL; +static void *sIsDecideOkButton = NULL; +static void *sIsKeyboardTarget = NULL; +static void *sIsNeedCalcSubThreadFont = NULL; +static void *sIsNeedCalcSubThreadPredict = NULL; +static void *sIsSelectCursorActive = NULL; +static void *sMuteAllSound = NULL; +static void *sSetControllerRemo = NULL; +static void *sSetCursorPos = NULL; +static void *sSetEnableOkButton = NULL; +static void *sSetInputFormString = NULL; +static void *sSetReceiver = NULL; +static void *sSetSelectFrom = NULL; +static void *sSetUserControllerEventObj = NULL; +static void *sSetUserSoundObj = NULL; +static void *sSetVersion = NULL; static OSDynLoad_Error allocForDynLoad(int32_t size, @@ -93,10 +93,10 @@ bool Create(const CreateArg &args) { OSDynLoadAllocFn prevDynLoadAlloc = NULL; - OSDynLoadFreeFn prevDynLoadFree = NULL; - uint32_t dynloadAcquireUseSize = 0; - void *workMemory = NULL; - bool result = true; + OSDynLoadFreeFn prevDynLoadFree = NULL; + uint32_t dynloadAcquireUseSize = 0; + void *workMemory = NULL; + bool result = true; if (!args.workMemory) { OSReport("SWKBD: Create failed. CreateArg.workMemory is NULL."); @@ -205,51 +205,39 @@ Create(const CreateArg &args) } bool -AppearInputForm(const AppearArg& args) +AppearInputForm(const AppearArg &args) { - return reinterpret_cast - (sAppearInputForm) - (args); + return reinterpret_cast(sAppearInputForm)(args); } bool -AppearKeyboard(const KeyboardArg& args) +AppearKeyboard(const KeyboardArg &args) { - return reinterpret_cast - (sAppearKeyboard) - (args); + return reinterpret_cast(sAppearKeyboard)(args); } void CalcSubThreadFont() { - return reinterpret_cast - (sCalcSubThreadFont) - (); + return reinterpret_cast(sCalcSubThreadFont)(); } void CalcSubThreadPredict() { - return reinterpret_cast - (sCalcSubThreadPredict) - (); + return reinterpret_cast(sCalcSubThreadPredict)(); } void Calc(const ControllerInfo &controllerInfo) { - return reinterpret_cast - (sCalc) - (controllerInfo); + return reinterpret_cast(sCalc)(controllerInfo); } void ConfirmUnfixAll() { - return reinterpret_cast - (sConfirmUnfixAll) - (); + return reinterpret_cast(sConfirmUnfixAll)(); } void @@ -271,73 +259,55 @@ Destroy() bool DisappearInputForm() { - return reinterpret_cast - (sDisappearInputForm) - (); + return reinterpret_cast(sDisappearInputForm)(); } bool DisappearKeyboard() { - return reinterpret_cast - (sDisappearKeyboard) - (); + return reinterpret_cast(sDisappearKeyboard)(); } void DrawDRC() { - return reinterpret_cast - (sDrawDRC) - (); + return reinterpret_cast(sDrawDRC)(); } void DrawTV() { - return reinterpret_cast - (sDrawTV) - (); + return reinterpret_cast(sDrawTV)(); } void GetDrawStringInfo(DrawStringInfo *drawStringInfo) { - return reinterpret_cast - (sGetDrawStringInfo) - (drawStringInfo); + return reinterpret_cast(sGetDrawStringInfo)(drawStringInfo); } const char16_t * GetInputFormString() { - return reinterpret_cast - (sGetInputFormString) - (); + return reinterpret_cast(sGetInputFormString)(); } void GetKeyboardCondition(KeyboardCondition *keyboardCondition) { - return reinterpret_cast - (sGetKeyboardCondition) - (keyboardCondition); + return reinterpret_cast(sGetKeyboardCondition)(keyboardCondition); } State GetStateInputForm() { - return reinterpret_cast - (sGetStateInputForm) - (); + return reinterpret_cast(sGetStateInputForm)(); } State GetStateKeyboard() { - return reinterpret_cast - (sGetStateKeyboard) - (); + return reinterpret_cast(sGetStateKeyboard)(); } uint32_t @@ -359,145 +329,109 @@ GetWorkMemorySize(uint32_t unk) void InactivateSelectCursor() { - return reinterpret_cast - (sInactivateSelectCursor) - (); + return reinterpret_cast(sInactivateSelectCursor)(); } bool InitLearnDic(void *dictionary) { - return reinterpret_cast - (sInitLearnDic) - (dictionary); + return reinterpret_cast(sInitLearnDic)(dictionary); } bool IsCoveredWithSubWindow() { - return reinterpret_cast - (sIsCoveredWithSubWindow) - (); + return reinterpret_cast(sIsCoveredWithSubWindow)(); } bool IsDecideCancelButton(bool *outIsSelected) { - return reinterpret_cast - (sIsDecideCancelButton) - (outIsSelected); + return reinterpret_cast(sIsDecideCancelButton)(outIsSelected); } bool IsDecideOkButton(bool *outIsSelected) { - return reinterpret_cast - (sIsDecideOkButton) - (outIsSelected); + return reinterpret_cast(sIsDecideOkButton)(outIsSelected); } bool IsKeyboardTarget(IEventReceiver *eventReceiver) { - return reinterpret_cast - (sIsKeyboardTarget) - (eventReceiver); + return reinterpret_cast(sIsKeyboardTarget)(eventReceiver); } bool IsNeedCalcSubThreadFont() { - return reinterpret_cast - (sIsNeedCalcSubThreadFont) - (); + return reinterpret_cast(sIsNeedCalcSubThreadFont)(); } bool IsNeedCalcSubThreadPredict() { - return reinterpret_cast - (sIsNeedCalcSubThreadPredict) - (); + return reinterpret_cast(sIsNeedCalcSubThreadPredict)(); } bool IsSelectCursorActive() { - return reinterpret_cast - (sIsSelectCursorActive) - (); + return reinterpret_cast(sIsSelectCursorActive)(); } void MuteAllSound(bool muted) { - return reinterpret_cast - (sMuteAllSound) - (muted); + return reinterpret_cast(sMuteAllSound)(muted); } void SetControllerRemo(ControllerType type) { - return reinterpret_cast - (sSetControllerRemo) - (type); + return reinterpret_cast(sSetControllerRemo)(type); } void SetCursorPos(int pos) { - return reinterpret_cast - (sSetCursorPos) - (pos); + return reinterpret_cast(sSetCursorPos)(pos); } void SetEnableOkButton(bool enable) { - return reinterpret_cast - (sSetEnableOkButton) - (enable); + return reinterpret_cast(sSetEnableOkButton)(enable); } void SetInputFormString(const char16_t *str) { - return reinterpret_cast - (sSetInputFormString) - (str); + return reinterpret_cast(sSetInputFormString)(str); } void SetReceiver(const ReceiverArg &receiver) { - return reinterpret_cast - (sSetReceiver) - (receiver); + return reinterpret_cast(sSetReceiver)(receiver); } void SetSelectFrom(int from) { - return reinterpret_cast - (sSetSelectFrom) - (from); + return reinterpret_cast(sSetSelectFrom)(from); } void SetUserControllerEventObj(IControllerEventObj *controllerEventObj) { - return reinterpret_cast - (sSetUserControllerEventObj) - (controllerEventObj); + return reinterpret_cast(sSetUserControllerEventObj)(controllerEventObj); } void SetUserSoundObj(ISoundObj *soundObj) { - return reinterpret_cast - (sSetUserSoundObj) - (soundObj); + return reinterpret_cast(sSetUserSoundObj)(soundObj); } } // namespace swkbd diff --git a/libraries/wutcrt/wut_crt.c b/libraries/wutcrt/wut_crt.c index 507b4a988..6f597fed6 100644 --- a/libraries/wutcrt/wut_crt.c +++ b/libraries/wutcrt/wut_crt.c @@ -1,13 +1,21 @@ #include -void __init_wut_newlib(); -void __init_wut_stdcpp(); -void __init_wut_devoptab(); -void __attribute__((weak)) __init_wut_socket(); +void +__init_wut_newlib(); +void +__init_wut_stdcpp(); +void +__init_wut_devoptab(); +void __attribute__((weak)) +__init_wut_socket(); -void __fini_wut_newlib(); -void __fini_wut_stdcpp(); -void __fini_wut_devoptab(); -void __attribute__((weak)) __fini_wut_socket(); +void +__fini_wut_newlib(); +void +__fini_wut_stdcpp(); +void +__fini_wut_devoptab(); +void __attribute__((weak)) +__fini_wut_socket(); void __attribute__((weak)) __init_wut() diff --git a/libraries/wutcrt/wut_preinit.c b/libraries/wutcrt/wut_preinit.c index 7a2a2b329..380d7c640 100644 --- a/libraries/wutcrt/wut_preinit.c +++ b/libraries/wutcrt/wut_preinit.c @@ -1,15 +1,18 @@ #include -void __init_wut_sbrk_heap(MEMHeapHandle heapHandle); -void __init_wut_malloc_lock(); -void __init_wut_defaultheap(); +void +__init_wut_sbrk_heap(MEMHeapHandle heapHandle); +void +__init_wut_malloc_lock(); +void +__init_wut_defaultheap(); void __attribute__((weak)) __preinit_user(MEMHeapHandle *mem1, MEMHeapHandle *foreground, MEMHeapHandle *mem2) { - __init_wut_sbrk_heap(*mem2); - __init_wut_malloc_lock(); - __init_wut_defaultheap(); + __init_wut_sbrk_heap(*mem2); + __init_wut_malloc_lock(); + __init_wut_defaultheap(); } diff --git a/libraries/wutdefaultheap/wut_defaultheap.c b/libraries/wutdefaultheap/wut_defaultheap.c index bd6d406d6..dfd003c2c 100644 --- a/libraries/wutdefaultheap/wut_defaultheap.c +++ b/libraries/wutdefaultheap/wut_defaultheap.c @@ -8,13 +8,13 @@ __wut_alloc_from_defaultheap(uint32_t size) } void * -__wut_alloc_from_defaultheap_ex(uint32_t size, - int32_t alignment) +__wut_alloc_from_defaultheap_ex(uint32_t size, + int32_t alignment) { return memalign(alignment, size); } -void +void __wut_free_to_defaultheap(void *ptr) { free(ptr); @@ -23,9 +23,9 @@ __wut_free_to_defaultheap(void *ptr) void __init_wut_defaultheap(void) { - MEMAllocFromDefaultHeap = __wut_alloc_from_defaultheap; + MEMAllocFromDefaultHeap = __wut_alloc_from_defaultheap; MEMAllocFromDefaultHeapEx = __wut_alloc_from_defaultheap_ex; - MEMFreeToDefaultHeap = __wut_free_to_defaultheap; + MEMFreeToDefaultHeap = __wut_free_to_defaultheap; } void diff --git a/libraries/wutdevoptab/MutexWrapper.h b/libraries/wutdevoptab/MutexWrapper.h index b814c077a..3a5267f2c 100644 --- a/libraries/wutdevoptab/MutexWrapper.h +++ b/libraries/wutdevoptab/MutexWrapper.h @@ -3,22 +3,29 @@ #include #include "coreinit/cache.h" -class MutexWrapper { +class MutexWrapper +{ public: - MutexWrapper() = default; + MutexWrapper() = default; - void init(const char *name) { - OSInitMutexEx(&mutex, name); - } + void + init(const char *name) + { + OSInitMutexEx(&mutex, name); + } - void lock() { - OSLockMutex(&mutex); - } + void + lock() + { + OSLockMutex(&mutex); + } - void unlock() { - OSUnlockMutex(&mutex); - } + void + unlock() + { + OSUnlockMutex(&mutex); + } private: - OSMutex mutex{}; + OSMutex mutex{}; }; diff --git a/libraries/wutdevoptab/devoptab_fsa.cpp b/libraries/wutdevoptab/devoptab_fsa.cpp index 50768d174..719b6551f 100644 --- a/libraries/wutdevoptab/devoptab_fsa.cpp +++ b/libraries/wutdevoptab/devoptab_fsa.cpp @@ -32,7 +32,9 @@ static devoptab_t __wut_fsa_devoptab = { __wut_fsa_device_t __wut_fsa_device_data = {}; -FSError __init_wut_devoptab() { +FSError +__init_wut_devoptab() +{ FSError rc; if (__wut_fsa_device_data.setup) { @@ -44,9 +46,9 @@ FSError __init_wut_devoptab() { __wut_fsa_device_data.device.deviceData = &__wut_fsa_device_data; snprintf(__wut_fsa_device_data.name, sizeof(__wut_fsa_device_data.name), "fs"); __wut_fsa_device_data.device.name = __wut_fsa_device_data.name; - __wut_fsa_device_data.setup = false; - __wut_fsa_device_data.mounted = false; - __wut_fsa_device_data.isSDCard = false; + __wut_fsa_device_data.setup = false; + __wut_fsa_device_data.mounted = false; + __wut_fsa_device_data.isSDCard = false; FSAInit(); __wut_fsa_device_data.clientHandle = FSAAddClient(nullptr); @@ -62,7 +64,7 @@ FSError __init_wut_devoptab() { __wut_fsa_device_data.setup = true; snprintf(__wut_fsa_device_data.mountPath, sizeof(__wut_fsa_device_data.mountPath), "/vol/external01"); - rc = FSAMount(__wut_fsa_device_data.clientHandle, "/dev/sdcard01", __wut_fsa_device_data.mountPath, (FSAMountFlags) 0, nullptr, 0); + rc = FSAMount(__wut_fsa_device_data.clientHandle, "/dev/sdcard01", __wut_fsa_device_data.mountPath, (FSAMountFlags)0, nullptr, 0); if (rc < 0 && rc != FS_ERROR_ALREADY_EXISTS) { WUT_DEBUG_REPORT("FSAMount(0x%08X, \"/dev/sdcard01\", %s, %08X, %08X, %08X) failed: %s\n", @@ -71,18 +73,18 @@ FSError __init_wut_devoptab() { } __wut_fsa_device_data.isSDCard = true; - __wut_fsa_device_data.mounted = true; - __wut_fsa_device_data.cwd[0] = '/'; - __wut_fsa_device_data.cwd[1] = '\0'; + __wut_fsa_device_data.mounted = true; + __wut_fsa_device_data.cwd[0] = '/'; + __wut_fsa_device_data.cwd[1] = '\0'; chdir("fs:/vol/external01"); FSADeviceInfo deviceInfo; if ((rc = FSAGetDeviceInfo(__wut_fsa_device_data.clientHandle, __wut_fsa_device_data.mountPath, &deviceInfo)) >= 0) { __wut_fsa_device_data.deviceSizeInSectors = deviceInfo.deviceSizeInSectors; - __wut_fsa_device_data.deviceSectorSize = deviceInfo.deviceSectorSize; + __wut_fsa_device_data.deviceSectorSize = deviceInfo.deviceSectorSize; } else { __wut_fsa_device_data.deviceSizeInSectors = 0xFFFFFFFF; - __wut_fsa_device_data.deviceSectorSize = 512; + __wut_fsa_device_data.deviceSectorSize = 512; WUT_DEBUG_REPORT("Failed to get DeviceInfo for %s: %s\n", __wut_fsa_device_data.mountPath, FSAGetStatusStr(rc)); } @@ -96,7 +98,8 @@ FSError __init_wut_devoptab() { } FSError -__fini_wut_devoptab() { +__fini_wut_devoptab() +{ FSError rc = FS_ERROR_OK; if (!__wut_fsa_device_data.setup) { diff --git a/libraries/wutdevoptab/devoptab_fsa.h b/libraries/wutdevoptab/devoptab_fsa.h index cf71fa4fb..df30abd65 100644 --- a/libraries/wutdevoptab/devoptab_fsa.h +++ b/libraries/wutdevoptab/devoptab_fsa.h @@ -1,13 +1,13 @@ #pragma once -#include #include +#include #include #include +#include #include #include -#include #include #include @@ -16,63 +16,66 @@ #include #include #include -#include "MutexWrapper.h" #include "../wutnewlib/wut_clock.h" +#include "MutexWrapper.h" -typedef struct FSADeviceData { - devoptab_t device; - bool setup; - bool mounted; - bool isSDCard; - char name[32]; - char mountPath[0x80]; - char cwd[FS_MAX_PATH + 1]; - FSAClientHandle clientHandle; - uint64_t deviceSizeInSectors; - uint32_t deviceSectorSize; +typedef struct FSADeviceData +{ + devoptab_t device; + bool setup; + bool mounted; + bool isSDCard; + char name[32]; + char mountPath[0x80]; + char cwd[FS_MAX_PATH + 1]; + FSAClientHandle clientHandle; + uint64_t deviceSizeInSectors; + uint32_t deviceSectorSize; } __wut_fsa_device_t; /** * Open file struct */ -typedef struct { - //! FSA file handle - FSAFileHandle fd; +typedef struct +{ + //! FSA file handle + FSAFileHandle fd; - //! Flags used in open(2) - int flags; + //! Flags used in open(2) + int flags; - //! Current file offset - uint32_t offset; + //! Current file offset + uint32_t offset; - //! Current file path - char fullPath[FS_MAX_PATH + 1]; + //! Current file path + char fullPath[FS_MAX_PATH + 1]; - //! Guard file access - MutexWrapper mutex; + //! Guard file access + MutexWrapper mutex; - //! Current file size (only valid if O_APPEND is set) - uint32_t appendOffset; + //! Current file size (only valid if O_APPEND is set) + uint32_t appendOffset; } __wut_fsa_file_t; /** * Open directory struct */ -typedef struct { - //! Should be set to FSA_DIRITER_MAGIC - uint32_t magic; +typedef struct +{ + //! Should be set to FSA_DIRITER_MAGIC + uint32_t magic; - //! FS directory handle - FSADirectoryHandle fd; + //! FS directory handle + FSADirectoryHandle fd; - //! Temporary storage for reading entries - FSADirectoryEntry entry_data; + //! Temporary storage for reading entries + FSADirectoryEntry entry_data; - //! Current directory path - char fullPath[FS_MAX_PATH + 1]; + //! Current directory path + char fullPath[FS_MAX_PATH + 1]; - //! Guard dir access - MutexWrapper mutex; + //! Guard dir access + MutexWrapper mutex; } __wut_fsa_dir_t; #define FSA_DIRITER_MAGIC 0x77696975 @@ -87,50 +90,75 @@ __init_wut_devoptab(); FSError __fini_wut_devoptab(); -int __wut_fsa_open(struct _reent *r, void *fileStruct, const char *path, - int flags, int mode); -int __wut_fsa_close(struct _reent *r, void *fd); -ssize_t __wut_fsa_write(struct _reent *r, void *fd, const char *ptr, - size_t len); -ssize_t __wut_fsa_read(struct _reent *r, void *fd, char *ptr, size_t len); -off_t __wut_fsa_seek(struct _reent *r, void *fd, off_t pos, int dir); -int __wut_fsa_fstat(struct _reent *r, void *fd, struct stat *st); -int __wut_fsa_stat(struct _reent *r, const char *file, struct stat *st); -int __wut_fsa_link(struct _reent *r, const char *existing, - const char *newLink); -int __wut_fsa_unlink(struct _reent *r, const char *name); -int __wut_fsa_chdir(struct _reent *r, const char *name); -int __wut_fsa_rename(struct _reent *r, const char *oldName, - const char *newName); -int __wut_fsa_mkdir(struct _reent *r, const char *path, int mode); -DIR_ITER *__wut_fsa_diropen(struct _reent *r, DIR_ITER *dirState, - const char *path); -int __wut_fsa_dirreset(struct _reent *r, DIR_ITER *dirState); -int __wut_fsa_dirnext(struct _reent *r, DIR_ITER *dirState, char *filename, - struct stat *filestat); -int __wut_fsa_dirclose(struct _reent *r, DIR_ITER *dirState); -int __wut_fsa_statvfs(struct _reent *r, const char *path, - struct statvfs *buf); -int __wut_fsa_ftruncate(struct _reent *r, void *fd, off_t len); -int __wut_fsa_fsync(struct _reent *r, void *fd); -int __wut_fsa_chmod(struct _reent *r, const char *path, mode_t mode); -int __wut_fsa_fchmod(struct _reent *r, void *fd, mode_t mode); -int __wut_fsa_rmdir(struct _reent *r, const char *name); -int __wut_fsa_utimes(struct _reent *r, const char *filename, const struct timeval times[2]); +int +__wut_fsa_open(struct _reent *r, void *fileStruct, const char *path, int flags, int mode); +int +__wut_fsa_close(struct _reent *r, void *fd); +ssize_t +__wut_fsa_write(struct _reent *r, void *fd, const char *ptr, size_t len); +ssize_t +__wut_fsa_read(struct _reent *r, void *fd, char *ptr, size_t len); +off_t +__wut_fsa_seek(struct _reent *r, void *fd, off_t pos, int dir); +int +__wut_fsa_fstat(struct _reent *r, void *fd, struct stat *st); +int +__wut_fsa_stat(struct _reent *r, const char *file, struct stat *st); +int +__wut_fsa_link(struct _reent *r, const char *existing, const char *newLink); +int +__wut_fsa_unlink(struct _reent *r, const char *name); +int +__wut_fsa_chdir(struct _reent *r, const char *name); +int +__wut_fsa_rename(struct _reent *r, const char *oldName, const char *newName); +int +__wut_fsa_mkdir(struct _reent *r, const char *path, int mode); +DIR_ITER * +__wut_fsa_diropen(struct _reent *r, DIR_ITER *dirState, const char *path); +int +__wut_fsa_dirreset(struct _reent *r, DIR_ITER *dirState); +int +__wut_fsa_dirnext(struct _reent *r, DIR_ITER *dirState, char *filename, struct stat *filestat); +int +__wut_fsa_dirclose(struct _reent *r, DIR_ITER *dirState); +int +__wut_fsa_statvfs(struct _reent *r, const char *path, struct statvfs *buf); +int +__wut_fsa_ftruncate(struct _reent *r, void *fd, off_t len); +int +__wut_fsa_fsync(struct _reent *r, void *fd); +int +__wut_fsa_chmod(struct _reent *r, const char *path, mode_t mode); +int +__wut_fsa_fchmod(struct _reent *r, void *fd, mode_t mode); +int +__wut_fsa_rmdir(struct _reent *r, const char *name); +int +__wut_fsa_utimes(struct _reent *r, const char *filename, const struct timeval times[2]); // devoptab_fsa_utils.c -char *__wut_fsa_fixpath(struct _reent *r, const char *path); -int __wut_fsa_translate_error(FSError error); -mode_t __wut_fsa_translate_stat_mode(FSStat *fsStat); -void __wut_fsa_translate_stat(FSAClientHandle handle, FSStat *fsStat, ino_t ino, struct stat *posStat); -uint32_t __wut_fsa_hashstring(const char *str); - -static inline FSMode __wut_fsa_translate_permission_mode(mode_t mode) { +char * +__wut_fsa_fixpath(struct _reent *r, const char *path); +int +__wut_fsa_translate_error(FSError error); +mode_t +__wut_fsa_translate_stat_mode(FSStat *fsStat); +void +__wut_fsa_translate_stat(FSAClientHandle handle, FSStat *fsStat, ino_t ino, struct stat *posStat); +uint32_t +__wut_fsa_hashstring(const char *str); + +static inline FSMode +__wut_fsa_translate_permission_mode(mode_t mode) +{ // Convert normal Unix octal permission bits into CafeOS hexadecimal permission bits - return (FSMode) (((mode & S_IRWXU) << 2) | ((mode & S_IRWXG) << 1) | (mode & S_IRWXO)); + return (FSMode)(((mode & S_IRWXU) << 2) | ((mode & S_IRWXG) << 1) | (mode & S_IRWXO)); } -static inline time_t __wut_fsa_translate_time(FSTime timeValue) { +static inline time_t +__wut_fsa_translate_time(FSTime timeValue) +{ return (timeValue / 1000000) + EPOCH_DIFF_SECS(WIIU_FSTIME_EPOCH_YEAR); } diff --git a/libraries/wutdevoptab/devoptab_fsa_chdir.cpp b/libraries/wutdevoptab/devoptab_fsa_chdir.cpp index b405ac5c8..a46d00792 100644 --- a/libraries/wutdevoptab/devoptab_fsa_chdir.cpp +++ b/libraries/wutdevoptab/devoptab_fsa_chdir.cpp @@ -3,7 +3,8 @@ int __wut_fsa_chdir(struct _reent *r, - const char *path) { + const char *path) +{ FSError status; __wut_fsa_device_t *deviceData; @@ -17,9 +18,9 @@ __wut_fsa_chdir(struct _reent *r, r->_errno = ENOMEM; return -1; } - deviceData = (__wut_fsa_device_t *) r->deviceData; + deviceData = (__wut_fsa_device_t *)r->deviceData; - status = FSAChangeDir(deviceData->clientHandle, fixedPath); + status = FSAChangeDir(deviceData->clientHandle, fixedPath); if (status < 0) { WUT_DEBUG_REPORT("FSAChangeDir(0x%08X, %s) failed: %s\n", deviceData->clientHandle, fixedPath, FSAGetStatusStr(status)); free(fixedPath); @@ -34,7 +35,7 @@ __wut_fsa_chdir(struct _reent *r, } } - if (snprintf(deviceData->cwd, sizeof(deviceData->cwd), "%s", fixedPath) >= (int) sizeof(deviceData->cwd)) { + if (snprintf(deviceData->cwd, sizeof(deviceData->cwd), "%s", fixedPath) >= (int)sizeof(deviceData->cwd)) { WUT_DEBUG_REPORT("__wut_fsa_chdir: snprintf result was truncated\n"); } diff --git a/libraries/wutdevoptab/devoptab_fsa_chmod.cpp b/libraries/wutdevoptab/devoptab_fsa_chmod.cpp index 9572dcf55..87973320c 100644 --- a/libraries/wutdevoptab/devoptab_fsa_chmod.cpp +++ b/libraries/wutdevoptab/devoptab_fsa_chmod.cpp @@ -1,11 +1,12 @@ -#include "devoptab_fsa.h" #include #include +#include "devoptab_fsa.h" int __wut_fsa_chmod(struct _reent *r, const char *path, - mode_t mode) { + mode_t mode) +{ FSError status; __wut_fsa_device_t *deviceData; @@ -22,9 +23,9 @@ __wut_fsa_chmod(struct _reent *r, FSMode translatedMode = __wut_fsa_translate_permission_mode(mode); - deviceData = (__wut_fsa_device_t *) r->deviceData; + deviceData = (__wut_fsa_device_t *)r->deviceData; - status = FSAChangeMode(deviceData->clientHandle, fixedPath, translatedMode); + status = FSAChangeMode(deviceData->clientHandle, fixedPath, translatedMode); if (status < 0) { WUT_DEBUG_REPORT("FSAChangeMode(0x%08X, %s, 0x%X) failed: %s\n", deviceData->clientHandle, fixedPath, translatedMode, FSAGetStatusStr(status)); diff --git a/libraries/wutdevoptab/devoptab_fsa_close.cpp b/libraries/wutdevoptab/devoptab_fsa_close.cpp index f2918f8a8..3adb65d30 100644 --- a/libraries/wutdevoptab/devoptab_fsa_close.cpp +++ b/libraries/wutdevoptab/devoptab_fsa_close.cpp @@ -1,9 +1,10 @@ -#include "devoptab_fsa.h" #include +#include "devoptab_fsa.h" int __wut_fsa_close(struct _reent *r, - void *fd) { + void *fd) +{ FSError status; __wut_fsa_file_t *file; __wut_fsa_device_t *deviceData; @@ -13,9 +14,9 @@ __wut_fsa_close(struct _reent *r, return -1; } - file = (__wut_fsa_file_t *) fd; + file = (__wut_fsa_file_t *)fd; - deviceData = (__wut_fsa_device_t *) r->deviceData; + deviceData = (__wut_fsa_device_t *)r->deviceData; std::scoped_lock lock(file->mutex); diff --git a/libraries/wutdevoptab/devoptab_fsa_dirclose.cpp b/libraries/wutdevoptab/devoptab_fsa_dirclose.cpp index 6024e1c90..4ee361868 100644 --- a/libraries/wutdevoptab/devoptab_fsa_dirclose.cpp +++ b/libraries/wutdevoptab/devoptab_fsa_dirclose.cpp @@ -1,9 +1,10 @@ -#include "devoptab_fsa.h" #include +#include "devoptab_fsa.h" int __wut_fsa_dirclose(struct _reent *r, - DIR_ITER *dirState) { + DIR_ITER *dirState) +{ FSError status; __wut_fsa_dir_t *dir; __wut_fsa_device_t *deviceData; @@ -13,9 +14,9 @@ __wut_fsa_dirclose(struct _reent *r, return -1; } - dir = (__wut_fsa_dir_t *) (dirState->dirStruct); + dir = (__wut_fsa_dir_t *)(dirState->dirStruct); - deviceData = (__wut_fsa_device_t *) r->deviceData; + deviceData = (__wut_fsa_device_t *)r->deviceData; std::scoped_lock lock(dir->mutex); diff --git a/libraries/wutdevoptab/devoptab_fsa_dirnext.cpp b/libraries/wutdevoptab/devoptab_fsa_dirnext.cpp index 6734b837d..6bba654a2 100644 --- a/libraries/wutdevoptab/devoptab_fsa_dirnext.cpp +++ b/libraries/wutdevoptab/devoptab_fsa_dirnext.cpp @@ -1,12 +1,13 @@ -#include "devoptab_fsa.h" #include #include +#include "devoptab_fsa.h" int __wut_fsa_dirnext(struct _reent *r, DIR_ITER *dirState, char *filename, - struct stat *filestat) { + struct stat *filestat) +{ FSError status; __wut_fsa_dir_t *dir; __wut_fsa_device_t *deviceData; @@ -16,8 +17,8 @@ __wut_fsa_dirnext(struct _reent *r, return -1; } - deviceData = (__wut_fsa_device_t *) r->deviceData; - dir = (__wut_fsa_dir_t *) (dirState->dirStruct); + deviceData = (__wut_fsa_device_t *)r->deviceData; + dir = (__wut_fsa_dir_t *)(dirState->dirStruct); std::scoped_lock lock(dir->mutex); memset(&dir->entry_data, 0, sizeof(dir->entry_data)); @@ -34,9 +35,9 @@ __wut_fsa_dirnext(struct _reent *r, ino_t ino; size_t fullLen = strlen(dir->fullPath) + 1 + strlen(dir->entry_data.name) + 1; - char *fullStr = (char *) memalign(0x40, fullLen); + char *fullStr = (char *)memalign(0x40, fullLen); if (fullStr) { - if (snprintf(fullStr, fullLen, "%s/%s", dir->fullPath, dir->entry_data.name) >= (int) fullLen) { + if (snprintf(fullStr, fullLen, "%s/%s", dir->fullPath, dir->entry_data.name) >= (int)fullLen) { WUT_DEBUG_REPORT("__wut_fsa_dirnext: snprintf fullStr result was truncated\n"); } ino = __wut_fsa_hashstring(fullStr); diff --git a/libraries/wutdevoptab/devoptab_fsa_diropen.cpp b/libraries/wutdevoptab/devoptab_fsa_diropen.cpp index d98babf9b..7178e7cdd 100644 --- a/libraries/wutdevoptab/devoptab_fsa_diropen.cpp +++ b/libraries/wutdevoptab/devoptab_fsa_diropen.cpp @@ -1,10 +1,11 @@ -#include "devoptab_fsa.h" #include +#include "devoptab_fsa.h" DIR_ITER * __wut_fsa_diropen(struct _reent *r, DIR_ITER *dirState, - const char *path) { + const char *path) +{ FSADirectoryHandle fd; FSError status; __wut_fsa_dir_t *dir; @@ -19,8 +20,8 @@ __wut_fsa_diropen(struct _reent *r, if (!fixedPath) { return NULL; } - dir = (__wut_fsa_dir_t *) (dirState->dirStruct); - deviceData = (__wut_fsa_device_t *) r->deviceData; + dir = (__wut_fsa_dir_t *)(dirState->dirStruct); + deviceData = (__wut_fsa_device_t *)r->deviceData; // Remove trailing '/' if (fixedPath[0] != '\0') { @@ -29,7 +30,7 @@ __wut_fsa_diropen(struct _reent *r, } } - if (snprintf(dir->fullPath, sizeof(dir->fullPath), "%s", fixedPath) >= (int) sizeof(dir->fullPath)) { + if (snprintf(dir->fullPath, sizeof(dir->fullPath), "%s", fixedPath) >= (int)sizeof(dir->fullPath)) { WUT_DEBUG_REPORT("__wut_fsa_diropen: snprintf result was truncated\n"); } @@ -47,7 +48,7 @@ __wut_fsa_diropen(struct _reent *r, } dir->magic = FSA_DIRITER_MAGIC; - dir->fd = fd; + dir->fd = fd; memset(&dir->entry_data, 0, sizeof(dir->entry_data)); return dirState; } diff --git a/libraries/wutdevoptab/devoptab_fsa_dirreset.cpp b/libraries/wutdevoptab/devoptab_fsa_dirreset.cpp index c3fdad67e..d5e0396ce 100644 --- a/libraries/wutdevoptab/devoptab_fsa_dirreset.cpp +++ b/libraries/wutdevoptab/devoptab_fsa_dirreset.cpp @@ -1,9 +1,10 @@ -#include "devoptab_fsa.h" #include +#include "devoptab_fsa.h" int __wut_fsa_dirreset(struct _reent *r, - DIR_ITER *dirState) { + DIR_ITER *dirState) +{ FSError status; __wut_fsa_dir_t *dir; __wut_fsa_device_t *deviceData; @@ -13,8 +14,8 @@ __wut_fsa_dirreset(struct _reent *r, return -1; } - dir = (__wut_fsa_dir_t *) (dirState->dirStruct); - deviceData = (__wut_fsa_device_t *) r->deviceData; + dir = (__wut_fsa_dir_t *)(dirState->dirStruct); + deviceData = (__wut_fsa_device_t *)r->deviceData; std::scoped_lock lock(dir->mutex); diff --git a/libraries/wutdevoptab/devoptab_fsa_fstat.cpp b/libraries/wutdevoptab/devoptab_fsa_fstat.cpp index 0e8402c15..89575a44e 100644 --- a/libraries/wutdevoptab/devoptab_fsa_fstat.cpp +++ b/libraries/wutdevoptab/devoptab_fsa_fstat.cpp @@ -1,10 +1,11 @@ -#include "devoptab_fsa.h" #include +#include "devoptab_fsa.h" int __wut_fsa_fstat(struct _reent *r, void *fd, - struct stat *st) { + struct stat *st) +{ FSError status; FSAStat fsStat; __wut_fsa_file_t *file; @@ -15,8 +16,8 @@ __wut_fsa_fstat(struct _reent *r, return -1; } - file = (__wut_fsa_file_t *) fd; - deviceData = (__wut_fsa_device_t *) r->deviceData; + file = (__wut_fsa_file_t *)fd; + deviceData = (__wut_fsa_device_t *)r->deviceData; std::scoped_lock lock(file->mutex); diff --git a/libraries/wutdevoptab/devoptab_fsa_fsync.cpp b/libraries/wutdevoptab/devoptab_fsa_fsync.cpp index 0bfb6d70a..3b56bde64 100644 --- a/libraries/wutdevoptab/devoptab_fsa_fsync.cpp +++ b/libraries/wutdevoptab/devoptab_fsa_fsync.cpp @@ -1,9 +1,10 @@ -#include "devoptab_fsa.h" #include +#include "devoptab_fsa.h" int __wut_fsa_fsync(struct _reent *r, - void *fd) { + void *fd) +{ FSError status; __wut_fsa_file_t *file; __wut_fsa_device_t *deviceData; @@ -13,9 +14,9 @@ __wut_fsa_fsync(struct _reent *r, return -1; } - file = (__wut_fsa_file_t *) fd; + file = (__wut_fsa_file_t *)fd; - deviceData = (__wut_fsa_device_t *) r->deviceData; + deviceData = (__wut_fsa_device_t *)r->deviceData; std::scoped_lock lock(file->mutex); diff --git a/libraries/wutdevoptab/devoptab_fsa_mkdir.cpp b/libraries/wutdevoptab/devoptab_fsa_mkdir.cpp index 22cbf5b45..522b9ad3b 100644 --- a/libraries/wutdevoptab/devoptab_fsa_mkdir.cpp +++ b/libraries/wutdevoptab/devoptab_fsa_mkdir.cpp @@ -3,7 +3,8 @@ int __wut_fsa_mkdir(struct _reent *r, const char *path, - int mode) { + int mode) +{ FSError status; char *fixedPath; __wut_fsa_device_t *deviceData; @@ -19,11 +20,11 @@ __wut_fsa_mkdir(struct _reent *r, return -1; } - deviceData = (__wut_fsa_device_t *) r->deviceData; + deviceData = (__wut_fsa_device_t *)r->deviceData; FSMode translatedMode = __wut_fsa_translate_permission_mode(mode); - status = FSAMakeDir(deviceData->clientHandle, fixedPath, translatedMode); + status = FSAMakeDir(deviceData->clientHandle, fixedPath, translatedMode); if (status < 0) { WUT_DEBUG_REPORT("FSAMakeDir(0x%08X, %s, 0x%X) failed: %s\n", deviceData->clientHandle, fixedPath, translatedMode, FSAGetStatusStr(status)); diff --git a/libraries/wutdevoptab/devoptab_fsa_open.cpp b/libraries/wutdevoptab/devoptab_fsa_open.cpp index 04850f3c6..6c49d8596 100644 --- a/libraries/wutdevoptab/devoptab_fsa_open.cpp +++ b/libraries/wutdevoptab/devoptab_fsa_open.cpp @@ -1,5 +1,5 @@ -#include "devoptab_fsa.h" #include +#include "devoptab_fsa.h" // Extended "magic" value that allows opening files with FS_OPEN_FLAG_UNENCRYPTED in underlying FSOpenFileEx() call similar to O_DIRECTORY #ifndef O_UNENCRYPTED @@ -11,7 +11,8 @@ __wut_fsa_open(struct _reent *r, void *fileStruct, const char *path, int flags, - int mode) { + int mode) +{ FSAFileHandle fd; FSError status; const char *fsMode; @@ -24,9 +25,9 @@ __wut_fsa_open(struct _reent *r, } bool createFileIfNotFound = false; - bool failIfFileNotFound = false; + bool failIfFileNotFound = false; // Map flags to open modes - int commonFlagMask = O_CREAT | O_TRUNC | O_APPEND; + int commonFlagMask = O_CREAT | O_TRUNC | O_APPEND; if (((flags & O_ACCMODE) == O_RDONLY) && !(flags & commonFlagMask)) { fsMode = "r"; } else if (((flags & O_ACCMODE) == O_RDWR) && !(flags & commonFlagMask)) { @@ -50,19 +51,19 @@ __wut_fsa_open(struct _reent *r, createFileIfNotFound = true; // It's not possible to open a file with write only mode which doesn't truncate the file // Technically we could read from the file, but our read implementation is blocking this. - fsMode = "r+"; - } else if (((flags & O_ACCMODE) == O_RDWR) && ((flags & commonFlagMask) == (O_CREAT))) { + fsMode = "r+"; + } else if (((flags & O_ACCMODE) == O_RDWR) && ((flags & commonFlagMask) == (O_CREAT))) { // Cafe OS doesn't have a matching mode for this, so we have to be creative and create the file. createFileIfNotFound = true; - fsMode = "r+"; + fsMode = "r+"; } else if (((flags & O_ACCMODE) == O_WRONLY) && ((flags & commonFlagMask) == (O_APPEND))) { // Cafe OS doesn't have a matching mode for this, so we have to check if the file exists. failIfFileNotFound = true; - fsMode = "a"; + fsMode = "a"; } else if (((flags & O_ACCMODE) == O_WRONLY) && ((flags & commonFlagMask) == (O_TRUNC))) { // As above failIfFileNotFound = true; - fsMode = "w"; + fsMode = "w"; } else { r->_errno = EINVAL; return -1; @@ -75,18 +76,18 @@ __wut_fsa_open(struct _reent *r, } - file = (__wut_fsa_file_t *) fileStruct; - deviceData = (__wut_fsa_device_t *) r->deviceData; + file = (__wut_fsa_file_t *)fileStruct; + deviceData = (__wut_fsa_device_t *)r->deviceData; - if (snprintf(file->fullPath, sizeof(file->fullPath), "%s", fixedPath) >= (int) sizeof(file->fullPath)) { + if (snprintf(file->fullPath, sizeof(file->fullPath), "%s", fixedPath) >= (int)sizeof(file->fullPath)) { WUT_DEBUG_REPORT("__wut_fsa_open: snprintf result was truncated\n"); } free(fixedPath); // Prepare flags FSOpenFileFlags openFlags = (flags & O_UNENCRYPTED) ? FS_OPEN_FLAG_UNENCRYPTED : FS_OPEN_FLAG_NONE; - FSMode translatedMode = __wut_fsa_translate_permission_mode(mode); - uint32_t preAllocSize = 0; + FSMode translatedMode = __wut_fsa_translate_permission_mode(mode); + uint32_t preAllocSize = 0; // Init mutex and lock file->mutex.init(file->fullPath); @@ -137,8 +138,8 @@ __wut_fsa_open(struct _reent *r, return -1; } - file->fd = fd; - file->flags = (flags & (O_ACCMODE | O_APPEND | O_SYNC)); + file->fd = fd; + file->flags = (flags & (O_ACCMODE | O_APPEND | O_SYNC)); // Is always 0, even if O_APPEND is set. file->offset = 0; @@ -153,7 +154,6 @@ __wut_fsa_open(struct _reent *r, if (FSACloseFile(deviceData->clientHandle, fd) < 0) { WUT_DEBUG_REPORT("FSACloseFile(0x%08X, 0x%08X) (%s) failed: %s\n", deviceData->clientHandle, fd, file->fullPath, FSAGetStatusStr(status)); - } return -1; } diff --git a/libraries/wutdevoptab/devoptab_fsa_read.cpp b/libraries/wutdevoptab/devoptab_fsa_read.cpp index a52672600..4ad58ad32 100644 --- a/libraries/wutdevoptab/devoptab_fsa_read.cpp +++ b/libraries/wutdevoptab/devoptab_fsa_read.cpp @@ -1,8 +1,10 @@ -#include "devoptab_fsa.h" #include #include +#include "devoptab_fsa.h" -ssize_t __wut_fsa_read(struct _reent *r, void *fd, char *ptr, size_t len) { +ssize_t +__wut_fsa_read(struct _reent *r, void *fd, char *ptr, size_t len) +{ FSError status; __wut_fsa_file_t *file; __wut_fsa_device_t *deviceData; @@ -12,7 +14,7 @@ ssize_t __wut_fsa_read(struct _reent *r, void *fd, char *ptr, size_t len) { } // Check that the file was opened with read access - file = (__wut_fsa_file_t *) fd; + file = (__wut_fsa_file_t *)fd; if ((file->flags & O_ACCMODE) == O_WRONLY) { r->_errno = EBADF; return -1; @@ -21,7 +23,7 @@ ssize_t __wut_fsa_read(struct _reent *r, void *fd, char *ptr, size_t len) { // cache-aligned, cache-line-sized __attribute__((aligned(0x40))) uint8_t alignedBuffer[0x40]; - deviceData = (__wut_fsa_device_t *) r->deviceData; + deviceData = (__wut_fsa_device_t *)r->deviceData; std::scoped_lock lock(file->mutex); @@ -29,16 +31,16 @@ ssize_t __wut_fsa_read(struct _reent *r, void *fd, char *ptr, size_t len) { while (bytesRead < len) { // only use input buffer if cache-aligned and read size is a multiple of cache line size // otherwise read into alignedBuffer - uint8_t *tmp = (uint8_t *) ptr; - size_t size = len - bytesRead; + uint8_t *tmp = (uint8_t *)ptr; + size_t size = len - bytesRead; if (size < 0x40) { // read partial cache-line back-end tmp = alignedBuffer; - } else if ((uintptr_t) ptr & 0x3F) { + } else if ((uintptr_t)ptr & 0x3F) { // read partial cache-line front-end - tmp = alignedBuffer; - size = MIN(size, 0x40 - ((uintptr_t) ptr & 0x3F)); + tmp = alignedBuffer; + size = MIN(size, 0x40 - ((uintptr_t)ptr & 0x3F)); } else { // read whole cache lines size &= ~0x3F; @@ -71,7 +73,7 @@ ssize_t __wut_fsa_read(struct _reent *r, void *fd, char *ptr, size_t len) { bytesRead += status; ptr += status; - if ((size_t) status != size) { + if ((size_t)status != size) { return bytesRead; // partial read } } diff --git a/libraries/wutdevoptab/devoptab_fsa_rename.cpp b/libraries/wutdevoptab/devoptab_fsa_rename.cpp index f00a8f76c..eb5fa07ee 100644 --- a/libraries/wutdevoptab/devoptab_fsa_rename.cpp +++ b/libraries/wutdevoptab/devoptab_fsa_rename.cpp @@ -3,7 +3,8 @@ int __wut_fsa_rename(struct _reent *r, const char *oldName, - const char *newName) { + const char *newName) +{ FSError status; char *fixedOldPath, *fixedNewPath; __wut_fsa_device_t *deviceData; @@ -26,9 +27,9 @@ __wut_fsa_rename(struct _reent *r, return -1; } - deviceData = (__wut_fsa_device_t *) r->deviceData; + deviceData = (__wut_fsa_device_t *)r->deviceData; - status = FSARename(deviceData->clientHandle, fixedOldPath, fixedNewPath); + status = FSARename(deviceData->clientHandle, fixedOldPath, fixedNewPath); if (status < 0) { WUT_DEBUG_REPORT("FSARename(0x%08X, %s, %s) failed: %s\n", deviceData->clientHandle, fixedOldPath, fixedNewPath, FSAGetStatusStr(status)); diff --git a/libraries/wutdevoptab/devoptab_fsa_rmdir.cpp b/libraries/wutdevoptab/devoptab_fsa_rmdir.cpp index ccd1a52d1..b3472f246 100644 --- a/libraries/wutdevoptab/devoptab_fsa_rmdir.cpp +++ b/libraries/wutdevoptab/devoptab_fsa_rmdir.cpp @@ -2,7 +2,8 @@ int __wut_fsa_rmdir(struct _reent *r, - const char *name) { + const char *name) +{ FSError status; __wut_fsa_device_t *deviceData; @@ -17,9 +18,9 @@ __wut_fsa_rmdir(struct _reent *r, return -1; } - deviceData = (__wut_fsa_device_t *) r->deviceData; + deviceData = (__wut_fsa_device_t *)r->deviceData; - status = FSARemove(deviceData->clientHandle, fixedPath); + status = FSARemove(deviceData->clientHandle, fixedPath); if (status < 0) { WUT_DEBUG_REPORT("FSARemove(0x%08X, %s) failed: %s\n", deviceData->clientHandle, fixedPath, FSAGetStatusStr(status)); diff --git a/libraries/wutdevoptab/devoptab_fsa_seek.cpp b/libraries/wutdevoptab/devoptab_fsa_seek.cpp index 07ba26b53..e8ff5b91d 100644 --- a/libraries/wutdevoptab/devoptab_fsa_seek.cpp +++ b/libraries/wutdevoptab/devoptab_fsa_seek.cpp @@ -1,11 +1,12 @@ -#include "devoptab_fsa.h" #include +#include "devoptab_fsa.h" off_t __wut_fsa_seek(struct _reent *r, void *fd, off_t pos, - int whence) { + int whence) +{ FSError status; FSAStat fsStat; uint64_t offset; @@ -17,9 +18,9 @@ __wut_fsa_seek(struct _reent *r, return -1; } - file = (__wut_fsa_file_t *) fd; + file = (__wut_fsa_file_t *)fd; - deviceData = (__wut_fsa_device_t *) r->deviceData; + deviceData = (__wut_fsa_device_t *)r->deviceData; std::scoped_lock lock(file->mutex); @@ -29,11 +30,11 @@ __wut_fsa_seek(struct _reent *r, offset = 0; break; } - case SEEK_CUR: { // Set position relative to the current position + case SEEK_CUR: { // Set position relative to the current position offset = file->offset; break; } - case SEEK_END: { // Set position relative to the end of the file + case SEEK_END: { // Set position relative to the end of the file status = FSAGetStatFile(deviceData->clientHandle, file->fd, &fsStat); if (status < 0) { WUT_DEBUG_REPORT("FSAGetStatFile(0x%08X, 0x%08X, 0x%08X) (%s) failed: %s\n", @@ -44,13 +45,13 @@ __wut_fsa_seek(struct _reent *r, offset = fsStat.size; break; } - default: { // An invalid option was provided + default: { // An invalid option was provided r->_errno = EINVAL; return -1; } } - if (pos < 0 && (off_t) offset < -pos) { + if (pos < 0 && (off_t)offset < -pos) { // Don't allow seek to before the beginning of the file r->_errno = EINVAL; return -1; @@ -60,19 +61,19 @@ __wut_fsa_seek(struct _reent *r, return -1; } - if ((uint32_t) (offset + pos) == file->offset) { + if ((uint32_t)(offset + pos) == file->offset) { return file->offset; } uint32_t old_pos = file->offset; - file->offset = offset + pos; + file->offset = offset + pos; - status = FSASetPosFile(deviceData->clientHandle, file->fd, file->offset); + status = FSASetPosFile(deviceData->clientHandle, file->fd, file->offset); if (status < 0) { WUT_DEBUG_REPORT("FSASetPosFile(0x%08X, 0x%08X, 0x%08X) (%s) failed: %s\n", deviceData->clientHandle, file->fd, file->offset, file->fullPath, FSAGetStatusStr(status)); file->offset = old_pos; - r->_errno = __wut_fsa_translate_error(status); + r->_errno = __wut_fsa_translate_error(status); return -1; } diff --git a/libraries/wutdevoptab/devoptab_fsa_stat.cpp b/libraries/wutdevoptab/devoptab_fsa_stat.cpp index 80029e777..99f1fe539 100644 --- a/libraries/wutdevoptab/devoptab_fsa_stat.cpp +++ b/libraries/wutdevoptab/devoptab_fsa_stat.cpp @@ -3,7 +3,8 @@ int __wut_fsa_stat(struct _reent *r, const char *path, - struct stat *st) { + struct stat *st) +{ FSError status; FSAStat fsStat; __wut_fsa_device_t *deviceData; @@ -19,9 +20,9 @@ __wut_fsa_stat(struct _reent *r, return -1; } - deviceData = (__wut_fsa_device_t *) r->deviceData; + deviceData = (__wut_fsa_device_t *)r->deviceData; - status = FSAGetStat(deviceData->clientHandle, fixedPath, &fsStat); + status = FSAGetStat(deviceData->clientHandle, fixedPath, &fsStat); if (status < 0) { if (status != FS_ERROR_NOT_FOUND) { WUT_DEBUG_REPORT("FSAGetStat(0x%08X, %s, 0x%08X) failed: %s\n", diff --git a/libraries/wutdevoptab/devoptab_fsa_statvfs.cpp b/libraries/wutdevoptab/devoptab_fsa_statvfs.cpp index 971d0046b..bd89a9026 100644 --- a/libraries/wutdevoptab/devoptab_fsa_statvfs.cpp +++ b/libraries/wutdevoptab/devoptab_fsa_statvfs.cpp @@ -3,12 +3,13 @@ int __wut_fsa_statvfs(struct _reent *r, const char *path, - struct statvfs *buf) { + struct statvfs *buf) +{ FSError status; uint64_t freeSpace; __wut_fsa_device_t *deviceData; - deviceData = (__wut_fsa_device_t *) r->deviceData; + deviceData = (__wut_fsa_device_t *)r->deviceData; if (deviceData->isSDCard) { r->_errno = ENOSYS; return -1; @@ -33,23 +34,23 @@ __wut_fsa_statvfs(struct _reent *r, free(fixedPath); // File system block size - buf->f_bsize = deviceData->deviceSectorSize; + buf->f_bsize = deviceData->deviceSectorSize; // Fundamental file system block size buf->f_frsize = deviceData->deviceSectorSize; // Total number of blocks on file system in units of f_frsize buf->f_blocks = deviceData->deviceSizeInSectors; // Free blocks available for all and for non-privileged processes - buf->f_bfree = buf->f_bavail = (uint32_t) (freeSpace / buf->f_frsize); + buf->f_bfree = buf->f_bavail = (uint32_t)(freeSpace / buf->f_frsize); // Number of inodes at this point in time - buf->f_files = 0xFFFFFFFF; + buf->f_files = 0xFFFFFFFF; // Free inodes available for all and for non-privileged processes - buf->f_ffree = 0xFFFFFFFF; + buf->f_ffree = 0xFFFFFFFF; // File system id - buf->f_fsid = (unsigned long) deviceData->clientHandle; + buf->f_fsid = (unsigned long)deviceData->clientHandle; // Bit mask of f_flag values. - buf->f_flag = 0; + buf->f_flag = 0; // Maximum length of filenames - buf->f_namemax = 255; + buf->f_namemax = 255; return 0; } \ No newline at end of file diff --git a/libraries/wutdevoptab/devoptab_fsa_truncate.cpp b/libraries/wutdevoptab/devoptab_fsa_truncate.cpp index cd3e0503c..98d56af34 100644 --- a/libraries/wutdevoptab/devoptab_fsa_truncate.cpp +++ b/libraries/wutdevoptab/devoptab_fsa_truncate.cpp @@ -1,10 +1,11 @@ -#include "devoptab_fsa.h" #include +#include "devoptab_fsa.h" int __wut_fsa_ftruncate(struct _reent *r, void *fd, - off_t len) { + off_t len) +{ FSError status; __wut_fsa_file_t *file; __wut_fsa_device_t *deviceData; @@ -15,9 +16,9 @@ __wut_fsa_ftruncate(struct _reent *r, return -1; } - file = (__wut_fsa_file_t *) fd; + file = (__wut_fsa_file_t *)fd; - deviceData = (__wut_fsa_device_t *) r->deviceData; + deviceData = (__wut_fsa_device_t *)r->deviceData; std::scoped_lock lock(file->mutex); diff --git a/libraries/wutdevoptab/devoptab_fsa_unlink.cpp b/libraries/wutdevoptab/devoptab_fsa_unlink.cpp index 72360d845..95921f8ea 100644 --- a/libraries/wutdevoptab/devoptab_fsa_unlink.cpp +++ b/libraries/wutdevoptab/devoptab_fsa_unlink.cpp @@ -2,7 +2,8 @@ int __wut_fsa_unlink(struct _reent *r, - const char *name) { + const char *name) +{ FSError status; char *fixedPath; __wut_fsa_device_t *deviceData; @@ -17,9 +18,9 @@ __wut_fsa_unlink(struct _reent *r, r->_errno = ENOMEM; return -1; } - deviceData = (__wut_fsa_device_t *) r->deviceData; + deviceData = (__wut_fsa_device_t *)r->deviceData; - status = FSARemove(deviceData->clientHandle, fixedPath); + status = FSARemove(deviceData->clientHandle, fixedPath); if (status < 0) { WUT_DEBUG_REPORT("FSARemove(0x%08X, %s) failed: %s\n", deviceData->clientHandle, fixedPath, FSAGetStatusStr(status)); diff --git a/libraries/wutdevoptab/devoptab_fsa_utils.cpp b/libraries/wutdevoptab/devoptab_fsa_utils.cpp index 5c540e495..e49d54361 100644 --- a/libraries/wutdevoptab/devoptab_fsa_utils.cpp +++ b/libraries/wutdevoptab/devoptab_fsa_utils.cpp @@ -8,9 +8,9 @@ #define ispathend(ch) (ispathsep(ch) || iseos(ch)) // https://gist.github.com/starwing/2761647 -static -char * -__wut_fsa_normpath(char *out, const char *in) { +static char * +__wut_fsa_normpath(char *out, const char *in) +{ char *pos[COMP_MAX], **top = pos, *head = out; int isabs = ispathsep(*in); @@ -65,12 +65,13 @@ __wut_fsa_normpath(char *out, const char *in) { } uint32_t -__wut_fsa_hashstring(const char *str) { +__wut_fsa_hashstring(const char *str) +{ uint32_t h; uint8_t *p; h = 0; - for (p = (uint8_t *) str; *p != '\0'; p++) { + for (p = (uint8_t *)str; *p != '\0'; p++) { h = 37 * h + *p; } return h; @@ -78,7 +79,8 @@ __wut_fsa_hashstring(const char *str) { char * __wut_fsa_fixpath(struct _reent *r, - const char *path) { + const char *path) +{ char *p; char *fixedPath; @@ -89,7 +91,7 @@ __wut_fsa_fixpath(struct _reent *r, p = strchr(path, ':') + 1; if (!strchr(path, ':')) { - p = (char *) path; + p = (char *)path; } // wii u softlocks on empty strings so give expected error back @@ -99,7 +101,7 @@ __wut_fsa_fixpath(struct _reent *r, } int maxPathLength = PATH_MAX; - fixedPath = static_cast(memalign(0x40, maxPathLength)); + fixedPath = static_cast(memalign(0x40, maxPathLength)); if (!fixedPath) { WUT_DEBUG_REPORT("__wut_fsa_fixpath: failed to allocate memory for fixedPath\n"); r->_errno = ENOMEM; @@ -108,7 +110,7 @@ __wut_fsa_fixpath(struct _reent *r, // Convert to an absolute path if (p[0] != '\0' && p[0] != '\\' && p[0] != '/') { - __wut_fsa_device_t *deviceData = (__wut_fsa_device_t *) r->deviceData; + __wut_fsa_device_t *deviceData = (__wut_fsa_device_t *)r->deviceData; if (snprintf(fixedPath, maxPathLength, "%s/%s", deviceData->cwd, p) >= maxPathLength) { WUT_DEBUG_REPORT("__wut_fsa_fixpath: fixedPath snprintf result (absolute) was truncated\n"); } @@ -152,7 +154,9 @@ __wut_fsa_fixpath(struct _reent *r, return fixedPath; } -mode_t __wut_fsa_translate_stat_mode(FSStat *fsStat) { +mode_t +__wut_fsa_translate_stat_mode(FSStat *fsStat) +{ mode_t retMode = 0; if ((fsStat->flags & FS_STAT_LINK) == FS_STAT_LINK) { @@ -176,24 +180,28 @@ mode_t __wut_fsa_translate_stat_mode(FSStat *fsStat) { return retMode | permissionMode; } -void __wut_fsa_translate_stat(FSAClientHandle clientHandle, FSStat *fsStat, ino_t ino, struct stat *posStat) { +void +__wut_fsa_translate_stat(FSAClientHandle clientHandle, FSStat *fsStat, ino_t ino, struct stat *posStat) +{ memset(posStat, 0, sizeof(struct stat)); - posStat->st_dev = (dev_t) clientHandle; - posStat->st_ino = ino; - posStat->st_mode = __wut_fsa_translate_stat_mode(fsStat); - posStat->st_nlink = 1; - posStat->st_uid = fsStat->owner; - posStat->st_gid = fsStat->group; - posStat->st_rdev = posStat->st_dev; - posStat->st_size = fsStat->size; - posStat->st_atime = __wut_fsa_translate_time(fsStat->modified); - posStat->st_ctime = __wut_fsa_translate_time(fsStat->created); - posStat->st_mtime = __wut_fsa_translate_time(fsStat->modified); + posStat->st_dev = (dev_t)clientHandle; + posStat->st_ino = ino; + posStat->st_mode = __wut_fsa_translate_stat_mode(fsStat); + posStat->st_nlink = 1; + posStat->st_uid = fsStat->owner; + posStat->st_gid = fsStat->group; + posStat->st_rdev = posStat->st_dev; + posStat->st_size = fsStat->size; + posStat->st_atime = __wut_fsa_translate_time(fsStat->modified); + posStat->st_ctime = __wut_fsa_translate_time(fsStat->created); + posStat->st_mtime = __wut_fsa_translate_time(fsStat->modified); posStat->st_blksize = 512; - posStat->st_blocks = (posStat->st_size + posStat->st_blksize - 1) / posStat->st_size; + posStat->st_blocks = (posStat->st_size + posStat->st_blksize - 1) / posStat->st_size; } -int __wut_fsa_translate_error(FSError error) { +int +__wut_fsa_translate_error(FSError error) +{ switch (error) { case FS_ERROR_END_OF_DIR: case FS_ERROR_END_OF_FILE: diff --git a/libraries/wutdevoptab/devoptab_fsa_write.cpp b/libraries/wutdevoptab/devoptab_fsa_write.cpp index 199b0bc7f..4b677c385 100644 --- a/libraries/wutdevoptab/devoptab_fsa_write.cpp +++ b/libraries/wutdevoptab/devoptab_fsa_write.cpp @@ -1,7 +1,9 @@ -#include "devoptab_fsa.h" #include +#include "devoptab_fsa.h" -ssize_t __wut_fsa_write(struct _reent *r, void *fd, const char *ptr, size_t len) { +ssize_t +__wut_fsa_write(struct _reent *r, void *fd, const char *ptr, size_t len) +{ FSError status; __wut_fsa_file_t *file; __wut_fsa_device_t *deviceData; @@ -12,7 +14,7 @@ ssize_t __wut_fsa_write(struct _reent *r, void *fd, const char *ptr, size_t len) } // Check that the file was opened with write access - file = (__wut_fsa_file_t *) fd; + file = (__wut_fsa_file_t *)fd; if ((file->flags & O_ACCMODE) == O_RDONLY) { r->_errno = EBADF; return -1; @@ -21,7 +23,7 @@ ssize_t __wut_fsa_write(struct _reent *r, void *fd, const char *ptr, size_t len) // cache-aligned, cache-line-sized __attribute__((aligned(0x40))) uint8_t alignedBuffer[0x40]; - deviceData = (__wut_fsa_device_t *) r->deviceData; + deviceData = (__wut_fsa_device_t *)r->deviceData; std::scoped_lock lock(file->mutex); @@ -35,16 +37,16 @@ ssize_t __wut_fsa_write(struct _reent *r, void *fd, const char *ptr, size_t len) while (bytesWritten < len) { // only use input buffer if cache-aligned and write size is a multiple of cache line size // otherwise write from alignedBuffer - uint8_t *tmp = (uint8_t *) ptr; - size_t size = len - bytesWritten; + uint8_t *tmp = (uint8_t *)ptr; + size_t size = len - bytesWritten; if (size < 0x40) { // write partial cache-line back-end tmp = alignedBuffer; - } else if ((uintptr_t) ptr & 0x3F) { + } else if ((uintptr_t)ptr & 0x3F) { // write partial cache-line front-end - tmp = alignedBuffer; - size = MIN(size, 0x40 - ((uintptr_t) ptr & 0x3F)); + tmp = alignedBuffer; + size = MIN(size, 0x40 - ((uintptr_t)ptr & 0x3F)); } else { // write whole cache lines size &= ~0x3F; @@ -76,7 +78,7 @@ ssize_t __wut_fsa_write(struct _reent *r, void *fd, const char *ptr, size_t len) bytesWritten += status; ptr += status; - if ((size_t) status != size) { + if ((size_t)status != size) { return bytesWritten; // partial write } } diff --git a/libraries/wutmalloc/wut_malloc.c b/libraries/wutmalloc/wut_malloc.c index 24573c6bd..9c7f9b8ca 100644 --- a/libraries/wutmalloc/wut_malloc.c +++ b/libraries/wutmalloc/wut_malloc.c @@ -1,9 +1,9 @@ -#include #include +#include #include +#include #include #include -#include void __init_wut_malloc(void) @@ -73,9 +73,10 @@ _memalign_r(struct _reent *r, size_t align, size_t size) return ptr; } -struct mallinfo _mallinfo_r(struct _reent *r) +struct mallinfo +_mallinfo_r(struct _reent *r) { - struct mallinfo info = { 0 }; + struct mallinfo info = {0}; return info; } diff --git a/libraries/wutnewlib/wut_clock.c b/libraries/wutnewlib/wut_clock.c index e96bd1fa5..b0a3f3d26 100644 --- a/libraries/wutnewlib/wut_clock.c +++ b/libraries/wutnewlib/wut_clock.c @@ -1,5 +1,5 @@ -#include "wut_newlib.h" #include "wut_clock.h" +#include "wut_newlib.h" #include #include @@ -10,13 +10,13 @@ __wut_clock_gettime(clockid_t clock_id, { if (clock_id == CLOCK_MONOTONIC) { OSTime time = OSGetSystemTime(); - tp->tv_sec = (time_t)OSTicksToSeconds(time); + tp->tv_sec = (time_t)OSTicksToSeconds(time); time -= OSSecondsToTicks(tp->tv_sec); tp->tv_nsec = (long)OSTicksToNanoseconds(time); } else if (clock_id == CLOCK_REALTIME) { OSTime time = OSGetTime(); - tp->tv_sec = (time_t)OSTicksToSeconds(time); + tp->tv_sec = (time_t)OSTicksToSeconds(time); time -= OSSecondsToTicks(tp->tv_sec); tp->tv_nsec = (long)OSTicksToNanoseconds(time); @@ -45,7 +45,7 @@ __wut_clock_getres(clockid_t clock_id, return EINVAL; } - res->tv_sec = 0; + res->tv_sec = 0; res->tv_nsec = (long)((1000000000ull + (uint64_t)OSTimerClockSpeed) / (uint64_t)OSTimerClockSpeed); return 0; } diff --git a/libraries/wutnewlib/wut_clock.h b/libraries/wutnewlib/wut_clock.h index 69940eb2f..f98290b8e 100644 --- a/libraries/wutnewlib/wut_clock.h +++ b/libraries/wutnewlib/wut_clock.h @@ -1,19 +1,19 @@ #pragma once // The Wii U OSTime epoch is at 2000, so we must map it to 1970 for gettime -#define WIIU_OSTIME_EPOCH_YEAR (2000) +#define WIIU_OSTIME_EPOCH_YEAR (2000) // The Wii U FSTime epoch is at 1980, so we must map it to 1970 for gettime -#define WIIU_FSTIME_EPOCH_YEAR (1980) +#define WIIU_FSTIME_EPOCH_YEAR (1980) -#define EPOCH_YEAR (1970) -#define EPOCH_YEARS_SINCE_LEAP 2 -#define EPOCH_YEARS_SINCE_CENTURY 70 +#define EPOCH_YEAR (1970) +#define EPOCH_YEARS_SINCE_LEAP 2 +#define EPOCH_YEARS_SINCE_CENTURY 70 #define EPOCH_YEARS_SINCE_LEAP_CENTURY 370 -#define EPOCH_DIFF_YEARS(year) (year - EPOCH_YEAR) -#define EPOCH_DIFF_DAYS(year) \ - ((EPOCH_DIFF_YEARS(year) * 365) + \ - (EPOCH_DIFF_YEARS(year) - 1 + EPOCH_YEARS_SINCE_LEAP) / 4 - \ +#define EPOCH_DIFF_YEARS(year) (year - EPOCH_YEAR) +#define EPOCH_DIFF_DAYS(year) \ + ((EPOCH_DIFF_YEARS(year) * 365) + \ + (EPOCH_DIFF_YEARS(year) - 1 + EPOCH_YEARS_SINCE_LEAP) / 4 - \ (EPOCH_DIFF_YEARS(year) - 1 + EPOCH_YEARS_SINCE_CENTURY) / 100 + \ (EPOCH_DIFF_YEARS(year) - 1 + EPOCH_YEARS_SINCE_LEAP_CENTURY) / 400) #define EPOCH_DIFF_SECS(year) (60ull * 60ull * 24ull * (uint64_t)EPOCH_DIFF_DAYS(year)) diff --git a/libraries/wutnewlib/wut_gettod_r.c b/libraries/wutnewlib/wut_gettod_r.c index 1c44e3345..9c553c9c9 100644 --- a/libraries/wutnewlib/wut_gettod_r.c +++ b/libraries/wutnewlib/wut_gettod_r.c @@ -1,5 +1,5 @@ -#include "wut_newlib.h" #include "wut_clock.h" +#include "wut_newlib.h" #include @@ -21,7 +21,7 @@ __wut_gettod_r(struct _reent *ptr, if (tz != NULL) { tz->tz_minuteswest = 0; - tz->tz_dsttime = 0; + tz->tz_dsttime = 0; } return 0; diff --git a/libraries/wutnewlib/wut_lock.c b/libraries/wutnewlib/wut_lock.c index b16987a7a..93377f2aa 100644 --- a/libraries/wutnewlib/wut_lock.c +++ b/libraries/wutnewlib/wut_lock.c @@ -1,7 +1,7 @@ #include "wut_newlib.h" -#include #include +#include #define MAX_LOCKS 16 @@ -26,7 +26,7 @@ __wut_lock_init(int *lock, uint32_t new_mask; uint32_t cur_mask = sLibcLockUsedMask; do { - slot = __builtin_ffs(~cur_mask)-1; + slot = __builtin_ffs(~cur_mask) - 1; if (slot < 0 || slot >= MAX_LOCKS) break; new_mask = cur_mask | (1U << slot); } while (!OSCompareAndSwapAtomicEx(&sLibcLockUsedMask, cur_mask, new_mask, &cur_mask)); @@ -50,7 +50,7 @@ __wut_lock_close(int *lock) uint32_t new_mask; uint32_t cur_mask = sLibcLockUsedMask; do { - new_mask = cur_mask &~ (1U << *lock); + new_mask = cur_mask & ~(1U << *lock); } while (!OSCompareAndSwapAtomicEx(&sLibcLockUsedMask, cur_mask, new_mask, &cur_mask)); *lock = -1; diff --git a/libraries/wutnewlib/wut_nanosleep.c b/libraries/wutnewlib/wut_nanosleep.c index 3fa6991fb..ead989a25 100644 --- a/libraries/wutnewlib/wut_nanosleep.c +++ b/libraries/wutnewlib/wut_nanosleep.c @@ -1,7 +1,7 @@ #include "wut_newlib.h" -#include #include +#include #include int @@ -10,7 +10,7 @@ __wut_nanosleep(const struct timespec *req, { OSSleepTicks(OSSecondsToTicks(req->tv_sec) + OSNanosecondsToTicks(req->tv_nsec)); - rem->tv_sec = 0; + rem->tv_sec = 0; rem->tv_nsec = 0; return 0; } diff --git a/libraries/wutnewlib/wut_newlib.c b/libraries/wutnewlib/wut_newlib.c index 88797e3d8..889d4a270 100644 --- a/libraries/wutnewlib/wut_newlib.c +++ b/libraries/wutnewlib/wut_newlib.c @@ -1,22 +1,24 @@ #include "wut_newlib.h" -#include #include +#include #include #include #include -void(*__wut_exit)(int rc); -extern void __fini_wut(void); +void (*__wut_exit)(int rc); +extern void +__fini_wut(void); void -__wut__abort(void) { +__wut__abort(void) +{ const char *error_text = "Abort called.\n"; if (OSIsDebuggerPresent()) { __asm__ __volatile__("mr 3, %0\n" // load 'tmp' into r3 "tw 0x1f, 31, 31" // DBGSTR_INSTRUCTION - : - : "r"(error_text) - : "r3"); + : + : "r"(error_text) + : "r3"); } OSFatal(error_text); /* NOTREACHED */ @@ -25,11 +27,11 @@ __wut__abort(void) { void __wut__assert_func(const char *file, - int line, - const char *func, - const char *failedexpr) + int line, + const char *func, + const char *failedexpr) { - char tmp[512] = {}; + char tmp[512] = {}; char buffer[512] = {}; __os_snprintf(tmp, sizeof(tmp), "assertion \"%s\" failed:\n file \"%s\", line %d%s%s", @@ -44,7 +46,7 @@ __wut__assert_func(const char *file, lineLength = 0; } else if (lineLength >= 64) { target_ptr[j++] = '\n'; - lineLength = 0; + lineLength = 0; } target_ptr[j++] = tmp[i++]; lineLength++; @@ -53,9 +55,9 @@ __wut__assert_func(const char *file, if (OSIsDebuggerPresent()) { __asm__ __volatile__("mr 3, %0\n" // load 'tmp' into r3 "tw 0x1f, 31, 31" // DBGSTR_INSTRUCTION - : - : "r"(tmp) - : "r3"); + : + : "r"(tmp) + : "r3"); } OSFatal(buffer); @@ -63,83 +65,123 @@ __wut__assert_func(const char *file, while (1); } -void *_sbrk_r(struct _reent *ptr, ptrdiff_t incr) { - return __wut_sbrk_r(ptr, incr); +void * +_sbrk_r(struct _reent *ptr, ptrdiff_t incr) +{ + return __wut_sbrk_r(ptr, incr); } -void __syscall_lock_init(int *lock) { - __wut_lock_init(lock, 0); +void +__syscall_lock_init(int *lock) +{ + __wut_lock_init(lock, 0); } -void __syscall_lock_acquire(int *lock) { - __wut_lock_acquire(lock); +void +__syscall_lock_acquire(int *lock) +{ + __wut_lock_acquire(lock); } -void __syscall_lock_release(int *lock) { - __wut_lock_release(lock); +void +__syscall_lock_release(int *lock) +{ + __wut_lock_release(lock); } -void __syscall_lock_close(int *lock) { - __wut_lock_close(lock); +void +__syscall_lock_close(int *lock) +{ + __wut_lock_close(lock); } -void __syscall_lock_init_recursive(_LOCK_T *lock) { - __wut_lock_init(lock, 1); +void +__syscall_lock_init_recursive(_LOCK_T *lock) +{ + __wut_lock_init(lock, 1); } -void __syscall_lock_acquire_recursive(int *lock) { - __wut_lock_acquire(lock); +void +__syscall_lock_acquire_recursive(int *lock) +{ + __wut_lock_acquire(lock); } -void __syscall_lock_release_recursive(int *lock) { - __wut_lock_release(lock); +void +__syscall_lock_release_recursive(int *lock) +{ + __wut_lock_release(lock); } -void __syscall_lock_close_recursive(int *lock) { - __wut_lock_close(lock); +void +__syscall_lock_close_recursive(int *lock) +{ + __wut_lock_close(lock); } -void __syscall_malloc_lock(struct _reent *ptr) { - return __wut_malloc_lock(ptr); +void +__syscall_malloc_lock(struct _reent *ptr) +{ + return __wut_malloc_lock(ptr); } -void __syscall_malloc_unlock(struct _reent *ptr) { - return __wut_malloc_unlock(ptr); +void +__syscall_malloc_unlock(struct _reent *ptr) +{ + return __wut_malloc_unlock(ptr); } -struct _reent *__syscall_getreent(void) { - return __wut_getreent(); +struct _reent * +__syscall_getreent(void) +{ + return __wut_getreent(); } -void __syscall_exit(int rc) { - __fini_wut(); - __wut_exit(rc); +void +__syscall_exit(int rc) +{ + __fini_wut(); + __wut_exit(rc); } -int __syscall_gettod_r(struct _reent *ptr, struct timeval *tp, struct timezone *tz) { - return __wut_gettod_r(ptr, tp, tz); +int +__syscall_gettod_r(struct _reent *ptr, struct timeval *tp, struct timezone *tz) +{ + return __wut_gettod_r(ptr, tp, tz); } -int __syscall_nanosleep(const struct timespec *req, struct timespec *rem) { - return __wut_nanosleep(req, rem); +int +__syscall_nanosleep(const struct timespec *req, struct timespec *rem) +{ + return __wut_nanosleep(req, rem); } -int __syscall_clock_gettime(clockid_t clock_id, struct timespec *tp) { - return __wut_clock_gettime(clock_id, tp); +int +__syscall_clock_gettime(clockid_t clock_id, struct timespec *tp) +{ + return __wut_clock_gettime(clock_id, tp); } -int __syscall_clock_settime(clockid_t clock_id, const struct timespec *tp) { +int +__syscall_clock_settime(clockid_t clock_id, const struct timespec *tp) +{ return __wut_clock_settime(clock_id, tp); } -int __syscall_clock_getres(clockid_t clock_id, struct timespec *res) { +int +__syscall_clock_getres(clockid_t clock_id, struct timespec *res) +{ return __wut_clock_getres(clock_id, res); } -void __syscall_abort() { +void +__syscall_abort() +{ __wut__abort(); } -void __syscall_assert_func(const char *file, int line, const char *func, const char *failedexpr) { +void +__syscall_assert_func(const char *file, int line, const char *func, const char *failedexpr) +{ __wut__assert_func(file, line, func, failedexpr); } @@ -152,5 +194,5 @@ __init_wut_newlib() void __fini_wut_newlib() { - __fini_wut_sbrk_heap(); + __fini_wut_sbrk_heap(); } diff --git a/libraries/wutnewlib/wut_newlib.h b/libraries/wutnewlib/wut_newlib.h index ab32edef0..999a37a8c 100644 --- a/libraries/wutnewlib/wut_newlib.h +++ b/libraries/wutnewlib/wut_newlib.h @@ -2,27 +2,42 @@ #define __WUT_NEWLIB_H #include +#include #include #include -#include -void * __wut_sbrk_r(struct _reent *r, ptrdiff_t incr); -int __wut_lock_init(int *lock, int recursive); -int __wut_lock_close(int *lock); -int __wut_lock_acquire(int *lock); -int __wut_lock_release(int *lock); -void __wut_malloc_lock(struct _reent *r); -void __wut_malloc_unlock(struct _reent *r); -int __wut_gettod_r(struct _reent *ptr, struct timeval *tp, - struct timezone *tz); -int __wut_clock_gettime(clockid_t clock_id, struct timespec *tp); -int __wut_clock_settime(clockid_t clock_id, const struct timespec *tp); -int __wut_clock_getres(clockid_t clock_id, struct timespec *res); -int __wut_nanosleep(const struct timespec *req, struct timespec *rem); -struct _reent *__wut_getreent(void); +void * +__wut_sbrk_r(struct _reent *r, ptrdiff_t incr); +int +__wut_lock_init(int *lock, int recursive); +int +__wut_lock_close(int *lock); +int +__wut_lock_acquire(int *lock); +int +__wut_lock_release(int *lock); +void +__wut_malloc_lock(struct _reent *r); +void +__wut_malloc_unlock(struct _reent *r); +int +__wut_gettod_r(struct _reent *ptr, struct timeval *tp, struct timezone *tz); +int +__wut_clock_gettime(clockid_t clock_id, struct timespec *tp); +int +__wut_clock_settime(clockid_t clock_id, const struct timespec *tp); +int +__wut_clock_getres(clockid_t clock_id, struct timespec *res); +int +__wut_nanosleep(const struct timespec *req, struct timespec *rem); +struct _reent * +__wut_getreent(void); -void __init_wut_malloc_lock(); -void __init_wut_sbrk_heap(); -void __fini_wut_sbrk_heap(); +void +__init_wut_malloc_lock(); +void +__init_wut_sbrk_heap(); +void +__fini_wut_sbrk_heap(); #endif // ifndef __WUT_NEWLIB_H diff --git a/libraries/wutnewlib/wut_reent.c b/libraries/wutnewlib/wut_reent.c index 285b1e0d1..708401e1e 100644 --- a/libraries/wutnewlib/wut_reent.c +++ b/libraries/wutnewlib/wut_reent.c @@ -18,7 +18,7 @@ __wut_thread_cleanup(OSThread *thread, { struct __wut_thread_context *context; - context = (struct __wut_thread_context *) wut_get_thread_specific(__WUT_CONTEXT_THREAD_SPECIFIC_ID); + context = (struct __wut_thread_context *)wut_get_thread_specific(__WUT_CONTEXT_THREAD_SPECIFIC_ID); if (!context || &context->reent == _GLOBAL_REENT) { abort(); } @@ -42,7 +42,7 @@ __wut_getreent(void) { struct __wut_thread_context *context; - context = (struct __wut_thread_context *) wut_get_thread_specific(__WUT_CONTEXT_THREAD_SPECIFIC_ID); + context = (struct __wut_thread_context *)wut_get_thread_specific(__WUT_CONTEXT_THREAD_SPECIFIC_ID); if (!context) { // Temporarily use global reent during context allocation wut_set_thread_specific(__WUT_CONTEXT_THREAD_SPECIFIC_ID, _GLOBAL_REENT); diff --git a/libraries/wutnewlib/wut_sbrk.c b/libraries/wutnewlib/wut_sbrk.c index 2226f2584..6688d1328 100644 --- a/libraries/wutnewlib/wut_sbrk.c +++ b/libraries/wutnewlib/wut_sbrk.c @@ -1,13 +1,13 @@ #include "wut_newlib.h" #include -#include #include #include +#include -static MEMHeapHandle sHeapHandle = NULL; -static void *sHeapBase = NULL; -static uint32_t sHeapMaxSize = 0; +static MEMHeapHandle sHeapHandle = NULL; +static void *sHeapBase = NULL; +static uint32_t sHeapMaxSize = 0; static volatile uint32_t sHeapSize = 0; void * @@ -37,13 +37,13 @@ __init_wut_sbrk_heap(MEMHeapHandle heapHandle) return; } - sHeapHandle = heapHandle; + sHeapHandle = heapHandle; // Use all of the available memory for the custom heap sHeapMaxSize = MEMGetAllocatableSizeForExpHeapEx(sHeapHandle, 4); - sHeapBase = MEMAllocFromExpHeapEx(sHeapHandle, sHeapMaxSize, 4); + sHeapBase = MEMAllocFromExpHeapEx(sHeapHandle, sHeapMaxSize, 4); - sHeapSize = 0; + sHeapSize = 0; } void @@ -58,7 +58,7 @@ __fini_wut_sbrk_heap() MEMFreeToExpHeap(sHeapHandle, sHeapBase); } - sHeapBase = NULL; - sHeapSize = 0; + sHeapBase = NULL; + sHeapSize = 0; sHeapMaxSize = 0; } diff --git a/libraries/wutnewlib/wut_thread_specific.c b/libraries/wutnewlib/wut_thread_specific.c index c3d5c8176..c3c332329 100644 --- a/libraries/wutnewlib/wut_thread_specific.c +++ b/libraries/wutnewlib/wut_thread_specific.c @@ -1,13 +1,16 @@ #include "wut_thread_specific.h" -#include #include +#include void __attribute__((weak)) -wut_set_thread_specific(__wut_thread_specific_id id, void *value) { +wut_set_thread_specific(__wut_thread_specific_id id, void *value) +{ OSSetThreadSpecific(OS_THREAD_SPECIFIC_WUT_RESERVED_0 + id - WUT_THREAD_SPECIFIC_0, value); } void *__attribute__((weak)) -wut_get_thread_specific(__wut_thread_specific_id id) { - return OSGetThreadSpecific(OS_THREAD_SPECIFIC_WUT_RESERVED_0 + id - WUT_THREAD_SPECIFIC_0);; +wut_get_thread_specific(__wut_thread_specific_id id) +{ + return OSGetThreadSpecific(OS_THREAD_SPECIFIC_WUT_RESERVED_0 + id - WUT_THREAD_SPECIFIC_0); + ; } \ No newline at end of file diff --git a/libraries/wutnewlib/wut_thread_specific.h b/libraries/wutnewlib/wut_thread_specific.h index c84188f4a..bcbecf60e 100644 --- a/libraries/wutnewlib/wut_thread_specific.h +++ b/libraries/wutnewlib/wut_thread_specific.h @@ -1,17 +1,20 @@ #pragma once -typedef enum __wut_thread_specific_id { - WUT_THREAD_SPECIFIC_0 = 0, - WUT_THREAD_SPECIFIC_1 = 1, +typedef enum __wut_thread_specific_id +{ + WUT_THREAD_SPECIFIC_0 = 0, + WUT_THREAD_SPECIFIC_1 = 1, } __wut_thread_specific_id; #ifdef __cplusplus extern "C" { #endif -void wut_set_thread_specific(__wut_thread_specific_id id, void *value); +void +wut_set_thread_specific(__wut_thread_specific_id id, void *value); -void *wut_get_thread_specific(__wut_thread_specific_id id); +void * +wut_get_thread_specific(__wut_thread_specific_id id); #ifdef __cplusplus } diff --git a/libraries/wutsocket/NSSLCreateConnection.c b/libraries/wutsocket/NSSLCreateConnection.c index 69441bb2e..0eda7a475 100644 --- a/libraries/wutsocket/NSSLCreateConnection.c +++ b/libraries/wutsocket/NSSLCreateConnection.c @@ -1,6 +1,7 @@ #include "wut_socket.h" #include +// clang-format off NSSLConnectionHandle RPLWRAP(NSSLCreateConnection)(NSSLContextHandle context, const char *host, @@ -8,6 +9,7 @@ RPLWRAP(NSSLCreateConnection)(NSSLContextHandle context, int32_t options, int32_t socket, int32_t block); +// clang-format on NSSLConnectionHandle NSSLCreateConnection(NSSLContextHandle context, diff --git a/libraries/wutsocket/accept.c b/libraries/wutsocket/accept.c index 8339ce80e..766d10a9f 100644 --- a/libraries/wutsocket/accept.c +++ b/libraries/wutsocket/accept.c @@ -12,10 +12,10 @@ accept(int sockfd, return -1; } - dev = __get_handle(sockfd)->device; + dev = __get_handle(sockfd)->device; sockfd = fd; - fd = __alloc_handle(dev); + fd = __alloc_handle(dev); if (fd == -1) { return -1; } @@ -25,8 +25,7 @@ accept(int sockfd, __release_handle(fd); return __wut_get_nsysnet_result(NULL, rc); } - + *(int *)__get_handle(fd)->fileStruct = rc; return fd; } - diff --git a/libraries/wutsocket/addrinfo.c b/libraries/wutsocket/addrinfo.c index a866f906b..0774e6e43 100644 --- a/libraries/wutsocket/addrinfo.c +++ b/libraries/wutsocket/addrinfo.c @@ -1,6 +1,6 @@ #include "wut_socket.h" -#include #include +#include int getaddrinfo(const char *node, @@ -40,7 +40,7 @@ getnameinfo(const struct sockaddr *addr, int flags) { int rc; - + rc = RPLWRAP(getnameinfo)(addr, addrlen, host, hostlen, serv, servlen, flags); return rc; diff --git a/libraries/wutsocket/bind.c b/libraries/wutsocket/bind.c index 57b139efe..e24fe4a6c 100644 --- a/libraries/wutsocket/bind.c +++ b/libraries/wutsocket/bind.c @@ -13,4 +13,3 @@ bind(int sockfd, rc = RPLWRAP(bind)(sockfd, addr, addrlen); return __wut_get_nsysnet_result(NULL, rc); } - diff --git a/libraries/wutsocket/connect.c b/libraries/wutsocket/connect.c index 6f83f8e45..8b1465786 100644 --- a/libraries/wutsocket/connect.c +++ b/libraries/wutsocket/connect.c @@ -1,8 +1,9 @@ #include "wut_socket.h" -int connect(int sockfd, - const struct sockaddr *addr, - socklen_t addrlen) +int +connect(int sockfd, + const struct sockaddr *addr, + socklen_t addrlen) { int rc; sockfd = __wut_get_nsysnet_fd(sockfd); @@ -12,4 +13,3 @@ int connect(int sockfd, rc = RPLWRAP(connect)(sockfd, addr, addrlen); return __wut_get_nsysnet_result(NULL, rc); } - diff --git a/libraries/wutsocket/fcntl.c b/libraries/wutsocket/fcntl.c index 804b34937..9db552089 100644 --- a/libraries/wutsocket/fcntl.c +++ b/libraries/wutsocket/fcntl.c @@ -2,7 +2,8 @@ int fcntl(int fd, - int cmd, ...) + int cmd, + ...) { va_list args; int sockfd, rc, flags, nonblock; @@ -25,7 +26,7 @@ fcntl(int fd, va_end(args); nonblock = !!(flags & O_NONBLOCK); - rc = RPLWRAP(setsockopt)(sockfd, + rc = RPLWRAP(setsockopt)(sockfd, SOL_SOCKET, SO_NONBLOCK, &nonblock, @@ -45,4 +46,3 @@ fcntl(int fd, flags = (nonblock) ? O_NONBLOCK : 0; return flags; } - diff --git a/libraries/wutsocket/getpeername.c b/libraries/wutsocket/getpeername.c index f5b0e3617..adc5e1271 100644 --- a/libraries/wutsocket/getpeername.c +++ b/libraries/wutsocket/getpeername.c @@ -13,4 +13,3 @@ getpeername(int sockfd, rc = RPLWRAP(getpeername)(sockfd, addr, addrlen); return __wut_get_nsysnet_result(NULL, rc); } - diff --git a/libraries/wutsocket/getsockname.c b/libraries/wutsocket/getsockname.c index e9cc3bfea..7763d3220 100644 --- a/libraries/wutsocket/getsockname.c +++ b/libraries/wutsocket/getsockname.c @@ -13,4 +13,3 @@ getsockname(int sockfd, rc = RPLWRAP(getsockname)(sockfd, addr, addrlen); return __wut_get_nsysnet_result(NULL, rc); } - diff --git a/libraries/wutsocket/getsockopt.c b/libraries/wutsocket/getsockopt.c index 13f8c51a3..b5e0cc900 100644 --- a/libraries/wutsocket/getsockopt.c +++ b/libraries/wutsocket/getsockopt.c @@ -15,4 +15,3 @@ getsockopt(int sockfd, rc = RPLWRAP(getsockopt)(sockfd, level, optname, optval, optlen); return __wut_get_nsysnet_result(NULL, rc); } - diff --git a/libraries/wutsocket/host.c b/libraries/wutsocket/host.c index 8342ebb2c..e080f3e24 100644 --- a/libraries/wutsocket/host.c +++ b/libraries/wutsocket/host.c @@ -19,7 +19,7 @@ gethostbyaddr(const void *addr, struct hostent *ent = RPLWRAP(gethostbyaddr)(addr, len, type); - h_errno = *RPLWRAP(get_h_errno)(); + h_errno = *RPLWRAP(get_h_errno)(); return ent; } @@ -34,7 +34,7 @@ gethostbyname(const char *name) struct hostent *ent = RPLWRAP(gethostbyname)(name); - h_errno = *RPLWRAP(get_h_errno)(); + h_errno = *RPLWRAP(get_h_errno)(); return ent; } diff --git a/libraries/wutsocket/hostid.c b/libraries/wutsocket/hostid.c index 1dd16ec83..b1dc59874 100644 --- a/libraries/wutsocket/hostid.c +++ b/libraries/wutsocket/hostid.c @@ -15,7 +15,7 @@ gethostname(char *name, size_t len) { struct in_addr in; - in.s_addr = gethostid(); + in.s_addr = gethostid(); const char *hostname = inet_ntop(AF_INET, &in, name, len); return hostname ? 0 : -1; } diff --git a/libraries/wutsocket/ioctl.c b/libraries/wutsocket/ioctl.c index 0feb08d7d..230433b5a 100644 --- a/libraries/wutsocket/ioctl.c +++ b/libraries/wutsocket/ioctl.c @@ -15,7 +15,7 @@ ioctl(int fd, data = (request & IOC_INOUT) ? va_arg(args, void *) : NULL; va_end(args); - if(data == NULL && (request & IOC_INOUT) && IOCPARM_LEN(request) != 0) { + if (data == NULL && (request & IOC_INOUT) && IOCPARM_LEN(request) != 0) { errno = EFAULT; return -1; } @@ -25,10 +25,10 @@ ioctl(int fd, return -1; } - switch(request) { + switch (request) { case FIONBIO: { int flags = fcntl(fd, F_GETFL, 0); - if(flags == -1) { + if (flags == -1) { return -1; } flags = *(int *)data != 0 ? (flags | O_NONBLOCK) : (flags & ~O_NONBLOCK); @@ -36,7 +36,7 @@ ioctl(int fd, } case FIONREAD: { socklen_t optlen = sizeof(int32_t); - rc = RPLWRAP(getsockopt)(sockfd, + rc = RPLWRAP(getsockopt)(sockfd, SOL_SOCKET, SO_RXDATA, data, @@ -45,7 +45,7 @@ ioctl(int fd, } case FIONWRITE: { socklen_t optlen = sizeof(int32_t); - rc = RPLWRAP(getsockopt)(sockfd, + rc = RPLWRAP(getsockopt)(sockfd, SOL_SOCKET, SO_TXDATA, data, diff --git a/libraries/wutsocket/listen.c b/libraries/wutsocket/listen.c index 61562b230..8a72eb59f 100644 --- a/libraries/wutsocket/listen.c +++ b/libraries/wutsocket/listen.c @@ -12,4 +12,3 @@ listen(int sockfd, rc = RPLWRAP(listen)(sockfd, backlog); return __wut_get_nsysnet_result(NULL, rc); } - diff --git a/libraries/wutsocket/recv.c b/libraries/wutsocket/recv.c index 2475bddb3..87d8369f9 100644 --- a/libraries/wutsocket/recv.c +++ b/libraries/wutsocket/recv.c @@ -14,4 +14,3 @@ recv(int sockfd, rc = RPLWRAP(recv)(sockfd, buf, len, flags); return (ssize_t)__wut_get_nsysnet_result(NULL, rc); } - diff --git a/libraries/wutsocket/recvfrom.c b/libraries/wutsocket/recvfrom.c index 54039d0fe..ac0fbedf3 100644 --- a/libraries/wutsocket/recvfrom.c +++ b/libraries/wutsocket/recvfrom.c @@ -16,4 +16,3 @@ recvfrom(int sockfd, rc = RPLWRAP(recvfrom)(sockfd, buf, len, flags, src_addr, addrlen); return (ssize_t)__wut_get_nsysnet_result(NULL, rc); } - diff --git a/libraries/wutsocket/select.c b/libraries/wutsocket/select.c index 4190f9939..0623eacff 100644 --- a/libraries/wutsocket/select.c +++ b/libraries/wutsocket/select.c @@ -52,7 +52,7 @@ select(int nfds, } if (timeout) { - cnv_timeout.tv_sec = timeout->tv_sec; + cnv_timeout.tv_sec = timeout->tv_sec; cnv_timeout.tv_usec = timeout->tv_usec; } diff --git a/libraries/wutsocket/send.c b/libraries/wutsocket/send.c index 729a88b0c..b2bf414f4 100644 --- a/libraries/wutsocket/send.c +++ b/libraries/wutsocket/send.c @@ -2,7 +2,7 @@ ssize_t send(int sockfd, - const void* buf, + const void *buf, size_t len, int flags) { @@ -14,4 +14,3 @@ send(int sockfd, rc = RPLWRAP(send)(sockfd, buf, len, flags); return (ssize_t)__wut_get_nsysnet_result(NULL, rc); } - diff --git a/libraries/wutsocket/sendto.c b/libraries/wutsocket/sendto.c index 7208c36e7..0b8ff5be9 100644 --- a/libraries/wutsocket/sendto.c +++ b/libraries/wutsocket/sendto.c @@ -16,4 +16,3 @@ sendto(int sockfd, rc = RPLWRAP(sendto)(sockfd, buf, len, flags, dest_addr, addrlen); return (ssize_t)__wut_get_nsysnet_result(NULL, rc); } - diff --git a/libraries/wutsocket/setsockopt.c b/libraries/wutsocket/setsockopt.c index 20c4dc3f5..97effef72 100644 --- a/libraries/wutsocket/setsockopt.c +++ b/libraries/wutsocket/setsockopt.c @@ -15,4 +15,3 @@ setsockopt(int sockfd, rc = RPLWRAP(setsockopt)(sockfd, level, optname, optval, optlen); return __wut_get_nsysnet_result(NULL, rc); } - diff --git a/libraries/wutsocket/shutdown.c b/libraries/wutsocket/shutdown.c index 38c1228b6..0f2f2790a 100644 --- a/libraries/wutsocket/shutdown.c +++ b/libraries/wutsocket/shutdown.c @@ -12,4 +12,3 @@ shutdown(int sockfd, rc = RPLWRAP(shutdown)(sockfd, how); return __wut_get_nsysnet_result(NULL, rc); } - diff --git a/libraries/wutsocket/sockatmark.c b/libraries/wutsocket/sockatmark.c index fa062d5bb..6d2375c0a 100644 --- a/libraries/wutsocket/sockatmark.c +++ b/libraries/wutsocket/sockatmark.c @@ -1,13 +1,14 @@ #include "wut_socket.h" -int sockatmark(int sockfd) +int +sockatmark(int sockfd) { char buf[1]; int rc; sockfd = __wut_get_nsysnet_fd(sockfd); - rc = RPLWRAP(recv)(sockfd, buf, sizeof(buf), MSG_OOB | MSG_PEEK | MSG_DONTWAIT); + rc = RPLWRAP(recv)(sockfd, buf, sizeof(buf), MSG_OOB | MSG_PEEK | MSG_DONTWAIT); if (rc > 0) { return 1; } diff --git a/libraries/wutsocket/socket.c b/libraries/wutsocket/socket.c index c06e42da3..3f9122420 100644 --- a/libraries/wutsocket/socket.c +++ b/libraries/wutsocket/socket.c @@ -26,4 +26,3 @@ socket(int domain, *(int *)__get_handle(fd)->fileStruct = rc; return fd; } - diff --git a/libraries/wutsocket/stubs.c b/libraries/wutsocket/stubs.c index e9e0ec950..cb06b334b 100644 --- a/libraries/wutsocket/stubs.c +++ b/libraries/wutsocket/stubs.c @@ -6,7 +6,7 @@ getservbyname(const char *name, const char *proto) { h_errno = NO_RECOVERY; - errno = ENOSYS; + errno = ENOSYS; return NULL; } @@ -15,22 +15,22 @@ getservbyport(int port, const char *proto) { h_errno = NO_RECOVERY; - errno = ENOSYS; + errno = ENOSYS; return NULL; } struct servent * getservent(void) -{ +{ h_errno = NO_RECOVERY; - errno = ENOSYS; - return NULL; + errno = ENOSYS; + return NULL; } struct hostent * gethostent(void) { h_errno = NO_RECOVERY; - errno = ENOSYS; + errno = ENOSYS; return NULL; } diff --git a/libraries/wutsocket/wut_socket.h b/libraries/wutsocket/wut_socket.h index bf47bb547..ef06846ba 100644 --- a/libraries/wutsocket/wut_socket.h +++ b/libraries/wutsocket/wut_socket.h @@ -1,20 +1,25 @@ #pragma once -#include +#include #include -#include -#include +#include #include -#include #include #include +#include +#include #define __LINUX_ERRNO_EXTENSIONS__ #include -int __wut_get_nsysnet_fd(int fd); -int __wut_get_nsysnet_result(struct _reent *r, int rc); - -int __wut_socket_open(struct _reent *r, void *fileStruct, const char *path, int flags, int mode); -int __wut_socket_close(struct _reent *r, void *fd); -ssize_t __wut_socket_write(struct _reent *r, void *fd, const char *ptr, size_t len); -ssize_t __wut_socket_read(struct _reent *r, void *fd, char *ptr, size_t len); +int +__wut_get_nsysnet_fd(int fd); +int +__wut_get_nsysnet_result(struct _reent *r, int rc); +int +__wut_socket_open(struct _reent *r, void *fileStruct, const char *path, int flags, int mode); +int +__wut_socket_close(struct _reent *r, void *fd); +ssize_t +__wut_socket_write(struct _reent *r, void *fd, const char *ptr, size_t len); +ssize_t +__wut_socket_read(struct _reent *r, void *fd, char *ptr, size_t len); diff --git a/libraries/wutsocket/wut_socket_close.c b/libraries/wutsocket/wut_socket_close.c index 7826771d8..b164ec68b 100644 --- a/libraries/wutsocket/wut_socket_close.c +++ b/libraries/wutsocket/wut_socket_close.c @@ -5,7 +5,6 @@ __wut_socket_close(struct _reent *r, void *fd) { int sockfd = *(int *)fd; - int rc = RPLWRAP(socketclose)(sockfd); + int rc = RPLWRAP(socketclose)(sockfd); return __wut_get_nsysnet_result(r, rc); } - diff --git a/libraries/wutsocket/wut_socket_common.c b/libraries/wutsocket/wut_socket_common.c index a0232fbc9..e43536e1f 100644 --- a/libraries/wutsocket/wut_socket_common.c +++ b/libraries/wutsocket/wut_socket_common.c @@ -6,12 +6,12 @@ int h_errno; static devoptab_t __wut_socket_devoptab = { - .name = "soc", - .structSize = sizeof(int), - .open_r = __wut_socket_open, - .close_r = __wut_socket_close, - .write_r = __wut_socket_write, - .read_r = __wut_socket_read, + .name = "soc", + .structSize = sizeof(int), + .open_r = __wut_socket_open, + .close_r = __wut_socket_close, + .write_r = __wut_socket_write, + .read_r = __wut_socket_read, }; static unsigned char __wut_nsysnet_error_code_map[] = { diff --git a/libraries/wutsocket/wut_socket_open.c b/libraries/wutsocket/wut_socket_open.c index 0fdb6ad2b..0e78adcb1 100644 --- a/libraries/wutsocket/wut_socket_open.c +++ b/libraries/wutsocket/wut_socket_open.c @@ -10,4 +10,3 @@ __wut_socket_open(struct _reent *r, r->_errno = ENOSYS; return -1; } - diff --git a/libraries/wutsocket/wut_socket_read.c b/libraries/wutsocket/wut_socket_read.c index a10e25919..4b29c51aa 100644 --- a/libraries/wutsocket/wut_socket_read.c +++ b/libraries/wutsocket/wut_socket_read.c @@ -7,7 +7,6 @@ __wut_socket_read(struct _reent *r, size_t len) { int sockfd = *(int *)fd; - int rc = RPLWRAP(recv)(sockfd, ptr, len, 0); + int rc = RPLWRAP(recv)(sockfd, ptr, len, 0); return (ssize_t)__wut_get_nsysnet_result(r, rc); } - diff --git a/libraries/wutsocket/wut_socket_write.c b/libraries/wutsocket/wut_socket_write.c index b19438b27..dd8ebbcb8 100644 --- a/libraries/wutsocket/wut_socket_write.c +++ b/libraries/wutsocket/wut_socket_write.c @@ -7,7 +7,6 @@ __wut_socket_write(struct _reent *r, size_t len) { int sockfd = *(int *)fd; - int rc = RPLWRAP(send)(sockfd, ptr, len, 0); + int rc = RPLWRAP(send)(sockfd, ptr, len, 0); return (ssize_t)__wut_get_nsysnet_result(r, rc); } - diff --git a/libraries/wutstdc++/wut_gthread.cpp b/libraries/wutstdc++/wut_gthread.cpp index 9d628f1b9..c15a9469d 100644 --- a/libraries/wutstdc++/wut_gthread.cpp +++ b/libraries/wutstdc++/wut_gthread.cpp @@ -1,138 +1,197 @@ #include "wut_gthread.h" -#include #include +#include -static constexpr __wut_key_t gthread_key_to_wut(__gthread_key_t key) +static constexpr __wut_key_t +gthread_key_to_wut(__gthread_key_t key) { - __wut_key_t dst={}; - static_assert(sizeof(__wut_key_t) == sizeof(__gthread_key_t), "Incompatible definition of thread local key type"); - __builtin_memcpy(&dst, &key, sizeof(dst)); - return dst; + __wut_key_t dst = {}; + static_assert(sizeof(__wut_key_t) == sizeof(__gthread_key_t), "Incompatible definition of thread local key type"); + __builtin_memcpy(&dst, &key, sizeof(dst)); + return dst; } extern "C" { -int __gthr_impl_active (void) { +int +__gthr_impl_active(void) +{ return 1; } -int __gthr_impl_create (__gthread_t *__threadid, void *(*__func) (void*), void *__args) { - return __wut_thread_create((OSThread**)__threadid, __func, __args); +int +__gthr_impl_create(__gthread_t *__threadid, void *(*__func)(void *), void *__args) +{ + return __wut_thread_create((OSThread **)__threadid, __func, __args); } -int __gthr_impl_join (__gthread_t __threadid, void **__value_ptr) { - return __wut_thread_join((OSThread*)__threadid, __value_ptr); +int +__gthr_impl_join(__gthread_t __threadid, void **__value_ptr) +{ + return __wut_thread_join((OSThread *)__threadid, __value_ptr); } -int __gthr_impl_detach (__gthread_t __threadid) { - return __wut_thread_detach((OSThread*)__threadid); +int +__gthr_impl_detach(__gthread_t __threadid) +{ + return __wut_thread_detach((OSThread *)__threadid); } -int __gthr_impl_equal (__gthread_t __t1, __gthread_t __t2) { - return __wut_thread_equal( (OSThread*)__t1, (OSThread*)__t2); +int +__gthr_impl_equal(__gthread_t __t1, __gthread_t __t2) +{ + return __wut_thread_equal((OSThread *)__t1, (OSThread *)__t2); } -__gthread_t __gthr_impl_self (void) { +__gthread_t +__gthr_impl_self(void) +{ return __wut_thread_self(); } -int __gthr_impl_yield (void) { +int +__gthr_impl_yield(void) +{ return __wut_thread_yield(); } -int __gthr_impl_once (__gthread_once_t *__once, void (*__func) (void)) { - return __wut_once((__wut_once_t*)__once, __func); +int +__gthr_impl_once(__gthread_once_t *__once, void (*__func)(void)) +{ + return __wut_once((__wut_once_t *)__once, __func); } -int __gth_impl_key_create (__gthread_key_t *__key, void (*__dtor) (void *)) { - return __wut_key_create((__wut_key_t*)__key, __dtor); +int +__gth_impl_key_create(__gthread_key_t *__key, void (*__dtor)(void *)) +{ + return __wut_key_create((__wut_key_t *)__key, __dtor); } -int __gthr_impl_key_delete (__gthread_key_t __key) { - return __wut_key_delete( gthread_key_to_wut(__key) ); +int +__gthr_impl_key_delete(__gthread_key_t __key) +{ + return __wut_key_delete(gthread_key_to_wut(__key)); } -void *__gthr_impl_getspecific (__gthread_key_t __key) { - return __wut_getspecific( gthread_key_to_wut(__key) ); +void * +__gthr_impl_getspecific(__gthread_key_t __key) +{ + return __wut_getspecific(gthread_key_to_wut(__key)); } -int __gthr_impl_setspecific (__gthread_key_t __key, const void *__ptr) { +int +__gthr_impl_setspecific(__gthread_key_t __key, const void *__ptr) +{ return __wut_setspecific(gthread_key_to_wut(__key), __ptr); } -void __gthr_impl_mutex_init_function (__gthread_mutex_t *__mutex) { - return __wut_mutex_init_function((OSMutex*)__mutex); +void +__gthr_impl_mutex_init_function(__gthread_mutex_t *__mutex) +{ + return __wut_mutex_init_function((OSMutex *)__mutex); } -int __gthr_impl_mutex_destroy (__gthread_mutex_t *__mutex) { - return __wut_mutex_destroy((OSMutex*)__mutex); +int +__gthr_impl_mutex_destroy(__gthread_mutex_t *__mutex) +{ + return __wut_mutex_destroy((OSMutex *)__mutex); } -int __gthr_impl_mutex_lock (__gthread_mutex_t *__mutex) { - return __wut_mutex_lock((OSMutex*)__mutex); +int +__gthr_impl_mutex_lock(__gthread_mutex_t *__mutex) +{ + return __wut_mutex_lock((OSMutex *)__mutex); } -int __gthr_impl_mutex_trylock (__gthread_mutex_t *__mutex) { - return __wut_mutex_trylock((OSMutex*)__mutex); +int +__gthr_impl_mutex_trylock(__gthread_mutex_t *__mutex) +{ + return __wut_mutex_trylock((OSMutex *)__mutex); } -int __gthr_impl_mutex_unlock (__gthread_mutex_t *__mutex) { - return __wut_mutex_unlock((OSMutex*)__mutex); +int +__gthr_impl_mutex_unlock(__gthread_mutex_t *__mutex) +{ + return __wut_mutex_unlock((OSMutex *)__mutex); } -int __gthr_impl_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex) { - return __wut_recursive_mutex_init_function((OSMutex*)__mutex); +int +__gthr_impl_recursive_mutex_init_function(__gthread_recursive_mutex_t *__mutex) +{ + return __wut_recursive_mutex_init_function((OSMutex *)__mutex); } -int __gthr_impl_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex) { - return __wut_recursive_mutex_lock((OSMutex*)__mutex); +int +__gthr_impl_recursive_mutex_lock(__gthread_recursive_mutex_t *__mutex) +{ + return __wut_recursive_mutex_lock((OSMutex *)__mutex); } -int __gthr_impl_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex) { - return __wut_recursive_mutex_trylock((OSMutex*)__mutex); +int +__gthr_impl_recursive_mutex_trylock(__gthread_recursive_mutex_t *__mutex) +{ + return __wut_recursive_mutex_trylock((OSMutex *)__mutex); } -int __gthr_impl_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex) { - return __wut_recursive_mutex_unlock((OSMutex*)__mutex); +int +__gthr_impl_recursive_mutex_unlock(__gthread_recursive_mutex_t *__mutex) +{ + return __wut_recursive_mutex_unlock((OSMutex *)__mutex); } -int __gthr_impl_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex) { - return __wut_recursive_mutex_destroy((OSMutex*)__mutex); +int +__gthr_impl_recursive_mutex_destroy(__gthread_recursive_mutex_t *__mutex) +{ + return __wut_recursive_mutex_destroy((OSMutex *)__mutex); } -void __gthr_impl_cond_init_function (__gthread_cond_t *__cond) { - return __wut_cond_init_function((OSCondition*)__cond); +void +__gthr_impl_cond_init_function(__gthread_cond_t *__cond) +{ + return __wut_cond_init_function((OSCondition *)__cond); } -int __gthr_impl_cond_broadcast (__gthread_cond_t *__cond) { - return __wut_cond_broadcast((OSCondition*)__cond); +int +__gthr_impl_cond_broadcast(__gthread_cond_t *__cond) +{ + return __wut_cond_broadcast((OSCondition *)__cond); } -int __gthr_impl_cond_signal (__gthread_cond_t *__cond) { - return __wut_cond_signal((OSCondition*)__cond); +int +__gthr_impl_cond_signal(__gthread_cond_t *__cond) +{ + return __wut_cond_signal((OSCondition *)__cond); } -int __gthr_impl_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex) { - return __wut_cond_wait((OSCondition*)__cond, (OSMutex*)__mutex); +int +__gthr_impl_cond_wait(__gthread_cond_t *__cond, __gthread_mutex_t *__mutex) +{ + return __wut_cond_wait((OSCondition *)__cond, (OSMutex *)__mutex); } -int __gthr_impl_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex, const __gthread_time_t *__abs_timeout) { - return __wut_cond_timedwait((OSCondition*)__cond, (OSMutex*)__mutex, __abs_timeout); +int +__gthr_impl_cond_timedwait(__gthread_cond_t *__cond, __gthread_mutex_t *__mutex, const __gthread_time_t *__abs_timeout) +{ + return __wut_cond_timedwait((OSCondition *)__cond, (OSMutex *)__mutex, __abs_timeout); } -int __gthr_impl_cond_wait_recursive (__gthread_cond_t *__cond, __gthread_recursive_mutex_t *__mutex) { - return __wut_cond_wait_recursive((OSCondition*)__cond, (OSMutex*)__mutex); +int +__gthr_impl_cond_wait_recursive(__gthread_cond_t *__cond, __gthread_recursive_mutex_t *__mutex) +{ + return __wut_cond_wait_recursive((OSCondition *)__cond, (OSMutex *)__mutex); } -int __gthr_impl_cond_destroy (__gthread_cond_t* __cond) { - return __wut_cond_destroy((OSCondition*)__cond); +int +__gthr_impl_cond_destroy(__gthread_cond_t *__cond) +{ + return __wut_cond_destroy((OSCondition *)__cond); } -void __init_wut_stdcpp() +void +__init_wut_stdcpp() { } -void __fini_wut_stdcpp() +void +__fini_wut_stdcpp() { } - } - diff --git a/libraries/wutstdc++/wut_gthread.h b/libraries/wutstdc++/wut_gthread.h index 5320e8df9..7788bb4e5 100644 --- a/libraries/wutstdc++/wut_gthread.h +++ b/libraries/wutstdc++/wut_gthread.h @@ -3,22 +3,23 @@ #include #include -#include #include +#include #include "../wutnewlib/wut_thread_specific.h" -#define __WUT_MAX_KEYS (128) -#define __WUT_STACK_SIZE (128*1024) +#define __WUT_MAX_KEYS (128) +#define __WUT_STACK_SIZE (128 * 1024) -#define __WUT_ONCE_VALUE_INIT (0) -#define __WUT_ONCE_VALUE_STARTED (1) -#define __WUT_ONCE_VALUE_DONE (2) +#define __WUT_ONCE_VALUE_INIT (0) +#define __WUT_ONCE_VALUE_STARTED (1) +#define __WUT_ONCE_VALUE_DONE (2) #define __WUT_KEY_THREAD_SPECIFIC_ID WUT_THREAD_SPECIFIC_0 typedef volatile uint32_t __wut_once_t; -typedef struct { +typedef struct +{ uint32_t index; } __wut_key_t; @@ -30,15 +31,15 @@ __wut_active_p(); int __wut_thread_create(OSThread **outThread, - void *(*func) (void*), + void *(*func)(void *), void *args); int -__wut_thread_join(OSThread * thread, +__wut_thread_join(OSThread *thread, void **outValue); int -__wut_thread_detach(OSThread * thread); +__wut_thread_detach(OSThread *thread); int __wut_thread_equal(OSThread *thread1, @@ -52,14 +53,14 @@ __wut_thread_yield(); int __wut_once(__wut_once_t *once, - void (*func) (void)); + void (*func)(void)); void __wut_key_cleanup(OSThread *thread); int __wut_key_create(__wut_key_t *key, - void (*dtor) (void *)); + void (*dtor)(void *)); int __wut_key_delete(__wut_key_t key); @@ -124,4 +125,4 @@ __wut_cond_wait_recursive(OSCondition *cond, OSMutex *mutex); int -__wut_cond_destroy(OSCondition* cond); +__wut_cond_destroy(OSCondition *cond); diff --git a/libraries/wutstdc++/wut_gthread_cond.cpp b/libraries/wutstdc++/wut_gthread_cond.cpp index f56d98b8d..fe1f3a503 100644 --- a/libraries/wutstdc++/wut_gthread_cond.cpp +++ b/libraries/wutstdc++/wut_gthread_cond.cpp @@ -47,19 +47,18 @@ __wut_cond_timedwait_alarm_callback(OSAlarm *alarm, OSContext *context) { __wut_cond_timedwait_data_t *data = (__wut_cond_timedwait_data_t *)OSGetAlarmUserData(alarm); - data->timed_out = true; + data->timed_out = true; OSSignalCond(data->cond); } int -__wut_cond_timedwait(OSCondition *cond, OSMutex *mutex, - const __gthread_time_t *abs_timeout) +__wut_cond_timedwait(OSCondition *cond, OSMutex *mutex, const __gthread_time_t *abs_timeout) { __wut_cond_timedwait_data_t data; data.timed_out = false; - data.cond = cond; + data.cond = cond; - OSTime time = OSGetTime(); + OSTime time = OSGetTime(); OSTime timeout = OSSecondsToTicks(abs_timeout->tv_sec - EPOCH_DIFF_SECS(WIIU_OSTIME_EPOCH_YEAR)) + OSNanosecondsToTicks(abs_timeout->tv_nsec); @@ -85,14 +84,14 @@ __wut_cond_timedwait(OSCondition *cond, OSMutex *mutex, int __wut_cond_wait_recursive(OSCondition *cond, - OSMutex *mutex) + OSMutex *mutex) { OSWaitCond(cond, mutex); return 0; } int -__wut_cond_destroy(OSCondition* cond) +__wut_cond_destroy(OSCondition *cond) { return 0; } diff --git a/libraries/wutstdc++/wut_gthread_keys.cpp b/libraries/wutstdc++/wut_gthread_keys.cpp index 0848615bb..ec54292ae 100644 --- a/libraries/wutstdc++/wut_gthread_keys.cpp +++ b/libraries/wutstdc++/wut_gthread_keys.cpp @@ -7,7 +7,7 @@ struct __wut_key_table_entry { bool in_use; - void (*dtor) (void *); + void (*dtor)(void *); }; static __wut_key_table_entry key_table[__WUT_MAX_KEYS]; @@ -15,7 +15,8 @@ static __wut_key_table_entry key_table[__WUT_MAX_KEYS]; static OSMutex key_mutex; static __wut_once_t init_once_control = __WUT_ONCE_VALUE_INIT; -static void init() +static void +init() { __wut_mutex_init_function(&key_mutex); memset(key_table, 0, sizeof(key_table)); @@ -23,7 +24,7 @@ static void init() int __wut_key_create(__wut_key_t *key, - void (*dtor) (void *)) + void (*dtor)(void *)) { int res = EAGAIN; __wut_once(&init_once_control, init); @@ -35,10 +36,10 @@ __wut_key_create(__wut_key_t *key, } key_table[i].in_use = 1; - key_table[i].dtor = dtor; + key_table[i].dtor = dtor; - res = 0; - key->index = i; + res = 0; + key->index = i; break; } @@ -51,7 +52,7 @@ __wut_key_delete(__wut_key_t key) { __wut_mutex_lock(&key_mutex); key_table[key.index].in_use = 0; - key_table[key.index].dtor = NULL; + key_table[key.index].dtor = NULL; __wut_mutex_unlock(&key_mutex); return -1; } diff --git a/libraries/wutstdc++/wut_gthread_once.cpp b/libraries/wutstdc++/wut_gthread_once.cpp index 52a2f4eb2..5fb4a1d72 100644 --- a/libraries/wutstdc++/wut_gthread_once.cpp +++ b/libraries/wutstdc++/wut_gthread_once.cpp @@ -2,7 +2,7 @@ int __wut_once(__wut_once_t *once, - void (*func) (void)) + void (*func)(void)) { uint32_t value = 0; diff --git a/libraries/wutstdc++/wut_gthread_thread.cpp b/libraries/wutstdc++/wut_gthread_thread.cpp index 52cbf9d72..3bffff2ea 100644 --- a/libraries/wutstdc++/wut_gthread_thread.cpp +++ b/libraries/wutstdc++/wut_gthread_thread.cpp @@ -1,7 +1,7 @@ #include "wut_gthread.h" -#include #include +#include #include #include uint32_t __attribute__((weak)) __wut_thread_default_stack_size = __WUT_STACK_SIZE; @@ -22,13 +22,13 @@ __wut_thread_cleanup(OSThread *thread, void *stack) int __wut_thread_create(OSThread **outThread, - void *(*entryPoint) (void*), + void *(*entryPoint)(void *), void *entryArgs) { OSThread *thread = (OSThread *)memalign(16, sizeof(OSThread)); if (!thread) { return ENOMEM; - } + } memset(thread, 0, sizeof(OSThread)); @@ -75,7 +75,7 @@ __wut_thread_join(OSThread *thread, } int -__wut_thread_detach(OSThread * thread) +__wut_thread_detach(OSThread *thread) { OSDetachThread(thread); return 0; diff --git a/samples/cmake/custom_default_heap/main.c b/samples/cmake/custom_default_heap/main.c index 6761752c5..f9e79eee6 100644 --- a/samples/cmake/custom_default_heap/main.c +++ b/samples/cmake/custom_default_heap/main.c @@ -1,19 +1,19 @@ #include -#include #include #include #include +#include #include -#include #include +#include -#include #include #include +#include static MEMHeapHandle sCustomHeap = NULL; -static uint32_t sCustomHeapAddr = 0; -static uint32_t sCustomHeapSize = 0; +static uint32_t sCustomHeapAddr = 0; +static uint32_t sCustomHeapSize = 0; static void * CustomAllocFromDefaultHeap(uint32_t size) @@ -29,7 +29,7 @@ CustomAllocFromDefaultHeapEx(uint32_t size, } static void -CustomFreeToDefaultHeap(void* ptr) +CustomFreeToDefaultHeap(void *ptr) { MEMFreeToExpHeap(sCustomHeap, ptr); } @@ -69,9 +69,9 @@ __preinit_user(MEMHeapHandle *mem1, { uint32_t addr, size; - MEMAllocFromDefaultHeap = CustomAllocFromDefaultHeap; + MEMAllocFromDefaultHeap = CustomAllocFromDefaultHeap; MEMAllocFromDefaultHeapEx = CustomAllocFromDefaultHeapEx; - MEMFreeToDefaultHeap = CustomFreeToDefaultHeap; + MEMFreeToDefaultHeap = CustomFreeToDefaultHeap; if (OSGetForegroundBucket(NULL, NULL)) { OSGetMemBound(OS_MEM1, &addr, &size); @@ -82,10 +82,10 @@ __preinit_user(MEMHeapHandle *mem1, } OSGetMemBound(OS_MEM2, &addr, &size); - sCustomHeap = MEMCreateExpHeapEx((void *)addr, size, MEM_HEAP_FLAG_USE_LOCK); + sCustomHeap = MEMCreateExpHeapEx((void *)addr, size, MEM_HEAP_FLAG_USE_LOCK); sCustomHeapAddr = addr; sCustomHeapSize = size; - *mem2 = sCustomHeap; + *mem2 = sCustomHeap; OSDynLoad_SetAllocator(CustomDynLoadAlloc, CustomDynLoadFree); OSDynLoad_SetTLSAllocator(CustomDynLoadAlloc, CustomDynLoadFree); @@ -117,7 +117,7 @@ main(int argc, char **argv) MEMVisitAllocatedForExpHeap(sCustomHeap, heapBlockVisitor, NULL); - while(WHBProcIsRunning()) { + while (WHBProcIsRunning()) { WHBLogConsoleDraw(); OSSleepTicks(OSMillisecondsToTicks(100)); } diff --git a/samples/cmake/erreula/main.cpp b/samples/cmake/erreula/main.cpp index 2529c9460..8003b1c17 100644 --- a/samples/cmake/erreula/main.cpp +++ b/samples/cmake/erreula/main.cpp @@ -3,12 +3,13 @@ #include #include -#include #include #include #include +#include -int main(int argc, char **argv) +int +main(int argc, char **argv) { WHBLogUdpInit(); WHBProcInit(); @@ -22,10 +23,10 @@ int main(int argc, char **argv) // Create erreula nn::erreula::CreateArg createArg; - createArg.region = nn::erreula::RegionType::Europe; - createArg.language = nn::erreula::LangType::English; + createArg.region = nn::erreula::RegionType::Europe; + createArg.language = nn::erreula::LangType::English; createArg.workMemory = MEMAllocFromDefaultHeap(nn::erreula::GetWorkMemorySize()); - createArg.fsClient = fsClient; + createArg.fsClient = fsClient; if (!nn::erreula::Create(createArg)) { WHBLogPrintf("nn::erreula::Create failed"); WHBProcShutdown(); @@ -34,13 +35,13 @@ int main(int argc, char **argv) // Show the error viewer nn::erreula::AppearArg appearArg; - appearArg.errorArg.errorType = nn::erreula::ErrorType::Message2Button; - appearArg.errorArg.renderTarget = nn::erreula::RenderTarget::Both; + appearArg.errorArg.errorType = nn::erreula::ErrorType::Message2Button; + appearArg.errorArg.renderTarget = nn::erreula::RenderTarget::Both; appearArg.errorArg.controllerType = nn::erreula::ControllerType::DrcGamepad; - appearArg.errorArg.errorMessage = u"This is my error message"; - appearArg.errorArg.button1Label = u"Left Button"; - appearArg.errorArg.button2Label = u"Right Button"; - appearArg.errorArg.errorTitle = u"Title"; + appearArg.errorArg.errorMessage = u"This is my error message"; + appearArg.errorArg.button1Label = u"Left Button"; + appearArg.errorArg.button2Label = u"Right Button"; + appearArg.errorArg.errorTitle = u"Title"; nn::erreula::AppearErrorViewer(appearArg); WHBLogPrintf("Begin rendering..."); @@ -52,7 +53,7 @@ int main(int argc, char **argv) // Update erreula nn::erreula::ControllerInfo controllerInfo; - controllerInfo.vpad = &vpadStatus; + controllerInfo.vpad = &vpadStatus; controllerInfo.kpad[0] = nullptr; controllerInfo.kpad[1] = nullptr; controllerInfo.kpad[2] = nullptr; @@ -80,7 +81,7 @@ int main(int argc, char **argv) } nn::erreula::ResultType resultType = nn::erreula::GetResultType(); - int32_t resultCode = nn::erreula::GetResultCode(); + int32_t resultCode = nn::erreula::GetResultCode(); WHBLogPrintf("Result type: %d, result code: %d", static_cast(resultType), resultCode); diff --git a/samples/cmake/gx2_triangle/main.c b/samples/cmake/gx2_triangle/main.c index 001c76836..3f829de0a 100644 --- a/samples/cmake/gx2_triangle/main.c +++ b/samples/cmake/gx2_triangle/main.c @@ -1,47 +1,48 @@ #include #include -#include #include #include -#include +#include #include -#include +#include #include +#include #include -#include -#include #include #include #include +#include +#include #include #include #include static const float sPositionData[] = { -// clang-format off + // clang-format off 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -// clang-format on + // clang-format on }; static const float sColourData[] = { -// clang-format off + // clang-format off 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, -// clang-format on + // clang-format on }; -int main(int argc, char **argv) +int +main(int argc, char **argv) { - GX2RBuffer positionBuffer = { 0 }; - GX2RBuffer colourBuffer = { 0 }; - WHBGfxShaderGroup group = { 0 }; - void *buffer = NULL; - char *gshFileData = NULL; - char *sdRootPath = NULL; + GX2RBuffer positionBuffer = {0}; + GX2RBuffer colourBuffer = {0}; + WHBGfxShaderGroup group = {0}; + void *buffer = NULL; + char *gshFileData = NULL; + char *sdRootPath = NULL; char path[256]; int result = 0; @@ -75,14 +76,14 @@ int main(int argc, char **argv) WHBGfxInitFetchShader(&group); WHBFreeWholeFile(gshFileData); - gshFileData = NULL; + gshFileData = NULL; // Set vertex position positionBuffer.flags = GX2R_RESOURCE_BIND_VERTEX_BUFFER | GX2R_RESOURCE_USAGE_CPU_READ | GX2R_RESOURCE_USAGE_CPU_WRITE | GX2R_RESOURCE_USAGE_GPU_READ; - positionBuffer.elemSize = 4 * 4; + positionBuffer.elemSize = 4 * 4; positionBuffer.elemCount = 3; GX2RCreateBuffer(&positionBuffer); buffer = GX2RLockBufferEx(&positionBuffer, 0); @@ -94,7 +95,7 @@ int main(int argc, char **argv) GX2R_RESOURCE_USAGE_CPU_READ | GX2R_RESOURCE_USAGE_CPU_WRITE | GX2R_RESOURCE_USAGE_GPU_READ; - colourBuffer.elemSize = 4 * 4; + colourBuffer.elemSize = 4 * 4; colourBuffer.elemCount = 3; GX2RCreateBuffer(&colourBuffer); buffer = GX2RLockBufferEx(&colourBuffer, 0); @@ -105,20 +106,20 @@ int main(int argc, char **argv) while (WHBProcIsRunning()) { // Animate colours... float *colours = (float *)GX2RLockBufferEx(&colourBuffer, 0); - colours[0] = 1.0f; - colours[1] = colours[1] >= 1.0f ? 0.0f : (colours[1] + 0.01f); - colours[2] = colours[2] >= 1.0f ? 0.0f : (colours[2] + 0.01f); - colours[3] = 1.0f; - - colours[4] = colours[4] >= 1.0f ? 0.0f : (colours[4] + 0.01f); - colours[5] = 1.0f; - colours[6] = colours[6] >= 1.0f ? 0.0f : (colours[6] + 0.01f); - colours[7] = 1.0f; - - colours[8] = colours[8] >= 1.0f ? 0.0f : (colours[8] + 0.01f); - colours[9] = colours[9] >= 1.0f ? 0.0f : (colours[9] + 0.01f); - colours[10] = 1.0f; - colours[11] = 1.0f; + colours[0] = 1.0f; + colours[1] = colours[1] >= 1.0f ? 0.0f : (colours[1] + 0.01f); + colours[2] = colours[2] >= 1.0f ? 0.0f : (colours[2] + 0.01f); + colours[3] = 1.0f; + + colours[4] = colours[4] >= 1.0f ? 0.0f : (colours[4] + 0.01f); + colours[5] = 1.0f; + colours[6] = colours[6] >= 1.0f ? 0.0f : (colours[6] + 0.01f); + colours[7] = 1.0f; + + colours[8] = colours[8] >= 1.0f ? 0.0f : (colours[8] + 0.01f); + colours[9] = colours[9] >= 1.0f ? 0.0f : (colours[9] + 0.01f); + colours[10] = 1.0f; + colours[11] = 1.0f; GX2RUnlockBufferEx(&colourBuffer, 0); // Render! diff --git a/samples/cmake/helloworld/main.c b/samples/cmake/helloworld/main.c index 489fc4780..462560850 100644 --- a/samples/cmake/helloworld/main.c +++ b/samples/cmake/helloworld/main.c @@ -1,9 +1,9 @@ #include #include -#include #include #include +#include int main(int argc, char **argv) @@ -15,7 +15,7 @@ main(int argc, char **argv) WHBLogConsoleInit(); WHBLogPrintf("Hello World!"); - while(WHBProcIsRunning()) { + while (WHBProcIsRunning()) { OSTicksToCalendarTime(OSGetTime(), &tm); if (tm.tm_sec != last_tm_sec) { @@ -23,7 +23,7 @@ main(int argc, char **argv) tm.tm_mday, tm.tm_mon, tm.tm_year, tm.tm_hour, tm.tm_min, tm.tm_sec); last_tm_sec = tm.tm_sec; - } + } WHBLogConsoleDraw(); OSSleepTicks(OSMillisecondsToTicks(100)); diff --git a/samples/cmake/helloworld_cpp/main.cpp b/samples/cmake/helloworld_cpp/main.cpp index 9938773f7..f4953c4dd 100644 --- a/samples/cmake/helloworld_cpp/main.cpp +++ b/samples/cmake/helloworld_cpp/main.cpp @@ -1,11 +1,11 @@ +#include #include #include -#include #include -#include #include #include +#include #include @@ -13,7 +13,7 @@ int hello_thread() { int last_tm_sec = -1; - uint32_t ip = 0; + uint32_t ip = 0; WHBLogPrintf("Hello World from a std::thread!"); if (!nn::ac::GetAssignedAddress(&ip)) { @@ -23,10 +23,10 @@ hello_thread() WHBLogPrintf("My IP is: %u.%u.%u.%u", (ip >> 24) & 0xFF, (ip >> 16) & 0xFF, - (ip >> 8) & 0xFF, - (ip >> 0) & 0xFF); + (ip >> 8) & 0xFF, + (ip >> 0) & 0xFF); - while(WHBProcIsRunning()) { + while (WHBProcIsRunning()) { OSCalendarTime tm; OSTicksToCalendarTime(OSGetTime(), &tm); diff --git a/samples/cmake/my_first_rpl/my_first_rpl.h b/samples/cmake/my_first_rpl/my_first_rpl.h index b2af8b026..c5404848c 100644 --- a/samples/cmake/my_first_rpl/my_first_rpl.h +++ b/samples/cmake/my_first_rpl/my_first_rpl.h @@ -1,6 +1,7 @@ #ifndef MY_FIRST_RPL_H #define MY_FIRST_RPL_H -const char *my_first_export(); +const char * +my_first_export(); #endif // MY_FIRST_RPL_H diff --git a/samples/cmake/my_first_rpl/my_first_rpx.c b/samples/cmake/my_first_rpl/my_first_rpx.c index d8a201f27..3129c1163 100644 --- a/samples/cmake/my_first_rpl/my_first_rpx.c +++ b/samples/cmake/my_first_rpl/my_first_rpx.c @@ -3,9 +3,9 @@ #include #include -#include #include #include +#include int main(int argc, char **argv) @@ -14,7 +14,7 @@ main(int argc, char **argv) WHBLogConsoleInit(); WHBLogPrintf(my_first_export()); - while(WHBProcIsRunning()) { + while (WHBProcIsRunning()) { WHBLogConsoleDraw(); OSSleepTicks(OSMillisecondsToTicks(30)); } diff --git a/samples/cmake/swkbd/main.cpp b/samples/cmake/swkbd/main.cpp index 69835186b..874ff9778 100644 --- a/samples/cmake/swkbd/main.cpp +++ b/samples/cmake/swkbd/main.cpp @@ -1,15 +1,16 @@ #include #include #include -#include #include +#include -#include #include #include #include +#include -int main(int argc, char **argv) +int +main(int argc, char **argv) { WHBLogUdpInit(); WHBProcInit(); @@ -26,7 +27,7 @@ int main(int argc, char **argv) nn::swkbd::CreateArg createArg; createArg.regionType = nn::swkbd::RegionType::Europe; createArg.workMemory = MEMAllocFromDefaultHeap(nn::swkbd::GetWorkMemorySize(0)); - createArg.fsClient = fsClient; + createArg.fsClient = fsClient; if (!nn::swkbd::Create(createArg)) { WHBLogPrintf("nn::swkbd::Create failed"); WHBProcShutdown(); @@ -39,7 +40,7 @@ int main(int argc, char **argv) // Show the keyboard nn::swkbd::AppearArg appearArg; appearArg.keyboardArg.configArg.languageType = nn::swkbd::LanguageType::English; - appearArg.inputFormArg.hintText = u"I'm a hint."; + appearArg.inputFormArg.hintText = u"I'm a hint."; if (!nn::swkbd::AppearInputForm(appearArg)) { WHBLogPrintf("nn::swkbd::AppearInputForm failed"); WHBProcShutdown(); @@ -55,7 +56,7 @@ int main(int argc, char **argv) // Update keyboard nn::swkbd::ControllerInfo controllerInfo; - controllerInfo.vpad = &vpadStatus; + controllerInfo.vpad = &vpadStatus; controllerInfo.kpad[0] = nullptr; controllerInfo.kpad[1] = nullptr; controllerInfo.kpad[2] = nullptr; diff --git a/samples/make/helloworld/source/main.c b/samples/make/helloworld/source/main.c index 489fc4780..462560850 100644 --- a/samples/make/helloworld/source/main.c +++ b/samples/make/helloworld/source/main.c @@ -1,9 +1,9 @@ #include #include -#include #include #include +#include int main(int argc, char **argv) @@ -15,7 +15,7 @@ main(int argc, char **argv) WHBLogConsoleInit(); WHBLogPrintf("Hello World!"); - while(WHBProcIsRunning()) { + while (WHBProcIsRunning()) { OSTicksToCalendarTime(OSGetTime(), &tm); if (tm.tm_sec != last_tm_sec) { @@ -23,7 +23,7 @@ main(int argc, char **argv) tm.tm_mday, tm.tm_mon, tm.tm_year, tm.tm_hour, tm.tm_min, tm.tm_sec); last_tm_sec = tm.tm_sec; - } + } WHBLogConsoleDraw(); OSSleepTicks(OSMillisecondsToTicks(100)); diff --git a/samples/make/helloworld_cpp/source/main.cpp b/samples/make/helloworld_cpp/source/main.cpp index 9938773f7..f4953c4dd 100644 --- a/samples/make/helloworld_cpp/source/main.cpp +++ b/samples/make/helloworld_cpp/source/main.cpp @@ -1,11 +1,11 @@ +#include #include #include -#include #include -#include #include #include +#include #include @@ -13,7 +13,7 @@ int hello_thread() { int last_tm_sec = -1; - uint32_t ip = 0; + uint32_t ip = 0; WHBLogPrintf("Hello World from a std::thread!"); if (!nn::ac::GetAssignedAddress(&ip)) { @@ -23,10 +23,10 @@ hello_thread() WHBLogPrintf("My IP is: %u.%u.%u.%u", (ip >> 24) & 0xFF, (ip >> 16) & 0xFF, - (ip >> 8) & 0xFF, - (ip >> 0) & 0xFF); + (ip >> 8) & 0xFF, + (ip >> 0) & 0xFF); - while(WHBProcIsRunning()) { + while (WHBProcIsRunning()) { OSCalendarTime tm; OSTicksToCalendarTime(OSGetTime(), &tm); diff --git a/tests/test_compile_headers_as_c11/main.c b/tests/test_compile_headers_as_c11/main.c index 70b21cca8..2d4928a0a 100644 --- a/tests/test_compile_headers_as_c11/main.c +++ b/tests/test_compile_headers_as_c11/main.c @@ -1,6 +1,7 @@ #include "test_compile_headers_list.h" -int main(int argc, char **argv) +int +main(int argc, char **argv) { (void)argc, (void)argv; return 0; diff --git a/tests/test_compile_headers_as_c99/main.c b/tests/test_compile_headers_as_c99/main.c index 70b21cca8..2d4928a0a 100644 --- a/tests/test_compile_headers_as_c99/main.c +++ b/tests/test_compile_headers_as_c99/main.c @@ -1,6 +1,7 @@ #include "test_compile_headers_list.h" -int main(int argc, char **argv) +int +main(int argc, char **argv) { (void)argc, (void)argv; return 0; diff --git a/tests/test_compile_headers_as_cpp/main.cpp b/tests/test_compile_headers_as_cpp/main.cpp index 70b21cca8..2d4928a0a 100644 --- a/tests/test_compile_headers_as_cpp/main.cpp +++ b/tests/test_compile_headers_as_cpp/main.cpp @@ -1,6 +1,7 @@ #include "test_compile_headers_list.h" -int main(int argc, char **argv) +int +main(int argc, char **argv) { (void)argc, (void)argv; return 0; diff --git a/tests/test_compile_headers_common/test_compile_headers_list.h b/tests/test_compile_headers_common/test_compile_headers_list.h index dc5f4c34c..1d93b6ffc 100644 --- a/tests/test_compile_headers_common/test_compile_headers_list.h +++ b/tests/test_compile_headers_common/test_compile_headers_list.h @@ -1,3 +1,6 @@ +#include +#include +#include #include #include #include @@ -27,11 +30,11 @@ #include #include #include -#include #include #include #include #include +#include #include #include #include @@ -92,71 +95,71 @@ #include #include #include -#include #include +#include #include #include +#include #include #include +#include #include +#include #include #include -#include #include #include #include #include +#include #include +#include #include #include +#include +#include #include +#include #include +#include #include #include +#include #include -#include +#include #include +#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include +#include #include -#include -#include -#include -#include #include -#include +#include +#include +#include #include +#include #include -#include #include #include #include #include #include #include +#include #include #include #include #include #include -#include +#include #include -#include #include -#include +#include #include +#include #include #include #include @@ -171,6 +174,3 @@ #include #include #include -#include -#include -#include