[Wii] added workaround to fix crash when loaded from Wiiflow (or any apploader passing "usb1:/", "usb2:/", ... for application path in argv[0]) with newlib 2.5.0 and later versions

This commit is contained in:
ekeeke 2021-04-04 08:46:04 +02:00
parent a8e9c831e9
commit 3eac114065
2 changed files with 11 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 MiB

After

Width:  |  Height:  |  Size: 4.0 MiB

View File

@ -3,7 +3,7 @@
* *
* Genesis Plus GX * Genesis Plus GX
* *
* Copyright Eke-Eke (2007-2019), based on original work from Softdev (2006) * Copyright Eke-Eke (2007-2021), based on original work from Softdev (2006)
* *
* Redistribution and use of this code or any derivative works are permitted * Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met: * provided that the following conditions are met:
@ -375,6 +375,15 @@ int main (int argc, char *argv[])
if (fatMounted) if (fatMounted)
{ {
#ifdef HW_RVL
/* workaround against regression introduced in newlib 2.5.0 (and later versions) causing crash when loaded from Wiiflow (or any apploader passing "usb1:/", "usb2:/", etc in application path) */
if ((argc > 0) && !strncasecmp(argv[0], "usb", 3))
{
/* set default path using exact device name mounted by libfat */
chdir("usb:/");
}
#endif
/* base directory */ /* base directory */
char pathname[MAXPATHLEN]; char pathname[MAXPATHLEN];
sprintf (pathname, DEFAULT_PATH); sprintf (pathname, DEFAULT_PATH);