From 3e4aca86668a3cae189c585702c6f7042c361946 Mon Sep 17 00:00:00 2001 From: pcjco Date: Tue, 19 Jan 2021 22:47:17 +0100 Subject: [PATCH] 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. --- frontend/drivers/platform_gx.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/drivers/platform_gx.c b/frontend/drivers/platform_gx.c index bc79f3fddc..46a646f49d 100644 --- a/frontend/drivers/platform_gx.c +++ b/frontend/drivers/platform_gx.c @@ -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:/");