Two seperate instances of USB Loader GX?

Northrup

Member
OP
Newcomer
Joined
Jun 10, 2022
Messages
20
Trophies
0
Location
Home
XP
95
Country
Germany
I'm trying to get two seperate instances of USB Loader GX running, one with Ocarina permanantly turned off and one with Ocarina permanently turned on, so I don't have to manually turn Ocarina on or of every single time.

I tried just copying my existing usbloader_gx folder and renaming it to usblgx_ocarina and edited the name in the meta.xml file so that I can easily tell the two usbloaders apart in HBC.
But when i start the modded loader and turn Ocarina on, it's also turned on when I start the unmodded loader.
So it seems that somehow they both share the same config files...?
I already looked into the GXGlobal.cfg, but there is no config path entry. Maybe I need to set it manually, but how could I do that?

Thanks in advance to everyone that can help me with this.
 

MXRD4K1LL4

Well-Known Member
Member
Joined
Jan 17, 2022
Messages
139
Trophies
0
XP
377
Country
Canada
I'm trying to get two seperate instances of USB Loader GX running, one with Ocarina permanantly turned off and one with Ocarina permanently turned on, so I don't have to manually turn Ocarina on or of every single time.

I tried just copying my existing usbloader_gx folder and renaming it to usblgx_ocarina and edited the name in the meta.xml file so that I can easily tell the two usbloaders apart in HBC.
But when i start the modded loader and turn Ocarina on, it's also turned on when I start the unmodded loader.
So it seems that somehow they both share the same config files...?
I already looked into the GXGlobal.cfg, but there is no config path entry. Maybe I need to set it manually, but how could I do that?

Thanks in advance to everyone that can help me with this.
Some homebrew apps or wads sometimes save files on a folder at the root of the SD card. I don't know for usb loader gx, but for any other loader that was there so go take a look at your sd (or maybe usb) root and search a folder like usb loader gx or things like that and you'll see boot.dol and other things like that. That's more applicable for wads but go do a check, we never know!
 

PhysicalPain

Member
Newcomer
Joined
Jun 3, 2022
Messages
19
Trophies
0
Location
Brandenburg
XP
86
Country
Germany
I would rather say that the app specifically looks for config files in the apps/usbloader_gx path. So no matter what you name the folder you start the app from, it loads the config file from that path.

To change this you would have to set a custom path, but I don't know if this is possible. You would have to ask @Cyan or @blackb0x.
 

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
How are you launching the different instances? via the hbc?

If you are using a forwarder channel you would need 2 separate ones, one specially crafted to use the alternate directory
If I don't mistaken, that would affect only the forwarder to check if the user want to use SD or USB and which IOS to use before launching the loader.
I think once in the loader, it would not use it anymore, the loader re-check the path and mount the config by itself.


I'm trying to get two seperate instances of USB Loader GX running

humm, there are ways to do it, but it's even more annoying than switching a setting.
You actually have to insert/eject the SD card if you are using the forwarder.

it loads the config file from that path.
It actually loads from different paths, so there are some tricks to get two instances. (more would be too complicated)

the loader and the forwarder look at different places for the settings, so you have to play with that.
for example the forwarder looks at :
sd:/config/ This was the VERY old USBLoaderGX v1.0 folder, and it's still in the sources for compatibility reason.
Then at two different locations on SD. If there's no config found, it mounts USB and parsed all 3 path on each mounted partition from 1 to 8
if it finds a config file, it uses that path to load the meta.xml to loads the launch arguments from it.

so 9 times this :
x:/config/GXGlobal.cfg
x:/apps/usbloader_gx/GXGlobal.cfg
x:/apps/usbloadergx/GXGlobal.cfg


if you have an SD inserted, it'll find the config on it and use it.
if your SD is not inserted, it'll go to USB and use the first setting found, etc.
So you can have two different settings : one on SD, one on USB. SD has priority if inserted.

I already looked into the GXGlobal.cfg, but there is no config path entry. Maybe I need to set it manually, but how could I do that?
There is actually a loader's path setting in GXGlobal, it's called : update_path
Default update path is : x:/apps/usbloader_gx/
And you are right, I think you need to edit the config manually.

If you have different folders for the loader on the same device, you should be sure to change the "update path" to point to the correct folder. For example, this is used for auto-update and prevent replacing a different version (for example main loader, maintained mods, etc.). It could have been useful in case of different projects, with different devs. But, it never really happened, there weren't any different maintained mods. only the main app, and dead mods.
Now there is Blackb0x mod which is maintained, but the "main" project isn't anymore, so it's also losing its usefulness. Blackb0x version will supersede the official version and become the official branch soon.


You could try to edit that variable and see if it works like intended, but I think it's broken for proper multiple instances.
Unfortunately, the config path is still hardcoded, and doesn't use update_path variable.
Developers should have been using it to access all resources dynamically, but I think we didn't always took care of it.

I checked, and the loader is looking for the config at two different (hardcoded) places :
x:/apps/usbloader_gx/GXGlobal.cfg
x:/config/GXGlobal.cfg
span over SD, then USB1 up to USB8, so you can also use the insert/eject SD trick from HBC.


