WIP commit: Added support for neek2o (rev 88 and up)

This commit is contained in:
overjoy.psm 2012-07-13 13:16:13 +00:00
parent 077bc500d1
commit cd156d17b7
8 changed files with 91 additions and 27 deletions

View File

@ -37,10 +37,25 @@
#define ARRAY_SIZE(a) (sizeof a / sizeof a[0]) #define ARRAY_SIZE(a) (sizeof a / sizeof a[0])
static u32 allowedBases[] = { 37, 38, 53, 55, 56, 57, 58 }; static u32 allowedBases[] = { 37, 38, 53, 55, 56, 57, 58 };
static u32 boot2version = 0;
bool cIOSInfo::neek2o(void)
{
if(!boot2version)
ES_GetBoot2Version(&boot2version);
return boot2version > 4 ? true : false;
}
/* Check if the cIOS is a D2X. */ /* Check if the cIOS is a D2X. */
bool cIOSInfo::D2X(u8 ios, u8 *base) bool cIOSInfo::D2X(u8 ios, u8 *base)
{ {
if(neek2o())
{
*base = (u8)IOS_GetVersion();
return true;
}
iosinfo_t *info = GetInfo(ios); iosinfo_t *info = GetInfo(ios);
if(!info) if(!info)
return false; return false;

View File

@ -16,6 +16,7 @@ typedef struct _iosinfo_t
class cIOSInfo class cIOSInfo
{ {
public: public:
static bool neek2o(void);
static bool D2X(u8 ios, u8 *base); static bool D2X(u8 ios, u8 *base);
static iosinfo_t *GetInfo(u8 ios); static iosinfo_t *GetInfo(u8 ios);
}; };

View File

@ -393,3 +393,17 @@ s32 WDVD_SetStreaming(void)
return (ret == 1) ? 0 : -ret; return (ret == 1) ? 0 : -ret;
} }
s32 WDVD_NEEK_LoadDisc(u32 id, u32 magic)
{
u32 *vec = (u32*)memalign(32, sizeof(u32) * 2);
vec[0] = id;
vec[1] = magic;
s32 ret = IOS_Ioctl(di_fd, 0x25, vec, sizeof(u32) * 2, NULL, 0);
gprintf("Load disc: (%08x)(%08x)(%d)(%d)\n", id, magic, ret, di_fd);
free(vec);
return ret;
}

View File

