]> Chaos Git - corbenik/corbenik.git/commitdiff
Kill common.h, std/unused.h
authorchaoskagami <chaos.kagami@gmail.com>
Tue, 17 Jan 2017 13:33:29 +0000 (08:33 -0500)
committerchaoskagami <chaos.kagami@gmail.com>
Tue, 17 Jan 2017 13:33:29 +0000 (08:33 -0500)
_UNUSED is a stupid macro and I should just use __attribute__((unused)) directly.
This will never build on anything aside from GCC or clang anyways, since msvc is shit
that targets windows and armcc is proprietary and expensive.

Clean up includes massively; the mess was mainly due to common.h "abstracting" all
the dependencies, allowing me to be lazy and not properly componentize code. Now all
files include solely what they need, which is a step in the right direction of unfucking
all the cross-dependencies.

This would have been much more painful to figure out were it not for include-what-you-use
(https://github.com/include-what-you-use/include-what-you-use) so next time you dig your
grave into source dependency hell using a common header, try that tool.

29 files changed:
boot/arm11.c
boot/chainloader.c
boot/configback/dummy.c
boot/configback/file-dat.c
boot/corbenik.c
boot/firm/decryptor.c
boot/firm/firm.c
boot/firm/firmlaunch.c
boot/firm/keys.c
boot/firm/util.c
boot/firm/version.c
boot/input.c
boot/interpreter.c
boot/interrupt.c
boot/menu-backend.c
boot/menu.c
boot/patch/emunand.c
boot/patch/module.c
boot/patch/reboot.c
boot/patch/svc.c
boot/patcher.c
boot/std/abort.c
boot/std/draw.c
boot/std/fs.c
boot/std/memory.c
include/common.h [deleted file]
include/input.h
include/std/unused.h [deleted file]
loader/source/patcher.c

index d5e859336f6d80bdd8ef7cfc4ac7be8184189fce..1cc97b7abb9b1c74b6437881c12b7fd41a594a61 100644 (file)
 
 //   Also, this contains quite a few changes from luma's screen.c, which is where it originates from.
 
-#include <common.h>
-#include <ctr9/io.h>
-#include <ctr9/ctr_screen.h>
-#include <ctr9/ctr_cache.h>
-#include <ctr9/i2c.h>
+#include <string.h>
+#include <stdbool.h>         // for false, true
+#include <stdint.h>          // for uint32_t, uint8_t
+#include <arm11.h>           // for PDC0_FRAMEBUFFER_SETUP_REG, PDC1_FRAMEBU...
+#include <ctr9/ctr_cache.h>  // for ctr_cache_clean_and_flush_all
+#include <ctr9/i2c.h>        // for i2cWriteRegister, I2C_DEV_MCU
+#include <malloc.h>          // for memalign
+#include <option.h>          // for get_opt_u32, OPTION_BRIGHTNESS
+#include <std/draw.h>        // for framebuffers
 
 struct framebuffers *framebuffers;
 
index 15ac103e360a8d31c984c8ab67f29562901a397f..12d8048594c840084d7e90783b023c430a249db9 100644 (file)
@@ -1,7 +1,18 @@
 #include <corbconf.h>
 #if defined(CHAINLOADER) && CHAINLOADER == 1
 
-#include <common.h>
+#include <stdint.h>            // for uint32_t, uint8_t
+#include <stdlib.h>            // for NULL
+#include <string.h>            // for memcpy, strlen, strncpy
+#include <arm11.h>             // for screen_mode
+#include <malloc.h>            // for memalign
+#include <menu-backend.h>      // for options_s, show_menu, type::option
+#include <std/abort.h>         // for panic
+#include <std/draw.h>          // for framebuffers, stderr
+#include <std/fs.h>            // for crclose, cropen, crread, crsize, recur...
+#include <std/memory.h>        // for memfind, strdup_self
+#include <structures.h>        // for PATH_BITS, PATH_CHAINS
+#include "ctr9/io/fatfs/ff.h"  // for FILINFO, f_stat, ::FR_OK, AM_DIR
 
 uint32_t current_chain_index = 0;
 struct options_s *chains = NULL;
index b1bce5c1eb60a07e2fdddd79d353654409bf37ae..f04271c6a0076a2aeee47cf11dc44dfb66486e60 100644 (file)
@@ -1,5 +1,3 @@
-#include <common.h>
-
 // This is a do-nothing implementation of the configuration backend.
 // It's solely to show what the access API for config should be.
 
index a2f9dfc14a9a2e8e008043f7bf8050621907ad89..db93efb830dd2672e7bbc45c8e90e6c3aca0e915 100644 (file)
@@ -1,4 +1,13 @@
-#include <common.h>
+#include <malloc.h>               // for memalign
+#include <stdint.h>               // for uint8_t, uint32_t
+#include <string.h>               // for memset, strncpy, memcmp, strcpy, NULL
+#include "config.h"               // for SYSCONFDIR, BINDIR, LIBDIR, LIBEXECDIR
+#include "ctr9/io/fatfs/ff.h"     // for f_mkdir, f_unlink
+#include "ctr9/io/sdmmc/sdmmc.h"  // for sdmmc_get_cid
+#include "menu.h"                 // for add_patch_menu, poweroff, reset_pat...
+#include "option.h"               // for config_file, OPTION_ACCENT_COLOR
+#include "std/fs.h"               // for cropen, crclose, crwrite, crread
+#include "structures.h"           // for PATH_AGB_F, PATH_AUX_PATCHES, PATH_...
 
 FILE *conf_handle;
 
index 0e1f189835620129e05e6d5666b37e4b49377403..4a192eab827a8fd3403da2958e8ff016936a6c2e 100644 (file)
@@ -1,10 +1,19 @@
-
-#include <ctr9/ctr_hid.h>
-#include <ctr9/io.h>
-#include <ctr9/ctr_screen.h>
-#include <ctr9/i2c.h>
-
-#include <common.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <arm11.h>         // for screen_mode, RGBA8, installArm11Stub, set_...
+#include <ctr9/ctr_hid.h>  // for ctr_hid_get_buttons, CTR_HID_RT
+#include <firm/headers.h>     // for prepatch_firm, boot_firm
+#include <firm/firm.h>     // for prepatch_firm, boot_firm
+#include <input.h>         // for wait
+#include <interrupt.h>     // for install_interrupts
+#include <malloc.h>        // for mallinfo
+#include <menu.h>          // for poweroff
+#include <option.h>        // for get_opt_u32, config, config_file, OPTION_S...
+#include <patcher.h>       // for generate_patch_cache
+#include <std/draw.h>      // for clear_disp, stderr, BOTTOM_SCREEN, TOP_SCREEN
+#include <std/fs.h>        // for crmount
+#include <std/types.h>     // for CFG_BOOTENV, PDN_MPCORE_CFG
+#include <structures.h>    // for PATH_AGB_P, PATH_BOTTOM_BG, PATH_MODULE_AGB
 
 int is_n3ds = 0;
 int doing_autoboot = 0;
index 871dd484650e2fd12aac040409123ace5fb4f21d..e5fbbb1576c1bbea19af36d4a938d5349e8ebc4c 100644 (file)
@@ -1,9 +1,12 @@
-#include <common.h>
-#include <ctr9/aes.h>
-#include <ctr9/sha.h>
-
+#include <stdint.h>          // for uint8_t, uint32_t
+#include <stddef.h>          // for uint8_t, uint32_t
+#include <ctr9/sha.h>        // for sha_get, sha_init, sha_update, SHA256_MODE
+#include "firm/headers.h"    // for ncch_h, MEDIA_UNITS
+#include "firm/keys.h"    // for ncch_h, MEDIA_UNITS
+#include "firm/firm.h"    // for ncch_h, MEDIA_UNITS
 #define FIRM_INTERNAL_CODE
-#include <firm/internal.h>
+#include <firm/internal.h>  // lines 6-6
+#include "firm/decryptor.h"  // for ::NCCHTYPE_EXEFS, ::NCCHTYPE_EXHEADER
 
 void
 ncch_getctr(const ncch_h *ncch, uint8_t *ctr, uint8_t type)
index f45d9dc4c58f1a8d2336bd926aa7e6d62ba88371..da89d3d2b248e4de5e519a7db0ff59cb84e89250 100644 (file)
@@ -1,13 +1,16 @@
-#include <stdint.h>
-#include <stddef.h>
-
-#include <ctr9/io.h>
-#include <ctr9/aes.h>
-#include <ctr9/sha.h>
-#include <common.h>
-
+#include <stddef.h>         // for NULL, size_t
+#include <stdint.h>         // for uint64_t, uint8_t
+#include <stdlib.h>         // for free
+#include <string.h>         // for memcmp
+#include <malloc.h>         // for memalign
+#include "firm/headers.h"   // for firm_h, ncch_h
+#include "firm/keys.h"   // for firm_h, ncch_h
+#include "firm/firm.h"      // for firm_signature, get_firm_info, consoles::...
 #define FIRM_INTERNAL_CODE
-#include <firm/internal.h>
+#include <firm/internal.h>  // for dec_k9l, extract_firm_from_ncch, firmlaunch
+#include "patcher.h"        // for patch_firm_all
+#include "std/fs.h"         // for cropen, crclose, crwrite, crread, crsize
+#include "std/memory.h"     // for strdupcat
 
 firm_h*
 load_firm(const char *path, size_t *size_out)
index b84f269a6bbdc8a990fa5f74649ce8d98fbd9652..ac597b7ffeb918995f75f15f8b2299c2f4e67d6f 100644 (file)
@@ -1,9 +1,15 @@
-#include <common.h>
-#include <ctr9/aes.h>
-#include <ctr9/sha.h>
-
+#include <stdint.h>         // for uint32_t, uint8_t
+#include <stdlib.h>         // for free
+#include <string.h>         // for memmove
+#include <firm/headers.h>
+#include <firm/keys.h>
+#include <firm/firm.h>
 #define FIRM_INTERNAL_CODE
-#include <firm/internal.h>
+#include <firm/internal.h>  // for void_call
+#include "arm11.h"          // for deinitScreens
+#include "firm/headers.h"   // for firm_section_h, firm_h
+#include "std/draw.h"       // for crflush, stderr
+#include "std/fs.h"         // for crumount
 
 static volatile uint32_t *const a11_entry = (volatile uint32_t *)0x1FFFFFF8;
 
index 2b409edea050f31ae8bdcfff6975d83bafedb74a..49c2aae011dec339d0159a6a0d9f38a0232b48a1 100644 (file)
@@ -1,10 +1,12 @@
-#include <common.h>
-
-#include <ctr9/aes.h>
-#include <ctr9/sha.h>
-
+#include <stdint.h>      // for uint8_t, uint32_t
+#include <ctr9/aes.h>    // for use_aeskey, AES_BLOCK_SIZE, setup_aeskey
+#include <firm/headers.h>
+#include <firm/keys.h>
+#include <firm/firm.h>
 #define FIRM_INTERNAL_CODE
-#include <firm/internal.h>
+#include <firm/internal.h>  // lines 7-7
+#include "std/fs.h"      // for crclose, cropen, crread
+#include "structures.h"  // for PATH_SLOT0X11KEY95, PATH_SLOT0X11KEY96
 
 int set_N11_K9L(uint32_t index) {
     static uint8_t ss_keyn[2][16] = {
index 11fc78c52eea5e9a2374f92fed960dc9174b99f8..2d8ff59944aaff346e89cf62621729768736dcd6 100644 (file)
@@ -1,13 +1,17 @@
-#include <stdint.h>
-#include <stddef.h>
-
-#include <ctr9/io.h>
-#include <ctr9/aes.h>
-#include <ctr9/sha.h>
-#include <common.h>
-
+#include <stddef.h>          // for NULL, size_t
+#include <stdint.h>          // for uint8_t, uint32_t
+#include <stdlib.h>          // for free, atoi
+#include <string.h>          // for memcpy, memcmp
+#include <ctr9/aes.h>        // for AES_BLOCK_SIZE, use_aeskey, cbc_decrypt
+#include <malloc.h>          // for memalign
+#include "firm/headers.h"    // for firm_h, firm_section_h, ncch_h, arm9bin_h
+#include "firm/keys.h"    // for firm_h, firm_section_h, ncch_h, arm9bin_h
+#include "firm/decryptor.h"  // for sha256sum, ncch_getctr, ::NCCHTYPE_EXEFS
+#include "firm/firm.h"       // for firm_type::type_native, firm_signature
 #define FIRM_INTERNAL_CODE
 #include <firm/internal.h>
+#include "std/fs.h"          // for crclose, cropen, crread, crsize
+#include "std/memory.h"      // for memfind
 
 int decrypt_k9l(arm9bin_h *header, enum firm_type type, uint32_t k9l) {
     uint8_t slot = 0x15;
index f7c0bc0ee07561411db4078fb2627811d50e712b..53f62b76ff373501f6864c89da2f7817591dd154 100644 (file)
@@ -1,7 +1,12 @@
-#include <common.h>
-
+#include <malloc.h>        // for memalign
+#include <stddef.h>        // for NULL
+#include <stdint.h>        // for uint8_t
+#include "firm/headers.h"  // for firm_section_h, firm_h, FIRM_TYPE_ARM9
+#include "firm/keys.h"  // for firm_section_h, firm_h, FIRM_TYPE_ARM9
+#include "firm/firm.h"     // for firm_signature, consoles::console_o3ds
 #define FIRM_INTERNAL_CODE
-#include <firm/internal.h>
+#include <firm/internal.h>  // lines 4-4
+#include "std/memory.h"    // for memfind
 
 struct firm_signature *
 get_firm_info(firm_h *firm)
index bd26cf79a82f17072abb24ea4a6ee59118ab4d16..a50cb8da8611abd8c909c61552dfcf7b3c9617c1 100644 (file)
@@ -1,12 +1,14 @@
-#include <stdint.h>
-#include <common.h>
+#include <stdint.h>        // for uint32_t
+#include <option.h>        // for get_opt_u32, OPTION_TRACE
+#include <std/draw.h>      // for screenshot, stderr
+#include "ctr9/ctr_hid.h"  // for ctr_hid_get_buttons, CTR_HID_A, CTR_HID_B
 
 extern void waitcycles(uint32_t cycles);
 
 #define ARM9_APPROX_DELAY_MAX 134058675 / 95
 
 uint32_t
-wait_key(_UNUSED int sleep)
+wait_key()
 {
     uint32_t ret = 0, get = 0;
     while (ret == 0) {
@@ -47,7 +49,7 @@ wait(void)
 {
     if (get_opt_u32(OPTION_TRACE) && !doing_autoboot) {
         fprintf(stderr, "[Waiting...]");
-        wait_key(0); // No delay on traces.
+        wait_key(); // No delay on traces.
     }
     fprintf(stderr, "\r            \r");
 }
index 4dd504cfb8f5fbe4d108dffd329306c23d05b75c..4d53e1351cdeacf788fea1c8302143bf5a258d8d 100644 (file)
@@ -1,9 +1,20 @@
 #include <stdint.h>
 #include <stddef.h>
-#include "std/unused.h"
 
 #ifndef LOADER
-  #include <common.h>
+  #include <stddef.h>        // for size_t, NULL
+  #include <stdint.h>        // for uint8_t, uint32_t, uint16_t, uint64_t
+  #include <stdlib.h>        // for malloc, free
+  #include <string.h>        // for strlen, memcmp, memcpy
+  #include <firm/headers.h>  // for firm_section_h, firm_h
+  #include <input.h>         // for wait
+  #include <malloc.h>        // for memalign
+  #include <option.h>        // for get_opt_u32, OPTION_OVERLY_VERBOSE
+  #include <std/abort.h>     // for panic
+  #include <std/draw.h>      // for stderr
+  #include <std/fs.h>        // for crclose, cropen, crsize, crread, crwrite
+  #include <std/memory.h>    // for memfind
+  #include <structures.h>    // for system_patch, PATH_LOADER_CACHE
 #else
   #ifndef PATH_MAX
     #define PATH_MAX 255
index 1800e31f36ffe77c5173567edcde179841ec3e1d..c2b6d38ec892c78eb2bc288a66e709ef424af992 100644 (file)
@@ -1,6 +1,8 @@
-#include <common.h>
-#include <ctr9/ctr_interrupt.h>
-#include <ctr9/ctr_irq.h>
+#include <stdint.h>              // for uint32_t
+#include <ctr9/ctr_interrupt.h>  // for ctr_interrupt_set, ctr_interrupt_pre...
+#include <ctr9/ctr_irq.h>        // for ctr_irq_initialize
+#include <std/abort.h>           // for panic
+#include <std/draw.h>            // for stderr
 
 void dump_state_printf(uint32_t* regs) {
     fprintf(stderr, "  cpsr:%x sp:%x pc:%x\n"
@@ -15,7 +17,7 @@ void dump_state_printf(uint32_t* regs) {
                     (unsigned int)regs[15]);
 }
 
-void reset_INT(_UNUSED uint32_t* regs) {
+void reset_INT(__attribute((unused)) uint32_t* regs) {
     fprintf(stderr, "Reset called.\n");
 }
 
@@ -25,7 +27,7 @@ void undef_INT(uint32_t* regs) {
     panic("Cannot continue. Halting.\n");
 }
 
-void swi_INT(_UNUSED uint32_t* regs) {
+void swi_INT(__attribute__((unused)) uint32_t* regs) {
     fprintf(stderr, "SWI called. Returning.\n");
 }
 
@@ -41,7 +43,7 @@ void databrt_INT(uint32_t* regs) {
     panic("Cannot continue. Halting.\n");
 }
 
-void fiq_INT(_UNUSED uint32_t* regs) {
+void fiq_INT(__attribute__((unused)) uint32_t* regs) {
     fprintf(stderr, "FIQ called. Returning.\n");
 }
 
index fe6a19106cab2370682bcbdca5e1b0c46f50a12c..f0f7914abb1a7c765783034c544db15679c66378 100644 (file)
@@ -1,4 +1,10 @@
-#include <common.h>
+#include <stdint.h>        // for uint32_t
+#include <stdlib.h>        // for NULL
+#include <input.h>         // for wait_key
+#include <menu-backend.h>  // for options_s, type::unselectable, type::optio...
+#include <option.h>        // for get_opt_u32, OPTION_ACCENT_COLOR
+#include <std/draw.h>      // for TOP_SCREEN, clear_disp, set_cursor, stdout
+#include "ctr9/ctr_hid.h"  // for CTR_HID_A, CTR_HID_B, CTR_HID_DOWN, CTR_HI...
 
 extern int is_n3ds;
 extern unsigned int font_w;
@@ -18,7 +24,7 @@ void show_help(const char* help) {
     set_cursor(TOP_SCREEN, 0, 0);
     header("Any:Back");
     fprintf(stdout, "%s", help);
-    wait_key(1);
+    wait_key();
 }
 
 void accent_color(void* screen, int fg) {
@@ -47,7 +53,7 @@ show_menu(struct options_s *options)
         set_cursor(TOP_SCREEN, 0, 0);
         header("Any:Back");
         fprintf(stdout, "No entries.\n");
-        wait_key(1);
+        wait_key();
         return 0;
     }
 
@@ -125,7 +131,7 @@ show_menu(struct options_s *options)
             fprintf(TOP_SCREEN, "%s\x1b[0m", options[i].name);
         }
 
-        uint32_t key = wait_key(1);
+        uint32_t key = wait_key();
 
         switch (key) {
             case CTR_HID_UP:
index a7ce9a14abfcc44bf93da6e2c3d70eb5bc741589..bec382c6d9d7779f66b627f54f3b6549dbe8499d 100644 (file)
@@ -1,5 +1,18 @@
-#include <common.h>
-#include <ctr9/ctr_system.h>
+#include <stdint.h>            // for uint32_t, uint8_t
+#include <stdlib.h>            // for NULL
+#include <string.h>            // for memcmp
+#include <ctr9/ctr_system.h>   // for ctr_system_poweroff, ctr_system_reset
+#include <malloc.h>            // for memalign
+#include <menu-backend.h>      // for type::unselectable, type::option, opti...
+#include <option.h>            // for get_opt, toggle_opt, save_config, OPTI...
+#include <firm/headers.h>
+#include <patcher.h>           // for generate_patch_cache
+#include <std/draw.h>          // for crflush, BOTTOM_SCREEN, stderr
+#include <std/fs.h>            // for crumount, read_file, recurse_call
+#include <std/memory.h>        // for strdup_self
+#include <structures.h>        // for system_patch, PATH_AUX_PATCHES, PATH_L...
+#include "config.h"            // for LOCALSTATEDIR
+#include "ctr9/io/fatfs/ff.h"  // for FILINFO, f_stat, ::FR_OK, AM_DIR
 
 // FIXME - Remove limit
 #define MAX_PATCHES 256
@@ -23,6 +36,8 @@ void chainload_menu();
 #define lnh(s) { s, "", unselectable, 0, NULL, NULL, 0, 1 }
 
 void config_main_menu();
+void poweroff();
+void reset();
 
 static struct options_s options[] = {
     // Patches.
index abb64710ec4f88c993cd5abf952cdd2e07b05bd8..53494efce4ab1213145cbd9846dba03960a58604 100644 (file)
@@ -2,8 +2,17 @@
 *   emunand.c
 */
 
-#include <ctr9/io.h>
-#include <common.h>
+#include <malloc.h>               // for memalign
+#include <stdint.h>               // for uint32_t, uint8_t, uint16_t, uintptr_t
+#include <stdlib.h>               // for free
+#include "ctr9/io/sdmmc/sdmmc.h"  // for sdmmc_sdcard_readsectors, getMMCDevice
+#include "firm/headers.h"         // for firm_section_h, firm_h, exefs_file_h
+#include "firm/firm.h"            // for find_proc9
+#include "std/abort.h"            // for panic
+#include "std/draw.h"             // for stderr
+#include "std/fs.h"               // for crclose, cropen, crread, crsize
+#include "std/memory.h"           // for memfind
+#include "structures.h"           // for PATH_EMUNAND_CODE
 
 void
 verify_emunand(uint32_t index, uint32_t *off, uint32_t *head)
index 9fce54e8017b8901f63c12ba1c41072ac8d524e8..ab593f693844e647f133f444c7e94c4535fe04c5 100644 (file)
@@ -1,4 +1,10 @@
-#include <common.h>
+#include <stdint.h>            // for uint8_t, uint32_t
+#include <stdlib.h>            // for free, malloc
+#include <string.h>            // for memmove, memcmp, memcpy
+#include "ctr9/io/fatfs/ff.h"  // for FILINFO, f_stat, ::FR_OK, AM_DIR
+#include "firm/headers.h"      // for ncch_h, firm_section_h, firm_h, NCCH_M...
+#include "std/draw.h"          // for stderr
+#include "std/fs.h"            // for crclose, cropen, crread, crsize, recur...
 
 /* Not possible to be implemented as bytecode. Hey, can't win em all. */
 
index c5e354b1b8c223aa6f79ea823ccbcc9b6f7f19fb..3a56b0b09d5a3eb0e96ea8bacaa1ebf43c2a8c6c 100644 (file)
@@ -1,8 +1,16 @@
 /* This code was all nicked from Luma (before the GPL headers were corrected by TuxSH)
    Someone please remind me to fix this code.*/
 
-#include <common.h>
-#include <ctr9/io.h>
+#include <stdint.h>        // for uint32_t, uint8_t
+#include <stddef.h>         // for fprintf, size_t, FILE
+#include <string.h>        // for memcpy
+#include "firm/headers.h"  // for firm_section_h, firm_h
+#include "input.h"         // for wait
+#include "std/abort.h"     // for panic
+#include "std/draw.h"      // for stderr
+#include "std/fs.h"        // for crclose, cropen, crread, crsize
+#include "std/memory.h"    // for memfind
+#include "structures.h"    // for PATH_AGB_P, PATH_NATIVE_P, PATH_TWL_P, PAT...
 
 uint8_t*
 getProcess9(uint8_t *pos, uint32_t size, uint32_t *process9Size, uint32_t *process9MemAddr)
index 5349ba0664102ee6473d4ee3a4acd7c2efc735ab..00209d0d6f1ffcaa5187d505fd3f388593d2a200 100644 (file)
@@ -1,4 +1,10 @@
-#include <common.h>
+#include <stdint.h>        // for uint32_t, uint8_t
+#include <stddef.h>         // for fprintf, NULL, FILE
+#include "firm/headers.h"  // for firm_section_h, firm_h
+#include "std/draw.h"      // for stderr
+#include "std/fs.h"        // for crclose, cropen, crread, crsize
+#include "std/memory.h"    // for memfind
+#include "structures.h"    // for PATH_BACKDOOR
 
 uint8_t *arm11Section1 = NULL;
 uint32_t *svc_tab_open = NULL, *exceptionsPage = NULL, *svcTable = NULL;
index 99f89b6e15dcd3a2a9f3e4c3562bd9346b249afc..e01d1666eb3fb800a45f601007fbc41e44e198c9 100644 (file)
@@ -1,5 +1,15 @@
-#include <common.h>
-#include <stdint.h>
+#include <stdint.h>            // for uint8_t, uint64_t
+#include <string.h>            // for memcmp
+#include <firm/headers.h>      // for firm_h
+#include <input.h>             // for wait
+#include <interp.h>            // for cache_patch, execb
+#include <option.h>            // for get_opt_u32, OPTION_EMUNAND, OPTION_EM...
+#include <patch/emunand.h>     // for patch_emunand
+#include <patcher.h>           // for patch_modules, patch_reboot, patch_svc...
+#include <std/abort.h>         // for panic
+#include <std/fs.h>            // for recurse_call, read_file, rrmdir
+#include <structures.h>        // for system_patch, PATH_TEMP, PATH_AUX_PATCHES
+#include "ctr9/io/fatfs/ff.h"  // for f_mkdir, FILINFO, f_stat, ::FR_OK, AM_DIR
 
 extern int doing_autoboot;
 
index fcc387b7ebae6f65f8e2cbd5edf69b66748360c3..49d5ca7ffb3645ea5ff55f22f8f6ce253072301a 100644 (file)
@@ -1,8 +1,10 @@
 #ifndef __ABORT_H
 #define __ABORT_H
 
-#include <stdarg.h>
-#include <common.h>
+#include <stdarg.h>    // for va_end, va_list, va_start
+#include "input.h"     // for wait_key
+#include "menu.h"      // for poweroff
+#include "std/draw.h"  // for stderr, clear_disp, set_cursor
 
 void panic(char* x, ...) {
     va_list ap;
index bd5c12c61d87048d5afe951408bd7ae5e5806cd4..595c8174b06a4dc30d4d76311468fde1e59e78a1 100644 (file)
@@ -1,8 +1,14 @@
-#include <stdint.h>
-#include <assert.h>
-#include <stdarg.h>
-#include <common.h>
-#include <ctr9/io.h>
+#include <ctype.h>             // for ::_ISprint, isprint
+#include <stdarg.h>            // for va_arg, va_list, va_end, va_start
+#include <stdint.h>            // for uint8_t, uint32_t, int64_t, uint64_t
+#include <stdlib.h>            // for malloc
+#include <string.h>            // for memset, NULL, size_t, memcpy, strlen
+#include "ctr9/io/fatfs/ff.h"  // for f_unlink
+#include "option.h"            // for get_opt_u32, OPTION_DIM_MODE, OPTION_S...
+#include "std/abort.h"         // for panic
+#include "std/draw.h"          // for framebuffers, SCREEN_DEPTH, stderr
+#include "std/fs.h"            // for crwrite, crclose, cropen, crread, crseek
+#include "structures.h"        // for PATH_TEMP, PATH_BOOTLOG
 
 static unsigned int top_cursor_x = 0, top_cursor_y = 0;
 static unsigned int bottom_cursor_x = 0, bottom_cursor_y = 0;
@@ -291,7 +297,7 @@ draw_character(uint8_t *screen, const unsigned int character, unsigned int ch_x,
     if (!isprint(character))
         return; // Don't output non-printables.
 
-    _UNUSED unsigned int width = 0;
+    unsigned int width = 0;
     unsigned int height = 0;
     uint8_t* buffer_bg;
     if (screen == framebuffers->top_left || screen == framebuffers->top_right) {
@@ -471,7 +477,7 @@ putc(void *buf, int c)
             return;
 
         unsigned int width = 0;
-        _UNUSED unsigned int height = 0;
+        unsigned int height = 0;
         unsigned int *cursor_x = NULL;
         unsigned int *cursor_y = NULL;
         uint8_t *screen = NULL;
index 3094c7a7f628fb9d8dcce35beb9fc362ea3eb817..b5a40fdb4ba977cab039e25d1307d6993c028245 100644 (file)
@@ -1,6 +1,14 @@
-#include <stddef.h>
-#include <ctr9/io.h>
-#include <common.h>
+#include <stddef.h>                      // for size_t, NULL
+#include <stdint.h>                      // for int64_t, uint32_t
+#include <stdlib.h>                      // for free, malloc
+#include <string.h>                      // for memset, strcpy, strnlen, str...
+#include "ctr9/io/ctr_fatfs.h"           // for ctr_fatfs_initialize
+#include "ctr9/io/ctr_nand_interface.h"  // for ctr_nand_interface
+#include "ctr9/io/ctr_sd_interface.h"    // for ctr_sd_interface
+#include "ctr9/io/fatfs/ff.h"            // for FILINFO, f_mount, ::FR_OK
+#include "ctr9/io/fatfs/integer.h"       // for UINT
+#include "option.h"                      // for set_opt_u32, OPTION_SAVE_LOGS
+#include "std/fs.h"                      // for SEEK_CUR, SEEK_END, SEEK_SET
 
 // ctr_nand_crypto_interface ctr_io;
 // ctr_nand_crypto_interface twl_io;
index e1a277c02d87e358409b0f9f5552dcfa9fb44a69..9f6fa9463bd5d8b0f2a66b47172a5e0c0f294d7d 100644 (file)
@@ -1,7 +1,7 @@
-#include <common.h>
-
-#include <stdint.h>
-#include <stddef.h>
+#include <stddef.h>  // for size_t, NULL
+#include <stdint.h>  // for uint32_t, uint8_t
+#include <stdlib.h>  // for malloc
+#include <string.h>  // for memcpy, strlen, memcmp
 
 char*
 strdup_self(const char* str)
diff --git a/include/common.h b/include/common.h
deleted file mode 100644 (file)
index e698971..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef __COMMON_H
-#define __COMMON_H
-
-#include <stdlib.h>
-#include <malloc.h>
-
-#include <corbconf.h>
-
-#include <std/unused.h>
-#include <std/abort.h>
-
-#include <std/types.h>
-
-#include <structures.h>
-
-#include <std/memory.h>
-#include <std/fs.h>
-#include <std/draw.h>
-
-#include <firm/headers.h>
-#include <firm/decryptor.h>
-#include <firm/firm.h>
-#include <firm/keys.h>
-
-#include <menu.h>
-#include <menu-backend.h>
-#include <arm11.h>
-#include <interrupt.h>
-#include <option.h>
-#include <input.h>
-#include <interp.h>
-#include <patcher.h>
-
-#include <patch/patch_file.h>
-#include <patch/emunand.h>
-
-#endif
index 7fdfa79dab73e31647f7bf8b5df799f080b7a654..0a0edae0afa47a2343d97c7869c751aeacf25efb 100644 (file)
@@ -5,10 +5,9 @@
 
 /* Waits for a single key to be pressed and released, returning the key when done.
  *
- * \param sleep Unused. Previously would add some delay to each read for dpads with issues.
  * \return The key pressed and released.
  */
-uint32_t wait_key(_UNUSED int sleep);
+uint32_t wait_key();
 
 /* Displays a prompt on the bottom screen if the relevant option is enabled and waits on input
  * to continue.
diff --git a/include/std/unused.h b/include/std/unused.h
deleted file mode 100644 (file)
index 93f287d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __UNUSED_H
-#define __UNUSED_H
-
-#define _UNUSED __attribute__((unused))
-
-#endif
index 4032f225e086609cd071c234d353e870ee6b743d..ac5b81a0f722cd6192647a5f9d07eec053acfb32 100644 (file)
@@ -7,7 +7,6 @@
 #include "memory.h"
 #include "logger.h"
 #include <structures.h>
-#include <std/unused.h>
 #include "interp.h"
 
 #ifndef PATH_MAX
@@ -288,7 +287,7 @@ patchCfgGetRegion(uint8_t *code, uint32_t size, uint8_t regionId, uint32_t CFGUH
 }
 
 static void
-adjust_cpu_settings(_UNUSED uint64_t progId, EXHEADER_prog_addrs *shared)
+adjust_cpu_settings(__attribute__((unused)) uint64_t progId, EXHEADER_prog_addrs *shared)
 {
     uint8_t* code = (uint8_t*)shared->text_addr;
     uint32_t size = shared->text_size << 12;
@@ -462,7 +461,7 @@ code_handler(uint64_t progId, EXHEADER_prog_addrs *shared)
 
 // This is only for the .code segment.
 void
-patch_exe(uint64_t progId, uint16_t progver, EXHEADER_prog_addrs* shared, _UNUSED EXHEADER_prog_addrs* original)
+patch_exe(uint64_t progId, uint16_t progver, EXHEADER_prog_addrs* shared, __attribute__((unused)) EXHEADER_prog_addrs* original)
 {
     if (progId == 0x0004013000008002LL)
         adjust_cpu_settings(progId, shared);
@@ -474,28 +473,28 @@ patch_exe(uint64_t progId, uint16_t progver, EXHEADER_prog_addrs* shared, _UNUSE
 
 // Gets how many bytes .text must be extended by for patches to fit.
 uint32_t
-get_text_extend(_UNUSED uint64_t progId, _UNUSED uint16_t progver, _UNUSED uint32_t size_orig)
+get_text_extend(__attribute__((unused)) uint64_t progId, __attribute__((unused)) uint16_t progver, __attribute__((unused)) uint32_t size_orig)
 {
     return 0; // Stub - nothing needs this yet
 }
 
 // Gets how many bytes .ro must be extended.
 uint32_t
-get_ro_extend(_UNUSED uint64_t progId, _UNUSED uint16_t progver, _UNUSED uint32_t size_orig)
+get_ro_extend(__attribute__((unused)) uint64_t progId, __attribute__((unused)) uint16_t progver, __attribute__((unused)) uint32_t size_orig)
 {
     return 0; // Stub - nothing needs this yet
 }
 
 // Again, same, but for .data.
 uint32_t
-get_data_extend(_UNUSED uint64_t progId, _UNUSED uint16_t progver, _UNUSED uint32_t size_orig)
+get_data_extend(__attribute__((unused)) uint64_t progId, __attribute__((unused)) uint16_t progver, __attribute__((unused)) uint32_t size_orig)
 {
     return 0; // Stub - nothing needs this yet
 }
 
 // Get CPU speed for progId.
 uint8_t
-get_cpumode(_UNUSED uint64_t progId)
+get_cpumode(__attribute__((unused)) uint64_t progId)
 {
     return 0xff; // Skip.
 }