Skip to content

Commit

Permalink
Remove trailing white space
Browse files Browse the repository at this point in the history
 - Removed trailing whitespace from all source code files (.c, .h. and
   .s) and the README.md
  • Loading branch information
gemarcano authored and d0k3 committed Aug 26, 2020
1 parent d682a65 commit d010f28
Show file tree
Hide file tree
Showing 81 changed files with 1,888 additions and 1,888 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ With the possibilites GodMode9 provides, not everything may be obvious at first
* __Hexview and hexedit any file__: Press the A button on a file and select `Show in Hexeditor`. A button again enables edit mode, hold the A button and press arrow buttons to edit bytes. You will get an additional confirmation prompt to take over changes. Take note that for certain files, write permissions can't be enabled.
* __View text files in a text viewer__: Press the A button on a file and select `Show in Textviewer` (only shows up for actual text files). You can enable wordwrapped mode via R+Y, and navigate around the file via R+X and the dpad.
* __Chainload FIRM payloads__: Press the A button on a FIRM file, select `FIRM options` -> `Boot FIRM`. Keep in mind you should not run FIRMs from dubious sources and that the write permissions system is no longer in place after booting a payload.
* __Chainload FIRM payloads from a neat menu__: The `payloads` menu is found inside the HOME button menu. It provides any FIRM found in `0:/gm9/payloads` for quick chainloading.
* __Chainload FIRM payloads from a neat menu__: The `payloads` menu is found inside the HOME button menu. It provides any FIRM found in `0:/gm9/payloads` for quick chainloading.
* __Inject a file to another file__: Put exactly one file (the file to be injected from) into the clipboard (via the Y button). Press A on the file to be injected to. There will be an option to inject the first file into it.

### Scripting functionality
Expand Down
2 changes: 1 addition & 1 deletion arm11/source/arm/gic.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ enum {
GIC_RISINGEDGE_1N = 3

// With the 1-N model, an interrupt that is taken on any CPU clears the Pending
// status on all CPUs.
// status on all CPUs.
// With the N-N model, all CPUs receive the interrupt independently. The Pending
// status is cleared only for the CPU that takes it, not for the other CPUs
};
Expand Down
8 changes: 4 additions & 4 deletions arm9/source/common/rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ bool is_valid_dstime(DsTime* dstime) {
(DSTIMEGET(dstime, bcd_m) >= 60) ||
(DSTIMEGET(dstime, bcd_s) >= 60))
return false;

// check the date...
u32 year = 2000 + DSTIMEGET(dstime, bcd_Y);
u32 month = DSTIMEGET(dstime, bcd_M);
u32 day = DSTIMEGET(dstime, bcd_D);

// date: year & month
if ((year >= 2100) || (month == 0) || (month > 12))
return false;

// date: day
// see: https://github.com/devkitPro/libnds/blob/9678bf09389cb1fcdc99dfa0357ec0cbe51dd0b7/source/arm7/clock.c#L224-L262
u32 months_lastday[1+12] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
u32 leap = (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) ? 1 : 0;
u32 days_in_month = months_lastday[month] + ((month == 2) ? leap : 0);
if (day > days_in_month) return false;

return true;
}

