]> Chaos Git - corbenik/corbenik.git/commitdiff
Fix up tabs (again)
authorchaoskagami <chaos.kagami@gmail.com>
Sat, 20 Aug 2016 16:05:59 +0000 (12:05 -0400)
committerchaoskagami <chaos.kagami@gmail.com>
Sat, 20 Aug 2016 16:05:59 +0000 (12:05 -0400)
source/arm11.c
source/chainloader.c
source/config-file.c
source/firm/decryptor.c
source/firm/firm.c
source/interpreter.c
source/interrupt.c
source/menu.c
source/patch/emunand.c
source/std/allocator.c
source/std/draw.c

index f8566aa3683ca759220f3597cd1f4733fe3eb040..9a447d13203a29fd99df716ecacb2d7f3be62ec2 100644 (file)
@@ -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();
index 775b8e56ddff664bf7fe0feaf5cbc696b11d89fb..ec6f9603d799c3a4c6c136243b4db160e6814182 100644 (file)
@@ -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);
 }
index 99a9584c1f43421a1ddeaa41a1f844212db12098..789d40f21ee09f6e915c69fb320586c19066b18a 100644 (file)
@@ -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);
 
index 4196555771003187e48c9e9eebea41d19caea910..cd628f6671c4830c9b081e7dc500fd1817299ad6 100644 (file)
@@ -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);
 }
index 10f0b519df1057c22cf9737e1baf0a3c350f7549..6a6e9b2d7ee06b9f047c191c843660f22dc2516b 100644 (file)
@@ -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) {
index bacfb72069160bbf1e327195364741bfad153e77..f732ebf72437edf76b4343ae8bc5ba7ab7c7fd58 100644 (file)
@@ -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);
index 23753a77b2af6292cd236117aa371f8a3f4dc413..94c5242704d1062defac12230bb6ca00319464ec 100644 (file)
@@ -3,7 +3,7 @@
 #include <ctr9/ctr_irq.h>
 
 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);
index 2fc7a21d4e06d1a93b63545a50838c4b4a861609..337b4e1781db53ad285cb32375a465f306d9948c 100644 (file)
@@ -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.
 
index a217ac389c8beeb6dcd21d0d1b965935f2094eb2..c5e92ab95a6203b8403ac3bffc9b6ffed0b382eb 100644 (file)
@@ -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)
index b6b380d2e53056c4d62158c97f89c2d1a8cbf07e..02d4dec25c0f3b8e16acfb34142fb96be4d89ea1 100644 (file)
@@ -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;
index 89ff74b996f339534f9c2e7564acf4532839038a..efbb6e0936a9010c0ae58cf74e1f930046758ac4 100644 (file)
@@ -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)