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.
|
2005-08-16 17:15:37 +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.
|
|
|
|
|
|
|
|
* 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.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2005-08-16 17:15:37 +00:00
|
|
|
*
|
2006-02-11 12:47:47 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2005-08-16 17:15:37 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2009-08-17 12:57:37 +00:00
|
|
|
#ifndef OSYS_PSP_H
|
|
|
|
#define OSYS_PSP_H
|
|
|
|
|
2005-08-16 17:15:37 +00:00
|
|
|
#include "common/scummsys.h"
|
2007-06-20 19:11:36 +00:00
|
|
|
#include "graphics/surface.h"
|
2009-01-24 19:33:18 +00:00
|
|
|
#include "graphics/colormasks.h"
|
2008-07-08 17:20:26 +00:00
|
|
|
#include "sound/mixer_intern.h"
|
2009-01-30 03:35:47 +00:00
|
|
|
#include "backends/base-backend.h"
|
2008-03-19 11:07:27 +00:00
|
|
|
#include "backends/fs/psp/psp-fs-factory.h"
|
2009-11-24 10:33:30 +00:00
|
|
|
#include "backends/platform/psp/pspkeyboard.h"
|
2008-03-19 11:07:27 +00:00
|
|
|
|
2005-08-16 17:15:37 +00:00
|
|
|
#include <SDL.h>
|
|
|
|
|
2009-03-25 21:58:16 +00:00
|
|
|
#include <pspctrl.h>
|
|
|
|
|
2005-08-16 17:15:37 +00:00
|
|
|
enum GraphicModeID {
|
|
|
|
CENTERED_320X200,
|
|
|
|
CENTERED_435X272,
|
|
|
|
STRETCHED_480X272,
|
|
|
|
CENTERED_362X272
|
|
|
|
};
|
|
|
|
|
2009-01-30 03:35:47 +00:00
|
|
|
class OSystem_PSP : public BaseBackend {
|
2005-08-16 17:15:37 +00:00
|
|
|
public:
|
|
|
|
static const OSystem::GraphicsMode s_supportedGraphicsModes[];
|
|
|
|
static OSystem *instance();
|
|
|
|
|
|
|
|
protected:
|
2009-08-21 22:30:35 +00:00
|
|
|
struct Vertex {
|
|
|
|
float u,v;
|
|
|
|
float x,y,z;
|
|
|
|
};
|
|
|
|
|
2005-08-16 17:15:37 +00:00
|
|
|
uint16 _screenWidth;
|
|
|
|
uint16 _screenHeight;
|
2006-05-29 17:40:31 +00:00
|
|
|
uint16 _overlayWidth;
|
|
|
|
uint16 _overlayHeight;
|
2005-08-16 17:15:37 +00:00
|
|
|
byte *_offscreen;
|
|
|
|
OverlayColor *_overlayBuffer;
|
|
|
|
uint16 _palette[256];
|
|
|
|
bool _overlayVisible;
|
|
|
|
uint32 _shakePos;
|
2009-08-19 16:23:44 +00:00
|
|
|
uint32 _lastScreenUpdate;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-06-19 22:39:59 +00:00
|
|
|
Graphics::Surface _framebuffer;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2005-08-16 17:15:37 +00:00
|
|
|
bool _mouseVisible;
|
|
|
|
int _mouseX, _mouseY;
|
|
|
|
int _mouseWidth, _mouseHeight;
|
|
|
|
int _mouseHotspotX, _mouseHotspotY;
|
|
|
|
byte _mouseKeyColour;
|
|
|
|
byte *_mouseBuf;
|
2009-08-18 18:06:50 +00:00
|
|
|
bool _cursorPaletteDisabled;
|
2005-08-16 17:15:37 +00:00
|
|
|
|
2009-08-21 22:30:35 +00:00
|
|
|
int _graphicMode;
|
|
|
|
unsigned short* _clut;
|
2009-11-24 10:33:30 +00:00
|
|
|
PSPKeyboard *_keyboard;
|
2009-08-21 22:30:35 +00:00
|
|
|
|
2005-08-16 17:15:37 +00:00
|
|
|
uint32 _prevButtons;
|
|
|
|
uint32 _lastPadCheck;
|
|
|
|
uint32 _padAccel;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2005-08-16 17:15:37 +00:00
|
|
|
uint32 _samplesPerSec;
|
|
|
|
SceCtrlData pad;
|
2007-02-11 11:24:37 +00:00
|
|
|
|
|
|
|
Common::SaveFileManager *_savefile;
|
2008-07-08 17:20:26 +00:00
|
|
|
Audio::MixerImpl *_mixer;
|
2007-02-11 11:24:37 +00:00
|
|
|
Common::TimerManager *_timer;
|
|
|
|
|
2005-08-16 17:15:37 +00:00
|
|
|
public:
|
|
|
|
OSystem_PSP();
|
|
|
|
virtual ~OSystem_PSP();
|
|
|
|
|
2007-02-11 11:24:37 +00:00
|
|
|
virtual void initBackend();
|
|
|
|
|
2005-08-16 17:15:37 +00:00
|
|
|
virtual bool hasFeature(Feature f);
|
|
|
|
virtual void setFeatureState(Feature f, bool enable);
|
|
|
|
virtual bool getFeatureState(Feature f);
|
2009-08-21 22:44:49 +00:00
|
|
|
|
2005-08-16 17:15:37 +00:00
|
|
|
virtual const GraphicsMode *getSupportedGraphicsModes() const;
|
|
|
|
virtual int getDefaultGraphicsMode() const;
|
|
|
|
virtual bool setGraphicsMode(int mode);
|
|
|
|
bool setGraphicsMode(const char *name);
|
|
|
|
virtual int getGraphicsMode() const;
|
2009-08-21 22:44:49 +00:00
|
|
|
|
2009-08-21 19:11:02 +00:00
|
|
|
virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format);
|
2005-08-16 17:15:37 +00:00
|
|
|
virtual int16 getWidth();
|
2006-05-29 17:40:31 +00:00
|
|
|
virtual int16 getHeight();
|
2009-08-21 22:44:49 +00:00
|
|
|
|
2005-08-16 17:15:37 +00:00
|
|
|
virtual void setPalette(const byte *colors, uint start, uint num);
|
2009-08-21 22:44:49 +00:00
|
|
|
virtual void grabPalette(byte *colors, uint start, uint num);
|
2009-08-21 22:30:35 +00:00
|
|
|
virtual void setCursorPalette(const byte *colors, uint start, uint num);
|
|
|
|
virtual void disableCursorPalette(bool disable);
|
2005-08-16 17:15:37 +00:00
|
|
|
virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
|
2007-06-19 22:39:59 +00:00
|
|
|
virtual Graphics::Surface *lockScreen();
|
|
|
|
virtual void unlockScreen();
|
2005-08-16 17:15:37 +00:00
|
|
|
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();
|
2009-02-18 13:28:52 +00:00
|
|
|
virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<4444>(); }
|
2007-02-11 11:24:37 +00:00
|
|
|
|
2005-08-16 17:15:37 +00:00
|
|
|
virtual bool showMouse(bool visible);
|
|
|
|
virtual void warpMouse(int x, int y);
|
2009-08-21 19:11:02 +00:00
|
|
|
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format);
|
2005-08-16 17:15:37 +00:00
|
|
|
|
2007-03-17 19:02:05 +00:00
|
|
|
virtual bool pollEvent(Common::Event &event);
|
2009-08-21 22:30:35 +00:00
|
|
|
virtual bool processInput(Common::Event &event);
|
2009-08-21 22:44:49 +00:00
|
|
|
|
2005-08-16 17:15:37 +00:00
|
|
|
virtual uint32 getMillis();
|
|
|
|
virtual void delayMillis(uint msecs);
|
|
|
|
|
2007-02-11 11:24:37 +00:00
|
|
|
typedef int (*TimerProc)(int interval);
|
2005-08-16 17:15:37 +00:00
|
|
|
virtual void setTimerCallback(TimerProc callback, int interval);
|
|
|
|
|
|
|
|
virtual MutexRef createMutex(void);
|
|
|
|
virtual void lockMutex(MutexRef mutex);
|
|
|
|
virtual void unlockMutex(MutexRef mutex);
|
|
|
|
virtual void deleteMutex(MutexRef mutex);
|
|
|
|
|
2008-07-08 17:20:26 +00:00
|
|
|
static void mixCallback(void *sys, byte *samples, int len);
|
|
|
|
virtual void setupMixer(void);
|
2005-08-16 17:15:37 +00:00
|
|
|
|
2007-02-11 11:24:37 +00:00
|
|
|
Common::SaveFileManager *getSavefileManager() { return _savefile; }
|
|
|
|
Audio::Mixer *getMixer() { return _mixer; }
|
|
|
|
Common::TimerManager *getTimerManager() { return _timer; }
|
2008-03-19 11:07:27 +00:00
|
|
|
FilesystemFactory *getFilesystemFactory() { return &PSPFilesystemFactory::instance(); }
|
2009-10-08 19:41:38 +00:00
|
|
|
void getTimeAndDate(TimeDate &t) const;
|
2007-02-11 11:24:37 +00:00
|
|
|
|
2005-08-16 17:15:37 +00:00
|
|
|
virtual void quit();
|
|
|
|
|
2009-01-23 03:30:40 +00:00
|
|
|
virtual Common::SeekableReadStream *createConfigReadStream();
|
|
|
|
virtual Common::WriteStream *createConfigWriteStream();
|
2005-08-16 17:15:37 +00:00
|
|
|
};
|
|
|
|
|
2009-08-17 12:57:37 +00:00
|
|
|
|
|
|
|
#endif /* OSYS_PSP_H */
|