Minor stuff

This commit is contained in:
Aurora 2016-09-14 22:31:25 +02:00
parent 0853f6f7ad
commit 8f3cba37b3
10 changed files with 25 additions and 24 deletions

View File

@ -139,14 +139,15 @@ void configMenu(bool oldPinStatus)
"out-of-region games work.\n" "out-of-region games work.\n"
"Refer to the wiki for instructions", "Refer to the wiki for instructions",
"Show the currently booted NAND in\n" "Show the currently booted NAND\n"
"System Settings (Sys = SysNAND,\n" "(Sys = SysNAND, Emu = EmuNAND 1,\n"
"Emu = EmuNAND 1, EmuX = EmuNAND X,\n" "EmuX = EmuNAND X,\n"
"SysE = SysNAND with EmuNAND 1 FIRM,\n" "SysE = SysNAND with EmuNAND 1 FIRM,\n"
"SyEX = SysNAND with EmuNAND X FIRM,\n" "SyEX = SysNAND with EmuNAND X FIRM,\n"
"EmXS = EmuNAND X with SysNAND FIRM)\n" "EmXS = EmuNAND X with SysNAND FIRM)\n"
"or an user-defined custom string\n" "or an user-defined custom string in\n"
"(refer to the wiki for instructions)", "System Settings.\n"
"Refer to the wiki for instructions",
"Show the GBA boot screen when\n" "Show the GBA boot screen when\n"
"launching GBA games", "launching GBA games",

View File

@ -405,7 +405,7 @@ void arm9Loader(u8 *arm9Section)
//Firm keys //Firm keys
u8 __attribute__((aligned(4))) keyY[0x10]; u8 __attribute__((aligned(4))) keyY[0x10];
u8 __attribute__((aligned(4))) arm9BinCTR[0x10]; u8 __attribute__((aligned(4))) arm9BinCTR[0x10];
u8 arm9BinSlot = a9lVersion ? 0x16 : 0x15; u8 arm9BinSlot = a9lVersion != 0 ? 0x16 : 0x15;
//Setup keys needed for arm9bin decryption //Setup keys needed for arm9bin decryption
memcpy(keyY, arm9Section + 0x10, 0x10); memcpy(keyY, arm9Section + 0x10, 0x10);
@ -414,7 +414,7 @@ void arm9Loader(u8 *arm9Section)
//Calculate the size of the ARM9 binary //Calculate the size of the ARM9 binary
u32 arm9BinSize = 0; u32 arm9BinSize = 0;
//http://stackoverflow.com/questions/12791077/atoi-implementation-in-c //http://stackoverflow.com/questions/12791077/atoi-implementation-in-c
for(u8 *tmp = arm9Section + 0x30; *tmp; tmp++) for(u8 *tmp = arm9Section + 0x30; *tmp != 0; tmp++)
arm9BinSize = (arm9BinSize << 3) + (arm9BinSize << 1) + *tmp - '0'; arm9BinSize = (arm9BinSize << 3) + (arm9BinSize << 1) + *tmp - '0';
if(a9lVersion) if(a9lVersion)

View File

