From: chaoskagami Date: Tue, 24 May 2016 02:11:20 +0000 (-0400) Subject: Go away, #pragma once X-Git-Tag: stable-1~43 X-Git-Url: https://chaos.moe/g/?a=commitdiff_plain;h=418bf55c88cf083a10015a8c2f9d53c9cee38509;p=corbenik%2Fcorbenik.git Go away, #pragma once --- diff --git a/external/loader/source/exheader.h b/external/loader/source/exheader.h index 394f351..2892ecb 100644 --- a/external/loader/source/exheader.h +++ b/external/loader/source/exheader.h @@ -1,4 +1,5 @@ -#pragma once +#ifndef __EXHEADER_H +#define __EXHEADER_H #include <3ds/types.h> @@ -92,3 +93,5 @@ typedef struct exheader_arm9accesscontrol arm9accesscontrol; } PACKED accessdesc; } PACKED exheader_header; + +#endif diff --git a/external/loader/source/fsldr.h b/external/loader/source/fsldr.h index 8dfcdd1..f3d403f 100644 --- a/external/loader/source/fsldr.h +++ b/external/loader/source/fsldr.h @@ -1,4 +1,5 @@ -#pragma once +#ifndef __FSLDR_H +#define __FSLDR_H #include <3ds/types.h> @@ -8,4 +9,6 @@ Result FSLDR_InitializeWithSdkVersion(Handle session, u32 version); Result FSLDR_SetPriority(u32 priority); Result FSLDR_OpenFileDirectly(Handle* out, FS_ArchiveID archiveId, FS_Path archivePath, FS_Path filePath, - u32 openFlags, u32 attributes); \ No newline at end of file + u32 openFlags, u32 attributes); + +#endif diff --git a/external/loader/source/fsreg.h b/external/loader/source/fsreg.h index c7f56bb..ad1dff4 100644 --- a/external/loader/source/fsreg.h +++ b/external/loader/source/fsreg.h @@ -1,4 +1,5 @@ -#pragma once +#ifndef __FSREG_H +#define __FSREG_H #include <3ds/types.h> #include "exheader.h" @@ -13,3 +14,5 @@ Result FSREG_UnloadProgram(u64 prog_handle); Result FSREG_Unregister(u32 pid); Result FSREG_Register(u32 pid, u64 prog_handle, FS_ProgramInfo* info, void* storageinfo); + +#endif diff --git a/external/loader/source/ifile.h b/external/loader/source/ifile.h index 8c15e21..5cda305 100644 --- a/external/loader/source/ifile.h +++ b/external/loader/source/ifile.h @@ -1,4 +1,5 @@ -#pragma once +#ifndef __IFILE_H +#define __IFILE_H #include <3ds/types.h> @@ -15,3 +16,5 @@ Result IFile_Close(IFile* file); Result IFile_GetSize(IFile* file, u64* size); Result IFile_Read(IFile* file, u64* total, void* buffer, u32 len); Result IFile_Write(IFile* file, u64* total, void* buffer, u32 len); + +#endif diff --git a/external/loader/source/internal.h b/external/loader/source/internal.h index 3ea12da..f410804 100644 --- a/external/loader/source/internal.h +++ b/external/loader/source/internal.h @@ -1,5 +1,8 @@ -#pragma once +#ifndef __INTERNAL_H +#define __INTERNAL_H // This is a GCC builtin, and so there's no need to carry an implementation // here. void* memcpy(void* dest, const void* src, size_t len); + +#endif diff --git a/external/loader/source/lzss.h b/external/loader/source/lzss.h index 7d71ba4..b4fcb89 100644 --- a/external/loader/source/lzss.h +++ b/external/loader/source/lzss.h @@ -1,3 +1,6 @@ -#pragma once +#ifndef __LZSS_H +#define __LZSS_H int lzss_decompress(u8* buffer); + +#endif diff --git a/external/loader/source/patch/patch.h b/external/loader/source/patch/patch.h index 2396856..90d8c2f 100644 --- a/external/loader/source/patch/patch.h +++ b/external/loader/source/patch/patch.h @@ -1,4 +1,5 @@ -#pragma once +#ifndef __PATCH_PATCH_H +#define __PATCH_PATCH_H void disable_cart_updates(u64 progId, u8* code, u32 size); void disable_eshop_updates(u64 progId, u8* code, u32 size); @@ -8,3 +9,5 @@ void settings_string(u64 progId, u8* code, u32 size); void region_patch(u64 progId, u8* code, u32 size); void ro_sigpatch(u64 progId, u8* code, u32 size); void secureinfo_sigpatch(u64 progId, u8* code, u32 size); + +#endif diff --git a/external/loader/source/patcher.c b/external/loader/source/patcher.c index 6000e49..115c85c 100644 --- a/external/loader/source/patcher.c +++ b/external/loader/source/patcher.c @@ -30,7 +30,7 @@ memcmp(const void* buf1, const void* buf2, u32 size) // Quick Search algorithm, adapted from // http://igm.univ-mlv.fr/~lecroq/string/node19.html#SECTION00190 static u8* -memsearch(u8* startPos, const void* pattern, u32 size, u32 patternSize) +memfind(u8* startPos, u32 size, const void* pattern, u32 patternSize) { const u8* patternc = (const u8*)pattern; @@ -61,7 +61,7 @@ patchMemory(u8* start, u32 size, const void* pattern, u32 patSize, int offset, u32 i; for (i = 0; i < count; i++) { - u8* found = memsearch(start, pattern, size, patSize); + u8* found = memfind(start, size, pattern, patSize); if (found == NULL) break; @@ -423,8 +423,8 @@ adjust_cpu_settings(u64 progId, u8* code, u32 size) static const u8 cfgN3dsCpuPattern[] = { 0x00, 0x40, 0xA0, 0xE1, 0x07, 0x00 }; - u32* cfgN3dsCpuLoc = (u32*)memsearch(code, cfgN3dsCpuPattern, size, - sizeof(cfgN3dsCpuPattern)); + u32* cfgN3dsCpuLoc = (u32*)memfind(code, size, cfgN3dsCpuPattern, + sizeof(cfgN3dsCpuPattern)); // Patch N3DS CPU Clock and L2 cache setting if (cfgN3dsCpuLoc != NULL) { diff --git a/external/loader/source/patcher.h b/external/loader/source/patcher.h index 2823d47..085dc7b 100644 --- a/external/loader/source/patcher.h +++ b/external/loader/source/patcher.h @@ -1,4 +1,5 @@ -#pragma once +#ifndef __PATCHER_H +#define __PATCHER_H #include <3ds/types.h> @@ -16,3 +17,5 @@ u32 patchMemory(u8* start, u32 size, const void* pattern, u32 patSize, int offset, const void* replace, u32 repSize, u32 count); u8 get_cpumode(u64 progId); + +#endif diff --git a/external/loader/source/pxipm.h b/external/loader/source/pxipm.h index 03f48b1..002eeae 100644 --- a/external/loader/source/pxipm.h +++ b/external/loader/source/pxipm.h @@ -1,4 +1,5 @@ -#pragma once +#ifndef __PXIPM_H +#define __PXIPM_H #include <3ds/types.h> #include "exheader.h" @@ -9,3 +10,5 @@ Result PXIPM_RegisterProgram(u64* prog_handle, FS_ProgramInfo* title, FS_ProgramInfo* update); Result PXIPM_GetProgramInfo(exheader_header* exheader, u64 prog_handle); Result PXIPM_UnregisterProgram(u64 prog_handle); + +#endif diff --git a/external/loader/source/srvsys.h b/external/loader/source/srvsys.h index 29a20fb..ace5bf9 100644 --- a/external/loader/source/srvsys.h +++ b/external/loader/source/srvsys.h @@ -2,7 +2,8 @@ * @file srv.h * @brief Service API. */ -#pragma once +#ifndef __SRVSYS_H +#define __SRVSYS_H /// Initializes the service API. Result srvSysInit(void); @@ -47,3 +48,5 @@ Result srvSysRegisterService(Handle* out, const char* name, int maxSessions); * @param name Name of the service. */ Result srvSysUnregisterService(const char* name); + +#endif diff --git a/source/i2c.h b/source/i2c.h index 6aaceac..0b289f1 100644 --- a/source/i2c.h +++ b/source/i2c.h @@ -1,4 +1,5 @@ -#pragma once +#ifndef __I2C_H +#define __I2C_H #include "common.h" @@ -34,3 +35,5 @@ int i2cWriteRegister(uint8_t dev_id, uint8_t reg, uint8_t data); int i2cReadRegisterBuffer(unsigned int dev_id, int reg, uint8_t* buffer, size_t buf_size); + +#endif diff --git a/source/input.h b/source/input.h index bdbd9e3..28d3cc4 100644 --- a/source/input.h +++ b/source/input.h @@ -1,3 +1,6 @@ +#ifndef __INPUT_H +#define __INPUT_H + #define BUTTON_A (1 << 0) #define BUTTON_B (1 << 1) #define BUTTON_SEL (1 << 2) @@ -16,3 +19,5 @@ #define BUTTON_ANY 0xFFF #define HID_PAD ((*(volatile uint32_t*)0x10146000) ^ BUTTON_ANY) + +#endif diff --git a/source/patcher.h b/source/patcher.h index 0858829..6dae47c 100644 --- a/source/patcher.h +++ b/source/patcher.h @@ -1,5 +1,5 @@ -#ifndef __PATCHER__ -#define __PATCHER__ +#ifndef __PATCHER_H +#define __PATCHER_H int patch_firm_all(); diff --git a/source/std/memory.c b/source/std/memory.c index f829b36..d99292b 100644 --- a/source/std/memory.c +++ b/source/std/memory.c @@ -170,7 +170,8 @@ atoi(const char* str) // Quick Search algorithm, adapted from // http://igm.univ-mlv.fr/~lecroq/string/node19.html#SECTION00190 uint8_t* -memfind(uint8_t* startPos, uint32_t size, const void* pattern, uint32_t patternSize) +memfind(uint8_t* startPos, uint32_t size, const void* pattern, + uint32_t patternSize) { const uint8_t* patternc = (const uint8_t*)pattern; @@ -193,4 +194,3 @@ memfind(uint8_t* startPos, uint32_t size, const void* pattern, uint32_t patternS return NULL; } - diff --git a/source/std/memory.h b/source/std/memory.h index 44e59ae..73cdab8 100644 --- a/source/std/memory.h +++ b/source/std/memory.h @@ -12,8 +12,8 @@ int memcmp(const void* buf1, const void* buf2, const size_t size); void strncpy(void* dest, const void* src, const size_t size); int strncmp(const void* buf1, const void* buf2, const size_t size); int atoi(const char* str); -uint8_t* memfind(uint8_t* startPos, uint32_t size, - const void* pattern, uint32_t patternSize); +uint8_t* memfind(uint8_t* startPos, uint32_t size, const void* pattern, + uint32_t patternSize); int isprint(char c); #endif