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"
|
2010-10-14 13:19:32 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
#include "backends/platform/psp/display_client.h"
|
|
|
|
#include "backends/platform/psp/default_display_client.h"
|
|
|
|
#include "backends/platform/psp/cursor.h"
|
2009-11-24 10:33:30 +00:00
|
|
|
#include "backends/platform/psp/pspkeyboard.h"
|
2010-10-14 13:19:32 +00:00
|
|
|
#include "backends/platform/psp/image_viewer.h"
|
2010-04-12 06:49:05 +00:00
|
|
|
#include "backends/platform/psp/display_manager.h"
|
|
|
|
#include "backends/platform/psp/input.h"
|
2010-05-23 05:51:32 +00:00
|
|
|
#include "backends/platform/psp/audio.h"
|
2010-05-24 03:05:17 +00:00
|
|
|
#include "backends/timer/psp/timer.h"
|
2010-06-07 13:47:27 +00:00
|
|
|
#include "backends/platform/psp/thread.h"
|
2008-03-19 11:07:27 +00:00
|
|
|
|
2009-01-30 03:35:47 +00:00
|
|
|
class OSystem_PSP : public BaseBackend {
|
2010-04-12 06:49:05 +00:00
|
|
|
private:
|
2010-04-12 07:28:54 +00:00
|
|
|
|
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;
|
2010-06-09 14:15:51 +00:00
|
|
|
bool _pendingUpdate; // save an update we couldn't perform
|
|
|
|
uint32 _pendingUpdateCounter; // prevent checking for pending update too often, in a cheap way
|
2007-02-11 11:24:37 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
// All needed sub-members
|
|
|
|
Screen _screen;
|
|
|
|
Overlay _overlay;
|
|
|
|
Cursor _cursor;
|
|
|
|
DisplayManager _displayManager;
|
|
|
|
PSPKeyboard _keyboard;
|
|
|
|
InputHandler _inputHandler;
|
2010-05-23 05:51:32 +00:00
|
|
|
PspAudio _audio;
|
2010-05-23 11:48:21 +00:00
|
|
|
PspTimer _pspTimer;
|
2010-10-14 13:19:32 +00:00
|
|
|
ImageViewer _imageViewer;
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
public:
|
2010-06-09 14:15:51 +00:00
|
|
|
OSystem_PSP() : _savefile(0), _mixer(0), _timer(0), _pendingUpdate(false), _pendingUpdateCounter(0) {}
|
2010-04-12 06:49:05 +00:00
|
|
|
~OSystem_PSP();
|
2009-08-21 22:44:49 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
static OSystem *instance();
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
void initBackend();
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
// Feature related
|
|
|
|
bool hasFeature(Feature f);
|
|
|
|
void setFeatureState(Feature f, bool enable);
|
|
|
|
bool getFeatureState(Feature f);
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
// Graphics related
|
|
|
|
const GraphicsMode *getSupportedGraphicsModes() const;
|
|
|
|
int getDefaultGraphicsMode() const;
|
|
|
|
bool setGraphicsMode(int mode);
|
2005-08-16 17:15:37 +00:00
|
|
|
bool setGraphicsMode(const char *name);
|
2010-04-12 06:49:05 +00:00
|
|
|
int getGraphicsMode() const;
|
|
|
|
#ifdef USE_RGB_COLOR
|
|
|
|
virtual Graphics::PixelFormat getScreenFormat() const;
|
2010-06-15 12:21:08 +00:00
|
|
|
virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const;
|
2010-04-12 06:49:05 +00:00
|
|
|
#endif
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
// Screen size
|
|
|
|
void initSize(uint width, uint height, const Graphics::PixelFormat *format);
|
|
|
|
int16 getWidth();
|
|
|
|
int16 getHeight();
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
// Palette related
|
|
|
|
void setPalette(const byte *colors, uint start, uint num);
|
|
|
|
void grabPalette(byte *colors, uint start, uint num);
|
|
|
|
void setCursorPalette(const byte *colors, uint start, uint num);
|
|
|
|
void disableCursorPalette(bool disable);
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
// Screen related
|
|
|
|
void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
|
|
|
|
Graphics::Surface *lockScreen();
|
|
|
|
void unlockScreen();
|
|
|
|
void updateScreen();
|
|
|
|
void setShakePos(int shakeOffset);
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
// Overlay related
|
|
|
|
void showOverlay();
|
|
|
|
void hideOverlay();
|
|
|
|
void clearOverlay();
|
|
|
|
void grabOverlay(OverlayColor *buf, int pitch);
|
|
|
|
void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
|
|
|
|
int16 getOverlayHeight();
|
|
|
|
int16 getOverlayWidth();
|
|
|
|
Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<4444>(); }
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
// Mouse related
|
|
|
|
bool showMouse(bool visible);
|
|
|
|
void warpMouse(int x, int y);
|
|
|
|
void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format);
|
|
|
|
|
|
|
|
// Events and input
|
|
|
|
bool pollEvent(Common::Event &event);
|
|
|
|
bool processInput(Common::Event &event);
|
|
|
|
|
|
|
|
// Time
|
|
|
|
uint32 getMillis();
|
|
|
|
void delayMillis(uint msecs);
|
|
|
|
|
|
|
|
// Timer
|
2007-02-11 11:24:37 +00:00
|
|
|
typedef int (*TimerProc)(int interval);
|
2010-04-12 06:49:05 +00:00
|
|
|
void setTimerCallback(TimerProc callback, int interval);
|
|
|
|
Common::TimerManager *getTimerManager() { return _timer; }
|
2005-08-16 17:15:37 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
// Mutex
|
|
|
|
MutexRef createMutex(void);
|
|
|
|
void lockMutex(MutexRef mutex);
|
|
|
|
void unlockMutex(MutexRef mutex);
|
|
|
|
void deleteMutex(MutexRef mutex);
|
2005-08-16 17:15:37 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
// Sound
|
2008-07-08 17:20:26 +00:00
|
|
|
static void mixCallback(void *sys, byte *samples, int len);
|
2010-04-12 06:49:05 +00:00
|
|
|
void setupMixer(void);
|
2007-02-11 11:24:37 +00:00
|
|
|
Audio::Mixer *getMixer() { return _mixer; }
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
// Misc
|
|
|
|
Common::SaveFileManager *getSavefileManager() { return _savefile; }
|
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;
|
2010-10-14 22:11:17 +00:00
|
|
|
virtual void engineDone();
|
2007-02-11 11:24:37 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
void quit();
|
2005-08-16 17:15:37 +00:00
|
|
|
|
2010-11-18 19:12:14 +00:00
|
|
|
void logMessage(LogMessageType::Type type, const char *message);
|
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
Common::SeekableReadStream *createConfigReadStream();
|
|
|
|
Common::WriteStream *createConfigWriteStream();
|
2005-08-16 17:15:37 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
};
|
2009-08-17 12:57:37 +00:00
|
|
|
|
|
|
|
#endif /* OSYS_PSP_H */
|