Hacking USB LOADER GX is slow to list GameCube games

Welohabi

Member
OP
Newcomer
Joined
Feb 23, 2020
Messages
18
Trophies
0
Age
37
XP
113
Country
United States
85137510_543361803052762_829058898651512832_n.jpg
 
  • Like
Reactions: Alexander1970

d_bizzzz

Well-Known Member
Newcomer
Joined
Jun 16, 2010
Messages
48
Trophies
1
XP
180
Country
I have the exact same issue.
I did get a slight speed increase when I rolled back all my cIOS from D2X V10 r53 to r52 as I read the latest r53 can cause some HDD issues.
It's not great but rather than 45 seconds to load the list now takes about 30 seconds.
I wonder, can GameCube games be listed without using folders, could folders be causing any slowdown here ?
 
  • Like
Reactions: Welohabi

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
45
Location
Engine room, learning
XP
15,646
Country
France
the d2x version has nothing to do with read speed.
even less if the loader uses IOS58 and not the cIOS to read the USB.
if the loader's IOS is set to a cIOS, the "base IOS" will determine the USB read access speed (base56 is faster than 57. base58 is the slowest)

The Wii games are using folders, and don't have loading speed issues.
I used the same method to load gamecube games, I guess I messed somewhere. There are maybe better way to scan for games.
Probably add a "game list cache" and only scan when requested by the user or when dumping a new game.

it should speed the loading if you have the TitleID in the folder name, as the loader depends on that info to display covers and game name from gametdb.
if you don't have the titleID in the folder, it has to mount each .ISO file one by one to look for the titleID inside the iso.
With TitleID in the folder : read the folder's name, get the titleID.
Without the titleID in the folder : read the folder's name, scan for TitleID.... enter the folder, load the file game.iso in memory, read the header, get the titleID, close the file, exit folder.

expected (best) format is like the Wii game format:
USB:/games/Zelda Wind Waker [GZLP01]/game.iso
 
Last edited by Cyan,
  • Like
Reactions: Welohabi

Welohabi

Member
OP
Newcomer
Joined
Feb 23, 2020
Messages
18
Trophies
0
Age
37
XP
113
Country
United States
The Wii games are using folders, and don't have loading speed issues.
I used the same method to load gamecube games, I guess I messed somewhere.

I think this same thing. They are literally the same, yet GCN loads slower.
 

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
45
Location
Engine room, learning
XP
15,646
Country
France
For each found folder in /games/ :
1) First, it checks the titleID and the game's tile from the folder's name (same functions as the Wii games, so not the problem I guess)
if no ID found, set titleID to 000000 (why? it should already be zero. unneeded commands, sources might need to be verified) it would remove few CPU cycles.

2) Then looking at the differences with wii games, gamecube has to get the game's filename.

On Wii, it's mandatory to be TitleID6.xxx but on gamecube, it can be :
titleID6 or "game", with extension "iso" or "gcm" (and "ciso" not supported yet)
so, the difference is it's checking for file existence 4 times, with "game.iso" first.
game.iso <-- you should have this, so it's checking and stopping on the first try. it shouldn't take too long, but maybe single cycle of "check if file exists" can be long if there are too much games?
TitleID.iso
game.gcm
TitleID.gcm

(possible bug, if no ID found previously, it'll search for 000000.xxxx 4 times, need to be fixed)

3) If none is found, it verify if you don't have only "disc2.iso", using the same method. This could probably be simplified. but it's only in case you have ONLY disc2, no disc1.

4) If still no game iso/gcm are found, it then checks whether the game is in extracted format (fst).


5) If no titleID has been found on first step 1, it opens the first found ISO file to read the titleID from the header. at the same time, store "game's Title" for later.
Apparently, there's no way to get the TitleID of an extracted game format if it's not found on previous steps! TitleID in folder is mandatory here!

6) get the Game's Title from gamestdb, or from the "Title cache" file, based on the titleID.
I now see there is a bug, there's no way to enforce "title from disc" (step 5) if TitleID is found (step1)

