Skip to content

Commit 8f3147f

Browse files
committed
ps2: normalize CWD to work around PS2SDK bug
Workaround for PS2SDK issue ps2dev/ps2sdk#805. PS2SDK's initialization routine does not properly set the CWD for HDD paths, leading to all slashes being converted to backslashes. This change ensures that they are converted back to slashes, until the issue is properly fixed in PS2SDK.
1 parent 04229be commit 8f3147f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

frontend/drivers/platform_ps2.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,16 @@ static void common_init_drivers(bool extra_drivers)
310310
poweroffSetCallback(&poweroffHandler, NULL);
311311

312312
getcwd(cwd, sizeof(cwd));
313+
314+
// Workaround for PS2SDK issue: https://github.com/ps2dev/ps2sdk/issues/805
315+
// PS2SDK's initialization routine does not properly set the CWD for HDD
316+
// paths, leading to all slashes being converted to backslashes. Manually
317+
// convert them back to slashes to work around the issue until it is
318+
// properly fixed in PS2SDK.
319+
int bootDeviceID = getBootDeviceID(cwd);
320+
if (bootDeviceID == BOOT_DEVICE_HDD || bootDeviceID == BOOT_DEVICE_HDD0)
321+
pathname_conform_slashes_to_os(cwd);
322+
313323
#if !defined(IS_SALAMANDER) && !defined(DEBUG)
314324
/* If it is not Salamander, we need to go one level
315325
* up for setting the CWD. */

0 commit comments

Comments
 (0)