diff --git a/Makefile b/Makefile index e229c71..766188f 100644 --- a/Makefile +++ b/Makefile @@ -30,9 +30,8 @@ INCLUDES := source source/common source/font source/fs source/crypto source/fatf #--------------------------------------------------------------------------------- ARCH := -mthumb -mthumb-interwork -flto -CFLAGS := -g -Wall -Wextra -Wpedantic -Wcast-align -pedantic -O2\ - -march=armv5te -mtune=arm946e-s -fomit-frame-pointer\ - -ffast-math -std=c99\ +CFLAGS := -g -Wall -Wextra -Wpedantic -Wcast-align -Wno-misleading-identation -O2\ + -march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math -std=gnu99\ $(ARCH) CFLAGS += $(INCLUDE) -DEXEC_$(EXEC_METHOD) -DARM9 diff --git a/source/fs/filetype.h b/source/fs/filetype.h index bf024bc..2e0e605 100644 --- a/source/fs/filetype.h +++ b/source/fs/filetype.h @@ -2,26 +2,26 @@ #include "common.h" -#define IMG_FAT (1<<0) -#define IMG_NAND (1<<1) -#define GAME_CIA (1<<2) -#define GAME_NCSD (1<<3) -#define GAME_NCCH (1<<4) -#define GAME_TMD (1<<5) -#define GAME_EXEFS (1<<6) -#define GAME_ROMFS (1<<7) -#define GAME_BOSS (1<<8) -#define GAME_NUSCDN (1<<9) -#define GAME_TICKET (1<<10) -#define SYS_FIRM (1<<11) -#define SYS_TICKDB (1<<12) -#define BIN_NCCHNFO (1<<13) -#define BIN_LAUNCH (1<<14) -#define BIN_SUPPORT (1<<15) +#define IMG_FAT (1UL<<0) +#define IMG_NAND (1UL<<1) +#define GAME_CIA (1UL<<2) +#define GAME_NCSD (1UL<<3) +#define GAME_NCCH (1UL<<4) +#define GAME_TMD (1UL<<5) +#define GAME_EXEFS (1UL<<6) +#define GAME_ROMFS (1UL<<7) +#define GAME_BOSS (1UL<<8) +#define GAME_NUSCDN (1UL<<9) +#define GAME_TICKET (1UL<<10) +#define SYS_FIRM (1UL<<11) +#define SYS_TICKDB (1UL<<12) +#define BIN_NCCHNFO (1UL<<13) +#define BIN_LAUNCH (1UL<<14) +#define BIN_SUPPORT (1UL<<15) #define TYPE_BASE 0x00FFFFFF // 24 bit reserved for base types -#define FLAG_NUSCDN (1<<30) -#define FLAG_CXI (1<<31) +#define FLAG_NUSCDN (1UL<<30) +#define FLAG_CXI (1UL<<31) #define FTYPE_MOUNTABLE(tp) (tp&(IMG_FAT|IMG_NAND|GAME_CIA|GAME_NCSD|GAME_NCCH|GAME_EXEFS|GAME_ROMFS|SYS_FIRM|SYS_TICKDB)) #define FYTPE_VERIFICABLE(tp) (tp&(IMG_NAND|GAME_CIA|GAME_NCSD|GAME_NCCH|GAME_TMD|GAME_BOSS|SYS_FIRM)) diff --git a/source/fs/fsdrive.h b/source/fs/fsdrive.h index 82d3364..98ec008 100644 --- a/source/fs/fsdrive.h +++ b/source/fs/fsdrive.h @@ -9,23 +9,23 @@ // primary drive types #define DRV_UNKNOWN (0<<0) -#define DRV_FAT (1<<0) -#define DRV_VIRTUAL (1<<1) +#define DRV_FAT (1UL<<0) +#define DRV_VIRTUAL (1UL<<1) // secondary drive types -#define DRV_SDCARD (1<<2) -#define DRV_SYSNAND (1<<3) -#define DRV_EMUNAND (1<<4) -#define DRV_CTRNAND (1<<5) -#define DRV_TWLNAND (1<<6) -#define DRV_IMAGE (1<<7) -#define DRV_XORPAD (1<<8) -#define DRV_RAMDRIVE (1<<9) -#define DRV_MEMORY (1<<10) -#define DRV_GAME (1<<11) -#define DRV_CART (1<<12) -#define DRV_ALIAS (1<<13) -#define DRV_SEARCH (1<<14) -#define DRV_STDFAT (1<<15) // standard FAT drive without limitations +#define DRV_SDCARD (1UL<<2) +#define DRV_SYSNAND (1UL<<3) +#define DRV_EMUNAND (1UL<<4) +#define DRV_CTRNAND (1UL<<5) +#define DRV_TWLNAND (1UL<<6) +#define DRV_IMAGE (1UL<<7) +#define DRV_XORPAD (1UL<<8) +#define DRV_RAMDRIVE (1UL<<9) +#define DRV_MEMORY (1UL<<10) +#define DRV_GAME (1UL<<11) +#define DRV_CART (1UL<<12) +#define DRV_ALIAS (1UL<<13) +#define DRV_SEARCH (1UL<<14) +#define DRV_STDFAT (1UL<<15) // standard FAT drive without limitations #define FS_DRVNAME \ "SDCARD", \ diff --git a/source/fs/fsperm.h b/source/fs/fsperm.h index 782f291..0c27b0f 100644 --- a/source/fs/fsperm.h +++ b/source/fs/fsperm.h @@ -3,20 +3,20 @@ #include "common.h" // permission types -#define PERM_SDCARD (1<<0) -#define PERM_IMAGE (1<<1) -#define PERM_RAMDRIVE (1<<2) -#define PERM_EMU_LVL0 (1<<3) -#define PERM_EMU_LVL1 (PERM_EMU_LVL0|(1<<4)) -#define PERM_SYS_LVL0 (1<<5) -#define PERM_SYS_LVL1 (PERM_SYS_LVL0|(1<<6)) -#define PERM_SYS_LVL2 (PERM_SYS_LVL1|(1<<7)) -#define PERM_SYS_LVL3 (PERM_SYS_LVL2|(1<<8)) -#define PERM_SDDATA (PERM_SDCARD|(1<<9)) -#define PERM_MEMORY (1<<10) -#define PERM_GAME (1<<11) // can't be enabled, placeholder -#define PERM_XORPAD (1<<12) // can't be enabled, placeholder -#define PERM_CART (1<<13) // can't be enabled, placeholder +#define PERM_SDCARD (1UL<<0) +#define PERM_IMAGE (1UL<<1) +#define PERM_RAMDRIVE (1UL<<2) +#define PERM_EMU_LVL0 (1UL<<3) +#define PERM_EMU_LVL1 (PERM_EMU_LVL0|(1UL<<4)) +#define PERM_SYS_LVL0 (1UL<<5) +#define PERM_SYS_LVL1 (PERM_SYS_LVL0|(1UL<<6)) +#define PERM_SYS_LVL2 (PERM_SYS_LVL1|(1UL<<7)) +#define PERM_SYS_LVL3 (PERM_SYS_LVL2|(1UL<<8)) +#define PERM_SDDATA (PERM_SDCARD|(1UL<<9)) +#define PERM_MEMORY (1UL<<10) +#define PERM_GAME (1UL<<11) // can't be enabled, placeholder +#define PERM_XORPAD (1UL<<12) // can't be enabled, placeholder +#define PERM_CART (1UL<<13) // can't be enabled, placeholder #define PERM_BASE (PERM_SDCARD | PERM_IMAGE | PERM_RAMDRIVE | PERM_EMU_LVL0 | PERM_SYS_LVL0) #ifndef SAFEMODE #define PERM_ALL (PERM_BASE | PERM_SDDATA | PERM_EMU_LVL1 | PERM_SYS_LVL2 | PERM_MEMORY) diff --git a/source/fs/fsutil.c b/source/fs/fsutil.c index 35fe4a8..1201360 100644 --- a/source/fs/fsutil.c +++ b/source/fs/fsutil.c @@ -11,8 +11,8 @@ #include "ff.h" #include "ui.h" -#define SKIP_CUR (1<<3) -#define OVERWRITE_CUR (1<<4) +#define SKIP_CUR (1UL<<3) +#define OVERWRITE_CUR (1UL<<4) // Volume2Partition resolution table PARTITION VolToPart[] = { diff --git a/source/fs/fsutil.h b/source/fs/fsutil.h index 6755a08..8a6257c 100644 --- a/source/fs/fsutil.h +++ b/source/fs/fsutil.h @@ -7,9 +7,9 @@ // #include "fsperm.h" // move / copy flags -#define ASK_ALL (1<<0) -#define SKIP_ALL (1<<1) -#define OVERWRITE_ALL (1<<2) +#define ASK_ALL (1UL<<0) +#define SKIP_ALL (1UL<<1) +#define OVERWRITE_ALL (1UL<<2) /** Return total size of SD card **/ uint64_t GetSDCardSize(); diff --git a/source/nand/nand.h b/source/nand/nand.h index 353c339..3500d8c 100644 --- a/source/nand/nand.h +++ b/source/nand/nand.h @@ -2,13 +2,13 @@ #include "common.h" -#define NAND_SYSNAND (1<<0) -#define NAND_EMUNAND (1<<1) -#define NAND_IMGNAND (1<<2) -#define NAND_ZERONAND (1<<3) -#define NAND_TYPE_O3DS (1<<4) -#define NAND_TYPE_N3DS (1<<5) -#define NAND_TYPE_NO3DS (1<<6) +#define NAND_SYSNAND (1UL<<0) +#define NAND_EMUNAND (1UL<<1) +#define NAND_IMGNAND (1UL<<2) +#define NAND_ZERONAND (1UL<<3) +#define NAND_TYPE_O3DS (1UL<<4) +#define NAND_TYPE_N3DS (1UL<<5) +#define NAND_TYPE_NO3DS (1UL<<6) // minimum size of NAND memory #define NAND_MIN_SECTORS_O3DS 0x1D7800 diff --git a/source/virtual/vcart.c b/source/virtual/vcart.c index f0178a4..530646f 100644 --- a/source/virtual/vcart.c +++ b/source/virtual/vcart.c @@ -2,7 +2,7 @@ #include "gamecart.h" #define FAT_LIMIT 0x100000000 -#define VFLAG_PRIV_HDR (1<<31) +#define VFLAG_PRIV_HDR (1UL<<31) static CartData* cdata = (CartData*) VCART_BUFFER; // 128kB reserved (~64kB required) static bool cart_init = false; diff --git a/source/virtual/vgame.c b/source/virtual/vgame.c index ca15302..359d97b 100644 --- a/source/virtual/vgame.c +++ b/source/virtual/vgame.c @@ -3,16 +3,16 @@ #include "game.h" #include "aes.h" -#define VFLAG_FIRM_SECTION (1<<22) -#define VFLAG_FIRM_ARM9 (1<<23) -#define VFLAG_FIRM (1<<24) -#define VFLAG_EXEFS_FILE (1<<25) -#define VFLAG_EXTHDR (1<<26) -#define VFLAG_CIA (1<<27) -#define VFLAG_NCSD (1<<28) -#define VFLAG_NCCH (1<<29) -#define VFLAG_EXEFS (1<<30) -#define VFLAG_ROMFS (1<<31) +#define VFLAG_FIRM_SECTION (1UL<<22) +#define VFLAG_FIRM_ARM9 (1UL<<23) +#define VFLAG_FIRM (1UL<<24) +#define VFLAG_EXEFS_FILE (1UL<<25) +#define VFLAG_EXTHDR (1UL<<26) +#define VFLAG_CIA (1UL<<27) +#define VFLAG_NCSD (1UL<<28) +#define VFLAG_NCCH (1UL<<29) +#define VFLAG_EXEFS (1UL<<30) +#define VFLAG_ROMFS (1UL<<31) #define VFLAG_GAMEDIR (VFLAG_FIRM|VFLAG_CIA|VFLAG_NCSD|VFLAG_NCCH|VFLAG_EXEFS|VFLAG_ROMFS|VFLAG_LV3) #define NAME_FIRM_HEADER "header.bin" diff --git a/source/virtual/virtual.h b/source/virtual/virtual.h index 9a57f50..31cb7d3 100644 --- a/source/virtual/virtual.h +++ b/source/virtual/virtual.h @@ -8,16 +8,16 @@ #define VRT_EMUNAND NAND_EMUNAND #define VRT_IMGNAND NAND_IMGNAND #define VRT_XORPAD NAND_ZERONAND -#define VRT_MEMORY (1<<10) -#define VRT_GAME (1<<11) -#define VRT_TICKDB (1<<12) -#define VRT_CART (1<<13) +#define VRT_MEMORY (1UL<<10) +#define VRT_GAME (1UL<<11) +#define VRT_TICKDB (1UL<<12) +#define VRT_CART (1UL<<13) #define VRT_SOURCE (VRT_SYSNAND|VRT_EMUNAND|VRT_IMGNAND|VRT_XORPAD|VRT_MEMORY|VRT_GAME|VRT_TICKDB|VRT_CART) -#define VFLAG_DIR (1<<16) -#define VFLAG_ROOT (1<<17) -#define VFLAG_LV3 (1<<18) +#define VFLAG_DIR (1UL<<16) +#define VFLAG_ROOT (1UL<<17) +#define VFLAG_LV3 (1UL<<18) #define VRT_DRIVES {'S', VRT_SYSNAND}, {'E', VRT_EMUNAND}, {'I', VRT_IMGNAND}, {'X', VRT_XORPAD }, \ {'M', VRT_MEMORY}, {'G', VRT_GAME}, {'T', VRT_TICKDB}, {'C', VRT_CART} diff --git a/source/virtual/vmem.c b/source/virtual/vmem.c index 4a56363..80705ee 100644 --- a/source/virtual/vmem.c +++ b/source/virtual/vmem.c @@ -1,7 +1,7 @@ #include "vmem.h" #include "platform.h" -#define VFLAG_N3DS_ONLY (1<<31) +#define VFLAG_N3DS_ONLY (1UL<<31) // see: http://3dbrew.org/wiki/Memory_layout#ARM9 static const VirtualFile vMemFileTemplates[] = { diff --git a/source/virtual/vnand.c b/source/virtual/vnand.c index 62f66e5..658baee 100644 --- a/source/virtual/vnand.c +++ b/source/virtual/vnand.c @@ -7,9 +7,9 @@ #define VFLAG_ON_N3DS NAND_TYPE_N3DS #define VFLAG_ON_NO3DS NAND_TYPE_NO3DS #define VFLAG_ON_NAND (VFLAG_ON_O3DS | VFLAG_ON_N3DS | VFLAG_ON_NO3DS) -#define VFLAG_GBA_VC (1<<29) -#define VFLAG_NEEDS_OTP (1<<30) -#define VFLAG_NAND_SIZE (1<<31) +#define VFLAG_GBA_VC (1UL<<29) +#define VFLAG_NEEDS_OTP (1UL<<30) +#define VFLAG_NAND_SIZE (1UL<<31) // see: http://3dbrew.org/wiki/Flash_Filesystem#NAND_structure // too much hardcoding, but more readable this way diff --git a/source/virtual/vtickdb.c b/source/virtual/vtickdb.c index 0719c40..6f6bd47 100644 --- a/source/virtual/vtickdb.c +++ b/source/virtual/vtickdb.c @@ -2,9 +2,9 @@ #include "image.h" #include "ticket.h" -#define VFLAG_UNKNOWN (1<<29) -#define VFLAG_ESHOP (1<<30) -#define VFLAG_SYSTEM (1<<31) +#define VFLAG_UNKNOWN (1UL<<29) +#define VFLAG_ESHOP (1UL<<30) +#define VFLAG_SYSTEM (1UL<<31) #define VFLAG_TICKDIR (VFLAG_UNKNOWN|VFLAG_ESHOP|VFLAG_SYSTEM) #define NAME_TIK "%02lX.%016llX.%08lX" // index / title id / console id