From c11ac6c04ea8585b08a2d3972da2b5e2c6c5f177 Mon Sep 17 00:00:00 2001 From: chaoskagami Date: Sat, 20 Aug 2016 12:05:59 -0400 Subject: [PATCH] Fix up tabs (again) --- source/arm11.c | 184 ++++++++++++++++++++-------------------- source/chainloader.c | 10 +-- source/config-file.c | 2 +- source/firm/decryptor.c | 2 +- source/firm/firm.c | 46 +++++----- source/interpreter.c | 2 +- source/interrupt.c | 28 +++--- source/menu.c | 2 +- source/patch/emunand.c | 2 +- source/std/allocator.c | 2 +- source/std/draw.c | 128 ++++++++++++++-------------- 11 files changed, 204 insertions(+), 204 deletions(-) diff --git a/source/arm11.c b/source/arm11.c index f8566aa..9a447d1 100644 --- a/source/arm11.c +++ b/source/arm11.c @@ -58,7 +58,7 @@ void installArm11Stub(void) { if(!hasCopiedStub) { memcpy((void *)ARM11_STUB_ADDRESS, arm11Stub, 0x30); - ctr_cache_clean_and_flush_all(); + ctr_cache_clean_and_flush_all(); hasCopiedStub = true; } } @@ -109,7 +109,7 @@ void updateBrightness(uint32_t brightnessIndex) WAIT_FOR_ARM9(); } - ctr_cache_clean_and_flush_all(); + ctr_cache_clean_and_flush_all(); invokeArm11Function(ARM11); } @@ -139,7 +139,7 @@ void clearScreens(void) { WAIT_FOR_ARM9(); } - ctr_cache_clean_and_flush_all(); + ctr_cache_clean_and_flush_all(); invokeArm11Function(ARM11); } @@ -148,16 +148,16 @@ void screen_mode(uint32_t mode) { bright = brightness[config->options[OPTION_BRIGHTNESS]]; - stride = 240 * 3; - if (mode == RGBA8) - stride = 240 * 4; + stride = 240 * 3; + if (mode == RGBA8) + stride = 240 * 4; init_top = MAKE_FRAMEBUFFER_PIXFMT(mode, 0, 1); init_bottom = MAKE_FRAMEBUFFER_PIXFMT(mode, 0, 0); if (!framebuffers) { // Look ma, dynamically allocating the CakeHax struct! (joking) - // We literally just discard the previous state - for sanity's sake. + // We literally just discard the previous state - for sanity's sake. // On chainload, it is needed to copy the framebuffer struct. framebuffers = malloc(sizeof(struct framebuffers)); } @@ -166,90 +166,90 @@ void screen_mode(uint32_t mode) { //Disable interrupts __asm(".word 0xF10C01C0"); - PDN_GPU_CNT = 0x1007F; //bit0: Enable GPU regs 0x10400000+, bit16 turn on LCD backlight? - LCD_REG(0x14) = 0x00000001; //UNKNOWN register, maybe LCD related? 0x10202000 - LCD_REG(0xC) &= 0xFFFEFFFE; //UNKNOWN register, maybe LCD related? - - LCD_TOP_CONF_BRIGHTNESS = bright; - LCD_BOT_CONF_BRIGHTNESS = bright; - LCD_TOP_CONF_REG(0x44) = 0x1023E; //unknown - LCD_BOT_CONF_REG(0x44) = 0x1023E; //unknown - - // Top screen - PDC0_FRAMEBUFFER_SETUP_REG(0x00) = 0x000001c2; //unknown - PDC0_FRAMEBUFFER_SETUP_REG(0x04) = 0x000000d1; //unknown - PDC0_FRAMEBUFFER_SETUP_REG(0x08) = 0x000001c1; - PDC0_FRAMEBUFFER_SETUP_REG(0x0c) = 0x000001c1; - PDC0_FRAMEBUFFER_SETUP_REG(0x10) = 0x00000000; - PDC0_FRAMEBUFFER_SETUP_REG(0x14) = 0x000000cf; - PDC0_FRAMEBUFFER_SETUP_REG(0x18) = 0x000000d1; - PDC0_FRAMEBUFFER_SETUP_REG(0x1c) = 0x01c501c1; - PDC0_FRAMEBUFFER_SETUP_REG(0x20) = 0x00010000; - PDC0_FRAMEBUFFER_SETUP_REG(0x24) = 0x0000019d; - PDC0_FRAMEBUFFER_SETUP_REG(0x28) = 0x00000002; - PDC0_FRAMEBUFFER_SETUP_REG(0x2c) = 0x00000192; - PDC0_FRAMEBUFFER_SETUP_REG(0x30) = 0x00000192; - PDC0_FRAMEBUFFER_SETUP_REG(0x34) = 0x00000192; - PDC0_FRAMEBUFFER_SETUP_REG(0x38) = 0x00000001; - PDC0_FRAMEBUFFER_SETUP_REG(0x3c) = 0x00000002; - PDC0_FRAMEBUFFER_SETUP_REG(0x40) = 0x01960192; - PDC0_FRAMEBUFFER_SETUP_REG(0x44) = 0x00000000; - PDC0_FRAMEBUFFER_SETUP_REG(0x48) = 0x00000000; - PDC0_FRAMEBUFFER_SETUP_DIMS = (240u << 16) | (400u); - PDC0_FRAMEBUFFER_SETUP_REG(0x60) = 0x01c100d1; - PDC0_FRAMEBUFFER_SETUP_REG(0x64) = 0x01920002; - PDC0_FRAMEBUFFER_SETUP_FBA_ADDR_1 = 0x18300000; - PDC0_FRAMEBUFFER_SETUP_FB_FORMAT = init_top; - PDC0_FRAMEBUFFER_SETUP_REG(0x74) = 0x00010501; - PDC0_FRAMEBUFFER_SETUP_FB_SELECT = 0; - PDC0_FRAMEBUFFER_SETUP_FB_STRIDE = stride; - PDC0_FRAMEBUFFER_SETUP_REG(0x9C) = 0x00000000; - - // Disco register - for(volatile uint32_t i = 0; i < 256; i++) - PDC0_FRAMEBUFFER_SETUP_DISCO = 0x10101 * i; - - // Bottom screen - PDC1_FRAMEBUFFER_SETUP_REG(0x00) = 0x000001c2; - PDC1_FRAMEBUFFER_SETUP_REG(0x04) = 0x000000d1; - PDC1_FRAMEBUFFER_SETUP_REG(0x08) = 0x000001c1; - PDC1_FRAMEBUFFER_SETUP_REG(0x0c) = 0x000001c1; - PDC1_FRAMEBUFFER_SETUP_REG(0x10) = 0x000000cd; - PDC1_FRAMEBUFFER_SETUP_REG(0x14) = 0x000000cf; - PDC1_FRAMEBUFFER_SETUP_REG(0x18) = 0x000000d1; - PDC1_FRAMEBUFFER_SETUP_REG(0x1c) = 0x01c501c1; - PDC1_FRAMEBUFFER_SETUP_REG(0x20) = 0x00010000; - PDC1_FRAMEBUFFER_SETUP_REG(0x24) = 0x0000019d; - PDC1_FRAMEBUFFER_SETUP_REG(0x28) = 0x00000052; - PDC1_FRAMEBUFFER_SETUP_REG(0x2c) = 0x00000192; - PDC1_FRAMEBUFFER_SETUP_REG(0x30) = 0x00000192; - PDC1_FRAMEBUFFER_SETUP_REG(0x34) = 0x0000004f; - PDC1_FRAMEBUFFER_SETUP_REG(0x38) = 0x00000050; - PDC1_FRAMEBUFFER_SETUP_REG(0x3c) = 0x00000052; - PDC1_FRAMEBUFFER_SETUP_REG(0x40) = 0x01980194; - PDC1_FRAMEBUFFER_SETUP_REG(0x44) = 0x00000000; - PDC1_FRAMEBUFFER_SETUP_REG(0x48) = 0x00000011; - PDC1_FRAMEBUFFER_SETUP_DIMS = (240u << 16) | 320u; - PDC1_FRAMEBUFFER_SETUP_REG(0x60) = 0x01c100d1; - PDC1_FRAMEBUFFER_SETUP_REG(0x64) = 0x01920052; - PDC1_FRAMEBUFFER_SETUP_FBA_ADDR_1 = 0x1835dc00; - PDC1_FRAMEBUFFER_SETUP_FB_FORMAT = init_bottom; - PDC1_FRAMEBUFFER_SETUP_REG(0x74) = 0x00010501; - PDC1_FRAMEBUFFER_SETUP_FB_SELECT = 0; - PDC1_FRAMEBUFFER_SETUP_FB_STRIDE = stride; - PDC1_FRAMEBUFFER_SETUP_REG(0x9C) = 0x00000000; - - // Disco register - for(volatile uint32_t i = 0; i < 256; i++) - PDC1_FRAMEBUFFER_SETUP_DISCO = 0x10101 * i; - - PDC0_FRAMEBUFFER_SETUP_FBA_ADDR_1 = 0x18300000; - PDC0_FRAMEBUFFER_SETUP_FBA_ADDR_2 = 0x18300000; - PDC0_FRAMEBUFFER_SETUP_FBB_ADDR_1 = 0x18300000; - PDC0_FRAMEBUFFER_SETUP_FBB_ADDR_2 = 0x18300000; - - PDC1_FRAMEBUFFER_SETUP_FBA_ADDR_1 = 0x1835dc00; - PDC1_FRAMEBUFFER_SETUP_FBA_ADDR_2 = 0x1835dc00; + PDN_GPU_CNT = 0x1007F; //bit0: Enable GPU regs 0x10400000+, bit16 turn on LCD backlight? + LCD_REG(0x14) = 0x00000001; //UNKNOWN register, maybe LCD related? 0x10202000 + LCD_REG(0xC) &= 0xFFFEFFFE; //UNKNOWN register, maybe LCD related? + + LCD_TOP_CONF_BRIGHTNESS = bright; + LCD_BOT_CONF_BRIGHTNESS = bright; + LCD_TOP_CONF_REG(0x44) = 0x1023E; //unknown + LCD_BOT_CONF_REG(0x44) = 0x1023E; //unknown + + // Top screen + PDC0_FRAMEBUFFER_SETUP_REG(0x00) = 0x000001c2; //unknown + PDC0_FRAMEBUFFER_SETUP_REG(0x04) = 0x000000d1; //unknown + PDC0_FRAMEBUFFER_SETUP_REG(0x08) = 0x000001c1; + PDC0_FRAMEBUFFER_SETUP_REG(0x0c) = 0x000001c1; + PDC0_FRAMEBUFFER_SETUP_REG(0x10) = 0x00000000; + PDC0_FRAMEBUFFER_SETUP_REG(0x14) = 0x000000cf; + PDC0_FRAMEBUFFER_SETUP_REG(0x18) = 0x000000d1; + PDC0_FRAMEBUFFER_SETUP_REG(0x1c) = 0x01c501c1; + PDC0_FRAMEBUFFER_SETUP_REG(0x20) = 0x00010000; + PDC0_FRAMEBUFFER_SETUP_REG(0x24) = 0x0000019d; + PDC0_FRAMEBUFFER_SETUP_REG(0x28) = 0x00000002; + PDC0_FRAMEBUFFER_SETUP_REG(0x2c) = 0x00000192; + PDC0_FRAMEBUFFER_SETUP_REG(0x30) = 0x00000192; + PDC0_FRAMEBUFFER_SETUP_REG(0x34) = 0x00000192; + PDC0_FRAMEBUFFER_SETUP_REG(0x38) = 0x00000001; + PDC0_FRAMEBUFFER_SETUP_REG(0x3c) = 0x00000002; + PDC0_FRAMEBUFFER_SETUP_REG(0x40) = 0x01960192; + PDC0_FRAMEBUFFER_SETUP_REG(0x44) = 0x00000000; + PDC0_FRAMEBUFFER_SETUP_REG(0x48) = 0x00000000; + PDC0_FRAMEBUFFER_SETUP_DIMS = (240u << 16) | (400u); + PDC0_FRAMEBUFFER_SETUP_REG(0x60) = 0x01c100d1; + PDC0_FRAMEBUFFER_SETUP_REG(0x64) = 0x01920002; + PDC0_FRAMEBUFFER_SETUP_FBA_ADDR_1 = 0x18300000; + PDC0_FRAMEBUFFER_SETUP_FB_FORMAT = init_top; + PDC0_FRAMEBUFFER_SETUP_REG(0x74) = 0x00010501; + PDC0_FRAMEBUFFER_SETUP_FB_SELECT = 0; + PDC0_FRAMEBUFFER_SETUP_FB_STRIDE = stride; + PDC0_FRAMEBUFFER_SETUP_REG(0x9C) = 0x00000000; + + // Disco register + for(volatile uint32_t i = 0; i < 256; i++) + PDC0_FRAMEBUFFER_SETUP_DISCO = 0x10101 * i; + + // Bottom screen + PDC1_FRAMEBUFFER_SETUP_REG(0x00) = 0x000001c2; + PDC1_FRAMEBUFFER_SETUP_REG(0x04) = 0x000000d1; + PDC1_FRAMEBUFFER_SETUP_REG(0x08) = 0x000001c1; + PDC1_FRAMEBUFFER_SETUP_REG(0x0c) = 0x000001c1; + PDC1_FRAMEBUFFER_SETUP_REG(0x10) = 0x000000cd; + PDC1_FRAMEBUFFER_SETUP_REG(0x14) = 0x000000cf; + PDC1_FRAMEBUFFER_SETUP_REG(0x18) = 0x000000d1; + PDC1_FRAMEBUFFER_SETUP_REG(0x1c) = 0x01c501c1; + PDC1_FRAMEBUFFER_SETUP_REG(0x20) = 0x00010000; + PDC1_FRAMEBUFFER_SETUP_REG(0x24) = 0x0000019d; + PDC1_FRAMEBUFFER_SETUP_REG(0x28) = 0x00000052; + PDC1_FRAMEBUFFER_SETUP_REG(0x2c) = 0x00000192; + PDC1_FRAMEBUFFER_SETUP_REG(0x30) = 0x00000192; + PDC1_FRAMEBUFFER_SETUP_REG(0x34) = 0x0000004f; + PDC1_FRAMEBUFFER_SETUP_REG(0x38) = 0x00000050; + PDC1_FRAMEBUFFER_SETUP_REG(0x3c) = 0x00000052; + PDC1_FRAMEBUFFER_SETUP_REG(0x40) = 0x01980194; + PDC1_FRAMEBUFFER_SETUP_REG(0x44) = 0x00000000; + PDC1_FRAMEBUFFER_SETUP_REG(0x48) = 0x00000011; + PDC1_FRAMEBUFFER_SETUP_DIMS = (240u << 16) | 320u; + PDC1_FRAMEBUFFER_SETUP_REG(0x60) = 0x01c100d1; + PDC1_FRAMEBUFFER_SETUP_REG(0x64) = 0x01920052; + PDC1_FRAMEBUFFER_SETUP_FBA_ADDR_1 = 0x1835dc00; + PDC1_FRAMEBUFFER_SETUP_FB_FORMAT = init_bottom; + PDC1_FRAMEBUFFER_SETUP_REG(0x74) = 0x00010501; + PDC1_FRAMEBUFFER_SETUP_FB_SELECT = 0; + PDC1_FRAMEBUFFER_SETUP_FB_STRIDE = stride; + PDC1_FRAMEBUFFER_SETUP_REG(0x9C) = 0x00000000; + + // Disco register + for(volatile uint32_t i = 0; i < 256; i++) + PDC1_FRAMEBUFFER_SETUP_DISCO = 0x10101 * i; + + PDC0_FRAMEBUFFER_SETUP_FBA_ADDR_1 = 0x18300000; + PDC0_FRAMEBUFFER_SETUP_FBA_ADDR_2 = 0x18300000; + PDC0_FRAMEBUFFER_SETUP_FBB_ADDR_1 = 0x18300000; + PDC0_FRAMEBUFFER_SETUP_FBB_ADDR_2 = 0x18300000; + + PDC1_FRAMEBUFFER_SETUP_FBA_ADDR_1 = 0x1835dc00; + PDC1_FRAMEBUFFER_SETUP_FBA_ADDR_2 = 0x1835dc00; // Set not-actually cakebrah framebuffers. Meh. framebuffers->top_left = (uint8_t *)0x18300000; @@ -259,7 +259,7 @@ void screen_mode(uint32_t mode) { WAIT_FOR_ARM9(); } - ctr_cache_clean_and_flush_all(); + ctr_cache_clean_and_flush_all(); invokeArm11Function(ARM11); clearScreens(); diff --git a/source/chainloader.c b/source/chainloader.c index 775b8e5..ec6f960 100644 --- a/source/chainloader.c +++ b/source/chainloader.c @@ -70,7 +70,7 @@ void chainload_file(char* chain_file_data) // Copy CakeHax struct where it is expected (at 0x23FFFE00) // It's very very likely we'll corrupt memory with this, but we aren't coming back anyways as of the // next call, so not my problem - memcpy((void*)0x23FFFE00, framebuffers, sizeof(struct framebuffers)); + memcpy((void*)0x23FFFE00, framebuffers, sizeof(struct framebuffers)); ((void(*)(void*, uint32_t))0x24F00000)(chain_data, size + 256 + 8); // Size of payload + argv. @@ -128,10 +128,10 @@ list_chain_build(char *name) } void chainload_menu() { - if (chains == NULL) { - chains = malloc(sizeof(struct options_s) * 100); - list_chain_build(PATH_CHAINS); - } + if (chains == NULL) { + chains = malloc(sizeof(struct options_s) * 100); + list_chain_build(PATH_CHAINS); + } show_menu(chains, NULL); } diff --git a/source/config-file.c b/source/config-file.c index 99a9584..789d40f 100644 --- a/source/config-file.c +++ b/source/config-file.c @@ -150,7 +150,7 @@ save_config() f_unlink(config_file_path); if (!(conf_handle = fopen(config_file_path, "w"))) - while(1); + while(1); fwrite(config, 1, sizeof(struct config_file) + FCRAM_SPACING / 2, conf_handle); diff --git a/source/firm/decryptor.c b/source/firm/decryptor.c index 4196555..cd628f6 100644 --- a/source/firm/decryptor.c +++ b/source/firm/decryptor.c @@ -38,7 +38,7 @@ ncch_getctr(const ncch_h *ncch, uint8_t *ctr, uint8_t type) void sha256sum(void* sum, void* data, uint32_t size) { - sha_init(SHA256_MODE); + sha_init(SHA256_MODE); sha_update(data, size); sha_get(sum); } diff --git a/source/firm/firm.c b/source/firm/firm.c index 10f0b51..6a6e9b2 100644 --- a/source/firm/firm.c +++ b/source/firm/firm.c @@ -61,7 +61,7 @@ void dump_firm(firm_h** buffer, uint8_t index) { use_aeskey(0x06); set_ctr(ctr); - ctr_decrypt(firm, firm, firm_b_size / AES_BLOCK_SIZE, AES_CNT_CTRNAND_MODE, ctr); + ctr_decrypt(firm, firm, firm_b_size / AES_BLOCK_SIZE, AES_CNT_CTRNAND_MODE, ctr); if (memcmp((char*) & firm->magic, "FIRM", 4)) abort(" Decryption failed on FIRM.\n"); @@ -186,33 +186,33 @@ void* find_section_key() { int decrypt_cetk_key(void *key, const void *cetk) { - static int got_cetk = 0; - uint8_t iv[AES_BLOCK_SIZE] = { 0 }; - uint32_t sigtype = __builtin_bswap32(*(const uint32_t *)cetk); + static int got_cetk = 0; + uint8_t iv[AES_BLOCK_SIZE] = { 0 }; + uint32_t sigtype = __builtin_bswap32(*(const uint32_t *)cetk); - if (sigtype != SIG_TYPE_RSA2048_SHA256) - return 1; + if (sigtype != SIG_TYPE_RSA2048_SHA256) + return 1; - const ticket_h *ticket = (const ticket_h *)((const uint8_t*)cetk + sizeof(sigtype) + 0x13C); - if (ticket->ticketCommonKeyYIndex != 1) - return 1; + const ticket_h *ticket = (const ticket_h *)((const uint8_t*)cetk + sizeof(sigtype) + 0x13C); + if (ticket->ticketCommonKeyYIndex != 1) + return 1; - if (got_cetk == 0) { - fprintf(stderr, " Retrieving 0x3D KeyY...\n"); - extract_slot0x3DkeyY(); - got_cetk = 1; - } + if (got_cetk == 0) { + fprintf(stderr, " Retrieving 0x3D KeyY...\n"); + extract_slot0x3DkeyY(); + got_cetk = 1; + } - use_aeskey(0x3D); + use_aeskey(0x3D); - memcpy(iv, ticket->titleID, sizeof(ticket->titleID)); - memcpy(key, ticket->titleKey, sizeof(ticket->titleKey)); + memcpy(iv, ticket->titleID, sizeof(ticket->titleID)); + memcpy(key, ticket->titleKey, sizeof(ticket->titleKey)); - cbc_decrypt(key, key, 1, AES_CNT_TITLEKEY_DECRYPT_MODE, iv); + cbc_decrypt(key, key, 1, AES_CNT_TITLEKEY_DECRYPT_MODE, iv); - fprintf(stderr, " Extracted titlekey from cetk.\n"); + fprintf(stderr, " Extracted titlekey from cetk.\n"); - return 0; + return 0; } int @@ -507,7 +507,7 @@ load_firms() fprintf(stderr, "FIRM load triggered.\n"); - firm_loc = malloc(firm_size); + firm_loc = malloc(firm_size); fprintf(stderr, "Loading NATIVE_FIRM\n"); if (load_firm(firm_loc, PATH_NATIVE_F, PATH_NATIVE_FIRMKEY, PATH_NATIVE_CETK, &firm_size, NATIVE_FIRM_TITLEID) != 0) { @@ -516,7 +516,7 @@ load_firms() find_proc9(firm_loc, &firm_proc9, &firm_p9_exefs); fprintf(stderr, " Ver: %x, %u\n", get_firm_info(firm_loc)->version, get_firm_info(firm_loc)->console ); - twl_firm_loc = malloc(twl_firm_size); + twl_firm_loc = malloc(twl_firm_size); fprintf(stderr, "TWL_FIRM\n"); if (load_firm(twl_firm_loc, PATH_TWL_F, PATH_TWL_FIRMKEY, PATH_TWL_CETK, &twl_firm_size, TWL_FIRM_TITLEID) != 0) { @@ -527,7 +527,7 @@ load_firms() fprintf(stderr, " Ver: %x, %u\n", get_firm_info(twl_firm_loc)->version, get_firm_info(twl_firm_loc)->console ); } - agb_firm_loc = malloc(agb_firm_size); + agb_firm_loc = malloc(agb_firm_size); fprintf(stderr, "AGB_FIRM\n"); if (load_firm(agb_firm_loc, PATH_AGB_F, PATH_AGB_FIRMKEY, PATH_AGB_CETK, &agb_firm_size, AGB_FIRM_TITLEID) != 0) { diff --git a/source/interpreter.c b/source/interpreter.c index bacfb72..f732ebf 100644 --- a/source/interpreter.c +++ b/source/interpreter.c @@ -673,7 +673,7 @@ execb(char *filename, int build_cache) uint32_t len = fsize(f); - uint8_t* patch_loc = malloc(len); + uint8_t* patch_loc = malloc(len); fread(patch_loc, 1, len, f); fclose(f); diff --git a/source/interrupt.c b/source/interrupt.c index 23753a7..94c5242 100644 --- a/source/interrupt.c +++ b/source/interrupt.c @@ -3,7 +3,7 @@ #include void dump_state_printf(uint32_t* regs) { - fprintf(stderr, " cpsr:%x sp:%x lr:%x\n" + fprintf(stderr, " cpsr:%x sp:%x lr:%x\n" " r0:%x r1:%x r2:%x r3:%x\n" " r4:%x r5:%x r6:%x r7:%x\n" " r8:%x r9:%x r10:%x r11:%x\n" @@ -16,38 +16,38 @@ void dump_state_printf(uint32_t* regs) { } void reset_INT(_UNUSED uint32_t* regs) { - fprintf(stderr, "Reset called.\n"); + fprintf(stderr, "Reset called.\n"); } void undef_INT(uint32_t* regs) { - fprintf(stderr, "Undefined instruction.\n"); - dump_state_printf(regs); - abort("Cannot continue. Halting.\n"); + fprintf(stderr, "Undefined instruction.\n"); + dump_state_printf(regs); + abort("Cannot continue. Halting.\n"); } void swi_INT(_UNUSED uint32_t* regs) { - fprintf(stderr, "SWI called. Returning.\n"); + fprintf(stderr, "SWI called. Returning.\n"); } void preabrt_INT(uint32_t* regs) { - fprintf(stderr, "Prefetch Abort.\n"); - dump_state_printf(regs); - abort("Cannot continue. Halting.\n"); + fprintf(stderr, "Prefetch Abort.\n"); + dump_state_printf(regs); + abort("Cannot continue. Halting.\n"); } void databrt_INT(uint32_t* regs) { - fprintf(stderr, "Data abort.\n"); - dump_state_printf(regs); - abort("Cannot continue. Halting.\n"); + fprintf(stderr, "Data abort.\n"); + dump_state_printf(regs); + abort("Cannot continue. Halting.\n"); } void fiq_INT(_UNUSED uint32_t* regs) { - fprintf(stderr, "FIQ called. Returning.\n"); + fprintf(stderr, "FIQ called. Returning.\n"); } void install_interrupts() { - ctr_interrupt_prepare(); + ctr_interrupt_prepare(); ctr_irq_initialize(); ctr_interrupt_set(CTR_INTERRUPT_RESET, reset_INT); diff --git a/source/menu.c b/source/menu.c index 2fc7a21..337b4e1 100644 --- a/source/menu.c +++ b/source/menu.c @@ -247,7 +247,7 @@ static struct options_s config_opts[] = { }; void config_main_menu() { - show_menu(config_opts, NULL); + show_menu(config_opts, NULL); save_config(); // Save config when exiting. diff --git a/source/patch/emunand.c b/source/patch/emunand.c index a217ac3..c5e92ab 100644 --- a/source/patch/emunand.c +++ b/source/patch/emunand.c @@ -10,7 +10,7 @@ verify_emunand(uint32_t index, uint32_t *off, uint32_t *head) { uint32_t nandSize = getMMCDevice(0)->total_size; - uint8_t *emunand_temp = (uint8_t*)malloc(2048); + uint8_t *emunand_temp = (uint8_t*)malloc(2048); uint32_t offset; if (nandSize > 0x200000) diff --git a/source/std/allocator.c b/source/std/allocator.c index b6b380d..02d4dec 100644 --- a/source/std/allocator.c +++ b/source/std/allocator.c @@ -55,7 +55,7 @@ void* malloc(size_t size) { } void free(void* ptr) { - if (ptr == NULL) return; + if (ptr == NULL) return; free_block* block = (free_block*)(((char*)ptr) - sizeof(free_block )); block->next = free_block_list_head.next; diff --git a/source/std/draw.c b/source/std/draw.c index 89ff74b..efbb6e0 100644 --- a/source/std/draw.c +++ b/source/std/draw.c @@ -36,11 +36,11 @@ uint8_t* font_data = NULL; static uint8_t alphamap[256] = {0}; void std_init() { - for(uint16_t i=0; i < 0x100; i++) { - alphamap[i] = 0; - if (i > 0x7F) - alphamap[i] = i - 0x7F; - } + for(uint16_t i=0; i < 0x100; i++) { + alphamap[i] = 0; + if (i > 0x7F) + alphamap[i] = i - 0x7F; + } top_bg = malloc(TOP_SIZE); bottom_bg = malloc(BOTTOM_SIZE); @@ -192,7 +192,7 @@ void set_font(const char* filename) { unsigned int c_font_w = (new_w / 8) + (new_w % 8 ? 1 : 0); - font_data = malloc(c_font_w * new_h * (256 - ' ')); + font_data = malloc(c_font_w * new_h * (256 - ' ')); fread(font_data, 1, c_font_w * new_h * (256 - ' '), f); // Skip non-printing chars. @@ -381,81 +381,81 @@ int stdout_val = 0, stderr_val = 0; int ansi_statemach(void* buf, const int c) { - int* state = NULL, *val = NULL; + int* state = NULL, *val = NULL; uint8_t *color = NULL; uint8_t color_tmp = 0; if (buf == stdout) { color = &color_top; - state = &stdout_state; - val = &stdout_val; + state = &stdout_state; + val = &stdout_val; } else if (buf == stderr) { color = &color_bottom; - state = &stderr_state; - val = &stderr_val; + state = &stderr_state; + val = &stderr_val; } else { return 0; } - switch(*state) { - case TEXT: - if (c == '\x1b') { - *state = ANSI_NEXT; - return 1; - } - return 0; - case ANSI_NEXT: - if (c == '[') { - *state = ANSI_PARSE; - *val = 0; - return 1; - } - // INVALID; this is a bad ansi sequence. Term early. - *state = TEXT; - return 0; - case ANSI_END: - if (c == ';') { - *state = ANSI_PARSE; // Another code coming up. - } else if(c >= 0x40 && c <= 0x7E) { - *state = TEXT; - } - - return 1; - case ANSI_PARSE: - if (c >= '0' && c <= '9') { - *val *= 10; - *val += (c - '0'); - - *state = ANSI_PARSE; - - if (*val == 0) { - // Reset formatting. - *color = 0xf0; - *state = ANSI_END; - } - - if (*val >= 10) { - switch(*val / 10) { - case 3: // Foreground color - *color &= 0x0f; // Remove fg color. - *color |= ((*val % 30) & 0xf) << 4; + switch(*state) { + case TEXT: + if (c == '\x1b') { + *state = ANSI_NEXT; + return 1; + } + return 0; + case ANSI_NEXT: + if (c == '[') { + *state = ANSI_PARSE; + *val = 0; + return 1; + } + // INVALID; this is a bad ansi sequence. Term early. + *state = TEXT; + return 0; + case ANSI_END: + if (c == ';') { + *state = ANSI_PARSE; // Another code coming up. + } else if(c >= 0x40 && c <= 0x7E) { + *state = TEXT; + } + + return 1; + case ANSI_PARSE: + if (c >= '0' && c <= '9') { + *val *= 10; + *val += (c - '0'); + + *state = ANSI_PARSE; + + if (*val == 0) { + // Reset formatting. + *color = 0xf0; + *state = ANSI_END; + } + + if (*val >= 10) { + switch(*val / 10) { + case 3: // Foreground color + *color &= 0x0f; // Remove fg color. + *color |= ((*val % 30) & 0xf) << 4; break; - case 4: // Background color - *color &= 0xf0; // Remove bg color. - *color |= ((*val % 40) & 0xf); + case 4: // Background color + *color &= 0xf0; // Remove bg color. + *color |= ((*val % 40) & 0xf); break; default: // ??? break; - } - *state = ANSI_END; - } - } - return 1; + } + *state = ANSI_END; + } + } + return 1; default: *state = TEXT; return 1; - } + } return 0; // Should not be reached. } @@ -463,8 +463,8 @@ ansi_statemach(void* buf, const int c) void putc(void *buf, int c) { - if(ansi_statemach(buf, c) == 1) // Inside ANSI escape? - return; + if(ansi_statemach(buf, c) == 1) // Inside ANSI escape? + return; if (buf == stdout || buf == stderr) { if (kill_output) -- 2.39.5