7) if title not found in gamestdb or not in use, or ID not found, and "force title from disc header" is disabled by the user, set the game's title from the title found in the path in step 1


8) If we have both an ID and a Title, add that game to the gamelist and skip to process next game.

9) unsure when this step is reached...or what it's supposed to do.
looking randomly at the sources 2 years later is not easy. comments are not very good.
Apparently, it's only reached if the user selected "Force Title from disc".
so, when using that option, it feels like the ISO is opened multiple times in the process.

It seems it opens the ISO header and store the entire raw header into the game list without really checking and storing the ID/Title/Disc number/etc. to be used by the loader (resulting in empty games listed on the interface?)
Finally it saves the game's ID/Title (from the unverified RAW header?) association to the "Game title cache" file to speed up next launch of the loader.

it should never reach that step anyway as it should already have both ID and title from previous steps, unless it failed to find ID or title. but then, I'm not sure why it's trying to open the ISO again.


So, if you see all these steps, it should do :
Step 1 (get the TitleID from folder) [like wii games]
step 2 (get the filename, stop at the very first try : game.iso)
step 7 get title from gametdb [like wii games]
step 8 add game to game list [like wii games]
Skip to next found game in /games/ folder [like wii games]

only "verify the filename" is added, and it's a single check if you use "game.iso".
it's using a loop to check all names.
maybe using 4 conditions would be faster?

maybe using stat() is slower than using "check if file exists" ? though, "FileExists()" might use stat() itself. (to be verified)

Of maybe the condition-ception is not working and never return true?
if((found = (stat(fpath, &st) == 0)) == true)
if it's never true, then it ends loading ID from the iso header.


https://sourceforge.net/p/usbloadergx/code/HEAD/tree/trunk/source/GameCube/GCGames.cpp

PS: I don't have that many GC games to do speed tests.
maybe I could add a timer or cycle checker to compare different methods/commands?
 
Last edited by Cyan,
  • Like
Reactions: Welohabi

Welohabi

Member
OP
Newcomer
Joined
Feb 23, 2020
Messages
18
Trophies
0
Age
37
XP
113
Country
United States
I have mine set up in the best possible scenario as you are describing. I do have one question, would a "space" affect how it reads the folder name?

The code indicates that it should be:

path/TITLE[GAMEID]/game.iso
but mine have an extra space between title and [gameid]
path/TITLE [GAMEID]/game.iso

Would this matter?

Maybe add an option to pick which path layout you have so it does not have to cycle the different options?

Takes me about 35 seconds to load 600+ GCN but only 10 seconds to load 1200+ Wii from the same drive.
 

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
45
Location
Engine room, learning
XP
15,646
Country
France
no, the space doesn't affect the way it reads the folder.
the space is seen as "TITLE" part before the bracket.
the loader only look for [ located at end character -7 to determine if the titleID is present, then cut the folder's name in half : Title from 0 to end-8, titleID from -6 to -1

checking the layout (A or B) is not a problem with wii games.
A : ID_Title
B : Title [ID]

That layout B is found, and then only the filename finding part can be responsible for the long loading time.
I don't think adding an option to tell "expect filename to be xxxxxx" is a good idea.
sometime, users can use gcm, or mix with some ciso format.
forcing one format is not ideal.

maybe trying a different method to find the filename could be used.
or, the best, would be a long time requested feature : game cache !
and now that we mention the filename being an issue, the gamecache has to store both the path to the file and the full game's header (to know if the game is first disc or second disc, know if it's an iso or extracted format, a wii disc or gamecube or channel, etc.), not just the list of available games.
the cache list would be bigger than I thought (not just a list of TitleID), but loading and parsing a single file will be faster. it can just become very big if you have hundreds of games. some users have more than a thousand, imagine how slow it is for them?
 
Last edited by Cyan,
  • Like
Reactions: Welohabi

d_bizzzz

