]> Chaos Git - corbenik/corbenik.git/commitdiff
Go away, #pragma once
authorchaoskagami <chaos.kagami@gmail.com>
Tue, 24 May 2016 02:11:20 +0000 (22:11 -0400)
committerchaoskagami <chaos.kagami@gmail.com>
Tue, 24 May 2016 02:11:20 +0000 (22:11 -0400)
16 files changed:
external/loader/source/exheader.h
external/loader/source/fsldr.h
external/loader/source/fsreg.h
external/loader/source/ifile.h
external/loader/source/internal.h
external/loader/source/lzss.h
external/loader/source/patch/patch.h
external/loader/source/patcher.c
external/loader/source/patcher.h
external/loader/source/pxipm.h
external/loader/source/srvsys.h
source/i2c.h
source/input.h
source/patcher.h
source/std/memory.c
source/std/memory.h

index 394f35181c07c8516024918809a2fdc843ebabeb..2892ecb0937619f2c758f7b14b1072ac01048169 100644 (file)
@@ -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
index 8dfcdd1e7d952dbc62766e391108a2940ccfbd63..f3d403f0e1254fd3ae1bd901cd9f1e1add6ccd24 100644 (file)
@@ -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
index c7f56bb3943a69769bf53de5b5d292c50190b1fb..ad1dff4b896611ffb9ec4cfb744e715d69361ffe 100644 (file)
@@ -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
index 8c15e21cb024992788ebb4eef4367ca0f9bb57d5..5cda305df61b68c5a9e322642287a6977e72c932 100644 (file)
@@ -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
index 3ea12dafda01b42953b3ce828683596f18d4c9be..f41080477ea8c0f1a3a5e368ecf6468de8f6933f 100644 (file)
@@ -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
index 7d71ba4f6af9a3d12f7b222be8c8d3573a11604b..b4fcb8942cc5098357dd44326e588ddcc0206b0d 100644 (file)
@@ -1,3 +1,6 @@
-#pragma once
+#ifndef __LZSS_H
+#define __LZSS_H
 
 int lzss_decompress(u8* buffer);
+
+#endif
index 2396856297d774d08167fbf1b3ce16939553b971..90d8c2f99c8645efec8d6d0c4a30786e4ed542f7 100644 (file)
@@ -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
index 6000e4983658a3508519fb34f6ef5b16552e53e3..115c85cf18d46189b0baa860b541325068b8e17c 100644 (file)
@@ -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) {
index 2823d476fcb98e1571cadf5474af3e2cec021e90..085dc7bb3a81bb0c82b8b9ace39f725fa09f02cc 100644 (file)
@@ -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
index 03f48b1860c46c523113c9719b582f73ec0d4499..002eeaec5d07cab75f4d411c7be2e77c491d2d1d 100644 (file)
@@ -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
index 29a20fb5d14eef59ea48a1644b632f4ade18c857..ace5bf96bef6d8f8e762b2c9a7e52ccad07f53a7 100644 (file)
@@ -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
index 6aaceacfbeb48168d2b1102edca21bfc4b44c231..0b289f1c48c85601cb39b8c18a7b827d6fec5014 100644 (file)
@@ -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
index bdbd9e3c6e7fe162769aa672af9385ffa8e6be65..28d3cc48d436766037f423ccad8765c831691163 100644 (file)
@@ -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
index 0858829e8ad631c56c247bff02426c8d68dc9129..6dae47cb9516ac71a1a9f6760c5d574cb6311b79 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __PATCHER__
-#define __PATCHER__
+#ifndef __PATCHER_H
+#define __PATCHER_H
 
 int patch_firm_all();
 
index f829b36b6a985630bc2d54ba500eb3cc6b408a06..d99292b8f7d4a30c450de8f69b584f603e44c549 100644 (file)
@@ -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;
 }
-
index 44e59ae36736dfde561df625b07bf29d8a803072..73cdab8a7f6dc5d5441d5ee77c1486d3c4387e38 100644 (file)
@@ -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