- Added optional use of palette

- Common sound struct
- Move common quit stuff to the base class
- Fixed CD functions, now MP3s work properly
- Make mutex functions virtual so that they can be redefined
- little cleanup

svn-id: r20503
This commit is contained in:
Chris Apers 2006-02-11 09:26:04 +00:00
parent 5cf077339e
commit 7f1771cba8
2 changed files with 33 additions and 17 deletions

View File

@ -1,7 +1,7 @@
/* ScummVM - Scumm Interpreter
* Copyright (C) 2001 Ludvig Strigeus
* Copyright (C) 2001-2006 The ScummVM project
* Copyright (C) 2002-2005 Chris Apers - PalmOS Backend
* Copyright (C) 2002-2006 Chris Apers - PalmOS Backend
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -17,7 +17,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* $Header$
* $URL$
* $Id$
*
*/
@ -39,6 +40,7 @@ OSystem_PalmBase::OSystem_PalmBase() {
_setMode = GFX_NORMAL;
_mode = _setMode;
_redawOSD = false;
_setPalette = true;
_offScreenH = NULL;
_screenH = NULL;
@ -63,6 +65,7 @@ OSystem_PalmBase::OSystem_PalmBase() {
MemSet(&_mouseCurState, sizeof(_mouseCurState), 0);
MemSet(&_mouseOldState, sizeof(_mouseOldState), 0);
MemSet(&_timer, sizeof(TimerType), 0);
MemSet(&_sound, sizeof(SoundType), 0);
}
void OSystem_PalmBase::initBackend() {
@ -101,3 +104,10 @@ void OSystem_PalmBase::setTimerCallback(TimerProc callback, int timer) {
_timer.active = false;
}
}
void OSystem_PalmBase::quit() {
int_quit();
clearSoundCallback();
unload_gfx_mode();
exit(0);
}

View File

@ -1,7 +1,7 @@
/* ScummVM - Scumm Interpreter
* Copyright (C) 2001 Ludvig Strigeus
* Copyright (C) 2001-2006 The ScummVM project
* Copyright (C) 2002-2005 Chris Apers - PalmOS Backend
* Copyright (C) 2002-2006 Chris Apers - PalmOS Backend
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -17,15 +17,14 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* $Header$
* $URL$
* $Id$
*
*/
#ifndef BE_BASE_H
#define BE_BASE_H
#define ALLOW_ACCESS_TO_INTERNALS_OF_BITMAPS
#include "common/stdafx.h"
#include "common/scummsys.h"
#include "common/system.h"
@ -51,11 +50,17 @@ enum {
#define kDrawFight 3030
typedef struct {
uint32 duration, nextExpiry;
bool active;
UInt32 duration, nextExpiry;
Boolean active;
OSystem::TimerProc callback;
} TimerType, *TimerPtr;
typedef struct {
Boolean active;
void *proc;
void *param;
} SoundType, *SoundPtr;
extern "C" void SysEventGet(EventType *, Int32);
class OSystem_PalmBase : public OSystem {
@ -83,7 +88,7 @@ private:
void battery_handler();
virtual void get_coordinates(EventPtr ev, Coord &x, Coord &y) = 0;
void simulate_mouse(Event &event, Int8 iHoriz, Int8 iVert, Coord *xr, Coord *yr);
virtual void sound_handler() {};
virtual void sound_handler() = 0;
protected:
virtual void draw_osd(UInt16 id, Int32 x, Int32 y, Boolean show, UInt8 color = 0);
@ -105,6 +110,7 @@ protected:
};
TimerType _timer;
SoundType _sound;
RGBColorType _currentPalette[256];
uint _paletteDirtyStart, _paletteDirtyEnd;
@ -125,7 +131,7 @@ protected:
int _new_shake_pos;
Boolean _overlayVisible;
Boolean _redawOSD;
Boolean _redawOSD, _setPalette;
UInt32 _keyMouseMask;
struct {
@ -222,22 +228,22 @@ public:
virtual void setTimerCallback(TimerProc callback, int interval);
MutexRef createMutex() { return NULL; }
void lockMutex(MutexRef mutex) {}
void unlockMutex(MutexRef mutex) {}
void deleteMutex(MutexRef mutex) {}
virtual MutexRef createMutex() { return NULL; }
virtual void lockMutex(MutexRef mutex) {}
virtual void unlockMutex(MutexRef mutex) {}
virtual void deleteMutex(MutexRef mutex) {}
virtual bool setSoundCallback(SoundProc proc, void *param) = 0;
virtual void clearSoundCallback() = 0;
int getOutputSampleRate() const { return _samplesPerSec; }
bool openCD(int drive) { return true;};
bool pollCD() { return true;};
bool openCD(int drive) { return false;};
bool pollCD() { return false;};
void playCD(int track, int num_loops, int start_frame, int duration) {};
void stopCD() {};
void updateCD() {};
void quit() { int_quit(); }
void quit();
virtual void setWindowCaption(const char *caption) = 0;
Common::SaveFileManager *getSavefileManager();