From 944f784c0a137fcab0100c1b649a0de57866fd16 Mon Sep 17 00:00:00 2001 From: "fix94.1" Date: Sat, 14 Jul 2012 16:19:41 +0000 Subject: [PATCH] -added simple dolphin-emu compatility, simply comment in the #define DOLPHIN in the defines.h and compile --- source/defines.h | 4 +++- source/devicemounter/DeviceHandler.cpp | 5 +++++ source/devicemounter/PartitionHandle.cpp | 8 ++++++-- source/loader/alt_ios.cpp | 4 ++++ source/main.cpp | 15 +++++++++++--- source/menu/menu_game.cpp | 26 ++++++++++++++++-------- 6 files changed, 47 insertions(+), 15 deletions(-) diff --git a/source/defines.h b/source/defines.h index 18e20dcb..3b40fad1 100644 --- a/source/defines.h +++ b/source/defines.h @@ -51,4 +51,6 @@ 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}" \ No newline at end of file +#define DUTAG_URL "http://tag.darkumbra.net/{KEY}.update={ID6}" + +//#define DOLPHIN true diff --git a/source/devicemounter/DeviceHandler.cpp b/source/devicemounter/DeviceHandler.cpp index 0b561cbf..c11cadd9 100644 --- a/source/devicemounter/DeviceHandler.cpp +++ b/source/devicemounter/DeviceHandler.cpp @@ -34,7 +34,12 @@ #include "wbfs.h" #include "usbstorage.h" +#ifdef DOLPHIN +#include +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; diff --git a/source/devicemounter/PartitionHandle.cpp b/source/devicemounter/PartitionHandle.cpp index 0fe9c875..cf823b75 100644 --- a/source/devicemounter/PartitionHandle.cpp +++ b/source/devicemounter/PartitionHandle.cpp @@ -37,6 +37,12 @@ #include "ext2.h" #include "wbfs.h" #include +#ifdef DOLPHIN +#include +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) diff --git a/source/loader/alt_ios.cpp b/source/loader/alt_ios.cpp index 57a89925..31a2a949 100644 --- a/source/loader/alt_ios.cpp +++ b/source/loader/alt_ios.cpp @@ -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 } diff --git a/source/main.cpp b/source/main.cpp index fc3340c9..6828c419 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -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; diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index 9d18fd5d..e7b1dd83 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -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 @@ -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 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);