@ -63,7 +63,7 @@ void drawCharacter(char character, bool isTopScreen, u32 posX, u32 posY, u32 col
char charPos = font[character * 8 + y]; char charPos = font[character * 8 + y];
for(u32 x = 0; x < 8; x++) for(u32 x = 0; x < 8; x++)
if((charPos >> (7 - x)) & 1) if(((charPos >> (7 - x)) & 1) == 1)
{ {
u32 screenPos = (posX * SCREEN_HEIGHT * 3 + (SCREEN_HEIGHT - y - posY - 1) * 3) + x * 3 * SCREEN_HEIGHT; u32 screenPos = (posX * SCREEN_HEIGHT * 3 + (SCREEN_HEIGHT - y - posY - 1) * 3) + x * 3 * SCREEN_HEIGHT;

View File

@ -580,7 +580,7 @@ static inline void launchFirm(FirmwareType firmType)
#endif #endif
//Copy FIRM sections to respective memory locations //Copy FIRM sections to respective memory locations
for(; sectionNum < 4 && section[sectionNum].size; sectionNum++) for(; sectionNum < 4 && section[sectionNum].size != 0; sectionNum++)
memcpy(section[sectionNum].address, (u8 *)firm + section[sectionNum].offset, section[sectionNum].size); memcpy(section[sectionNum].address, (u8 *)firm + section[sectionNum].offset, section[sectionNum].size);
//Determine the ARM11 entry to use //Determine the ARM11 entry to use

View File

@ -117,8 +117,8 @@ static bool i2cSelectRegister(u8 bus_id, u8 reg)
bool i2cWriteRegister(u8 dev_id, u8 reg, u8 data) bool i2cWriteRegister(u8 dev_id, u8 reg, u8 data)
{ {
u8 bus_id = i2cGetDeviceBusId(dev_id); u8 bus_id = i2cGetDeviceBusId(dev_id),
u8 dev_addr = i2cGetDeviceRegAddr(dev_id); dev_addr = i2cGetDeviceRegAddr(dev_id);
for(u32 i = 0; i < 8; i++) for(u32 i = 0; i < 8; i++)
{ {

View File

@ -46,13 +46,13 @@ void memset32(void *dest, u32 filler, u32 size)
int memcmp(const void *buf1, const void *buf2, u32 size) int memcmp(const void *buf1, const void *buf2, u32 size)
{ {
const u8 *buf1c = (const u8 *)buf1; const u8 *buf1c = (const u8 *)buf1,
const u8 *buf2c = (const u8 *)buf2; *buf2c = (const u8 *)buf2;
for(u32 i = 0; i < size; i++) for(u32 i = 0; i < size; i++)
{ {
int cmp = buf1c[i] - buf2c[i]; int cmp = buf1c[i] - buf2c[i];
if(cmp) return cmp; if(cmp != 0) return cmp;
} }
return 0; return 0;

View File

@ -187,9 +187,9 @@ void implementSvcGetCFWInfo(u8 *pos, u32 *arm11SvcTable, u32 baseK11VA, u8 **fre
else isRelease = rev[4] == 0; else isRelease = rev[4] == 0;
#ifdef DEV #ifdef DEV
info->flags = 1 /* dev branch */ | ((isRelease ? 1 : 0) << 1) /* is release */; info->flags = 1 /* dev build */ | ((isRelease ? 1 : 0) << 1) /* is release */;
#else #else
info->flags = 0 /* master branch */ | ((isRelease ? 1 : 0) << 1) /* is release */; info->flags = 0 /* regular build */ | ((isRelease ? 1 : 0) << 1) /* is release */;
#endif #endif
arm11SvcTable[0x2E] = baseK11VA + *freeK11Space - pos; //Stubbed svc arm11SvcTable[0x2E] = baseK11VA + *freeK11Space - pos; //Stubbed svc

View File

@ -59,7 +59,7 @@ void newPin(bool allowSkipping)
u8 __attribute__((aligned(4))) enteredPassword[0x10] = {0}; u8 __attribute__((aligned(4))) enteredPassword[0x10] = {0};
u8 cnt = 0; u8 cnt = 0;
int charDrawPos = 16 * SPACING_X; u32 charDrawPos = 16 * SPACING_X;
while(cnt < length) while(cnt < length)
{ {
@ -130,12 +130,12 @@ bool verifyPin(void)
bool unlock = false; bool unlock = false;
u8 cnt = 0; u8 cnt = 0;
int charDrawPos = 16 * SPACING_X; u32 charDrawPos = 16 * SPACING_X;
const char *messagePath = "/luma/pinmessage.txt"; const char *messagePath = "/luma/pinmessage.txt";
u32 messageSize = getFileSize(messagePath); u32 messageSize = getFileSize(messagePath);
if(messageSize > 0 && messageSize < 800) if(messageSize > 0 && messageSize <= 800)
{ {
char message[messageSize + 1]; char message[messageSize + 1];
fileRead(message, messagePath, 0); fileRead(message, messagePath, 0);

View File

@ -34,7 +34,7 @@ u32 strlen(const char *string)
void concatenateStrings(char *destination, const char *source) void concatenateStrings(char *destination, const char *source)
{ {
int i = strlen(source), u32 i = strlen(source),
j = strlen(destination); j = strlen(destination);
memcpy(&destination[j], source, i + 1); memcpy(&destination[j], source, i + 1);
@ -51,5 +51,5 @@ void hexItoa(u32 number, char *out, u32 digits)
number >>= 4; number >>= 4;
} }
for(; i < digits; i++) out[digits - 1 - i] = '0'; while(i < digits) out[digits - 1 - i++] = '0';
} }

View File

@ -29,8 +29,8 @@
u32 waitInput(void) u32 waitInput(void)
{ {
u32 pressedKey = 0, bool pressedKey = false;
key; u32 key;
//Wait for no keys to be pressed //Wait for no keys to be pressed
while(HID_PAD); while(HID_PAD);
@ -46,7 +46,7 @@ u32 waitInput(void)
for(u32 i = 0x13000; i > 0; i--) for(u32 i = 0x13000; i > 0; i--)
{ {
if(key != HID_PAD) break; if(key != HID_PAD) break;
if(i == 1) pressedKey = 1; if(i == 1) pressedKey = true;
} }
} }
while(!pressedKey); while(!pressedKey);