Expand Down
10 changes: 5 additions & 5 deletions arm9/source/common/swkbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static bool BuildKeyboard(TouchBox* swkbd, const char* keys, const u8* layout) {

static void DrawKey(const TouchBox* key, const bool pressed, const u32 uppercase) {
const char* keystrs[] = { SWKBD_KEYSTR };
const u32 color = (pressed) ? COLOR_SWKBD_PRESSED :
const u32 color = (pressed) ? COLOR_SWKBD_PRESSED :
(key->id == KEY_ENTER) ? COLOR_SWKBD_ENTER :
((key->id == KEY_CAPS) && (uppercase > 1)) ? COLOR_SWKBD_CAPS :
COLOR_SWKBD_NORMAL;
Expand Down Expand Up @@ -125,12 +125,12 @@ static void DrawTextBox(const TouchBox* txtbox, const char* inputstr, const u32
const u32 input_shown = (txtbox->w / FONT_WIDTH_EXT) - 2;
const u32 inputstr_size = strlen(inputstr); // we rely on a zero terminated string
const u16 x = txtbox->x;
const u16 y = txtbox->y;
const u16 y = txtbox->y;

// fix scroll
if (cursor < *scroll) *scroll = cursor;
else if (cursor - *scroll > input_shown) *scroll = cursor - input_shown;

// draw input string
DrawStringF(BOT_SCREEN, x, y, COLOR_STD_FONT, COLOR_STD_BG, "%c%-*.*s%-*.*s%c",
(*scroll) ? '<' : '|',
Expand All @@ -142,7 +142,7 @@ static void DrawTextBox(const TouchBox* txtbox, const char* inputstr, const u32
"",
(inputstr_size - (s32) *scroll > input_shown) ? '>' : '|'
);

// draw cursor
DrawStringF(BOT_SCREEN, x-(FONT_WIDTH_EXT/2), y+10, COLOR_STD_FONT, COLOR_STD_BG, "%-*.*s^%-*.*s",
1 + cursor - *scroll,
Expand Down
4 changes: 2 additions & 2 deletions arm9/source/common/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ u64 timer_start( void ) {
if (!(*TIMER_CNT0 & *TIMER_CNT1 & *TIMER_CNT2 & *TIMER_CNT3 & TIMER_ACTIVE) ||
!(*TIMER_CNT1 & *TIMER_CNT2 & *TIMER_CNT3 & TIMER_COUNT_UP))
timer_init = true;

if (timer_init) {
// deactivate, then reset timers
*TIMER_CNT0 = 0;
Expand All @@ -17,7 +17,7 @@ u64 timer_start( void ) {
// start timers
*TIMER_CNT0 = TIMER_ACTIVE;
*TIMER_CNT1 = *TIMER_CNT2 = *TIMER_CNT3 = TIMER_ACTIVE | TIMER_COUNT_UP;

// timer initialized
timer_init = false;
}
Expand Down
6 changes: 3 additions & 3 deletions arm9/source/common/touchcal.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ bool CalibrateTouchFromSupportFile(void) {
size_t size = LoadSupportFile(TOUCH_CALIB_FILENAME, calibrations, sizeof(calibrations));
u32 n_dots = size / sizeof(HID_CalibrationData);

is_calibrated = (n_dots == 0) ? false :
is_calibrated = (n_dots == 0) ? false :
HID_SetCalibrationData(calibrations, n_dots, SCREEN_WIDTH_BOT, SCREEN_HEIGHT);
return is_calibrated;
}
Expand All @@ -99,11 +99,11 @@ bool CalibrateTouchFromFlash(void) {

// set calibration defaults
SetCalibrationDefaults();

// check SPIflash status
if (!spiflash_get_status())
return false;

// check NVRAM console ID
u32 console_id = 0;
if (!spiflash_read(0x001C, 4, (u8*)&console_id))
Expand Down
26 changes: 13 additions & 13 deletions arm9/source/common/ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#define STRBUF_SIZE 512 // maximum size of the string buffer
#define FONT_MAX_WIDTH 8
#define FONT_MAX_HEIGHT 10
#define PROGRESS_REFRESH_RATE 30 // the progress bar is only allowed to draw to screen every X milliseconds
#define PROGRESS_REFRESH_RATE 30 // the progress bar is only allowed to draw to screen every X milliseconds

static u32 font_width = 0;
static u32 font_height = 0;
Expand Down Expand Up @@ -247,7 +247,7 @@ void DrawString(u16 *screen, const char *str, int x, int y, u32 color, u32 bgcol
size_t len = (strlen(str) > max_len) ? max_len : strlen(str);

for (size_t i = 0; i < len; i++) {
char c = (char) (fix_utf8 && str[i] >= 0x80) ? '?' : str[i];
char c = (char) (fix_utf8 && str[i] >= 0x80) ? '?' : str[i];
DrawCharacter(screen, c, x + i * font_width, y, color, bgcolor);
}
}
Expand Down Expand Up @@ -445,17 +445,17 @@ void ShowIconString(u16* icon, int w, int h, const char *format, ...)
bool ShowPrompt(bool ask, const char *format, ...)
{
bool ret = true;

char str[STRBUF_SIZE];
va_list va;
va_start(va, format);
vsnprintf(str, STRBUF_SIZE, format, va);
va_end(va);

ClearScreenF(true, false, COLOR_STD_BG);
DrawStringCenter(MAIN_SCREEN, COLOR_STD_FONT, COLOR_STD_BG, "%s\n \n%s", str,
(ask) ? "(<A> yes, <B> no)" : "(<A> to continue)");

while (true) {
u32 pad_state = InputWait(0);
if (pad_state & BUTTON_A) break;
Expand All @@ -464,9 +464,9 @@ bool ShowPrompt(bool ask, const char *format, ...)
break;
}
}

ClearScreenF(true, false, COLOR_STD_BG);

return ret;
}

Expand Down Expand Up @@ -661,7 +661,7 @@ u32 ShowFileScrollPrompt(u32 n, const DirEntry** options, bool hide_ext, const c
DrawStringF(MAIN_SCREEN, x, yopt + ((line_height+2)*(i-scroll)),
(sel == (int)i) ? COLOR_STD_FONT : COLOR_ENTRY(options[i]), COLOR_STD_BG, "%2.2s %s",
(sel == (int)i) ? "->" : "", content_str);

DrawStringF(MAIN_SCREEN, x + item_width - font_width * 11, yopt + ((line_height+2)*(i-scroll)),
(sel == (int)i) ? COLOR_STD_FONT : COLOR_ENTRY(options[i]), COLOR_STD_BG, "%10.10s",
(options[i]->type == T_DIR) ? "(dir)" : (options[i]->type == T_DOTDOT) ? "(..)" : bytestr);
Expand Down Expand Up @@ -768,7 +768,7 @@ bool ShowInputPrompt(char* inputstr, u32 max_size, u32 resize, const char* alpha
if (str_width < (24 * font_width)) str_width = 24 * font_width;
x = (str_width >= SCREEN_WIDTH_MAIN) ? 0 : (SCREEN_WIDTH_MAIN - str_width) / 2;
y = (str_height >= SCREEN_HEIGHT) ? 0 : (SCREEN_HEIGHT - str_height) / 2;

ClearScreenF(true, false, COLOR_STD_BG);
DrawStringF(MAIN_SCREEN, x, y, COLOR_STD_FONT, COLOR_STD_BG, "%s", str);
DrawStringF(MAIN_SCREEN, x + 8, y + str_height - 40, COLOR_STD_FONT, COLOR_STD_BG,
Expand Down Expand Up @@ -901,7 +901,7 @@ bool ShowStringPrompt(char* inputstr, u32 max_size, const char *format, ...) {
ret = ShowInputPrompt(inputstr, max_size, 1, alphabet, format, va);
va_end(va);

return ret;
return ret;
}

u64 ShowHexPrompt(u64 start_val, u32 n_digits, const char *format, ...) {
Expand All @@ -919,7 +919,7 @@ u64 ShowHexPrompt(u64 start_val, u32 n_digits, const char *format, ...) {
} else ret = (u64) -1;
va_end(va);

return ret;
return ret;
}

u64 ShowNumberPrompt(u64 start_val, const char *format, ...) {
Expand All @@ -936,7 +936,7 @@ u64 ShowNumberPrompt(u64 start_val, const char *format, ...) {
} else ret = (u64) -1;
va_end(va);

return ret;
return ret;
}

bool ShowDataPrompt(u8* data, u32* size, const char *format, ...) {
Expand Down Expand Up @@ -965,7 +965,7 @@ bool ShowDataPrompt(u8* data, u32* size, const char *format, ...) {
}
va_end(va);

return ret;
return ret;
}


Expand Down
4 changes: 2 additions & 2 deletions arm9/source/common/utf.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ int utf16_to_utf8(u8 *out, const u16 *in, int len_out, int len_in)
units = decode_utf16(&code, in);
if(units == -1)
return -1;

if (len_in >= units)
len_in -= units;
else return -1;
Expand Down Expand Up @@ -238,7 +238,7 @@ int utf8_to_utf16(u16 *out, const u8 *in, int len_out, int len_in)
units = decode_utf8(&code, in);
if(units == -1)
return -1;

if (len_in >= units)
len_in -= units;
else return -1;
Expand Down
12 changes: 6 additions & 6 deletions arm9/source/crypto/aes.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,11 @@ void ctr_decrypt_byte(void *inbuf, void *outbuf, size_t size, size_t off, uint32
uint8_t *in = inbuf;
uint8_t *out = outbuf;
uint32_t i;

for (i=0; i<AES_BLOCK_SIZE; i++) // setup local ctr
ctr_local[i] = ctr[i];
add_ctr(ctr_local, off / AES_BLOCK_SIZE);

if (off_fix) // handle misaligned offset (at beginning)
{
size_t last_byte = ((off_fix + bytes_left) >= AES_BLOCK_SIZE) ?
Expand All @@ -229,7 +229,7 @@ void ctr_decrypt_byte(void *inbuf, void *outbuf, size_t size, size_t off, uint32
*(out++) = temp[i];
bytes_left -= last_byte - off_fix;
}

if (bytes_left >= AES_BLOCK_SIZE)
{
size_t blocks = bytes_left / AES_BLOCK_SIZE;
Expand All @@ -238,7 +238,7 @@ void ctr_decrypt_byte(void *inbuf, void *outbuf, size_t size, size_t off, uint32
out += AES_BLOCK_SIZE * blocks;
bytes_left -= AES_BLOCK_SIZE * blocks;
}

if (bytes_left) // handle misaligned offset (at end)
{
for (i=0; i<bytes_left; i++)
Expand Down Expand Up @@ -300,7 +300,7 @@ void aes_cmac(void* inbuf, void* outbuf, size_t size)
AES_CNT_INPUT_ENDIAN | AES_CNT_OUTPUT_ENDIAN;
uint32_t* out = (uint32_t*) outbuf;
uint32_t* in = (uint32_t*) inbuf;

// create xorpad for last block
set_ctr(zeroes);
aes_decrypt(xorpad, xorpad, 1, mode);
Expand All @@ -312,7 +312,7 @@ void aes_cmac(void* inbuf, void* outbuf, size_t size)
}
xorpadb[15] <<= 1;
xorpadb[15] ^= finalxor;

// process blocks
for (uint32_t i = 0; i < 4; i++)
out[i] = 0;
Expand Down
4 changes: 2 additions & 2 deletions arm9/source/crypto/crc16.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ u16 crc16_quick(const void* src, u32 len) {
static const u16 tabval[] = { CRC16_TABVAL };
u16* data = (u16*) src;
u16 crc = 0xFFFF;

for (len >>= 1; len; len--) {
u16 curr = *(data++);
for (u32 i = 0; i < 4; i++) {
Expand All @@ -21,6 +21,6 @@ u16 crc16_quick(const void* src, u32 len) {
crc ^= tval;
}
}

return crc;
}
4 changes: 2 additions & 2 deletions arm9/source/crypto/crc32.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ u32 crc32_calculate_from_file(const char* fileName, u32 offset, u32 length) {
return crc32;
}
fvx_lseek(&inputFile, offset);

bool ret = true;
for (u64 pos = 0; (pos < length) && ret; pos += bufsiz) {
UINT read_bytes = min(bufsiz, length - pos);
Expand All @@ -83,7 +83,7 @@ u32 crc32_calculate_from_file(const char* fileName, u32 offset, u32 length) {
ret = false;
if (ret) crc32 = crc32_calculate(crc32, buffer, read_bytes);
}

fvx_close(&inputFile);
free(buffer);
return ~crc32;
Expand Down
Loading

0 comments on commit d010f28

Please sign in to comment.