From 0b1562fcdf5857343f82f594035bef3b3fc206fc Mon Sep 17 00:00:00 2001 From: "fix94.1" Date: Fri, 20 Jul 2012 21:18:29 +0000 Subject: [PATCH] -dont use frag list on wbfs partitions, they are not needed -fixed booting games from wbfs via waninkoko cIOS r17 or older -fixed partition handle wbfs detection --- source/devicemounter/PartitionHandle.cpp | 9 +++++---- source/loader/disc.c | 6 +++--- source/loader/disc.h | 2 +- source/menu/menu_game.cpp | 7 ++++--- source/menu/menu_wbfs.cpp | 2 +- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/source/devicemounter/PartitionHandle.cpp b/source/devicemounter/PartitionHandle.cpp index e1f1e33b..fac21f7e 100644 --- a/source/devicemounter/PartitionHandle.cpp +++ b/source/devicemounter/PartitionHandle.cpp @@ -152,8 +152,7 @@ bool PartitionHandle::Mount(int pos, const char * name, bool forceFAT) return true; } } - - if(strncmp(GetFSName(pos), "NTFS", 4) == 0 || strcmp(GetFSName(pos), "GUID-Entry") == 0) + else if(strncmp(GetFSName(pos), "NTFS", 4) == 0 || strcmp(GetFSName(pos), "GUID-Entry") == 0) { if(ntfsMount(MountNameList[pos].c_str(), interface, GetLBAStart(pos), CACHE, SECTORS, NTFS_SHOW_HIDDEN_FILES | NTFS_RECOVER)) { @@ -161,8 +160,7 @@ bool PartitionHandle::Mount(int pos, const char * name, bool forceFAT) return true; } } - - if(strncmp(GetFSName(pos), "LINUX", 5) == 0 || strcmp(GetFSName(pos), "GUID-Entry") == 0) + else if(strncmp(GetFSName(pos), "LINUX", 5) == 0 || strcmp(GetFSName(pos), "GUID-Entry") == 0) { if(ext2Mount(MountNameList[pos].c_str(), interface, GetLBAStart(pos), CACHE, SECTORS, EXT2_FLAG_DEFAULT)) { @@ -177,7 +175,10 @@ bool PartitionHandle::Mount(int pos, const char * name, bool forceFAT) else if(interface == &__io_sdhc) SetWbfsHandle(pos, wbfs_open_partition(__WBFS_ReadSDHC, __WBFS_WriteSDHC, NULL, 512, GetSecCount(pos), GetLBAStart(pos), 0)); if(GetWbfsHandle(pos)) + { + PartitionList[pos].FSName = "WBFS"; return true; + } } MountNameList[pos].clear(); diff --git a/source/loader/disc.c b/source/loader/disc.c index 712db0af..7efd604a 100644 --- a/source/loader/disc.c +++ b/source/loader/disc.c @@ -299,15 +299,15 @@ s32 Disc_Wait(void) return 0; } -s32 Disc_SetUSB(const u8 *id) +s32 Disc_SetUSB(const u8 *id, bool frag) { - if(id) + if(id && frag) return set_frag_list((u8 *) id); s32 part = -1; if(is_ios_type(IOS_TYPE_HERMES, IOS_GetVersion())) part = wbfs_part_idx ? wbfs_part_idx - 1 : 0; - return WDVD_SetUSBMode(wbfsDev, (u8 *) id, part); + return WDVD_SetUSBMode(wbfsDev, (u8*)id, part); } s32 Disc_ReadHeader(void *outbuf) diff --git a/source/loader/disc.h b/source/loader/disc.h index 9a06b9c2..ed9a13ca 100644 --- a/source/loader/disc.h +++ b/source/loader/disc.h @@ -97,7 +97,7 @@ extern "C" { s32 Disc_Init(void); s32 Disc_Open(bool); s32 Disc_Wait(void); -s32 Disc_SetUSB(const u8 *); +s32 Disc_SetUSB(const u8 *id, bool frag); s32 Disc_ReadHeader(void *); s32 Disc_ReadGCHeader(void *); s32 Disc_Type(bool); diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index 8a58aef5..e517a508 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -1152,7 +1152,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) #ifndef DOLPHIN if(!neek2o()) { - Disc_SetUSB(NULL); + Disc_SetUSB(NULL, false); if (WDVD_GetCoverStatus(&cover) < 0) { error(_t("errgame7", L"WDVDGetCoverStatus Failed!")); @@ -1281,7 +1281,8 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) Nand::Instance()->Do_Region_Change(id); } } - if(!dvd && get_frag_list((u8 *)id.c_str(), (char*)path.c_str(), currentPartition == 0 ? 0x200 : USBStorage2_GetSectorSize()) < 0) + bool wbfs_partition = (DeviceHandler::Instance()->GetFSType(currentPartition) == PART_FS_WBFS); + if(!dvd && !wbfs_partition && get_frag_list((u8 *)id.c_str(), (char*)path.c_str(), currentPartition == 0 ? 0x200 : USBStorage2_GetSectorSize()) < 0) return; u8 patchVidMode = min((u32)m_gcfg2.getInt(id, "patch_video_modes", 0), ARRAY_SIZE(CMenu::_vidModePatch) - 1u); @@ -1383,7 +1384,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) } if(!dvd) { - s32 ret = Disc_SetUSB((u8 *)id.c_str()); + s32 ret = Disc_SetUSB((u8*)id.c_str(), !wbfs_partition); if (ret < 0) { gprintf("Set USB failed: %d\n", ret); diff --git a/source/menu/menu_wbfs.cpp b/source/menu/menu_wbfs.cpp index e2d91501..7b76fc52 100644 --- a/source/menu/menu_wbfs.cpp +++ b/source/menu/menu_wbfs.cpp @@ -312,7 +312,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op) m_btnMgr.hide(m_wbfsBtnBack); m_btnMgr.show(m_wbfsLblMessage); m_btnMgr.setText(m_wbfsLblMessage, L""); - Disc_SetUSB(NULL); + Disc_SetUSB(NULL, false); if (Disc_Wait() < 0) { error(_t("wbfsoperr1", L"Disc_Wait failed"));