-added simple dolphin-emu compatility, simply comment in the

#define DOLPHIN in the defines.h and compile
This commit is contained in:
fix94.1 2012-07-14 16:19:41 +00:00
parent 5a5fab8579
commit 944f784c0a
6 changed files with 47 additions and 15 deletions

View File

@ -52,3 +52,5 @@ postLoader"
#define WIINNERTAG_URL "http://www.wiinnertag.com/wiinnertag_scripts/update_sign.php?key={KEY}&game_id={ID6}"
#define DUTAG_URL "http://tag.darkumbra.net/{KEY}.update={ID6}"
//#define DOLPHIN true

View File

@ -34,7 +34,12 @@
#include "wbfs.h"
#include "usbstorage.h"
#ifdef DOLPHIN
#include <sdcard/wiisd_io.h>
const DISC_INTERFACE __io_sdhc = __io_wiisd;
#else
extern const DISC_INTERFACE __io_sdhc;
#endif
DeviceHandler * DeviceHandler::instance = NULL;
unsigned int DeviceHandler::watchdog_timeout = 10;

View File

@ -37,6 +37,12 @@
#include "ext2.h"
#include "wbfs.h"
#include <sdcard/gcsd.h>
#ifdef DOLPHIN
#include <sdcard/wiisd_io.h>
const DISC_INTERFACE __io_sdhc = __io_wiisd;
#else
extern const DISC_INTERFACE __io_sdhc;
#endif
#define PARTITION_TYPE_DOS33_EXTENDED 0x05 /* DOS 3.3+ extended partition */
#define PARTITION_TYPE_WIN95_EXTENDED 0x0F /* Windows 95 extended partition */
@ -45,8 +51,6 @@
#define CACHE 32
#define SECTORS 64
extern const DISC_INTERFACE __io_sdhc;
extern u32 sector_size;
static inline const char * PartFromType(int type)

View File

@ -68,6 +68,7 @@ u32 IOSPATCH_AHBPROT()
bool loadIOS(int ios, bool launch_game)
{
#ifndef DOLPHIN
gprintf("Reloading into IOS %i from %i (AHBPROT: %u)...\n", ios, IOS_GetVersion(), HAVE_AHBPROT);
Close_Inputs();
@ -90,4 +91,7 @@ bool loadIOS(int ios, bool launch_game)
Open_Inputs();
return iosOK;
#else
return true;
#endif
}

View File

@ -63,6 +63,7 @@ int main(int argc, char **argv)
else if (argv[i] != NULL && strcasestr(argv[i], "EMULATOR_MAGIC") != NULL)
Emulator_boot = true;
}
#ifndef DOLPHIN
// Load Custom IOS
gprintf("Loading cIOS: %d\n", mainIOS);
bool iosOK = loadIOS(mainIOS, false);
@ -71,6 +72,9 @@ int main(int argc, char **argv)
ISFS_Initialize();
iosOK = iosOK && cIOSInfo::D2X(mainIOS, &mainIOSBase);
gprintf("Loaded cIOS: %u has base %u\n", mainIOS, mainIOSBase);
#else
bool iosOK = true;
#endif
// Init
Sys_Init();
@ -81,7 +85,7 @@ int main(int argc, char **argv)
while(ret == 1)
{
Open_Inputs(); //(re)init wiimote
#ifndef DOLPHIN
bool deviceAvailable = false;
u8 timeout = 0;
while(!deviceAvailable && timeout++ != 20)
@ -97,7 +101,11 @@ int main(int argc, char **argv)
}
if(DeviceHandler::Instance()->IsInserted(SD))
deviceAvailable = true;
#else
bool deviceAvailable = true;
DeviceHandler::Instance()->MountAll();
sleep(1);
#endif
bool dipOK = Disc_Init() >= 0;
mainMenu = new CMenu(vid);
@ -128,8 +136,9 @@ int main(int argc, char **argv)
}
}
mainMenu->cleanup();
#ifndef DOLPHIN
ISFS_Deinitialize();
#endif
Sys_Exit();
exit(1);
return 0;

View File

@ -16,8 +16,6 @@
#include "loader/wbfs.h"
#include "wip.h"
#include "channel_launcher.h"
#include "devicemounter/sdhc.h"
#include "devicemounter/usbstorage.h"
#include "BannerWindow.hpp"
#include <network.h>
@ -40,6 +38,11 @@
#include "gc/gcdisc.hpp"
#include "Gekko.h"
#ifndef DOLPHIN
#include "devicemounter/sdhc.h"
#include "devicemounter/usbstorage.h"
#endif
extern const u8 btngamecfg_png[];
extern const u8 btngamecfgs_png[];
extern const u8 stopkidon_png[];
@ -852,10 +855,11 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
m_cat.save(true);
m_cfg.save(true);
cleanup();
#ifndef DOLPHIN
ISFS_Deinitialize();
USBStorage_Deinit();
SDHC_Init();
#endif
GC_SetVideoMode(DMLvideoMode, videoSetting);
GC_SetLanguage(GClanguage);
if(!m_devo_installed || strcasestr(path.c_str(), "boot.bin") != NULL)
@ -892,9 +896,10 @@ void CMenu::_launchHomebrew(const char *filepath, vector<string> arguments)
AddBootArgument(filepath);
for(u32 i = 0; i < arguments.size(); ++i)
AddBootArgument(arguments[i].c_str());
#ifndef DOLPHIN
ISFS_Deinitialize();
USBStorage_Deinit();
#endif
//MEM2_clear();
BootHomebrew(title);
}
@ -1105,8 +1110,9 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
_loadFile(cheatFile, cheatSize, m_cheatDir.c_str(), fmt("%s.gct", id.c_str()));
ocarina_load_code(cheatFile.get(), cheatSize);
}
#ifndef DOLPHIN
ISFS_Deinitialize();
#endif
if(forwarder)
{
WII_Initialize();
@ -1312,10 +1318,9 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
m_cat.save(true);
m_cfg.save(true);
cleanup(); // wifi and sd gecko doesnt work anymore after cleanup
#ifndef DOLPHIN
ISFS_Deinitialize();
bool iosLoaded = false;
if(!dvd || cIOSInfo::neek2o())
{
int result = _loadIOS(gameIOS, userIOS, id);
@ -1324,6 +1329,9 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
if(result == LOAD_IOS_SUCCEEDED)
iosLoaded = true;
}
#else
bool iosLoaded = true;
#endif
if(!m_directLaunch)
{
if (rtrn != NULL && strlen(rtrn) == 4)
@ -1385,11 +1393,11 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
return;
}
}
#ifndef DOLPHIN
USBStorage_Deinit();
if(currentPartition == 0)
SDHC_Init();
#endif
/* Find game partition offset */
u64 offset;
s32 ret = Disc_FindPartition(&offset);