If the setting manager sources are updated to look first on the "current path where boot.dol is launched from" and use it to look for the config, or to generate it if no other are found, then multiple instance would work.
I think it's a small update to make it compatible.
it's CSettings.cpp > bool CSettings::FindConfig()
 
Last edited by Cyan,
  • Like
Reactions: jeannotte

XFlak

Wiitired but still kicking
Member
Joined
Sep 12, 2009
Messages
13,888
Trophies
3
Age
38
Location
Cyprus, originally from Toronto
Website
modmii.github.io
XP
9,938
Country
Cyprus
If I don't mistaken, that would affect only the forwarder to check if the user want to use SD or USB and which IOS to use before launching the loader.
I think once in the loader, it would not use it anymore, the loader re-check the path and mount the config by itself.
Correct except you could also launch it using unique meta.xml's if using unique forwarder paths, and iirc u can control some things via the meta.xml arguments like what ios is loaded and such. That being said that would only impact how it's launched initially and later it may very well be overriden by the apps global settings, I expect u would know better than me about that stuff though :)
 
  • Like
Reactions: Cyan and jeannotte

VentRhythm

Member
Newcomer
Joined
Jan 12, 2021
Messages
8
Trophies
0
Age
33
XP
274
Country
United States
If the setting manager sources are updated to look first on the "current path where boot.dol is launched from" and use it to look for the config, or to generate it if no other are found, then multiple instance would work.
I think it's a small update to make it compatible.
it's CSettings.cpp > bool CSettings::FindConfig()

First of all, thank you for all of your contributions. I have also been trying to figure out if two config files would be possible for 2 separate instances of usb loader gx. I stumbled onto this thread the other day. How could I go about making those changes that you mentioned here in your post? Thanks!
 

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
First of all, thank you for all of your contributions. I have also been trying to figure out if two config files would be possible for 2 separate instances of usb loader gx. I stumbled onto this thread the other day. How could I go about making those changes that you mentioned here in your post? Thanks!

there are different things you need to do :

- you'll have to update the CSettings.cpp file.
You need to add a way to "look into the current folder where the boot.dol is launched from" when looking for places to load for the config file from.
I think the path to the current folder should be available as Argument 0 at launch.
You can find arguments reading example in StartUpProcess.cpp, startup class, parse argument method, etc.
The examples are about named arguments from "argv[1]" etc, but argv[0] should be the path.


- you need to be sure all references to any config files are properly prefixed by "update_path" variable. be sure there are no hardcoded path to apps/usbloader_gx/ or apps/usbloadergx/ or /config/
It's not only about GXGlobal, which defines most of other path the user wants to use, but also other path that the user doesn't have access to, like gamelist, game cache, etc.

This alone should be enough if the user change the "update_path" variable manually in the GXGlobal after it has been generated, or by copying an existing installation to a different folder.
But if you might want the loader to actually generate the config files directly into the current folder on a new installation (only boot.dol, meta.xml and icon.png in the folder, and NO other config file in /config/ or in USB partition), then
Csettings, line 1342, there are too much code in here.
it's first trying to generate the config file in /apps/usbloader_gx/ and if it can't access it, it tries in /config/ (why would config work more than apps? if the SD is in write mode, /config/ path should never be reached).
Instead, it should be replaced with "update_path" *, unless the SD card is write protected, in that case it looks for USB partitions to generate it. (SD should NEVER be write protected!)

* update_path should be stored in memory at loader's launch, if config file is not loaded yet or not present, then the Csettings.cpp sources will have that information to create the config to the proper place. There are few variables stored in memory at launch, used to generate the config, or until the config file is actually read from a file.
 
  • Like
Reactions: jeannotte

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
when I was still working on it, I had the idea of merging the Tabmod idea and the multiple instance idea into a single instance and easy to switch "profile" idea.
But it would have require too much work and I never did it, but I started thinking about it and how I wanted it to look.

the idea was that the user could easilly add new "profile" by clicking a + button (choose new or duplicate current profile), name it like he wanted and set an icon of his choice, for example one could have different profiles : "kids", "Dad", "John", or "RPG" or "WiiWare" or "Gamecube + Wii RPG", etc. (which would appear like tabgroup current looks)
each profile would have their own "entire settings" (global AND individual, not just console's origin option from 4th icon) and remember ALL the user's setup (visual, filters, paths, etc.) for easy switching, some profile could be password protected to prevent kids from accessing it, etc.
Something like Tabgroup, but improved and expanded to the entire Loader's settings, to switch back and forth easily. That would have feel like Multiple instance.

I also wanted to reorganize the settings and the visual inside the loader at the same time, to make it easier to manage profiles, and look more modern (like Phone apps) and easier to understand by renaming and moving elements to be more intuitive.
I would have tag it v4.0, But, seeing how much work it required, which also imply changing the themes ! making all 3.0 themes incompatible, I think the simple Multiple instance idea from different folders is far easier to make.
 
Last edited by Cyan,

Dubya

Active Member
Newcomer
Joined
Dec 16, 2019
Messages
43
Trophies
0
Age
104
XP
368
Country
United States
Sorry to dig up an old thread.

Curious if this has been tried or even simplified over the last couple years?

I'm wanting to run 2 separate USB Loader GXs ... one for Wii and one for GameCube ... all games and files are on one SD card
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Xdqwerty @ Xdqwerty: Also brb