ScummVM API documentation
osystem.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 _WII_OSYSTEM_H_
23#define _WII_OSYSTEM_H_
24
25#include <gctypes.h>
26#include <gccore.h>
27
28#include <gxflux/gfx.h>
29
30#include "base/main.h"
31#include "common/fs.h"
32#include "common/rect.h"
33#include "common/events.h"
34#include "backends/base-backend.h"
35#include "graphics/blit.h"
36#include "graphics/paletteman.h"
37#include "graphics/surface.h"
38#include "audio/mixer_intern.h"
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44extern bool reset_btn_pressed;
45extern bool power_btn_pressed;
46
47#ifdef DEBUG_WII_MEMSTATS
48extern void wii_memstats(void);
49#endif
50
51#ifdef __cplusplus
52}
53#endif
54
55class OSystem_Wii final : virtual public BaseBackend, public Common::EventSource, public PaletteManager {
56private:
57 s64 _startup_time;
58
59 float _cursorScaleX;
60 float _cursorScaleY;
61 bool _cursorPaletteDisabled;
62 u16 *_cursorPalette;
63 bool _cursorPaletteDirty;
64
65 bool _gameRunning;
66 u16 _gameWidth, _gameHeight;
67 u8 *_gamePixels, *_gamePixelsTexture;
68 Graphics::Surface _surface;
69 gfx_screen_coords_t _coordsGame;
70 gfx_tex_t _texGame;
71 bool _gameDirty;
72
73 bool _overlayVisible;
74 u16 _overlayWidth, _overlayHeight;
75 u32 _overlaySize;
76 uint16 *_overlayPixels;
77 gfx_screen_coords_t _coordsOverlay;
78 gfx_tex_t _texOverlay;
79 bool _overlayDirty;
80 bool _overlayInGUI;
81
82 Graphics::FastBlitFunc _blitFunc;
83 u32 _lastScreenUpdate;
84 u16 _currentWidth, _currentHeight;
85 f32 _currentXScale, _currentYScale;
86
87 s32 _configGraphicsMode;
88 s32 _actualGraphicsMode;
89 bool _bilinearFilter;
90 const Graphics::PixelFormat _pfRGB565;
91 const Graphics::PixelFormat _pfRGB3444;
93 Graphics::PixelFormat _pfGameTexture;
94 Graphics::PixelFormat _pfCursor;
95 Graphics::PixelFormat _pfCursorTexture;
96
97 bool _consoleVisible;
98 bool _optionsDlgActive;
99 bool _fullscreen;
100 bool _arCorrection;
101
102 bool _mouseVisible;
103 s32 _mouseX, _mouseY;
104 s32 _mouseHotspotX, _mouseHotspotY;
105 uint32 _mouseKeyColor;
106 gfx_tex_t _texMouse;
107
108 bool _kbd_active;
109
110 bool _event_quit;
111
112 u32 _lastPadCheck;
113 u8 _padSensitivity;
114 u8 _padAcceleration;
115
116 void initGfx();
117 void deinitGfx();
118 void updateScreenResolution();
119 void switchVideoMode(int mode);
120 bool needsScreenUpdate();
121 void updateMousePalette();
122
123 void initSfx();
124 void deinitSfx();
125
126 void initEvents();
127 void deinitEvents();
128 void updateEventScreenResolution();
129 bool pollKeyboard(Common::Event &event);
130
131 void showOptionsDialog();
132
133protected:
134 Audio::MixerImpl *_mixer;
135
136public:
137 enum {
138 gmStandard = 0,
139 gmStandardFiltered,
140 gmDoubleStrike,
141 gmDoubleStrikeFiltered
142 };
143
144 OSystem_Wii();
145 virtual ~OSystem_Wii();
146
147 void initBackend() override;
148 void engineInit() override;
149 void engineDone() override;
150
151 bool hasFeature(Feature f) override;
152 void setFeatureState(Feature f, bool enable) override;
153 bool getFeatureState(Feature f) override;
155 int getDefaultGraphicsMode() const override;
156 bool setGraphicsMode(int mode, uint flags = kGfxModeNoFlags) override;
157#ifdef USE_RGB_COLOR
158 Graphics::PixelFormat getScreenFormat() const override;
159 Common::List<Graphics::PixelFormat> getSupportedFormats() const override;
160#endif
161 int getGraphicsMode() const override;
162 virtual void initSize(uint width, uint height,
163 const Graphics::PixelFormat *format) override;
164 int16 getWidth() override;
165 int16 getHeight() override;
166
167 PaletteManager *getPaletteManager() override { return this; }
168protected:
169 void setPalette(const byte *colors, uint start, uint num) override;
170 void grabPalette(byte *colors, uint start, uint num) const override;
171public:
172 void setCursorPalette(const byte *colors, uint start, uint num) override;
173 virtual void copyRectToScreen(const void *buf, int pitch, int x, int y,
174 int w, int h) override;
175 void updateScreen() override;
177 void unlockScreen() override;
178 void setShakePos(int shakeXOffset, int shakeYOffset) override;
179
180 void showOverlay(bool inGUI) override;
181 void hideOverlay() override;
182 bool isOverlayVisible() const override { return _overlayVisible; }
183 void clearOverlay() override;
184 void grabOverlay(Graphics::Surface &surface) override;
185 virtual void copyRectToOverlay(const void *buf, int pitch,
186 int x, int y, int w, int h) override;
187 int16 getOverlayWidth() const override;
188 int16 getOverlayHeight() const override;
190
191 bool showMouse(bool visible) override;
192
193 void warpMouse(int x, int y) override;
194 virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX,
195 int hotspotY, uint32 keycolor,
196 const Graphics::PixelFormat *format, const byte *mask,
197 frac_t scaleX, frac_t scaleY) override;
198
199 bool pollEvent(Common::Event &event) override;
200 uint32 getMillis(bool skipRecord = false) override;
201 void delayMillis(uint msecs) override;
202
204
205 typedef void (*SoundProc)(void *param, byte *buf, int len);
206
207 void quit() override;
208
211 void getTimeAndDate(TimeDate &td, bool skipRecord = false) const override;
212
213 void logMessage(LogMessageType::Type type, const char *message) override;
214
215#ifndef GAMECUBE
217#endif // GAMECUBE
218};
219
220#endif
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: str.h:59
Definition: fs-factory.h:31
Definition: osystem.h:55
bool setGraphicsMode(int mode, uint flags=kGfxModeNoFlags) override
void setFeatureState(Feature f, bool enable) override
void clearOverlay() override
PaletteManager * getPaletteManager() override
Definition: osystem.h:167
void getTimeAndDate(TimeDate &td, bool skipRecord=false) const override
Graphics::Surface * lockScreen() override
Audio::Mixer * getMixer() override
int16 getOverlayHeight() const override
Graphics::PixelFormat getOverlayFormat() const override
void setShakePos(int shakeXOffset, int shakeYOffset) override
void quit() override
void unlockScreen() override
Common::MutexInternal * createMutex() override
void updateScreen() override
void delayMillis(uint msecs) override
bool hasFeature(Feature f) override
bool getFeatureState(Feature f) override
void engineInit() override
FilesystemFactory * getFilesystemFactory() override
bool isOverlayVisible() const override
Definition: osystem.h:182
void grabOverlay(Graphics::Surface &surface) override
void initBackend() override
int16 getHeight() override
const GraphicsMode * getSupportedGraphicsModes() const override
virtual 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) override
void setPalette(const byte *colors, uint start, uint num) override
int getDefaultGraphicsMode() const override
void engineDone() override
void showOverlay(bool inGUI) override
int16 getWidth() override
bool pollEvent(Common::Event &event) override
void warpMouse(int x, int y) override
void logMessage(LogMessageType::Type type, const char *message) override
int getGraphicsMode() const override
void setCursorPalette(const byte *colors, uint start, uint num) override
bool showMouse(bool visible) override
virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) override
void grabPalette(byte *colors, uint start, uint num) const override
void hideOverlay() override
virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) override
uint32 getMillis(bool skipRecord=false) override
Common::String getSystemLanguage() const override
virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format) override
int16 getOverlayWidth() const override
Definition: paletteman.h:47
int32 frac_t
Definition: frac.h:52
Feature
Definition: system.h:415
@ kGfxModeNoFlags
Definition: system.h:790
Type
Definition: log.h:33
Definition: events.h:218
Definition: pixelformat.h:138
Definition: surface.h:67
Definition: system.h:741
Definition: system.h:111