Skip to content

Commit b7f7e11

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 bc5c61f commit b7f7e11

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
@@ -314,6 +314,16 @@ static void common_init_drivers(bool extra_drivers)
314314
#endif
315315

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

0 commit comments

Comments
 (0)