mirror of
https://github.com/libretro/RetroArch
synced 2025-02-19 12:41:00 +00:00
Merge pull request #6862 from gblues/master
WIIU: cleanups to wiiu bootstrap code
This commit is contained in:
commit
a3ae537c02
@ -49,7 +49,6 @@
|
|||||||
#include "../../retroarch.h"
|
#include "../../retroarch.h"
|
||||||
#include "../../gfx/video_driver.h"
|
#include "../../gfx/video_driver.h"
|
||||||
|
|
||||||
|
|
||||||
#include "hbl.h"
|
#include "hbl.h"
|
||||||
#include "wiiu_dbg.h"
|
#include "wiiu_dbg.h"
|
||||||
#include "system/exception_handler.h"
|
#include "system/exception_handler.h"
|
||||||
|
@ -22,12 +22,16 @@ extern "C" {
|
|||||||
|
|
||||||
#define SO_REUSEADDR 0x0004
|
#define SO_REUSEADDR 0x0004
|
||||||
#define SO_NBIO 0x1014
|
#define SO_NBIO 0x1014
|
||||||
|
#define SO_NONBLOCK 0x1016
|
||||||
|
|
||||||
|
|
||||||
/* return codes */
|
/* return codes */
|
||||||
#define SO_SUCCESS 0
|
#define SO_SUCCESS 0
|
||||||
#define SO_EWOULDBLOCK 6
|
#define SO_EWOULDBLOCK 6
|
||||||
|
|
||||||
|
#define EWOULDBLOCK SO_EWOULDBLOCK
|
||||||
|
#define EAGAIN SO_EWOULDBLOCK
|
||||||
|
#define ENOBUFS 105 /* No buffer space available */
|
||||||
|
|
||||||
typedef uint32_t socklen_t;
|
typedef uint32_t socklen_t;
|
||||||
typedef uint16_t sa_family_t;
|
typedef uint16_t sa_family_t;
|
||||||
|
85
wiiu/main.c
85
wiiu/main.c
@ -50,7 +50,8 @@ void __init(void);
|
|||||||
static void fsdev_init(void);
|
static void fsdev_init(void);
|
||||||
static void fsdev_exit(void);
|
static void fsdev_exit(void);
|
||||||
|
|
||||||
static int iosuhaxMount = 0;
|
bool iosuhaxMount = 0;
|
||||||
|
|
||||||
static int mcp_hook_fd = -1;
|
static int mcp_hook_fd = -1;
|
||||||
|
|
||||||
/* HBL elf entry point */
|
/* HBL elf entry point */
|
||||||
@ -163,35 +164,69 @@ void MCPHookClose(void)
|
|||||||
mcp_hook_fd = -1;
|
mcp_hook_fd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool try_init_iosuhax(void)
|
||||||
|
{
|
||||||
|
int result = IOSUHAX_Open(NULL);
|
||||||
|
if(result < 0)
|
||||||
|
result = MCPHookOpen();
|
||||||
|
|
||||||
|
return (result < 0) ? false : true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void try_shutdown_iosuhax(void)
|
||||||
|
{
|
||||||
|
if(!iosuhaxMount)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (mcp_hook_fd >= 0)
|
||||||
|
MCPHookClose();
|
||||||
|
else
|
||||||
|
IOSUHAX_Close();
|
||||||
|
|
||||||
|
iosuhaxMount = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mount the filesystem(s) needed by the application. By default, we
|
||||||
|
* mount the SD card to /sd.
|
||||||
|
*
|
||||||
|
* The 'iosuhaxMount' symbol used here is public and can be referenced
|
||||||
|
* in overriding implementations.
|
||||||
|
*/
|
||||||
|
__attribute__((weak))
|
||||||
|
void __mount_filesystems(void)
|
||||||
|
{
|
||||||
|
if(iosuhaxMount)
|
||||||
|
fatInitDefault();
|
||||||
|
else
|
||||||
|
mount_sd_fat("sd");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unmount filesystems. Implementing applications should be careful to
|
||||||
|
* clean up anything mounted in __mount_filesystems() here.
|
||||||
|
*/
|
||||||
|
__attribute__((weak))
|
||||||
|
void __unmount_filesystems(void)
|
||||||
|
{
|
||||||
|
if (iosuhaxMount)
|
||||||
|
{
|
||||||
|
fatUnmount("sd:");
|
||||||
|
fatUnmount("usb:");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
unmount_sd_fat("sd");
|
||||||
|
}
|
||||||
|
|
||||||
static void fsdev_init(void)
|
static void fsdev_init(void)
|
||||||
{
|
{
|
||||||
iosuhaxMount = 0;
|
iosuhaxMount = try_init_iosuhax();
|
||||||
int res = IOSUHAX_Open(NULL);
|
|
||||||
|
|
||||||
if (res < 0)
|
__mount_filesystems();
|
||||||
res = MCPHookOpen();
|
|
||||||
|
|
||||||
if (res < 0)
|
|
||||||
mount_sd_fat("sd");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
iosuhaxMount = 1;
|
|
||||||
fatInitDefault();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fsdev_exit(void)
|
static void fsdev_exit(void)
|
||||||
{
|
{
|
||||||
if (iosuhaxMount)
|
__unmount_filesystems();
|
||||||
{
|
try_shutdown_iosuhax();
|
||||||
fatUnmount("sd:");
|
|
||||||
fatUnmount("usb:");
|
|
||||||
|
|
||||||
if (mcp_hook_fd >= 0)
|
|
||||||
MCPHookClose();
|
|
||||||
else
|
|
||||||
IOSUHAX_Close();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
unmount_sd_fat("sd");
|
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,9 @@
|
|||||||
#include "wiiu_dbg.h"
|
#include "wiiu_dbg.h"
|
||||||
#include "exception_handler.h"
|
#include "exception_handler.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
#ifdef HAVE_GIT_VERSION
|
||||||
#include "version_git.h"
|
#include "version_git.h"
|
||||||
|
#endif
|
||||||
/* Settings */
|
/* Settings */
|
||||||
#define NUM_STACK_TRACE_LINES 5
|
#define NUM_STACK_TRACE_LINES 5
|
||||||
|
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
/* coreinit */
|
/* coreinit */
|
||||||
IMPORT_BEGIN(coreinit);
|
IMPORT_BEGIN(coreinit);
|
||||||
|
|
||||||
|
IMPORT(OSScreenInit);
|
||||||
|
IMPORT(OSScreenGetBufferSizeEx);
|
||||||
|
IMPORT(OSScreenSetBufferEx);
|
||||||
|
IMPORT(OSScreenEnableEx);
|
||||||
|
IMPORT(OSScreenFlipBuffersEx);
|
||||||
|
IMPORT(OSScreenClearBufferEx);
|
||||||
|
IMPORT(OSScreenPutFontEx);
|
||||||
IMPORT(OSFatal);
|
IMPORT(OSFatal);
|
||||||
IMPORT(OSDynLoad_Acquire);
|
IMPORT(OSDynLoad_Acquire);
|
||||||
IMPORT(OSDynLoad_FindExport);
|
IMPORT(OSDynLoad_FindExport);
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <wiiu/os.h>
|
#include <wiiu/os.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <features/features_cpu.h>
|
|
||||||
#include <sys/reent.h>
|
#include <sys/reent.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
#ifdef WIIU
|
#ifdef __wiiu__
|
||||||
#include <wiiu/types.h>
|
#include <wiiu/types.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
Loading…
x
Reference in New Issue
Block a user