Replace hokey "hooks" struct with weak symbol annotations

- Did a test build to ensure RA built
- Copied over to my FTPservU sources and ensured no compile issues there

Looks solid. A lot cleaner, too.

@aliaspider
This commit is contained in:
gblues 2018-06-07 18:41:16 -07:00
parent f22c337cfc
commit 8b87a53366
3 changed files with 25 additions and 36 deletions

View File

@ -49,7 +49,6 @@
#include "../../retroarch.h"
#include "../../gfx/video_driver.h"
#include "wiiu_main.h"
#include "hbl.h"
#include "wiiu_dbg.h"
#include "system/exception_handler.h"
@ -68,10 +67,6 @@
* The Wii U frontend driver, along with the main() method.
*/
/* TODO: If we want greater control over which filesystems get mounted,
* implement callbacks and assign them below. */
hooks_t hooks = { NULL, NULL };
static enum frontend_fork wiiu_fork_mode = FRONTEND_FORK_NONE;
static const char *elf_path_cst = WIIU_SD_PATH "retroarch/retroarch.elf";

View File

@ -188,36 +188,36 @@ static void try_shutdown_iosuhax(void)
iosuhaxMount = false;
}
__attribute__((weak))
void mount_filesystems(void)
{
if(iosuhaxMount)
fatInitDefault();
else
mount_sd_fat("sd");
}
__attribute__((weak))
void unmount_filesystems(void)
{
if (iosuhaxMount)
{
fatUnmount("sd:");
fatUnmount("usb:");
}
else
unmount_sd_fat("sd");
}
static void fsdev_init(void)
{
iosuhaxMount = try_init_iosuhax();
if(hooks.fs_mount != NULL && hooks.fs_unmount != NULL)
hooks.fs_mount();
else
{
if(iosuhaxMount)
fatInitDefault();
else
mount_sd_fat("sd");
}
mount_filesystems();
}
static void fsdev_exit(void)
{
if(hooks.fs_mount != NULL && hooks.fs_unmount != NULL)
hooks.fs_unmount();
else
{
if (iosuhaxMount)
{
fatUnmount("sd:");
fatUnmount("usb:");
}
else
unmount_sd_fat("sd");
}
unmount_filesystems();
try_shutdown_iosuhax();
}

View File

@ -3,14 +3,8 @@
#include "wiiu/types.h"
struct main_hooks {
void (*fs_mount)(void);
void (*fs_unmount)(void);
};
typedef struct main_hooks hooks_t;
extern hooks_t hooks;
void mount_filesystems(void);
void unmount_filesystems(void);
extern bool iosuhaxMount;
#endif /* _MAIN_H */