2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2006-07-09 11:47:17 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2010-07-05 16:11:11 +00:00
|
|
|
|
2006-07-09 11:47:17 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2010-07-05 16:11:11 +00:00
|
|
|
|
2006-07-09 11:47:17 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2010-07-05 16:11:11 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
2006-07-09 11:47:17 +00:00
|
|
|
*/
|
2009-01-01 15:06:43 +00:00
|
|
|
|
|
|
|
|
2006-07-09 11:47:17 +00:00
|
|
|
#ifndef _OSYSTEM_DS_H_
|
|
|
|
#define _OSYSTEM_DS_H_
|
2009-01-30 03:35:47 +00:00
|
|
|
|
|
|
|
#include "backends/base-backend.h"
|
2007-04-06 18:34:53 +00:00
|
|
|
#include "common/events.h"
|
2006-07-09 11:47:17 +00:00
|
|
|
#include "nds.h"
|
|
|
|
#include "gbampsave.h"
|
2006-10-25 19:18:38 +00:00
|
|
|
#include "backends/saves/default/default-saves.h"
|
2011-02-09 01:09:01 +00:00
|
|
|
#include "audio/mixer_intern.h"
|
2007-08-18 11:10:41 +00:00
|
|
|
#include "graphics/surface.h"
|
2009-01-23 02:44:30 +00:00
|
|
|
#include "graphics/colormasks.h"
|
2011-04-28 22:19:35 +03:00
|
|
|
#include "graphics/palette.h"
|
2006-10-25 19:18:38 +00:00
|
|
|
|
2011-02-07 17:52:38 +00:00
|
|
|
class OSystem_DS : public BaseBackend, public PaletteManager {
|
2007-12-21 18:36:40 +00:00
|
|
|
protected:
|
2007-06-30 23:03:03 +00:00
|
|
|
|
2006-07-09 11:47:17 +00:00
|
|
|
int eventNum;
|
|
|
|
int lastPenFrame;
|
2009-01-01 15:06:43 +00:00
|
|
|
|
2007-06-30 23:03:03 +00:00
|
|
|
Common::Event eventQueue[96];
|
2006-07-09 11:47:17 +00:00
|
|
|
int queuePos;
|
2009-01-01 15:06:43 +00:00
|
|
|
|
2006-07-09 11:47:17 +00:00
|
|
|
GBAMPSaveFileManager mpSaveManager;
|
2010-07-05 16:10:22 +00:00
|
|
|
Audio::MixerImpl *_mixer;
|
2007-08-18 11:10:41 +00:00
|
|
|
Graphics::Surface _framebuffer;
|
2007-12-21 18:36:40 +00:00
|
|
|
bool _frameBufferExists;
|
2008-09-15 22:43:20 +00:00
|
|
|
bool _graphicsEnable;
|
2006-11-03 23:16:29 +00:00
|
|
|
|
2010-07-05 16:10:22 +00:00
|
|
|
static OSystem_DS *_instance;
|
2008-09-15 22:43:20 +00:00
|
|
|
|
|
|
|
u16 _palette[256];
|
|
|
|
u16 _cursorPalette[256];
|
|
|
|
|
|
|
|
u8 _cursorImage[64 * 64];
|
|
|
|
uint _cursorW;
|
|
|
|
uint _cursorH;
|
|
|
|
int _cursorHotX;
|
|
|
|
int _cursorHotY;
|
|
|
|
byte _cursorKey;
|
|
|
|
int _cursorScale;
|
|
|
|
|
2009-01-01 15:06:43 +00:00
|
|
|
|
2010-07-05 16:10:22 +00:00
|
|
|
Graphics::Surface *createTempFrameBuffer();
|
2008-09-15 22:43:20 +00:00
|
|
|
bool _disableCursorPalette;
|
2006-07-09 11:47:17 +00:00
|
|
|
|
2009-09-27 22:42:21 +00:00
|
|
|
int _gammaValue;
|
|
|
|
|
2006-07-09 11:47:17 +00:00
|
|
|
public:
|
2008-07-09 16:50:23 +00:00
|
|
|
typedef void (*SoundProc)(byte *buf, int len);
|
2007-12-21 18:36:40 +00:00
|
|
|
typedef int (*TimerProc)(int interval);
|
2006-07-09 11:47:17 +00:00
|
|
|
|
|
|
|
OSystem_DS();
|
|
|
|
virtual ~OSystem_DS();
|
|
|
|
|
2007-12-21 18:36:40 +00:00
|
|
|
static OSystem_DS *instance() { return _instance; }
|
|
|
|
|
2006-07-09 11:47:17 +00:00
|
|
|
virtual bool hasFeature(Feature f);
|
|
|
|
virtual void setFeatureState(Feature f, bool enable);
|
|
|
|
virtual bool getFeatureState(Feature f);
|
|
|
|
virtual const GraphicsMode *getSupportedGraphicsModes() const;
|
|
|
|
virtual int getDefaultGraphicsMode() const;
|
|
|
|
virtual bool setGraphicsMode(int mode);
|
|
|
|
bool setGraphicsMode(const char *name);
|
|
|
|
virtual int getGraphicsMode() const;
|
2009-09-27 16:06:06 +00:00
|
|
|
virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format);
|
2006-07-09 11:47:17 +00:00
|
|
|
virtual int16 getHeight();
|
|
|
|
virtual int16 getWidth();
|
2011-02-07 17:52:38 +00:00
|
|
|
|
|
|
|
virtual PaletteManager *getPaletteManager() { return this; }
|
|
|
|
protected:
|
|
|
|
// PaletteManager API
|
2006-07-09 11:47:17 +00:00
|
|
|
virtual void setPalette(const byte *colors, uint start, uint num);
|
2011-02-07 17:52:38 +00:00
|
|
|
virtual void grabPalette(byte *colors, uint start, uint num);
|
|
|
|
|
|
|
|
public:
|
2009-03-19 09:51:40 +00:00
|
|
|
void restoreHardwarePalette();
|
2006-07-09 11:47:17 +00:00
|
|
|
|
|
|
|
virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
|
|
|
|
virtual void updateScreen();
|
|
|
|
virtual void setShakePos(int shakeOffset);
|
|
|
|
|
|
|
|
virtual void showOverlay();
|
|
|
|
virtual void hideOverlay();
|
|
|
|
virtual void clearOverlay();
|
|
|
|
virtual void grabOverlay(OverlayColor *buf, int pitch);
|
|
|
|
virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
|
|
|
|
virtual int16 getOverlayHeight();
|
|
|
|
virtual int16 getOverlayWidth();
|
2008-11-06 15:02:50 +00:00
|
|
|
virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<1555>(); }
|
2009-01-01 15:06:43 +00:00
|
|
|
|
2006-07-09 11:47:17 +00:00
|
|
|
virtual bool showMouse(bool visible);
|
|
|
|
|
|
|
|
virtual void warpMouse(int x, int y);
|
2009-09-27 16:06:06 +00:00
|
|
|
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, u32 keycolor, int targetCursorScale, const Graphics::PixelFormat *format);
|
2006-07-09 11:47:17 +00:00
|
|
|
|
2007-03-17 19:02:05 +00:00
|
|
|
virtual bool pollEvent(Common::Event &event);
|
2006-07-09 11:47:17 +00:00
|
|
|
virtual uint32 getMillis();
|
|
|
|
virtual void delayMillis(uint msecs);
|
2009-10-08 19:41:38 +00:00
|
|
|
virtual void getTimeAndDate(TimeDate &t) const;
|
2006-07-09 11:47:17 +00:00
|
|
|
|
|
|
|
virtual MutexRef createMutex(void);
|
|
|
|
virtual void lockMutex(MutexRef mutex);
|
|
|
|
virtual void unlockMutex(MutexRef mutex);
|
|
|
|
virtual void deleteMutex(MutexRef mutex);
|
|
|
|
|
2010-11-18 13:17:25 +00:00
|
|
|
|
|
|
|
// FIXME/TODO: The CD API as follows is *obsolete*
|
|
|
|
// and should be replaced by an AudioCDManager subclass,
|
|
|
|
// see backends/audiocd/ and common/system.h
|
2006-07-09 11:47:17 +00:00
|
|
|
virtual bool openCD(int drive);
|
|
|
|
virtual bool pollCD();
|
|
|
|
virtual void playCD(int track, int num_loops, int start_frame, int duration);
|
|
|
|
virtual void stopCD();
|
|
|
|
virtual void updateCD();
|
|
|
|
|
|
|
|
virtual void quit();
|
|
|
|
|
2010-07-05 16:09:27 +00:00
|
|
|
void addEvent(const Common::Event& e);
|
|
|
|
bool isEventQueueEmpty() const { return queuePos == 0; }
|
2009-01-01 15:06:43 +00:00
|
|
|
|
2010-07-05 16:10:22 +00:00
|
|
|
virtual bool grabRawScreen(Graphics::Surface *surf);
|
2009-01-01 15:06:43 +00:00
|
|
|
|
2006-07-09 11:47:17 +00:00
|
|
|
virtual void setFocusRectangle(const Common::Rect& rect);
|
2009-01-01 15:06:43 +00:00
|
|
|
|
2006-07-09 11:47:17 +00:00
|
|
|
virtual void clearFocusRectangle();
|
2009-01-01 15:06:43 +00:00
|
|
|
|
2006-07-09 11:47:17 +00:00
|
|
|
virtual void initBackend();
|
2009-01-01 15:06:43 +00:00
|
|
|
|
2007-08-18 11:10:41 +00:00
|
|
|
virtual Graphics::Surface *lockScreen();
|
|
|
|
virtual void unlockScreen();
|
2009-01-01 15:06:43 +00:00
|
|
|
|
2010-07-05 16:10:22 +00:00
|
|
|
virtual Audio::Mixer *getMixer() { return _mixer; }
|
|
|
|
Audio::MixerImpl *getMixerImpl() { return _mixer; }
|
2008-07-09 16:50:23 +00:00
|
|
|
|
2006-11-03 23:16:29 +00:00
|
|
|
static int timerHandler(int t);
|
2007-06-30 23:03:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
virtual void addAutoComplete(const char *word);
|
|
|
|
virtual void clearAutoComplete();
|
|
|
|
virtual void setCharactersEntered(int count);
|
|
|
|
|
2010-07-05 16:09:27 +00:00
|
|
|
u16 getDSPaletteEntry(u32 entry) const { return _palette[entry]; }
|
|
|
|
u16 getDSCursorPaletteEntry(u32 entry) const { return !_disableCursorPalette? _cursorPalette[entry]: _palette[entry]; }
|
2008-09-15 22:43:20 +00:00
|
|
|
|
|
|
|
virtual void setCursorPalette(const byte *colors, uint start, uint num);
|
|
|
|
|
2011-06-06 10:55:28 +02:00
|
|
|
virtual FilesystemFactory *getFilesystemFactory();
|
2008-09-15 22:43:20 +00:00
|
|
|
|
|
|
|
void refreshCursor();
|
2009-09-27 22:42:21 +00:00
|
|
|
|
2011-06-06 15:30:21 +02:00
|
|
|
virtual Common::String getDefaultConfigFileName();
|
2009-09-27 22:42:21 +00:00
|
|
|
|
2011-06-06 10:55:28 +02:00
|
|
|
virtual void logMessage(LogMessageType::Type type, const char *message);
|
|
|
|
|
2011-04-14 14:12:27 +02:00
|
|
|
u16 applyGamma(u16 color);
|
2009-09-27 22:42:21 +00:00
|
|
|
void setGammaValue(int gamma) { _gammaValue = gamma; }
|
|
|
|
|
|
|
|
void engineDone();
|
2006-07-09 11:47:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
|
|
|
|
{0, 0, 0},
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|