Harmonized with new OSystem API.

svn-id: r13245
This commit is contained in:
Marcus Comstedt 2004-03-13 13:41:50 +00:00
parent 4aa240e0e5
commit 882b0a094a
5 changed files with 76 additions and 38 deletions

View File

@ -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;
}

View File

@ -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();

View File

@ -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) {
// Dummy.
return true;
}
case PROP_GET_SAMPLE_RATE:
return 22050;
case PROP_SET_WINDOW_CAPTION:
gGameName = value->caption;
break;
}
return 0;
void OSystem_Dreamcast::setWindowCaption(const char *caption)
{
gGameName = caption;
}
void OSystem_Dreamcast::quit() {

View File

@ -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;
}

View File

@ -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;