aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Comstedt2004-03-13 13:41:50 +0000
committerMarcus Comstedt2004-03-13 13:41:50 +0000
commit882b0a094a050e2fa8c357d0bd81d155315d66ba (patch)
tree5095565ec9ccea2c389703b3cce5162fa1a78c0a
parent4aa240e0e5585828753663c9f9a8a65abf66f56e (diff)
downloadscummvm-rg350-882b0a094a050e2fa8c357d0bd81d155315d66ba.tar.gz
scummvm-rg350-882b0a094a050e2fa8c357d0bd81d155315d66ba.tar.bz2
scummvm-rg350-882b0a094a050e2fa8c357d0bd81d155315d66ba.zip
Harmonized with new OSystem API.
svn-id: r13245
-rw-r--r--backends/dc/audio.cpp15
-rw-r--r--backends/dc/dc.h44
-rw-r--r--backends/dc/dcmain.cpp19
-rw-r--r--backends/dc/display.cpp34
-rw-r--r--backends/dc/input.cpp2
5 files changed, 76 insertions, 38 deletions
diff --git a/backends/dc/audio.cpp b/backends/dc/audio.cpp
index 2838e0779d..bf475f1cce 100644
--- a/backends/dc/audio.cpp
+++ b/backends/dc/audio.cpp
@@ -36,13 +36,8 @@ void initSound()
bool OSystem_Dreamcast::setSoundCallback(SoundProc proc, void *param)
{
-#if SAMPLE_MODE == 0
- assert(format == SOUND_16BIT);
-#elif SAMPLE_MODE == 1
- assert(format == SOUND_8BIT);
-#else
-#error Invalid SAMPLE_MODE
-#endif
+ assert(SAMPLE_MODE == 0);
+
_sound_proc_param = param;
_sound_proc = proc;
@@ -93,3 +88,9 @@ void OSystem_Dreamcast::checkSound()
if((fillpos += n) >= curr_ring_buffer_samples)
fillpos = 0;
}
+
+int OSystem_Dreamcast::getOutputSampleRate() const
+{
+ return 22050;
+}
+
diff --git a/backends/dc/dc.h b/backends/dc/dc.h
index a72ecc252b..1425c5759b 100644
--- a/backends/dc/dc.h
+++ b/backends/dc/dc.h
@@ -30,6 +30,19 @@ class OSystem_Dreamcast : public OSystem {
public:
OSystem_Dreamcast();
+
+ // Retrieve a list of all graphics modes supported by this backend.
+ const GraphicsMode *getSupportedGraphicsModes() const;
+
+ // Switch to the specified graphics mode.
+ bool setGraphicsMode(int mode);
+
+ // Switch to the specified graphics mode.
+ bool setGraphicsMode(const char *name);
+
+ // Determine which graphics mode is currently active.
+ int getGraphicsMode() const;
+
// Set colors of the palette
void setPalette(const byte *colors, uint start, uint num);
@@ -49,11 +62,10 @@ class OSystem_Dreamcast : public OSystem {
// Either show or hide the mouse cursor
bool show_mouse(bool visible);
+
+ // Move ("warp") the mouse cursor to the specified position.
void warp_mouse(int x, int y);
- // Set the position of the mouse cursor
- void set_mouse_pos(int x, int y);
-
// Set the bitmap that's used when drawing the cursor.
void set_mouse_cursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y);
@@ -73,7 +85,14 @@ class OSystem_Dreamcast : public OSystem {
// Set function that generates samples
bool setSoundCallback(SoundProc proc, void *param);
void clearSoundCallback();
+
+ // Determine the output sample rate. Audio data provided by the sound
+ // callback will be played using this rate.
+ int getOutputSampleRate() const;
+ // Initialise the specified CD drive for audio playback.
+ bool openCD(int drive);
+
// Poll cdrom status
// Returns true if cd audio is playing
bool poll_cdrom();
@@ -90,9 +109,6 @@ class OSystem_Dreamcast : public OSystem {
// Quit
void quit();
- // Set a parameter
- uint32 property(int param, Property *value);
-
// Overlay
void show_overlay();
void hide_overlay();
@@ -101,16 +117,20 @@ class OSystem_Dreamcast : public OSystem {
void copy_rect_overlay(const int16 *buf, int pitch, int x, int y, int w, int h);
// Add a callback timer
- virtual void set_timer(TimerProc callback, int timer);
+ void set_timer(TimerProc callback, int timer);
// Mutex handling
- virtual MutexRef createMutex();
- virtual void lockMutex(MutexRef mutex);
- virtual void unlockMutex(MutexRef mutex);
- virtual void deleteMutex(MutexRef mutex);
+ MutexRef createMutex();
+ void lockMutex(MutexRef mutex);
+ void unlockMutex(MutexRef mutex);
+ void deleteMutex(MutexRef mutex);
+
+ // Set a window caption or any other comparable status display to the
+ // given value.
+ void setWindowCaption(const char *caption);
// Savefile handling
- virtual SaveFileManager *get_savefile_manager();
+ SaveFileManager *get_savefile_manager();
static OSystem *create();
diff --git a/backends/dc/dcmain.cpp b/backends/dc/dcmain.cpp
index 10970122b3..82ab1b666b 100644
--- a/backends/dc/dcmain.cpp
+++ b/backends/dc/dcmain.cpp
@@ -109,20 +109,15 @@ void OSystem_Dreamcast::update_cdrom()
// Dummy. The CD drive takes care of itself.
}
-uint32 OSystem_Dreamcast::property(int param, Property *value)
+bool OSystem_Dreamcast::openCD(int drive)
{
- switch(param) {
-
- case PROP_GET_SAMPLE_RATE:
- return 22050;
-
- case PROP_SET_WINDOW_CAPTION:
- gGameName = value->caption;
- break;
+ // Dummy.
+ return true;
+}
- }
-
- return 0;
+void OSystem_Dreamcast::setWindowCaption(const char *caption)
+{
+ gGameName = caption;
}
void OSystem_Dreamcast::quit() {
diff --git a/backends/dc/display.cpp b/backends/dc/display.cpp
index 840454d51b..23365ba7ca 100644
--- a/backends/dc/display.cpp
+++ b/backends/dc/display.cpp
@@ -238,7 +238,7 @@ bool OSystem_Dreamcast::show_mouse(bool visible)
return last;
}
-void OSystem_Dreamcast::set_mouse_pos(int x, int y)
+void OSystem_Dreamcast::warp_mouse(int x, int y)
{
if (_overlay_visible) {
x += _overlay_x;
@@ -248,11 +248,6 @@ void OSystem_Dreamcast::set_mouse_pos(int x, int y)
_ms_cur_y = (_hires? (y>>1):y);
}
-void OSystem_Dreamcast::warp_mouse(int x, int y)
-{
- set_mouse_pos(x, y);
-}
-
void OSystem_Dreamcast::set_mouse_cursor(const byte *buf, uint w, uint h,
int hotspot_x, int hotspot_y)
{
@@ -570,3 +565,30 @@ void OSystem_Dreamcast::copy_rect_overlay(const int16 *buf, int pitch,
} while (--h);
_overlay_dirty = true;
}
+
+
+static const OSystem::GraphicsMode gfxmodes[] = {
+ { "default", "640×480 16bpp", 0 },
+ { NULL, NULL, 0 }
+};
+
+const OSystem::GraphicsMode *OSystem_Dreamcast::getSupportedGraphicsModes() const
+{
+ return gfxmodes;
+}
+
+bool OSystem_Dreamcast::setGraphicsMode(int mode)
+{
+ return mode == 0;
+}
+
+bool OSystem_Dreamcast::setGraphicsMode(const char *name)
+{
+ return strcmp(name, "default") == 0;
+}
+
+int OSystem_Dreamcast::getGraphicsMode() const
+{
+ return 0;
+}
+
diff --git a/backends/dc/input.cpp b/backends/dc/input.cpp
index d177b229a1..11417b5461 100644
--- a/backends/dc/input.cpp
+++ b/backends/dc/input.cpp
@@ -196,7 +196,7 @@ bool OSystem_Dreamcast::poll_event(Event *event)
event->event_code = EVENT_MOUSEMOVE;
_ms_old_x = _ms_cur_x;
_ms_old_y = _ms_cur_y;
- set_mouse_pos(event->mouse.x, event->mouse.y);
+ warp_mouse(event->mouse.x, event->mouse.y);
return true;
} else {
event->event_code = (EventCode)0;