ps2homebrew / wLaunchELF

ELF loader and File browser for Sony PlayStation 2
Other
491 stars 51 forks source link

[ISSUE]: Commit 0156510d00858f784322248cf90f3aaf863240f4 breaks PS2Disk (and probably other functions) #116

Closed karas84 closed 10 months ago

karas84 commented 10 months ago

Checks

Describe the issue

Commit 0156510d00858f784322248cf90f3aaf863240f4 which introduced 64-bit size support breaks PS2Disk. The issue manifests as wLaunchELF giving the error PS2Disk => Failed CDVD 0x14. The "problem" seems to lie in the genLseek used by preloadCNF. when preloadCNF tries to guess the media type by looking for a proper SYSTEM.CNF it first tries to open it with genOpen which succeeds, and then it tries to get its file size using genLseek which returns -1 (actually it returns 4294967295 as the value is not cast to an int). The commit updated the genLseek function to use lseek64 which at least in this in this specific instance returns -1. Reverting back (as a test) to lseek, the correct SYSTEM.CNF size is returned and the game boots correctly. It is reasonable to assume that the change may affect other use cases and break other functions.

Console model

PCSX2 and SCPH90004

karas84 commented 10 months ago

I created a PR (#117) that should fix the issue.