aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorMatthew Hoops2015-10-01 19:12:07 -0400
committerJohannes Schickel2016-03-13 13:57:01 +0100
commit1626fbd633ff5e39ee5551b6e839def62ef9b599 (patch)
tree96e8455e550424cbdc360a9a9f8242817b0d4993 /backends
parente39faa239a8b0149d3be37e21afb173b936ab74c (diff)
downloadscummvm-rg350-1626fbd633ff5e39ee5551b6e839def62ef9b599.tar.gz
scummvm-rg350-1626fbd633ff5e39ee5551b6e839def62ef9b599.tar.bz2
scummvm-rg350-1626fbd633ff5e39ee5551b6e839def62ef9b599.zip
BACKENDS: Allow for specifying a drive via the cdrom option
Diffstat (limited to 'backends')
-rw-r--r--backends/audiocd/default/default-audiocd.cpp16
-rw-r--r--backends/audiocd/default/default-audiocd.h12
2 files changed, 27 insertions, 1 deletions
diff --git a/backends/audiocd/default/default-audiocd.cpp b/backends/audiocd/default/default-audiocd.cpp
index 0c5bb8df03..4c08938741 100644
--- a/backends/audiocd/default/default-audiocd.cpp
+++ b/backends/audiocd/default/default-audiocd.cpp
@@ -155,5 +155,19 @@ DefaultAudioCDManager::Status DefaultAudioCDManager::getStatus() const {
}
bool DefaultAudioCDManager::openCD() {
- return openCD(ConfMan.getInt("cdrom"));
+ Common::String cdrom = ConfMan.get("cdrom");
+
+ // Try to parse it as an int
+ char *endPos;
+ int drive = strtol(cdrom.c_str(), &endPos, 0);
+
+ // If not an integer, treat as a drive path
+ if (endPos == cdrom.c_str())
+ return openCD(cdrom);
+
+ if (drive < 0)
+ return false;
+
+ return openCD(drive);
}
+
diff --git a/backends/audiocd/default/default-audiocd.h b/backends/audiocd/default/default-audiocd.h
index 6011a8fafd..5c7ee9ee34 100644
--- a/backends/audiocd/default/default-audiocd.h
+++ b/backends/audiocd/default/default-audiocd.h
@@ -26,6 +26,10 @@
#include "backends/audiocd/audiocd.h"
#include "audio/mixer.h"
+namespace Common {
+class String;
+} // End of namespace Common
+
/**
* The default audio cd manager. Implements emulation of audio cd playback.
*/
@@ -51,12 +55,20 @@ public:
* @note The index is implementation-defined, but 0 is always the best choice
*/
virtual bool openCD(int drive) { return false; }
+
virtual void updateCD() {}
virtual bool pollCD() const { return false; }
virtual void playCD(int track, int num_loops, int start_frame, int duration) {}
virtual void stopCD() {}
protected:
+ /**
+ * Open a CD from a specific drive
+ * @param drive The name of the drive/path
+ * @note The drive parameter is platform-specific
+ */
+ virtual bool openCD(const Common::String &drive) { return false; }
+
Audio::SoundHandle _handle;
bool _emulating;