From 33cf0e160c2987f6b790ef29aa02d6c2e417e9e2 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 7 May 2020 20:13:02 +0200 Subject: [PATCH] Style nits --- frontend/drivers/platform_wiiu.c | 10 ++-- wiiu/main.c | 79 ++++++++++++++------------------ 2 files changed, 40 insertions(+), 49 deletions(-) diff --git a/frontend/drivers/platform_wiiu.c b/frontend/drivers/platform_wiiu.c index 970d275077..efa677e130 100644 --- a/frontend/drivers/platform_wiiu.c +++ b/frontend/drivers/platform_wiiu.c @@ -80,7 +80,8 @@ static bool exists(char *path) return (stat(path, &stat_buf) == 0); } -static void fix_asset_directory(void) { +static void fix_asset_directory(void) +{ char src_path_buf[PATH_MAX_LENGTH] = {0}; char dst_path_buf[PATH_MAX_LENGTH] = {0}; @@ -190,16 +191,15 @@ static int frontend_wiiu_parse_drive_list(void *data, bool load_content) enum_idx, FILE_TYPE_DIRECTORY, 0, 0); menu_entries_append_enum(list, WIIU_STORAGE_USB_PATH, - msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR), - enum_idx, - FILE_TYPE_DIRECTORY, 0, 0); + msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR), + enum_idx, + FILE_TYPE_DIRECTORY, 0, 0); #endif return 0; } static void frontend_wiiu_exec(const char *path, bool should_load_content) { - struct { u32 magic; diff --git a/wiiu/main.c b/wiiu/main.c index 9a4039f5a1..c6d10f3e2b 100644 --- a/wiiu/main.c +++ b/wiiu/main.c @@ -54,8 +54,8 @@ void __init(void); static void fsdev_init(void); static void fsdev_exit(void); -bool iosuhaxMount = 0; -int fsaFd = -1; +bool iosuhaxMount = 0; +int fsaFd = -1; static int mcp_hook_fd = -1; /* HBL elf entry point */ @@ -91,10 +91,7 @@ void _start(int argc, char **argv) exit(0); } -void __eabi(void) -{ - -} +void __eabi(void) { } __attribute__((weak)) void __init(void) @@ -103,9 +100,8 @@ void __init(void) extern void (*const __CTOR_END__)(void); void (*const *ctor)(void) = &__CTOR_LIST__; - while (ctor < &__CTOR_END__) { + while (ctor < &__CTOR_END__) (*ctor++)(); - } } __attribute__((weak)) @@ -115,30 +111,27 @@ void __fini(void) extern void (*const __DTOR_END__)(void); void (*const *dtor)(void) = &__DTOR_LIST__; - while (dtor < &__DTOR_END__) { + while (dtor < &__DTOR_END__) (*dtor++)(); - } } /* libiosuhax related */ -//just to be able to call async -void someFunc(void *arg) -{ - (void)arg; -} +/* just to be able to call async */ +static void some_func(void *arg) { (void)arg; } #ifdef HAVE_IOSUHAX int MCPHookOpen(void) { - //take over mcp thread + /* take over mcp thread */ mcp_hook_fd = IOS_Open("/dev/mcp", 0); if (mcp_hook_fd < 0) return -1; - IOS_IoctlAsync(mcp_hook_fd, 0x62, (void *)0, 0, (void *)0, 0, someFunc, (void *)0); - //let wupserver start up + IOS_IoctlAsync(mcp_hook_fd, 0x62, (void *)0, 0, + (void *)0, 0, some_func, (void *)0); + /* let wupserver start up */ usleep(1000); if (IOSUHAX_Open("/dev/mcp") < 0) @@ -156,24 +149,26 @@ void MCPHookClose(void) if (mcp_hook_fd < 0) return; - //close down wupserver, return control to mcp + /* close down wupserver, return control to mcp */ IOSUHAX_Close(); - //wait for mcp to return + /* wait for mcp to return */ usleep(1000); IOS_Close(mcp_hook_fd); mcp_hook_fd = -1; } -#endif //HAVE_IOSUHAX +#endif /* HAVE_IOSUHAX */ static bool try_init_iosuhax(void) { #ifdef HAVE_IOSUHAX int result = IOSUHAX_Open(NULL); - if(result < 0) + if (result < 0) result = MCPHookOpen(); - return (result < 0) ? false : true; -#else //don't HAVE_IOSUHAX + if (result < 0) + return false; + return true; +#else /* don't HAVE_IOSUHAX */ return false; #endif } @@ -181,13 +176,13 @@ static bool try_init_iosuhax(void) static void try_shutdown_iosuhax(void) { #ifdef HAVE_IOSUHAX - if(!iosuhaxMount) - return; + if (!iosuhaxMount) + return; if (mcp_hook_fd >= 0) - MCPHookClose(); + MCPHookClose(); else - IOSUHAX_Close(); + IOSUHAX_Close(); #endif //HAVE_IOSUHAX iosuhaxMount = false; @@ -204,17 +199,15 @@ __attribute__((weak)) void __mount_filesystems(void) { #ifdef HAVE_LIBFAT - if(iosuhaxMount) + if (iosuhaxMount) { fatInitDefault(); fsaFd = IOSUHAX_FSA_Open(); mount_fs("storage_usb", fsaFd, NULL, "/vol/storage_usb01"); - } - else - mount_sd_fat("sd"); -#else - mount_sd_fat("sd"); + return; + } #endif + mount_sd_fat("sd"); } /** @@ -229,23 +222,21 @@ void __unmount_filesystems(void) { fatUnmount("sd:"); fatUnmount("usb:"); - + IOSUHAX_sdio_disc_interface.shutdown(); IOSUHAX_usb_disc_interface.shutdown(); unmount_fs("storage_usb"); IOSUHAX_FSA_Close(fsaFd); - - if(mcp_hook_fd >= 0) - MCPHookClose(); - else - IOSUHAX_Close(); + + if (mcp_hook_fd >= 0) + MCPHookClose(); + else + IOSUHAX_Close(); + return; } - else - unmount_sd_fat("sd"); -#else - unmount_sd_fat("sd"); #endif + unmount_sd_fat("sd"); } static void fsdev_init(void)