From 9468582d833cb66649ba94a00947940d9047463e Mon Sep 17 00:00:00 2001 From: Aurora Date: Fri, 11 Mar 2016 15:08:05 +0100 Subject: [PATCH] Clean-up, fixed mistake GCC, why no u warn me of strict aliasing --- loader/Makefile | 2 +- loader/source/fatfs/option/syscall.c | 151 --------------------------- loader/source/fatfs/sdmmc/common.h | 18 ++-- loader/source/fatfs/sdmmc/delay.s | 13 +-- loader/source/fatfs/sdmmc/sdmmc.c | 2 +- loader/source/fatfs/sdmmc/sdmmc.h | 3 +- loader/source/main.c | 6 +- source/crypto.h | 7 +- source/draw.h | 7 +- source/emunand.h | 7 +- source/fatfs/option/syscall.c | 151 --------------------------- source/fatfs/sdmmc/common.h | 13 +-- source/fatfs/sdmmc/delay.s | 13 +-- source/fatfs/sdmmc/sdmmc.c | 2 +- source/fatfs/sdmmc/sdmmc.h | 3 +- source/firm.c | 30 +++--- source/firm.h | 25 ++++- source/fs.h | 7 +- source/loader.h | 7 +- source/memory.h | 7 +- source/patches.h | 7 +- source/types.h | 31 +----- 22 files changed, 78 insertions(+), 434 deletions(-) delete mode 100644 loader/source/fatfs/option/syscall.c delete mode 100644 source/fatfs/option/syscall.c diff --git a/loader/Makefile b/loader/Makefile index f12c376..d772e42 100644 --- a/loader/Makefile +++ b/loader/Makefile @@ -33,7 +33,7 @@ ARCH := -mthumb -mthumb-interwork CFLAGS := -g -Wall -O2\ -march=armv5te -mtune=arm946e-s -fomit-frame-pointer\ - -ffast-math -std=c99\ + -ffast-math -Wno-main -std=c99\ $(ARCH) CFLAGS += $(INCLUDE) -DARM9 diff --git a/loader/source/fatfs/option/syscall.c b/loader/source/fatfs/option/syscall.c deleted file mode 100644 index 8e25898..0000000 --- a/loader/source/fatfs/option/syscall.c +++ /dev/null @@ -1,151 +0,0 @@ -/*------------------------------------------------------------------------*/ -/* Sample code of OS dependent controls for FatFs */ -/* (C)ChaN, 2014 */ -/*------------------------------------------------------------------------*/ - - -#include "../ff.h" - - -#if _FS_REENTRANT -/*------------------------------------------------------------------------*/ -/* Create a Synchronization Object */ -/*------------------------------------------------------------------------*/ -/* This function is called in f_mount() function to create a new -/ synchronization object, such as semaphore and mutex. When a 0 is returned, -/ the f_mount() function fails with FR_INT_ERR. -*/ - -int ff_cre_syncobj ( /* !=0:Function succeeded, ==0:Could not create due to any error */ - BYTE vol, /* Corresponding logical drive being processed */ - _SYNC_t *sobj /* Pointer to return the created sync object */ -) -{ - int ret; - - - *sobj = CreateMutex(NULL, FALSE, NULL); /* Win32 */ - ret = (int)(*sobj != INVALID_HANDLE_VALUE); - -// *sobj = SyncObjects[vol]; /* uITRON (give a static created sync object) */ -// ret = 1; /* The initial value of the semaphore must be 1. */ - -// *sobj = OSMutexCreate(0, &err); /* uC/OS-II */ -// ret = (int)(err == OS_NO_ERR); - -// *sobj = xSemaphoreCreateMutex(); /* FreeRTOS */ -// ret = (int)(*sobj != NULL); - - return ret; -} - - - -/*------------------------------------------------------------------------*/ -/* Delete a Synchronization Object */ -/*------------------------------------------------------------------------*/ -/* This function is called in f_mount() function to delete a synchronization -/ object that created with ff_cre_syncobj function. When a 0 is returned, -/ the f_mount() function fails with FR_INT_ERR. -*/ - -int ff_del_syncobj ( /* !=0:Function succeeded, ==0:Could not delete due to any error */ - _SYNC_t sobj /* Sync object tied to the logical drive to be deleted */ -) -{ - int ret; - - - ret = CloseHandle(sobj); /* Win32 */ - -// ret = 1; /* uITRON (nothing to do) */ - -// OSMutexDel(sobj, OS_DEL_ALWAYS, &err); /* uC/OS-II */ -// ret = (int)(err == OS_NO_ERR); - -// vSemaphoreDelete(sobj); /* FreeRTOS */ -// ret = 1; - - return ret; -} - - - -/*------------------------------------------------------------------------*/ -/* Request Grant to Access the Volume */ -/*------------------------------------------------------------------------*/ -/* This function is called on entering file functions to lock the volume. -/ When a 0 is returned, the file function fails with FR_TIMEOUT. -*/ - -int ff_req_grant ( /* 1:Got a grant to access the volume, 0:Could not get a grant */ - _SYNC_t sobj /* Sync object to wait */ -) -{ - int ret; - - ret = (int)(WaitForSingleObject(sobj, _FS_TIMEOUT) == WAIT_OBJECT_0); /* Win32 */ - -// ret = (int)(wai_sem(sobj) == E_OK); /* uITRON */ - -// OSMutexPend(sobj, _FS_TIMEOUT, &err)); /* uC/OS-II */ -// ret = (int)(err == OS_NO_ERR); - -// ret = (int)(xSemaphoreTake(sobj, _FS_TIMEOUT) == pdTRUE); /* FreeRTOS */ - - return ret; -} - - - -/*------------------------------------------------------------------------*/ -/* Release Grant to Access the Volume */ -/*------------------------------------------------------------------------*/ -/* This function is called on leaving file functions to unlock the volume. -*/ - -void ff_rel_grant ( - _SYNC_t sobj /* Sync object to be signaled */ -) -{ - ReleaseMutex(sobj); /* Win32 */ - -// sig_sem(sobj); /* uITRON */ - -// OSMutexPost(sobj); /* uC/OS-II */ - -// xSemaphoreGive(sobj); /* FreeRTOS */ -} - -#endif - - - - -#if _USE_LFN == 3 /* LFN with a working buffer on the heap */ -/*------------------------------------------------------------------------*/ -/* Allocate a memory block */ -/*------------------------------------------------------------------------*/ -/* If a NULL is returned, the file function fails with FR_NOT_ENOUGH_CORE. -*/ - -void* ff_memalloc ( /* Returns pointer to the allocated memory block */ - UINT msize /* Number of bytes to allocate */ -) -{ - return malloc(msize); /* Allocate a new memory block with POSIX API */ -} - - -/*------------------------------------------------------------------------*/ -/* Free a memory block */ -/*------------------------------------------------------------------------*/ - -void ff_memfree ( - void* mblock /* Pointer to the memory block to free */ -) -{ - free(mblock); /* Discard the memory block with POSIX API */ -} - -#endif diff --git a/loader/source/fatfs/sdmmc/common.h b/loader/source/fatfs/sdmmc/common.h index b4ab486..64cf632 100644 --- a/loader/source/fatfs/sdmmc/common.h +++ b/loader/source/fatfs/sdmmc/common.h @@ -4,12 +4,12 @@ #include #include -#define u8 uint8_t -#define u16 uint16_t -#define u32 uint32_t -#define u64 uint64_t - -#define vu8 volatile u8 -#define vu16 volatile u16 -#define vu32 volatile u32 -#define vu64 volatile u64 +//Common data types +typedef uint8_t u8; +typedef uint16_t u16; +typedef uint32_t u32; +typedef uint64_t u64; +typedef volatile u8 vu8; +typedef volatile u16 vu16; +typedef volatile u32 vu32; +typedef volatile u64 vu64; \ No newline at end of file diff --git a/loader/source/fatfs/sdmmc/delay.s b/loader/source/fatfs/sdmmc/delay.s index 3a2cfdf..5386fd8 100644 --- a/loader/source/fatfs/sdmmc/delay.s +++ b/loader/source/fatfs/sdmmc/delay.s @@ -4,12 +4,7 @@ @waitcycles ( u32 us ) waitcycles: - PUSH {R0-R2,LR} - STR R0, [SP,#4] - waitcycles_loop: - LDR R3, [SP,#4] - SUBS R2, R3, #1 - STR R2, [SP,#4] - CMP R3, #0 - BNE waitcycles_loop - POP {R0-R2,PC} + waitcycles_loop: + subs r0, #1 + bgt waitcycles_loop + bx lr diff --git a/loader/source/fatfs/sdmmc/sdmmc.c b/loader/source/fatfs/sdmmc/sdmmc.c index 2ca9952..6d12848 100644 --- a/loader/source/fatfs/sdmmc/sdmmc.c +++ b/loader/source/fatfs/sdmmc/sdmmc.c @@ -337,7 +337,7 @@ static int SD_Init() { inittarget(&handleSD); - waitcycles(1u << 19); //Card needs a little bit of time to be detected, it seems + waitcycles(1u << 18); //Card needs a little bit of time to be detected, it seems //If not inserted if (!(*((vu16*)0x1000601c) & TMIO_STAT0_SIGSTATE)) return -1; diff --git a/loader/source/fatfs/sdmmc/sdmmc.h b/loader/source/fatfs/sdmmc/sdmmc.h index 66cee62..c501414 100644 --- a/loader/source/fatfs/sdmmc/sdmmc.h +++ b/loader/source/fatfs/sdmmc/sdmmc.h @@ -124,5 +124,4 @@ u32 sdmmc_sdcard_writesectors(u32 sector_no, u32 numsectors, vu8 *in); mmcdevice *getMMCDevice(int drive); u32 sdmmc_nand_readsectors(u32 sector_no, u32 numsectors, vu8 *out); -u32 sdmmc_nand_writesectors(u32 sector_no, u32 numsectors, vu8 *in); - +u32 sdmmc_nand_writesectors(u32 sector_no, u32 numsectors, vu8 *in); \ No newline at end of file diff --git a/loader/source/main.c b/loader/source/main.c index f82e4ca..b3ddb9b 100644 --- a/loader/source/main.c +++ b/loader/source/main.c @@ -2,7 +2,7 @@ #define PAYLOAD_ADDRESS 0x23F00000 -int main() +void main() { FATFS fs; FIL payload; @@ -14,6 +14,4 @@ int main() f_read(&payload, (void *)PAYLOAD_ADDRESS, f_size(&payload), &br); ((void (*)())PAYLOAD_ADDRESS)(); } - - return 1; -} +} \ No newline at end of file diff --git a/source/crypto.h b/source/crypto.h index b18c0fc..cd671a6 100755 --- a/source/crypto.h +++ b/source/crypto.h @@ -1,7 +1,6 @@ // From http://github.com/b1l1s/ctr -#ifndef CRYPTO_INC -#define CRYPTO_INC +#pragma once #include "types.h" @@ -51,6 +50,4 @@ //NAND/FIRM stuff void nandFirm0(u8 *outbuf, u32 size, u32 console); void decArm9Bin(u8 *armHdr, u32 mode); -void setKeyXs(u8 *armHdr); - -#endif \ No newline at end of file +void setKeyXs(u8 *armHdr); \ No newline at end of file diff --git a/source/draw.h b/source/draw.h index 862a5f3..6ada547 100644 --- a/source/draw.h +++ b/source/draw.h @@ -4,12 +4,9 @@ * Copyright (c) 2015 All Rights Reserved */ -#ifndef DRAW_INC -#define DRAW_INC +#pragma once #include "types.h" void loadSplash(void); -void __attribute__((naked)) shutdownLCD(void); - -#endif \ No newline at end of file +void __attribute__((naked)) shutdownLCD(void); \ No newline at end of file diff --git a/source/emunand.h b/source/emunand.h index 3b93ddc..1fbb2fb 100644 --- a/source/emunand.h +++ b/source/emunand.h @@ -4,8 +4,7 @@ * Copyright (c) 2015 All Rights Reserved */ -#ifndef EMUNAND_INC -#define EMUNAND_INC +#pragma once #include "types.h" @@ -14,6 +13,4 @@ void getEmunandSect(u32 *off, u32 *head); void getSDMMC(void *pos, u32 *off, u32 size); void getEmuRW(void *pos, u32 size, u32 *readOff, u32 *writeOff); -void getMPU(void *pos, u32 *off, u32 size); - -#endif \ No newline at end of file +void getMPU(void *pos, u32 *off, u32 size); \ No newline at end of file diff --git a/source/fatfs/option/syscall.c b/source/fatfs/option/syscall.c deleted file mode 100644 index 8e25898..0000000 --- a/source/fatfs/option/syscall.c +++ /dev/null @@ -1,151 +0,0 @@ -/*------------------------------------------------------------------------*/ -/* Sample code of OS dependent controls for FatFs */ -/* (C)ChaN, 2014 */ -/*------------------------------------------------------------------------*/ - - -#include "../ff.h" - - -#if _FS_REENTRANT -/*------------------------------------------------------------------------*/ -/* Create a Synchronization Object */ -/*------------------------------------------------------------------------*/ -/* This function is called in f_mount() function to create a new -/ synchronization object, such as semaphore and mutex. When a 0 is returned, -/ the f_mount() function fails with FR_INT_ERR. -*/ - -int ff_cre_syncobj ( /* !=0:Function succeeded, ==0:Could not create due to any error */ - BYTE vol, /* Corresponding logical drive being processed */ - _SYNC_t *sobj /* Pointer to return the created sync object */ -) -{ - int ret; - - - *sobj = CreateMutex(NULL, FALSE, NULL); /* Win32 */ - ret = (int)(*sobj != INVALID_HANDLE_VALUE); - -// *sobj = SyncObjects[vol]; /* uITRON (give a static created sync object) */ -// ret = 1; /* The initial value of the semaphore must be 1. */ - -// *sobj = OSMutexCreate(0, &err); /* uC/OS-II */ -// ret = (int)(err == OS_NO_ERR); - -// *sobj = xSemaphoreCreateMutex(); /* FreeRTOS */ -// ret = (int)(*sobj != NULL); - - return ret; -} - - - -/*------------------------------------------------------------------------*/ -/* Delete a Synchronization Object */ -/*------------------------------------------------------------------------*/ -/* This function is called in f_mount() function to delete a synchronization -/ object that created with ff_cre_syncobj function. When a 0 is returned, -/ the f_mount() function fails with FR_INT_ERR. -*/ - -int ff_del_syncobj ( /* !=0:Function succeeded, ==0:Could not delete due to any error */ - _SYNC_t sobj /* Sync object tied to the logical drive to be deleted */ -) -{ - int ret; - - - ret = CloseHandle(sobj); /* Win32 */ - -// ret = 1; /* uITRON (nothing to do) */ - -// OSMutexDel(sobj, OS_DEL_ALWAYS, &err); /* uC/OS-II */ -// ret = (int)(err == OS_NO_ERR); - -// vSemaphoreDelete(sobj); /* FreeRTOS */ -// ret = 1; - - return ret; -} - - - -/*------------------------------------------------------------------------*/ -/* Request Grant to Access the Volume */ -/*------------------------------------------------------------------------*/ -/* This function is called on entering file functions to lock the volume. -/ When a 0 is returned, the file function fails with FR_TIMEOUT. -*/ - -int ff_req_grant ( /* 1:Got a grant to access the volume, 0:Could not get a grant */ - _SYNC_t sobj /* Sync object to wait */ -) -{ - int ret; - - ret = (int)(WaitForSingleObject(sobj, _FS_TIMEOUT) == WAIT_OBJECT_0); /* Win32 */ - -// ret = (int)(wai_sem(sobj) == E_OK); /* uITRON */ - -// OSMutexPend(sobj, _FS_TIMEOUT, &err)); /* uC/OS-II */ -// ret = (int)(err == OS_NO_ERR); - -// ret = (int)(xSemaphoreTake(sobj, _FS_TIMEOUT) == pdTRUE); /* FreeRTOS */ - - return ret; -} - - - -/*------------------------------------------------------------------------*/ -/* Release Grant to Access the Volume */ -/*------------------------------------------------------------------------*/ -/* This function is called on leaving file functions to unlock the volume. -*/ - -void ff_rel_grant ( - _SYNC_t sobj /* Sync object to be signaled */ -) -{ - ReleaseMutex(sobj); /* Win32 */ - -// sig_sem(sobj); /* uITRON */ - -// OSMutexPost(sobj); /* uC/OS-II */ - -// xSemaphoreGive(sobj); /* FreeRTOS */ -} - -#endif - - - - -#if _USE_LFN == 3 /* LFN with a working buffer on the heap */ -/*------------------------------------------------------------------------*/ -/* Allocate a memory block */ -/*------------------------------------------------------------------------*/ -/* If a NULL is returned, the file function fails with FR_NOT_ENOUGH_CORE. -*/ - -void* ff_memalloc ( /* Returns pointer to the allocated memory block */ - UINT msize /* Number of bytes to allocate */ -) -{ - return malloc(msize); /* Allocate a new memory block with POSIX API */ -} - - -/*------------------------------------------------------------------------*/ -/* Free a memory block */ -/*------------------------------------------------------------------------*/ - -void ff_memfree ( - void* mblock /* Pointer to the memory block to free */ -) -{ - free(mblock); /* Discard the memory block with POSIX API */ -} - -#endif diff --git a/source/fatfs/sdmmc/common.h b/source/fatfs/sdmmc/common.h index b4ab486..90a327e 100644 --- a/source/fatfs/sdmmc/common.h +++ b/source/fatfs/sdmmc/common.h @@ -1,15 +1,4 @@ #pragma once -#include -#include #include - -#define u8 uint8_t -#define u16 uint16_t -#define u32 uint32_t -#define u64 uint64_t - -#define vu8 volatile u8 -#define vu16 volatile u16 -#define vu32 volatile u32 -#define vu64 volatile u64 +#include "../../types.h" \ No newline at end of file diff --git a/source/fatfs/sdmmc/delay.s b/source/fatfs/sdmmc/delay.s index 3a2cfdf..5386fd8 100644 --- a/source/fatfs/sdmmc/delay.s +++ b/source/fatfs/sdmmc/delay.s @@ -4,12 +4,7 @@ @waitcycles ( u32 us ) waitcycles: - PUSH {R0-R2,LR} - STR R0, [SP,#4] - waitcycles_loop: - LDR R3, [SP,#4] - SUBS R2, R3, #1 - STR R2, [SP,#4] - CMP R3, #0 - BNE waitcycles_loop - POP {R0-R2,PC} + waitcycles_loop: + subs r0, #1 + bgt waitcycles_loop + bx lr diff --git a/source/fatfs/sdmmc/sdmmc.c b/source/fatfs/sdmmc/sdmmc.c index 2ca9952..6d12848 100644 --- a/source/fatfs/sdmmc/sdmmc.c +++ b/source/fatfs/sdmmc/sdmmc.c @@ -337,7 +337,7 @@ static int SD_Init() { inittarget(&handleSD); - waitcycles(1u << 19); //Card needs a little bit of time to be detected, it seems + waitcycles(1u << 18); //Card needs a little bit of time to be detected, it seems //If not inserted if (!(*((vu16*)0x1000601c) & TMIO_STAT0_SIGSTATE)) return -1; diff --git a/source/fatfs/sdmmc/sdmmc.h b/source/fatfs/sdmmc/sdmmc.h index 66cee62..c501414 100644 --- a/source/fatfs/sdmmc/sdmmc.h +++ b/source/fatfs/sdmmc/sdmmc.h @@ -124,5 +124,4 @@ u32 sdmmc_sdcard_writesectors(u32 sector_no, u32 numsectors, vu8 *in); mmcdevice *getMMCDevice(int drive); u32 sdmmc_nand_readsectors(u32 sector_no, u32 numsectors, vu8 *out); -u32 sdmmc_nand_writesectors(u32 sector_no, u32 numsectors, vu8 *in); - +u32 sdmmc_nand_writesectors(u32 sector_no, u32 numsectors, vu8 *in); \ No newline at end of file diff --git a/source/firm.c b/source/firm.c index 9477153..66ee511 100755 --- a/source/firm.c +++ b/source/firm.c @@ -28,7 +28,7 @@ static const char *firmPathPatched = NULL; void setupCFW(void){ //Determine if booting with A9LH via PDN_SPI_CNT - u8 a9lhBoot = (*(u8 *)0x101401C0 == 0x0) ? 1 : 0; + u32 a9lhBoot = (*(u8 *)0x101401C0 == 0x0) ? 1 : 0; //Retrieve the last booted FIRM via CFG_BOOTENV u8 previousFirm = *(u8 *)0x10010000; u32 overrideConfig = 0; @@ -135,11 +135,11 @@ static u32 loadEmu(void){ u32 emuOffset = 0, emuHeader = 0, - emuRead = 0, - emuWrite = 0, - sdmmcOffset = 0, - mpuOffset = 0, - emuCodeOffset = 0; + emuRead, + emuWrite, + sdmmcOffset, + mpuOffset, + emuCodeOffset; //Read emunand code from SD const char path[] = "/rei/emunand/emunand.bin"; @@ -197,23 +197,21 @@ u32 patchFirm(void){ } //Disable signature checks - u32 sigOffset = 0, - sigOffset2 = 0; + u32 sigOffset, + sigOffset2; getSignatures(firmLocation, firmSize, &sigOffset, &sigOffset2); memcpy((void *)sigOffset, sigPat1, sizeof(sigPat1)); memcpy((void *)sigOffset2, sigPat2, sizeof(sigPat2)); //Patch ARM9 entrypoint on N3DS to skip arm9loader - if(console){ - u32 *arm9 = (u32 *)&firmLocation->arm9Entry; - *arm9 = 0x801B01C; - } + if(console) + firmLocation->arm9Entry = (u8 *)0x801B01C; //Patch FIRM reboots, not on 9.0 FIRM as it breaks firmlaunchhax if(mode){ - u32 rebootOffset = 0, - fOpenOffset = 0; + u32 rebootOffset, + fOpenOffset; //Read reboot code from SD const char path[] = "/rei/reboot/reboot.bin"; @@ -254,10 +252,10 @@ void launchFirm(void){ vu32 *const arm11 = (u32 *)0x1FFFFFF8; *arm11 = (u32)shutdownLCD; while(*arm11); - + //Set ARM11 kernel *arm11 = (u32)firmLocation->arm11Entry; - + //Final jump to arm9 binary ((void (*)())firmLocation->arm9Entry)(); } \ No newline at end of file diff --git a/source/firm.h b/source/firm.h index 00273d3..38f37c9 100644 --- a/source/firm.h +++ b/source/firm.h @@ -4,8 +4,7 @@ * Copyright (c) 2015 All Rights Reserved */ -#ifndef FIRM_INC -#define FIRM_INC +#pragma once #include "types.h" @@ -17,9 +16,25 @@ #define BUTTON_A 1 #define SAFEMODE (BUTTON_L1R1 | BUTTON_A | (1 << 6)) +//FIRM Header layout +typedef struct firmSectionHeader { + u32 offset; + u8 *address; + u32 size; + u32 procType; + u8 hash[0x20]; +} firmSectionHeader; + +typedef struct firmHeader { + u32 magic; + u32 reserved1; + u8 *arm11Entry; + u8 *arm9Entry; + u8 reserved2[0x30]; + firmSectionHeader section[4]; +} firmHeader; + void setupCFW(void); u32 loadFirm(void); u32 patchFirm(void); -void launchFirm(void); - -#endif \ No newline at end of file +void launchFirm(void); \ No newline at end of file diff --git a/source/fs.h b/source/fs.h index 302b75a..9dc4636 100644 --- a/source/fs.h +++ b/source/fs.h @@ -2,8 +2,7 @@ * fs.h */ -#ifndef FS_INC -#define FS_INC +#pragma once #include "types.h" @@ -11,6 +10,4 @@ u32 mountSD(void); u32 fileRead(u8 *dest, const char *path, u32 size); u32 fileWrite(const u8 *buffer, const char *path, u32 size); u32 fileSize(const char *path); -u32 fileExists(const char *path); - -#endif \ No newline at end of file +u32 fileExists(const char *path); \ No newline at end of file diff --git a/source/loader.h b/source/loader.h index 150b27a..300de99 100644 --- a/source/loader.h +++ b/source/loader.h @@ -2,11 +2,8 @@ * loader.h */ -#ifndef LOADER_INC -#define LOADER_INC +#pragma once #include "types.h" -void loadPayload(void); - -#endif \ No newline at end of file +void loadPayload(void); \ No newline at end of file diff --git a/source/memory.h b/source/memory.h index 63686a6..c3d3767 100644 --- a/source/memory.h +++ b/source/memory.h @@ -4,14 +4,11 @@ * Copyright (c) 2015 All Rights Reserved */ -#ifndef MEMORY_INC -#define MEMORY_INC +#pragma once #include "types.h" void memcpy(void *dest, const void *src, u32 size); void memset(void *dest, int filler, u32 size); int memcmp(const void *buf1, const void *buf2, u32 size); -void *memsearch(void *start_pos, const void *search, u32 size, u32 size_search); - -#endif \ No newline at end of file +void *memsearch(void *start_pos, const void *search, u32 size, u32 size_search); \ No newline at end of file diff --git a/source/patches.h b/source/patches.h index 879a3bf..fb7d0e4 100644 --- a/source/patches.h +++ b/source/patches.h @@ -4,8 +4,7 @@ * Copyright (c) 2015 All Rights Reserved */ -#ifndef PATCHES_INC -#define PATCHES_INC +#pragma once #include "types.h" @@ -25,6 +24,4 @@ const u8 emuInstr[5]; void getSignatures(void *pos, u32 size, u32 *off, u32 *off2); void getReboot(void *pos, u32 size, u32 *off); void getfOpen(void *pos, u32 size, u32 *off); -void getFIRMWrite(void *pos, u32 size, u32 *off); - -#endif \ No newline at end of file +void getFIRMWrite(void *pos, u32 size, u32 *off); \ No newline at end of file diff --git a/source/types.h b/source/types.h index 5f4f982..56d82bb 100644 --- a/source/types.h +++ b/source/types.h @@ -4,8 +4,7 @@ * Copyright (c) 2015 All Rights Reserved */ -#ifndef TYPES_INC -#define TYPES_INC +#pragma once #include #include @@ -15,27 +14,7 @@ typedef uint8_t u8; typedef uint16_t u16; typedef uint32_t u32; typedef uint64_t u64; -typedef volatile uint8_t vu8; -typedef volatile uint16_t vu16; -typedef volatile uint32_t vu32; -typedef volatile uint64_t vu64; - -//FIRM Header layout -typedef struct firmSectionHeader { - u32 offset; - u8 *address; - u32 size; - u32 procType; - u8 hash[0x20]; -} firmSectionHeader; - -typedef struct firmHeader { - u32 magic; - u32 reserved1; - u8 *arm11Entry; - u8 *arm9Entry; - u8 reserved2[0x30]; - firmSectionHeader section[4]; -} firmHeader; - -#endif \ No newline at end of file +typedef volatile u8 vu8; +typedef volatile u16 vu16; +typedef volatile u32 vu32; +typedef volatile u64 vu64; \ No newline at end of file