Well-Known Member
Newcomer
Joined
Jun 16, 2010
Messages
48
Trophies
1
XP
180
Country
the d2x version has nothing to do with read speed.
even less if the loader uses IOS58 and not the cIOS to read the USB.
if the loader's IOS is set to a cIOS, the "base IOS" will determine the USB read access speed (base56 is faster than 57. base58 is the slowest)

The Wii games are using folders, and don't have loading speed issues.
I used the same method to load gamecube games, I guess I messed somewhere. There are maybe better way to scan for games.
Probably add a "game list cache" and only scan when requested by the user or when dumping a new game.

it should speed the loading if you have the TitleID in the folder name, as the loader depends on that info to display covers and game name from gametdb.
if you don't have the titleID in the folder, it has to mount each .ISO file one by one to look for the titleID inside the iso.
With TitleID in the folder : read the folder's name, get the titleID.
Without the titleID in the folder : read the folder's name, scan for TitleID.... enter the folder, load the file game.iso in memory, read the header, get the titleID, close the file, exit folder.

expected (best) format is like the Wii game format:
USB:/games/Zelda Wind Waker [GZLP01]/game.iso

Ah I getcha. Apologies Cyan. I could have sworn it seemed quicker

--------------------- MERGED ---------------------------

For each found folder in /games/ :
1) First, it checks the titleID and the game's tile from the folder's name (same functions as the Wii games, so not the problem I guess)
if no ID found, set titleID to 000000 (why? it should already be zero. unneeded commands, sources might need to be verified) it would remove few CPU cycles.

2) Then looking at the differences with wii games, gamecube has to get the game's filename.

On Wii, it's mandatory to be TitleID6.xxx but on gamecube, it can be :
titleID6 or "game", with extension "iso" or "gcm" (and "ciso" not supported yet)
so, the difference is it's checking for file existence 4 times, with "game.iso" first.
game.iso <-- you should have this, so it's checking and stopping on the first try. it shouldn't take too long, but maybe single cycle of "check if file exists" can be long if there are too much games?
TitleID.iso
game.gcm
TitleID.gcm

(possible bug, if no ID found previously, it'll search for 000000.xxxx 4 times, need to be fixed)

3) If none is found, it verify if you don't have only "disc2.iso", using the same method. This could probably be simplified. but it's only in case you have ONLY disc2, no disc1.

4) If still no game iso/gcm are found, it then checks whether the game is in extracted format (fst).


5) If no titleID has been found on first step 1, it opens the first found ISO file to read the titleID from the header. at the same time, store "game's Title" for later.
Apparently, there's no way to get the TitleID of an extracted game format if it's not found on previous steps! TitleID in folder is mandatory here!

6) get the Game's Title from gamestdb, or from the "Title cache" file, based on the titleID.
I now see there is a bug, there's no way to enforce "title from disc" (step 5) if TitleID is found (step1)

7) if title not found in gamestdb or not in use, or ID not found, and "force title from disc header" is disabled by the user, set the game's title from the title found in the path in step 1


8) If we have both an ID and a Title, add that game to the gamelist and skip to process next game.

9) unsure when this step is reached...or what it's supposed to do.
looking randomly at the sources 2 years later is not easy. comments are not very good.
Apparently, it's only reached if the user selected "Force Title from disc".
so, when using that option, it feels like the ISO is opened multiple times in the process.

It seems it opens the ISO header and store the entire raw header into the game list without really checking and storing the ID/Title/Disc number/etc. to be used by the loader (resulting in empty games listed on the interface?)
Finally it saves the game's ID/Title (from the unverified RAW header?) association to the "Game title cache" file to speed up next launch of the loader.

it should never reach that step anyway as it should already have both ID and title from previous steps, unless it failed to find ID or title. but then, I'm not sure why it's trying to open the ISO again.


So, if you see all these steps, it should do :
Step 1 (get the TitleID from folder) [like wii games]
step 2 (get the filename, stop at the very first try : game.iso)
step 7 get title from gametdb [like wii games]
step 8 add game to game list [like wii games]
Skip to next found game in /games/ folder [like wii games]

