-#pragma once
+#ifndef __EXHEADER_H
+#define __EXHEADER_H
#include <3ds/types.h>
exheader_arm9accesscontrol arm9accesscontrol;
} PACKED accessdesc;
} PACKED exheader_header;
+
+#endif
-#pragma once
+#ifndef __FSLDR_H
+#define __FSLDR_H
#include <3ds/types.h>
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
-#pragma once
+#ifndef __FSREG_H
+#define __FSREG_H
#include <3ds/types.h>
#include "exheader.h"
Result FSREG_Unregister(u32 pid);
Result FSREG_Register(u32 pid, u64 prog_handle, FS_ProgramInfo* info,
void* storageinfo);
+
+#endif
-#pragma once
+#ifndef __IFILE_H
+#define __IFILE_H
#include <3ds/types.h>
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
-#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
-#pragma once
+#ifndef __LZSS_H
+#define __LZSS_H
int lzss_decompress(u8* buffer);
+
+#endif
-#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);
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
// 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;
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;
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) {
-#pragma once
+#ifndef __PATCHER_H
+#define __PATCHER_H
#include <3ds/types.h>
int offset, const void* replace, u32 repSize, u32 count);
u8 get_cpumode(u64 progId);
+
+#endif
-#pragma once
+#ifndef __PXIPM_H
+#define __PXIPM_H
#include <3ds/types.h>
#include "exheader.h"
FS_ProgramInfo* update);
Result PXIPM_GetProgramInfo(exheader_header* exheader, u64 prog_handle);
Result PXIPM_UnregisterProgram(u64 prog_handle);
+
+#endif
* @file srv.h
* @brief Service API.
*/
-#pragma once
+#ifndef __SRVSYS_H
+#define __SRVSYS_H
/// Initializes the service API.
Result srvSysInit(void);
* @param name Name of the service.
*/
Result srvSysUnregisterService(const char* name);
+
+#endif
-#pragma once
+#ifndef __I2C_H
+#define __I2C_H
#include "common.h"
int i2cReadRegisterBuffer(unsigned int dev_id, int reg, uint8_t* buffer,
size_t buf_size);
+
+#endif
+#ifndef __INPUT_H
+#define __INPUT_H
+
#define BUTTON_A (1 << 0)
#define BUTTON_B (1 << 1)
#define BUTTON_SEL (1 << 2)
#define BUTTON_ANY 0xFFF
#define HID_PAD ((*(volatile uint32_t*)0x10146000) ^ BUTTON_ANY)
+
+#endif
-#ifndef __PATCHER__
-#define __PATCHER__
+#ifndef __PATCHER_H
+#define __PATCHER_H
int patch_firm_all();
// 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;
return NULL;
}
-
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