From 5abc4873d861395376eb95e74f64c5494faaf262 Mon Sep 17 00:00:00 2001 From: TuxSH Date: Mon, 22 Jan 2018 01:07:11 +0100 Subject: [PATCH] Include only what is really necessary... add pragma once in every header, etc. --- nx/include/switch/arm.h | 3 +++ nx/include/switch/gfx/binder.h | 3 +++ nx/include/switch/gfx/buffer_producer.h | 1 - nx/include/switch/gfx/gfx.h | 3 +++ nx/include/switch/gfx/ioctl.h | 2 ++ nx/include/switch/gfx/nvgfx.h | 3 +++ nx/include/switch/gfx/nvioctl.h | 1 + nx/include/switch/gfx/parcel.h | 5 +++-- nx/include/switch/ipc.h | 5 +++++ nx/include/switch/kernel/detect.h | 3 +++ nx/include/switch/kernel/jit.h | 2 ++ nx/include/switch/kernel/mutex.h | 1 + nx/include/switch/kernel/random.h | 2 ++ nx/include/switch/kernel/rwlock.h | 2 ++ nx/include/switch/kernel/shmem.h | 3 +++ nx/include/switch/kernel/svc.h | 3 +-- nx/include/switch/kernel/thread.h | 3 +++ nx/include/switch/kernel/tmem.h | 3 +++ nx/include/switch/kernel/virtmem.h | 3 +++ nx/include/switch/result.h | 2 +- nx/include/switch/runtime/devices/console.h | 3 +-- nx/include/switch/runtime/devices/fs_dev.h | 1 + nx/include/switch/runtime/devices/usb_comms.h | 3 +++ nx/include/switch/runtime/env.h | 2 ++ nx/include/switch/runtime/util/utf.h | 2 +- nx/include/switch/services/acc.h | 3 +++ nx/include/switch/services/apm.h | 3 +++ nx/include/switch/services/applet.h | 3 +++ nx/include/switch/services/bsd.h | 4 ++++ nx/include/switch/services/fatal.h | 3 +++ nx/include/switch/services/fs.h | 3 +++ nx/include/switch/services/hid.h | 3 +++ nx/include/switch/services/nv.h | 3 +++ nx/include/switch/services/pm.h | 3 +++ nx/include/switch/services/sm.h | 5 +++++ nx/include/switch/services/usb.h | 4 ++++ nx/include/switch/services/vi.h | 4 ++++ nx/include/switch/types.h | 2 +- nx/source/gfx/binder.c | 6 +++++- nx/source/gfx/buffer_producer.c | 6 +++++- nx/source/gfx/gfx.c | 11 ++++++++++- nx/source/gfx/ioctl/channel.c | 6 +++++- nx/source/gfx/ioctl/nvhost-as-gpu.c | 6 +++++- nx/source/gfx/ioctl/nvhost-ctrl-gpu.c | 6 +++++- nx/source/gfx/ioctl/nvhost-ctrl.c | 6 +++++- nx/source/gfx/ioctl/nvmap.c | 6 +++++- nx/source/gfx/nvgfx.c | 10 +++++++++- nx/source/gfx/parcel.c | 3 ++- nx/source/internal.h | 5 +++-- nx/source/kernel/detect.c | 4 +++- nx/source/kernel/jit.c | 9 ++++++++- nx/source/kernel/mutex.c | 3 ++- nx/source/kernel/random.c | 8 +++++++- nx/source/kernel/rwlock.c | 3 ++- nx/source/kernel/shmem.c | 6 +++++- nx/source/kernel/thread.c | 7 ++++++- nx/source/kernel/tmem.c | 6 +++++- nx/source/kernel/virtmem.c | 8 +++++++- nx/source/runtime/argv.c | 4 ++-- nx/source/runtime/devices/console.c | 4 +++- nx/source/runtime/devices/fs_dev.c | 4 +++- nx/source/runtime/devices/usb_comms.c | 6 +++++- nx/source/runtime/dynamic.c | 3 ++- nx/source/runtime/env.c | 5 ++++- nx/source/runtime/init.c | 9 ++++++++- nx/source/runtime/newlib.c | 7 ++++++- nx/source/runtime/util/utf/decode_utf16.c | 3 +-- nx/source/runtime/util/utf/decode_utf8.c | 2 +- nx/source/runtime/util/utf/encode_utf16.c | 2 +- nx/source/runtime/util/utf/encode_utf8.c | 2 +- nx/source/runtime/util/utf/utf16_to_utf32.c | 3 +-- nx/source/runtime/util/utf/utf16_to_utf8.c | 3 +-- nx/source/runtime/util/utf/utf32_to_utf16.c | 4 ++-- nx/source/runtime/util/utf/utf32_to_utf8.c | 3 +-- nx/source/runtime/util/utf/utf8_to_utf16.c | 3 +-- nx/source/runtime/util/utf/utf8_to_utf32.c | 3 +-- nx/source/services/acc.c | 5 +++-- nx/source/services/apm.c | 7 +++++-- nx/source/services/applet.c | 9 ++++++++- nx/source/services/bsd.c | 8 +++++++- nx/source/services/fatal.c | 8 +++++++- nx/source/services/fs.c | 7 ++++++- nx/source/services/hid.c | 9 ++++++++- nx/source/services/nv.c | 9 ++++++++- nx/source/services/pm.c | 6 +++++- nx/source/services/sm.c | 6 +++++- nx/source/services/usb.c | 7 ++++++- nx/source/services/vi.c | 7 ++++++- 88 files changed, 319 insertions(+), 71 deletions(-) diff --git a/nx/include/switch/arm.h b/nx/include/switch/arm.h index daa64e1d..723f9545 100644 --- a/nx/include/switch/arm.h +++ b/nx/include/switch/arm.h @@ -1,3 +1,6 @@ +#pragma once +#include + static inline void* armGetTls(void) { void* ret; __asm__ ("mrs %x[data], tpidrro_el0" : [data] "=r" (ret)); diff --git a/nx/include/switch/gfx/binder.h b/nx/include/switch/gfx/binder.h index a620ce3c..0137b2a4 100644 --- a/nx/include/switch/gfx/binder.h +++ b/nx/include/switch/gfx/binder.h @@ -1,3 +1,6 @@ +#pragma once +#include + #define BINDER_FIRST_CALL_TRANSACTION 0x1 typedef struct { diff --git a/nx/include/switch/gfx/buffer_producer.h b/nx/include/switch/gfx/buffer_producer.h index 21f499a1..763fdf60 100644 --- a/nx/include/switch/gfx/buffer_producer.h +++ b/nx/include/switch/gfx/buffer_producer.h @@ -1,5 +1,4 @@ #pragma once - #include typedef struct { diff --git a/nx/include/switch/gfx/gfx.h b/nx/include/switch/gfx/gfx.h index 0f47e16e..cd63e88c 100644 --- a/nx/include/switch/gfx/gfx.h +++ b/nx/include/switch/gfx/gfx.h @@ -1,3 +1,6 @@ +#pragma once +#include + /// Converts red, green, blue, and alpha components to packed RGBA8. #define RGBA8(r,g,b,a) (((r)&0xff)|(((g)&0xff)<<8)|(((b)&0xff)<<16)|(((a)&0xff)<<24)) diff --git a/nx/include/switch/gfx/ioctl.h b/nx/include/switch/gfx/ioctl.h index a017c75a..0f4c4344 100644 --- a/nx/include/switch/gfx/ioctl.h +++ b/nx/include/switch/gfx/ioctl.h @@ -1,3 +1,5 @@ +#pragma once + //The below defines are from Linux kernel ioctl.h. #define _IOC_NRBITS 8 diff --git a/nx/include/switch/gfx/nvgfx.h b/nx/include/switch/gfx/nvgfx.h index fbb53707..f66dc2fb 100644 --- a/nx/include/switch/gfx/nvgfx.h +++ b/nx/include/switch/gfx/nvgfx.h @@ -1,3 +1,6 @@ +#pragma once +#include + Result nvgfxInitialize(void); void nvgfxExit(void); Result nvgfxEventWait(u32 syncpt_id, u32 threshold, s32 timeout); diff --git a/nx/include/switch/gfx/nvioctl.h b/nx/include/switch/gfx/nvioctl.h index a70f8cfd..85286173 100644 --- a/nx/include/switch/gfx/nvioctl.h +++ b/nx/include/switch/gfx/nvioctl.h @@ -1,4 +1,5 @@ #pragma once +#include typedef struct { u32 arch; // 0x120 (NVGPU_GPU_ARCH_GM200) diff --git a/nx/include/switch/gfx/parcel.h b/nx/include/switch/gfx/parcel.h index d1f2d183..2106f1a1 100644 --- a/nx/include/switch/gfx/parcel.h +++ b/nx/include/switch/gfx/parcel.h @@ -1,5 +1,6 @@ -#include -#include +#pragma once +#include +#include typedef struct { u8 payload[0x400]; diff --git a/nx/include/switch/ipc.h b/nx/include/switch/ipc.h index ad713d59..2f385cf5 100644 --- a/nx/include/switch/ipc.h +++ b/nx/include/switch/ipc.h @@ -1,4 +1,9 @@ // Copyright 2017 plutoo +#pragma once +#include +#include +#include + #define SFCI_MAGIC 0x49434653 #define SFCO_MAGIC 0x4f434653 diff --git a/nx/include/switch/kernel/detect.h b/nx/include/switch/kernel/detect.h index 8109f3f8..aec31ec7 100644 --- a/nx/include/switch/kernel/detect.h +++ b/nx/include/switch/kernel/detect.h @@ -1,4 +1,7 @@ // Copyright 2017 plutoo +#pragma once +#include + bool kernelAbove200(void); bool kernelAbove300(void); bool kernelAbove400(void); diff --git a/nx/include/switch/kernel/jit.h b/nx/include/switch/kernel/jit.h index 879206a0..eebd3e4f 100644 --- a/nx/include/switch/kernel/jit.h +++ b/nx/include/switch/kernel/jit.h @@ -1,4 +1,6 @@ // Copyright 2018 plutoo +#pragma once +#include typedef enum { JitType_CodeMemory, diff --git a/nx/include/switch/kernel/mutex.h b/nx/include/switch/kernel/mutex.h index e79b9264..57f32783 100644 --- a/nx/include/switch/kernel/mutex.h +++ b/nx/include/switch/kernel/mutex.h @@ -1,6 +1,7 @@ // Copyright 2017 plutoo #pragma once #include +#include // not needed in this file, still including it typedef _LOCK_T Mutex; typedef _LOCK_RECURSIVE_T RMutex; diff --git a/nx/include/switch/kernel/random.h b/nx/include/switch/kernel/random.h index 05c0b172..6764454a 100644 --- a/nx/include/switch/kernel/random.h +++ b/nx/include/switch/kernel/random.h @@ -1,4 +1,6 @@ // Copyright 2018 plutoo +#pragma once +#include void randomGet(u8* buf, size_t len); u64 randomGet64(void); diff --git a/nx/include/switch/kernel/rwlock.h b/nx/include/switch/kernel/rwlock.h index c49f6191..bf9ef772 100644 --- a/nx/include/switch/kernel/rwlock.h +++ b/nx/include/switch/kernel/rwlock.h @@ -1,4 +1,6 @@ // Copyright 2018 plutoo +#pragma once +#include typedef struct { RMutex r; diff --git a/nx/include/switch/kernel/shmem.h b/nx/include/switch/kernel/shmem.h index 4af87746..c4720c9d 100644 --- a/nx/include/switch/kernel/shmem.h +++ b/nx/include/switch/kernel/shmem.h @@ -1,3 +1,6 @@ +#pragma once +#include + typedef struct { Handle handle; size_t size; diff --git a/nx/include/switch/kernel/svc.h b/nx/include/switch/kernel/svc.h index 93ee74a1..55562568 100644 --- a/nx/include/switch/kernel/svc.h +++ b/nx/include/switch/kernel/svc.h @@ -3,8 +3,7 @@ * @brief Syscall wrappers. */ #pragma once - -#include "../types.h" +#include /// Pseudo handle for the current process #define CUR_PROCESS_HANDLE 0xFFFF8001 diff --git a/nx/include/switch/kernel/thread.h b/nx/include/switch/kernel/thread.h index dea17bc0..9ff44fa5 100644 --- a/nx/include/switch/kernel/thread.h +++ b/nx/include/switch/kernel/thread.h @@ -1,3 +1,6 @@ +#pragma once +#include + typedef struct { Handle handle; void* stack_mem; diff --git a/nx/include/switch/kernel/tmem.h b/nx/include/switch/kernel/tmem.h index 5e97841c..ace5ff72 100644 --- a/nx/include/switch/kernel/tmem.h +++ b/nx/include/switch/kernel/tmem.h @@ -1,3 +1,6 @@ +#pragma once +#include + typedef struct { Handle handle; size_t size; diff --git a/nx/include/switch/kernel/virtmem.h b/nx/include/switch/kernel/virtmem.h index 60aa722e..14339ecf 100644 --- a/nx/include/switch/kernel/virtmem.h +++ b/nx/include/switch/kernel/virtmem.h @@ -1,3 +1,6 @@ +#pragma once +#include + void* virtmemReserve(size_t size); void virtmemFree(void* addr, size_t size); diff --git a/nx/include/switch/result.h b/nx/include/switch/result.h index 3660bc3e..64fc8cc4 100644 --- a/nx/include/switch/result.h +++ b/nx/include/switch/result.h @@ -3,7 +3,7 @@ * @brief Switch result code tools */ #pragma once -#include "types.h" +#include /// Checks whether a result code indicates success. #define R_SUCCEEDED(res) ((res)==0) diff --git a/nx/include/switch/runtime/devices/console.h b/nx/include/switch/runtime/devices/console.h index 431945d8..e4254ab1 100644 --- a/nx/include/switch/runtime/devices/console.h +++ b/nx/include/switch/runtime/devices/console.h @@ -15,8 +15,7 @@ * @endcode */ #pragma once - -#include +#include #define CONSOLE_ESC(x) "\x1b[" #x #define CONSOLE_RESET CONSOLE_ESC(0m) diff --git a/nx/include/switch/runtime/devices/fs_dev.h b/nx/include/switch/runtime/devices/fs_dev.h index 4fa2f5ad..66c575db 100644 --- a/nx/include/switch/runtime/devices/fs_dev.h +++ b/nx/include/switch/runtime/devices/fs_dev.h @@ -3,6 +3,7 @@ * @brief FS driver. */ #pragma once +#include //NOTE: This is currently not usable. diff --git a/nx/include/switch/runtime/devices/usb_comms.h b/nx/include/switch/runtime/devices/usb_comms.h index 4d23aa01..75947694 100644 --- a/nx/include/switch/runtime/devices/usb_comms.h +++ b/nx/include/switch/runtime/devices/usb_comms.h @@ -1,3 +1,6 @@ +#pragma once +#include + Result usbCommsInitialize(void); void usbCommsExit(void); diff --git a/nx/include/switch/runtime/env.h b/nx/include/switch/runtime/env.h index 213eaa95..98bbc6ea 100644 --- a/nx/include/switch/runtime/env.h +++ b/nx/include/switch/runtime/env.h @@ -1,4 +1,6 @@ // Copyright 2018 plutoo +#pragma once +#include typedef struct { u32 Key; diff --git a/nx/include/switch/runtime/util/utf.h b/nx/include/switch/runtime/util/utf.h index 8c4f914b..f5b94edb 100644 --- a/nx/include/switch/runtime/util/utf.h +++ b/nx/include/switch/runtime/util/utf.h @@ -4,8 +4,8 @@ */ #pragma once -#include #include +#include /** Convert a UTF-8 sequence into a UTF-32 codepoint * diff --git a/nx/include/switch/services/acc.h b/nx/include/switch/services/acc.h index 822fa7a0..895d4931 100644 --- a/nx/include/switch/services/acc.h +++ b/nx/include/switch/services/acc.h @@ -1,3 +1,6 @@ +#pragma once +#include + Result accountInitialize(void); void accountExit(void); Handle accountGetSessionService(void); diff --git a/nx/include/switch/services/apm.h b/nx/include/switch/services/apm.h index b8182daa..5fee8ad0 100644 --- a/nx/include/switch/services/apm.h +++ b/nx/include/switch/services/apm.h @@ -1,3 +1,6 @@ +#pragma once +#include + /// These are used internally by applet. Result apmInitialize(void); diff --git a/nx/include/switch/services/applet.h b/nx/include/switch/services/applet.h index 5c0f9aa4..41a22f0e 100644 --- a/nx/include/switch/services/applet.h +++ b/nx/include/switch/services/applet.h @@ -1,3 +1,6 @@ +#pragma once +#include + typedef enum { AppletType_None = -2, AppletType_Default = -1, diff --git a/nx/include/switch/services/bsd.h b/nx/include/switch/services/bsd.h index ff982871..e3f79ad9 100644 --- a/nx/include/switch/services/bsd.h +++ b/nx/include/switch/services/bsd.h @@ -1,3 +1,7 @@ +#pragma once +#include +#include + struct bsd_sockaddr_in { u8 sin_len; u8 sin_family; diff --git a/nx/include/switch/services/fatal.h b/nx/include/switch/services/fatal.h index f572dec6..c75004b2 100644 --- a/nx/include/switch/services/fatal.h +++ b/nx/include/switch/services/fatal.h @@ -1 +1,4 @@ +#pragma once +#include + __attribute__((noreturn)) void fatalSimple(Result err); diff --git a/nx/include/switch/services/fs.h b/nx/include/switch/services/fs.h index ea85665d..664efdad 100644 --- a/nx/include/switch/services/fs.h +++ b/nx/include/switch/services/fs.h @@ -1,4 +1,7 @@ // Copyright 2017 plutoo +#pragma once +#include +#include // We use wrapped handles for type safety. diff --git a/nx/include/switch/services/hid.h b/nx/include/switch/services/hid.h index cf571977..8f28c820 100644 --- a/nx/include/switch/services/hid.h +++ b/nx/include/switch/services/hid.h @@ -1,5 +1,8 @@ +#pragma once + #include #include +#include // Begin enums and output structs diff --git a/nx/include/switch/services/nv.h b/nx/include/switch/services/nv.h index d3e326ff..739c98b5 100644 --- a/nx/include/switch/services/nv.h +++ b/nx/include/switch/services/nv.h @@ -1,3 +1,6 @@ +#pragma once +#include + typedef enum { NVSERVTYPE_Default = -1, NVSERVTYPE_Application = 0, diff --git a/nx/include/switch/services/pm.h b/nx/include/switch/services/pm.h index e281b648..36c7298a 100644 --- a/nx/include/switch/services/pm.h +++ b/nx/include/switch/services/pm.h @@ -1,3 +1,6 @@ +#pragma once +#include + // Copyright 2017 plutoo Result pmdmntInitialize(void); Result pmdmntStartProcess(u64 pid); diff --git a/nx/include/switch/services/sm.h b/nx/include/switch/services/sm.h index d1e6ced4..4e6bdf1f 100644 --- a/nx/include/switch/services/sm.h +++ b/nx/include/switch/services/sm.h @@ -1,3 +1,8 @@ +#pragma once +#include +#include +#include + typedef enum { ServiceType_Uninitialized, ServiceType_Normal, diff --git a/nx/include/switch/services/usb.h b/nx/include/switch/services/usb.h index 8cb5e3e6..57b6d133 100644 --- a/nx/include/switch/services/usb.h +++ b/nx/include/switch/services/usb.h @@ -1,3 +1,7 @@ +#pragma once +#include +#include + /// usb:ds Switch-as-device<>host USB comms, see also here: http://switchbrew.org/index.php?title=USB_services /// Names starting with "libusb" were changed to "usb" to avoid collision with actual libusb if it's ever used. diff --git a/nx/include/switch/services/vi.h b/nx/include/switch/services/vi.h index be0d30bf..5ea72247 100644 --- a/nx/include/switch/services/vi.h +++ b/nx/include/switch/services/vi.h @@ -1,3 +1,7 @@ +#pragma once +#include +#include + typedef struct { u64 display_id; char display_name[0x40]; diff --git a/nx/include/switch/types.h b/nx/include/switch/types.h index b9e14833..2c142f9f 100644 --- a/nx/include/switch/types.h +++ b/nx/include/switch/types.h @@ -65,7 +65,7 @@ typedef enum { #define NORETURN __attribute__((noreturn)) #define IGNORE_ARG(x) (void)(x) -#ifndef LIBCTRU_NO_DEPRECATION +#ifndef LIBNX_NO_DEPRECATION /// Flags a function as deprecated. #define DEPRECATED __attribute__ ((deprecated)) #else diff --git a/nx/source/gfx/binder.c b/nx/source/gfx/binder.c index 107e3e4a..15ffa42c 100644 --- a/nx/source/gfx/binder.c +++ b/nx/source/gfx/binder.c @@ -1,5 +1,9 @@ #include -#include +#include +#include +#include +#include +#include void binderCreateSession(Binder *session, Handle sessionHandle, s32 id) { diff --git a/nx/source/gfx/buffer_producer.c b/nx/source/gfx/buffer_producer.c index dabd92b4..793f3e89 100644 --- a/nx/source/gfx/buffer_producer.c +++ b/nx/source/gfx/buffer_producer.c @@ -1,5 +1,9 @@ #include -#include +#include +#include +#include +#include + // This implements the version of Android IGraphicBufferProducer used by Switch. // Hence names/params etc here are based on Android IGraphicBufferProducer.cpp. diff --git a/nx/source/gfx/gfx.c b/nx/source/gfx/gfx.c index bd019d71..1889e186 100644 --- a/nx/source/gfx/gfx.c +++ b/nx/source/gfx/gfx.c @@ -1,5 +1,14 @@ #include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static bool g_gfxInitialized = 0; static ViDisplay g_gfxDisplay; diff --git a/nx/source/gfx/ioctl/channel.c b/nx/source/gfx/ioctl/channel.c index 3f839cd4..923b0182 100644 --- a/nx/source/gfx/ioctl/channel.c +++ b/nx/source/gfx/ioctl/channel.c @@ -1,5 +1,9 @@ -#include #include +#include +#include +#include +#include +#include Result nvioctlChannel_SetNvmapFd(u32 fd, u32 nvmap_fd) { struct { diff --git a/nx/source/gfx/ioctl/nvhost-as-gpu.c b/nx/source/gfx/ioctl/nvhost-as-gpu.c index 378879b5..a6406ffe 100644 --- a/nx/source/gfx/ioctl/nvhost-as-gpu.c +++ b/nx/source/gfx/ioctl/nvhost-as-gpu.c @@ -1,5 +1,9 @@ -#include #include +#include +#include +#include +#include +#include Result nvioctlNvhostAsGpu_BindChannel(u32 fd, u32 channel_fd) { struct { diff --git a/nx/source/gfx/ioctl/nvhost-ctrl-gpu.c b/nx/source/gfx/ioctl/nvhost-ctrl-gpu.c index 0aeb4aef..77a3b3b8 100644 --- a/nx/source/gfx/ioctl/nvhost-ctrl-gpu.c +++ b/nx/source/gfx/ioctl/nvhost-ctrl-gpu.c @@ -1,5 +1,9 @@ -#include #include +#include +#include +#include +#include +#include Result nvioctlNvhostCtrlGpu_ZCullGetCtxSize(u32 fd, u32 *out) { Result rc = 0; diff --git a/nx/source/gfx/ioctl/nvhost-ctrl.c b/nx/source/gfx/ioctl/nvhost-ctrl.c index 3cacc2a1..2883200a 100644 --- a/nx/source/gfx/ioctl/nvhost-ctrl.c +++ b/nx/source/gfx/ioctl/nvhost-ctrl.c @@ -1,5 +1,9 @@ -#include #include +#include +#include +#include +#include +#include Result nvioctlNvhostCtrl_EventSignal(u32 fd, u32 event_id) { struct { diff --git a/nx/source/gfx/ioctl/nvmap.c b/nx/source/gfx/ioctl/nvmap.c index 31d2745f..75a0b40f 100644 --- a/nx/source/gfx/ioctl/nvmap.c +++ b/nx/source/gfx/ioctl/nvmap.c @@ -1,5 +1,9 @@ -#include #include +#include +#include +#include +#include +#include Result nvioctlNvmap_Create(u32 fd, u32 size, u32 *nvmap_handle) { Result rc=0; diff --git a/nx/source/gfx/nvgfx.c b/nx/source/gfx/nvgfx.c index a1dbe46f..e16df87d 100644 --- a/nx/source/gfx/nvgfx.c +++ b/nx/source/gfx/nvgfx.c @@ -1,6 +1,14 @@ #include #include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include //#include "nvgfx_gpu_gpfifo_data0_bin.h" diff --git a/nx/source/gfx/parcel.c b/nx/source/gfx/parcel.c index d6a8d9c1..bde4fc18 100644 --- a/nx/source/gfx/parcel.c +++ b/nx/source/gfx/parcel.c @@ -1,5 +1,6 @@ #include -#include +#include +#include //This implements Android Parcel, hence names etc here are based on Android Parcel.cpp. diff --git a/nx/source/internal.h b/nx/source/internal.h index c4b66b6c..aadcd668 100644 --- a/nx/source/internal.h +++ b/nx/source/internal.h @@ -1,6 +1,7 @@ #pragma once -#include -#include +#include +#include +#include #define THREADVARS_MAGIC 0x21545624 // !TV$ diff --git a/nx/source/kernel/detect.c b/nx/source/kernel/detect.c index 3e2c07ed..9752782c 100644 --- a/nx/source/kernel/detect.c +++ b/nx/source/kernel/detect.c @@ -1,5 +1,7 @@ // Copyright 2017 plutoo -#include +#include +#include +#include static bool g_IsAbove200; static bool g_IsAbove300; diff --git a/nx/source/kernel/jit.c b/nx/source/kernel/jit.c index 24ea9d51..0dc2b39d 100644 --- a/nx/source/kernel/jit.c +++ b/nx/source/kernel/jit.c @@ -1,7 +1,14 @@ // Copyright 2018 plutoo -#include #include +#include +#include +#include +#include +#include +#include +#include + Result jitCreate(Jit* j, size_t size) { JitType type; diff --git a/nx/source/kernel/mutex.c b/nx/source/kernel/mutex.c index 776a606a..43c3748f 100644 --- a/nx/source/kernel/mutex.c +++ b/nx/source/kernel/mutex.c @@ -1,5 +1,6 @@ // Copyright 2017 plutoo -#include +#include +#include #include "../internal.h" #define HAS_LISTENERS 0x40000000 diff --git a/nx/source/kernel/random.c b/nx/source/kernel/random.c index deebb2e7..8387f1ec 100644 --- a/nx/source/kernel/random.c +++ b/nx/source/kernel/random.c @@ -6,7 +6,13 @@ Modified by plutoo. */ -#include +#include +#include +#include +#include +#include +#include +#include #define ROTL32(x, n) (((x) << (n)) | ((x) >> (32-(n)))) diff --git a/nx/source/kernel/rwlock.c b/nx/source/kernel/rwlock.c index 88d61b7a..91229f74 100644 --- a/nx/source/kernel/rwlock.c +++ b/nx/source/kernel/rwlock.c @@ -1,5 +1,6 @@ // Copyright 2018 plutoo -#include +#include +#include void rwlockReadLock(RwLock* r) { rmutexLock(&r->r); diff --git a/nx/source/kernel/shmem.c b/nx/source/kernel/shmem.c index ebc8dcde..40a36989 100644 --- a/nx/source/kernel/shmem.c +++ b/nx/source/kernel/shmem.c @@ -1,6 +1,10 @@ // Copyright 2017 plutoo -#include #include +#include +#include +#include +#include +#include Result shmemCreate(SharedMemory* s, size_t size, Permission local_perm, Permission remote_perm) { diff --git a/nx/source/kernel/thread.c b/nx/source/kernel/thread.c index f98ceccc..b6d4c80e 100644 --- a/nx/source/kernel/thread.c +++ b/nx/source/kernel/thread.c @@ -1,6 +1,11 @@ // Copyright 2017 plutoo -#include #include +#include +#include +#include +#include +#include +#include #include "../internal.h" extern const u8 __tdata_lma[]; diff --git a/nx/source/kernel/tmem.c b/nx/source/kernel/tmem.c index a770b5f6..338e4cb5 100644 --- a/nx/source/kernel/tmem.c +++ b/nx/source/kernel/tmem.c @@ -1,6 +1,10 @@ // Copyright 2017 plutoo -#include #include +#include +#include +#include +#include +#include Result tmemCreate(TransferMemory* t, size_t size, Permission perm) { diff --git a/nx/source/kernel/virtmem.c b/nx/source/kernel/virtmem.c index 6f0b5e36..d24349da 100644 --- a/nx/source/kernel/virtmem.c +++ b/nx/source/kernel/virtmem.c @@ -1,4 +1,10 @@ -#include +#include +#include +#include +#include +#include +#include +#include typedef struct { u64 start; diff --git a/nx/source/runtime/argv.c b/nx/source/runtime/argv.c index 2936353e..1c41c61a 100644 --- a/nx/source/runtime/argv.c +++ b/nx/source/runtime/argv.c @@ -1,7 +1,7 @@ -#include - #include #include +#include +#include // System globals we define here int __system_argc; diff --git a/nx/source/runtime/devices/console.c b/nx/source/runtime/devices/console.c index 113130f1..5ba2a70d 100644 --- a/nx/source/runtime/devices/console.c +++ b/nx/source/runtime/devices/console.c @@ -1,7 +1,9 @@ #include #include #include -#include +#include +#include +#include #include "default_font_bin.h" diff --git a/nx/source/runtime/devices/fs_dev.c b/nx/source/runtime/devices/fs_dev.c index 449bc0ba..c2458c02 100644 --- a/nx/source/runtime/devices/fs_dev.c +++ b/nx/source/runtime/devices/fs_dev.c @@ -8,7 +8,9 @@ #include #include -#include +#include +#include +#include /*! @internal diff --git a/nx/source/runtime/devices/usb_comms.c b/nx/source/runtime/devices/usb_comms.c index f7649e82..0137cb87 100644 --- a/nx/source/runtime/devices/usb_comms.c +++ b/nx/source/runtime/devices/usb_comms.c @@ -1,6 +1,10 @@ #include #include -#include +#include +#include +#include +#include +#include static bool g_usbCommsInitialized = false; diff --git a/nx/source/runtime/dynamic.c b/nx/source/runtime/dynamic.c index 01cdefd7..ff06e688 100644 --- a/nx/source/runtime/dynamic.c +++ b/nx/source/runtime/dynamic.c @@ -1,4 +1,5 @@ -#include +#include +#include #include void __nx_dynamic(uintptr_t base, const Elf64_Dyn* dyn) diff --git a/nx/source/runtime/env.c b/nx/source/runtime/env.c index f1b24911..e4c668d2 100644 --- a/nx/source/runtime/env.c +++ b/nx/source/runtime/env.c @@ -1,5 +1,8 @@ // Copyright 2018 plutoo -#include +#include +#include +#include +#include static bool g_isNso = false; static Handle g_mainThreadHandle = INVALID_HANDLE; diff --git a/nx/source/runtime/init.c b/nx/source/runtime/init.c index 0aec27c2..f727dfcd 100644 --- a/nx/source/runtime/init.c +++ b/nx/source/runtime/init.c @@ -1,4 +1,11 @@ -#include +#include +#include +#include +#include +#include +#include +#include + void __nx_exit(int rc); diff --git a/nx/source/runtime/newlib.c b/nx/source/runtime/newlib.c index b9fce07b..ffa31d13 100644 --- a/nx/source/runtime/newlib.c +++ b/nx/source/runtime/newlib.c @@ -1,9 +1,14 @@ -#include +#include #include #include #include #include #include "../internal.h" +#include +#include +#include +#include +#include void __attribute__((weak)) NORETURN __libnx_exit(int rc); diff --git a/nx/source/runtime/util/utf/decode_utf16.c b/nx/source/runtime/util/utf/decode_utf16.c index 47cc2f4d..3d0b1940 100644 --- a/nx/source/runtime/util/utf/decode_utf16.c +++ b/nx/source/runtime/util/utf/decode_utf16.c @@ -1,5 +1,4 @@ -#include "switch/types.h" -#include "switch/runtime/util/utf.h" +#include ssize_t decode_utf16(uint32_t *out, diff --git a/nx/source/runtime/util/utf/decode_utf8.c b/nx/source/runtime/util/utf/decode_utf8.c index 7554ad92..f9158673 100644 --- a/nx/source/runtime/util/utf/decode_utf8.c +++ b/nx/source/runtime/util/utf/decode_utf8.c @@ -1,4 +1,4 @@ -#include "switch/runtime/util/utf.h" +#include ssize_t decode_utf8(uint32_t *out, diff --git a/nx/source/runtime/util/utf/encode_utf16.c b/nx/source/runtime/util/utf/encode_utf16.c index baed345b..91878686 100644 --- a/nx/source/runtime/util/utf/encode_utf16.c +++ b/nx/source/runtime/util/utf/encode_utf16.c @@ -1,4 +1,4 @@ -#include "switch/runtime/util/utf.h" +#include ssize_t encode_utf16(uint16_t *out, diff --git a/nx/source/runtime/util/utf/encode_utf8.c b/nx/source/runtime/util/utf/encode_utf8.c index c5dc42cf..97dcccff 100644 --- a/nx/source/runtime/util/utf/encode_utf8.c +++ b/nx/source/runtime/util/utf/encode_utf8.c @@ -1,4 +1,4 @@ -#include "switch/runtime/util/utf.h" +#include ssize_t encode_utf8(uint8_t *out, diff --git a/nx/source/runtime/util/utf/utf16_to_utf32.c b/nx/source/runtime/util/utf/utf16_to_utf32.c index 5e2af244..2a864778 100644 --- a/nx/source/runtime/util/utf/utf16_to_utf32.c +++ b/nx/source/runtime/util/utf/utf16_to_utf32.c @@ -1,5 +1,4 @@ -#include "switch/types.h" -#include "switch/runtime/util/utf.h" +#include ssize_t utf16_to_utf32(uint32_t *out, diff --git a/nx/source/runtime/util/utf/utf16_to_utf8.c b/nx/source/runtime/util/utf/utf16_to_utf8.c index b5fed36f..3b812baa 100644 --- a/nx/source/runtime/util/utf/utf16_to_utf8.c +++ b/nx/source/runtime/util/utf/utf16_to_utf8.c @@ -1,5 +1,4 @@ -#include "switch/types.h" -#include "switch/runtime/util/utf.h" +#include ssize_t utf16_to_utf8(uint8_t *out, diff --git a/nx/source/runtime/util/utf/utf32_to_utf16.c b/nx/source/runtime/util/utf/utf32_to_utf16.c index 75b3643f..495dc6e4 100644 --- a/nx/source/runtime/util/utf/utf32_to_utf16.c +++ b/nx/source/runtime/util/utf/utf32_to_utf16.c @@ -1,5 +1,5 @@ -#include "switch/types.h" -#include "switch/runtime/util/utf.h" +#include + ssize_t utf32_to_utf16(uint16_t *out, diff --git a/nx/source/runtime/util/utf/utf32_to_utf8.c b/nx/source/runtime/util/utf/utf32_to_utf8.c index b7025fd0..9520d314 100644 --- a/nx/source/runtime/util/utf/utf32_to_utf8.c +++ b/nx/source/runtime/util/utf/utf32_to_utf8.c @@ -1,5 +1,4 @@ -#include "switch/types.h" -#include "switch/runtime/util/utf.h" +#include ssize_t utf32_to_utf8(uint8_t *out, diff --git a/nx/source/runtime/util/utf/utf8_to_utf16.c b/nx/source/runtime/util/utf/utf8_to_utf16.c index 48653cb6..54f2f36c 100644 --- a/nx/source/runtime/util/utf/utf8_to_utf16.c +++ b/nx/source/runtime/util/utf/utf8_to_utf16.c @@ -1,5 +1,4 @@ -#include "switch/types.h" -#include "switch/runtime/util/utf.h" +#include ssize_t utf8_to_utf16(uint16_t *out, diff --git a/nx/source/runtime/util/utf/utf8_to_utf32.c b/nx/source/runtime/util/utf/utf8_to_utf32.c index fe70a560..162dfb33 100644 --- a/nx/source/runtime/util/utf/utf8_to_utf32.c +++ b/nx/source/runtime/util/utf/utf8_to_utf32.c @@ -1,5 +1,4 @@ -#include "switch/types.h" -#include "switch/runtime/util/utf.h" +#include ssize_t utf8_to_utf32(uint32_t *out, diff --git a/nx/source/services/acc.c b/nx/source/services/acc.c index db370783..264d5316 100644 --- a/nx/source/services/acc.c +++ b/nx/source/services/acc.c @@ -1,5 +1,6 @@ -#include -#include +#include +#include +#include static Service g_accSrv; diff --git a/nx/source/services/apm.c b/nx/source/services/apm.c index b176a0fd..74a47b38 100644 --- a/nx/source/services/apm.c +++ b/nx/source/services/apm.c @@ -1,5 +1,8 @@ -#include -#include +#include +#include +#include +#include +#include static Service g_apmSrv; static Service g_apmISession; diff --git a/nx/source/services/applet.c b/nx/source/services/applet.c index 57c35173..909e48dd 100644 --- a/nx/source/services/applet.c +++ b/nx/source/services/applet.c @@ -1,5 +1,12 @@ #include -#include +#include +#include +#include +#include +#include +#include +#include +#include __attribute__((weak)) u32 __nx_applet_type = AppletType_Default; __attribute__((weak)) bool __nx_applet_auto_notifyrunning = true; diff --git a/nx/source/services/bsd.c b/nx/source/services/bsd.c index fd5dcec1..bf5d3bf1 100644 --- a/nx/source/services/bsd.c +++ b/nx/source/services/bsd.c @@ -1,5 +1,11 @@ // Copyright 2017 plutoo -#include +#include +#include +#include +#include +#include +#include +#include static Service g_bsdSrv; static Service g_bsdMonitor; diff --git a/nx/source/services/fatal.c b/nx/source/services/fatal.c index 82bd17a6..a2090033 100644 --- a/nx/source/services/fatal.c +++ b/nx/source/services/fatal.c @@ -1,5 +1,11 @@ // Copyright 2017 plutoo -#include +#include +#include +#include +#include +#include +#include +#include void fatalSimple(Result err) { Result rc = 0; diff --git a/nx/source/services/fs.c b/nx/source/services/fs.c index 4ad29451..ff73d628 100644 --- a/nx/source/services/fs.c +++ b/nx/source/services/fs.c @@ -1,5 +1,10 @@ // Copyright 2017 plutoo -#include +#include +#include +#include +#include +#include +#include static Service g_fsSrv; diff --git a/nx/source/services/hid.c b/nx/source/services/hid.c index 20d0b8b8..07cca889 100644 --- a/nx/source/services/hid.c +++ b/nx/source/services/hid.c @@ -1,5 +1,12 @@ #include -#include +#include +#include +#include +#include +#include +#include +#include +#include static Service g_hidSrv; static Service g_hidIAppletResource; diff --git a/nx/source/services/nv.c b/nx/source/services/nv.c index 7e84c1e4..cf8a496c 100644 --- a/nx/source/services/nv.c +++ b/nx/source/services/nv.c @@ -1,5 +1,12 @@ #include -#include +#include +#include +#include +#include +#include +#include +#include +#include static Service g_nvSrv; static size_t g_nvIpcBufferSize = 0; diff --git a/nx/source/services/pm.c b/nx/source/services/pm.c index 546cf709..b183be5a 100644 --- a/nx/source/services/pm.c +++ b/nx/source/services/pm.c @@ -1,5 +1,9 @@ // Copyright 2017 plutoo -#include +#include +#include +#include +#include +#include static Service g_pmdmntSrv; diff --git a/nx/source/services/sm.c b/nx/source/services/sm.c index 5d6126c5..1ec234a0 100644 --- a/nx/source/services/sm.c +++ b/nx/source/services/sm.c @@ -1,5 +1,9 @@ // Copyright 2017 plutoo -#include +#include +#include +#include +#include +#include static Handle g_smHandle = INVALID_HANDLE; diff --git a/nx/source/services/usb.c b/nx/source/services/usb.c index c36d6a83..6719ecec 100644 --- a/nx/source/services/usb.c +++ b/nx/source/services/usb.c @@ -1,5 +1,10 @@ #include -#include +#include +#include +#include +#include +#include +#include #define TOTAL_INTERFACES 4 #define TOTAL_ENDPOINTS 15*2 diff --git a/nx/source/services/vi.c b/nx/source/services/vi.c index 696b96cf..a720e9c5 100644 --- a/nx/source/services/vi.c +++ b/nx/source/services/vi.c @@ -1,5 +1,10 @@ #include -#include +#include +#include +#include +#include +#include +#include static Service g_viSrv;