only "verify the filename" is added, and it's a single check if you use "game.iso".
it's using a loop to check all names.
maybe using 4 conditions would be faster?

maybe using stat() is slower than using "check if file exists" ? though, "FileExists()" might use stat() itself. (to be verified)

Of maybe the condition-ception is not working and never return true?
if((found = (stat(fpath, &st) == 0)) == true)
if it's never true, then it ends loading ID from the iso header.


https://sourceforge.net/p/usbloadergx/code/HEAD/tree/trunk/source/GameCube/GCGames.cpp

PS: I don't have that many GC games to do speed tests.
maybe I could add a timer or cycle checker to compare different methods/commands?

I wonder does each folder/game get analyzed with this same method, or would one incorrect named TITLE ID cause an impact to the way each folder/game is loaded ?
Also a thought, could a duplicate cause some issues here ?
I don't have the same tech knowledge as you but am using trial & error to find best way to improve GC list loading times.
 
Last edited by d_bizzzz,

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
45
Location
Engine room, learning
XP
15,646
Country
France
if you create a random one [ABCD01] then the loader will use ABCD01 as titleID. to the laoder, it's not incorrect.
then, it'll check into Wiitdb.xml if that titleID exists to get the game's name. if it's not present then it'll look if present in "title cache". if not, it'll try to open the ISO to get the name from the ISO header and save it to "title cache". it'll take a little longer, but only the first time as the found title will be stored for consequent launches.

If the titleID is fully wrong (not 6 digit) then it's not even seen as a titleID, and all the steps to get the TitleID is parsed.
• my title[ABC]/game.iso <-- not 6 digit ID
• luigis_mansion/game.iso <--- really bad idea, 6 letter before underscore are seen as TitleID ! the loader will use "LUIGIS" as titleID and won't find anything in wiitdb.xml
• game title[ONE ID]/game.iso with another ID in the header ! <-- the loader will use the TitleID found in the folder name to speed the loading, and don't look inside the ISO unless the folder doesn't contain an ID6 at all. mismatching folder's TitleID and ISO's titleID is only a problem for wii games. not gamecube.



Duplicate are skipped, as the loader work with TitleID to list games and define game settings, it can't have 2 identical TitleID.
maybe confusing, don't try to understand if you don't: if you have the same titleID for two different games on two different devices (SD, USB, another USB etc.), the settings will be identical, you can't have different settings for same titleID, unless you store the settings on different devices (SD has priority on setting file, if not SD inserted then partition order up to 8 has priority)

for duplicated games, priority is user defined in the loader settings.
SD > USB
USB > SD
SD only
USB only

due to the way gamecube worked on early stage, "USB" is called "main" and can be placed on SD too.
so you can have 2 SD folders, one called main, one called SD.
SD > main : can be SD > SD
but usually people prefer using USB for more storage space. just know that setting use "main" as the USB path instead of calling it "USB".
 
Last edited by Cyan,
  • Like
Reactions: d_bizzzz

DJcubed

New Member
Newbie
Joined
Jun 2, 2020
Messages
1
Trophies
0
Age
39
XP
35
Country
United States
BOOST... as it's one of the only major issues GX still has. My library is 585 GC games... and the list load time sucks compared to Wii library.
 
  • Like
Reactions: Welohabi

NeroAyers

Member
Newcomer
Joined
Sep 14, 2020
Messages
12
Trophies
0
Age
31
XP
67
Country
Kuwait
Hi all! I want to update you guys that I've found a way to fix a slow loading of games via USB hd. Using the modmii guide, I follow the instructions and formatted my usb hd as fat32. After tons of troubleshooting, I finally found out that formatting it as wbsf fixed my slow loading issue.

Hope it helps others.

keywords:
usb loader gx is slow to load games, slow loading usb, how to load games faster
 

Welohabi

Member
OP
Newcomer
Joined
Feb 23, 2020
Messages
18
Trophies
0
Age
37
XP
113
Country
United States
Hi all! I want to update you guys that I've found a way to fix a slow loading of games via USB hd. Using the modmii guide, I follow the instructions and formatted my usb hd as fat32. After tons of troubleshooting, I finally found out that formatting it as wbsf fixed my slow loading issue.

