libretro / picodrive

Fast MegaDrive/MegaCD/32X emulator
Other
41 stars 63 forks source link

The core doesn't like special characters in path on Windows. #123

Closed bslenul closed 2 years ago

bslenul commented 4 years ago

Hey!

I'm personally not using special characters in my folder names but I guess it can be a real issue for some people depending on their language. I noticed it here, while helping someone on Reddit: https://www.reddit.com/r/RetroArch/comments/hbk3cc/failed_to_load_content_fbneo/fv9oj4h/

When loading a rom, if path contains special characters the game won't load, log file will spit a [libretro ERROR] Failed to detect ROM/CD image type. error with MD/32X, or [libretro ERROR] Invalid CD image with SCD.

Not sure which characters are problematic tho, but ç, ã, é and è for sure.

Probably worth noting: the issue DOES NOT happen on my Linux Mint VM or my Android phone! Only on Windows 10.

bslenul commented 4 years ago

Oh, and I just noticed that it only happens with extracted rom or if cache folder contains special characters too.

So basically:

negativeExponent commented 3 years ago

since this has since posted more than a year ago, can you re-confirm issue still happens on latest commit?

bslenul commented 3 years ago

Hey! Yes, still the exact same errors. Also I didn't mention it here but it also affect the system path, like Sega-CD fails to boot if the BIOS is in a folder with special characters.

negativeExponent commented 3 years ago

Hey! Yes, still the exact same errors. Also I didn't mention it here but it also affect the system path, like Sega-CD fails to boot if the BIOS is in a folder with special characters.

thats interesting, since im doing the same thing on pcsx that is done here (pls confirm final pr in pcsx still works)

negativeExponent commented 3 years ago

i see the issue now. can you check if this PR works now.

https://github.com/libretro/picodrive/pull/152

bslenul commented 3 years ago

Seems to work fine with special BIOS path and for content as well (tested a .md and a .cue/.bin), excepted for chd which crashes RA completely: crash-210502-103014.log

negativeExponent commented 3 years ago

ok, aside from my small change above, try to change this from dir: "pico/cd/include/libchdr/coretypes.h"

#define core_file FILE
#define core_fopen(file) fopen(file, "rb")
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WIN64__)
    #define core_fseek _fseeki64
    #define core_ftell _ftelli64
#elif defined(_LARGEFILE_SOURCE) && defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64
    #define core_fseek fseeko64
    #define core_ftell ftello64
#else
    #define core_fseek fseeko
    #define core_ftell ftello
#endif
#define core_fread(fc, buff, len) fread(buff, 1, len, fc)
#define core_fclose fclose

to this:


#ifdef USE_LIBRETRO_VFS
#define core_file RFILE
#define core_fopen(file) rfopen(file, "rb")
#define core_fseek rfseek
#define core_ftell rftell
#define core_fread(fc, buff, len) rfread(buff, 1, len, fc)
#define core_fclose rfclose
#else
#define core_file FILE
#define core_fopen(file) fopen(file, "rb")
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WIN64__)
    #define core_fseek _fseeki64
    #define core_ftell _ftelli64
#elif defined(_LARGEFILE_SOURCE) && defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64
    #define core_fseek fseeko64
    #define core_ftell ftello64
#else
    #define core_fseek fseeko
    #define core_ftell ftello
#endif
#define core_fread(fc, buff, len) fread(buff, 1, len, fc)
#define core_fclose fclose
#endif
bslenul commented 3 years ago

Yay that worked! Good job again! ❤️

edit: logs if needed: https://pastebin.com/vnPzt3kT

negativeExponent commented 3 years ago

Ok, just a recap, in order for this fix to be "fixed" 2 things has to be done.

  1. is have platfrom windows in Makefile have the USE_LIBRETRO_VFS=1 flag
  2. libchdr has to be updated as stated in my previous comment https://github.com/libretro/picodrive/issues/123#issuecomment-830780252 (or whatever maintaner wants to do and how with it since libchdr is implemented as a submodule instead of a direct dependency like other cores utilizing libchdr)

https://github.com/libretro/picodrive/pull/152

irixxxx commented 2 years ago

VFS is now used for all platforms and I asked rtissera to include a fix in libchdr, so this should now be fixed.