mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-26 12:48:16 +00:00
BACKENDS: Add support for opening a CD on Linux by path or drive
This commit is contained in:
parent
1626fbd633
commit
442f91c622
@ -256,6 +256,9 @@ public:
|
||||
void closeCD();
|
||||
void playCD(int track, int numLoops, int startFrame, int duration);
|
||||
|
||||
protected:
|
||||
bool openCD(const Common::String &drive);
|
||||
|
||||
private:
|
||||
struct Device {
|
||||
Device(const Common::String &n, dev_t d) : name(n), device(d) {}
|
||||
@ -320,6 +323,23 @@ bool LinuxAudioCDManager::openCD(int drive) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LinuxAudioCDManager::openCD(const Common::String &drive) {
|
||||
DeviceList devices;
|
||||
if (!tryAddDrive(devices, drive) && !tryAddPath(devices, drive))
|
||||
return false;
|
||||
|
||||
_fd = open(devices[0].name.c_str(), O_RDONLY | O_NONBLOCK, 0);
|
||||
if (_fd < 0)
|
||||
return false;
|
||||
|
||||
if (!loadTOC()) {
|
||||
closeCD();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void LinuxAudioCDManager::closeCD() {
|
||||
if (_fd < 0)
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user