Hope it helps others.

keywords:
usb loader gx is slow to load games, slow loading usb, how to load games faster


You cant format as WBFS and still use gamecube games.....
 
Last edited by Welohabi,

Inthebunker

New Member
Newbie
Joined
Jun 21, 2021
Messages
2
Trophies
0
Age
34
XP
29
Country
Chile
Any chance on this issue being fixed or should I just move on?
Hey I don't know if you still got the issue but I find a way to make it fast... Had the same issues.
Well in the features option exist the following:
Cache titles and Use Game Header Cache.
This two turn them on (you have to play here a little bit, my full ntsc emunand had some title issues but at some point it worked)
The thing is if you turn off cache titles it will have a fast boot (5 seconds) but with cache titles on its almost instant load.

I'm using a Toshiba 2tb SSD USB 3.0 (I think it's 4096kb cluster)
And a generic SDHC 32gb card. (32kb Cluster)
Almost full Gamecube NTSC and JAP/PAL exclusives
550 Wii Games
Full NTSC Wiiware/Virtual Console. (Neek2o)
Everything working except for The adventures of tin tin... (Full Wiiware don't let me in emunand, just postloader and even with disc boot has the freezing problems, but nothing that reset button can solve)
Hope works for you :)

--------------------- MERGED ---------------------------

i have the same issue.. did u ever fix it?
In my setup I solved it, check the post before this one
 
Last edited by Inthebunker,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • Psionic Roshambo @ Psionic Roshambo:
    Batman joined the Trans Justice League
    +2
  • Sicklyboy @ Sicklyboy:
    based af
    +2
  • Sonic Angel Knight @ Sonic Angel Knight:
    Forget the base, get on the roof.
  • K3Nv2 @ K3Nv2:
    Is that a bat in your buckle or are you just happy to have me
  • Psionic Roshambo @ Psionic Roshambo:
    Wonder "Woman" lol you wonder if they are a woman?
  • Psionic Roshambo @ Psionic Roshambo:
    The Riddler has questions...
  • K3Nv2 @ K3Nv2:
    Played a little of snow day glad I didn't spend $30
  • K3Nv2 @ K3Nv2:
    It's asthetic is okay maybe a good $10 grab
  • Psionic Roshambo @ Psionic Roshambo:
    Lol is it a game about doing cocaine?
  • K3Nv2 @ K3Nv2:
    Probably in pvp
  • Psionic Roshambo @ Psionic Roshambo:
    I tried Balders Gate II on the PS2 a few minutes ago, not bad lol
  • Psionic Roshambo @ Psionic Roshambo:
    My back catalog of games is like that scene at the end of Indiana Jones where the arc of the covenant is being stored in a giant ass warehouse
  • K3Nv2 @ K3Nv2:
    At least I can will my game catalog to family members
    +1
  • K3Nv2 @ K3Nv2:
    It's your problem now bitches
  • Psionic Roshambo @ Psionic Roshambo:
    Put it in your will that in order to receive any money they have to beat certain games, hard games and super shitty games...
  • Psionic Roshambo @ Psionic Roshambo:
    Say 20 bucks per Ninja Gaiden on the NES lol 60 bucks for all 3
  • Psionic Roshambo @ Psionic Roshambo:
    People you like "Beat level 1 of Ms Pacman" lol
  • K3Nv2 @ K3Nv2:
    Hello kitty ds is required
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Beat Celebrity Death Match on the PS1 omg tried it earlier today .... Absolutely trash
  • Psionic Roshambo @ Psionic Roshambo:
    Like -37 out of 10
  • Psionic Roshambo @ Psionic Roshambo:
    One of the worst games I have ever played
  • K3Nv2 @ K3Nv2:
    Make them rank up every cod game out
  • K3Nv2 @ K3Nv2:
    "Now I know why he took his own life"
    K3Nv2 @ K3Nv2: "Now I know why he took his own life"