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 
43 private:
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 
59 public:
60  OSystem_PSP() : _mixer(0), _pendingUpdate(false), _pendingUpdateCounter(0) {}
61  ~OSystem_PSP();
62 
63  static OSystem *instance();
64 
65  void initBackend();
66 
67  // Feature related
68  bool hasFeature(Feature f);
69  void setFeatureState(Feature f, bool enable);
70  bool getFeatureState(Feature f);
71 
72  // Graphics related
74  int getDefaultGraphicsMode() const;
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
88  PaletteManager *getPaletteManager() { return this; }
89 protected:
90  // PaletteManager API
91  void setPalette(const byte *colors, uint start, uint num);
92  void grabPalette(byte *colors, uint start, uint num) const;
93 public:
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);
99  void unlockScreen();
100  void updateScreen();
101  void setShakePos(int shakeXOffset, int shakeYOffset);
102 
103  // Overlay related
104  void showOverlay(bool inGUI);
105  void hideOverlay();
106  bool isOverlayVisible() const;
107  void clearOverlay();
108  void grabOverlay(Graphics::Surface &surface);
109  void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h);
110  int16 getOverlayHeight();
111  int16 getOverlayWidth();
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, bool dontScale, const Graphics::PixelFormat *format, const byte *mask);
118 
119  // Events and input
120  bool pollEvent(Common::Event &event);
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 */
Graphics::PixelFormat getOverlayFormat() const
Definition: osys_psp.h:112
void unlockScreen()
bool pollEvent(Common::Event &event)
void showOverlay(bool inGUI)
Definition: input.h:165
Definition: system.h:106
virtual void engineDone()
int16 getOverlayWidth()
Definition: surface.h:67
void getTimeAndDate(TimeDate &td, bool skipRecord=false) const
Definition: fs-factory.h:31
void grabOverlay(Graphics::Surface &surface)
void initBackend()
int getGraphicsMode() const
FilesystemFactory * getFilesystemFactory()
Definition: osys_psp.h:136
void initSize(uint width, uint height, const Graphics::PixelFormat *format)
Definition: pixelformat.h:138
void setCursorPalette(const byte *colors, uint start, uint num)
Definition: system.h:730
Feature
Definition: system.h:403
void hideOverlay()
void delayMillis(uint msecs)
Definition: list.h:44
int getDefaultGraphicsMode() const
void setPalette(const byte *colors, uint start, uint num)
void logMessage(LogMessageType::Type type, const char *message)
Definition: path.h:52
Definition: audio.h:27
Definition: atari-screen.h:60
bool showMouse(bool visible)
void setShakePos(int shakeXOffset, int shakeYOffset)
Type
Definition: log.h:33
void setFeatureState(Feature f, bool enable)
Definition: mixer_intern.h:58
void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h)
Definition: display_manager.h:103
Definition: mixer.h:59
void grabPalette(byte *colors, uint start, uint num) const
int16 getHeight()
void clearOverlay()
Audio::Mixer * getMixer()
Definition: osys_psp.h:133
Definition: atari-cursor.h:38
bool getFeatureState(Feature f)
PaletteManager * getPaletteManager()
Definition: osys_psp.h:88
Definition: events.h:199
Common::MutexInternal * createMutex(void)
void warpMouse(int x, int y)
Definition: image_viewer.h:29
Definition: base-backend.h:44
bool setGraphicsMode(int mode, uint flags)
Definition: pspkeyboard.h:37
Definition: default_display_client.h:65
const GraphicsMode * getSupportedGraphicsModes() const
Graphics::Surface * lockScreen()
bool hasFeature(Feature f)
void updateScreen()
int16 getOverlayHeight()
bool isOverlayVisible() const
virtual Common::Path getDefaultConfigFileName()
uint32 getMillis(bool skipRecord=false)
Definition: mutex.h:40
void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h)
Definition: system.h:161
Definition: paletteman.h:47
Definition: osys_psp.h:42
int16 getWidth()
void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format, const byte *mask)