mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-27 05:34:15 +01:00
-fixed wiimote doesnt properly resync on entering emu nand
-fixed installing gamecube disc 2 with wiiflow installer -fixed exit to neek2o for people who got their nand in a folder -some general cleanup and speedup
This commit is contained in:
parent
21078c74fb
commit
75ff081c0c
@ -43,6 +43,7 @@
|
||||
#include "loader/sys.h"
|
||||
#include "loader/wbfs.h"
|
||||
#include "memory/memory.h"
|
||||
#include "wiiuse/wpad.h"
|
||||
|
||||
u8 *confbuffer ATTRIBUTE_ALIGN(32);
|
||||
u8 CCode[0x1008];
|
||||
@ -157,11 +158,6 @@ s32 Nand::Enable_Emu()
|
||||
{
|
||||
if(emu_enabled)
|
||||
return 0;
|
||||
if(CurrentIOS.Type == IOS_TYPE_NORMAL_IOS)
|
||||
{
|
||||
loadIOS(mainIOS, true);
|
||||
Open_Inputs();
|
||||
}
|
||||
NandDevice *Device = &NandDeviceList[EmuDevice];
|
||||
|
||||
s32 ret = Nand_Mount(Device);
|
||||
|
@ -170,34 +170,31 @@ s32 USBStorage2_GetCapacity(u32 port, u32 *_sector_size)
|
||||
if((usb_libogc_mode && !__io_usbstorage_ogc.isInserted()) || (!usb_libogc_mode && fd < 0))
|
||||
return 0;
|
||||
|
||||
s32 ret;
|
||||
u32 sector_size = 0;
|
||||
u32 numSectors = 0;
|
||||
u32 sectorSize = 0;
|
||||
USBStorage2_SetPort(port);
|
||||
if(usb_libogc_mode)
|
||||
{
|
||||
sector_size = USB_OGC_GetSectorSize();
|
||||
ret = USB_OGC_GetCapacity();
|
||||
}
|
||||
USB_OGC_GetCapacity(&numSectors, §orSize);
|
||||
else
|
||||
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_GET_CAPACITY, ":i", §or_size);
|
||||
numSectors = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_GET_CAPACITY, ":i", §orSize);
|
||||
|
||||
if(first)
|
||||
{
|
||||
gprintf(" * * * * * * * * * * * *\n");
|
||||
gprintf(" * HDD Information\n * Sectors: %lu\n", ret);
|
||||
u32 size = ((((ret / 1024U) * sector_size) / 1024U) / 1024U);
|
||||
gprintf(" * HDD Information\n * Sectors: %lu\n", numSectors);
|
||||
u32 size = ((((numSectors / 1024U) * sectorSize) / 1024U) / 1024U);
|
||||
if(size >= 1000U)
|
||||
gprintf(" * Size [Sector Size]: %lu.%lu TB [%u]\n", size / 1024U, (size * 100U) % 1024U, sector_size);
|
||||
gprintf(" * Size [Sector Size]: %lu.%lu TB [%u]\n", size / 1024U, (size * 100U) % 1024U, sectorSize);
|
||||
else
|
||||
gprintf(" * Size [Sector Size]: %lu GB [%u]\n", size, sector_size);
|
||||
gprintf(" * Size [Sector Size]: %lu GB [%u]\n", size, sectorSize);
|
||||
gprintf(" * * * * * * * * * * * *\n");
|
||||
first = false;
|
||||
}
|
||||
|
||||
if(ret && _sector_size)
|
||||
*_sector_size = sector_size;
|
||||
if(numSectors && _sector_size)
|
||||
*_sector_size = sectorSize;
|
||||
|
||||
return ret;
|
||||
return numSectors;
|
||||
}
|
||||
|
||||
s32 USBStorage2_ReadSectors(u32 port, u32 sector, u32 numSectors, void *buffer)
|
||||
|
@ -1006,20 +1006,9 @@ DISC_INTERFACE __io_usbstorage_ogc = {
|
||||
(FN_MEDIUM_SHUTDOWN)&__usbstorage_ogc_Shutdown
|
||||
};
|
||||
|
||||
u32 USB_OGC_GetSectorSize()
|
||||
u32 USB_OGC_GetCapacity(u32 *numSectors, u32 *sectorSize)
|
||||
{
|
||||
u32 numSectors = 0;
|
||||
u32 sectorsize = 0;
|
||||
USBStorage_OGC_ReadCapacity(&__usbfd, __lun, §orsize, &numSectors);
|
||||
return sectorsize;
|
||||
}
|
||||
|
||||
u32 USB_OGC_GetCapacity()
|
||||
{
|
||||
u32 numSectors = 0;
|
||||
u32 sectorsize = 0;
|
||||
USBStorage_OGC_ReadCapacity(&__usbfd, __lun, §orsize, &numSectors);
|
||||
return numSectors;
|
||||
return USBStorage_OGC_ReadCapacity(&__usbfd, __lun, sectorSize, numSectors);
|
||||
}
|
||||
|
||||
#endif /* HW_RVL */
|
||||
|
@ -30,8 +30,7 @@ s32 USBStorage_OGC_StartStop(usbstorage_handle *dev, u8 lun, u8 lo_ej, u8 start,
|
||||
|
||||
extern DISC_INTERFACE __io_usbstorage_ogc;
|
||||
|
||||
u32 USB_OGC_GetSectorSize();
|
||||
u32 USB_OGC_GetCapacity();
|
||||
u32 USB_OGC_GetCapacity(u32 *numSectors, u32 *sectorSize);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ bool GCDump::__WaitForDisc(u8 dsc, u32 msg)
|
||||
if(Disc_Wait() < 0)
|
||||
continue;
|
||||
|
||||
if(Disc_Open(true) < 0)
|
||||
if(Disc_Open(false) < 0)
|
||||
{
|
||||
MEM2_free(ReadBuffer);
|
||||
return false;
|
||||
|
@ -22,17 +22,10 @@
|
||||
bool reset = false;
|
||||
bool shutdown = false;
|
||||
bool exiting = false;
|
||||
|
||||
bool priiloader_def = false;
|
||||
bool return_to_hbc = false;
|
||||
bool return_to_menu = false;
|
||||
bool return_to_priiloader = false;
|
||||
bool return_to_disable = false;
|
||||
bool return_to_bootmii = false;
|
||||
bool return_to_neek2o = false;
|
||||
u8 ExitOption = 0;
|
||||
const char *NeekPath = NULL;
|
||||
|
||||
extern void __exception_closeall();
|
||||
extern u32 __PADDisableRecalibration(s32 disable);
|
||||
|
||||
void __Wpad_PowerCallback()
|
||||
{
|
||||
@ -79,23 +72,20 @@ void Sys_Test(void)
|
||||
else if (shutdown) SYS_ResetSystem(SYS_POWEROFF, 0, 0);
|
||||
}
|
||||
|
||||
int Sys_GetExitTo(void)
|
||||
{
|
||||
return ExitOption;
|
||||
}
|
||||
void Sys_ExitTo(int option)
|
||||
{
|
||||
priiloader_def = option == PRIILOADER_DEF;
|
||||
return_to_hbc = option == EXIT_TO_HBC;
|
||||
return_to_menu = option == EXIT_TO_MENU;
|
||||
return_to_priiloader = option == EXIT_TO_PRIILOADER;
|
||||
return_to_disable = option == EXIT_TO_DISABLE;
|
||||
return_to_bootmii = option == EXIT_TO_BOOTMII;
|
||||
return_to_neek2o = option == EXIT_TO_NEEK2O;
|
||||
|
||||
ExitOption = option;
|
||||
//magic word to force wii menu in priiloader.
|
||||
if(return_to_menu)
|
||||
if(ExitOption == EXIT_TO_MENU)
|
||||
{
|
||||
*Priiloader_CFG1 = 0x50756E65;
|
||||
*Priiloader_CFG2 = 0x50756E65;
|
||||
}
|
||||
else if(return_to_priiloader)
|
||||
else if(ExitOption == EXIT_TO_PRIILOADER)
|
||||
{
|
||||
*Priiloader_CFG1 = 0x4461636F;
|
||||
*Priiloader_CFG2 = 0x4461636F;
|
||||
@ -111,29 +101,24 @@ void Sys_ExitTo(int option)
|
||||
|
||||
void Sys_Exit(void)
|
||||
{
|
||||
if(return_to_disable)
|
||||
if(ExitOption == EXIT_TO_DISABLE)
|
||||
return;
|
||||
|
||||
/* Shutdown Inputs */
|
||||
Close_Inputs();
|
||||
|
||||
if(return_to_neek2o)
|
||||
{
|
||||
Launch_nk(0x1000144574641LL, NULL);
|
||||
while(1);
|
||||
}
|
||||
|
||||
WII_Initialize();
|
||||
if(return_to_menu || return_to_priiloader || priiloader_def)
|
||||
Sys_LoadMenu();
|
||||
else if(return_to_bootmii)
|
||||
IOS_ReloadIOS(254);
|
||||
|
||||
//else
|
||||
WII_LaunchTitle(HBC_108);
|
||||
WII_LaunchTitle(HBC_JODI);
|
||||
WII_LaunchTitle(HBC_HAXX);
|
||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
if(ExitOption == EXIT_TO_NEEK2O)
|
||||
Launch_nk(0x1000144574641LL, NeekPath);
|
||||
else if(ExitOption == EXIT_TO_BOOTMII)
|
||||
IOS_ReloadIOS(0xfe);
|
||||
else if(ExitOption == EXIT_TO_HBC)
|
||||
{
|
||||
WII_LaunchTitle(HBC_108);
|
||||
WII_LaunchTitle(HBC_JODI);
|
||||
WII_LaunchTitle(HBC_HAXX);
|
||||
}
|
||||
//else boot system menu
|
||||
Sys_LoadMenu();
|
||||
}
|
||||
|
||||
void __Sys_ResetCallback(void)
|
||||
@ -163,3 +148,8 @@ bool AHBRPOT_Patched(void)
|
||||
{
|
||||
return (*HW_AHBPROT == 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
void Sys_SetNeekPath(const char *Path)
|
||||
{
|
||||
NeekPath = Path;
|
||||
}
|
||||
|
@ -32,6 +32,8 @@ bool Sys_Exiting(void);
|
||||
void Sys_Test(void);
|
||||
void Sys_Exit(void);
|
||||
void Sys_ExitTo(int);
|
||||
int Sys_GetExitTo(void);
|
||||
void Sys_SetNeekPath(const char*);
|
||||
|
||||
void Open_Inputs(void);
|
||||
void Close_Inputs(void);
|
||||
|
@ -92,11 +92,8 @@ int main(int argc, char **argv)
|
||||
// Init
|
||||
Sys_Init();
|
||||
Sys_ExitTo(EXIT_TO_HBC);
|
||||
|
||||
Open_Inputs(); //(re)init wiimote
|
||||
#ifndef DOLPHIN
|
||||
const DISC_INTERFACE *handle = DeviceHandler::GetUSB0Interface();
|
||||
bool deviceAvailable = false;
|
||||
u8 timeout = time(NULL);
|
||||
while(time(NULL) - timeout < 20)
|
||||
{
|
||||
@ -110,15 +107,20 @@ int main(int argc, char **argv)
|
||||
bool dipOK = Disc_Init() >= 0;
|
||||
|
||||
mainMenu = new CMenu(vid);
|
||||
Open_Inputs();
|
||||
mainMenu->init();
|
||||
if(CurrentIOS.Version != mainIOS && useMainIOS)
|
||||
iosOK = loadIOS(mainIOS, true) && CustomIOS(CurrentIOS.Type);
|
||||
if(DeviceHandler::Instance()->IsInserted(SD) || DeviceHandler::Instance()->IsInserted(USB1))
|
||||
deviceAvailable = true;
|
||||
|
||||
if(CurrentIOS.Version != mainIOS && !neek2o())
|
||||
{
|
||||
if(useMainIOS || (!DeviceHandler::Instance()->IsInserted(SD) && !DeviceHandler::Instance()->IsInserted(USB1)))
|
||||
{
|
||||
iosOK = loadIOS(mainIOS, true) && CustomIOS(CurrentIOS.Type);
|
||||
Open_Inputs();
|
||||
mainMenu->init();
|
||||
}
|
||||
}
|
||||
if(!iosOK)
|
||||
mainMenu->terror("errboot1", L"No cIOS found!\ncIOS d2x 249 base 56 and 250 base 57 are enough for all your games.");
|
||||
else if(!deviceAvailable)
|
||||
else if(!DeviceHandler::Instance()->IsInserted(SD) && !DeviceHandler::Instance()->IsInserted(USB1))
|
||||
mainMenu->terror("errboot2", L"Could not find a device to save configuration files on!");
|
||||
else if(!dipOK)
|
||||
mainMenu->terror("errboot3", L"Could not initialize the DIP module!");
|
||||
@ -130,7 +132,7 @@ int main(int argc, char **argv)
|
||||
mainMenu->m_Emulator_boot = true;
|
||||
mainMenu->main();
|
||||
}
|
||||
|
||||
//Exit WiiFlow, no game booted...
|
||||
mainMenu->cleanup();
|
||||
DeviceHandler::Instance()->UnMountAll();
|
||||
Nand::Instance()->DeInit_ISFS();
|
||||
|
@ -137,7 +137,6 @@ CMenu::CMenu(CVideo &vid) :
|
||||
m_bnr_settings = true;
|
||||
m_directLaunch = false;
|
||||
m_exit = false;
|
||||
m_initialCoverStatusComplete = false;
|
||||
m_reload = false;
|
||||
m_gamesound_changed = false;
|
||||
m_video_playing = false;
|
||||
@ -2051,6 +2050,13 @@ bool CMenu::_loadChannelList(void)
|
||||
Nand::Instance()->Disable_Emu();
|
||||
if(!disable_emu)
|
||||
{
|
||||
if(CurrentIOS.Type == IOS_TYPE_NORMAL_IOS)
|
||||
{
|
||||
loadIOS(mainIOS, true);
|
||||
Open_Inputs();
|
||||
for(int chan = WPAD_MAX_WIIMOTES-2; chan >= 0; chan--)
|
||||
WPAD_SetVRes(chan, m_vid.width() + m_cursor[chan].width(), m_vid.height() + m_cursor[chan].height());
|
||||
}
|
||||
if(!DeviceHandler::Instance()->IsInserted(lastPartition))
|
||||
DeviceHandler::Instance()->Mount(lastPartition);
|
||||
|
||||
|
@ -581,8 +581,7 @@ private:
|
||||
SZone m_mainButtonsZone3;
|
||||
SZone m_gameButtonsZone;
|
||||
bool m_reload;
|
||||
bool m_initialCoverStatusComplete;
|
||||
|
||||
|
||||
WPADData *wd[WPAD_MAX_WIIMOTES];
|
||||
void LeftStick();
|
||||
u8 pointerhidedelay[WPAD_MAX_WIIMOTES];
|
||||
@ -1050,7 +1049,6 @@ private:
|
||||
bool _isNetworkAvailable();
|
||||
int _initNetwork();
|
||||
void _deinitNetwork();
|
||||
static int GetCoverStatusAsync(CMenu *m);
|
||||
void LoadView(void);
|
||||
void _getGrabStatus(void);
|
||||
static void _addDiscProgress(int status, int total, void *user_data);
|
||||
|
@ -179,14 +179,6 @@ void CMenu::_showMain(void)
|
||||
Nand::Instance()->Enable_Emu();
|
||||
}
|
||||
|
||||
int CMenu::GetCoverStatusAsync(CMenu *m)
|
||||
{
|
||||
u32 disc_check = 0;
|
||||
WDVD_GetCoverStatus(&disc_check);
|
||||
m->m_initialCoverStatusComplete = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CMenu::LoadView(void)
|
||||
{
|
||||
m_curGameId = m_cf.getId();
|
||||
@ -268,7 +260,7 @@ int CMenu::main(void)
|
||||
bool bUsed = false;
|
||||
|
||||
m_reload = false;
|
||||
static u32 disc_check = 0;
|
||||
u32 disc_check = 0;
|
||||
int done = 0;
|
||||
|
||||
if (m_cfg.getBool("GENERAL", "async_network", false) || has_enabled_providers())
|
||||
@ -304,23 +296,13 @@ int CMenu::main(void)
|
||||
if(BTN_B_HELD)
|
||||
bUsed = true;
|
||||
}
|
||||
|
||||
lwp_t coverStatus = LWP_THREAD_NULL;
|
||||
unsigned int stack_size = (unsigned int)32768;
|
||||
SmartBuf coverstatus_stack = smartMem2Alloc(stack_size);
|
||||
LWP_CreateThread(&coverStatus, (void *(*)(void *))CMenu::GetCoverStatusAsync, (void *)this, coverstatus_stack.get(), stack_size, 40);
|
||||
|
||||
while(true)
|
||||
{
|
||||
/* IMPORTANT check if a disc is inserted */
|
||||
WDVD_GetCoverStatus(&disc_check);
|
||||
/* Main Loop */
|
||||
_mainLoopCommon(true);
|
||||
if(m_initialCoverStatusComplete)
|
||||
{
|
||||
LWP_JoinThread(coverStatus, NULL);
|
||||
coverStatus = LWP_THREAD_NULL;
|
||||
if(coverstatus_stack.get())
|
||||
coverstatus_stack.release();
|
||||
WDVD_GetCoverStatus(&disc_check);
|
||||
}
|
||||
if(bheld && !BTN_B_HELD)
|
||||
{
|
||||
bheld = false;
|
||||
@ -867,15 +849,16 @@ int CMenu::main(void)
|
||||
_launchHomebrew(fmt("%s/boot.dol", m_appDir.c_str()), m_homebrewArgs);
|
||||
return 0;
|
||||
}
|
||||
else if(Sys_GetExitTo() == EXIT_TO_NEEK2O)
|
||||
{
|
||||
string emuPath;
|
||||
_FindEmuPart(&emuPath, m_cfg.getInt("NAND", "partition", 0), false);
|
||||
Sys_SetNeekPath(emuPath.size() > 1 ? emuPath.c_str() : NULL);
|
||||
}
|
||||
gprintf("Saving configuration files\n");
|
||||
m_cfg.save();
|
||||
m_cat.unload();
|
||||
// m_loc.save();
|
||||
gprintf("Wait for dvd\n");
|
||||
LWP_JoinThread(coverStatus, NULL);
|
||||
coverStatus = LWP_THREAD_NULL;
|
||||
if(coverstatus_stack.get())
|
||||
coverstatus_stack.release();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user