aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/audiocd/default/default-audiocd.cpp16
-rw-r--r--backends/audiocd/default/default-audiocd.h12
-rw-r--r--base/commandLine.cpp5
3 files changed, 30 insertions, 3 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;
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 19702ea36d..c34e4d43c0 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -100,8 +100,9 @@ static const char HELP_STRING[] =
" -u, --dump-scripts Enable script dumping if a directory called 'dumps'\n"
" exists in the current directory\n"
"\n"
- " --cdrom=NUM CD drive to play CD audio from (default: 0 = first\n"
- " drive)\n"
+ " --cdrom=DRIVE CD drive to play CD audio from; can either be a\n"
+ " drive, path, or numeric index (default: 0 = best\n"
+ " choice drive)\n"
" --joystick[=NUM] Enable joystick input (default: 0 = first joystick)\n"
" --platform=WORD Specify platform of game (allowed values: 2gs, 3do,\n"
" acorn, amiga, atari, c64, fmtowns, nes, mac, pc, pc98,\n"