From: chaoskagami Date: Tue, 17 Jan 2017 13:33:29 +0000 (-0500) Subject: Kill common.h, std/unused.h X-Git-Tag: v0.3.1~28 X-Git-Url: https://chaos.moe/g/?a=commitdiff_plain;h=85a37e20917401c38b679ce2faf72f9f2da23f1d;p=corbenik%2Fcorbenik.git Kill common.h, std/unused.h _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. --- diff --git a/boot/arm11.c b/boot/arm11.c index d5e8593..1cc97b7 100644 --- a/boot/arm11.c +++ b/boot/arm11.c @@ -30,11 +30,15 @@ // Also, this contains quite a few changes from luma's screen.c, which is where it originates from. -#include -#include -#include -#include -#include +#include +#include // for false, true +#include // for uint32_t, uint8_t +#include // for PDC0_FRAMEBUFFER_SETUP_REG, PDC1_FRAMEBU... +#include // for ctr_cache_clean_and_flush_all +#include // for i2cWriteRegister, I2C_DEV_MCU +#include // for memalign +#include // for get_opt_u32, OPTION_BRIGHTNESS +#include // for framebuffers struct framebuffers *framebuffers; diff --git a/boot/chainloader.c b/boot/chainloader.c index 15ac103..12d8048 100644 --- a/boot/chainloader.c +++ b/boot/chainloader.c @@ -1,7 +1,18 @@ #include #if defined(CHAINLOADER) && CHAINLOADER == 1 -#include +#include // for uint32_t, uint8_t +#include // for NULL +#include // for memcpy, strlen, strncpy +#include // for screen_mode +#include // for memalign +#include // for options_s, show_menu, type::option +#include // for panic +#include // for framebuffers, stderr +#include // for crclose, cropen, crread, crsize, recur... +#include // for memfind, strdup_self +#include // 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; diff --git a/boot/configback/dummy.c b/boot/configback/dummy.c index b1bce5c..f04271c 100644 --- a/boot/configback/dummy.c +++ b/boot/configback/dummy.c @@ -1,5 +1,3 @@ -#include - // This is a do-nothing implementation of the configuration backend. // It's solely to show what the access API for config should be. diff --git a/boot/configback/file-dat.c b/boot/configback/file-dat.c index a2f9dfc..db93efb 100644 --- a/boot/configback/file-dat.c +++ b/boot/configback/file-dat.c @@ -1,4 +1,13 @@ -#include +#include // for memalign +#include // for uint8_t, uint32_t +#include // 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; diff --git a/boot/corbenik.c b/boot/corbenik.c index 0e1f189..4a192ea 100644 --- a/boot/corbenik.c +++ b/boot/corbenik.c @@ -1,10 +1,19 @@ - -#include -#include -#include -#include - -#include +#include +#include +#include // for screen_mode, RGBA8, installArm11Stub, set_... +#include // for ctr_hid_get_buttons, CTR_HID_RT +#include // for prepatch_firm, boot_firm +#include // for prepatch_firm, boot_firm +#include // for wait +#include // for install_interrupts +#include // for mallinfo +#include // for poweroff +#include // for get_opt_u32, config, config_file, OPTION_S... +#include // for generate_patch_cache +#include // for clear_disp, stderr, BOTTOM_SCREEN, TOP_SCREEN +#include // for crmount +#include // for CFG_BOOTENV, PDN_MPCORE_CFG +#include // for PATH_AGB_P, PATH_BOTTOM_BG, PATH_MODULE_AGB int is_n3ds = 0; int doing_autoboot = 0; diff --git a/boot/firm/decryptor.c b/boot/firm/decryptor.c index 871dd48..e5fbbb1 100644 --- a/boot/firm/decryptor.c +++ b/boot/firm/decryptor.c @@ -1,9 +1,12 @@ -#include -#include -#include - +#include // for uint8_t, uint32_t +#include // for uint8_t, uint32_t +#include // 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 +#include // 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) diff --git a/boot/firm/firm.c b/boot/firm/firm.c index f45d9dc..da89d3d 100644 --- a/boot/firm/firm.c +++ b/boot/firm/firm.c @@ -1,13 +1,16 @@ -#include -#include - -#include -#include -#include -#include - +#include // for NULL, size_t +#include // for uint64_t, uint8_t +#include // for free +#include // for memcmp +#include // 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 +#include // 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) diff --git a/boot/firm/firmlaunch.c b/boot/firm/firmlaunch.c index b84f269..ac597b7 100644 --- a/boot/firm/firmlaunch.c +++ b/boot/firm/firmlaunch.c @@ -1,9 +1,15 @@ -#include -#include -#include - +#include // for uint32_t, uint8_t +#include // for free +#include // for memmove +#include +#include +#include #define FIRM_INTERNAL_CODE -#include +#include // 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; diff --git a/boot/firm/keys.c b/boot/firm/keys.c index 2b409ed..49c2aae 100644 --- a/boot/firm/keys.c +++ b/boot/firm/keys.c @@ -1,10 +1,12 @@ -#include - -#include -#include - +#include // for uint8_t, uint32_t +#include // for use_aeskey, AES_BLOCK_SIZE, setup_aeskey +#include +#include +#include #define FIRM_INTERNAL_CODE -#include +#include // 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] = { diff --git a/boot/firm/util.c b/boot/firm/util.c index 11fc78c..2d8ff59 100644 --- a/boot/firm/util.c +++ b/boot/firm/util.c @@ -1,13 +1,17 @@ -#include -#include - -#include -#include -#include -#include - +#include // for NULL, size_t +#include // for uint8_t, uint32_t +#include // for free, atoi +#include // for memcpy, memcmp +#include // for AES_BLOCK_SIZE, use_aeskey, cbc_decrypt +#include // 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 +#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; diff --git a/boot/firm/version.c b/boot/firm/version.c index f7c0bc0..53f62b7 100644 --- a/boot/firm/version.c +++ b/boot/firm/version.c @@ -1,7 +1,12 @@ -#include - +#include // for memalign +#include // for NULL +#include // 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 +#include // lines 4-4 +#include "std/memory.h" // for memfind struct firm_signature * get_firm_info(firm_h *firm) diff --git a/boot/input.c b/boot/input.c index bd26cf7..a50cb8d 100644 --- a/boot/input.c +++ b/boot/input.c @@ -1,12 +1,14 @@ -#include -#include +#include // for uint32_t +#include // for get_opt_u32, OPTION_TRACE +#include // 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"); } diff --git a/boot/interpreter.c b/boot/interpreter.c index 4dd504c..4d53e13 100644 --- a/boot/interpreter.c +++ b/boot/interpreter.c @@ -1,9 +1,20 @@ #include #include -#include "std/unused.h" #ifndef LOADER - #include + #include // for size_t, NULL + #include // for uint8_t, uint32_t, uint16_t, uint64_t + #include // for malloc, free + #include // for strlen, memcmp, memcpy + #include // for firm_section_h, firm_h + #include // for wait + #include // for memalign + #include // for get_opt_u32, OPTION_OVERLY_VERBOSE + #include // for panic + #include // for stderr + #include // for crclose, cropen, crsize, crread, crwrite + #include // for memfind + #include // for system_patch, PATH_LOADER_CACHE #else #ifndef PATH_MAX #define PATH_MAX 255 diff --git a/boot/interrupt.c b/boot/interrupt.c index 1800e31..c2b6d38 100644 --- a/boot/interrupt.c +++ b/boot/interrupt.c @@ -1,6 +1,8 @@ -#include -#include -#include +#include // for uint32_t +#include // for ctr_interrupt_set, ctr_interrupt_pre... +#include // for ctr_irq_initialize +#include // for panic +#include // 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"); } diff --git a/boot/menu-backend.c b/boot/menu-backend.c index fe6a191..f0f7914 100644 --- a/boot/menu-backend.c +++ b/boot/menu-backend.c @@ -1,4 +1,10 @@ -#include +#include // for uint32_t +#include // for NULL +#include // for wait_key +#include // for options_s, type::unselectable, type::optio... +#include // for get_opt_u32, OPTION_ACCENT_COLOR +#include // 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: diff --git a/boot/menu.c b/boot/menu.c index a7ce9a1..bec382c 100644 --- a/boot/menu.c +++ b/boot/menu.c @@ -1,5 +1,18 @@ -#include -#include +#include // for uint32_t, uint8_t +#include // for NULL +#include // for memcmp +#include // for ctr_system_poweroff, ctr_system_reset +#include // for memalign +#include // for type::unselectable, type::option, opti... +#include // for get_opt, toggle_opt, save_config, OPTI... +#include +#include // for generate_patch_cache +#include // for crflush, BOTTOM_SCREEN, stderr +#include // for crumount, read_file, recurse_call +#include // for strdup_self +#include // 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. diff --git a/boot/patch/emunand.c b/boot/patch/emunand.c index abb6471..53494ef 100644 --- a/boot/patch/emunand.c +++ b/boot/patch/emunand.c @@ -2,8 +2,17 @@ * emunand.c */ -#include -#include +#include // for memalign +#include // for uint32_t, uint8_t, uint16_t, uintptr_t +#include // 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) diff --git a/boot/patch/module.c b/boot/patch/module.c index 9fce54e..ab593f6 100644 --- a/boot/patch/module.c +++ b/boot/patch/module.c @@ -1,4 +1,10 @@ -#include +#include // for uint8_t, uint32_t +#include // for free, malloc +#include // 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. */ diff --git a/boot/patch/reboot.c b/boot/patch/reboot.c index c5e354b..3a56b0b 100644 --- a/boot/patch/reboot.c +++ b/boot/patch/reboot.c @@ -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 -#include +#include // for uint32_t, uint8_t +#include // for fprintf, size_t, FILE +#include // 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) diff --git a/boot/patch/svc.c b/boot/patch/svc.c index 5349ba0..00209d0 100644 --- a/boot/patch/svc.c +++ b/boot/patch/svc.c @@ -1,4 +1,10 @@ -#include +#include // for uint32_t, uint8_t +#include // 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; diff --git a/boot/patcher.c b/boot/patcher.c index 99f89b6..e01d166 100644 --- a/boot/patcher.c +++ b/boot/patcher.c @@ -1,5 +1,15 @@ -#include -#include +#include // for uint8_t, uint64_t +#include // for memcmp +#include // for firm_h +#include // for wait +#include // for cache_patch, execb +#include // for get_opt_u32, OPTION_EMUNAND, OPTION_EM... +#include // for patch_emunand +#include // for patch_modules, patch_reboot, patch_svc... +#include // for panic +#include // for recurse_call, read_file, rrmdir +#include // 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; diff --git a/boot/std/abort.c b/boot/std/abort.c index fcc387b..49d5ca7 100644 --- a/boot/std/abort.c +++ b/boot/std/abort.c @@ -1,8 +1,10 @@ #ifndef __ABORT_H #define __ABORT_H -#include -#include +#include // 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; diff --git a/boot/std/draw.c b/boot/std/draw.c index bd5c12c..595c817 100644 --- a/boot/std/draw.c +++ b/boot/std/draw.c @@ -1,8 +1,14 @@ -#include -#include -#include -#include -#include +#include // for ::_ISprint, isprint +#include // for va_arg, va_list, va_end, va_start +#include // for uint8_t, uint32_t, int64_t, uint64_t +#include // for malloc +#include // 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; diff --git a/boot/std/fs.c b/boot/std/fs.c index 3094c7a..b5a40fd 100644 --- a/boot/std/fs.c +++ b/boot/std/fs.c @@ -1,6 +1,14 @@ -#include -#include -#include +#include // for size_t, NULL +#include // for int64_t, uint32_t +#include // for free, malloc +#include // 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; diff --git a/boot/std/memory.c b/boot/std/memory.c index e1a277c..9f6fa94 100644 --- a/boot/std/memory.c +++ b/boot/std/memory.c @@ -1,7 +1,7 @@ -#include - -#include -#include +#include // for size_t, NULL +#include // for uint32_t, uint8_t +#include // for malloc +#include // for memcpy, strlen, memcmp char* strdup_self(const char* str) diff --git a/include/common.h b/include/common.h deleted file mode 100644 index e698971..0000000 --- a/include/common.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __COMMON_H -#define __COMMON_H - -#include -#include - -#include - -#include -#include - -#include - -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#endif diff --git a/include/input.h b/include/input.h index 7fdfa79..0a0edae 100644 --- a/include/input.h +++ b/include/input.h @@ -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 index 93f287d..0000000 --- a/include/std/unused.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __UNUSED_H -#define __UNUSED_H - -#define _UNUSED __attribute__((unused)) - -#endif diff --git a/loader/source/patcher.c b/loader/source/patcher.c index 4032f22..ac5b81a 100644 --- a/loader/source/patcher.c +++ b/loader/source/patcher.c @@ -7,7 +7,6 @@ #include "memory.h" #include "logger.h" #include -#include #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. }