ScummVM API documentation
osys_psp.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef OSYS_PSP_H
23#define OSYS_PSP_H
24
25#include "common/scummsys.h"
26#include "graphics/surface.h"
27#include "graphics/paletteman.h"
28#include "audio/mixer_intern.h"
29#include "backends/base-backend.h"
30#include "backends/fs/psp/psp-fs-factory.h"
31
32#include "backends/platform/psp/display_client.h"
33#include "backends/platform/psp/default_display_client.h"
34#include "backends/platform/psp/cursor.h"
35#include "backends/platform/psp/pspkeyboard.h"
36#include "backends/platform/psp/image_viewer.h"
37#include "backends/platform/psp/display_manager.h"
38#include "backends/platform/psp/input.h"
39#include "backends/platform/psp/audio.h"
40#include "backends/platform/psp/thread.h"
41
42class OSystem_PSP : virtual public BaseBackend, public Common::EventSource, public PaletteManager {
43private:
44
45 Audio::MixerImpl *_mixer;
46 bool _pendingUpdate; // save an update we couldn't perform
47 uint32 _pendingUpdateCounter; // prevent checking for pending update too often, in a cheap way
48
49 // All needed sub-members
50 Screen _screen;
51 Overlay _overlay;
52 Cursor _cursor;
53 DisplayManager _displayManager;
54 PSPKeyboard _keyboard;
55 InputHandler _inputHandler;
56 PspAudio _audio;
57 ImageViewer _imageViewer;
58
59public:
60 OSystem_PSP() : _mixer(0), _pendingUpdate(false), _pendingUpdateCounter(0) {}
62
63 static OSystem *instance();
64
66
67 // Feature related
69 void setFeatureState(Feature f, bool enable);
71
72 // Graphics related
75 bool setGraphicsMode(int mode, uint flags);
76 int getGraphicsMode() const;
77#ifdef USE_RGB_COLOR
78 virtual Graphics::PixelFormat getScreenFormat() const;
79 virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const;
80#endif
81
82 // Screen size
83 void initSize(uint width, uint height, const Graphics::PixelFormat *format);
84 int16 getWidth();
85 int16 getHeight();
86
87 // Palette related
89protected:
90 // PaletteManager API
91 void setPalette(const byte *colors, uint start, uint num);
92 void grabPalette(byte *colors, uint start, uint num) const;
93public:
94 void setCursorPalette(const byte *colors, uint start, uint num);
95
96 // Screen related
97 void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h);
101 void setShakePos(int shakeXOffset, int shakeYOffset);
102
103 // Overlay related
104 void showOverlay(bool inGUI);
106 bool isOverlayVisible() const;
109 void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h);
110 int16 getOverlayHeight() const;
111 int16 getOverlayWidth() const;
112 Graphics::PixelFormat getOverlayFormat() const { return Graphics::PixelFormat(2, 4, 4, 4, 4, 0, 4, 8, 12); }
113
114 // Mouse related
115 bool showMouse(bool visible);
116 void warpMouse(int x, int y);
117 void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, const Graphics::PixelFormat *format, const byte *mask, frac_t scaleX, frac_t scaleY);
118
119 // Events and input
121 bool processInput(Common::Event &event);
122
123 // Time
124 uint32 getMillis(bool skipRecord = false);
125 void delayMillis(uint msecs);
126
127 // Mutex
129
130 // Sound
131 static void mixCallback(void *sys, byte *samples, int len);
132 void setupMixer(void);
133 Audio::Mixer *getMixer() { return _mixer; }
134
135 // Misc
136 FilesystemFactory *getFilesystemFactory() { return &PSPFilesystemFactory::instance(); }
137 void getTimeAndDate(TimeDate &td, bool skipRecord = false) const;
138 virtual void engineDone();
139
140 void quit();
141
142 void logMessage(LogMessageType::Type type, const char *message);
143
145};
146
147#endif /* OSYS_PSP_H */
Definition: mixer.h:70
Definition: mixer_intern.h:58
Definition: base-backend.h:31
Definition: events.h:278
Definition: list.h:44
Definition: mutex.h:40
Definition: path.h:52
Definition: display_manager.h:103
Definition: fs-factory.h:31
Definition: image_viewer.h:29
Definition: input.h:165
Definition: osys_psp.h:42
Common::MutexInternal * createMutex(void)
void initBackend()
void unlockScreen()
void showOverlay(bool inGUI)
int16 getHeight()
uint32 getMillis(bool skipRecord=false)
void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h)
bool getFeatureState(Feature f)
Graphics::Surface * lockScreen()
bool isOverlayVisible() const
void setShakePos(int shakeXOffset, int shakeYOffset)
int getDefaultGraphicsMode() const
int16 getWidth()
bool showMouse(bool visible)
Graphics::PixelFormat getOverlayFormat() const
Definition: osys_psp.h:112
void setCursorPalette(const byte *colors, uint start, uint num)
void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h)
void getTimeAndDate(TimeDate &td, bool skipRecord=false) const
int getGraphicsMode() const
bool pollEvent(Common::Event &event)
void hideOverlay()
PaletteManager * getPaletteManager()
Definition: osys_psp.h:88
void setPalette(const byte *colors, uint start, uint num)
FilesystemFactory * getFilesystemFactory()
Definition: osys_psp.h:136
const GraphicsMode * getSupportedGraphicsModes() const
bool hasFeature(Feature f)
void grabOverlay(Graphics::Surface &surface)
void logMessage(LogMessageType::Type type, const char *message)
void updateScreen()
virtual void engineDone()
void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, const Graphics::PixelFormat *format, const byte *mask, frac_t scaleX, frac_t scaleY)
int16 getOverlayWidth() const
void warpMouse(int x, int y)
bool setGraphicsMode(int mode, uint flags)
Audio::Mixer * getMixer()
Definition: osys_psp.h:133
int16 getOverlayHeight() const
void delayMillis(uint msecs)
virtual Common::Path getDefaultConfigFileName()
void grabPalette(byte *colors, uint start, uint num) const
void clearOverlay()
void setFeatureState(Feature f, bool enable)
void initSize(uint width, uint height, const Graphics::PixelFormat *format)
Definition: system.h:166
Definition: default_display_client.h:68
Definition: pspkeyboard.h:37
Definition: paletteman.h:47
Definition: audio.h:27
int32 frac_t
Definition: frac.h:52
Feature
Definition: system.h:415
Type
Definition: log.h:33
Definition: events.h:218
Definition: atari-cursor.h:35
Definition: pixelformat.h:138
Definition: surface.h:67
Definition: system.h:741
Definition: atari-screen.h:58
Definition: system.h:111