Issue when argv[0] is usb1:/... on Wii

When RA dol file launched from Wiiflow, getcwd return nothing, dirs[DEFAULT_DIR_CORE] is empty and RA "info", "autoconfig",.... dirs are on root /
This seems to be because argv[0] is starting with "usb1://...dol" (maybe incompatible libfat)
This patch allow to default dirs[DEFAULT_DIR_CORE]  on Wii to the dirname of the DOL in such cases.
This commit is contained in:
pcjco 2021-01-19 22:47:17 +01:00 committed by GitHub
parent ded9a428de
commit 3e4aca8666
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -192,6 +192,12 @@ static void frontend_gx_get_env(
* as a result the cfg file is not found. */
if (*argc > 2 && argv[1] != NULL && argv[2] != NULL)
{
if (strncmp("usb1", argv[0], 4) == 0 || strncmp("usb2", argv[0], 4) == 0)
{
strncpy(g_defaults.dirs[DEFAULT_DIR_CORE],argv[0], strlen(argv[0]));
strncpy(g_defaults.dirs[DEFAULT_DIR_CORE]," usb", 4);
memmove(g_defaults.dirs[DEFAULT_DIR_CORE], g_defaults.dirs[DEFAULT_DIR_CORE]+1, strlen(g_defaults.dirs[DEFAULT_DIR_CORE]));
}
if(gx_devices[GX_DEVICE_SD].mounted)
{
chdir("sd:/");