win32: fix opening CD drive on command line. libretro build fix

This commit is contained in:
Flyinghead 2024-12-12 15:52:07 +01:00
parent 9ea0563a7a
commit 27a0497dd5
3 changed files with 11 additions and 4 deletions

View File

@ -680,7 +680,7 @@ if(USE_LIBCDIO)
target_compile_definitions(${PROJECT_NAME} PRIVATE USE_LIBCDIO)
if(MINGW)
# Force static link
target_link_libraries(${PROJECT_NAME} PRIVATE "-l:libcdio.a -l:libiconv.a")
target_link_libraries(${PROJECT_NAME} PRIVATE "-l:libcdio.a -l:libiconv.a -lwinmm")
else()
target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::CDIO)
endif()

View File

@ -31,7 +31,7 @@
#endif
#endif
#ifdef _WIN32
#if defined(_WIN32) && !defined(USE_LIBCDIO) // libcdio has its equivalent version
#undef fopen
void *fopen_utf8(const char * filename, const char * mode)

View File

@ -89,14 +89,21 @@ struct CdioDrive : public Disc
if (!devices.empty())
{
// If the list isn't empty, check that an entry exists for the current path
std::string lpath(path);
#ifdef _WIN32
if (lpath.substr(0, 4) != "\\\\.\\")
lpath = "\\\\.\\" + lpath;
#endif
bool found = false;
for (const std::string& dev : devices)
if (dev == path) {
if (dev == lpath) {
found = true;
break;
}
if (!found)
if (!found) {
WARN_LOG(GDROM, "%s isn't a CD device", path);
return false;
}
}
pCdio = cdio_open(path, DRIVER_DEVICE);
if (pCdio == nullptr) {