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
  • K3Nv2 @ K3Nv2:
    They should've just made it a movie at 50 minutes
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    No from Paramount Plus or whatever it is
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Psi now has access to every streaming and cable channel out
  • K3Nv2 @ K3Nv2:
    Eh I'd rather just download and delete is it already up on paramount?
  • Psionic Roshambo @ Psionic Roshambo:
    Yeah it's on now
  • Xdqwerty @ Xdqwerty:
    @Psionic Roshambo, why are most new south park episodes half hour specials?
    +1
  • K3Nv2 @ K3Nv2:
    @Psionic Roshambo, let me get a Netflix account I've always been nice to you
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    I made a honey pepper glazed turkey breast for dinner turned out pretty bomb
  • K3Nv2 @ K3Nv2:
    We can Netflix and chill
  • Xdqwerty @ Xdqwerty:
    Nvm not half hour, but hour long
  • Xdqwerty @ Xdqwerty:
    Normal south park episodes are already half hour
  • Psionic Roshambo @ Psionic Roshambo:
    Got 2 free Xumo boxes they work pretty good
  • K3Nv2 @ K3Nv2:
    I'm happy to get anything most series don't make it pass 6 seasons
  • Psionic Roshambo @ Psionic Roshambo:
    Except Stars and Encore those are being a bitch lol
  • K3Nv2 @ K3Nv2:
    I may consider that onn pro box finally a media box with type A ;O
    +1
  • Xdqwerty @ Xdqwerty:
    @K3Nv2, cuz the companies don't want em to
  • K3Nv2 @ K3Nv2:
    No it's revenue and demand south park could argue has a bigger audience than family guy about the same
    +1
  • K3Nv2 @ K3Nv2:
    Family guy is worth 300mill south parks worth 1Bill according to the interwebs
  • Xdqwerty @ Xdqwerty:
    @K3Nv2, probably cuz family guy is more disliked compared to south park
  • K3Nv2 @ K3Nv2:
    It just does the same formula south park can press buttons without going overboard
  • Xdqwerty @ Xdqwerty:
    And bc most of the family guy budget is spent on the voice actors rather than on the animation
  • K3Nv2 @ K3Nv2:
    Southpark could spend 30k on a animated dick and people would laugh at it
    +2
  • K3Nv2 @ K3Nv2:
    lol one prescription to Lizzo
  • Xdqwerty @ Xdqwerty:
    who is lizzo?
  • Xdqwerty @ Xdqwerty:
    yawn
    Xdqwerty @ Xdqwerty: yawn