Skip to content

Commit

Permalink
better hints to reduce compiled size by a few kb
Browse files Browse the repository at this point in the history
mostly just added static const to constant arrays/buffers
  • Loading branch information
Wolfvak committed Jul 23, 2020
1 parent 698ad9d commit 929cc7f
Show file tree
Hide file tree
Showing 26 changed files with 72 additions and 81 deletions.
2 changes: 1 addition & 1 deletion arm11/source/hw/codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

typedef struct {
s16 cpad_x, cpad_y;
s16 ts_x, ts_y;
u16 ts_x, ts_y;
} CODEC_Input;

void CODEC_Init(void);
Expand Down
24 changes: 8 additions & 16 deletions arm11/source/hw/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,16 @@ static u32 HID_ConvertCPAD(s16 cpad_x, s16 cpad_y)
{
u32 ret = 0;

switch(int_sign(cpad_x)) {
default:
break;
case 1:
ret |= BUTTON_RIGHT;
break;
case -1:
ret |= BUTTON_LEFT;
if (cpad_x > 0) {
ret |= BUTTON_RIGHT;
} else if (cpad_x < 0) {
ret |= BUTTON_LEFT;
}

switch(int_sign(cpad_y)) {
default:
break;
case 1:
ret |= BUTTON_UP;
break;
case -1:
ret |= BUTTON_DOWN;
if (cpad_y > 0) {
ret |= BUTTON_UP;
} else if (cpad_y < 0) {
ret |= BUTTON_DOWN;
}

return ret;
Expand Down
4 changes: 3 additions & 1 deletion arm11/source/hw/mcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ typedef struct {
} PACKED_STRUCT MCU_NotificationLED;

static u8 cached_volume_slider = 0;
static u32 spec_hid = 0, shell_state = SHELL_OPEN;
static u32 spec_hid = 0, shell_state = 0;

static void MCU_UpdateVolumeSlider(void)
{
Expand Down Expand Up @@ -189,6 +189,8 @@ void MCU_Init(void)
{
u32 clrpend, mask = 0;

shell_state = SHELL_OPEN;

/* set register mask and clear any pending registers */
MCU_WriteRegBuf(REG_INT_EN, (const u8*)&mask, sizeof(mask));
MCU_ReadRegBuf(REG_INT_MASK, (u8*)&clrpend, sizeof(clrpend));
Expand Down
10 changes: 5 additions & 5 deletions arm11/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ static const u8 brightness_lvls[] = {
0x4D, 0x56, 0x60, 0x6B,
0x79, 0x8C, 0xA7, 0xD2
};
static int prev_bright_lvl = -1;
static bool auto_brightness = true;
static int prev_bright_lvl;
static bool auto_brightness;
#endif

static SystemSHMEM __attribute__((section(".shared"))) SharedMemoryState;
Expand Down Expand Up @@ -180,11 +180,11 @@ void __attribute__((noreturn)) MainLoop(void)
{
#ifdef FIXED_BRIGHTNESS
LCD_SetBrightness(FIXED_BRIGHTNESS);
#else
prev_bright_lvl = -1;
auto_brightness = true;
#endif

// clear up the shared memory section
memset(&SharedMemoryState, 0, sizeof(SharedMemoryState));

// configure interrupts
gicSetInterruptConfig(PXI_RX_INTERRUPT, BIT(0), GIC_PRIO2, GIC_RISINGEDGE_1N, PXI_RX_Handler);
gicSetInterruptConfig(MCU_INTERRUPT, BIT(0), GIC_PRIO1, GIC_RISINGEDGE_1N, MCU_HandleInterrupts);
Expand Down
2 changes: 1 addition & 1 deletion arm9/source/crypto/crc16.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// see: https://github.com/TASVideos/desmume/blob/master/desmume/src/bios.cpp#L1070tions
u16 crc16_quick(const void* src, u32 len) {
const u16 tabval[] = { CRC16_TABVAL };
static const u16 tabval[] = { CRC16_TABVAL };
u16* data = (u16*) src;
u16 crc = 0xFFFF;

Expand Down
2 changes: 1 addition & 1 deletion arm9/source/crypto/keydb.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ u32 CheckRecommendedKeyDb(const char* path)
{
// SHA-256 of the recommended aeskeydb.bin file
// equals MD5 A5B28945A7C051D7A0CD18AF0E580D1B
const u8 recommended_sha[0x20] = {
static const u8 recommended_sha[0x20] = {
0x40, 0x76, 0x54, 0x3D, 0xA3, 0xFF, 0x91, 0x1C, 0xE1, 0xCC, 0x4E, 0xC7, 0x2F, 0x92, 0xE4, 0xB7,
0x2B, 0x24, 0x00, 0x15, 0xBE, 0x9B, 0xFC, 0xDE, 0x7F, 0xED, 0x95, 0x1D, 0xD5, 0xAB, 0x2D, 0xCB
};
Expand Down
14 changes: 7 additions & 7 deletions arm9/source/filesys/filetype.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
#include "ui.h" // only for font file detection

u64 IdentifyFileType(const char* path) {
const u8 romfs_magic[] = { ROMFS_MAGIC };
const u8 diff_magic[] = { DIFF_MAGIC };
const u8 disa_magic[] = { DISA_MAGIC };
const u8 tickdb_magic[] = { TICKDB_MAGIC };
const u8 smdh_magic[] = { SMDH_MAGIC };
const u8 threedsx_magic[] = { THREEDSX_EXT_MAGIC };
const u8 png_magic[] = { PNG_MAGIC };
static const u8 romfs_magic[] = { ROMFS_MAGIC };
static const u8 diff_magic[] = { DIFF_MAGIC };
static const u8 disa_magic[] = { DISA_MAGIC };
static const u8 tickdb_magic[] = { TICKDB_MAGIC };
static const u8 smdh_magic[] = { SMDH_MAGIC };
static const u8 threedsx_magic[] = { THREEDSX_EXT_MAGIC };
static const u8 png_magic[] = { PNG_MAGIC };

if (!path) return 0; // safety
u8 ALIGN(32) header[0x2C0]; // minimum required size
Expand Down
6 changes: 3 additions & 3 deletions arm9/source/filesys/fsperm.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ bool CheckWritePermissions(const char* path) {

// check drive type, get permission type
if (drvtype & DRV_SYSNAND) {
u32 perms[] = { PERM_SYS_LVL0, PERM_SYS_LVL1, PERM_SYS_LVL2, PERM_SYS_LVL3 };
static const u32 perms[] = { PERM_SYS_LVL0, PERM_SYS_LVL1, PERM_SYS_LVL2, PERM_SYS_LVL3 };
u32 lvl = (drvtype & (DRV_TWLNAND|DRV_ALIAS|DRV_CTRNAND)) ? 1 : 0;
if (drvtype & (DRV_CTRNAND|DRV_VIRTUAL)) { // check for paths
const char* path_lvl3[] = { PATH_SYS_LVL3 };
Expand All @@ -65,7 +65,7 @@ bool CheckWritePermissions(const char* path) {
perm = perms[lvl];
snprintf(area_name, 16, "SysNAND (lvl%lu)", lvl);
} else if (drvtype & DRV_EMUNAND) {
u32 perms[] = { PERM_EMU_LVL0, PERM_EMU_LVL1 };
static const u32 perms[] = { PERM_EMU_LVL0, PERM_EMU_LVL1 };
u32 lvl = (drvtype & (DRV_ALIAS|DRV_CTRNAND)) ? 1 : 0;
if (drvtype & DRV_VIRTUAL) { // check for paths
const char* path_lvl1[] = { PATH_EMU_LVL1 };
Expand Down Expand Up @@ -124,7 +124,7 @@ bool CheckWritePermissions(const char* path) {
}

bool CheckDirWritePermissions(const char* path) {
const char* path_chk[] = { PATH_SYS_LVL3, PATH_SYS_LVL2, PATH_SYS_LVL1, PATH_EMU_LVL1 };
static const char* path_chk[] = { PATH_SYS_LVL3, PATH_SYS_LVL2, PATH_SYS_LVL1, PATH_EMU_LVL1 };
for (u32 i = 0; i < sizeof(path_chk) / sizeof(char*); i++) {
const char* path_cmp = path_chk[i];
u32 p = 0;
Expand Down
6 changes: 3 additions & 3 deletions arm9/source/filesys/sddata.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ typedef struct {

static FilCryptInfo filcrypt[NUM_FILCRYPTINFO] = { 0 };

char alias_drv[NUM_ALIAS_DRV]; // 1 char ASCII drive number of the alias drive / 0x00 if unused
char alias_path[NUM_ALIAS_DRV][128]; // full path to resolve the alias into
static char alias_drv[NUM_ALIAS_DRV]; // 1 char ASCII drive number of the alias drive / 0x00 if unused
static char alias_path[NUM_ALIAS_DRV][128]; // full path to resolve the alias into

u8 sd_keyy[NUM_ALIAS_DRV][16] __attribute__((aligned(4))); // key Y belonging to alias drive
static u8 sd_keyy[NUM_ALIAS_DRV][16] __attribute__((aligned(4))); // key Y belonging to alias drive

int alias_num (const TCHAR* path) {
int num = -1;
Expand Down
4 changes: 2 additions & 2 deletions arm9/source/game/cia.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ u32 FixCiaHeaderForTmd(CiaHeader* header, TitleMetaData* tmd) {
}

u32 BuildCiaCert(u8* ciacert) {
const u8 cert_hash_expected[0x20] = {
static const u8 cert_hash_expected[0x20] = {
0xC7, 0x2E, 0x1C, 0xA5, 0x61, 0xDC, 0x9B, 0xC8, 0x05, 0x58, 0x58, 0x9C, 0x63, 0x08, 0x1C, 0x8A,
0x10, 0x78, 0xDF, 0x42, 0x99, 0x80, 0x3A, 0x68, 0x58, 0xF0, 0x41, 0xF9, 0xCB, 0x10, 0xE6, 0x35
};
const u8 cert_hash_expected_dev[0x20] = {
static const u8 cert_hash_expected_dev[0x20] = {
0xFB, 0xD2, 0xC0, 0x47, 0x95, 0xB9, 0x4C, 0xC8, 0x0B, 0x64, 0x58, 0x96, 0xF6, 0x61, 0x0F, 0x52,
0x18, 0x83, 0xAF, 0xE0, 0xF4, 0xE5, 0x62, 0xBA, 0x69, 0xEE, 0x72, 0x2A, 0xC2, 0x4E, 0x95, 0xB3
};
Expand Down
10 changes: 5 additions & 5 deletions arm9/source/game/disadiff.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ inline static FRESULT DisaDiffQWrite(const TCHAR* path, const void* buf, UINT of
}

u32 GetDisaDiffRWInfo(const char* path, DisaDiffRWInfo* info, bool partitionB) {
const u8 disa_magic[] = { DISA_MAGIC };
const u8 diff_magic[] = { DIFF_MAGIC };
const u8 ivfc_magic[] = { IVFC_MAGIC };
const u8 dpfs_magic[] = { DPFS_MAGIC };
const u8 difi_magic[] = { DIFI_MAGIC };
static const u8 disa_magic[] = { DISA_MAGIC };
static const u8 diff_magic[] = { DIFF_MAGIC };
static const u8 ivfc_magic[] = { IVFC_MAGIC };
static const u8 dpfs_magic[] = { DPFS_MAGIC };
static const u8 difi_magic[] = { DIFI_MAGIC };

// reset reader info
memset(info, 0x00, sizeof(DisaDiffRWInfo));
Expand Down
4 changes: 2 additions & 2 deletions arm9/source/game/gba.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
0x84, 0x9D, 0xA0, 0xD5, 0x6F, 0x5A, 0x34, 0xC4, 0x81, 0x06, 0x0C, 0x9F, 0xF2, 0xFA, 0xD8, 0x18

u32 ValidateAgbSaveHeader(AgbSaveHeader* header) {
u8 magic[] = { AGBSAVE_MAGIC };
static u8 magic[] = { AGBSAVE_MAGIC };

// basic checks
if ((memcmp(header->magic, magic, sizeof(magic)) != 0) ||
Expand All @@ -28,7 +28,7 @@ u32 ValidateAgbSaveHeader(AgbSaveHeader* header) {

// http://problemkaputt.de/gbatek.htm#gbacartridgeheader
u32 ValidateAgbHeader(AgbHeader* agb) {
const u8 logo_sha[0x20] = { AGBLOGO_SHA256 };
static const u8 logo_sha[0x20] = { AGBLOGO_SHA256 };
u8 logo[0x9C] __attribute__((aligned(4)));

// check fixed value
Expand Down
2 changes: 1 addition & 1 deletion arm9/source/game/ncsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "ncch.h"

u32 ValidateNcsdHeader(NcsdHeader* header) {
u8 zeroes[16] = { 0 };
static const u8 zeroes[16] = { 0 };
if ((memcmp(header->magic, "NCSD", 4) != 0) || // check magic number
(memcmp(header->partitions_fs_type, zeroes, 8) != 0) || !header->mediaId) // prevent detection of NAND images
return 1;
Expand Down
2 changes: 1 addition & 1 deletion arm9/source/game/romfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ u64 GetRomFsLvOffset(RomFsIvfcHeader* ivfc, u32 lvl) {

// validate IVFC header by checking offsets and hash sizes
u32 ValidateRomFsHeader(RomFsIvfcHeader* ivfc, u32 max_size) {
u8 magic[] = { ROMFS_MAGIC };
static const u8 magic[] = { ROMFS_MAGIC };

// check magic number
if (memcmp(magic, ivfc->magic, sizeof(magic)) != 0)
Expand Down
2 changes: 1 addition & 1 deletion arm9/source/game/smdh.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
36, 37, 44, 45, 38, 39, 46, 47, 52, 53, 60, 61, 54, 55, 62, 63

u32 ConvertSmdhIcon(u16* icon, const u16* smdh_icon, u32 w, u32 h) {
const u32 lut[8*8] = { SMDH_LUT };
static const u32 lut[8*8] = { SMDH_LUT };
u16* pix565 = (u16*) smdh_icon;
for (u32 y = 0; y < h; y += 8) {
for (u32 x = 0; x < w; x += 8) {
Expand Down
10 changes: 5 additions & 5 deletions arm9/source/game/ticket.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "ff.h"

u32 ValidateTicket(Ticket* ticket) {
const u8 magic[] = { TICKET_SIG_TYPE };
static const u8 magic[] = { TICKET_SIG_TYPE };
if ((memcmp(ticket->sig_type, magic, sizeof(magic)) != 0) ||
((strncmp((char*) ticket->issuer, TICKET_ISSUER, 0x40) != 0) &&
(strncmp((char*) ticket->issuer, TICKET_ISSUER_DEV, 0x40) != 0)) ||
Expand Down Expand Up @@ -39,8 +39,8 @@ u32 ValidateTicketSignature(Ticket* ticket) {
}

u32 BuildFakeTicket(Ticket* ticket, u8* title_id) {
const u8 sig_type[4] = { TICKET_SIG_TYPE }; // RSA_2048 SHA256
const u8 ticket_cnt_index[] = { // whatever this is
static const u8 sig_type[4] = { TICKET_SIG_TYPE }; // RSA_2048 SHA256
static const u8 ticket_cnt_index[] = { // whatever this is
0x00, 0x01, 0x00, 0x14, 0x00, 0x00, 0x00, 0xAC, 0x00, 0x00, 0x00, 0x14, 0x00, 0x01, 0x00, 0x14,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x84,
0x00, 0x00, 0x00, 0x84, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
Expand Down Expand Up @@ -72,11 +72,11 @@ u32 GetTicketSize(const Ticket* ticket) {
}

u32 BuildTicketCert(u8* tickcert) {
const u8 cert_hash_expected[0x20] = {
static const u8 cert_hash_expected[0x20] = {
0xDC, 0x15, 0x3C, 0x2B, 0x8A, 0x0A, 0xC8, 0x74, 0xA9, 0xDC, 0x78, 0x61, 0x0E, 0x6A, 0x8F, 0xE3,
0xE6, 0xB1, 0x34, 0xD5, 0x52, 0x88, 0x73, 0xC9, 0x61, 0xFB, 0xC7, 0x95, 0xCB, 0x47, 0xE6, 0x97
};
const u8 cert_hash_expected_dev[0x20] = {
static const u8 cert_hash_expected_dev[0x20] = {
0x97, 0x2A, 0x32, 0xFF, 0x9D, 0x4B, 0xAA, 0x2F, 0x1A, 0x24, 0xCF, 0x21, 0x13, 0x87, 0xF5, 0x38,
0xC6, 0x4B, 0xD4, 0x8F, 0xDF, 0x13, 0x21, 0x3D, 0xFC, 0x72, 0xFC, 0x8D, 0x9F, 0xDD, 0x01, 0x0E
};
Expand Down
8 changes: 4 additions & 4 deletions arm9/source/game/tmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "ff.h"

u32 ValidateTmd(TitleMetaData* tmd) {
const u8 magic[] = { TMD_SIG_TYPE };
static const u8 magic[] = { TMD_SIG_TYPE };
if ((memcmp(tmd->sig_type, magic, sizeof(magic)) != 0) ||
((strncmp((char*) tmd->issuer, TMD_ISSUER, 0x40) != 0) &&
(strncmp((char*) tmd->issuer, TMD_ISSUER_DEV, 0x40) != 0)))
Expand Down Expand Up @@ -77,7 +77,7 @@ u32 FixTmdHashes(TitleMetaData* tmd) {
}

u32 BuildFakeTmd(TitleMetaData* tmd, u8* title_id, u32 n_contents, u32 save_size, u32 twl_privsave_size) {
const u8 sig_type[4] = { TMD_SIG_TYPE };
static const u8 sig_type[4] = { TMD_SIG_TYPE };
// safety check: number of contents
if (n_contents > TMD_MAX_CONTENTS) return 1; // potential incompatibility here (!)
// set TMD all zero for a clean start
Expand All @@ -102,11 +102,11 @@ u32 BuildFakeTmd(TitleMetaData* tmd, u8* title_id, u32 n_contents, u32 save_size
}

u32 BuildTmdCert(u8* tmdcert) {
const u8 cert_hash_expected[0x20] = {
static const u8 cert_hash_expected[0x20] = {
0x91, 0x5F, 0x77, 0x3A, 0x07, 0x82, 0xD4, 0x27, 0xC4, 0xCE, 0xF5, 0x49, 0x25, 0x33, 0xE8, 0xEC,
0xF6, 0xFE, 0xA1, 0xEB, 0x8C, 0xCF, 0x59, 0x6E, 0x69, 0xBA, 0x2A, 0x38, 0x8D, 0x73, 0x8A, 0xE1
};
const u8 cert_hash_expected_dev[0x20] = {
static const u8 cert_hash_expected_dev[0x20] = {
0x49, 0xC9, 0x41, 0x56, 0xCA, 0x86, 0xBD, 0x1F, 0x36, 0x51, 0x51, 0x6A, 0x4A, 0x9F, 0x54, 0xA1,
0xC2, 0xE9, 0xCA, 0x93, 0x94, 0xF4, 0x29, 0xA0, 0x38, 0x54, 0x75, 0xFF, 0xAB, 0x6E, 0x8E, 0x71
};
Expand Down
18 changes: 9 additions & 9 deletions arm9/source/godmode.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,10 @@ void DrawDirContents(DirStruct* contents, u32 cursor, u32* scroll) {
}

u32 SdFormatMenu(const char* slabel) {
const u32 cluster_size_table[5] = { 0x0, 0x0, 0x4000, 0x8000, 0x10000 };
const char* option_emunand_size[7] = { "No EmuNAND", "RedNAND size (min)", "GW EmuNAND size (full)",
static const u32 cluster_size_table[5] = { 0x0, 0x0, 0x4000, 0x8000, 0x10000 };
static const char* option_emunand_size[7] = { "No EmuNAND", "RedNAND size (min)", "GW EmuNAND size (full)",
"MultiNAND size (2x)", "MultiNAND size (3x)", "MultiNAND size (4x)", "User input..." };
const char* option_cluster_size[4] = { "Auto", "16KB Clusters", "32KB Clusters", "64KB Clusters" };
static const char* option_cluster_size[4] = { "Auto", "16KB Clusters", "32KB Clusters", "64KB Clusters" };
u32 sysnand_min_size_sectors = GetNandMinSizeSectors(NAND_SYSNAND);
u64 sysnand_min_size_mb = ((sysnand_min_size_sectors * 0x200) + 0xFFFFF) / 0x100000;
u64 sysnand_multi_size_mb = (align(sysnand_min_size_sectors + 1, 0x2000) * 0x200) / 0x100000;
Expand Down Expand Up @@ -467,13 +467,13 @@ u32 SdFormatMenu(const char* slabel) {
u32 emunand_offset = 1;
u32 n_emunands = 1;
if (emunand_size_mb >= 2 * sysnand_size_mb) {
const char* option_emunand_type[4] = { "RedNAND type (multi)", "RedNAND type (single)", "GW EmuNAND type", "Don't set up" };
static const char* option_emunand_type[4] = { "RedNAND type (multi)", "RedNAND type (single)", "GW EmuNAND type", "Don't set up" };
user_select = ShowSelectPrompt(4, option_emunand_type, "Choose EmuNAND type to set up:");
if (user_select > 3) return 0;
emunand_offset = (user_select == 3) ? 0 : 1;
if (user_select == 1) n_emunands = 4;
} else if (emunand_size_mb >= sysnand_size_mb) {
const char* option_emunand_type[3] = { "RedNAND type", "GW EmuNAND type", "Don't set up" };
static const char* option_emunand_type[3] = { "RedNAND type", "GW EmuNAND type", "Don't set up" };
user_select = ShowSelectPrompt(3, option_emunand_type, "Choose EmuNAND type to set up:");
if (user_select > 2) return 0;
emunand_offset = (user_select == 2) ? 0 : 1; // 0 -> GW EmuNAND
Expand Down Expand Up @@ -748,7 +748,7 @@ u32 FileHexViewer(const char* path) {
else if (dual_screen) ClearScreen(BOT_SCREEN, COLOR_STD_BG);
else memcpy(BOT_SCREEN, bottom_cpy, SCREEN_SIZE_BOT);
} else if (pad_state & BUTTON_X) {
const char* optionstr[3] = { "Go to offset", "Search for string", "Search for data" };
static const char* optionstr[3] = { "Go to offset", "Search for string", "Search for data" };
u32 user_select = ShowSelectPrompt(3, optionstr, "Current offset: %08X\nSelect action:",
(unsigned int) offset);
if (user_select == 1) { // -> goto offset
Expand Down Expand Up @@ -2329,7 +2329,7 @@ u32 GodMode(int entrypoint) {
} else { // one level up
u32 user_select = 1;
if (curr_drvtype & DRV_SEARCH) { // special menu for search drive
const char* optionstr[2] = { "Open this folder", "Open containing folder" };
static const char* optionstr[2] = { "Open this folder", "Open containing folder" };
char pathstr[32 + 1];
TruncateString(pathstr, curr_entry->path, 32, 8);
user_select = ShowSelectPrompt(2, optionstr, "%s", pathstr);
Expand Down Expand Up @@ -2490,7 +2490,7 @@ u32 GodMode(int entrypoint) {
} else if ((curr_drvtype & DRV_CART) && (pad_state & BUTTON_Y)) {
ShowPrompt(false, "Not allowed in gamecart drive");
} else if (pad_state & BUTTON_Y) { // paste files
const char* optionstr[2] = { "Copy path(s)", "Move path(s)" };
static const char* optionstr[2] = { "Copy path(s)", "Move path(s)" };
char promptstr[64];
u32 flags = 0;
u32 user_select;
Expand Down Expand Up @@ -2542,7 +2542,7 @@ u32 GodMode(int entrypoint) {
}
}
} else if (pad_state & BUTTON_Y) { // create an entry
const char* optionstr[] = { "Create a folder", "Create a dummy file" };
static const char* optionstr[] = { "Create a folder", "Create a dummy file" };
u32 type = ShowSelectPrompt(2, optionstr, "Create a new entry here?\nSelect type.");
if (type) {
const char* typestr = (type == 1) ? "folder" : (type == 2) ? "file" : NULL;
Expand Down
2 changes: 1 addition & 1 deletion arm9/source/nand/nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ u32 ValidateSecretSector(u8* sector)
// see: https://github.com/d0k3/GodMode9/blob/master/source/game/ncsd.c#L4
u32 ValidateNandNcsdHeader(NandNcsdHeader* header)
{
u8 zeroes[16] = { 0 };
static const u8 zeroes[16] = { 0 };
if ((memcmp(header->magic, "NCSD", 4) != 0) || // check magic number
(memcmp(header->partitions_fs_type, zeroes, 8) == 0) || header->mediaId) // prevent detection of cart NCSD images
return 1;
Expand Down
2 changes: 1 addition & 1 deletion arm9/source/utils/ctrtransfer.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ u32 TransferCtrNandImage(const char* path_img, const char* drv) {
}

// actual transfer - db files / titles
const char* dbnames[] = { "ticket.db", "certs.db", "title.db", "import.db", "tmp_t.db", "tmp_i.db" };
static const char* dbnames[] = { "ticket.db", "certs.db", "title.db", "import.db", "tmp_t.db", "tmp_i.db" };
char path_to[32];
char path_from[32];
char path_dbs[32];
Expand Down
Loading

0 comments on commit 929cc7f

Please sign in to comment.