mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-12-26 19:21:49 +01:00
[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:
parent
a8e9c831e9
commit
3eac114065
Binary file not shown.
Before Width: | Height: | Size: 4.0 MiB After Width: | Height: | Size: 4.0 MiB |
13
gx/main.c
13
gx/main.c
@ -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:
|
||||||
@ -332,7 +332,7 @@ void shutdown(void)
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int main (int argc, char *argv[])
|
int main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
/* enable 64-byte fetch mode for L2 cache */
|
/* enable 64-byte fetch mode for L2 cache */
|
||||||
L2Enhance();
|
L2Enhance();
|
||||||
|
|
||||||
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user