Style nits

This commit is contained in:
twinaphex 2020-05-07 20:13:02 +02:00
parent b78c48c2c3
commit 33cf0e160c
2 changed files with 40 additions and 49 deletions

View File

@ -80,7 +80,8 @@ static bool exists(char *path)
return (stat(path, &stat_buf) == 0); 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 src_path_buf[PATH_MAX_LENGTH] = {0};
char dst_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, enum_idx,
FILE_TYPE_DIRECTORY, 0, 0); FILE_TYPE_DIRECTORY, 0, 0);
menu_entries_append_enum(list, WIIU_STORAGE_USB_PATH, menu_entries_append_enum(list, WIIU_STORAGE_USB_PATH,
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR), msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
enum_idx, enum_idx,
FILE_TYPE_DIRECTORY, 0, 0); FILE_TYPE_DIRECTORY, 0, 0);
#endif #endif
return 0; return 0;
} }
static void frontend_wiiu_exec(const char *path, bool should_load_content) static void frontend_wiiu_exec(const char *path, bool should_load_content)
{ {
struct struct
{ {
u32 magic; u32 magic;

View File

@ -54,8 +54,8 @@ void __init(void);
static void fsdev_init(void); static void fsdev_init(void);
static void fsdev_exit(void); static void fsdev_exit(void);
bool iosuhaxMount = 0; bool iosuhaxMount = 0;
int fsaFd = -1; int fsaFd = -1;
static int mcp_hook_fd = -1; static int mcp_hook_fd = -1;
/* HBL elf entry point */ /* HBL elf entry point */
@ -91,10 +91,7 @@ void _start(int argc, char **argv)
exit(0); exit(0);
} }
void __eabi(void) void __eabi(void) { }
{
}
__attribute__((weak)) __attribute__((weak))
void __init(void) void __init(void)
@ -103,9 +100,8 @@ void __init(void)
extern void (*const __CTOR_END__)(void); extern void (*const __CTOR_END__)(void);
void (*const *ctor)(void) = &__CTOR_LIST__; void (*const *ctor)(void) = &__CTOR_LIST__;
while (ctor < &__CTOR_END__) { while (ctor < &__CTOR_END__)
(*ctor++)(); (*ctor++)();
}
} }
__attribute__((weak)) __attribute__((weak))
@ -115,30 +111,27 @@ void __fini(void)
extern void (*const __DTOR_END__)(void); extern void (*const __DTOR_END__)(void);
void (*const *dtor)(void) = &__DTOR_LIST__; void (*const *dtor)(void) = &__DTOR_LIST__;
while (dtor < &__DTOR_END__) { while (dtor < &__DTOR_END__)
(*dtor++)(); (*dtor++)();
}
} }
/* libiosuhax related */ /* libiosuhax related */
//just to be able to call async /* just to be able to call async */
void someFunc(void *arg) static void some_func(void *arg) { (void)arg; }
{
(void)arg;
}
#ifdef HAVE_IOSUHAX #ifdef HAVE_IOSUHAX
int MCPHookOpen(void) int MCPHookOpen(void)
{ {
//take over mcp thread /* take over mcp thread */
mcp_hook_fd = IOS_Open("/dev/mcp", 0); mcp_hook_fd = IOS_Open("/dev/mcp", 0);
if (mcp_hook_fd < 0) if (mcp_hook_fd < 0)
return -1; return -1;
IOS_IoctlAsync(mcp_hook_fd, 0x62, (void *)0, 0, (void *)0, 0, someFunc, (void *)0); IOS_IoctlAsync(mcp_hook_fd, 0x62, (void *)0, 0,
//let wupserver start up (void *)0, 0, some_func, (void *)0);
/* let wupserver start up */
usleep(1000); usleep(1000);
if (IOSUHAX_Open("/dev/mcp") < 0) if (IOSUHAX_Open("/dev/mcp") < 0)
@ -156,24 +149,26 @@ void MCPHookClose(void)
if (mcp_hook_fd < 0) if (mcp_hook_fd < 0)
return; return;
//close down wupserver, return control to mcp /* close down wupserver, return control to mcp */
IOSUHAX_Close(); IOSUHAX_Close();
//wait for mcp to return /* wait for mcp to return */
usleep(1000); usleep(1000);
IOS_Close(mcp_hook_fd); IOS_Close(mcp_hook_fd);
mcp_hook_fd = -1; mcp_hook_fd = -1;
} }
#endif //HAVE_IOSUHAX #endif /* HAVE_IOSUHAX */
static bool try_init_iosuhax(void) static bool try_init_iosuhax(void)
{ {
#ifdef HAVE_IOSUHAX #ifdef HAVE_IOSUHAX
int result = IOSUHAX_Open(NULL); int result = IOSUHAX_Open(NULL);
if(result < 0) if (result < 0)
result = MCPHookOpen(); result = MCPHookOpen();
return (result < 0) ? false : true; if (result < 0)
#else //don't HAVE_IOSUHAX return false;
return true;
#else /* don't HAVE_IOSUHAX */
return false; return false;
#endif #endif
} }
@ -181,13 +176,13 @@ static bool try_init_iosuhax(void)
static void try_shutdown_iosuhax(void) static void try_shutdown_iosuhax(void)
{ {
#ifdef HAVE_IOSUHAX #ifdef HAVE_IOSUHAX
if(!iosuhaxMount) if (!iosuhaxMount)
return; return;
if (mcp_hook_fd >= 0) if (mcp_hook_fd >= 0)
MCPHookClose(); MCPHookClose();
else else
IOSUHAX_Close(); IOSUHAX_Close();
#endif //HAVE_IOSUHAX #endif //HAVE_IOSUHAX
iosuhaxMount = false; iosuhaxMount = false;
@ -204,17 +199,15 @@ __attribute__((weak))
void __mount_filesystems(void) void __mount_filesystems(void)
{ {
#ifdef HAVE_LIBFAT #ifdef HAVE_LIBFAT
if(iosuhaxMount) if (iosuhaxMount)
{ {
fatInitDefault(); fatInitDefault();
fsaFd = IOSUHAX_FSA_Open(); fsaFd = IOSUHAX_FSA_Open();
mount_fs("storage_usb", fsaFd, NULL, "/vol/storage_usb01"); mount_fs("storage_usb", fsaFd, NULL, "/vol/storage_usb01");
} return;
else }
mount_sd_fat("sd");
#else
mount_sd_fat("sd");
#endif #endif
mount_sd_fat("sd");
} }
/** /**
@ -229,23 +222,21 @@ void __unmount_filesystems(void)
{ {
fatUnmount("sd:"); fatUnmount("sd:");
fatUnmount("usb:"); fatUnmount("usb:");
IOSUHAX_sdio_disc_interface.shutdown(); IOSUHAX_sdio_disc_interface.shutdown();
IOSUHAX_usb_disc_interface.shutdown(); IOSUHAX_usb_disc_interface.shutdown();
unmount_fs("storage_usb"); unmount_fs("storage_usb");
IOSUHAX_FSA_Close(fsaFd); IOSUHAX_FSA_Close(fsaFd);
if(mcp_hook_fd >= 0) if (mcp_hook_fd >= 0)
MCPHookClose(); MCPHookClose();
else else
IOSUHAX_Close(); IOSUHAX_Close();
return;
} }
else
unmount_sd_fat("sd");
#else
unmount_sd_fat("sd");
#endif #endif
unmount_sd_fat("sd");
} }
static void fsdev_init(void) static void fsdev_init(void)