Hacking Wii U vWii USB Loader GX issue at "Waiting for HDD" Screen

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
46
Location
Engine room, learning
XP
15,662
Country
France
thanks.
it looks like it forces two things :
- if no partition is found, force a FAT partition anyway (why?, no partition present on the drive, but let's fake one?)
- if USB is not init or inserted, it "set device" anyway, instead of looping with "wait for device".

Maybe looking at "waitForDevice" and "setDevice" functions will be interesting to see what really happen, and for how long it waits for the drive to initialize.
USBLoaderGX waits 20 seconds per USB port (40 total!) and it's not enough?
 

falto2

Member
Newcomer
Joined
Jul 20, 2017
Messages
18
Trophies
0
Age
34
XP
116
Country
Spain
thanks.
it looks like it forces two things :
- if no partition is found, force a FAT partition anyway (why?, no partition present on the drive, but let's fake one?)
- if USB is not init or inserted, it "set device" anyway, instead of looping with "wait for device".

Maybe looking at "waitForDevice" and "setDevice" functions will be interesting to see what really happen, and for how long it waits for the drive to initialize.
USBLoaderGX waits 20 seconds per USB port (40 total!) and it's not enough?
Code:
void DeviceHandler::WaitForDevice(const DISC_INTERFACE *Handle)
{
    if(Handle == NULL)
        return;
    time_t timeout = time(NULL);
    while(time(NULL) - timeout < 20)
    {
        if(Handle->startup() && Handle->isInserted())
            break;
        usleep(50000);
    }
}
Code:
void PartitionHandle::SetDevice(const DISC_INTERFACE *discio)
{
    Cleanup();
    interface = discio;

    // Sanity check
    if(!interface)
        return;

    // Start the device and check that it is inserted
    if(!interface->startup())
        return;

    if(!interface->isInserted())
        return;

    FindPartitions();
}
 

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
46
Location
Engine room, learning
XP
15,662
Country
France
ok, so it's waiting 20 seconds too, like USBLoaderGX.
setDevice is doing what USBGX is doing too, except it's not in another sub function, but directly in the init loop.

it's doing the startup() and isInserted() in loop for 20 seconds.

Maybe the only differences is that USBGX doesn't "clean all interfaces" ?
/* Kill possible USB thread */
KillUSBKeepAliveThread();


Code:
static inline bool USBSpinUp()
{
	bool started0 = false;
	bool started1 = false;
	int retries = 400;

	const DISC_INTERFACE * handle0 = NULL;
	const DISC_INTERFACE * handle1 = NULL;
	if(Settings.USBPort == 0 || Settings.USBPort == 2)
		handle0 = DeviceHandler::GetUSB0Interface();
	if(Settings.USBPort == 1 || Settings.USBPort == 2)
		handle1 = DeviceHandler::GetUSB1Interface();

	// wait 20 sec for the USB to spin up...stupid slow ass HDD
	do
	{
		if(handle0)
			started0 = (handle0->startup() && handle0->isInserted());

		if(handle1)
			started1 = (handle1->startup() && handle1->isInserted());

		if(   (!handle0 || started0)
		   && (!handle1 || started1)) {
			break;
		}
		usleep(50000);
	}
	while(--retries > 0);

	return (started0 || started1);
}
 
Last edited by Cyan,

falto2

Member
Newcomer
Joined
Jul 20, 2017
Messages
18
Trophies
0
Age
34
XP
116
Country
Spain
ok, so it's waiting 20 seconds too, like USBLoaderGX.
setDevice is doing what USBGX is doing too, except it's not in another sub function, but directly in the init loop.

it's doing the startup() and isInserted() in loop for 20 seconds.

Maybe the only differences is that USBGX doesn't "clean all interfaces" ?

Code:
static inline bool USBSpinUp()
{
    bool started0 = false;
    bool started1 = false;
    int retries = 400;

    const DISC_INTERFACE * handle0 = NULL;
    const DISC_INTERFACE * handle1 = NULL;
    if(Settings.USBPort == 0 || Settings.USBPort == 2)
        handle0 = DeviceHandler::GetUSB0Interface();
    if(Settings.USBPort == 1 || Settings.USBPort == 2)
        handle1 = DeviceHandler::GetUSB1Interface();

    // wait 20 sec for the USB to spin up...stupid slow ass HDD
    do
    {
        if(handle0)
            started0 = (handle0->startup() && handle0->isInserted());

        if(handle1)
            started1 = (handle1->startup() && handle1->isInserted());

        if(   (!handle0 || started0)
           && (!handle1 || started1)) {
            break;
        }
        usleep(50000);
    }
    while(--retries > 0);

    return (started0 || started1);
}
Yeah, it's the same... Maybe is what you said before? That "trick" initializing a fake fat partition? I'll look into the Nintendont initialize code.
 

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
46
Location
Engine room, learning
XP
15,662
Country
France
Nintendont is doing it differently, it's addressing the raw USB interface from IOS58 commands instead of using Libogc.

but thank you for looking and helping with that issue :)
I plan to rewrite the boot sequence anyway (make it faster, use IOS58 first, then cIOS), only problem with IOS58 is in case of multiple USB, it's mounted in reversed order.
 
Last edited by Cyan,

falto2

Member
Newcomer
Joined
Jul 20, 2017
Messages
18
Trophies
0
Age
34
XP
116
Country
Spain
Nintendont is doing it differently, it's addressing the raw USB interface from IOS58 commands instead of using Libogc.

but thank you for looking and helping with that issue :)
I plan to rewrite the boot sequence anyway (make it faster, use IOS58 first, then cIOS), only problem with IOS58 is in case of multiple USB, it's mounted in reversed order.
I'm looking into nintendont's code and it's totally diferent yes :wacko: Maybe you could try to make a build with some code from wiiflow lite? I will do the tests :)
 
  • Like
Reactions: Cyan

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Xdqwerty @ Xdqwerty: @realtimesave, iirc she said she is non binary