@ -27,6 +27,7 @@ s32 WDVD_Eject(void);
s32 WDVD_Read_Disc_BCA(void *); s32 WDVD_Read_Disc_BCA(void *);
s32 WDVD_SetFragList(int device, void *fraglist, int size); s32 WDVD_SetFragList(int device, void *fraglist, int size);
s32 WDVD_SetStreaming(void); s32 WDVD_SetStreaming(void);
s32 WDVD_NEEK_LoadDisc(u32 id, u32 magic);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -25,6 +25,7 @@
#include "loader/frag.h" #include "loader/frag.h"
#include "loader/fst.h" #include "loader/fst.h"
#include "cios.hpp"
#include "gui/WiiMovie.hpp" #include "gui/WiiMovie.hpp"
#include "gui/GameTDB.hpp" #include "gui/GameTDB.hpp"
@ -58,6 +59,7 @@ extern const u8 gc_ogg[];
extern const u32 gc_ogg_size; extern const u32 gc_ogg_size;
extern u32 sector_size; extern u32 sector_size;
extern u32 boot2version;
extern int mainIOS; extern int mainIOS;
static u64 sm_title_id[8] ATTRIBUTE_ALIGN(32); static u64 sm_title_id[8] ATTRIBUTE_ALIGN(32);
@ -897,6 +899,17 @@ void CMenu::_launchHomebrew(const char *filepath, vector<string> arguments)
int CMenu::_loadIOS(u8 gameIOS, int userIOS, string id) int CMenu::_loadIOS(u8 gameIOS, int userIOS, string id)
{ {
gprintf("Game ID# %s requested IOS %d. User selected %d\n", id.c_str(), gameIOS, userIOS); gprintf("Game ID# %s requested IOS %d. User selected %d\n", id.c_str(), gameIOS, userIOS);
if(cIOSInfo::neek2o())
{
if(!loadIOS(gameIOS, true))
{
_reload_wifi_gecko();
error(sfmt("errgame4", L"Couldn't load IOS %i", gameIOS));
return LOAD_IOS_FAILED;
}
return LOAD_IOS_SUCCEEDED;
}
if(userIOS) if(userIOS)
{ {
for(CIOSItr itr = _installed_cios.begin(); itr != _installed_cios.end(); itr++) for(CIOSItr itr = _installed_cios.begin(); itr != _installed_cios.end(); itr++)
@ -982,7 +995,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
} }
} }
forwarder = m_gcfg2.getBool(id, "custom", forwarder) || strncmp(id.c_str(), "WIMC", 4) == 0; forwarder = m_gcfg2.getBool(id, "custom", forwarder) || strncmp(id.c_str(), "WIMC", 4) == 0 || cIOSInfo::neek2o();
bool vipatch = m_gcfg2.testOptBool(id, "vipatch", m_cfg.getBool("GENERAL", "vipatch", false)); bool vipatch = m_gcfg2.testOptBool(id, "vipatch", m_cfg.getBool("GENERAL", "vipatch", false));
bool cheat = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool("NAND", "cheat", false)); bool cheat = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool("NAND", "cheat", false));
@ -1062,7 +1075,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
gprintf("Return to channel %s %s. Using new d2x way\n", rtrn, IOS_Ioctlv(ESHandle, 0xA1, 1, 0, vector) != -101 ? "Succeeded" : "Failed!" ); gprintf("Return to channel %s %s. Using new d2x way\n", rtrn, IOS_Ioctlv(ESHandle, 0xA1, 1, 0, vector) != -101 ? "Succeeded" : "Failed!" );
IOS_Close(ESHandle); IOS_Close(ESHandle);
} }
if(!emu_disabled) if(!emu_disabled && !cIOSInfo::neek2o())
{ {
Nand::Instance()->Init(emuPath.c_str(), emuPartition, false); Nand::Instance()->Init(emuPath.c_str(), emuPartition, false);
DeviceHandler::Instance()->UnMount(emuPartition); DeviceHandler::Instance()->UnMount(emuPartition);
@ -1108,9 +1121,20 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
Nand::Instance()->Disable_Emu(); Nand::Instance()->Disable_Emu();
if(cIOSInfo::neek2o())
{
int discID = id.c_str()[0] << 24 | id.c_str()[1] << 16 | id.c_str()[2] << 8 | id.c_str()[3];
WDVD_NEEK_LoadDisc((discID&0xFFFFFFFF), 0x5D1C9EA3);
dvd = true;
sleep(1);
}
if(dvd) if(dvd)
{ {
u32 cover = 0; u32 cover = 0;
if(!cIOSInfo::neek2o())
{
Disc_SetUSB(NULL); Disc_SetUSB(NULL);
if (WDVD_GetCoverStatus(&cover) < 0) if (WDVD_GetCoverStatus(&cover) < 0)
{ {
@ -1125,6 +1149,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
if (BTN_B_PRESSED) return; if (BTN_B_PRESSED) return;
} while(!(cover & 0x2)); } while(!(cover & 0x2));
} }
}
/* Open Disc */ /* Open Disc */
if (Disc_Open(true) < 0) if (Disc_Open(true) < 0)
{ {
@ -1276,7 +1301,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
app_gameconfig_load((u8 *) &id, gameconfig.get(), gameconfigSize); app_gameconfig_load((u8 *) &id, gameconfig.get(), gameconfigSize);
ocarina_load_code(cheatFile.get(), cheatSize); ocarina_load_code(cheatFile.get(), cheatSize);
u8 gameIOS = 0; u8 gameIOS = 0;
if(!dvd) if(!dvd || cIOSInfo::neek2o())
gameIOS = GetRequestedGameIOS(hdr); gameIOS = GetRequestedGameIOS(hdr);
m_gcfg1.save(true); m_gcfg1.save(true);
@ -1288,7 +1313,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
bool iosLoaded = false; bool iosLoaded = false;
if(!dvd) if(!dvd || cIOSInfo::neek2o())
{ {
int result = _loadIOS(gameIOS, userIOS, id); int result = _loadIOS(gameIOS, userIOS, id);
if(result == LOAD_IOS_FAILED) if(result == LOAD_IOS_FAILED)
@ -1315,7 +1340,8 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
} }
} }
IOSReloadBlock(IOS_GetVersion(), true); IOSReloadBlock(IOS_GetVersion(), true);
if(emulate_mode)
if(emulate_mode && !cIOSInfo::neek2o())
{ {
Nand::Instance()->Init(emuPath.c_str(), emuPartition, false); Nand::Instance()->Init(emuPath.c_str(), emuPartition, false);
DeviceHandler::Instance()->UnMount(emuPartition); DeviceHandler::Instance()->UnMount(emuPartition);

View File

@ -199,15 +199,22 @@ void CMenu::_enableNandEmu(bool fromconfig)
_cfNeedsUpdate(); _cfNeedsUpdate();
bool disable = m_cfg.getBool("NAND", "disable", true) && m_current_view == COVERFLOW_CHANNEL && !m_tempView; bool disable = m_cfg.getBool("NAND", "disable", true) && m_current_view == COVERFLOW_CHANNEL && !m_tempView;
if(!disable) if(!disable || cIOSInfo::neek2o())
{
bool isD2XnewerThanV6 = false;
if(!cIOSInfo::neek2o())
{ {
Nand::Instance()->Disable_Emu(); Nand::Instance()->Disable_Emu();
bool isD2XnewerThanV6 = false;
iosinfo_t * iosInfo = cIOSInfo::GetInfo(mainIOS); iosinfo_t * iosInfo = cIOSInfo::GetInfo(mainIOS);
if (iosInfo->version > 6) if (iosInfo->version > 6)
isD2XnewerThanV6 = true; isD2XnewerThanV6 = true;
if(m_current_view == COVERFLOW_CHANNEL && !m_cfg.getBool("NAND", "disable", true) && !m_tempView) if(m_current_view == COVERFLOW_CHANNEL && !m_cfg.getBool("NAND", "disable", true) && !m_tempView)
Nand::Instance()->Enable_Emu(); Nand::Instance()->Enable_Emu();
}
else
{
isD2XnewerThanV6 = true;
}
u8 limiter = 0; u8 limiter = 0;
s8 direction = m_btnMgr.selected(m_configBtnPartitionP) ? 1 : -1; s8 direction = m_btnMgr.selected(m_configBtnPartitionP) ? 1 : -1;
if (!fromconfig) if (!fromconfig)

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<pd><ViewState><e p="Wiiflow\portlibs" x="false"></e><e p="Wiiflow\source\cheats" x="true"></e><e p="Wiiflow\docs" x="false"></e><e p="Wiiflow\source\gecko" x="true"></e><e p="Wiiflow\source\homebrew" x="true"></e><e p="Wiiflow\source\loader" x="true"></e><e p="Wiiflow\source\wstringEx" x="false"></e><e p="Wiiflow" x="true"></e><e p="Wiiflow\source\devicemounter\libwbfs" x="true"></e><e p="Wiiflow\source\gc" x="true"></e><e p="Wiiflow\source\list" x="true"></e><e p="Wiiflow\source\music" x="true"></e><e p="Wiiflow\source\banner" x="false"></e><e p="Wiiflow\source\config" x="true"></e><e p="Wiiflow\source\memory" x="false"></e><e p="Wiiflow\source" x="true"></e><e p="Wiiflow\source\channel" x="true"></e><e p="Wiiflow\source\menu" x="true"></e><e p="Wiiflow\source\network" x="true"></e><e p="Wiiflow\source\plugin" x="true"></e><e p="Wiiflow\source\unzip" x="true"></e><e p="Wiiflow\wii" x="false"></e><e p="Wiiflow\data" x="false"></e><e p="Wiiflow\resources" x="false"></e><e p="Wiiflow\scripts" x="false"></e><e p="Wiiflow\source\devicemounter" x="true"></e><e p="Wiiflow\source\gui" x="true"></e></ViewState></pd> <pd><ViewState><e p="Wiiflow" x="true"></e><e p="Wiiflow\resources" x="false"></e><e p="Wiiflow\source\devicemounter\libwbfs" x="true"></e><e p="Wiiflow\data" x="false"></e><e p="Wiiflow\scripts" x="false"></e><e p="Wiiflow\source" x="true"></e><e p="Wiiflow\source\network" x="true"></e><e p="Wiiflow\source\channel" x="true"></e><e p="Wiiflow\source\menu" x="true"></e><e p="Wiiflow\docs" x="false"></e><e p="Wiiflow\portlibs" x="false"></e><e p="Wiiflow\source\banner" x="false"></e><e p="Wiiflow\source\cheats" x="true"></e><e p="Wiiflow\source\config" x="true"></e><e p="Wiiflow\source\devicemounter" x="true"></e><e p="Wiiflow\source\gc" x="true"></e><e p="Wiiflow\source\gecko" x="true"></e><e p="Wiiflow\source\gui" x="true"></e><e p="Wiiflow\source\homebrew" x="true"></e><e p="Wiiflow\source\list" x="true"></e><e p="Wiiflow\source\loader" x="true"></e><e p="Wiiflow\source\memory" x="false"></e><e p="Wiiflow\source\music" x="true"></e><e p="Wiiflow\source\plugin" x="true"></e><e p="Wiiflow\source\unzip" x="true"></e><e p="Wiiflow\source\wstringEx" x="false"></e><e p="Wiiflow\wii" x="false"></e></ViewState></pd>